diff --git a/Factor.app/Contents/Info.plist b/Factor.app/Contents/Info.plist index ca0e6d5f8a..a8943d0d32 100644 --- a/Factor.app/Contents/Info.plist +++ b/Factor.app/Contents/Info.plist @@ -32,7 +32,7 @@ CFBundlePackageType APPL NSHumanReadableCopyright - Copyright © 2003-2007, Slava Pestov and friends + Copyright © 2003-2008, Slava Pestov and friends NSServices diff --git a/build-support/factor.sh b/build-support/factor.sh index 70c522f6cd..c60ab46671 100755 --- a/build-support/factor.sh +++ b/build-support/factor.sh @@ -89,11 +89,6 @@ set_md5sum() { set_gcc() { case $OS in openbsd) ensure_program_installed egcc; CC=egcc;; - netbsd) if [[ $WORD -eq 64 ]] ; then - CC=/usr/pkg/gcc34/bin/gcc - else - CC=gcc - fi ;; *) CC=gcc;; esac } diff --git a/core/alien/alien-docs.factor b/core/alien/alien-docs.factor index 7d13080e3c..0caf0e9a9f 100755 --- a/core/alien/alien-docs.factor +++ b/core/alien/alien-docs.factor @@ -265,7 +265,7 @@ ARTICLE: "embedding-restrictions" "Embedding API restrictions" ARTICLE: "embedding-factor" "What embedding looks like from Factor" "Factor code will run inside an embedded instance in the same way it would run in a stand-alone instance." $nl -"One exception is the global " { $link stdio } " stream, which is by default not bound to the terminal where the process is running, to avoid conflicting with any I/O the host process might perform. To initialize the terminal stream, " { $link init-stdio } " must be called explicitly." +"One exception is that the global " { $link input-stream } " and " { $link output-stream } " streams are not bound by default, to avoid conflicting with any I/O the host process might perform. The " { $link init-stdio } " words must be called explicitly to initialize terminal streams." $nl "There is a word which can detect when Factor is embedded:" { $subsection embedded? } diff --git a/core/alien/c-types/c-types-docs.factor b/core/alien/c-types/c-types-docs.factor index 3cd5afef33..8da030c7d1 100755 --- a/core/alien/c-types/c-types-docs.factor +++ b/core/alien/c-types/c-types-docs.factor @@ -1,7 +1,7 @@ IN: alien.c-types USING: alien help.syntax help.markup libc kernel.private byte-arrays math strings hashtables alien.syntax -bit-arrays float-arrays debugger ; +bit-arrays float-arrays debugger destructors ; HELP: { $values { "type" hashtable } } @@ -222,6 +222,9 @@ $nl { $subsection realloc } "You must always free pointers returned by any of the above words when the block of memory is no longer in use:" { $subsection free } +"Utilities for automatically freeing memory in conjunction with " { $link with-destructors } ":" +{ $subsection &free } +{ $subsection |free } "You can unsafely copy a range of bytes from one memory location to another:" { $subsection memcpy } "You can copy a range of bytes from memory into a byte array:" diff --git a/core/alien/c-types/c-types.factor b/core/alien/c-types/c-types.factor index f67fc78259..87fa553dc3 100755 --- a/core/alien/c-types/c-types.factor +++ b/core/alien/c-types/c-types.factor @@ -5,7 +5,7 @@ assocs kernel kernel.private libc math namespaces parser sequences strings words assocs splitting math.parser cpu.architecture alien alien.accessors quotations layouts system compiler.units io.files io.encodings.binary -accessors combinators ; +accessors combinators effects ; IN: alien.c-types DEFER: @@ -214,7 +214,8 @@ M: long-long-type box-return ( type -- ) >r ">c-" swap "-array" 3append r> create ; : define-to-array ( type vocab -- ) - [ to-array-word ] 2keep >c-array-quot define ; + [ to-array-word ] 2keep >c-array-quot + (( array -- byte-array )) define-declared ; : c-array>quot ( type vocab -- quot ) [ @@ -227,7 +228,8 @@ M: long-long-type box-return ( type -- ) >r "c-" swap "-array>" 3append r> create ; : define-from-array ( type vocab -- ) - [ from-array-word ] 2keep c-array>quot define ; + [ from-array-word ] 2keep c-array>quot + (( c-ptr n -- array )) define-declared ; : define-primitive-type ( type name -- ) "alien.c-types" @@ -382,4 +384,6 @@ M: long-long-type box-return ( type -- ) "double" define-primitive-type os winnt? cpu x86.64? and "longlong" "long" ? "ptrdiff_t" typedef + + "ulong" "size_t" typedef ] with-compilation-unit diff --git a/core/alien/compiler/compiler-tests.factor b/core/alien/compiler/compiler-tests.factor index 5d847e364f..eb7652aefd 100755 --- a/core/alien/compiler/compiler-tests.factor +++ b/core/alien/compiler/compiler-tests.factor @@ -77,7 +77,7 @@ FUNCTION: tiny ffi_test_17 int x ; [ [ alien-indirect ] infer ] [ inference-error? ] must-fail-with -: indirect-test-1 +: indirect-test-1 ( ptr -- result ) "int" { } "cdecl" alien-indirect ; { 1 1 } [ indirect-test-1 ] must-infer-as @@ -86,7 +86,7 @@ FUNCTION: tiny ffi_test_17 int x ; [ -1 indirect-test-1 ] must-fail -: indirect-test-2 +: indirect-test-2 ( x y ptr -- result ) "int" { "int" "int" } "cdecl" alien-indirect gc ; { 3 1 } [ indirect-test-2 ] must-infer-as @@ -95,7 +95,7 @@ FUNCTION: tiny ffi_test_17 int x ; [ 2 3 "ffi_test_2" f dlsym indirect-test-2 ] unit-test -: indirect-test-3 +: indirect-test-3 ( a b c d ptr -- result ) "int" { "int" "int" "int" "int" } "stdcall" alien-indirect gc ; @@ -139,7 +139,7 @@ FUNCTION: void ffi_test_20 double x1, double x2, double x3, ! Make sure XT doesn't get clobbered in stack frame -: ffi_test_31 +: ffi_test_31 ( a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ptr -- result y ) "void" f "ffi_test_31" { "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" } @@ -286,21 +286,21 @@ FUNCTION: ulonglong ffi_test_38 ( ulonglong x, ulonglong y ) ; ! Test callbacks -: callback-1 "void" { } "cdecl" [ ] alien-callback ; +: callback-1 ( -- callback ) "void" { } "cdecl" [ ] alien-callback ; [ 0 1 ] [ [ callback-1 ] infer dup effect-in swap effect-out ] unit-test [ t ] [ callback-1 alien? ] unit-test -: callback_test_1 "void" { } "cdecl" alien-indirect ; +: callback_test_1 ( ptr -- ) "void" { } "cdecl" alien-indirect ; [ ] [ callback-1 callback_test_1 ] unit-test -: callback-2 "void" { } "cdecl" [ [ 5 throw ] ignore-errors ] alien-callback ; +: callback-2 ( -- callback ) "void" { } "cdecl" [ [ 5 throw ] ignore-errors ] alien-callback ; [ ] [ callback-2 callback_test_1 ] unit-test -: callback-3 "void" { } "cdecl" [ 5 "x" set ] alien-callback ; +: callback-3 ( -- callback ) "void" { } "cdecl" [ 5 "x" set ] alien-callback ; [ t ] [ namestack* @@ -314,7 +314,7 @@ FUNCTION: ulonglong ffi_test_38 ( ulonglong x, ulonglong y ) ; ] with-scope ] unit-test -: callback-4 +: callback-4 ( -- callback ) "void" { } "cdecl" [ "Hello world" write ] alien-callback gc ; @@ -322,14 +322,14 @@ FUNCTION: ulonglong ffi_test_38 ( ulonglong x, ulonglong y ) ; [ callback-4 callback_test_1 ] with-string-writer ] unit-test -: callback-5 +: callback-5 ( -- callback ) "void" { } "cdecl" [ gc ] alien-callback ; [ "testing" ] [ "testing" callback-5 callback_test_1 ] unit-test -: callback-5a +: callback-5a ( -- callback ) "void" { } "cdecl" [ 8000000 f drop ] alien-callback ; ! Hack; if we're on ARM, we probably don't have much RAM, so @@ -340,26 +340,26 @@ FUNCTION: ulonglong ffi_test_38 ( ulonglong x, ulonglong y ) ; ! ] unit-test ! ] unless -: callback-6 +: callback-6 ( -- callback ) "void" { } "cdecl" [ [ continue ] callcc0 ] alien-callback ; [ 1 2 3 ] [ callback-6 callback_test_1 1 2 3 ] unit-test -: callback-7 +: callback-7 ( -- callback ) "void" { } "cdecl" [ 1000 sleep ] alien-callback ; [ 1 2 3 ] [ callback-7 callback_test_1 1 2 3 ] unit-test [ f ] [ namespace global eq? ] unit-test -: callback-8 +: callback-8 ( -- callback ) "void" { } "cdecl" [ [ continue ] callcc0 ] alien-callback ; [ ] [ callback-8 callback_test_1 ] unit-test -: callback-9 +: callback-9 ( -- callback ) "int" { "int" "int" "int" } "cdecl" [ + + 1+ ] alien-callback ; diff --git a/core/alien/compiler/compiler.factor b/core/alien/compiler/compiler.factor index 3de4c61291..ac1895e37e 100755 --- a/core/alien/compiler/compiler.factor +++ b/core/alien/compiler/compiler.factor @@ -7,7 +7,7 @@ math.parser classes alien.arrays alien.c-types alien.strings alien.structs alien.syntax cpu.architecture alien inspector quotations assocs kernel.private threads continuations.private libc combinators compiler.errors continuations layouts accessors -; +init ; IN: alien.compiler TUPLE: #alien-node < node return parameters abi ; @@ -216,7 +216,8 @@ M: alien-invoke-error summary drop "Words calling ``alien-invoke'' must be compiled with the optimizing compiler." ; -: pop-parameters pop-literal nip [ expand-constants ] map ; +: pop-parameters ( -- seq ) + pop-literal nip [ expand-constants ] map ; : stdcall-mangle ( symbol node -- symbol ) "@" @@ -270,7 +271,7 @@ M: no-such-symbol compiler-error-type pop-literal nip >>library pop-literal nip >>return ! Quotation which coerces parameters to required types - dup param-prep-quot f infer-quot + dup param-prep-quot recursive-state get infer-quot ! Set ABI dup library>> library [ abi>> ] [ "cdecl" ] if* >>abi ! Add node to IR @@ -278,7 +279,7 @@ M: no-such-symbol compiler-error-type ! Magic #: consume exactly the number of inputs dup 0 alien-invoke-stack ! Quotation which coerces return value to required type - return-prep-quot f infer-quot + return-prep-quot recursive-state get infer-quot ] "infer" set-word-prop M: #alien-invoke generate-node @@ -306,13 +307,13 @@ M: alien-indirect-error summary pop-parameters >>parameters pop-literal nip >>return ! Quotation which coerces parameters to required types - dup param-prep-quot [ dip ] curry f infer-quot + dup param-prep-quot [ dip ] curry recursive-state get infer-quot ! Add node to IR dup node, ! Magic #: consume the function pointer, too dup 1 alien-invoke-stack ! Quotation which coerces return value to required type - return-prep-quot f infer-quot + return-prep-quot recursive-state get infer-quot ] "infer" set-word-prop M: #alien-indirect generate-node @@ -336,7 +337,7 @@ M: #alien-indirect generate-node ! this hashtable, they will all be blown away by code GC, beware SYMBOL: callbacks -callbacks global [ H{ } assoc-like ] change-at +[ H{ } clone callbacks set-global ] "alien.compiler" add-init-hook : register-callback ( word -- ) dup callbacks get set-at ; @@ -344,8 +345,8 @@ M: alien-callback-error summary drop "Words calling ``alien-callback'' must be compiled with the optimizing compiler." ; : callback-bottom ( node -- ) - xt>> [ word-xt drop ] curry - f infer-quot ; + xt>> [ [ register-callback ] [ word-xt drop ] bi ] curry + recursive-state get infer-quot ; \ alien-callback [ 4 ensure-values @@ -354,7 +355,7 @@ M: alien-callback-error summary pop-literal nip >>abi pop-parameters >>parameters pop-literal nip >>return - gensym dup register-callback >>xt + gensym >>xt callback-bottom ] "infer" set-word-prop diff --git a/core/alien/remote-control/remote-control.factor b/core/alien/remote-control/remote-control.factor index 1d713f6edd..027663a645 100755 --- a/core/alien/remote-control/remote-control.factor +++ b/core/alien/remote-control/remote-control.factor @@ -4,14 +4,14 @@ USING: alien alien.c-types alien.strings parser threads words kernel.private kernel io.encodings.utf8 ; IN: alien.remote-control -: eval-callback +: eval-callback ( -- callback ) "void*" { "char*" } "cdecl" [ eval>string utf8 malloc-string ] alien-callback ; -: yield-callback +: yield-callback ( -- callback ) "void" { } "cdecl" [ yield ] alien-callback ; -: sleep-callback +: sleep-callback ( -- callback ) "void" { "long" } "cdecl" [ sleep ] alien-callback ; : ?callback ( word -- alien ) diff --git a/core/alien/strings/strings.factor b/core/alien/strings/strings.factor old mode 100644 new mode 100755 index d69d8e9e8e..827d478d06 --- a/core/alien/strings/strings.factor +++ b/core/alien/strings/strings.factor @@ -85,10 +85,10 @@ M: string-type c-type-getter M: string-type c-type-setter drop [ set-alien-cell ] ; -TUPLE: utf16n ; - ! Native-order UTF-16 +SINGLETON: utf16n + : utf16n ( -- descriptor ) little-endian? utf16le utf16be ? ; foldable diff --git a/core/alien/structs/structs-docs.factor b/core/alien/structs/structs-docs.factor index e7e576293f..baf0b40707 100755 --- a/core/alien/structs/structs-docs.factor +++ b/core/alien/structs/structs-docs.factor @@ -91,6 +91,6 @@ $nl ARTICLE: "c-unions" "C unions" "A " { $snippet "union" } " in C defines a type large enough to hold its largest member. This is usually used to allocate a block of memory which can hold one of several types of values." { $subsection POSTPONE: C-UNION: } -"C structure objects can be allocated by calling " { $link } " or " { $link malloc-object } "." +"C union objects can be allocated by calling " { $link } " or " { $link malloc-object } "." $nl "Arrays of C unions can be created by calling " { $link } " or " { $link malloc-array } ". Elements can be read and written using words named " { $snippet { $emphasis "type" } "-nth" } " and " { $snippet "set-" { $emphasis "type" } "-nth" } "; these words are automatically generated by " { $link POSTPONE: C-UNION: } "." ; diff --git a/core/alien/syntax/syntax.factor b/core/alien/syntax/syntax.factor index f0f495cac9..def5b02ba0 100755 --- a/core/alien/syntax/syntax.factor +++ b/core/alien/syntax/syntax.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: arrays alien alien.c-types alien.structs alien.arrays alien.strings kernel math namespaces parser sequences words -quotations math.parser splitting effects prettyprint +quotations math.parser splitting grouping effects prettyprint prettyprint.sections prettyprint.backend assocs combinators ; IN: alien.syntax @@ -40,7 +40,7 @@ PRIVATE> : FUNCTION: scan "c-library" get scan ";" parse-tokens - [ "()" subseq? not ] subset + [ "()" subseq? not ] filter define-function ; parsing : TYPEDEF: diff --git a/core/assocs/assocs-docs.factor b/core/assocs/assocs-docs.factor index 863fdaecb3..b33773cf9e 100755 --- a/core/assocs/assocs-docs.factor +++ b/core/assocs/assocs-docs.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007 Daniel Ehrenberg and Slava Pestov ! See http://factorcode.org/license.txt for BSD license. USING: help.markup help.syntax kernel sequences -sequences.private namespaces classes math ; +sequences.private namespaces math ; IN: assocs ARTICLE: "alists" "Association lists" @@ -39,9 +39,7 @@ ARTICLE: "assocs-protocol" "Associative mapping protocol" "All associative mappings must implement methods on the following generic words:" { $subsection at* } { $subsection assoc-size } -"At least one of the following two generic words must have a method; the " { $link assoc } " mixin has default definitions which are mutually recursive:" { $subsection >alist } -{ $subsection assoc-find } "Mutable assocs should implement the following additional words:" { $subsection set-at } { $subsection delete-at } @@ -68,7 +66,7 @@ ARTICLE: "assocs-lookup" "Lookup and querying of assocs" ARTICLE: "assocs-sets" "Set-theoretic operations on assocs" "It is often useful to use the keys of an associative mapping as a set, exploiting the constant or logarithmic lookup time of most implementations (" { $link "alists" } " being a notable exception)." -{ $subsection subassoc? } +{ $subsection assoc-subset? } { $subsection assoc-intersect } { $subsection update } { $subsection assoc-union } @@ -94,9 +92,10 @@ $nl $nl "The standard functional programming idioms:" { $subsection assoc-each } +{ $subsection assoc-find } { $subsection assoc-map } { $subsection assoc-push-if } -{ $subsection assoc-subset } +{ $subsection assoc-filter } { $subsection assoc-contains? } { $subsection assoc-all? } "Three additional combinators:" @@ -139,8 +138,7 @@ HELP: new-assoc HELP: assoc-find { $values { "assoc" assoc } { "quot" "a quotation with stack effect " { $snippet "( key value -- ? )" } } { "key" "the successful key, or f" } { "value" "the successful value, or f" } { "?" "a boolean" } } -{ $contract "Applies a predicate quotation to each entry in the assoc. Returns the key or value that the quotation succeeds on, or " { $link f } " for both if the quotation fails. It also returns a boolean describing whether there was anything found." } -{ $notes "The " { $link assoc } " mixin has a default implementation for this generic word which first converts the assoc to an association list, then iterates over that with the " { $link find } " combinator for sequences." } ; +{ $description "Applies a predicate quotation to each entry in the assoc. Returns the key and value that the quotation succeeds on, or " { $link f } " for both if the quotation fails. It also returns a boolean describing whether there was anything found; this can be used to distinguish between a key and a value equal to " { $link f } ", or nothing being found." } ; HELP: clear-assoc { $values { "assoc" assoc } } @@ -203,7 +201,7 @@ HELP: assoc-push-if { $values { "accum" "a resizable mutable sequence" } { "quot" "a quotation with stack effect " { $snippet "( key value -- ? )" } } { "key" object } { "value" object } } { $description "If the quotation yields true when applied to the key/value pair, adds the key/value pair at the end of " { $snippet "accum" } "." } ; -HELP: assoc-subset +HELP: assoc-filter { $values { "assoc" assoc } { "quot" "a quotation with stack effect " { $snippet "( key value -- ? )" } } { "subassoc" "a new assoc" } } { $description "Outputs an assoc of the same type as " { $snippet "assoc" } " consisting of all entries for which the predicate quotation yields true." } ; @@ -215,7 +213,7 @@ HELP: assoc-all? { $values { "assoc" assoc } { "quot" "a quotation with stack effect " { $snippet "( key value -- ? )" } } { "?" "a boolean" } } { $description "Tests if all entries in the assoc satisfy a predicate by applying the quotation to each entry in turn. a predicate quotation to entry in the assoc. Iteration stops if an entry is found for which the quotation outputs " { $link f } ". If the assoc is empty, always outputs " { $link t } "." } ; -HELP: subassoc? +HELP: assoc-subset? { $values { "assoc1" assoc } { "assoc2" assoc } { "?" "a new assoc" } } { $description "Tests if " { $snippet "assoc2" } " contains all key/value pairs of " { $snippet "assoc1" } "." } ; @@ -281,7 +279,7 @@ HELP: assoc-union HELP: assoc-diff { $values { "assoc1" assoc } { "assoc2" assoc } { "diff" "a new assoc" } } -{ $description "Outputs an assoc consisting of all entries from " { $snippet "assoc2" } " whose key is not contained in " { $snippet "assoc1" } "." } +{ $description "Outputs an assoc consisting of all entries from " { $snippet "assoc1" } " whose key is not contained in " { $snippet "assoc2" } "." } ; HELP: remove-all { $values { "assoc" assoc } { "seq" "a sequence" } { "subseq" "a new sequence" } } diff --git a/core/assocs/assocs-tests.factor b/core/assocs/assocs-tests.factor index 76f484006d..43a1bac82d 100755 --- a/core/assocs/assocs-tests.factor +++ b/core/assocs/assocs-tests.factor @@ -3,13 +3,13 @@ USING: kernel math namespaces tools.test vectors sequences sequences.private hashtables io prettyprint assocs continuations ; -[ t ] [ H{ } dup subassoc? ] unit-test -[ f ] [ H{ { 1 3 } } H{ } subassoc? ] unit-test -[ t ] [ H{ } H{ { 1 3 } } subassoc? ] unit-test -[ t ] [ H{ { 1 3 } } H{ { 1 3 } } subassoc? ] unit-test -[ f ] [ H{ { 1 3 } } H{ { 1 "hey" } } subassoc? ] unit-test -[ f ] [ H{ { 1 f } } H{ } subassoc? ] unit-test -[ t ] [ H{ { 1 f } } H{ { 1 f } } subassoc? ] unit-test +[ t ] [ H{ } dup assoc-subset? ] unit-test +[ f ] [ H{ { 1 3 } } H{ } assoc-subset? ] unit-test +[ t ] [ H{ } H{ { 1 3 } } assoc-subset? ] unit-test +[ t ] [ H{ { 1 3 } } H{ { 1 3 } } assoc-subset? ] unit-test +[ f ] [ H{ { 1 3 } } H{ { 1 "hey" } } assoc-subset? ] unit-test +[ f ] [ H{ { 1 f } } H{ } assoc-subset? ] unit-test +[ t ] [ H{ { 1 f } } H{ { 1 f } } assoc-subset? ] unit-test ! Test some combinators [ @@ -30,10 +30,10 @@ continuations ; [ t ] [ H{ { 1 1 } { 2 2 } } [ = ] assoc-all? ] unit-test [ f ] [ H{ { 1 2 } { 2 2 } } [ = ] assoc-all? ] unit-test -[ H{ } ] [ H{ { t f } { f t } } [ 2drop f ] assoc-subset ] unit-test +[ H{ } ] [ H{ { t f } { f t } } [ 2drop f ] assoc-filter ] unit-test [ H{ { 3 4 } { 4 5 } { 6 7 } } ] [ H{ { 1 2 } { 2 3 } { 3 4 } { 4 5 } { 6 7 } } - [ drop 3 >= ] assoc-subset + [ drop 3 >= ] assoc-filter ] unit-test [ 21 ] [ @@ -104,3 +104,17 @@ unit-test 2drop ] { } make ] unit-test + +[ + H{ + { "bangers" "mash" } + { "fries" "onion rings" } + } +] [ + { "bangers" "fries" } H{ + { "fish" "chips" } + { "bangers" "mash" } + { "fries" "onion rings" } + { "nachos" "cheese" } + } extract-keys +] unit-test diff --git a/core/assocs/assocs.factor b/core/assocs/assocs.factor index 4a6ecae4fe..15afce3e93 100755 --- a/core/assocs/assocs.factor +++ b/core/assocs/assocs.factor @@ -20,11 +20,9 @@ GENERIC: assoc-clone-like ( assoc exemplar -- newassoc ) GENERIC: >alist ( assoc -- newassoc ) -GENERIC# assoc-find 1 ( assoc quot -- key value ? ) inline - -M: assoc assoc-find - >r >alist [ first2 ] r> compose find swap - [ first2 t ] [ drop f f f ] if ; +: assoc-find ( assoc quot -- key value ? ) + >r >alist r> [ first2 ] prepose find swap + [ first2 t ] [ drop f f f ] if ; inline : key? ( key assoc -- ? ) at* nip ; inline @@ -50,7 +48,7 @@ M: assoc assoc-find : assoc-pusher ( quot -- quot' accum ) V{ } clone [ [ assoc-push-if ] 2curry ] keep ; inline -: assoc-subset ( assoc quot -- subassoc ) +: assoc-filter ( assoc quot -- subassoc ) over >r assoc-pusher >r assoc-each r> r> assoc-like ; inline : assoc-contains? ( assoc quot -- ? ) @@ -98,11 +96,11 @@ M: assoc assoc-clone-like ( assoc exemplar -- newassoc ) : assoc-stack ( key seq -- value ) dup length 1- swap (assoc-stack) ; -: subassoc? ( assoc1 assoc2 -- ? ) +: assoc-subset? ( assoc1 assoc2 -- ? ) [ swapd at* [ = ] [ 2drop f ] if ] curry assoc-all? ; : assoc= ( assoc1 assoc2 -- ? ) - 2dup subassoc? >r swap subassoc? r> and ; + [ assoc-subset? ] [ swap assoc-subset? ] 2bi and ; : assoc-hashcode ( n assoc -- code ) [ @@ -110,7 +108,7 @@ M: assoc assoc-clone-like ( assoc exemplar -- newassoc ) ] { } assoc>map hashcode* ; : assoc-intersect ( assoc1 assoc2 -- intersection ) - swap [ nip key? ] curry assoc-subset ; + swap [ nip key? ] curry assoc-filter ; : update ( assoc1 assoc2 -- ) swap [ swapd set-at ] curry assoc-each ; @@ -120,10 +118,10 @@ M: assoc assoc-clone-like ( assoc exemplar -- newassoc ) [ rot update ] keep [ swap update ] keep ; : assoc-diff ( assoc1 assoc2 -- diff ) - swap [ nip key? not ] curry assoc-subset ; + [ nip key? not ] curry assoc-filter ; : remove-all ( assoc seq -- subseq ) - swap [ key? not ] curry subset ; + swap [ key? not ] curry filter ; : (substitute) [ dupd at* [ nip ] [ drop ] if ] curry ; inline @@ -150,7 +148,10 @@ M: assoc assoc-clone-like ( assoc exemplar -- newassoc ) : map>assoc ( seq quot exemplar -- assoc ) >r [ 2array ] compose { } map-as r> assoc-like ; inline -M: assoc >alist [ 2array ] { } assoc>map ; +: extract-keys ( seq assoc -- subassoc ) + [ [ dupd at ] curry ] keep map>assoc ; + +! M: assoc >alist [ 2array ] { } assoc>map ; : value-at ( value assoc -- key/f ) swap [ = nip ] curry assoc-find 2drop ; diff --git a/core/bootstrap/compiler/compiler.factor b/core/bootstrap/compiler/compiler.factor index da3c634ebd..5480bac4f5 100755 --- a/core/bootstrap/compiler/compiler.factor +++ b/core/bootstrap/compiler/compiler.factor @@ -5,7 +5,7 @@ namespaces parser kernel kernel.private classes classes.private arrays hashtables vectors classes.tuple sbufs inference.dataflow hashtables.private sequences.private math classes.tuple.private growable namespaces.private assocs words generator command-line -vocabs io prettyprint libc compiler.units ; +vocabs io prettyprint libc compiler.units math.order ; IN: bootstrap.compiler ! Don't bring this in when deploying, since it will store a @@ -18,6 +18,9 @@ IN: bootstrap.compiler enable-compiler +: compile-uncompiled ( words -- ) + [ compiled? not ] filter compile ; + nl "Compiling..." write flush @@ -39,41 +42,41 @@ nl underlying - find-pair-next namestack* + namestack* bitand bitor bitxor bitnot -} compile +} compile-uncompiled "." write flush { - + 1+ 1- 2/ < <= > >= shift min -} compile + + 1+ 1- 2/ < <= > >= shift +} compile-uncompiled "." write flush { new-sequence nth push pop peek -} compile +} compile-uncompiled "." write flush { hashcode* = get set -} compile +} compile-uncompiled "." write flush { . lines -} compile +} compile-uncompiled "." write flush { malloc calloc free memcpy -} compile +} compile-uncompiled -vocabs [ words [ compiled? not ] subset compile "." write flush ] each +vocabs [ words compile-uncompiled "." write flush ] each " done" print flush diff --git a/core/bootstrap/image/image-tests.factor b/core/bootstrap/image/image-tests.factor index ae5c66a45c..c432a47ea4 100755 --- a/core/bootstrap/image/image-tests.factor +++ b/core/bootstrap/image/image-tests.factor @@ -1,5 +1,22 @@ IN: bootstrap.image.tests -USING: bootstrap.image bootstrap.image.private tools.test ; +USING: bootstrap.image bootstrap.image.private tools.test +kernel math ; \ ' must-infer \ write-image must-infer + +[ f ] [ { 1 2 3 } [ 1 2 3 ] eql? ] unit-test + +[ t ] [ [ 1 2 3 ] [ 1 2 3 ] eql? ] unit-test + +[ f ] [ [ 2drop 0 ] [ 2drop 0.0 ] eql? ] unit-test + +[ t ] [ [ 2drop 0 ] [ 2drop 0 ] eql? ] unit-test + +[ f ] [ \ + [ 2drop 0 ] eql? ] unit-test + +[ f ] [ 3 [ 0 1 2 ] eql? ] unit-test + +[ f ] [ 3 3.0 eql? ] unit-test + +[ t ] [ 4.0 4.0 eql? ] unit-test diff --git a/core/bootstrap/image/image.factor b/core/bootstrap/image/image.factor index 05d48af2e8..0187a6ce52 100755 --- a/core/bootstrap/image/image.factor +++ b/core/bootstrap/image/image.factor @@ -4,11 +4,11 @@ USING: alien arrays bit-arrays byte-arrays generic assocs hashtables assocs hashtables.private io kernel kernel.private math namespaces parser prettyprint sequences sequences.private strings sbufs vectors words quotations assocs system layouts -splitting growable classes classes.builtin classes.tuple +splitting grouping growable classes classes.builtin classes.tuple classes.tuple.private words.private io.binary io.files vocabs vocabs.loader source-files definitions debugger float-arrays quotations.private sequences.private combinators -io.encodings.binary ; +io.encodings.binary math.order accessors ; IN: bootstrap.image : my-arch ( -- arch ) @@ -31,6 +31,43 @@ IN: bootstrap.image id + +M: id hashcode* obj>> hashcode* ; + +GENERIC: (eql?) ( obj1 obj2 -- ? ) + +: eql? ( obj1 obj2 -- ? ) + [ (eql?) ] [ [ class ] bi@ = ] 2bi and ; + +M: integer (eql?) = ; + +M: sequence (eql?) + over sequence? [ + 2dup [ length ] bi@ = + [ [ eql? ] 2all? ] [ 2drop f ] if + ] [ 2drop f ] if ; + +M: object (eql?) = ; + +M: id equal? + over id? [ [ obj>> ] bi@ eql? ] [ 2drop f ] if ; + +SYMBOL: objects + +: (objects) objects get ; inline + +: lookup-object ( obj -- n/f ) (objects) at ; + +: put-object ( n obj -- ) (objects) set-at ; + +: cache-object ( obj quot -- value ) + >r (objects) r> [ obj>> ] prepose cache ; inline + ! Constants : image-magic HEX: 0f0e0d0c ; inline @@ -48,22 +85,12 @@ IN: bootstrap.image : 1-offset 8 ; inline : -1-offset 9 ; inline -: array-start 2 bootstrap-cells object tag-number - ; -: scan@ array-start bootstrap-cell - ; -: wrapper@ bootstrap-cell object tag-number - ; -: word-xt@ 8 bootstrap-cells object tag-number - ; -: quot-array@ bootstrap-cell object tag-number - ; -: quot-xt@ 3 bootstrap-cells object tag-number - ; - : jit-define ( quot rc rt offset name -- ) >r { [ { } make ] [ ] [ ] [ ] } spread 4array r> set ; ! The image being constructed; a vector of word-size integers SYMBOL: image -! Object cache -SYMBOL: objects - ! Image output format SYMBOL: big-endian @@ -169,9 +196,9 @@ GENERIC: ' ( obj -- ptr ) ! Bignums -: bignum-bits bootstrap-cell-bits 2 - ; +: bignum-bits ( -- n ) bootstrap-cell-bits 2 - ; -: bignum-radix bignum-bits 2^ 1- ; +: bignum-radix ( -- n ) bignum-bits 2^ 1- ; : bignum>seq ( n -- seq ) #! n is positive or zero. @@ -187,7 +214,9 @@ GENERIC: ' ( obj -- ptr ) 2tri ; M: bignum ' - bignum tag-number dup [ emit-bignum ] emit-object ; + [ + bignum tag-number dup [ emit-bignum ] emit-object + ] cache-object ; ! Fixnums @@ -202,23 +231,25 @@ M: fixnum ' ! Floats M: float ' - float tag-number dup [ - align-here double>bits emit-64 - ] emit-object ; + [ + float tag-number dup [ + align-here double>bits emit-64 + ] emit-object + ] cache-object ; ! Special objects ! Padded with fixnums for 8-byte alignment -: t, t t-offset fixup ; +: t, ( -- ) t t-offset fixup ; M: f ' #! f is #define F RETAG(0,F_TYPE) drop \ f tag-number ; -: 0, 0 >bignum ' 0-offset fixup ; -: 1, 1 >bignum ' 1-offset fixup ; -: -1, -1 >bignum ' -1-offset fixup ; +: 0, ( -- ) 0 >bignum ' 0-offset fixup ; +: 1, ( -- ) 1 >bignum ' 1-offset fixup ; +: -1, ( -- ) -1 >bignum ' -1-offset fixup ; ! Words @@ -243,7 +274,7 @@ M: f ' ] bi \ word type-number object tag-number [ emit-seq ] emit-object - ] keep objects get set-at ; + ] keep put-object ; : word-error ( word msg -- * ) [ % dup word-vocabulary % " " % word-name % ] "" make throw ; @@ -252,7 +283,7 @@ M: f ' [ target-word ] keep or ; : fixup-word ( word -- offset ) - transfer-word dup objects get at + transfer-word dup lookup-object [ ] [ "Not in image: " word-error ] ?if ; : fixup-words ( -- ) @@ -267,12 +298,12 @@ M: wrapper ' [ emit ] emit-object ; ! Strings -: emit-chars ( seq -- ) +: emit-bytes ( seq -- ) bootstrap-cell big-endian get [ [ be> ] map ] [ [ le> ] map ] if emit-seq ; -: pack-string ( string -- newstr ) +: pad-bytes ( seq -- newseq ) dup length bootstrap-cell align 0 pad-right ; : emit-string ( string -- ptr ) @@ -280,13 +311,13 @@ M: wrapper ' dup length emit-fixnum f ' emit f ' emit - pack-string emit-chars + pad-bytes emit-bytes ] emit-object ; M: string ' #! We pool strings so that each string is only written once #! to the image - objects get [ emit-string ] cache ; + [ emit-string ] cache-object ; : assert-empty ( seq -- ) length 0 assert= ; @@ -297,7 +328,11 @@ M: string ' [ 0 emit-fixnum ] emit-object ] bi* ; -M: byte-array ' byte-array emit-dummy-array ; +M: byte-array ' + byte-array type-number object tag-number [ + dup length emit-fixnum + pad-bytes emit-bytes + ] emit-object ; M: bit-array ' bit-array emit-dummy-array ; @@ -305,18 +340,18 @@ M: float-array ' float-array emit-dummy-array ; ! Tuples : (emit-tuple) ( tuple -- pointer ) - [ tuple>array 1 tail-slice ] + [ tuple>array rest-slice ] [ class transfer-word tuple-layout ] bi prefix [ ' ] map tuple type-number dup [ emit-seq ] emit-object ; : emit-tuple ( tuple -- pointer ) dup class word-name "tombstone" = - [ objects get [ (emit-tuple) ] cache ] [ (emit-tuple) ] if ; + [ [ (emit-tuple) ] cache-object ] [ (emit-tuple) ] if ; M: tuple ' emit-tuple ; M: tuple-layout ' - objects get [ + [ [ { [ layout-hashcode , ] @@ -328,12 +363,12 @@ M: tuple-layout ' ] { } make [ ' ] map \ tuple-layout type-number object tag-number [ emit-seq ] emit-object - ] cache ; + ] cache-object ; M: tombstone ' delegate "((tombstone))" "((empty))" ? "hashtables.private" lookup - word-def first objects get [ emit-tuple ] cache ; + word-def first [ emit-tuple ] cache-object ; ! Arrays M: array ' @@ -343,7 +378,7 @@ M: array ' ! Quotations M: quotation ' - objects get [ + [ quotation-array ' quotation type-number object tag-number [ emit ! array @@ -351,7 +386,7 @@ M: quotation ' 0 emit ! xt 0 emit ! code ] emit-object - ] cache ; + ] cache-object ; ! End of the image @@ -362,8 +397,8 @@ M: quotation ' [ { dictionary source-files builtins - update-map class<-cache class-not-cache - classes-intersect-cache class-and-cache + update-map class<=-cache + class-not-cache classes-intersect-cache class-and-cache class-or-cache } [ dup get swap bootstrap-word set ] each ] H{ } make-assoc @@ -433,15 +468,13 @@ M: quotation ' "Writing image to " write architecture get boot-image-name resource-path [ write "..." print flush ] - [ binary [ (write-image) ] with-stream ] bi ; + [ binary [ (write-image) ] with-file-writer ] bi ; PRIVATE> : make-image ( arch -- ) [ architecture set - bootstrapping? on - load-help? off "resource:/core/bootstrap/stage1.factor" run-file build-image write-image diff --git a/core/bootstrap/primitives.factor b/core/bootstrap/primitives.factor index dd3a4adf8b..6a3c1c35d5 100755 --- a/core/bootstrap/primitives.factor +++ b/core/bootstrap/primitives.factor @@ -5,8 +5,9 @@ hashtables.private io kernel math namespaces parser sequences strings vectors words quotations assocs layouts classes classes.builtin classes.tuple classes.tuple.private kernel.private vocabs vocabs.loader source-files definitions -slots.deprecated classes.union compiler.units -bootstrap.image.private io.files accessors combinators ; +slots.deprecated classes.union classes.intersection +compiler.units bootstrap.image.private io.files accessors +combinators ; IN: bootstrap.primitives "Creating primitives and basic runtime structures..." print flush @@ -30,6 +31,7 @@ crossref off ! Bring up a bare cross-compiling vocabulary. "syntax" vocab vocab-words bootstrap-syntax set H{ } clone dictionary set +H{ } clone new-classes set H{ } clone changed-definitions set H{ } clone forgotten-definitions set H{ } clone root-cache set @@ -51,6 +53,8 @@ call ! After we execute bootstrap/layouts num-types get f builtins set +bootstrapping? on + ! Create some empty vocabs where the below primitives and ! classes will go { @@ -59,6 +63,7 @@ num-types get f builtins set "arrays" "bit-arrays" "byte-arrays" + "byte-vectors" "classes.private" "classes.tuple" "classes.tuple.private" @@ -124,7 +129,7 @@ num-types get f builtins set : register-builtin ( class -- ) [ dup lookup-type-number "type" set-word-prop ] [ dup "type" word-prop builtins get set-nth ] - [ f f builtin-class define-class ] + [ f f f builtin-class define-class ] tri ; : define-builtin-slots ( symbol slotspec -- ) @@ -157,7 +162,7 @@ num-types get f builtins set ! Catch-all class for providing a default method. "object" "kernel" create -[ f builtins get [ ] subset union-class define-class ] +[ f f { } intersection-class define-class ] [ [ drop t ] "predicate" set-word-prop ] bi @@ -169,7 +174,7 @@ builtins get num-tags get tail define-union-class ! Empty class with no instances "null" "kernel" create -[ f { } union-class define-class ] +[ f { } f union-class define-class ] [ [ drop f ] "predicate" set-word-prop ] bi @@ -452,6 +457,22 @@ tuple } } define-tuple-class +"byte-vector" "byte-vectors" create +tuple +{ + { + { "byte-array" "byte-arrays" } + "underlying" + { "underlying" "growable" } + { "set-underlying" "growable" } + } { + { "array-capacity" "sequences.private" } + "fill" + { "length" "sequences" } + { "set-fill" "growable" } + } +} define-tuple-class + "curry" "kernel" create tuple { @@ -590,7 +611,7 @@ tuple { "(exists?)" "io.files.private" } { "(directory)" "io.files.private" } { "gc" "memory" } - { "gc-time" "memory" } + { "gc-stats" "memory" } { "save-image" "memory" } { "save-image-and-exit" "memory" } { "datastack" "kernel" } @@ -685,6 +706,7 @@ tuple { "resize-float-array" "float-arrays" } { "dll-valid?" "alien" } { "unimplemented" "kernel.private" } + { "gc-reset" "memory" } } dup length [ >r first2 r> make-primitive ] 2each diff --git a/core/bootstrap/stage1.factor b/core/bootstrap/stage1.factor index f99c8eb82f..64402ca2e1 100755 --- a/core/bootstrap/stage1.factor +++ b/core/bootstrap/stage1.factor @@ -13,6 +13,8 @@ vocabs.loader system debugger continuations ; "resource:core/bootstrap/primitives.factor" run-file +load-help? off + ! Create a boot quotation for the target [ [ diff --git a/core/bootstrap/stage2.factor b/core/bootstrap/stage2.factor index dfd2e4be6f..f94cc0ed37 100755 --- a/core/bootstrap/stage2.factor +++ b/core/bootstrap/stage2.factor @@ -22,13 +22,13 @@ SYMBOL: bootstrap-time xref-sources ; : load-components ( -- ) - "exclude" "include" - [ get-global " " split [ empty? not ] subset ] bi@ + "include" "exclude" + [ get-global " " split harvest ] bi@ diff [ "bootstrap." prepend require ] each ; : count-words ( pred -- ) - all-words swap subset length number>string write ; + all-words swap filter length number>string write ; : print-report ( time -- ) 1000 /i @@ -44,10 +44,6 @@ SYMBOL: bootstrap-time "Now, you can run Factor:" print vm write " -i=" write "output-image" get print flush ; -! Wrap everything in a catch which starts a listener so -! you can see what went wrong, instead of dealing with a -! fep - ! We time bootstrap millis >r @@ -91,7 +87,7 @@ f error-continuation set-global parse-command-line run-user-init "run" get run - stdio get [ stream-flush ] when* + output-stream get [ stream-flush ] when* ] [ print-error 1 exit ] recover ] set-boot-quot diff --git a/core/bootstrap/syntax.factor b/core/bootstrap/syntax.factor index 4b74804749..f3d7707878 100755 --- a/core/bootstrap/syntax.factor +++ b/core/bootstrap/syntax.factor @@ -10,12 +10,14 @@ IN: bootstrap.syntax "\"" "#!" "(" + "((" ":" ";" " { $values { "box" box } } @@ -27,12 +27,11 @@ ARTICLE: "boxes" "Boxes" { $subsection box } "Creating an empty box:" { $subsection } -"Testing if a box is full:" -{ $subsection box-full? } "Storing a value and removing a value from a box:" { $subsection >box } { $subsection box> } "Safely removing a value:" -{ $subsection ?box } ; +{ $subsection ?box } +"Testing if a box is full can be done by reading the " { $snippet "occupied" } " slot." ; ABOUT: "boxes" diff --git a/core/boxes/boxes-tests.factor b/core/boxes/boxes-tests.factor index 76a6cfd8b1..71fc1c9a7b 100755 --- a/core/boxes/boxes-tests.factor +++ b/core/boxes/boxes-tests.factor @@ -1,17 +1,17 @@ IN: boxes.tests -USING: boxes namespaces tools.test ; +USING: boxes namespaces tools.test accessors ; [ ] [ "b" set ] unit-test [ ] [ 3 "b" get >box ] unit-test -[ t ] [ "b" get box-full? ] unit-test +[ t ] [ "b" get occupied>> ] unit-test [ 4 "b" >box ] must-fail [ 3 ] [ "b" get box> ] unit-test -[ f ] [ "b" get box-full? ] unit-test +[ f ] [ "b" get occupied>> ] unit-test [ "b" get box> ] must-fail @@ -21,4 +21,4 @@ USING: boxes namespaces tools.test ; [ 12 t ] [ "b" get ?box ] unit-test -[ f ] [ "b" get box-full? ] unit-test +[ f ] [ "b" get occupied>> ] unit-test diff --git a/core/boxes/boxes.factor b/core/boxes/boxes.factor index b56a46b6b3..9e2e8a4673 100755 --- a/core/boxes/boxes.factor +++ b/core/boxes/boxes.factor @@ -1,24 +1,26 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel ; +USING: kernel accessors ; IN: boxes -TUPLE: box value full? ; +TUPLE: box value occupied ; : ( -- box ) box new ; +ERROR: box-full box ; + : >box ( value box -- ) - dup box-full? [ "Box already has a value" throw ] when - t over set-box-full? - set-box-value ; + dup occupied>> + [ box-full ] [ t >>occupied (>>value) ] if ; + +ERROR: box-empty box ; : box> ( box -- value ) - dup box-full? [ "Box empty" throw ] unless - dup box-value f pick set-box-value - f rot set-box-full? ; + dup occupied>> + [ [ f ] change-value f >>occupied drop ] [ box-empty ] if ; : ?box ( box -- value/f ? ) - dup box-full? [ box> t ] [ drop f f ] if ; + dup occupied>> [ box> t ] [ drop f f ] if ; : if-box? ( box quot -- ) >r ?box r> [ drop ] if ; inline diff --git a/core/byte-arrays/byte-arrays-docs.factor b/core/byte-arrays/byte-arrays-docs.factor index 27df8771c3..8a51f4c663 100755 --- a/core/byte-arrays/byte-arrays-docs.factor +++ b/core/byte-arrays/byte-arrays-docs.factor @@ -26,5 +26,6 @@ HELP: ( n -- byte-array ) HELP: >byte-array { $values { "seq" "a sequence" } { "byte-array" byte-array } } -{ $description "Outputs a freshly-allocated byte array whose elements have the same boolean values as a given sequence." } +{ $description + "Outputs a freshly-allocated byte array whose elements have the same signed byte values as a given sequence." } { $errors "Throws an error if the sequence contains elements other than integers." } ; diff --git a/extra/byte-vectors/byte-vectors-docs.factor b/core/byte-vectors/byte-vectors-docs.factor similarity index 100% rename from extra/byte-vectors/byte-vectors-docs.factor rename to core/byte-vectors/byte-vectors-docs.factor diff --git a/extra/byte-vectors/byte-vectors-tests.factor b/core/byte-vectors/byte-vectors-tests.factor similarity index 100% rename from extra/byte-vectors/byte-vectors-tests.factor rename to core/byte-vectors/byte-vectors-tests.factor diff --git a/extra/byte-vectors/byte-vectors.factor b/core/byte-vectors/byte-vectors.factor similarity index 61% rename from extra/byte-vectors/byte-vectors.factor rename to core/byte-vectors/byte-vectors.factor index a8351dc781..e80b797a8d 100755 --- a/extra/byte-vectors/byte-vectors.factor +++ b/core/byte-vectors/byte-vectors.factor @@ -1,20 +1,9 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: arrays kernel kernel.private math sequences -sequences.private growable byte-arrays prettyprint.backend -parser accessors ; +sequences.private growable byte-arrays ; IN: byte-vectors -TUPLE: byte-vector underlying fill ; - -M: byte-vector underlying underlying>> { byte-array } declare ; - -M: byte-vector set-underlying (>>underlying) ; - -M: byte-vector length fill>> { array-capacity } declare ; - -M: byte-vector set-fill (>>fill) ; - vector ( byte-array length -- byte-vector ) @@ -43,9 +32,3 @@ M: byte-vector equal? M: byte-array new-resizable drop ; INSTANCE: byte-vector growable - -: BV{ \ } [ >byte-vector ] parse-literal ; parsing - -M: byte-vector >pprint-sequence ; - -M: byte-vector pprint-delims drop \ BV{ \ } ; diff --git a/extra/byte-vectors/summary.txt b/core/byte-vectors/summary.txt similarity index 100% rename from extra/byte-vectors/summary.txt rename to core/byte-vectors/summary.txt diff --git a/extra/byte-vectors/tags.txt b/core/byte-vectors/tags.txt similarity index 100% rename from extra/byte-vectors/tags.txt rename to core/byte-vectors/tags.txt diff --git a/core/checksums/checksums-docs.factor b/core/checksums/checksums-docs.factor new file mode 100644 index 0000000000..6ef0e85025 --- /dev/null +++ b/core/checksums/checksums-docs.factor @@ -0,0 +1,55 @@ +USING: help.markup help.syntax kernel math sequences quotations +math.private byte-arrays strings ; +IN: checksums + +HELP: checksum +{ $class-description "The class of checksum algorithms." } ; + +HELP: hex-string +{ $values { "seq" "a sequence" } { "str" "a string" } } +{ $description "Converts a sequence of values from 0-255 to a string of hex numbers from 0-ff." } +{ $examples + { $example "USING: checksums io ;" "B{ 1 2 3 4 } hex-string print" "01020304" } +} +{ $notes "Numbers are zero-padded on the left." } ; + +HELP: checksum-stream +{ $values { "stream" "an input stream" } { "checksum" "a checksum specifier" } { "value" byte-array } } +{ $contract "Computes the checksum of all data read from the stream." } +{ $side-effects "stream" } ; + +HELP: checksum-bytes +{ $values { "bytes" "a sequence of bytes" } { "checksum" "a checksum specifier" } { "value" byte-array } } +{ $contract "Computes the checksum of all data in a sequence." } ; + +HELP: checksum-lines +{ $values { "lines" "a sequence of sequences of bytes" } { "checksum" "a checksum specifier" } { "value" byte-array } } +{ $contract "Computes the checksum of all data in a sequence." } ; + +HELP: checksum-file +{ $values { "path" "a pathname specifier" } { "checksum" "a checksum specifier" } { "value" byte-array } } +{ $contract "Computes the checksum of all data in a file." } ; + +ARTICLE: "checksums" "Checksums" +"A " { $emphasis "checksum" } " is a function mapping sequences of bytes to fixed-length strings. While checksums are not one-to-one, a good checksum should have a low probability of collision. Additionally, some checksum algorithms are designed to be hard to reverse, in the sense that finding an input string which hashes to a given checksum string requires a brute-force search." +$nl +"Checksums are instances of a class:" +{ $subsection checksum } +"Operations on checksums:" +{ $subsection checksum-bytes } +{ $subsection checksum-stream } +{ $subsection checksum-lines } +"Checksums should implement at least one of " { $link checksum-bytes } " and " { $link checksum-stream } ". Implementing " { $link checksum-lines } " is optional." +$nl +"Utilities:" +{ $subsection checksum-file } +{ $subsection hex-string } +"Checksum implementations:" +{ $subsection "checksums.crc32" } +{ $vocab-subsection "MD5 checksum" "checksums.md5" } +{ $vocab-subsection "SHA1 checksum" "checksums.sha1" } +{ $vocab-subsection "SHA2 checksum" "checksums.sha2" } +{ $vocab-subsection "Adler-32 checksum" "checksums.adler-32" } +{ $vocab-subsection "OpenSSL checksums" "checksums.openssl" } ; + +ABOUT: "checksums" diff --git a/core/checksums/checksums-tests.factor b/core/checksums/checksums-tests.factor new file mode 100644 index 0000000000..1ec675b0cf --- /dev/null +++ b/core/checksums/checksums-tests.factor @@ -0,0 +1,7 @@ +IN: checksums.tests +USING: checksums tools.test ; + +\ checksum-bytes must-infer +\ checksum-stream must-infer +\ checksum-lines must-infer +\ checksum-file must-infer diff --git a/core/checksums/checksums.factor b/core/checksums/checksums.factor new file mode 100644 index 0000000000..08a13297d1 --- /dev/null +++ b/core/checksums/checksums.factor @@ -0,0 +1,25 @@ +! Copyright (c) 2008 Slava Pestov +! See http://factorcode.org/license.txt for BSD license. +USING: sequences math.parser io io.streams.byte-array +io.encodings.binary io.files kernel ; +IN: checksums + +MIXIN: checksum + +GENERIC: checksum-bytes ( bytes checksum -- value ) + +GENERIC: checksum-stream ( stream checksum -- value ) + +GENERIC: checksum-lines ( lines checksum -- value ) + +M: checksum checksum-bytes >r binary r> checksum-stream ; + +M: checksum checksum-stream >r contents r> checksum-bytes ; + +M: checksum checksum-lines >r B{ CHAR: \n } join r> checksum-bytes ; + +: checksum-file ( path checksum -- value ) + >r binary r> checksum-stream ; + +: hex-string ( seq -- str ) + [ >hex 2 CHAR: 0 pad-left ] { } map-as concat ; diff --git a/core/io/crc32/authors.txt b/core/checksums/crc32/authors.txt similarity index 100% rename from core/io/crc32/authors.txt rename to core/checksums/crc32/authors.txt diff --git a/core/checksums/crc32/crc32-docs.factor b/core/checksums/crc32/crc32-docs.factor new file mode 100644 index 0000000000..0f277bcd16 --- /dev/null +++ b/core/checksums/crc32/crc32-docs.factor @@ -0,0 +1,11 @@ +USING: help.markup help.syntax math ; +IN: checksums.crc32 + +HELP: crc32 +{ $class-description "The CRC32 checksum algorithm." } ; + +ARTICLE: "checksums.crc32" "CRC32 checksum" +"The CRC32 checksum algorithm provides a quick but unreliable way to detect changes in data." +{ $subsection crc32 } ; + +ABOUT: "checksums.crc32" diff --git a/core/checksums/crc32/crc32-tests.factor b/core/checksums/crc32/crc32-tests.factor new file mode 100644 index 0000000000..6fe4b995ee --- /dev/null +++ b/core/checksums/crc32/crc32-tests.factor @@ -0,0 +1,6 @@ +USING: checksums checksums.crc32 kernel math tools.test namespaces ; + +[ B{ 0 0 0 0 } ] [ "" crc32 checksum-bytes ] unit-test + +[ B{ HEX: cb HEX: f4 HEX: 39 HEX: 26 } ] [ "123456789" crc32 checksum-bytes ] unit-test + diff --git a/core/io/crc32/crc32.factor b/core/checksums/crc32/crc32.factor similarity index 59% rename from core/io/crc32/crc32.factor rename to core/checksums/crc32/crc32.factor index afe7e4bfb7..e1f0b9417b 100755 --- a/core/io/crc32/crc32.factor +++ b/core/checksums/crc32/crc32.factor @@ -2,8 +2,8 @@ ! See http://factorcode.org/license.txt for BSD license. USING: kernel math sequences sequences.private namespaces words io io.binary io.files io.streams.string quotations -definitions ; -IN: io.crc32 +definitions checksums ; +IN: checksums.crc32 : crc32-polynomial HEX: edb88320 ; inline @@ -20,10 +20,20 @@ IN: io.crc32 mask-byte crc32-table nth-unsafe >bignum swap -8 shift bitxor ; inline -: crc32 ( seq -- n ) - >r HEX: ffffffff dup r> [ (crc32) ] each bitxor ; +SINGLETON: crc32 -: lines-crc32 ( seq -- n ) - HEX: ffffffff tuck [ - [ (crc32) ] each CHAR: \n (crc32) - ] reduce bitxor ; +INSTANCE: crc32 checksum + +: init-crc32 drop >r HEX: ffffffff dup r> ; inline + +: finish-crc32 bitxor 4 >be ; inline + +M: crc32 checksum-bytes + init-crc32 + [ (crc32) ] each + finish-crc32 ; + +M: crc32 checksum-lines + init-crc32 + [ [ (crc32) ] each CHAR: \n (crc32) ] each + finish-crc32 ; diff --git a/core/io/crc32/summary.txt b/core/checksums/crc32/summary.txt similarity index 100% rename from core/io/crc32/summary.txt rename to core/checksums/crc32/summary.txt diff --git a/core/classes/algebra/algebra-docs.factor b/core/classes/algebra/algebra-docs.factor index 87c72048f4..810bdbe10f 100755 --- a/core/classes/algebra/algebra-docs.factor +++ b/core/classes/algebra/algebra-docs.factor @@ -1,14 +1,14 @@ -USING: help.markup help.syntax kernel classes ; +USING: help.markup help.syntax kernel classes words +checksums checksums.crc32 sequences math ; IN: classes.algebra ARTICLE: "class-operations" "Class operations" "Set-theoretic operations on classes:" { $subsection class< } +{ $subsection class<= } { $subsection class-and } { $subsection class-or } { $subsection classes-intersect? } -"Topological sort:" -{ $subsection sort-classes } { $subsection min-class } "Low-level implementation detail:" { $subsection class-types } @@ -17,6 +17,29 @@ ARTICLE: "class-operations" "Class operations" { $subsection class-types } { $subsection class-tags } ; +ARTICLE: "class-linearization" "Class linearization" +"Classes have an intrinsic partial order; given two classes A and B, we either have that A is a subset of B, B is a subset of A, A and B are equal as sets, or they are incomparable. The last two situations present difficulties for method dispatch:" +{ $list + "If a generic word defines a method on a mixin class A and another class B, and B is the only instance of A, there is an ambiguity because A and B are equal as sets; any object that is an instance of one is an instance of both." + { "If a generic word defines methods on two union classes which are incomparable but not disjoint, for example " { $link sequence } " and " { $link number } ", there is an ambiguity because the generic word may be called on an object that is an instance of both unions." } +} +"The first ambiguity is resolved with a tie-breaker that compares metaclasses. The intrinsic meta-class order, from most-specific to least-specific:" +{ $list + "Built-in classes and tuple classes" + "Predicate classes" + "Union classes" + "Mixin classes" +} +"This means that in the above example, the generic word with methods on a mixin and its sole instance will always call the method for the sole instance, since it is more specific than a mixin class." +$nl +"The second problem is resolved with another tie-breaker. When performing the topological sort of classes, if there are multiple candidates at any given step of the sort, lexicographical order on the class name is used." +$nl +"Operations:" +{ $subsection class< } +{ $subsection sort-classes } +"Metaclass order:" +{ $subsection rank-class } ; + HELP: flatten-builtin-class { $values { "class" class } { "assoc" "an assoc whose keys are classes" } } { $description "Outputs a set of tuple classes whose union is the smallest cover of " { $snippet "class" } " intersected with " { $link tuple } "." } ; @@ -29,14 +52,14 @@ HELP: class-types { $values { "class" class } { "seq" "an increasing sequence of integers" } } { $description "Outputs a sequence of builtin type numbers whose instances can possibly be instances of the given class." } ; -HELP: class< +HELP: class<= { $values { "first" "a class" } { "second" "a class" } { "?" "a boolean" } } { $description "Tests if all instances of " { $snippet "class1" } " are also instances of " { $snippet "class2" } "." } { $notes "Classes are partially ordered. This means that if " { $snippet "class1 <= class2" } " and " { $snippet "class2 <= class1" } ", then " { $snippet "class1 = class2" } ". Also, if " { $snippet "class1 <= class2" } " and " { $snippet "class2 <= class3" } ", then " { $snippet "class1 <= class3" } "." } ; HELP: sort-classes { $values { "seq" "a sequence of class" } { "newseq" "a new seqence of classes" } } -{ $description "Outputs a topological sort of a sequence of classes. Larger classes come before their subclasses." } ; +{ $description "Outputs a linear sort of a sequence of classes. Larger classes come before their subclasses." } ; HELP: class-or { $values { "first" class } { "second" class } { "class" class } } diff --git a/core/classes/algebra/algebra-tests.factor b/core/classes/algebra/algebra-tests.factor index dba97c16f5..28e899d08b 100755 --- a/core/classes/algebra/algebra-tests.factor +++ b/core/classes/algebra/algebra-tests.factor @@ -1,16 +1,22 @@ -IN: classes.algebra.tests USING: alien arrays definitions generic assocs hashtables io kernel math namespaces parser prettyprint sequences strings tools.test vectors words quotations classes classes.algebra classes.private classes.union classes.mixin classes.predicate vectors definitions source-files compiler.units growable -random inference effects kernel.private sbufs ; +random inference effects kernel.private sbufs math.order ; +IN: classes.algebra.tests -: class= [ class< ] 2keep swap class< and ; +\ class< must-infer +\ class-and must-infer +\ class-or must-infer +\ flatten-class must-infer +\ flatten-builtin-class must-infer -: class-and* >r class-and r> class= ; +: class= ( cls1 cls2 -- ? ) [ class<= ] [ swap class<= ] 2bi and ; -: class-or* >r class-or r> class= ; +: class-and* ( cls1 cls2 cls3 -- ? ) >r class-and r> class= ; + +: class-or* ( cls1 cls2 cls3 -- ? ) >r class-or r> class= ; [ t ] [ object object object class-and* ] unit-test [ t ] [ fixnum object fixnum class-and* ] unit-test @@ -38,43 +44,43 @@ UNION: both first-one union-class ; [ f ] [ number vector class-and sequence classes-intersect? ] unit-test -[ t ] [ \ fixnum \ integer class< ] unit-test -[ t ] [ \ fixnum \ fixnum class< ] unit-test -[ f ] [ \ integer \ fixnum class< ] unit-test -[ t ] [ \ integer \ object class< ] unit-test -[ f ] [ \ integer \ null class< ] unit-test -[ t ] [ \ null \ object class< ] unit-test +[ t ] [ \ fixnum \ integer class<= ] unit-test +[ t ] [ \ fixnum \ fixnum class<= ] unit-test +[ f ] [ \ integer \ fixnum class<= ] unit-test +[ t ] [ \ integer \ object class<= ] unit-test +[ f ] [ \ integer \ null class<= ] unit-test +[ t ] [ \ null \ object class<= ] unit-test -[ t ] [ \ generic \ word class< ] unit-test -[ f ] [ \ word \ generic class< ] unit-test +[ t ] [ \ generic \ word class<= ] unit-test +[ f ] [ \ word \ generic class<= ] unit-test -[ f ] [ \ reversed \ slice class< ] unit-test -[ f ] [ \ slice \ reversed class< ] unit-test +[ f ] [ \ reversed \ slice class<= ] unit-test +[ f ] [ \ slice \ reversed class<= ] unit-test PREDICATE: no-docs < word "documentation" word-prop not ; UNION: no-docs-union no-docs integer ; -[ t ] [ no-docs no-docs-union class< ] unit-test -[ f ] [ no-docs-union no-docs class< ] unit-test +[ t ] [ no-docs no-docs-union class<= ] unit-test +[ f ] [ no-docs-union no-docs class<= ] unit-test TUPLE: a ; TUPLE: b ; UNION: c a b ; -[ t ] [ \ c \ tuple class< ] unit-test -[ f ] [ \ tuple \ c class< ] unit-test +[ t ] [ \ c \ tuple class<= ] unit-test +[ f ] [ \ tuple \ c class<= ] unit-test -[ t ] [ \ tuple-class \ class class< ] unit-test -[ f ] [ \ class \ tuple-class class< ] unit-test +[ t ] [ \ tuple-class \ class class<= ] unit-test +[ f ] [ \ class \ tuple-class class<= ] unit-test TUPLE: tuple-example ; -[ t ] [ \ null \ tuple-example class< ] unit-test -[ f ] [ \ object \ tuple-example class< ] unit-test -[ f ] [ \ object \ tuple-example class< ] unit-test -[ t ] [ \ tuple-example \ tuple class< ] unit-test -[ f ] [ \ tuple \ tuple-example class< ] unit-test +[ t ] [ \ null \ tuple-example class<= ] unit-test +[ f ] [ \ object \ tuple-example class<= ] unit-test +[ f ] [ \ object \ tuple-example class<= ] unit-test +[ t ] [ \ tuple-example \ tuple class<= ] unit-test +[ f ] [ \ tuple \ tuple-example class<= ] unit-test TUPLE: a1 ; TUPLE: b1 ; @@ -84,57 +90,57 @@ UNION: x1 a1 b1 ; UNION: y1 a1 c1 ; UNION: z1 b1 c1 ; -[ f ] [ z1 x1 y1 class-and class< ] unit-test +[ f ] [ z1 x1 y1 class-and class<= ] unit-test -[ t ] [ x1 y1 class-and a1 class< ] unit-test +[ t ] [ x1 y1 class-and a1 class<= ] unit-test [ f ] [ y1 z1 class-and x1 classes-intersect? ] unit-test -[ f ] [ b1 c1 class-or a1 b1 class-or a1 c1 class-and class-and class< ] unit-test +[ f ] [ b1 c1 class-or a1 b1 class-or a1 c1 class-and class-and class<= ] unit-test -[ t ] [ a1 b1 class-or a1 c1 class-or class-and a1 class< ] unit-test +[ t ] [ a1 b1 class-or a1 c1 class-or class-and a1 class<= ] unit-test [ f ] [ a1 c1 class-or b1 c1 class-or class-and a1 b1 class-or classes-intersect? ] unit-test [ f ] [ growable \ hi-tag classes-intersect? ] unit-test [ t ] [ - growable tuple sequence class-and class< + growable tuple sequence class-and class<= ] unit-test [ t ] [ - growable assoc class-and tuple class< + growable assoc class-and tuple class<= ] unit-test -[ t ] [ object \ f \ f class-not class-or class< ] unit-test +[ t ] [ object \ f \ f class-not class-or class<= ] unit-test [ t ] [ fixnum class-not integer class-and bignum class= ] unit-test [ f ] [ integer integer class-not classes-intersect? ] unit-test -[ t ] [ array number class-not class< ] unit-test +[ t ] [ array number class-not class<= ] unit-test -[ f ] [ bignum number class-not class< ] unit-test +[ f ] [ bignum number class-not class<= ] unit-test [ vector ] [ vector class-not class-not ] unit-test -[ t ] [ fixnum fixnum bignum class-or class< ] unit-test +[ t ] [ fixnum fixnum bignum class-or class<= ] unit-test -[ f ] [ fixnum class-not integer class-and array class< ] unit-test +[ f ] [ fixnum class-not integer class-and array class<= ] unit-test -[ f ] [ fixnum class-not integer class< ] unit-test +[ f ] [ fixnum class-not integer class<= ] unit-test -[ f ] [ number class-not array class< ] unit-test +[ f ] [ number class-not array class<= ] unit-test -[ f ] [ fixnum class-not array class< ] unit-test +[ f ] [ fixnum class-not array class<= ] unit-test -[ t ] [ number class-not integer class-not class< ] unit-test +[ t ] [ number class-not integer class-not class<= ] unit-test [ t ] [ vector array class-not class-and vector class= ] unit-test [ f ] [ fixnum class-not number class-and array classes-intersect? ] unit-test -[ f ] [ fixnum class-not integer class< ] unit-test +[ f ] [ fixnum class-not integer class<= ] unit-test [ t ] [ null class-not object class= ] unit-test @@ -147,7 +153,7 @@ UNION: z1 b1 c1 ; [ t ] [ fixnum class-not fixnum fixnum class-not class-or - class< + class<= ] unit-test ! Test method inlining @@ -187,9 +193,9 @@ UNION: z1 b1 c1 ; [ f ] [ null { number fixnum null } min-class ] unit-test ! Test for hangs? -: random-class classes random ; +: random-class ( -- class ) classes random ; -: random-op +: random-op ( -- word ) { class-and class-or @@ -205,13 +211,13 @@ UNION: z1 b1 c1 ; ] unit-test ] times -: random-boolean +: random-boolean ( -- ? ) { t f } random ; -: boolean>class +: boolean>class ( ? -- class ) object null ? ; -: random-boolean-op +: random-boolean-op ( -- word ) { and or @@ -219,9 +225,10 @@ UNION: z1 b1 c1 ; xor } random ; -: class-xor [ class-or ] 2keep class-and class-not class-and ; +: class-xor ( cls1 cls2 -- cls3 ) + [ class-or ] 2keep class-and class-not class-and ; -: boolean-op>class-op +: boolean-op>class-op ( word -- word' ) { { and class-and } { or class-or } @@ -241,3 +248,58 @@ UNION: z1 b1 c1 ; = ] unit-test ] times + +SINGLETON: xxx +UNION: yyy xxx ; + +[ { yyy xxx } ] [ { xxx yyy } sort-classes ] unit-test +[ { yyy xxx } ] [ { yyy xxx } sort-classes ] unit-test + +[ { number ratio integer } ] [ { ratio number integer } sort-classes ] unit-test +[ { sequence number ratio } ] [ { ratio number sequence } sort-classes ] unit-test + +TUPLE: xa ; +TUPLE: xb ; +TUPLE: xc < xa ; +TUPLE: xd < xb ; +TUPLE: xe ; +TUPLE: xf < xb ; +TUPLE: xg < xb ; +TUPLE: xh < xb ; + +[ t ] [ { xa xb xc xd xe xf xg xh } sort-classes dup sort-classes = ] unit-test + +INTERSECTION: generic-class generic class ; + +[ t ] [ generic-class generic class<= ] unit-test +[ t ] [ generic-class \ class class<= ] unit-test + +! Later +[ + [ t ] [ \ class generic class-and generic-class class<= ] unit-test + [ t ] [ \ class generic class-and generic-class swap class<= ] unit-test +] drop + +[ t ] [ \ word generic-class classes-intersect? ] unit-test +[ f ] [ number generic-class classes-intersect? ] unit-test + +[ H{ { word word } } ] [ + generic-class flatten-class +] unit-test + +INTERSECTION: empty-intersection ; + +[ t ] [ object empty-intersection class<= ] unit-test +[ t ] [ empty-intersection object class<= ] unit-test +[ t ] [ \ f class-not empty-intersection class<= ] unit-test +[ f ] [ empty-intersection \ f class-not class<= ] unit-test +[ t ] [ \ number empty-intersection class<= ] unit-test +[ t ] [ empty-intersection class-not null class<= ] unit-test +[ t ] [ null empty-intersection class-not class<= ] unit-test + +[ t ] [ \ f class-not \ f class-or empty-intersection class<= ] unit-test +[ t ] [ empty-intersection \ f class-not \ f class-or class<= ] unit-test + +[ t ] [ object \ f class-not \ f class-or class<= ] unit-test + +[ ] [ object flatten-builtin-class drop ] unit-test diff --git a/core/classes/algebra/algebra.factor b/core/classes/algebra/algebra.factor index f2941e3cef..a9c1520fc6 100755 --- a/core/classes/algebra/algebra.factor +++ b/core/classes/algebra/algebra.factor @@ -2,16 +2,16 @@ ! See http://factorcode.org/license.txt for BSD license. USING: kernel classes classes.builtin combinators accessors sequences arrays vectors assocs namespaces words sorting layouts -math hashtables kernel.private sets ; +math hashtables kernel.private sets math.order ; IN: classes.algebra : 2cache ( key1 key2 assoc quot -- value ) >r >r 2array r> [ first2 ] r> compose cache ; inline -DEFER: (class<) +DEFER: (class<=) -: class< ( first second -- ? ) - class<-cache get [ (class<) ] 2cache ; +: class<= ( first second -- ? ) + class<=-cache get [ (class<=) ] 2cache ; DEFER: (class-not) @@ -37,7 +37,7 @@ TUPLE: anonymous-union members ; C: anonymous-union -TUPLE: anonymous-intersection members ; +TUPLE: anonymous-intersection participants ; C: anonymous-intersection @@ -45,65 +45,91 @@ TUPLE: anonymous-complement class ; C: anonymous-complement -: superclass< ( first second -- ? ) - >r superclass r> class< ; +: superclass<= ( first second -- ? ) + >r superclass r> class<= ; -: left-union-class< ( first second -- ? ) - >r members r> [ class< ] curry all? ; +: left-anonymous-union<= ( first second -- ? ) + >r members>> r> [ class<= ] curry all? ; -: right-union-class< ( first second -- ? ) - members [ class< ] with contains? ; +: right-anonymous-union<= ( first second -- ? ) + members>> [ class<= ] with contains? ; -: left-anonymous-union< ( first second -- ? ) - >r members>> r> [ class< ] curry all? ; +: left-anonymous-intersection<= ( first second -- ? ) + >r participants>> r> [ class<= ] curry contains? ; -: right-anonymous-union< ( first second -- ? ) - members>> [ class< ] with contains? ; +: right-anonymous-intersection<= ( first second -- ? ) + participants>> [ class<= ] with all? ; -: left-anonymous-intersection< ( first second -- ? ) - >r members>> r> [ class< ] curry contains? ; +: anonymous-complement<= ( first second -- ? ) + [ class>> ] bi@ swap class<= ; -: right-anonymous-intersection< ( first second -- ? ) - members>> [ class< ] with all? ; - -: anonymous-complement< ( first second -- ? ) - [ class>> ] bi@ swap class< ; - -: (class<) ( first second -- -1/0/1 ) +: normalize-class ( class -- class' ) { - { [ 2dup eq? ] [ 2drop t ] } - { [ dup object eq? ] [ 2drop t ] } - { [ over null eq? ] [ 2drop t ] } - { [ 2dup [ anonymous-complement? ] both? ] [ anonymous-complement< ] } - { [ over anonymous-union? ] [ left-anonymous-union< ] } - { [ over anonymous-intersection? ] [ left-anonymous-intersection< ] } - { [ over members ] [ left-union-class< ] } - { [ dup anonymous-union? ] [ right-anonymous-union< ] } - { [ dup anonymous-intersection? ] [ right-anonymous-intersection< ] } - { [ over anonymous-complement? ] [ 2drop f ] } - { [ dup anonymous-complement? ] [ class>> classes-intersect? not ] } - { [ dup members ] [ right-union-class< ] } - { [ over superclass ] [ superclass< ] } - [ 2drop f ] + { [ dup members ] [ members ] } + { [ dup participants ] [ participants ] } + [ ] } cond ; +: normalize-complement ( class -- class' ) + class>> normalize-class { + { [ dup anonymous-union? ] [ + members>> + [ class-not normalize-class ] map + + ] } + { [ dup anonymous-intersection? ] [ + participants>> + [ class-not normalize-class ] map + + ] } + } cond ; + +: left-anonymous-complement<= ( first second -- ? ) + >r normalize-complement r> class<= ; + +PREDICATE: nontrivial-anonymous-complement < anonymous-complement + class>> { + [ anonymous-union? ] + [ anonymous-intersection? ] + [ members ] + [ participants ] + } cleave or or or ; + +PREDICATE: empty-union < anonymous-union members>> empty? ; + +PREDICATE: empty-intersection < anonymous-intersection participants>> empty? ; + +: (class<=) ( first second -- -1/0/1 ) + 2dup eq? [ 2drop t ] [ + [ normalize-class ] bi@ { + { [ dup empty-intersection? ] [ 2drop t ] } + { [ over empty-union? ] [ 2drop t ] } + { [ 2dup [ anonymous-complement? ] both? ] [ anonymous-complement<= ] } + { [ over anonymous-union? ] [ left-anonymous-union<= ] } + { [ over anonymous-intersection? ] [ left-anonymous-intersection<= ] } + { [ over nontrivial-anonymous-complement? ] [ left-anonymous-complement<= ] } + { [ dup anonymous-union? ] [ right-anonymous-union<= ] } + { [ dup anonymous-intersection? ] [ right-anonymous-intersection<= ] } + { [ dup anonymous-complement? ] [ class>> classes-intersect? not ] } + { [ over superclass ] [ superclass<= ] } + [ 2drop f ] + } cond + ] if ; + : anonymous-union-intersect? ( first second -- ? ) members>> [ classes-intersect? ] with contains? ; : anonymous-intersection-intersect? ( first second -- ? ) - members>> [ classes-intersect? ] with all? ; + participants>> [ classes-intersect? ] with all? ; : anonymous-complement-intersect? ( first second -- ? ) - class>> class< not ; - -: union-class-intersect? ( first second -- ? ) - members [ classes-intersect? ] with contains? ; + class>> class<= not ; : tuple-class-intersect? ( first second -- ? ) { { [ over tuple eq? ] [ 2drop t ] } { [ over builtin-class? ] [ 2drop f ] } - { [ over tuple-class? ] [ [ class< ] [ swap class< ] 2bi or ] } + { [ over tuple-class? ] [ [ class<= ] [ swap class<= ] 2bi or ] } [ swap classes-intersect? ] } cond ; @@ -115,61 +141,57 @@ C: anonymous-complement } cond ; : (classes-intersect?) ( first second -- ? ) - { + normalize-class { { [ dup anonymous-union? ] [ anonymous-union-intersect? ] } { [ dup anonymous-intersection? ] [ anonymous-intersection-intersect? ] } { [ dup anonymous-complement? ] [ anonymous-complement-intersect? ] } { [ dup tuple-class? ] [ tuple-class-intersect? ] } { [ dup builtin-class? ] [ builtin-class-intersect? ] } { [ dup superclass ] [ superclass classes-intersect? ] } - { [ dup members ] [ union-class-intersect? ] } } cond ; -: left-union-and ( first second -- class ) - >r members r> [ class-and ] curry map ; - -: right-union-and ( first second -- class ) - members [ class-and ] with map ; - -: left-anonymous-union-and ( first second -- class ) - >r members>> r> [ class-and ] curry map ; - -: right-anonymous-union-and ( first second -- class ) +: anonymous-union-and ( first second -- class ) members>> [ class-and ] with map ; -: left-anonymous-intersection-and ( first second -- class ) - >r members>> r> suffix ; - -: right-anonymous-intersection-and ( first second -- class ) - members>> swap suffix ; +: anonymous-intersection-and ( first second -- class ) + participants>> swap suffix ; : (class-and) ( first second -- class ) { - { [ 2dup class< ] [ drop ] } - { [ 2dup swap class< ] [ nip ] } + { [ 2dup class<= ] [ drop ] } + { [ 2dup swap class<= ] [ nip ] } { [ 2dup classes-intersect? not ] [ 2drop null ] } - { [ dup members ] [ right-union-and ] } - { [ dup anonymous-union? ] [ right-anonymous-union-and ] } - { [ dup anonymous-intersection? ] [ right-anonymous-intersection-and ] } - { [ over members ] [ left-union-and ] } - { [ over anonymous-union? ] [ left-anonymous-union-and ] } - { [ over anonymous-intersection? ] [ left-anonymous-intersection-and ] } - [ 2array ] + [ + [ normalize-class ] bi@ { + { [ dup anonymous-union? ] [ anonymous-union-and ] } + { [ dup anonymous-intersection? ] [ anonymous-intersection-and ] } + { [ over anonymous-union? ] [ swap anonymous-union-and ] } + { [ over anonymous-intersection? ] [ swap anonymous-intersection-and ] } + [ 2array ] + } cond + ] } cond ; -: left-anonymous-union-or ( first second -- class ) - >r members>> r> suffix ; - -: right-anonymous-union-or ( first second -- class ) +: anonymous-union-or ( first second -- class ) members>> swap suffix ; +: ((class-or)) ( first second -- class ) + [ normalize-class ] bi@ { + { [ dup anonymous-union? ] [ anonymous-union-or ] } + { [ over anonymous-union? ] [ swap anonymous-union-or ] } + [ 2array ] + } cond ; + +: anonymous-complement-or ( first second -- class ) + 2dup class>> swap class<= [ 2drop object ] [ ((class-or)) ] if ; + : (class-or) ( first second -- class ) { - { [ 2dup class< ] [ nip ] } - { [ 2dup swap class< ] [ drop ] } - { [ dup anonymous-union? ] [ right-anonymous-union-or ] } - { [ over anonymous-union? ] [ left-anonymous-union-or ] } - [ 2array ] + { [ 2dup class<= ] [ nip ] } + { [ 2dup swap class<= ] [ drop ] } + { [ dup anonymous-complement? ] [ anonymous-complement-or ] } + { [ over anonymous-complement? ] [ swap anonymous-complement-or ] } + [ ((class-or)) ] } cond ; : (class-not) ( class -- complement ) @@ -180,22 +202,38 @@ C: anonymous-complement [ ] } cond ; +: class< ( first second -- ? ) + { + { [ 2dup class<= not ] [ 2drop f ] } + { [ 2dup swap class<= not ] [ 2drop t ] } + [ [ rank-class ] bi@ < ] + } cond ; + : largest-class ( seq -- n elt ) - dup [ - [ 2dup class< >r swap class< not r> and ] - with subset empty? - ] curry find [ "Topological sort failed" throw ] unless* ; + dup [ [ class< ] with contains? not ] curry find-last + [ "Topological sort failed" throw ] unless* ; : sort-classes ( seq -- newseq ) - >vector + [ [ word-name ] compare ] sort >vector [ dup empty? not ] [ dup largest-class >r over delete-nth r> ] [ ] unfold nip ; : min-class ( class seq -- class/f ) - over [ classes-intersect? ] curry subset + over [ classes-intersect? ] curry filter dup empty? [ 2drop f ] [ - tuck [ class< ] with all? [ peek ] [ drop f ] if + tuck [ class<= ] with all? [ peek ] [ drop f ] if + ] if ; + +DEFER: (flatten-class) +DEFER: flatten-builtin-class + +: flatten-intersection-class ( class -- ) + participants [ flatten-builtin-class ] map + dup empty? [ + drop builtins get [ (flatten-class) ] each + ] [ + unclip [ assoc-intersect ] reduce [ swap set ] assoc-each ] if ; : (flatten-class) ( class -- ) @@ -203,6 +241,7 @@ C: anonymous-complement { [ dup tuple-class? ] [ dup set ] } { [ dup builtin-class? ] [ dup set ] } { [ dup members ] [ members [ (flatten-class) ] each ] } + { [ dup participants ] [ flatten-intersection-class ] } { [ dup superclass ] [ superclass (flatten-class) ] } [ drop ] } cond ; @@ -212,7 +251,7 @@ C: anonymous-complement : flatten-builtin-class ( class -- assoc ) flatten-class [ - dup tuple class< [ 2drop tuple tuple ] when + dup tuple class<= [ 2drop tuple tuple ] when ] assoc-map ; : class-types ( class -- seq ) diff --git a/core/classes/builtin/builtin.factor b/core/classes/builtin/builtin.factor index 1c2871b031..8e992b852e 100644 --- a/core/classes/builtin/builtin.factor +++ b/core/classes/builtin/builtin.factor @@ -16,3 +16,5 @@ PREDICATE: builtin-class < class M: hi-tag class hi-tag type>class ; M: object class tag type>class ; + +M: builtin-class rank-class drop 0 ; diff --git a/core/classes/classes-docs.factor b/core/classes/classes-docs.factor index dd3782e877..9fc4f6c4e7 100755 --- a/core/classes/classes-docs.factor +++ b/core/classes/classes-docs.factor @@ -40,6 +40,7 @@ $nl "There are several sorts of classes:" { $subsection "builtin-classes" } { $subsection "unions" } +{ $subsection "intersections" } { $subsection "mixins" } { $subsection "predicates" } { $subsection "singletons" } @@ -47,6 +48,7 @@ $nl $nl "Classes can be inspected and operated upon:" { $subsection "class-operations" } +{ $subsection "class-linearization" } { $see-also "class-index" } ; ABOUT: "classes" @@ -55,7 +57,7 @@ HELP: class { $values { "object" object } { "class" class } } { $description "Outputs an object's canonical class. While an object may be an instance of more than one class, the canonical class is either its built-in class, or if the object is a tuple, its tuple class." } { $class-description "The class of all class words." } -{ $examples { $example "USING: classes prettyprint ;" "1.0 class ." "float" } { $example "USING: classes prettyprint ;" "TUPLE: point x y z ;\nT{ point f 1 2 3 } class ." "point" } } ; +{ $examples { $example "USING: classes prettyprint ;" "1.0 class ." "float" } { $example "USING: classes prettyprint ;" "IN: scratchpad" "TUPLE: point x y z ;\nT{ point f 1 2 3 } class ." "point" } } ; HELP: classes { $values { "seq" "a sequence of class words" } } @@ -63,7 +65,7 @@ HELP: classes HELP: tuple-class { $class-description "The class of tuple class words." } -{ $examples { $example "USING: classes prettyprint ;" "TUPLE: name title first last ;" "name tuple-class? ." "t" } } ; +{ $examples { $example "USING: classes prettyprint ;" "IN: scratchpad" "TUPLE: name title first last ;" "name tuple-class? ." "t" } } ; HELP: update-map { $var-description "Hashtable mapping each class to a set of classes defined in terms of this class. The " { $link define-class } " word uses this information to update generic words when classes are redefined." } ; @@ -85,7 +87,11 @@ HELP: members { $values { "class" class } { "seq" "a sequence of union members, or " { $link f } } } { $description "If " { $snippet "class" } " is a union class, outputs a sequence of its member classes, otherwise outputs " { $link f } "." } ; +HELP: participants +{ $values { "class" class } { "seq" "a sequence of intersection participants, or " { $link f } } } +{ $description "If " { $snippet "class" } " is an intersection class, outputs a sequence of its participant classes, otherwise outputs " { $link f } "." } ; + HELP: define-class -{ $values { "word" word } { "members" "a sequence of class words" } { "superclass" class } { "metaclass" class } } +{ $values { "word" word } { "superclass" class } { "members" "a sequence of class words" } { "participants" "a sequence of class words" } { "metaclass" class } } { $description "Sets a property indicating this word is a class word, thus making it an instance of " { $link class } ", and registers it with " { $link update-map } "." } $low-level-note ; diff --git a/core/classes/classes-tests.factor b/core/classes/classes-tests.factor index ae19f38d14..a03fed7fcb 100755 --- a/core/classes/classes-tests.factor +++ b/core/classes/classes-tests.factor @@ -18,14 +18,14 @@ GENERIC: generic-update-test ( x -- y ) M: union-1 generic-update-test drop "union-1" ; -[ f ] [ bignum union-1 class< ] unit-test -[ t ] [ union-1 number class< ] unit-test +[ f ] [ bignum union-1 class<= ] unit-test +[ t ] [ union-1 number class<= ] unit-test [ "union-1" ] [ 1.0 generic-update-test ] unit-test "IN: classes.tests USE: math USE: arrays UNION: union-1 rational array ;" eval -[ t ] [ bignum union-1 class< ] unit-test -[ f ] [ union-1 number class< ] unit-test +[ t ] [ bignum union-1 class<= ] unit-test +[ f ] [ union-1 number class<= ] unit-test [ "union-1" ] [ { 1.0 } generic-update-test ] unit-test "IN: classes.tests USE: math PREDICATE: union-1 < integer even? ;" eval @@ -52,7 +52,7 @@ M: sequence-mixin collection-size length ; M: assoc-mixin collection-size assoc-size ; -[ t ] [ array sequence-mixin class< ] unit-test +[ t ] [ array sequence-mixin class<= ] unit-test [ t ] [ { 1 2 3 } sequence-mixin? ] unit-test [ 3 ] [ { 1 2 3 } collection-size ] unit-test [ f ] [ H{ { 1 2 } { 2 3 } } sequence-mixin? ] unit-test @@ -67,19 +67,19 @@ MIXIN: mx1 INSTANCE: integer mx1 -[ t ] [ integer mx1 class< ] unit-test -[ t ] [ mx1 integer class< ] unit-test -[ t ] [ mx1 number class< ] unit-test +[ t ] [ integer mx1 class<= ] unit-test +[ t ] [ mx1 integer class<= ] unit-test +[ t ] [ mx1 number class<= ] unit-test "IN: classes.tests USE: arrays INSTANCE: array mx1" eval -[ t ] [ array mx1 class< ] unit-test -[ f ] [ mx1 number class< ] unit-test +[ t ] [ array mx1 class<= ] unit-test +[ f ] [ mx1 number class<= ] unit-test [ \ mx1 forget ] with-compilation-unit ! Empty unions were causing problems -GENERIC: empty-union-test +GENERIC: empty-union-test ( obj -- obj ) UNION: empty-union-1 ; @@ -94,14 +94,14 @@ UNION: redefine-bug-1 fixnum ; UNION: redefine-bug-2 redefine-bug-1 quotation ; -[ t ] [ fixnum redefine-bug-2 class< ] unit-test -[ t ] [ quotation redefine-bug-2 class< ] unit-test +[ t ] [ fixnum redefine-bug-2 class<= ] unit-test +[ t ] [ quotation redefine-bug-2 class<= ] unit-test [ ] [ "IN: classes.tests USE: math UNION: redefine-bug-1 bignum ;" eval ] unit-test -[ t ] [ bignum redefine-bug-1 class< ] unit-test -[ f ] [ fixnum redefine-bug-2 class< ] unit-test -[ t ] [ bignum redefine-bug-2 class< ] unit-test +[ t ] [ bignum redefine-bug-1 class<= ] unit-test +[ f ] [ fixnum redefine-bug-2 class<= ] unit-test +[ t ] [ bignum redefine-bug-2 class<= ] unit-test USE: io.streams.string @@ -160,3 +160,12 @@ TUPLE: flat-mx-2-1 ; INSTANCE: flat-mx-2-1 flat-mx-2 [ t ] [ 3 number instance? ] unit-test [ f ] [ 3 null instance? ] unit-test [ t ] [ "hi" \ hi-tag instance? ] unit-test + +! Regression +GENERIC: method-forget-test ( obj -- obj ) +TUPLE: method-forget-class ; +M: method-forget-class method-forget-test ; + +[ f ] [ \ method-forget-test "methods" word-prop assoc-empty? ] unit-test +[ ] [ [ \ method-forget-class forget ] with-compilation-unit ] unit-test +[ t ] [ \ method-forget-test "methods" word-prop assoc-empty? ] unit-test diff --git a/core/classes/classes.factor b/core/classes/classes.factor index 4f43b86f64..593213c5c6 100755 --- a/core/classes/classes.factor +++ b/core/classes/classes.factor @@ -5,21 +5,21 @@ slots.private namespaces sequences strings words vectors math quotations combinators sorting effects graphs vocabs ; IN: classes -SYMBOL: class<-cache +SYMBOL: class<=-cache SYMBOL: class-not-cache SYMBOL: classes-intersect-cache SYMBOL: class-and-cache SYMBOL: class-or-cache : init-caches ( -- ) - H{ } clone class<-cache set + H{ } clone class<=-cache set H{ } clone class-not-cache set H{ } clone classes-intersect-cache set H{ } clone class-and-cache set H{ } clone class-or-cache set ; : reset-caches ( -- ) - class<-cache get clear-assoc + class<=-cache get clear-assoc class-not-cache get clear-assoc classes-intersect-cache get clear-assoc class-and-cache get clear-assoc @@ -33,12 +33,12 @@ PREDICATE: class < word PREDICATE: tuple-class < class "metaclass" word-prop tuple-class eq? ; -: classes ( -- seq ) all-words [ class? ] subset ; +: classes ( -- seq ) all-words [ class? ] filter ; : predicate-word ( word -- predicate ) [ word-name "?" append ] keep word-vocabulary create ; -: predicate-effect 1 { "?" } ; +: predicate-effect T{ effect f 1 { "?" } } ; PREDICATE: predicate < word "predicating" word-prop >boolean ; @@ -57,36 +57,50 @@ PREDICATE: predicate < word "predicating" word-prop >boolean ; #! Output f for non-classes to work with algebra code dup class? [ "members" word-prop ] [ drop f ] if ; +: participants ( class -- seq ) + #! Output f for non-classes to work with algebra code + dup class? [ "participants" word-prop ] [ drop f ] if ; + +GENERIC: rank-class ( class -- n ) + GENERIC: reset-class ( class -- ) M: word reset-class drop ; -r dup reset-class + dup class? [ dup new-class ] unless dup deferred? [ dup define-symbol ] when dup word-props r> assoc-union over set-word-props @@ -102,15 +116,15 @@ GENERIC: update-class ( class -- ) M: class update-class drop ; -GENERIC: update-methods ( assoc -- ) +GENERIC: update-methods ( class assoc -- ) : update-classes ( class -- ) - class-usages - [ [ drop update-class ] assoc-each ] + dup class-usages + [ nip keys [ update-class ] each ] [ update-methods ] - bi ; + 2bi ; -: define-class ( word superclass members metaclass -- ) +: define-class ( word superclass members participants metaclass -- ) #! If it was already a class, update methods after. reset-caches make-class-props diff --git a/core/classes/intersection/intersection-docs.factor b/core/classes/intersection/intersection-docs.factor new file mode 100644 index 0000000000..e9ca706d63 --- /dev/null +++ b/core/classes/intersection/intersection-docs.factor @@ -0,0 +1,28 @@ +USING: generic help.markup help.syntax kernel kernel.private +namespaces sequences words arrays layouts help effects math +layouts classes.private classes compiler.units ; +IN: classes.intersection + +ARTICLE: "intersections" "Intersection classes" +"An object is an instance of a intersection class if it is an instance of all of its participants." +{ $subsection POSTPONE: INTERSECTION: } +{ $subsection define-intersection-class } +"Intersection classes can be introspected:" +{ $subsection participants } +"The set of intersection classes is a class:" +{ $subsection intersection-class } +{ $subsection intersection-class? } +"Intersection classes are used to associate a method with objects which are simultaneously instances of multiple different classes, as well as to conveniently define predicates." ; + +ABOUT: "intersections" + +HELP: define-intersection-class +{ $values { "class" class } { "participants" "a sequence of classes" } } +{ $description "Defines a intersection class with specified participants. This is the run time equivalent of " { $link POSTPONE: INTERSECTION: } "." } +{ $notes "This word must be called from inside " { $link with-compilation-unit } "." } +{ $side-effects "class" } ; + +{ intersection-class define-intersection-class POSTPONE: INTERSECTION: } related-words + +HELP: intersection-class +{ $class-description "The class of intersection classes." } ; diff --git a/core/classes/intersection/intersection.factor b/core/classes/intersection/intersection.factor new file mode 100644 index 0000000000..7ea8e24f0a --- /dev/null +++ b/core/classes/intersection/intersection.factor @@ -0,0 +1,33 @@ +! Copyright (C) 2004, 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: words sequences kernel assocs combinators classes +namespaces arrays math quotations ; +IN: classes.intersection + +PREDICATE: intersection-class < class + "metaclass" word-prop intersection-class eq? ; + +: intersection-predicate-quot ( members -- quot ) + dup empty? [ + drop [ drop t ] + ] [ + unclip "predicate" word-prop swap [ + "predicate" word-prop [ dup ] swap [ not ] 3append + [ drop f ] + ] { } map>assoc alist>quot + ] if ; + +: define-intersection-predicate ( class -- ) + dup participants intersection-predicate-quot define-predicate ; + +M: intersection-class update-class define-intersection-predicate ; + +: define-intersection-class ( class participants -- ) + [ f f rot intersection-class define-class ] + [ drop update-classes ] + 2bi ; + +M: intersection-class reset-class + { "class" "metaclass" "participants" } reset-props ; + +M: intersection-class rank-class drop 2 ; diff --git a/core/classes/mixin/mixin.factor b/core/classes/mixin/mixin.factor index 33b0fc32fa..9ffcd952e3 100755 --- a/core/classes/mixin/mixin.factor +++ b/core/classes/mixin/mixin.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2004, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: classes classes.union words kernel sequences -definitions combinators arrays accessors ; +definitions combinators arrays assocs generic accessors ; IN: classes.mixin PREDICATE: mixin-class < union-class "mixin" word-prop ; @@ -9,9 +9,12 @@ PREDICATE: mixin-class < union-class "mixin" word-prop ; M: mixin-class reset-class { "class" "metaclass" "members" "mixin" } reset-props ; +M: mixin-class rank-class drop 3 ; + : redefine-mixin-class ( class members -- ) - dupd define-union-class - t "mixin" set-word-prop ; + [ (define-union-class) ] + [ drop t "mixin" set-word-prop ] + 2bi ; : define-mixin-class ( class -- ) dup mixin-class? [ @@ -28,17 +31,35 @@ TUPLE: check-mixin-class mixin ; ] unless ; : if-mixin-member? ( class mixin true false -- ) - >r >r check-mixin-class 2dup members memq? r> r> if ; inline + [ check-mixin-class 2dup members memq? ] 2dip if ; inline : change-mixin-class ( class mixin quot -- ) - [ members swap bootstrap-word ] swap compose keep + [ [ members swap bootstrap-word ] dip call ] [ drop ] 2bi swap redefine-mixin-class ; inline +: update-classes/new ( mixin -- ) + class-usages + [ keys [ update-class ] each ] + [ implementors [ make-generic ] each ] bi ; + : add-mixin-instance ( class mixin -- ) - [ 2drop ] [ [ suffix ] change-mixin-class ] if-mixin-member? ; + #! Note: we call update-classes on the new member, not the + #! mixin. This ensures that we only have to update the + #! methods whose specializer intersects the new member, not + #! the entire mixin (since the other mixin members are not + #! affected at all). Also, all usages of the mixin will get + #! updated by transitivity; the mixins usages appear in + #! class-usages of the member, now that it's been added. + [ 2drop ] [ + [ [ suffix ] change-mixin-class ] 2keep drop + dup new-class? [ update-classes/new ] [ update-classes ] if + ] if-mixin-member? ; : remove-mixin-instance ( class mixin -- ) - [ [ swap remove ] change-mixin-class ] [ 2drop ] if-mixin-member? ; + [ + [ [ swap remove ] change-mixin-class ] keep + update-classes + ] [ 2drop ] if-mixin-member? ; ! Definition protocol implementation ensures that removing an ! INSTANCE: declaration from a source file updates the mixin. diff --git a/core/classes/predicate/predicate.factor b/core/classes/predicate/predicate.factor index 4729a6dd5e..c8de36582e 100755 --- a/core/classes/predicate/predicate.factor +++ b/core/classes/predicate/predicate.factor @@ -14,7 +14,7 @@ PREDICATE: predicate-class < class ] [ ] make ; : define-predicate-class ( class superclass definition -- ) - [ drop f predicate-class define-class ] + [ drop f f predicate-class define-class ] [ nip "predicate-definition" set-word-prop ] [ 2drop @@ -30,3 +30,5 @@ M: predicate-class reset-class "predicate-definition" "superclass" } reset-props ; + +M: predicate-class rank-class drop 1 ; diff --git a/core/classes/singleton/singleton-docs.factor b/core/classes/singleton/singleton-docs.factor index a8dae809ec..f647b006d9 100644 --- a/core/classes/singleton/singleton-docs.factor +++ b/core/classes/singleton/singleton-docs.factor @@ -18,7 +18,7 @@ HELP: SINGLETON: "Defines a new singleton class. The class word itself is the sole instance of the singleton class." } { $examples - { $example "USING: classes.singleton kernel io ;" "SINGLETON: foo\nGENERIC: bar ( obj -- )\nM: foo bar drop \"a foo!\" print ;\nfoo bar" "a foo!" } + { $example "USING: classes.singleton kernel io ;" "IN: scratchpad" "SINGLETON: foo\nGENERIC: bar ( obj -- )\nM: foo bar drop \"a foo!\" print ;\nfoo bar" "a foo!" } } ; HELP: define-singleton-class diff --git a/core/classes/singleton/singleton-tests.factor b/core/classes/singleton/singleton-tests.factor index 2ed51abb93..10ddde75ae 100644 --- a/core/classes/singleton/singleton-tests.factor +++ b/core/classes/singleton/singleton-tests.factor @@ -10,3 +10,10 @@ GENERIC: zammo ( obj -- str ) [ ] [ SINGLETON: omg ] unit-test [ t ] [ omg singleton-class? ] unit-test [ "IN: classes.singleton.tests\nSINGLETON: omg\n" ] [ [ omg see ] with-string-writer ] unit-test + +SINGLETON: word-and-singleton + +: word-and-singleton 3 ; + +[ t ] [ \ word-and-singleton word-and-singleton? ] unit-test +[ 3 ] [ word-and-singleton ] unit-test diff --git a/core/classes/tuple/tuple-docs.factor b/core/classes/tuple/tuple-docs.factor index cdfdee9717..9f8ce83240 100755 --- a/core/classes/tuple/tuple-docs.factor +++ b/core/classes/tuple/tuple-docs.factor @@ -341,6 +341,7 @@ HELP: new { $examples { $example "USING: kernel prettyprint ;" + "IN: scratchpad" "TUPLE: employee number name department ;" "employee new ." "T{ employee f f f f }" diff --git a/core/classes/tuple/tuple-tests.factor b/core/classes/tuple/tuple-tests.factor index 2932187152..dc99734ce5 100755 --- a/core/classes/tuple/tuple-tests.factor +++ b/core/classes/tuple/tuple-tests.factor @@ -4,11 +4,11 @@ namespaces quotations sequences.private classes continuations generic.standard effects classes.tuple classes.tuple.private arrays vectors strings compiler.units accessors classes.algebra calendar prettyprint io.streams.string splitting inspector -columns ; +columns math.order classes.private ; IN: classes.tuple.tests TUPLE: rect x y w h ; -: rect boa ; +: ( x y w h -- rect ) rect boa ; : move ( x rect -- rect ) [ + ] change-x ; @@ -69,7 +69,7 @@ C: predicate-test PREDICATE: silly-pred < tuple class \ rect = ; -GENERIC: area +GENERIC: area ( obj -- n ) M: silly-pred area dup w>> swap h>> * ; TUPLE: circle radius ; @@ -88,7 +88,7 @@ C: empty [ t length ] [ object>> t eq? ] must-fail-with [ "" ] -[ "TUPLE: constructor-test ; C: constructor-test" eval word word-name ] unit-test +[ "IN: classes.tuple.test TUPLE: constructor-test ; C: constructor-test" eval word word-name ] unit-test TUPLE: size-test a b c d ; @@ -164,7 +164,7 @@ C: t4 [ 1 ] [ 1 m2 ] unit-test ! another combination issue -GENERIC: silly +GENERIC: silly ( obj -- obj obj ) UNION: my-union slice repetition column array vector reversed ; @@ -208,8 +208,8 @@ C: erg's-reshape-problem ! We want to make sure constructors are recompiled when ! tuples are reshaped -: cons-test-1 \ erg's-reshape-problem new ; -: cons-test-2 \ erg's-reshape-problem boa ; +: cons-test-1 ( -- tuple ) \ erg's-reshape-problem new ; +: cons-test-2 ( a b c d -- tuple ) \ erg's-reshape-problem boa ; "IN: classes.tuple.tests TUPLE: erg's-reshape-problem a b c d e f ;" eval @@ -233,8 +233,8 @@ TUPLE: laptop < computer battery ; C: laptop [ t ] [ laptop tuple-class? ] unit-test -[ t ] [ laptop tuple class< ] unit-test -[ t ] [ laptop computer class< ] unit-test +[ t ] [ laptop tuple class<= ] unit-test +[ t ] [ laptop computer class<= ] unit-test [ t ] [ laptop computer classes-intersect? ] unit-test [ ] [ "Pentium" 128 3 hours "laptop" set ] unit-test @@ -242,7 +242,7 @@ C: laptop [ t ] [ "laptop" get computer? ] unit-test [ t ] [ "laptop" get tuple? ] unit-test -: test-laptop-slot-values +: test-laptop-slot-values ( -- ) [ laptop ] [ "laptop" get class ] unit-test [ "Pentium" ] [ "laptop" get cpu>> ] unit-test [ 128 ] [ "laptop" get ram>> ] unit-test @@ -266,8 +266,8 @@ TUPLE: server < computer rackmount ; C: server [ t ] [ server tuple-class? ] unit-test -[ t ] [ server tuple class< ] unit-test -[ t ] [ server computer class< ] unit-test +[ t ] [ server tuple class<= ] unit-test +[ t ] [ server computer class<= ] unit-test [ t ] [ server computer classes-intersect? ] unit-test [ ] [ "PowerPC" 64 "1U" "server" set ] unit-test @@ -275,7 +275,7 @@ C: server [ t ] [ "server" get computer? ] unit-test [ t ] [ "server" get tuple? ] unit-test -: test-server-slot-values +: test-server-slot-values ( -- ) [ server ] [ "server" get class ] unit-test [ "PowerPC" ] [ "server" get cpu>> ] unit-test [ 64 ] [ "server" get ram>> ] unit-test @@ -286,8 +286,8 @@ test-server-slot-values [ f ] [ "server" get laptop? ] unit-test [ f ] [ "laptop" get server? ] unit-test -[ f ] [ server laptop class< ] unit-test -[ f ] [ laptop server class< ] unit-test +[ f ] [ server laptop class<= ] unit-test +[ f ] [ laptop server class<= ] unit-test [ f ] [ laptop server classes-intersect? ] unit-test [ f ] [ 1 2 laptop? ] unit-test @@ -306,9 +306,9 @@ TUPLE: electronic-device ; [ ] [ "IN: classes.tuple.tests TUPLE: computer < electronic-device cpu ram ;" eval ] unit-test -[ f ] [ electronic-device laptop class< ] unit-test -[ t ] [ server electronic-device class< ] unit-test -[ t ] [ laptop server class-or electronic-device class< ] unit-test +[ f ] [ electronic-device laptop class<= ] unit-test +[ t ] [ server electronic-device class<= ] unit-test +[ t ] [ laptop server class-or electronic-device class<= ] unit-test [ t ] [ "laptop" get electronic-device? ] unit-test [ t ] [ "laptop" get computer? ] unit-test @@ -375,7 +375,7 @@ C: test2 "a" "b" "test" set -: test-a/b +: test-a/b ( -- ) [ "a" ] [ "test" get a>> ] unit-test [ "b" ] [ "test" get b>> ] unit-test ; @@ -403,7 +403,7 @@ TUPLE: move-up-2 < move-up-1 c ; T{ move-up-2 f "a" "b" "c" } "move-up" set -: test-move-up +: test-move-up ( -- ) [ "a" ] [ "move-up" get a>> ] unit-test [ "b" ] [ "move-up" get b>> ] unit-test [ "c" ] [ "move-up" get c>> ] unit-test ; @@ -541,4 +541,27 @@ TUPLE: another-forget-accessors-test ; ] unit-test ! Missing error check -[ "IN: tuples.test USE: words TUPLE: wrong-superclass < word ;" eval ] must-fail +[ "IN: classes.tuple.tests USE: words TUPLE: wrong-superclass < word ;" eval ] must-fail + +! Class forget messyness +TUPLE: subclass-forget-test ; + +TUPLE: subclass-forget-test-1 < subclass-forget-test ; +TUPLE: subclass-forget-test-2 < subclass-forget-test ; +TUPLE: subclass-forget-test-3 < subclass-forget-test-2 ; + +[ ] [ "IN: classes.tuple.tests FORGET: subclass-forget-test" eval ] unit-test + +[ H{ { subclass-forget-test-2 subclass-forget-test-2 } } ] +[ subclass-forget-test-2 class-usages ] +unit-test + +[ H{ { subclass-forget-test-3 subclass-forget-test-3 } } ] +[ subclass-forget-test-3 class-usages ] +unit-test + +[ f ] [ subclass-forget-test-1 tuple-class? ] unit-test +[ f ] [ subclass-forget-test-2 tuple-class? ] unit-test +[ subclass-forget-test-3 new ] must-fail + +[ "IN: classes.tuple.tests TUPLE: subclass-forget-test-4 < subclass-forget-test-2 ;" eval ] must-fail diff --git a/core/classes/tuple/tuple.factor b/core/classes/tuple/tuple.factor index c14205e1d9..0b54d7d69f 100755 --- a/core/classes/tuple/tuple.factor +++ b/core/classes/tuple/tuple.factor @@ -102,7 +102,7 @@ ERROR: bad-superclass class ; dup tuple-predicate-quot define-predicate ; : superclass-size ( class -- n ) - superclasses 1 head-slice* + superclasses but-last-slice [ slot-names length ] map sum ; : generate-tuple-slots ( class slots -- slot-specs ) @@ -160,13 +160,13 @@ M: tuple-class update-class tri ; : define-new-tuple-class ( class superclass slots -- ) - [ drop f tuple-class define-class ] + [ drop f f tuple-class define-class ] [ nip "slot-names" set-word-prop ] [ 2drop update-classes ] 3tri ; : subclasses ( class -- classes ) - class-usages keys [ tuple-class? ] subset ; + class-usages keys [ tuple-class? ] filter ; : each-subclass ( class quot -- ) >r subclasses r> each ; inline @@ -176,7 +176,7 @@ M: tuple-class update-class 2drop [ [ update-tuples-after ] - [ changed-definition ] + [ +inlined+ changed-definition ] [ redefined ] tri ] each-subclass @@ -226,6 +226,8 @@ M: tuple-class reset-class } reset-props ] bi ; +M: tuple-class rank-class drop 0 ; + M: tuple clone (clone) dup delegate clone over set-delegate ; diff --git a/core/classes/union/union-docs.factor b/core/classes/union/union-docs.factor index 91726b6697..3d7312a889 100755 --- a/core/classes/union/union-docs.factor +++ b/core/classes/union/union-docs.factor @@ -4,7 +4,7 @@ layouts classes.private classes compiler.units ; IN: classes.union ARTICLE: "unions" "Union classes" -"An object is an instance of a union class if it is an instance of one of its members. Union classes are used to associate the same method with several different classes, as well as to conveniently define predicates." +"An object is an instance of a union class if it is an instance of one of its members." { $subsection POSTPONE: UNION: } { $subsection define-union-class } "Union classes can be introspected:" @@ -12,7 +12,7 @@ ARTICLE: "unions" "Union classes" "The set of union classes is a class:" { $subsection union-class } { $subsection union-class? } -"Unions are used to define behavior shared between a fixed set of classes." +"Unions are used to define behavior shared between a fixed set of classes, as well as to conveniently define predicates." { $see-also "mixins" "tuple-subclassing" } ; ABOUT: "unions" diff --git a/core/classes/union/union.factor b/core/classes/union/union.factor index 09f8f88ced..74e29cfb01 100755 --- a/core/classes/union/union.factor +++ b/core/classes/union/union.factor @@ -7,7 +7,6 @@ IN: classes.union PREDICATE: union-class < class "metaclass" word-prop union-class eq? ; -! Union classes for dispatch on multiple classes. : union-predicate-quot ( members -- quot ) dup empty? [ drop [ drop f ] @@ -23,10 +22,13 @@ PREDICATE: union-class < class M: union-class update-class define-union-predicate ; +: (define-union-class) ( class members -- ) + f swap f union-class define-class ; + : define-union-class ( class members -- ) - [ f swap union-class define-class ] - [ drop update-classes ] - 2bi ; + [ (define-union-class) ] [ drop update-classes ] 2bi ; M: union-class reset-class { "class" "metaclass" "members" } reset-props ; + +M: union-class rank-class drop 2 ; diff --git a/core/combinators/combinators-docs.factor b/core/combinators/combinators-docs.factor index 54c62c44fa..c65c01d2ab 100755 --- a/core/combinators/combinators-docs.factor +++ b/core/combinators/combinators-docs.factor @@ -10,8 +10,10 @@ ARTICLE: "combinators-quot" "Quotation construction utilities" { $subsection alist>quot } ; ARTICLE: "combinators" "Additional combinators" -"The " { $vocab-link "combinators" } " vocabulary provides generalizations of certain combinators from the " { $vocab-link "kernel" } " vocabulary." +"The " { $vocab-link "combinators" } " vocabulary provides a few useful combinators." $nl +"A looping combinator:" +{ $subsection while } "Generalization of " { $link bi } " and " { $link tri } ":" { $subsection cleave } "Generalization of " { $link bi* } " and " { $link tri* } ":" @@ -95,7 +97,7 @@ HELP: case "If there is no case matching " { $snippet "obj" } ", the default case is taken. If the last element of " { $snippet "cases" } " is a quotation, the quotation is called with " { $snippet "obj" } " on the stack. Otherwise, a " { $link no-cond } " error is rasied." $nl "The following two phrases are equivalent:" - { $code "{ { X [ Y ] } { Y [ T ] } } case" } + { $code "{ { X [ Y ] } { Z [ T ] } } case" } { $code "dup X = [ drop Y ] [ dup Z = [ drop T ] [ no-case ] if ] if" } } { $examples diff --git a/core/combinators/combinators.factor b/core/combinators/combinators.factor index da98a78736..f6873429fe 100755 --- a/core/combinators/combinators.factor +++ b/core/combinators/combinators.factor @@ -1,9 +1,9 @@ ! Copyright (C) 2006, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -IN: combinators USING: arrays sequences sequences.private math.private kernel kernel.private math assocs quotations vectors -hashtables sorting words sets ; +hashtables sorting words sets math.order ; +IN: combinators : cleave ( x seq -- ) [ call ] with each ; @@ -95,10 +95,10 @@ M: hashtable hashcode* : (distribute-buckets) ( buckets pair keys -- ) dup t eq? [ - drop [ swap push-new ] curry each + drop [ swap adjoin ] curry each ] [ [ - >r 2dup r> hashcode pick length rem rot nth push-new + >r 2dup r> hashcode pick length rem rot nth adjoin ] each 2drop ] if ; diff --git a/core/command-line/command-line.factor b/core/command-line/command-line.factor index 246bf2dabe..fb4fd374a7 100644 --- a/core/command-line/command-line.factor +++ b/core/command-line/command-line.factor @@ -1,9 +1,9 @@ ! Copyright (C) 2003, 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -IN: command-line USING: init continuations debugger hashtables io kernel kernel.private namespaces parser sequences strings system splitting io.files ; +IN: command-line : run-bootstrap-init ( -- ) "user-init" get [ @@ -36,7 +36,7 @@ SYMBOL: main-vocab-hook main-vocab-hook get [ call ] [ "listener" ] if* ] if ; -: default-cli-args +: default-cli-args ( -- ) global [ "quiet" off "script" off @@ -54,7 +54,7 @@ SYMBOL: main-vocab-hook "none" "run" set-global ; : parse-command-line ( -- ) - cli-args [ cli-arg ] subset + cli-args [ cli-arg ] filter "script" get [ script-mode ] when ignore-cli-args? [ drop ] [ [ run-file ] each ] if "e" get [ eval ] when* ; diff --git a/core/compiler/compiler.factor b/core/compiler/compiler.factor index 806ea914bb..8c653b866e 100755 --- a/core/compiler/compiler.factor +++ b/core/compiler/compiler.factor @@ -4,38 +4,55 @@ USING: kernel namespaces arrays sequences io inference.backend inference.state generator debugger words compiler.units continuations vocabs assocs alien.compiler dlists optimizer definitions math compiler.errors threads graphs generic -inference ; +inference combinators ; IN: compiler : ripple-up ( word -- ) compiled-usage [ drop queue-compile ] assoc-each ; : save-effect ( word effect -- ) - over "compiled-uses" word-prop [ - 2dup swap "compiled-effect" word-prop = - [ over ripple-up ] unless - ] when - "compiled-effect" set-word-prop ; - -: finish-compile ( word effect dependencies -- ) - >r dupd save-effect r> - over compiled-unxref - over compiled-crossref? [ compiled-xref ] [ 2drop ] if ; - -: compile-succeeded ( word -- effect dependencies ) [ - [ word-dataflow optimize ] keep dup generate - ] computing-dependencies ; + over "compiled-effect" word-prop = [ + dup "compiled-uses" word-prop + [ dup ripple-up ] when + ] unless drop + ] + [ "compiled-effect" set-word-prop ] 2bi ; + +: compile-begins ( word -- ) + f swap compiler-error ; : compile-failed ( word error -- ) - f pick compiled get set-at - swap compiler-error ; + [ swap compiler-error ] + [ + drop + [ f swap compiled get set-at ] + [ f save-effect ] + bi + ] 2bi ; + +: compile-succeeded ( effect word -- ) + [ swap save-effect ] + [ compiled-unxref ] + [ + dup crossref? + [ dependencies get compiled-xref ] [ drop ] if + ] tri ; : (compile) ( word -- ) - f over compiler-error - [ dup compile-succeeded finish-compile ] - [ dupd compile-failed f save-effect ] - recover ; + [ + H{ } clone dependencies set + + { + [ compile-begins ] + [ + [ word-dataflow ] [ compile-failed return ] recover + optimize + ] + [ dup generate ] + [ compile-succeeded ] + } cleave + ] curry with-return ; : compile-loop ( assoc -- ) dup assoc-empty? [ drop ] [ diff --git a/core/compiler/constants/constants.factor b/core/compiler/constants/constants.factor index 11f64c9373..622c63d7f0 100755 --- a/core/compiler/constants/constants.factor +++ b/core/compiler/constants/constants.factor @@ -4,19 +4,22 @@ USING: math kernel layouts system ; IN: compiler.constants ! These constants must match vm/memory.h -: card-bits 6 ; -: card-mark HEX: 40 HEX: 80 bitor ; +: card-bits 8 ; +: deck-bits 18 ; +: card-mark ( -- n ) HEX: 40 HEX: 80 bitor ; ! These constants must match vm/layouts.h -: header-offset object tag-number neg ; -: float-offset 8 float tag-number - ; -: string-offset 4 bootstrap-cells object tag-number - ; -: profile-count-offset 7 bootstrap-cells object tag-number - ; -: byte-array-offset 2 bootstrap-cells object tag-number - ; -: alien-offset 3 bootstrap-cells object tag-number - ; -: underlying-alien-offset bootstrap-cell object tag-number - ; -: tuple-class-offset bootstrap-cell tuple tag-number - ; -: class-hash-offset bootstrap-cell object tag-number - ; -: word-xt-offset 8 bootstrap-cells object tag-number - ; -: word-code-offset 9 bootstrap-cells object tag-number - ; -: compiled-header-size 4 bootstrap-cells ; +: header-offset ( -- n ) object tag-number neg ; +: float-offset ( -- n ) 8 float tag-number - ; +: string-offset ( -- n ) 4 bootstrap-cells object tag-number - ; +: profile-count-offset ( -- n ) 7 bootstrap-cells object tag-number - ; +: byte-array-offset ( -- n ) 2 bootstrap-cells object tag-number - ; +: alien-offset ( -- n ) 3 bootstrap-cells object tag-number - ; +: underlying-alien-offset ( -- n ) bootstrap-cell object tag-number - ; +: tuple-class-offset ( -- n ) bootstrap-cell tuple tag-number - ; +: class-hash-offset ( -- n ) bootstrap-cell object tag-number - ; +: word-xt-offset ( -- n ) 8 bootstrap-cells object tag-number - ; +: quot-xt-offset ( -- n ) 3 bootstrap-cells object tag-number - ; +: word-code-offset ( -- n ) 9 bootstrap-cells object tag-number - ; +: array-start-offset ( -- n ) 2 bootstrap-cells object tag-number - ; +: compiled-header-size ( -- n ) 4 bootstrap-cells ; diff --git a/core/compiler/errors/errors-docs.factor b/core/compiler/errors/errors-docs.factor index dd71eb704f..d86587662b 100755 --- a/core/compiler/errors/errors-docs.factor +++ b/core/compiler/errors/errors-docs.factor @@ -21,19 +21,19 @@ HELP: compiler-error HELP: compiler-error. { $values { "error" "an error" } { "word" word } } -{ $description "Prints a compiler error to the " { $link stdio } " stream." } ; +{ $description "Prints a compiler error to " { $link output-stream } "." } ; HELP: compiler-errors. { $values { "type" symbol } } -{ $description "Prints compiler errors to the " { $link stdio } " stream. The type parameter is one of " { $link +error+ } ", " { $link +warning+ } ", or " { $link +linkage+ } "." } ; +{ $description "Prints compiler errors to " { $link output-stream } ". The type parameter is one of " { $link +error+ } ", " { $link +warning+ } ", or " { $link +linkage+ } "." } ; HELP: :errors -{ $description "Prints all serious compiler errors from the most recent compile to the " { $link stdio } " stream." } ; +{ $description "Prints all serious compiler errors from the most recent compile to " { $link output-stream } "." } ; HELP: :warnings -{ $description "Prints all ignorable compiler warnings from the most recent compile to the " { $link stdio } " stream." } ; +{ $description "Prints all ignorable compiler warnings from the most recent compile to " { $link output-stream } "." } ; HELP: :linkage -{ $description "Prints all C library interface linkage errors from the most recent compile to the " { $link stdio } " stream." } ; +{ $description "Prints all C library interface linkage errors from the most recent compile to " { $link output-stream } "." } ; { :errors :warnings } related-words diff --git a/core/compiler/errors/errors.factor b/core/compiler/errors/errors.factor index b7b599e5a9..2bea6ad974 100755 --- a/core/compiler/errors/errors.factor +++ b/core/compiler/errors/errors.factor @@ -27,7 +27,7 @@ SYMBOL: with-compiler-errors? : errors-of-type ( type -- assoc ) compiler-errors get-global swap [ >r nip compiler-error-type r> eq? ] curry - assoc-subset ; + assoc-filter ; : compiler-errors. ( type -- ) errors-of-type >alist sort-keys @@ -59,11 +59,11 @@ PRIVATE> [ set-at ] [ delete-at drop ] if ] [ 2drop ] if ; -: :errors +error+ compiler-errors. ; +: :errors ( -- ) +error+ compiler-errors. ; -: :warnings +warning+ compiler-errors. ; +: :warnings ( -- ) +warning+ compiler-errors. ; -: :linkage +linkage+ compiler-errors. ; +: :linkage ( -- ) +linkage+ compiler-errors. ; : with-compiler-errors ( quot -- ) with-compiler-errors? get "quiet" get or [ call ] [ diff --git a/core/compiler/tests/intrinsics.factor b/core/compiler/tests/intrinsics.factor index 7d473871fe..0e5c96eca0 100755 --- a/core/compiler/tests/intrinsics.factor +++ b/core/compiler/tests/intrinsics.factor @@ -1,11 +1,11 @@ -IN: compiler.tests USING: arrays compiler.units kernel kernel.private math math.constants math.private sequences strings tools.test words continuations sequences.private hashtables.private byte-arrays strings.private system random layouts vectors.private -sbufs.private strings.private slots.private alien +sbufs.private strings.private slots.private alien math.order alien.accessors alien.c-types alien.syntax alien.strings namespaces libc sequences.private io.encodings.ascii ; +IN: compiler.tests ! Make sure that intrinsic ops compile to correct code. [ ] [ 1 [ drop ] compile-call ] unit-test @@ -252,7 +252,7 @@ cell 8 = [ ! Some randomized tests : compiled-fixnum* fixnum* ; -: test-fixnum* +: test-fixnum* ( -- ) 32 random-bits >fixnum 32 random-bits >fixnum 2dup [ fixnum* ] 2keep compiled-fixnum* = @@ -262,7 +262,7 @@ cell 8 = [ : compiled-fixnum>bignum fixnum>bignum ; -: test-fixnum>bignum +: test-fixnum>bignum ( -- ) 32 random-bits >fixnum dup [ fixnum>bignum ] keep compiled-fixnum>bignum = [ drop ] [ "Oops" throw ] if ; @@ -271,7 +271,7 @@ cell 8 = [ : compiled-bignum>fixnum bignum>fixnum ; -: test-bignum>fixnum +: test-bignum>fixnum ( -- ) 5 random [ drop 32 random-bits ] map product >bignum dup [ bignum>fixnum ] keep compiled-bignum>fixnum = [ drop ] [ "Oops" throw ] if ; @@ -377,7 +377,7 @@ cell 8 = [ [ 252 ] [ B{ 1 2 3 -4 5 } 3 [ { byte-array fixnum } declare alien-unsigned-1 ] compile-call ] unit-test [ -4 ] [ B{ 1 2 3 -4 5 } 3 [ { byte-array fixnum } declare alien-signed-1 ] compile-call ] unit-test -: xword-def word-def [ { fixnum } declare ] prepend ; +: xword-def ( word -- def ) word-def [ { fixnum } declare ] prepend ; [ -100 ] [ -100 [ { byte-array } declare *char ] compile-call ] unit-test [ 156 ] [ -100 [ { byte-array } declare *uchar ] compile-call ] unit-test diff --git a/core/compiler/tests/redefine.factor b/core/compiler/tests/redefine.factor new file mode 100644 index 0000000000..b87898c649 --- /dev/null +++ b/core/compiler/tests/redefine.factor @@ -0,0 +1,14 @@ +IN: compiler.tests +USING: compiler tools.test math parser ; + +GENERIC: method-redefine-test ( a -- b ) + +M: integer method-redefine-test 3 + ; + +: method-redefine-test-1 ( -- b ) 3 method-redefine-test ; + +[ 6 ] [ method-redefine-test-1 ] unit-test + +[ ] [ "IN: compiler.tests USE: math M: fixnum method-redefine-test 4 + ;" eval ] unit-test + +[ 7 ] [ method-redefine-test-1 ] unit-test diff --git a/core/compiler/tests/simple.factor b/core/compiler/tests/simple.factor index bc9c56864c..68c85d6d97 100755 --- a/core/compiler/tests/simple.factor +++ b/core/compiler/tests/simple.factor @@ -69,31 +69,31 @@ IN: compiler.tests ! Regression -: empty ; +: empty ( -- ) ; [ "b" ] [ 1 [ empty { [ "a" ] [ "b" ] } dispatch ] compile-call ] unit-test -: dummy-if-1 t [ ] [ ] if ; +: dummy-if-1 ( -- ) t [ ] [ ] if ; [ ] [ dummy-if-1 ] unit-test -: dummy-if-2 f [ ] [ ] if ; +: dummy-if-2 ( -- ) f [ ] [ ] if ; [ ] [ dummy-if-2 ] unit-test -: dummy-if-3 t [ 1 ] [ 2 ] if ; +: dummy-if-3 ( -- n ) t [ 1 ] [ 2 ] if ; [ 1 ] [ dummy-if-3 ] unit-test -: dummy-if-4 f [ 1 ] [ 2 ] if ; +: dummy-if-4 ( -- n ) f [ 1 ] [ 2 ] if ; [ 2 ] [ dummy-if-4 ] unit-test -: dummy-if-5 0 dup 1 fixnum<= [ drop 1 ] [ ] if ; +: dummy-if-5 ( -- n ) 0 dup 1 fixnum<= [ drop 1 ] [ ] if ; [ 1 ] [ dummy-if-5 ] unit-test -: dummy-if-6 +: dummy-if-6 ( n -- n ) dup 1 fixnum<= [ drop 1 ] [ @@ -102,7 +102,7 @@ IN: compiler.tests [ 17 ] [ 10 dummy-if-6 ] unit-test -: dead-code-rec +: dead-code-rec ( -- obj ) t [ 3.2 ] [ @@ -111,11 +111,11 @@ IN: compiler.tests [ 3.2 ] [ dead-code-rec ] unit-test -: one-rec [ f one-rec ] [ "hi" ] if ; +: one-rec ( ? -- obj ) [ f one-rec ] [ "hi" ] if ; [ "hi" ] [ t one-rec ] unit-test -: after-if-test +: after-if-test ( -- n ) t [ ] [ ] if 5 ; [ 5 ] [ after-if-test ] unit-test @@ -127,37 +127,37 @@ DEFER: countdown-b [ ] [ 10 countdown-b ] unit-test -: dummy-when-1 t [ ] when ; +: dummy-when-1 ( -- ) t [ ] when ; [ ] [ dummy-when-1 ] unit-test -: dummy-when-2 f [ ] when ; +: dummy-when-2 ( -- ) f [ ] when ; [ ] [ dummy-when-2 ] unit-test -: dummy-when-3 dup [ dup fixnum* ] when ; +: dummy-when-3 ( a -- b ) dup [ dup fixnum* ] when ; [ 16 ] [ 4 dummy-when-3 ] unit-test [ f ] [ f dummy-when-3 ] unit-test -: dummy-when-4 dup [ dup dup fixnum* fixnum* ] when swap ; +: dummy-when-4 ( a b -- a b ) dup [ dup dup fixnum* fixnum* ] when swap ; [ 64 f ] [ f 4 dummy-when-4 ] unit-test [ f t ] [ t f dummy-when-4 ] unit-test -: dummy-when-5 f [ dup fixnum* ] when ; +: dummy-when-5 ( a -- b ) f [ dup fixnum* ] when ; [ f ] [ f dummy-when-5 ] unit-test -: dummy-unless-1 t [ ] unless ; +: dummy-unless-1 ( -- ) t [ ] unless ; [ ] [ dummy-unless-1 ] unit-test -: dummy-unless-2 f [ ] unless ; +: dummy-unless-2 ( -- ) f [ ] unless ; [ ] [ dummy-unless-2 ] unit-test -: dummy-unless-3 dup [ drop 3 ] unless ; +: dummy-unless-3 ( a -- b ) dup [ drop 3 ] unless ; [ 3 ] [ f dummy-unless-3 ] unit-test [ 4 ] [ 4 dummy-unless-3 ] unit-test @@ -201,7 +201,7 @@ DEFER: countdown-b ] compile-call ] unit-test -GENERIC: single-combination-test +GENERIC: single-combination-test ( obj1 obj2 -- obj ) M: object single-combination-test drop ; M: f single-combination-test nip ; @@ -214,13 +214,13 @@ M: integer single-combination-test drop ; DEFER: single-combination-test-2 -: single-combination-test-4 +: single-combination-test-4 ( obj -- obj ) dup [ single-combination-test-2 ] when ; -: single-combination-test-3 +: single-combination-test-3 ( obj -- obj ) drop 3 ; -GENERIC: single-combination-test-2 +GENERIC: single-combination-test-2 ( obj -- obj ) M: object single-combination-test-2 single-combination-test-3 ; M: f single-combination-test-2 single-combination-test-4 ; diff --git a/core/compiler/tests/stack-trace.factor b/core/compiler/tests/stack-trace.factor index f54ac62204..3b1a5c6c85 100755 --- a/core/compiler/tests/stack-trace.factor +++ b/core/compiler/tests/stack-trace.factor @@ -1,25 +1,25 @@ IN: compiler.tests USING: compiler tools.test namespaces sequences kernel.private kernel math continuations continuations.private -words splitting sorting ; +words splitting grouping sorting ; : symbolic-stack-trace ( -- newseq ) error-continuation get continuation-call callstack>array 2 group flip first ; -: foo 3 throw 7 ; -: bar foo 4 ; -: baz bar 5 ; +: foo ( -- * ) 3 throw 7 ; +: bar ( -- * ) foo 4 ; +: baz ( -- * ) bar 5 ; [ baz ] [ 3 = ] must-fail-with [ t ] [ symbolic-stack-trace - [ word? ] subset + [ word? ] filter { baz bar foo throw } tail? ] unit-test -: bleh [ 3 + ] map [ 0 > ] subset ; +: bleh ( seq -- seq' ) [ 3 + ] map [ 0 > ] filter ; -: stack-trace-contains? symbolic-stack-trace memq? ; +: stack-trace-contains? ( word -- ? ) symbolic-stack-trace memq? ; [ t ] [ [ { 1 "hi" } bleh ] ignore-errors \ + stack-trace-contains? @@ -31,7 +31,7 @@ words splitting sorting ; \ > stack-trace-contains? ] unit-test -: quux { 1 2 3 } [ "hi" throw ] sort ; +: quux ( -- seq ) { 1 2 3 } [ "hi" throw ] sort ; [ t ] [ [ 10 quux ] ignore-errors diff --git a/core/compiler/tests/templates.factor b/core/compiler/tests/templates.factor index 14d75cdc03..65ef68deb8 100755 --- a/core/compiler/tests/templates.factor +++ b/core/compiler/tests/templates.factor @@ -31,7 +31,7 @@ unit-test [ 2 ] [ 1 2 [ swap fixnum/i ] compile-call ] unit-test -: foo ; +: foo ( -- ) ; [ 5 5 ] [ 1.2 [ tag [ foo ] keep ] compile-call ] @@ -103,10 +103,10 @@ unit-test ! Test how dispatch handles the end of a basic block -: try-breaking-dispatch +: try-breaking-dispatch ( n a b -- a b str ) float+ swap { [ "hey" ] [ "bye" ] } dispatch ; -: try-breaking-dispatch-2 +: try-breaking-dispatch-2 ( -- ? ) 1 1.0 2.5 try-breaking-dispatch "bye" = >r 3.5 = r> and ; [ t ] [ @@ -143,7 +143,7 @@ unit-test ] unit-test ! Regression -: foox +: foox ( obj -- obj ) dup not [ drop 3 ] [ dup tuple? [ drop 4 ] [ drop 5 ] if ] if ; @@ -189,7 +189,7 @@ TUPLE: my-tuple ; ] unit-test ! Regression -: a-dummy drop "hi" print ; +: a-dummy ( -- ) drop "hi" print ; [ ] [ 1 [ @@ -203,7 +203,7 @@ TUPLE: my-tuple ; ] compile-call ] unit-test -: float-spill-bug +: float-spill-bug ( a -- b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b ) { [ dup float+ ] [ dup float+ ] diff --git a/core/compiler/units/units.factor b/core/compiler/units/units.factor index 65e57a8912..658a64315e 100755 --- a/core/compiler/units/units.factor +++ b/core/compiler/units/units.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel continuations assocs namespaces sequences words -vocabs definitions hashtables init ; +vocabs definitions hashtables init sets ; IN: compiler.units SYMBOL: old-definitions @@ -14,7 +14,7 @@ TUPLE: redefine-error def ; { { "Continue" t } } throw-restarts drop ; : add-once ( key assoc -- ) - 2dup key? [ over redefine-error ] when dupd set-at ; + 2dup key? [ over redefine-error ] when conjoin ; : (remember-definition) ( definition loc assoc -- ) >r over set-where r> add-once ; @@ -53,7 +53,7 @@ GENERIC: definitions-changed ( assoc obj -- ) [ definitions-changed ] with each ; : changed-vocabs ( assoc -- vocabs ) - [ drop word? ] assoc-subset + [ drop word? ] assoc-filter [ drop word-vocabulary dup [ vocab ] when dup ] assoc-map ; : updated-definitions ( -- assoc ) @@ -66,14 +66,14 @@ GENERIC: definitions-changed ( assoc obj -- ) : compile ( words -- ) recompile-hook get call - dup [ drop compiled-crossref? ] assoc-contains? + dup [ drop crossref? ] assoc-contains? modify-code-heap ; SYMBOL: outdated-tuples SYMBOL: update-tuples-hook : call-recompile-hook ( -- ) - changed-definitions get keys [ word? ] subset + changed-definitions get [ drop word? ] assoc-filter compiled-usages recompile-hook get call ; : call-update-tuples-hook ( -- ) @@ -82,18 +82,28 @@ SYMBOL: update-tuples-hook : finish-compilation-unit ( -- ) call-recompile-hook call-update-tuples-hook - dup [ drop compiled-crossref? ] assoc-contains? modify-code-heap - updated-definitions notify-definition-observers ; + dup [ drop crossref? ] assoc-contains? modify-code-heap ; + +: with-nested-compilation-unit ( quot -- ) + [ + H{ } clone changed-definitions set + H{ } clone outdated-tuples set + [ finish-compilation-unit ] [ ] cleanup + ] with-scope ; inline : with-compilation-unit ( quot -- ) [ H{ } clone changed-definitions set H{ } clone forgotten-definitions set H{ } clone outdated-tuples set + H{ } clone new-classes set new-definitions set old-definitions set - [ finish-compilation-unit ] - [ ] cleanup + [ + finish-compilation-unit + updated-definitions + notify-definition-observers + ] [ ] cleanup ] with-scope ; inline : compile-call ( quot -- ) diff --git a/core/continuations/continuations-docs.factor b/core/continuations/continuations-docs.factor index b1db09b6bc..3cb7d8a71e 100755 --- a/core/continuations/continuations-docs.factor +++ b/core/continuations/continuations-docs.factor @@ -1,6 +1,6 @@ USING: help.markup help.syntax kernel kernel.private continuations.private parser vectors arrays namespaces -assocs words quotations io ; +assocs words quotations ; IN: continuations ARTICLE: "errors-restartable" "Restartable errors" @@ -28,13 +28,7 @@ $nl { $heading "Anti-pattern #3: Dropping and rethrowing" } "Do not use " { $link recover } " to handle an error by dropping it and throwing a new error. By losing the original error message, you signal to the user that something failed without leaving any indication of what actually went wrong. Either wrap the error in a new error containing additional information, or rethrow the original error. A more subtle form of this is using " { $link throw } " instead of " { $link rethrow } ". The " { $link throw } " word should only be used when throwing new errors, and never when rethrowing errors that have been caught." { $heading "Anti-pattern #4: Logging and rethrowing" } -"If you are going to rethrow an error, do not log a message. If you do so, the user will see two log messages for the same error, which will clutter logs without adding any useful information." -{ $heading "Anti-pattern #5: Leaking external resources" } -"Words which create objects corresponding to external resources should always be used with " { $link with-disposal } ". The following code is wrong:" -{ $code - " ... do stuff ... dispose" -} -"The reason being that if " { $snippet "do stuff" } " throws an error, the resource will not be disposed of. The most important case where this can occur is with I/O streams, and the correct solution is to always use " { $link with-stream } "; see " { $link "stdio" } " for details." ; +"If you are going to rethrow an error, do not log a message. If you do so, the user will see two log messages for the same error, which will clutter logs without adding any useful information." ; ARTICLE: "errors" "Error handling" "Support for handling exceptional situations such as bad user input, implementation bugs, and input/output errors is provided by a set of words built using continuations." @@ -88,19 +82,6 @@ $nl ABOUT: "continuations" -HELP: dispose -{ $values { "object" "a disposable object" } } -{ $contract "Releases operating system resources associated with a disposable object. Disposable objects include streams, memory mapped files, and so on." -$nl -"No further operations can be performed on a disposable object after this call." -$nl -"Disposing an object which has already been disposed should have no effect, and in particular it should not fail with an error." } -{ $notes "You must close disposable objects after you are finished working with them, to avoid leaking operating system resources. A convenient way to automate this is by using the " { $link with-disposal } " word." } ; - -HELP: with-disposal -{ $values { "object" "a disposable object" } { "quot" "a quotation with stack effect " { $snippet "( object -- )" } } } -{ $description "Calls the quotation, disposing the object with " { $link dispose } " after the quotation returns or if it throws an error." } ; - HELP: catchstack* { $values { "catchstack" "a vector of continuations" } } { $description "Outputs the current catchstack." } ; diff --git a/core/continuations/continuations-tests.factor b/core/continuations/continuations-tests.factor index 8b396763e1..27e1f02b91 100755 --- a/core/continuations/continuations-tests.factor +++ b/core/continuations/continuations-tests.factor @@ -1,6 +1,6 @@ USING: kernel math namespaces io tools.test sequences vectors continuations debugger parser memory arrays words -kernel.private ; +kernel.private accessors ; IN: continuations.tests : (callcc1-test) @@ -39,7 +39,7 @@ IN: continuations.tests "!!! The following error is part of the test" print -[ ] [ [ [ "2 car" ] eval ] [ print-error ] recover ] unit-test +[ ] [ [ [ "2 car" ] eval ] try ] unit-test [ f throw ] must-fail @@ -100,3 +100,7 @@ SYMBOL: error-counter [ 3 ] [ always-counter get ] unit-test [ 1 ] [ error-counter get ] unit-test ] with-scope + +[ ] [ [ return ] with-return ] unit-test + +[ { } [ ] attempt-all ] [ attempt-all-error? ] must-fail-with diff --git a/core/continuations/continuations.factor b/core/continuations/continuations.factor index cf67280cca..087661dff4 100755 --- a/core/continuations/continuations.factor +++ b/core/continuations/continuations.factor @@ -26,7 +26,7 @@ SYMBOL: restarts #! with a declaration. f { object } declare ; -: init-catchstack V{ } clone 1 setenv ; +: init-catchstack ( -- ) V{ } clone 1 setenv ; PRIVATE> @@ -101,6 +101,14 @@ PRIVATE> : continue ( continuation -- ) f swap continue-with ; +SYMBOL: return-continuation + +: with-return ( quot -- ) + [ [ return-continuation set ] prepose callcc0 ] with-scope ; inline + +: return ( -- ) + return-continuation get continue ; + GENERIC: compute-restarts ( error -- seq ) r compose [ dip rethrow ] curry recover r> call ; inline +ERROR: attempt-all-error ; + : attempt-all ( seq quot -- obj ) - [ - [ [ , f ] compose [ , drop t ] recover ] curry all? - ] { } make peek swap [ rethrow ] when ; inline - -GENERIC: dispose ( object -- ) - -: with-disposal ( object quot -- ) - over [ dispose ] curry [ ] cleanup ; inline + over empty? [ + attempt-all-error + ] [ + [ + [ [ , f ] compose [ , drop t ] recover ] curry all? + ] { } make peek swap [ rethrow ] when + ] if ; inline TUPLE: condition error restarts continuation ; diff --git a/core/cpu/architecture/architecture.factor b/core/cpu/architecture/architecture.factor index 338c5341bc..42bf37d17f 100755 --- a/core/cpu/architecture/architecture.factor +++ b/core/cpu/architecture/architecture.factor @@ -41,12 +41,12 @@ HOOK: stack-frame cpu ( frame-size -- n ) ! Set up caller stack frame HOOK: %prologue cpu ( n -- ) -: %prologue-later \ %prologue-later , ; +: %prologue-later ( -- ) \ %prologue-later , ; ! Tear down stack frame HOOK: %epilogue cpu ( n -- ) -: %epilogue-later \ %epilogue-later , ; +: %epilogue-later ( -- ) \ %epilogue-later , ; ! Store word XT in stack frame HOOK: %save-word-xt cpu ( -- ) @@ -195,7 +195,7 @@ HOOK: %unbox-any-c-ptr cpu ( dst src -- ) HOOK: %box-alien cpu ( dst src -- ) ! GC check -HOOK: %gc cpu +HOOK: %gc cpu ( -- ) : operand ( var -- op ) get v>operand ; inline diff --git a/core/cpu/ppc/architecture/architecture.factor b/core/cpu/ppc/architecture/architecture.factor index 1799411021..70345b1e96 100755 --- a/core/cpu/ppc/architecture/architecture.factor +++ b/core/cpu/ppc/architecture/architecture.factor @@ -4,7 +4,7 @@ USING: alien.c-types cpu.ppc.assembler cpu.architecture generic kernel kernel.private math memory namespaces sequences words assocs generator generator.registers generator.fixup system layouts classes words.private alien combinators -compiler.constants ; +compiler.constants math.order ; IN: cpu.ppc.architecture ! PowerPC register assignments diff --git a/core/cpu/ppc/assembler/assembler.factor b/core/cpu/ppc/assembler/assembler.factor index 628022698f..b1d7016eff 100755 --- a/core/cpu/ppc/assembler/assembler.factor +++ b/core/cpu/ppc/assembler/assembler.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2005, 2006 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. +USING: generator.fixup generic kernel memory namespaces +words math math.bitfields math.order io.binary ; IN: cpu.ppc.assembler -USING: generator.fixup generic kernel math memory namespaces -words math.bitfields io.binary ; ! See the Motorola or IBM documentation for details. The opcode ! names are standard, and the operand order is the same as in diff --git a/core/cpu/ppc/bootstrap.factor b/core/cpu/ppc/bootstrap.factor index 18c7e8b92e..cf380d69f1 100755 --- a/core/cpu/ppc/bootstrap.factor +++ b/core/cpu/ppc/bootstrap.factor @@ -72,7 +72,7 @@ big-endian on ] rc-relative-ppc-3 rt-xt 0 jit-word-jump jit-define : jit-call-quot ( -- ) - temp-reg quot-reg quot-xt@ LWZ ! load quotation-xt + temp-reg quot-reg quot-xt-offset LWZ ! load quotation-xt temp-reg MTCTR ! jump to quotation-xt BCTR ; @@ -93,7 +93,7 @@ big-endian on temp-reg ds-reg 0 LWZ ! load index temp-reg dup 1 SRAWI ! turn it into an array offset quot-reg dup temp-reg ADD ! compute quotation location - quot-reg dup array-start LWZ ! load quotation + quot-reg dup array-start-offset LWZ ! load quotation ds-reg dup 4 SUBI ! pop index jit-call-quot ] rc-absolute-ppc-2/2 rt-literal 1 jit-dispatch jit-define diff --git a/core/cpu/ppc/intrinsics/intrinsics.factor b/core/cpu/ppc/intrinsics/intrinsics.factor index 34e9900893..1b28f7262e 100755 --- a/core/cpu/ppc/intrinsics/intrinsics.factor +++ b/core/cpu/ppc/intrinsics/intrinsics.factor @@ -18,13 +18,13 @@ IN: cpu.ppc.intrinsics "obj" get operand-tag - ; : %slot-literal-any-tag - "obj" operand "scratch" operand %untag - "val" operand "scratch" operand "n" get cells ; + "obj" operand "scratch1" operand %untag + "val" operand "scratch1" operand "n" get cells ; : %slot-any - "obj" operand "scratch" operand %untag + "obj" operand "scratch1" operand %untag "offset" operand "n" operand 1 SRAWI - "scratch" operand "val" operand "offset" operand ; + "scratch1" operand "val" operand "offset" operand ; \ slot { ! Slot number is literal and the tag is known @@ -39,7 +39,7 @@ IN: cpu.ppc.intrinsics { [ %slot-literal-any-tag LWZ ] H{ { +input+ { { f "obj" } { [ small-slot? ] "n" } } } - { +scratch+ { { f "scratch" } { f "val" } } } + { +scratch+ { { f "scratch1" } { f "val" } } } { +output+ { "val" } } } } @@ -47,7 +47,7 @@ IN: cpu.ppc.intrinsics { [ %slot-any LWZX ] H{ { +input+ { { f "obj" } { f "n" } } } - { +scratch+ { { f "val" } { f "scratch" } { f "offset" } } } + { +scratch+ { { f "val" } { f "scratch1" } { f "offset" } } } { +output+ { "val" } } } } @@ -56,14 +56,22 @@ IN: cpu.ppc.intrinsics : load-cards-offset ( dest -- ) "cards_offset" f pick %load-dlsym dup 0 LWZ ; +: load-decks-offset ( dest -- ) + "decks_offset" f pick %load-dlsym dup 0 LWZ ; + : %write-barrier ( -- ) "val" get operand-immediate? "obj" get fresh-object? or [ - "obj" operand "scratch" operand card-bits SRWI + card-mark "scratch1" operand LI + + ! Mark the card "val" operand load-cards-offset - "scratch" operand dup "val" operand ADD - "val" operand "scratch" operand 0 LBZ - "val" operand dup card-mark ORI - "val" operand "scratch" operand 0 STB + "obj" operand "scratch2" operand card-bits SRWI + "scratch2" operand "scratch1" operand "val" operand STBX + + ! Mark the card deck + "val" operand load-decks-offset + "obj" operand "scratch2" operand deck-bits SRWI + "scratch2" operand "scratch1" operand "val" operand STBX ] unless ; \ set-slot { @@ -71,7 +79,7 @@ IN: cpu.ppc.intrinsics { [ %slot-literal-known-tag STW %write-barrier ] H{ { +input+ { { f "val" } { f "obj" known-tag } { [ small-slot? ] "n" } } } - { +scratch+ { { f "scratch" } } } + { +scratch+ { { f "scratch1" } { f "scratch2" } } } { +clobber+ { "val" } } } } @@ -79,7 +87,7 @@ IN: cpu.ppc.intrinsics { [ %slot-literal-any-tag STW %write-barrier ] H{ { +input+ { { f "val" } { f "obj" } { [ small-slot? ] "n" } } } - { +scratch+ { { f "scratch" } } } + { +scratch+ { { f "scratch1" } { f "scratch2" } } } { +clobber+ { "val" } } } } @@ -87,7 +95,7 @@ IN: cpu.ppc.intrinsics { [ %slot-any STWX %write-barrier ] H{ { +input+ { { f "val" } { f "obj" } { f "n" } } } - { +scratch+ { { f "scratch" } { f "offset" } } } + { +scratch+ { { f "scratch1" } { f "scratch2" } { f "offset" } } } { +clobber+ { "val" } } } } diff --git a/core/cpu/x86/32/32.factor b/core/cpu/x86/32/32.factor index 50e38f2082..3c6e4963e1 100755 --- a/core/cpu/x86/32/32.factor +++ b/core/cpu/x86/32/32.factor @@ -22,29 +22,32 @@ M: x86.32 temp-reg-2 ECX ; M: temp-reg v>operand drop EBX ; -M: x86.32 %alien-invoke ( symbol dll -- ) - (CALL) rel-dlsym ; +M: x86.32 %alien-global 0 [] MOV rc-absolute-cell rel-dlsym ; + +M: x86.32 %alien-invoke (CALL) rel-dlsym ; ! On x86, parameters are never passed in registers. M: int-regs return-reg drop EAX ; M: int-regs param-regs drop { } ; M: int-regs vregs drop { EAX ECX EDX EBP } ; M: int-regs push-return-reg return-reg PUSH ; -: load/store-int-return return-reg stack-reg rot [+] ; +: load/store-int-return ( n reg-class -- src dst ) + return-reg stack-reg rot [+] ; M: int-regs load-return-reg load/store-int-return MOV ; M: int-regs store-return-reg load/store-int-return swap MOV ; M: float-regs param-regs drop { } ; M: float-regs vregs drop { XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 } ; -: FSTP 4 = [ FSTPS ] [ FSTPL ] if ; +: FSTP ( operand size -- ) 4 = [ FSTPS ] [ FSTPL ] if ; M: float-regs push-return-reg stack-reg swap reg-size [ SUB stack-reg [] ] keep FSTP ; -: FLD 4 = [ FLDS ] [ FLDL ] if ; +: FLD ( operand size -- ) 4 = [ FLDS ] [ FLDL ] if ; -: load/store-float-return reg-size >r stack@ r> ; +: load/store-float-return ( n reg-class -- op size ) + [ stack@ ] [ reg-size ] bi* ; M: float-regs load-return-reg load/store-float-return FLD ; M: float-regs store-return-reg load/store-float-return FSTP ; @@ -150,7 +153,7 @@ M: x86.32 %box ( n reg-class func -- ) >r (%box) r> f %alien-invoke ] with-aligned-stack ; -: (%box-long-long) +: (%box-long-long) ( n -- ) #! If n is f, push the return registers onto the stack; we #! are boxing a return value of a C function. If n is an #! integer, push [ESP+n]:[ESP+n+4] on the stack; we are @@ -165,7 +168,7 @@ M: x86.32 %box ( n reg-class func -- ) M: x86.32 %box-long-long ( n func -- ) 8 [ - >r (%box-long-long) r> f %alien-invoke + [ (%box-long-long) ] [ f %alien-invoke ] bi* ] with-aligned-stack ; M: x86.32 %box-large-struct ( n size -- ) @@ -259,7 +262,7 @@ os windows? [ 4 "double" c-type set-c-type-align ] unless -: sse2? "Intrinsic" throw ; +: sse2? ( -- ? ) "Intrinsic" throw ; \ sse2? [ { EAX EBX ECX EDX } [ PUSH ] each diff --git a/core/cpu/x86/64/64.factor b/core/cpu/x86/64/64.factor index d79ce58d88..ebaa6056ff 100755 --- a/core/cpu/x86/64/64.factor +++ b/core/cpu/x86/64/64.factor @@ -130,7 +130,10 @@ M: x86.64 %prepare-box-struct ( size -- ) M: x86.64 %prepare-var-args RAX RAX XOR ; -M: x86.64 %alien-invoke ( symbol dll -- ) +M: x86.64 %alien-global + [ 0 MOV rc-absolute-cell rel-dlsym ] [ dup [] MOV ] bi ; + +M: x86.64 %alien-invoke 0 address-operand >r rc-absolute-cell rel-dlsym r> CALL ; M: x86.64 %prepare-alien-indirect ( -- ) @@ -181,7 +184,7 @@ stack-params "__stack_value" c-type set-c-type-reg-class >> : split-struct ( pairs -- seq ) [ [ 8 mod zero? [ t , ] when , ] assoc-each - ] { } make { t } split [ empty? not ] subset ; + ] { } make { t } split harvest ; : flatten-large-struct ( type -- ) heap-size cell align diff --git a/core/cpu/x86/allot/allot.factor b/core/cpu/x86/allot/allot.factor index 63870f94cd..144a9560d7 100755 --- a/core/cpu/x86/allot/allot.factor +++ b/core/cpu/x86/allot/allot.factor @@ -6,7 +6,7 @@ sequences generic arrays generator generator.fixup generator.registers system layouts alien ; IN: cpu.x86.allot -: allot-reg +: allot-reg ( -- reg ) #! We temporarily use the datastack register, since it won't #! be accessed inside the quotation given to %allot in any #! case. diff --git a/core/cpu/x86/architecture/architecture.factor b/core/cpu/x86/architecture/architecture.factor index 7e7ff8a334..2a3d16694e 100755 --- a/core/cpu/x86/architecture/architecture.factor +++ b/core/cpu/x86/architecture/architecture.factor @@ -1,17 +1,18 @@ ! Copyright (C) 2005, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: alien alien.c-types alien.compiler arrays -cpu.x86.assembler cpu.architecture kernel kernel.private math -memory namespaces sequences words generator generator.registers -generator.fixup system layouts combinators compiler.constants ; +cpu.x86.assembler cpu.x86.assembler.private cpu.architecture +kernel kernel.private math memory namespaces sequences words +generator generator.registers generator.fixup system layouts +combinators compiler.constants math.order ; IN: cpu.x86.architecture -HOOK: ds-reg cpu -HOOK: rs-reg cpu -HOOK: stack-reg cpu -HOOK: stack-save-reg cpu +HOOK: ds-reg cpu ( -- reg ) +HOOK: rs-reg cpu ( -- reg ) +HOOK: stack-reg cpu ( -- reg ) +HOOK: stack-save-reg cpu ( -- reg ) -: stack@ stack-reg swap [+] ; +: stack@ ( n -- op ) stack-reg swap [+] ; : reg-stack ( n reg -- op ) swap cells neg [+] ; @@ -35,14 +36,14 @@ GENERIC: load-return-reg ( stack@ reg-class -- ) GENERIC: store-return-reg ( stack@ reg-class -- ) ! Only used by inline allocation -HOOK: temp-reg-1 cpu -HOOK: temp-reg-2 cpu +HOOK: temp-reg-1 cpu ( -- reg ) +HOOK: temp-reg-2 cpu ( -- reg ) HOOK: address-operand cpu ( address -- operand ) -HOOK: fixnum>slot@ cpu +HOOK: fixnum>slot@ cpu ( op -- ) -HOOK: prepare-division cpu +HOOK: prepare-division cpu ( -- ) M: immediate load-literal v>operand swap v>operand MOV ; @@ -52,7 +53,7 @@ M: x86 stack-frame ( n -- i ) M: x86 %save-word-xt ( -- ) temp-reg v>operand 0 MOV rc-absolute-cell rel-this ; -: factor-area-size 4 cells ; +: factor-area-size ( -- n ) 4 cells ; M: x86 %prologue ( n -- ) dup cell + PUSH @@ -62,8 +63,7 @@ M: x86 %prologue ( n -- ) M: x86 %epilogue ( n -- ) stack-reg swap ADD ; -: %alien-global ( symbol dll register -- ) - [ 0 MOV rc-absolute-cell rel-dlsym ] keep dup [] MOV ; +HOOK: %alien-global cpu ( symbol dll register -- ) M: x86 %prepare-alien-invoke #! Save Factor stack pointers in case the C code calls a @@ -120,7 +120,7 @@ M: x86 %peek [ v>operand ] bi@ MOV ; M: x86 %replace swap %peek ; -: (%inc) swap cells dup 0 > [ ADD ] [ neg SUB ] if ; +: (%inc) ( n reg -- ) swap cells dup 0 > [ ADD ] [ neg SUB ] if ; M: x86 %inc-d ( n -- ) ds-reg (%inc) ; @@ -139,7 +139,7 @@ M: x86 small-enough? ( n -- ? ) : %tag-fixnum ( reg -- ) tag-bits get SHL ; -: temp@ stack-reg \ stack-frame get rot - [+] ; +: temp@ ( n -- op ) stack-reg \ stack-frame get rot - [+] ; : struct-return@ ( size n -- n ) [ diff --git a/core/cpu/x86/assembler/assembler-tests.factor b/core/cpu/x86/assembler/assembler-tests.factor index caa00bd618..4c0f04fcc2 100644 --- a/core/cpu/x86/assembler/assembler-tests.factor +++ b/core/cpu/x86/assembler/assembler-tests.factor @@ -36,3 +36,6 @@ IN: cpu.x86.assembler.tests [ { HEX: 0f HEX: be HEX: c3 } ] [ [ EAX BL MOVSX ] { } make ] unit-test [ { HEX: 0f HEX: bf HEX: c3 } ] [ [ EAX BX MOVSX ] { } make ] unit-test + +[ { HEX: 80 HEX: 08 HEX: 05 } ] [ [ EAX [] 5 OR ] { } make ] unit-test +[ { HEX: c6 HEX: 00 HEX: 05 } ] [ [ EAX [] 5 MOV ] { } make ] unit-test diff --git a/core/cpu/x86/assembler/assembler.factor b/core/cpu/x86/assembler/assembler.factor index 3ad7d4f7b5..452a102341 100755 --- a/core/cpu/x86/assembler/assembler.factor +++ b/core/cpu/x86/assembler/assembler.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: arrays generator.fixup io.binary kernel combinators kernel.private math namespaces parser sequences -words system layouts ; +words system layouts math.order accessors ; IN: cpu.x86.assembler ! A postfix assembler for x86 and AMD64. @@ -11,11 +11,6 @@ IN: cpu.x86.assembler ! In 64-bit mode, { 1234 } is RIP-relative. ! Beware! -: n, >le % ; inline -: 4, 4 n, ; inline -: 2, 2 n, ; inline -: cell, bootstrap-cell n, ; inline - ! Register operands -- eg, ECX << @@ -27,7 +22,7 @@ IN: cpu.x86.assembler : define-registers ( names size -- ) >r dup length r> [ define-register ] curry 2each ; -: REGISTERS: +: REGISTERS: ( -- ) scan-word ";" parse-tokens swap define-registers ; parsing >> @@ -45,6 +40,10 @@ REGISTERS: 128 XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8 XMM9 XMM10 XMM11 XMM12 XMM13 XMM14 XMM15 ; +TUPLE: byte value ; + +C: byte + ; ! Addressing modes TUPLE: indirect base index scale displacement ; -M: indirect extended? indirect-base extended? ; +M: indirect extended? base>> extended? ; -: canonicalize-EBP +: canonicalize-EBP ( indirect -- indirect ) #! { EBP } ==> { EBP 0 } - dup indirect-base { EBP RBP R13 } memq? [ - dup indirect-displacement [ - drop - ] [ - 0 swap set-indirect-displacement - ] if - ] [ - drop - ] if ; + dup base>> { EBP RBP R13 } member? [ + dup displacement>> [ 0 >>displacement ] unless + ] when ; -: canonicalize-ESP +: canonicalize-ESP ( indirect -- indirect ) #! { ESP } ==> { ESP ESP } - dup indirect-base { ESP RSP R12 } memq? [ - ESP swap set-indirect-index - ] [ - drop - ] if ; + dup base>> { ESP RSP R12 } member? [ ESP >>index ] when ; -: canonicalize ( indirect -- ) +: canonicalize ( indirect -- indirect ) #! Modify the indirect to work around certain addressing mode #! quirks. - dup canonicalize-EBP - canonicalize-ESP ; + canonicalize-EBP canonicalize-ESP ; : ( base index scale displacement -- indirect ) - indirect boa dup canonicalize ; + indirect boa canonicalize ; -: reg-code "register" word-prop 7 bitand ; +: reg-code ( reg -- n ) "register" word-prop 7 bitand ; -: indirect-base* indirect-base EBP or reg-code ; +: indirect-base* ( op -- n ) base>> EBP or reg-code ; -: indirect-index* indirect-index ESP or reg-code ; +: indirect-index* ( op -- n ) index>> ESP or reg-code ; -: indirect-scale* indirect-scale 0 or ; +: indirect-scale* ( op -- n ) scale>> 0 or ; GENERIC: sib-present? ( op -- ? ) M: indirect sib-present? - dup indirect-base { ESP RSP } memq? - over indirect-index rot indirect-scale or or ; + [ base>> { ESP RSP } member? ] [ index>> ] [ scale>> ] tri or or ; M: register sib-present? drop f ; @@ -130,16 +117,23 @@ M: indirect r/m M: register r/m reg-code ; -: byte? -128 127 between? ; +! Immediate operands +UNION: immediate byte integer ; + +GENERIC: fits-in-byte? ( value -- ? ) + +M: byte fits-in-byte? drop t ; + +M: integer fits-in-byte? -128 127 between? ; GENERIC: modifier ( op -- n ) M: indirect modifier - dup indirect-base [ - indirect-displacement { - { [ dup not ] [ BIN: 00 ] } - { [ dup byte? ] [ BIN: 01 ] } - { [ dup integer? ] [ BIN: 10 ] } + dup base>> [ + displacement>> { + { [ dup not ] [ BIN: 00 ] } + { [ dup fits-in-byte? ] [ BIN: 01 ] } + { [ dup immediate? ] [ BIN: 10 ] } } cond nip ] [ drop BIN: 00 @@ -147,14 +141,23 @@ M: indirect modifier M: register modifier drop BIN: 11 ; +GENERIC# n, 1 ( value n -- ) + +M: integer n, >le % ; +M: byte n, >r value>> r> n, ; +: 1, ( n -- ) 1 n, ; inline +: 4, ( n -- ) 4 n, ; inline +: 2, ( n -- ) 2 n, ; inline +: cell, ( n -- ) bootstrap-cell n, ; inline + : mod-r/m, ( reg# indirect -- ) - dup modifier 6 shift rot 3 shift rot r/m bitor bitor , ; + [ 3 shift ] [ [ modifier 6 shift ] [ r/m ] bi ] bi* bitor bitor , ; : sib, ( indirect -- ) dup sib-present? [ - dup indirect-base* - over indirect-index* 3 shift bitor - swap indirect-scale* 6 shift bitor , + [ indirect-base* ] + [ indirect-index* 3 shift ] + [ indirect-scale* 6 shift ] tri bitor bitor , ] [ drop ] if ; @@ -162,9 +165,9 @@ M: register modifier drop BIN: 11 ; GENERIC: displacement, ( op -- ) M: indirect displacement, - dup indirect-displacement dup [ - swap indirect-base - [ dup byte? [ , ] [ 4, ] if ] [ 4, ] if + dup displacement>> dup [ + swap base>> + [ dup fits-in-byte? [ , ] [ 4, ] if ] [ 4, ] if ] [ 2drop ] if ; @@ -172,18 +175,19 @@ M: indirect displacement, M: register displacement, drop ; : addressing ( reg# indirect -- ) - [ mod-r/m, ] keep [ sib, ] keep displacement, ; + [ mod-r/m, ] [ sib, ] [ displacement, ] tri ; ! Utilities UNION: operand register indirect ; -: operand-64? ( operand -- ? ) - dup indirect? [ - dup indirect-base register-64? - swap indirect-index register-64? or - ] [ - register-64? - ] if ; +GENERIC: operand-64? ( operand -- ? ) + +M: indirect operand-64? + [ base>> ] [ index>> ] bi [ operand-64? ] either? ; + +M: register-64 operand-64? drop t ; + +M: object operand-64? drop f ; : rex.w? ( rex.w reg r/m -- ? ) { @@ -192,14 +196,13 @@ UNION: operand register indirect ; [ nip operand-64? ] } cond and ; -: rex.r +: rex.r ( m op -- n ) extended? [ BIN: 00000100 bitor ] when ; -: rex.b +: rex.b ( m op -- n ) [ extended? [ BIN: 00000001 bitor ] when ] keep dup indirect? [ - indirect-index extended? - [ BIN: 00000010 bitor ] when + index>> extended? [ BIN: 00000010 bitor ] when ] [ drop ] if ; @@ -222,7 +225,7 @@ UNION: operand register indirect ; #! the opcode. >r dupd prefix-1 reg-code r> + , ; -: opcode, dup array? [ % ] [ , ] if ; +: opcode, ( opcode -- ) dup array? [ % ] [ , ] if ; : extended-opcode ( opcode -- opcode' ) OCT: 17 swap 2array ; @@ -230,25 +233,34 @@ UNION: operand register indirect ; : opcode-or ( opcode mask -- opcode' ) swap dup array? - [ 1 cut* first rot bitor suffix ] [ bitor ] if ; + [ unclip-last rot bitor suffix ] [ bitor ] if ; -: 1-operand ( op reg rex.w opcode -- ) +: 1-operand ( op reg,rex.w,opcode -- ) #! The 'reg' is not really a register, but a value for the #! 'reg' field of the mod-r/m byte. - >r >r over r> prefix-1 r> opcode, swap addressing ; + first3 >r >r over r> prefix-1 r> opcode, swap addressing ; -: immediate-1 ( imm dst reg rex.w opcode -- ) - 1-operand , ; +: immediate-operand-size-bit ( imm dst reg,rex.w,opcode -- imm dst reg,rex.w,opcode ) + pick integer? [ first3 BIN: 1 opcode-or 3array ] when ; -: immediate-1/4 ( imm dst reg rex.w opcode -- ) +: immediate-1 ( imm dst reg,rex.w,opcode -- ) + immediate-operand-size-bit 1-operand 1, ; + +: immediate-4 ( imm dst reg,rex.w,opcode -- ) + immediate-operand-size-bit 1-operand 4, ; + +: immediate-fits-in-size-bit ( imm dst reg,rex.w,opcode -- imm dst reg,rex.w,opcode ) + pick integer? [ first3 BIN: 10 opcode-or 3array ] when ; + +: immediate-1/4 ( imm dst reg,rex.w,opcode -- ) #! If imm is a byte, compile the opcode and the byte. - #! Otherwise, set the 32-bit operand flag in the opcode, and + #! Otherwise, set the 8-bit operand flag in the opcode, and #! compile the cell. The 'reg' is not really a register, but #! a value for the 'reg' field of the mod-r/m byte. - >r >r pick byte? [ - r> r> BIN: 10 opcode-or immediate-1 + pick fits-in-byte? [ + immediate-fits-in-size-bit immediate-1 ] [ - r> r> 1-operand 4, + immediate-4 ] if ; : (2-operand) ( dst src op -- ) @@ -283,22 +295,24 @@ PRIVATE> ! Moving stuff GENERIC: PUSH ( op -- ) M: register PUSH f HEX: 50 short-operand ; -M: integer PUSH HEX: 68 , 4, ; -M: operand PUSH BIN: 110 f HEX: ff 1-operand ; +M: immediate PUSH HEX: 68 , 4, ; +M: operand PUSH { BIN: 110 f HEX: ff } 1-operand ; GENERIC: POP ( op -- ) M: register POP f HEX: 58 short-operand ; -M: operand POP BIN: 000 f HEX: 8f 1-operand ; +M: operand POP { BIN: 000 f HEX: 8f } 1-operand ; ! MOV where the src is immediate. GENERIC: (MOV-I) ( src dst -- ) M: register (MOV-I) t HEX: b8 short-operand cell, ; -M: operand (MOV-I) BIN: 000 t HEX: c7 1-operand 4, ; +M: operand (MOV-I) + { BIN: 000 t HEX: c6 } + pick byte? [ immediate-1 ] [ immediate-4 ] if ; PREDICATE: callable < word register? not ; GENERIC: MOV ( dst src -- ) -M: integer MOV swap (MOV-I) ; +M: immediate MOV swap (MOV-I) ; M: callable MOV 0 rot (MOV-I) rc-absolute-cell rel-word ; M: operand MOV HEX: 88 2-operand ; @@ -306,38 +320,38 @@ M: operand MOV HEX: 88 2-operand ; ! Control flow GENERIC: JMP ( op -- ) -: (JMP) HEX: e9 , 0 4, rc-relative ; +: (JMP) ( -- rel-class ) HEX: e9 , 0 4, rc-relative ; M: callable JMP (JMP) rel-word ; M: label JMP (JMP) label-fixup ; -M: operand JMP BIN: 100 t HEX: ff 1-operand ; +M: operand JMP { BIN: 100 t HEX: ff } 1-operand ; GENERIC: CALL ( op -- ) -: (CALL) HEX: e8 , 0 4, rc-relative ; +: (CALL) ( -- rel-class ) HEX: e8 , 0 4, rc-relative ; M: callable CALL (CALL) rel-word ; M: label CALL (CALL) label-fixup ; -M: operand CALL BIN: 010 t HEX: ff 1-operand ; +M: operand CALL { BIN: 010 t HEX: ff } 1-operand ; GENERIC# JUMPcc 1 ( addr opcode -- ) -: (JUMPcc) extended-opcode, 0 4, rc-relative ; +: (JUMPcc) ( n -- rel-class ) extended-opcode, 0 4, rc-relative ; M: callable JUMPcc (JUMPcc) rel-word ; M: label JUMPcc (JUMPcc) label-fixup ; -: JO HEX: 80 JUMPcc ; -: JNO HEX: 81 JUMPcc ; -: JB HEX: 82 JUMPcc ; -: JAE HEX: 83 JUMPcc ; -: JE HEX: 84 JUMPcc ; ! aka JZ -: JNE HEX: 85 JUMPcc ; -: JBE HEX: 86 JUMPcc ; -: JA HEX: 87 JUMPcc ; -: JS HEX: 88 JUMPcc ; -: JNS HEX: 89 JUMPcc ; -: JP HEX: 8a JUMPcc ; -: JNP HEX: 8b JUMPcc ; -: JL HEX: 8c JUMPcc ; -: JGE HEX: 8d JUMPcc ; -: JLE HEX: 8e JUMPcc ; -: JG HEX: 8f JUMPcc ; +: JO ( dst -- ) HEX: 80 JUMPcc ; +: JNO ( dst -- ) HEX: 81 JUMPcc ; +: JB ( dst -- ) HEX: 82 JUMPcc ; +: JAE ( dst -- ) HEX: 83 JUMPcc ; +: JE ( dst -- ) HEX: 84 JUMPcc ; ! aka JZ +: JNE ( dst -- ) HEX: 85 JUMPcc ; +: JBE ( dst -- ) HEX: 86 JUMPcc ; +: JA ( dst -- ) HEX: 87 JUMPcc ; +: JS ( dst -- ) HEX: 88 JUMPcc ; +: JNS ( dst -- ) HEX: 89 JUMPcc ; +: JP ( dst -- ) HEX: 8a JUMPcc ; +: JNP ( dst -- ) HEX: 8b JUMPcc ; +: JL ( dst -- ) HEX: 8c JUMPcc ; +: JGE ( dst -- ) HEX: 8d JUMPcc ; +: JLE ( dst -- ) HEX: 8e JUMPcc ; +: JG ( dst -- ) HEX: 8f JUMPcc ; : LEAVE ( -- ) HEX: c9 , ; @@ -347,57 +361,57 @@ M: label JUMPcc (JUMPcc) label-fixup ; ! Arithmetic GENERIC: ADD ( dst src -- ) -M: integer ADD swap BIN: 000 t HEX: 81 immediate-1/4 ; +M: immediate ADD swap { BIN: 000 t HEX: 80 } immediate-1/4 ; M: operand ADD OCT: 000 2-operand ; GENERIC: OR ( dst src -- ) -M: integer OR swap BIN: 001 t HEX: 81 immediate-1/4 ; +M: immediate OR swap { BIN: 001 t HEX: 80 } immediate-1/4 ; M: operand OR OCT: 010 2-operand ; GENERIC: ADC ( dst src -- ) -M: integer ADC swap BIN: 010 t HEX: 81 immediate-1/4 ; +M: immediate ADC swap { BIN: 010 t HEX: 80 } immediate-1/4 ; M: operand ADC OCT: 020 2-operand ; GENERIC: SBB ( dst src -- ) -M: integer SBB swap BIN: 011 t HEX: 81 immediate-1/4 ; +M: immediate SBB swap { BIN: 011 t HEX: 80 } immediate-1/4 ; M: operand SBB OCT: 030 2-operand ; GENERIC: AND ( dst src -- ) -M: integer AND swap BIN: 100 t HEX: 81 immediate-1/4 ; +M: immediate AND swap { BIN: 100 t HEX: 80 } immediate-1/4 ; M: operand AND OCT: 040 2-operand ; GENERIC: SUB ( dst src -- ) -M: integer SUB swap BIN: 101 t HEX: 81 immediate-1/4 ; +M: immediate SUB swap { BIN: 101 t HEX: 80 } immediate-1/4 ; M: operand SUB OCT: 050 2-operand ; GENERIC: XOR ( dst src -- ) -M: integer XOR swap BIN: 110 t HEX: 81 immediate-1/4 ; +M: immediate XOR swap { BIN: 110 t HEX: 80 } immediate-1/4 ; M: operand XOR OCT: 060 2-operand ; GENERIC: CMP ( dst src -- ) -M: integer CMP swap BIN: 111 t HEX: 81 immediate-1/4 ; +M: immediate CMP swap { BIN: 111 t HEX: 80 } immediate-1/4 ; M: operand CMP OCT: 070 2-operand ; -: NOT ( dst -- ) BIN: 010 t HEX: f7 1-operand ; -: NEG ( dst -- ) BIN: 011 t HEX: f7 1-operand ; -: MUL ( dst -- ) BIN: 100 t HEX: f7 1-operand ; -: IMUL ( src -- ) BIN: 101 t HEX: f7 1-operand ; -: DIV ( dst -- ) BIN: 110 t HEX: f7 1-operand ; -: IDIV ( src -- ) BIN: 111 t HEX: f7 1-operand ; +: NOT ( dst -- ) { BIN: 010 t HEX: f7 } 1-operand ; +: NEG ( dst -- ) { BIN: 011 t HEX: f7 } 1-operand ; +: MUL ( dst -- ) { BIN: 100 t HEX: f7 } 1-operand ; +: IMUL ( src -- ) { BIN: 101 t HEX: f7 } 1-operand ; +: DIV ( dst -- ) { BIN: 110 t HEX: f7 } 1-operand ; +: IDIV ( src -- ) { BIN: 111 t HEX: f7 } 1-operand ; -: CDQ HEX: 99 , ; -: CQO HEX: 48 , CDQ ; +: CDQ ( -- ) HEX: 99 , ; +: CQO ( -- ) HEX: 48 , CDQ ; -: ROL ( dst n -- ) swap BIN: 000 t HEX: c1 immediate-1 ; -: ROR ( dst n -- ) swap BIN: 001 t HEX: c1 immediate-1 ; -: RCL ( dst n -- ) swap BIN: 010 t HEX: c1 immediate-1 ; -: RCR ( dst n -- ) swap BIN: 011 t HEX: c1 immediate-1 ; -: SHL ( dst n -- ) swap BIN: 100 t HEX: c1 immediate-1 ; -: SHR ( dst n -- ) swap BIN: 101 t HEX: c1 immediate-1 ; -: SAR ( dst n -- ) swap BIN: 111 t HEX: c1 immediate-1 ; +: ROL ( dst n -- ) swap { BIN: 000 t HEX: c0 } immediate-1 ; +: ROR ( dst n -- ) swap { BIN: 001 t HEX: c0 } immediate-1 ; +: RCL ( dst n -- ) swap { BIN: 010 t HEX: c0 } immediate-1 ; +: RCR ( dst n -- ) swap { BIN: 011 t HEX: c0 } immediate-1 ; +: SHL ( dst n -- ) swap { BIN: 100 t HEX: c0 } immediate-1 ; +: SHR ( dst n -- ) swap { BIN: 101 t HEX: c0 } immediate-1 ; +: SAR ( dst n -- ) swap { BIN: 111 t HEX: c0 } immediate-1 ; GENERIC: IMUL2 ( dst src -- ) -M: integer IMUL2 swap dup reg-code t HEX: 69 immediate-1/4 ; +M: immediate IMUL2 swap dup reg-code t HEX: 68 3array immediate-1/4 ; M: operand IMUL2 OCT: 257 extended-opcode (2-operand) ; : MOVSX ( dst src -- ) @@ -409,34 +423,34 @@ M: operand IMUL2 OCT: 257 extended-opcode (2-operand) ; ! Conditional move : MOVcc ( dst src cc -- ) extended-opcode swapd (2-operand) ; -: CMOVO HEX: 40 MOVcc ; -: CMOVNO HEX: 41 MOVcc ; -: CMOVB HEX: 42 MOVcc ; -: CMOVAE HEX: 43 MOVcc ; -: CMOVE HEX: 44 MOVcc ; ! aka CMOVZ -: CMOVNE HEX: 45 MOVcc ; -: CMOVBE HEX: 46 MOVcc ; -: CMOVA HEX: 47 MOVcc ; -: CMOVS HEX: 48 MOVcc ; -: CMOVNS HEX: 49 MOVcc ; -: CMOVP HEX: 4a MOVcc ; -: CMOVNP HEX: 4b MOVcc ; -: CMOVL HEX: 4c MOVcc ; -: CMOVGE HEX: 4d MOVcc ; -: CMOVLE HEX: 4e MOVcc ; -: CMOVG HEX: 4f MOVcc ; +: CMOVO ( dst src -- ) HEX: 40 MOVcc ; +: CMOVNO ( dst src -- ) HEX: 41 MOVcc ; +: CMOVB ( dst src -- ) HEX: 42 MOVcc ; +: CMOVAE ( dst src -- ) HEX: 43 MOVcc ; +: CMOVE ( dst src -- ) HEX: 44 MOVcc ; ! aka CMOVZ +: CMOVNE ( dst src -- ) HEX: 45 MOVcc ; +: CMOVBE ( dst src -- ) HEX: 46 MOVcc ; +: CMOVA ( dst src -- ) HEX: 47 MOVcc ; +: CMOVS ( dst src -- ) HEX: 48 MOVcc ; +: CMOVNS ( dst src -- ) HEX: 49 MOVcc ; +: CMOVP ( dst src -- ) HEX: 4a MOVcc ; +: CMOVNP ( dst src -- ) HEX: 4b MOVcc ; +: CMOVL ( dst src -- ) HEX: 4c MOVcc ; +: CMOVGE ( dst src -- ) HEX: 4d MOVcc ; +: CMOVLE ( dst src -- ) HEX: 4e MOVcc ; +: CMOVG ( dst src -- ) HEX: 4f MOVcc ; ! CPU Identification -: CPUID HEX: a2 extended-opcode, ; +: CPUID ( -- ) HEX: a2 extended-opcode, ; ! x87 Floating Point Unit -: FSTPS ( operand -- ) BIN: 011 f HEX: d9 1-operand ; -: FSTPL ( operand -- ) BIN: 011 f HEX: dd 1-operand ; +: FSTPS ( operand -- ) { BIN: 011 f HEX: d9 } 1-operand ; +: FSTPL ( operand -- ) { BIN: 011 f HEX: dd } 1-operand ; -: FLDS ( operand -- ) BIN: 000 f HEX: d9 1-operand ; -: FLDL ( operand -- ) BIN: 000 f HEX: dd 1-operand ; +: FLDS ( operand -- ) { BIN: 000 f HEX: d9 } 1-operand ; +: FLDL ( operand -- ) { BIN: 000 f HEX: dd } 1-operand ; ! SSE multimedia instructions diff --git a/core/cpu/x86/bootstrap.factor b/core/cpu/x86/bootstrap.factor index ea4cadd51b..bd1b0f2871 100755 --- a/core/cpu/x86/bootstrap.factor +++ b/core/cpu/x86/bootstrap.factor @@ -60,7 +60,7 @@ big-endian off arg0 \ f tag-number CMP ! compare it with f arg0 arg1 [] CMOVNE ! load true branch if not equal arg0 arg1 bootstrap-cell [+] CMOVE ! load false branch if equal - arg0 quot-xt@ [+] JMP ! jump to quotation-xt + arg0 quot-xt-offset [+] JMP ! jump to quotation-xt ] rc-absolute-cell rt-literal 1 rex-length + jit-if-jump jit-define [ @@ -70,8 +70,8 @@ big-endian off fixnum>slot@ ! turn it into an array offset ds-reg bootstrap-cell SUB ! pop index arg0 arg1 ADD ! compute quotation location - arg0 arg0 array-start [+] MOV ! load quotation - arg0 quot-xt@ [+] JMP ! execute branch + arg0 arg0 array-start-offset [+] MOV ! load quotation + arg0 quot-xt-offset [+] JMP ! execute branch ] rc-absolute-cell rt-literal 1 rex-length + jit-dispatch jit-define [ diff --git a/core/cpu/x86/intrinsics/intrinsics.factor b/core/cpu/x86/intrinsics/intrinsics.factor index c48f33b765..0ee8a0a1d9 100755 --- a/core/cpu/x86/intrinsics/intrinsics.factor +++ b/core/cpu/x86/intrinsics/intrinsics.factor @@ -20,16 +20,16 @@ IN: cpu.x86.intrinsics } define-intrinsic ! Slots -: %slot-literal-known-tag +: %slot-literal-known-tag ( -- op ) "obj" operand "n" get cells "obj" get operand-tag - [+] ; -: %slot-literal-any-tag +: %slot-literal-any-tag ( -- op ) "obj" operand %untag "obj" operand "n" get cells [+] ; -: %slot-any +: %slot-any ( -- op ) "obj" operand %untag "n" operand fixnum>slot@ "obj" operand "n" operand [+] ; @@ -63,9 +63,15 @@ IN: cpu.x86.intrinsics : generate-write-barrier ( -- ) #! Mark the card pointed to by vreg. "val" get operand-immediate? "obj" get fresh-object? or [ + ! Mark the card "obj" operand card-bits SHR "cards_offset" f temp-reg v>operand %alien-global - temp-reg v>operand "obj" operand [+] card-mark OR + temp-reg v>operand "obj" operand [+] card-mark MOV + + ! Mark the card deck + "obj" operand deck-bits card-bits - SHR + "decks_offset" f temp-reg v>operand %alien-global + temp-reg v>operand "obj" operand [+] card-mark MOV ] unless ; \ set-slot { @@ -393,15 +399,15 @@ IN: cpu.x86.intrinsics { +clobber+ { "offset" } } } ; -: define-getter +: define-getter ( word quot reg -- ) [ %alien-integer-get ] 2curry alien-integer-get-template define-intrinsic ; -: define-unsigned-getter +: define-unsigned-getter ( word reg -- ) [ small-reg dup XOR MOV ] swap define-getter ; -: define-signed-getter +: define-signed-getter ( word reg -- ) [ [ >r MOV small-reg r> MOVSX ] curry ] keep define-getter ; : %alien-integer-set ( quot reg -- ) @@ -423,7 +429,7 @@ IN: cpu.x86.intrinsics { +clobber+ { "value" "offset" } } } ; -: define-setter +: define-setter ( word reg -- ) [ swap MOV ] swap [ %alien-integer-set ] 2curry alien-integer-set-template diff --git a/core/debugger/debugger-docs.factor b/core/debugger/debugger-docs.factor index ca6aa59cc4..9dd23c6011 100755 --- a/core/debugger/debugger-docs.factor +++ b/core/debugger/debugger-docs.factor @@ -1,7 +1,7 @@ USING: alien arrays generic generic.math help.markup help.syntax kernel math memory strings sbufs vectors io io.files classes help generic.standard continuations system debugger.private -io.files.private ; +io.files.private listener ; IN: debugger ARTICLE: "errors-assert" "Assertions" @@ -64,7 +64,7 @@ HELP: :3 HELP: error. { $values { "error" "an error" } } -{ $contract "Print an error to the " { $link stdio } " stream. You can define methods on this generic word to print human-readable messages for custom errors." } +{ $contract "Print an error to " { $link output-stream } ". You can define methods on this generic word to print human-readable messages for custom errors." } { $notes "Code should call " { $link print-error } " instead, which handles the case where the printing of the error itself throws an error." } ; HELP: error-help @@ -75,19 +75,15 @@ HELP: error-help HELP: print-error { $values { "error" "an error" } } -{ $description "Print an error to the " { $link stdio } " stream." } +{ $description "Print an error to " { $link output-stream } "." } { $notes "This word is called by the listener and other tools which report caught errors to the user." } ; HELP: restarts. -{ $description "Print a list of restarts for the most recently thrown error to the " { $link stdio } " stream." } ; - -HELP: error-hook -{ $var-description "A quotation with stack effect " { $snippet "( error -- )" } " which is used by " { $link try } " to report the error to the user." } -{ $examples "The default value prints the error with " { $link print-error } ", followed by a list of restarts and a help message. The graphical listener sets this variable to display a popup instead." } ; +{ $description "Print a list of restarts for the most recently thrown error to " { $link output-stream } "." } ; HELP: try { $values { "quot" "a quotation" } } -{ $description "Attempts to call a quotation; if it throws an error, the " { $link error-hook } " gets called, stacks are restored, and execution continues after the call to " { $link try } "." } +{ $description "Attempts to call a quotation; if it throws an error, the error is printed to " { $link output-stream } ", stacks are restored, and execution continues after the call to " { $link try } "." } { $examples "The following example prints an error and keeps going:" { $code diff --git a/core/debugger/debugger.factor b/core/debugger/debugger.factor index f2740a63a9..cfad144737 100755 --- a/core/debugger/debugger.factor +++ b/core/debugger/debugger.factor @@ -1,12 +1,13 @@ ! Copyright (C) 2004, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: arrays definitions generic hashtables inspector io kernel -math namespaces prettyprint sequences assocs sequences.private -strings io.styles vectors words system splitting math.parser -classes.tuple continuations continuations.private combinators -generic.math io.streams.duplex classes.builtin classes -compiler.units generic.standard vocabs threads threads.private -init kernel.private libc io.encodings mirrors accessors ; +math namespaces prettyprint prettyprint.config sequences assocs +sequences.private strings io.styles vectors words system +splitting math.parser classes.tuple continuations +continuations.private combinators generic.math +classes.builtin classes compiler.units generic.standard vocabs +threads threads.private init kernel.private libc io.encodings +mirrors accessors math.order destructors ; IN: debugger GENERIC: error. ( error -- ) @@ -35,12 +36,12 @@ M: string error. print ; : :vars ( -- ) error-continuation get continuation-name namestack. ; -: :res ( n -- ) +: :res ( n -- * ) 1- restarts get-global nth f restarts set-global restart ; -: :1 1 :res ; -: :2 2 :res ; -: :3 3 :res ; +: :1 ( -- * ) 1 :res ; +: :2 ( -- * ) 2 :res ; +: :3 ( -- * ) 3 :res ; : restart. ( restart n -- ) [ @@ -63,17 +64,14 @@ M: string error. print ; [ global [ "Error in print-error!" print drop ] bind ] recover ; -SYMBOL: error-hook - -[ +: print-error-and-restarts ( error -- ) print-error restarts. nl - "Type :help for debugging help." print flush -] error-hook set-global + "Type :help for debugging help." print flush ; : try ( quot -- ) - [ error-hook get call ] recover ; + [ print-error-and-restarts ] recover ; ERROR: assert got expect ; @@ -95,11 +93,11 @@ M: relative-overflow summary drop "Superfluous items pushed to data stack" ; : assert-depth ( quot -- ) - >r datastack r> swap slip >r datastack r> - 2dup [ length ] compare sgn { - { -1 [ trim-datastacks nip relative-underflow ] } - { 0 [ 2drop ] } - { 1 [ trim-datastacks drop relative-overflow ] } + >r datastack r> dip >r datastack r> + 2dup [ length ] compare { + { +lt+ [ trim-datastacks nip relative-underflow ] } + { +eq+ [ 2drop ] } + { +gt+ [ trim-datastacks drop relative-overflow ] } } case ; inline : expired-error. ( obj -- ) @@ -145,15 +143,15 @@ M: relative-overflow summary : stack-overflow. ( obj name -- ) write " stack overflow" print drop ; -: datastack-underflow. "Data" stack-underflow. ; -: datastack-overflow. "Data" stack-overflow. ; -: retainstack-underflow. "Retain" stack-underflow. ; -: retainstack-overflow. "Retain" stack-overflow. ; +: datastack-underflow. ( obj -- ) "Data" stack-underflow. ; +: datastack-overflow. ( obj -- ) "Data" stack-overflow. ; +: retainstack-underflow. ( obj -- ) "Retain" stack-underflow. ; +: retainstack-overflow. ( obj -- ) "Retain" stack-overflow. ; -: memory-error. +: memory-error. ( error -- ) "Memory protection fault at address " write third .h ; -: primitive-error. +: primitive-error. ( error -- ) "Unimplemented primitive" print drop ; PREDICATE: kernel-error < array @@ -163,7 +161,7 @@ PREDICATE: kernel-error < array [ second 0 15 between? ] } cond ; -: kernel-errors +: kernel-errors ( error -- n errors ) second { { 0 [ expired-error. ] } { 1 [ io-error. ] } @@ -208,9 +206,6 @@ M: no-next-method summary M: inconsistent-next-method summary drop "Executing call-next-method with inconsistent parameters" ; -M: stream-closed-twice summary - drop "Attempt to perform I/O on closed stream" ; - M: check-method summary drop "Invalid parameters for create-method" ; @@ -240,6 +235,15 @@ M: condition error-help error>> error-help ; M: assert summary drop "Assertion failed" ; +M: assert error. + "Assertion failed" print + standard-table-style [ + 15 length-limit set + 5 line-limit set + [ expect>> [ [ "Expect:" write ] with-cell pprint-cell ] with-row ] + [ got>> [ [ "Got:" write ] with-cell pprint-cell ] with-row ] bi + ] tabular-output ; + M: immutable summary drop "Sequence is immutable" ; M: redefine-error error. @@ -266,8 +270,7 @@ M: double-free summary M: realloc-error summary drop "Memory reallocation failed" ; -: error-in-thread. ( -- ) - error-thread get-global +: error-in-thread. ( thread -- ) "Error in thread " write [ dup thread-id # @@ -281,7 +284,7 @@ M: thread error-in-thread ( error thread -- ) die drop ] [ global [ - error-in-thread. print-error flush + error-thread get-global error-in-thread. print-error flush ] bind ] if ; @@ -293,6 +296,12 @@ M: no-such-slot summary drop "No such slot" ; M: immutable-slot summary drop "Slot is immutable" ; +M: bad-create summary drop "Bad parameters to create" ; + +M: attempt-all-error summary drop "Nothing to attempt" ; + +M: already-disposed summary drop "Attempting to operate on disposed object" ; + ... do stuff ... dispose" +} +"The reason being that if " { $snippet "do stuff" } " throws an error, the resource will not be disposed of. The most important case where this can occur is with I/O streams, and the correct solution is to always use " { $link with-input-stream } " and " { $link with-output-stream } "; see " { $link "stdio" } " for details." ; + +ARTICLE: "destructors" "Deterministic resource disposal" +"Operating system resources such as streams, memory mapped files, and so on are not managed by Factor's garbage collector and must be released when you are done with them. Failing to release a resource can lead to reduced performance and instability." +$nl +"Disposable object protocol:" +{ $subsection dispose } +{ $subsection dispose* } +"Utility word for scoped disposal:" +{ $subsection with-disposal } +"Utility word for disposing multiple objects:" +{ $subsection dispose-each } +"Utility words for more complex disposal patterns:" +{ $subsection with-destructors } +{ $subsection &dispose } +{ $subsection |dispose } +{ $subsection "destructors-anti-patterns" } ; + +ABOUT: "destructors" diff --git a/extra/destructors/destructors-tests.factor b/core/destructors/destructors-tests.factor similarity index 62% rename from extra/destructors/destructors-tests.factor rename to core/destructors/destructors-tests.factor index 59c325c490..f442e27a04 100755 --- a/extra/destructors/destructors-tests.factor +++ b/core/destructors/destructors-tests.factor @@ -1,6 +1,24 @@ -USING: destructors kernel tools.test continuations ; +USING: destructors kernel tools.test continuations accessors +namespaces sequences ; IN: destructors.tests +TUPLE: dispose-error ; + +M: dispose-error dispose 3 throw ; + +TUPLE: dispose-dummy disposed? ; + +M: dispose-dummy dispose t >>disposed? drop ; + +T{ dispose-error } "a" set +T{ dispose-dummy } "b" set + +[ f ] [ "b" get disposed?>> ] unit-test + +[ { "a" "b" } [ get ] map dispose-each ] [ 3 = ] must-fail-with + +[ t ] [ "b" get disposed?>> ] unit-test + TUPLE: dummy-obj destroyed? ; : dummy-obj new ; @@ -13,10 +31,10 @@ M: dummy-destructor dispose ( obj -- ) dummy-destructor-obj t swap set-dummy-obj-destroyed? ; : destroy-always - add-always-destructor ; + &dispose drop ; : destroy-later - add-error-destructor ; + |dispose drop ; [ t ] [ [ diff --git a/core/destructors/destructors.factor b/core/destructors/destructors.factor new file mode 100755 index 0000000000..bed1c16bcf --- /dev/null +++ b/core/destructors/destructors.factor @@ -0,0 +1,56 @@ +! Copyright (C) 2007, 2008 Doug Coleman, Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors continuations kernel namespaces +sequences vectors ; +IN: destructors + +TUPLE: disposable disposed ; + +GENERIC: dispose* ( disposable -- ) + +ERROR: already-disposed disposable ; + +: check-disposed ( disposable -- ) + dup disposed>> [ already-disposed ] [ drop ] if ; inline + +GENERIC: dispose ( disposable -- ) + +M: object dispose + dup disposed>> [ drop ] [ t >>disposed dispose* ] if ; + +: dispose-each ( seq -- ) + [ + [ [ dispose ] curry [ , ] recover ] each + ] { } make dup empty? [ drop ] [ peek rethrow ] if ; + +: with-disposal ( object quot -- ) + over [ dispose ] curry [ ] cleanup ; inline + + dispose-each ; + +: do-error-destructors ( -- ) + error-destructors get dispose-each ; + +PRIVATE> + +: &dispose ( disposable -- disposable ) + dup always-destructors get push ; inline + +: |dispose ( disposable -- disposable ) + dup error-destructors get push ; inline + +: with-destructors ( quot -- ) + [ + V{ } clone always-destructors set + V{ } clone error-destructors set + [ do-always-destructors ] + [ do-error-destructors ] + cleanup + ] with-scope ; inline diff --git a/extra/destructors/summary.txt b/core/destructors/summary.txt similarity index 100% rename from extra/destructors/summary.txt rename to core/destructors/summary.txt diff --git a/core/dlists/dlists-docs.factor b/core/dlists/dlists-docs.factor index c957c04453..8616d1f253 100755 --- a/core/dlists/dlists-docs.factor +++ b/core/dlists/dlists-docs.factor @@ -1,4 +1,4 @@ -USING: help.markup help.syntax kernel quotations ; +USING: help.markup help.syntax kernel quotations dlists.private ; IN: dlists ARTICLE: "dlists" "Doubly-linked lists" @@ -51,38 +51,52 @@ HELP: dlist-empty? HELP: push-front { $values { "obj" "an object" } { "dlist" dlist } } { $description "Push the object onto the front of the " { $link dlist } "." } -{ $notes "This operation is O(1)." } -{ $see-also push-back pop-front pop-front* pop-back pop-back* } ; +{ $notes "This operation is O(1)." } ; + +HELP: push-front* +{ $values { "obj" "an object" } { "dlist" dlist } { "dlist-node" dlist-node } } +{ $description "Push the object onto the front of the " { $link dlist } " and return the newly created " { $snippet "dlist-node" } "." } +{ $notes "This operation is O(1)." } ; HELP: push-back { $values { "obj" "an object" } { "dlist" dlist } } { $description "Push the object onto the back of the " { $link dlist } "." } -{ $notes "This operation is O(1)." } -{ $see-also push-front pop-front pop-front* pop-back pop-back* } ; +{ $notes "This operation is O(1)." } ; + +HELP: push-back* +{ $values { "obj" "an object" } { "dlist" dlist } { "dlist-node" dlist-node } } +{ $description "Push the object onto the back of the " { $link dlist } " and return the newly created " { $snippet "dlist-node" } "." } +{ $notes "This operation is O(1)." } ; + +HELP: peek-front +{ $values { "dlist" dlist } { "obj" "an object" } } +{ $description "Returns the object at the front of the " { $link dlist } "." } ; HELP: pop-front { $values { "dlist" dlist } { "obj" "an object" } } { $description "Pop the object off the front of the " { $link dlist } " and return the object." } -{ $notes "This operation is O(1)." } -{ $see-also push-front push-back pop-front* pop-back pop-back* } ; +{ $notes "This operation is O(1)." } ; HELP: pop-front* { $values { "dlist" dlist } } { $description "Pop the object off the front of the " { $link dlist } "." } -{ $notes "This operation is O(1)." } -{ $see-also push-front push-back pop-front pop-back pop-back* } ; +{ $notes "This operation is O(1)." } ; + +HELP: peek-back +{ $values { "dlist" dlist } { "obj" "an object" } } +{ $description "Returns the object at the back of the " { $link dlist } "." } ; HELP: pop-back { $values { "dlist" dlist } { "obj" "an object" } } { $description "Pop the object off the back of the " { $link dlist } " and return the object." } -{ $notes "This operation is O(1)." } -{ $see-also push-front push-back pop-front pop-front* pop-back* } ; +{ $notes "This operation is O(1)." } ; HELP: pop-back* { $values { "dlist" dlist } } { $description "Pop the object off the back of the " { $link dlist } "." } -{ $notes "This operation is O(1)." } -{ $see-also push-front push-back pop-front pop-front* pop-back } ; +{ $notes "This operation is O(1)." } ; + +{ push-front push-front* push-back push-back* peek-front pop-front pop-front* peek-back pop-back pop-back* } related-words HELP: dlist-find { $values { "dlist" { $link dlist } } { "quot" quotation } { "obj/f" "an object or " { $link f } } { "?" "a boolean" } } diff --git a/core/dlists/dlists-tests.factor b/core/dlists/dlists-tests.factor index b0fe2a1157..886572c867 100755 --- a/core/dlists/dlists-tests.factor +++ b/core/dlists/dlists-tests.factor @@ -1,6 +1,6 @@ USING: dlists dlists.private kernel tools.test random assocs sets sequences namespaces sorting debugger io prettyprint -math ; +math accessors classes ; IN: dlists.tests [ t ] [ dlist-empty? ] unit-test @@ -65,21 +65,18 @@ IN: dlists.tests : assert-same-elements [ prune natural-sort ] bi@ assert= ; -: dlist-push-all [ push-front ] curry each ; - : dlist-delete-all [ dlist-delete drop ] curry each ; : dlist>array [ [ , ] dlist-slurp ] { } make ; [ ] [ 5 [ drop 30 random >fixnum ] map prune - 6 [ drop 30 random >fixnum ] map prune 2dup nl . . nl - [ + 6 [ drop 30 random >fixnum ] map prune [ - [ dlist-push-all ] keep - [ dlist-delete-all ] keep - dlist>array - ] 2keep diff assert-same-elements + [ push-all-front ] + [ dlist-delete-all ] + [ dlist>array ] tri + ] 2keep swap diff assert-same-elements ] unit-test [ ] [ @@ -95,3 +92,13 @@ IN: dlists.tests [ 1 ] [ "d" get dlist-length ] unit-test [ 1 ] [ "d" get dlist>array length ] unit-test + +[ t ] [ 4 over push-back 5 over push-back [ obj>> 4 = ] dlist-find-node drop class dlist-node = ] unit-test +[ t ] [ 4 over push-back 5 over push-back [ obj>> 5 = ] dlist-find-node drop class dlist-node = ] unit-test +[ t ] [ 4 over push-back 5 over push-back* [ = ] curry dlist-find-node drop class dlist-node = ] unit-test +[ ] [ 4 over push-back 5 over push-back [ drop ] dlist-each ] unit-test + +[ peek-front ] must-fail +[ peek-back ] must-fail +[ pop-front ] [ empty-dlist? ] must-fail-with +[ pop-back ] [ empty-dlist? ] must-fail-with diff --git a/core/dlists/dlists.factor b/core/dlists/dlists.factor index e79907f11f..e07bfcdabe 100755 --- a/core/dlists/dlists.factor +++ b/core/dlists/dlists.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007, 2008 Mackenzie Straight, Doug Coleman, ! Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: combinators kernel math sequences accessors ; +USING: combinators kernel math sequences accessors inspector ; IN: dlists TUPLE: dlist front back length ; @@ -47,7 +47,7 @@ C: dlist-node : (dlist-find-node) ( dlist-node quot -- node/f ? ) over [ - [ >r obj>> r> call ] 2keep rot + [ call ] 2keep rot [ drop t ] [ >r next>> r> (dlist-find-node) ] if ] [ 2drop f f ] if ; inline @@ -55,7 +55,7 @@ C: dlist-node >r front>> r> (dlist-find-node) ; inline : dlist-each-node ( dlist quot -- ) - [ t ] compose dlist-find-node 2drop ; inline + [ f ] compose dlist-find-node 2drop ; inline PRIVATE> @@ -84,11 +84,17 @@ PRIVATE> : push-all-back ( seq dlist -- ) [ push-back ] curry each ; +ERROR: empty-dlist ; + +M: empty-dlist summary ( dlist -- ) + drop "Emtpy dlist" ; + : peek-front ( dlist -- obj ) - front>> obj>> ; + front>> [ empty-dlist ] unless* obj>> ; : pop-front ( dlist -- obj ) - dup front>> [ + dup front>> [ empty-dlist ] unless* + [ dup next>> f rot (>>next) f over set-prev-when @@ -96,13 +102,15 @@ PRIVATE> ] 2keep obj>> swap [ normalize-back ] keep dec-length ; -: pop-front* ( dlist -- ) pop-front drop ; +: pop-front* ( dlist -- ) + pop-front drop ; : peek-back ( dlist -- obj ) - back>> obj>> ; + back>> [ empty-dlist ] unless* obj>> ; : pop-back ( dlist -- obj ) - dup back>> [ + dup back>> [ empty-dlist ] unless* + [ dup prev>> f rot (>>prev) f over set-next-when @@ -110,9 +118,11 @@ PRIVATE> ] 2keep obj>> swap [ normalize-front ] keep dec-length ; -: pop-back* ( dlist -- ) pop-back drop ; +: pop-back* ( dlist -- ) + pop-back drop ; : dlist-find ( dlist quot -- obj/f ? ) + [ obj>> ] prepose dlist-find-node [ obj>> t ] [ drop f f ] if ; inline : dlist-contains? ( dlist quot -- ? ) @@ -141,6 +151,7 @@ PRIVATE> ] if ; inline : delete-node-if ( dlist quot -- obj/f ) + [ obj>> ] prepose delete-node-if* drop ; inline : dlist-delete ( obj dlist -- obj/f ) @@ -153,7 +164,7 @@ PRIVATE> drop ; : dlist-each ( dlist quot -- ) - [ obj>> ] swap compose dlist-each-node ; inline + [ obj>> ] prepose dlist-each-node ; inline : dlist-slurp ( dlist quot -- ) over dlist-empty? diff --git a/core/effects/effects-docs.factor b/core/effects/effects-docs.factor index 9e37ba4c85..66beae443f 100644 --- a/core/effects/effects-docs.factor +++ b/core/effects/effects-docs.factor @@ -2,7 +2,9 @@ USING: help.markup help.syntax math strings words ; IN: effects ARTICLE: "effect-declaration" "Stack effect declaration" -"It is good practice to declare the stack effects of words using the following syntax:" +"Stack effects of words must be declared, with the exception of words which only push literals on the stack." +$nl +"Stack effects are declared with the following syntax:" { $code ": sq ( x -- y ) dup * ;" } "A stack effect declaration is written in parentheses and lists word inputs and outputs, separated by " { $snippet "--" } ". Stack effect declarations are read in using a parsing word:" { $subsection POSTPONE: ( } @@ -28,18 +30,21 @@ $nl ARTICLE: "effects" "Stack effects" "A " { $emphasis "stack effect declaration" } ", for example " { $snippet "( x y -- z )" } " denotes that an operation takes two inputs, with " { $snippet "y" } " at the top of the stack, and returns one output." $nl +"Stack effects of words can be declared." +{ $subsection "effect-declaration" } "Stack effects are first-class, and words for working with them are found in the " { $vocab-link "effects" } " vocabulary." { $subsection effect } { $subsection effect? } -"Stack effects of words can be declared." -{ $subsection "effect-declaration" } +"There is a literal syntax for stack objects. It is most often used with " { $link define-declared } "." +{ $subsection POSTPONE: (( } "Getting a word's declared stack effect:" { $subsection stack-effect } "Converting a stack effect to a string form:" { $subsection effect>string } "Comparing effects:" { $subsection effect-height } -{ $subsection effect<= } ; +{ $subsection effect<= } +{ $see-also "inference" } ; ABOUT: "effects" diff --git a/core/effects/effects-tests.factor b/core/effects/effects-tests.factor index 234f567f25..c592ef6c92 100644 --- a/core/effects/effects-tests.factor +++ b/core/effects/effects-tests.factor @@ -1,9 +1,17 @@ IN: effects.tests -USING: effects tools.test ; +USING: effects tools.test prettyprint accessors sequences ; [ t ] [ 1 1 2 2 effect<= ] unit-test [ f ] [ 1 0 2 2 effect<= ] unit-test [ t ] [ 2 2 2 2 effect<= ] unit-test [ f ] [ 3 3 2 2 effect<= ] unit-test [ f ] [ 2 3 2 2 effect<= ] unit-test -[ t ] [ 2 3 f effect<= ] unit-test +[ 2 ] [ (( a b -- c )) in>> length ] unit-test +[ 1 ] [ (( a b -- c )) out>> length ] unit-test + + +[ "(( a b -- c d ))" ] [ { "a" "b" } { "c" "d" } unparse ] unit-test +[ "(( -- c d ))" ] [ { } { "c" "d" } unparse ] unit-test +[ "(( a b -- ))" ] [ { "a" "b" } { } unparse ] unit-test +[ "(( -- ))" ] [ { } { } unparse ] unit-test +[ "(( a b -- c ))" ] [ (( a b -- c )) unparse ] unit-test diff --git a/core/effects/effects.factor b/core/effects/effects.factor index 80a4f679c0..099260f111 100755 --- a/core/effects/effects.factor +++ b/core/effects/effects.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2006, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel math namespaces sequences strings words assocs -combinators ; +combinators accessors ; IN: effects TUPLE: effect in out terminated? ; @@ -11,14 +11,13 @@ TUPLE: effect in out terminated? ; effect boa ; : effect-height ( effect -- n ) - dup effect-out length swap effect-in length - ; + [ out>> length ] [ in>> length ] bi - ; : effect<= ( eff1 eff2 -- ? ) { - { [ dup not ] [ t ] } - { [ over effect-terminated? ] [ t ] } - { [ dup effect-terminated? ] [ f ] } - { [ 2dup [ effect-in length ] bi@ > ] [ f ] } + { [ over terminated?>> ] [ t ] } + { [ dup terminated?>> ] [ f ] } + { [ 2dup [ in>> length ] bi@ > ] [ f ] } { [ 2dup [ effect-height ] bi@ = not ] [ f ] } [ t ] } cond 2nip ; @@ -34,10 +33,10 @@ M: integer (stack-picture) drop "object" ; : effect>string ( effect -- string ) [ "( " % - dup effect-in stack-picture % - "-- " % - dup effect-out stack-picture % - effect-terminated? [ "* " % ] when + [ in>> stack-picture % "-- " % ] + [ out>> stack-picture % ] + [ terminated?>> [ "* " % ] when ] + tri ")" % ] "" make ; @@ -50,16 +49,16 @@ M: word stack-effect swap word-props [ at ] curry map [ ] find nip ; M: effect clone - [ effect-in clone ] keep effect-out clone ; + [ in>> clone ] keep effect-out clone ; : split-shuffle ( stack shuffle -- stack1 stack2 ) - effect-in length cut* ; + in>> length cut* ; : load-shuffle ( stack shuffle -- ) - effect-in [ set ] 2each ; + in>> [ set ] 2each ; : shuffled-values ( shuffle -- values ) - effect-out [ get ] map ; + out>> [ get ] map ; : shuffle* ( stack shuffle -- newstack ) [ [ load-shuffle ] keep shuffled-values ] with-scope ; diff --git a/core/generator/fixup/fixup-docs.factor b/core/generator/fixup/fixup-docs.factor index f5d530dccb..64d733ef8c 100644 --- a/core/generator/fixup/fixup-docs.factor +++ b/core/generator/fixup/fixup-docs.factor @@ -1,14 +1,11 @@ -USING: help.syntax help.markup generator.fixup math kernel +USING: help.syntax help.markup math kernel words strings alien ; +IN: generator.fixup HELP: frame-required { $values { "n" "a non-negative integer" } } { $description "Notify the code generator that the currently compiling code block needs a stack frame with room for at least " { $snippet "n" } " parameters." } ; -HELP: (rel-fixup) -{ $values { "arg" integer } { "class" "a relocation class" } { "type" "a relocation type" } { "offset" integer } { "pair" "a pair of integers" } } -{ $description "Creates a relocation instruction for the VM's runtime compiled code linker." } ; - HELP: add-literal { $values { "obj" object } { "n" integer } } { $description "Adds a literal to the " { $link literal-table } ", if it is not already there, and outputs the index of the literal in the table. This literal can then be used as an argument for a " { $link rt-literal } " relocation with " { $link rel-fixup } "." } ; diff --git a/core/generator/fixup/fixup.factor b/core/generator/fixup/fixup.factor index ad6cd3051c..a0961984ed 100755 --- a/core/generator/fixup/fixup.factor +++ b/core/generator/fixup/fixup.factor @@ -1,9 +1,10 @@ ! Copyright (C) 2007, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: arrays generic assocs hashtables +USING: arrays byte-arrays generic assocs hashtables io.binary kernel kernel.private math namespaces sequences words -quotations strings alien.strings layouts system combinators -math.bitfields words.private cpu.architecture ; +quotations strings alien.accessors alien.strings layouts system +combinators math.bitfields words.private cpu.architecture +math.order accessors growable ; IN: generator.fixup : no-stack-frame -1 ; inline @@ -77,38 +78,35 @@ TUPLE: label-fixup label class ; : label-fixup ( label class -- ) \ label-fixup boa , ; M: label-fixup fixup* - dup label-fixup-class rc-absolute? + dup class>> rc-absolute? [ "Absolute labels not supported" throw ] when - dup label-fixup-label swap label-fixup-class - compiled-offset 4 - rot 3array label-table get push ; + dup label>> swap class>> compiled-offset 4 - rot + 3array label-table get push ; TUPLE: rel-fixup arg class type ; : rel-fixup ( arg class type -- ) \ rel-fixup boa , ; -: (rel-fixup) ( arg class type offset -- pair ) - pick rc-absolute-cell = cell 4 ? - - >r { 0 8 16 } bitfield r> - 2array ; +: push-4 ( value vector -- ) + [ length ] [ B{ 0 0 0 0 } swap push-all ] [ underlying ] tri + swap set-alien-unsigned-4 ; M: rel-fixup fixup* - dup rel-fixup-arg - over rel-fixup-class - rot rel-fixup-type - compiled-offset (rel-fixup) - relocation-table get push-all ; + [ [ arg>> ] [ class>> ] [ type>> ] tri { 0 8 16 } bitfield ] + [ class>> rc-absolute-cell = cell 4 ? compiled-offset swap - ] bi + [ relocation-table get push-4 ] bi@ ; M: frame-required fixup* drop ; M: integer fixup* , ; -: push-new* ( obj table -- n ) +: adjoin* ( obj table -- n ) 2dup swap [ eq? ] curry find drop [ 2nip ] [ dup length >r push r> ] if* ; SYMBOL: literal-table -: add-literal ( obj -- n ) literal-table get push-new* ; +: add-literal ( obj -- n ) literal-table get adjoin* ; : add-dlsym-literals ( symbol dll -- ) >r string>symbol r> 2array literal-table get push-all ; @@ -134,7 +132,7 @@ SYMBOL: literal-table 0 swap rt-here rel-fixup ; : init-fixup ( -- ) - V{ } clone relocation-table set + BV{ } clone relocation-table set V{ } clone label-table set ; : resolve-labels ( labels -- labels' ) @@ -150,6 +148,6 @@ SYMBOL: literal-table dup stack-frame-size swap [ fixup* ] each drop literal-table get >array - relocation-table get >array + relocation-table get >byte-array label-table get resolve-labels ] { } make ; diff --git a/core/generator/generator.factor b/core/generator/generator.factor index b8de9c3517..684c058913 100755 --- a/core/generator/generator.factor +++ b/core/generator/generator.factor @@ -72,8 +72,8 @@ GENERIC: generate-node ( node -- next ) : word-dataflow ( word -- effect dataflow ) [ - dup "no-effect" word-prop [ no-effect ] when - dup "no-compile" word-prop [ no-effect ] when + dup "cannot-infer" word-prop [ cannot-infer-effect ] when + dup "no-compile" word-prop [ cannot-infer-effect ] when dup specialized-def over dup 2array 1array infer-quot finish-word ] with-infer ; diff --git a/core/generator/registers/registers.factor b/core/generator/registers/registers.factor index 6a1d9ec0f4..ded1c82ee4 100755 --- a/core/generator/registers/registers.factor +++ b/core/generator/registers/registers.factor @@ -4,7 +4,7 @@ USING: arrays assocs classes classes.private classes.algebra combinators cpu.architecture generator.fixup hashtables kernel layouts math namespaces quotations sequences system vectors words effects alien byte-arrays bit-arrays float-arrays -accessors sets ; +accessors sets math.order ; IN: generator.registers SYMBOL: +input+ @@ -67,7 +67,7 @@ INSTANCE: temp-reg value ! A data stack location. TUPLE: ds-loc n class ; -: f ds-loc boa ; +: ( n -- loc ) f ds-loc boa ; M: ds-loc minimal-ds-loc* ds-loc-n min ; M: ds-loc operand-class* ds-loc-class ; @@ -78,7 +78,7 @@ M: ds-loc live-loc? ! A retain stack location. TUPLE: rs-loc n class ; -: f rs-loc boa ; +: ( n -- loc ) f rs-loc boa ; M: rs-loc operand-class* rs-loc-class ; M: rs-loc set-operand-class set-rs-loc-class ; M: rs-loc live-loc? @@ -177,15 +177,15 @@ INSTANCE: constant value r 0 V{ } clone r> boa ; inline -: (loc) +: (loc) ( m stack -- n ) #! Utility for methods on height>> - ; @@ -314,7 +314,7 @@ M: phantom-retainstack finalize-height : (live-locs) ( phantom -- seq ) #! Discard locs which haven't moved [ phantom-locs* ] [ stack>> ] bi zip - [ live-loc? ] assoc-subset + [ live-loc? ] assoc-filter values ; : live-locs ( -- seq ) @@ -372,7 +372,7 @@ M: value (lazy-load) : (compute-free-vregs) ( used class -- vector ) #! Find all vregs in 'class' which are not in 'used'. [ vregs length reverse ] keep - [ ] curry map diff + [ ] curry map swap diff >vector ; : compute-free-vregs ( -- ) @@ -484,7 +484,7 @@ M: loc lazy-store : substitute-vregs ( values vregs -- ) [ vreg-substitution ] 2map - [ substitute-vreg? ] assoc-subset >hashtable + [ substitute-vreg? ] assoc-filter >hashtable [ >r stack>> r> substitute-here ] curry each-phantom ; : set-operand ( value var -- ) @@ -569,7 +569,7 @@ M: loc lazy-store { { f [ drop t ] } { known-tag [ class-tag >boolean ] } - [ class< ] + [ class<= ] } case ; : spec-matches? ( value spec -- ? ) @@ -644,7 +644,7 @@ PRIVATE> UNION: immediate fixnum POSTPONE: f ; : operand-immediate? ( operand -- ? ) - operand-class immediate class< ; + operand-class immediate class<= ; : phantom-push ( obj -- ) 1 phantom-datastack get adjust-phantom diff --git a/core/generic/generic-docs.factor b/core/generic/generic-docs.factor index 1024c377a8..39293bfec9 100755 --- a/core/generic/generic-docs.factor +++ b/core/generic/generic-docs.factor @@ -4,22 +4,22 @@ generic.standard generic.math combinators ; IN: generic ARTICLE: "method-order" "Method precedence" -"Consider the case where a generic word has methods on two classes, say A and B, which share a non-empty intersection. If the generic word is called on an object which is an instance of both A and B, a choice of method must be made. If A is a subclass of B, the method for A to be called; this makes sense, because we're defining general behavior for instances of B, and refining it for instances of A. Conversely, if B is a subclass of A, then we expect B's method to be called. However, if neither is a subclass of the other, we have an ambiguous situation and undefined behavior will result. Either the method for A or B will be called, and there is no way to predict ahead of time." -$nl -"The generic word system linearly orders all the methods on a generic word by their class. Conceptually, method dispatch is implemented by testing the object against the predicate word for every class, in order. If methods are defined on overlapping classes, this order will fail to be unique and the problem described above can occur." +"Conceptually, method dispatch is implemented by testing the object against the predicate word for every class, in linear order (" { $link "class-linearization" } ")." $nl "Here is an example:" { $code "GENERIC: explain" - "M: number explain drop \"an integer\" print ;" - "M: sequence explain drop \"a sequence\" print ;" "M: object explain drop \"an object\" print ;" + "M: number explain drop \"a number\" print ;" + "M: sequence explain drop \"a sequence\" print ;" } -"Neither " { $link number } " nor " { $link sequence } " are subclasses of each other, yet their intersection is the non-empty " { $link integer } " class. As a result, the outcome of calling " { $snippet "bar" } " with an " { $link integer } " on the stack is undefined - either one of the two methods may be called. This situation can lead to subtle bugs. To avoid it, explicitly disambiguate the method order by defining a method on the intersection. If in this case we want integers to behave like numbers, we would also define:" -{ $code "M: integer explain drop \"an integer\" print ;" } -"On the other hand, if we want integers to behave like sequences here, we could define:" +"The linear order is the following, from least-specific to most-specific:" +{ $code "{ object sequence number }" } +"Neither " { $link number } " nor " { $link sequence } " are subclasses of each other, yet their intersection is the non-empty " { $link integer } " class. Calling " { $snippet "explain" } " with an integer on the stack will print " { $snippet "a number" } " because " { $link number } " precedes " { $link sequence } " in the class linearization order. If this was not the desired outcome, define a method on the intersection:" { $code "M: integer explain drop \"a sequence\" print ;" } -"The " { $link order } " word can be useful to clarify method dispatch order." +"Now, the linear order is the following, from least-specific to most-specific:" +{ $code "{ object sequence number integer }" } +"The " { $link order } " word can be useful to clarify method dispatch order:" { $subsection order } ; ARTICLE: "generic-introspection" "Generic word introspection" diff --git a/core/generic/generic-tests.factor b/core/generic/generic-tests.factor index bbd7186a11..9d968a3a98 100755 --- a/core/generic/generic-tests.factor +++ b/core/generic/generic-tests.factor @@ -143,7 +143,7 @@ GENERIC: generic-forget-test-1 M: integer generic-forget-test-1 / ; [ t ] [ - \ / usage [ word? ] subset + \ / usage [ word? ] filter [ word-name "generic-forget-test-1/integer" = ] contains? ] unit-test @@ -152,16 +152,16 @@ M: integer generic-forget-test-1 / ; ] unit-test [ f ] [ - \ / usage [ word? ] subset + \ / usage [ word? ] filter [ word-name "generic-forget-test-1/integer" = ] contains? ] unit-test -GENERIC: generic-forget-test-2 +GENERIC: generic-forget-test-2 ( a b -- c ) M: sequence generic-forget-test-2 = ; [ t ] [ - \ = usage [ word? ] subset + \ = usage [ word? ] filter [ word-name "generic-forget-test-2/sequence" = ] contains? ] unit-test @@ -170,11 +170,11 @@ M: sequence generic-forget-test-2 = ; ] unit-test [ f ] [ - \ = usage [ word? ] subset + \ = usage [ word? ] filter [ word-name "generic-forget-test-2/sequence" = ] contains? ] unit-test -GENERIC: generic-forget-test-3 +GENERIC: generic-forget-test-3 ( a -- b ) M: f generic-forget-test-3 ; diff --git a/core/generic/generic.factor b/core/generic/generic.factor index 6c59d76d07..fb9820008a 100755 --- a/core/generic/generic.factor +++ b/core/generic/generic.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: words kernel sequences namespaces assocs hashtables definitions kernel.private classes classes.private -classes.algebra quotations arrays vocabs effects ; +classes.algebra quotations arrays vocabs effects combinators ; IN: generic ! Method combination protocol @@ -35,7 +35,7 @@ PREDICATE: method-spec < pair GENERIC: effective-method ( ... generic -- method ) : next-method-class ( class generic -- class/f ) - order [ class< ] with subset reverse dup length 1 = + order [ class<= ] with filter reverse dup length 1 = [ drop f ] [ second ] if ; : next-method ( class generic -- class/f ) @@ -56,8 +56,19 @@ TUPLE: check-method class generic ; \ check-method boa throw ] unless ; inline -: with-methods ( generic quot -- ) - swap [ "methods" word-prop swap call ] keep make-generic ; +: affected-methods ( class generic -- seq ) + "methods" word-prop swap + [ nip classes-intersect? ] curry assoc-filter + values ; + +: update-generic ( class generic -- ) + [ affected-methods [ +called+ changed-definition ] each ] + [ make-generic ] + bi ; + +: with-methods ( class generic quot -- ) + [ [ "methods" word-prop ] dip call ] + [ drop update-generic ] 3bi ; inline : method-word-name ( class word -- string ) @@ -117,42 +128,57 @@ M: method-spec definition M: method-spec forget* first2 method forget* ; +M: method-spec smart-usage + second smart-usage ; + M: method-body definer drop \ M: \ ; ; M: method-body forget* dup "forgotten" word-prop [ drop ] [ [ - [ "method-class" word-prop ] - [ "method-generic" word-prop ] bi - dup generic? [ - [ delete-at* ] with-methods - [ call-next-method ] [ drop ] if - ] [ 2drop ] if + [ ] + [ "method-class" word-prop ] + [ "method-generic" word-prop ] tri + 3dup method eq? [ + [ delete-at ] with-methods + call-next-method + ] [ 3drop ] if ] [ t "forgotten" set-word-prop ] bi ] if ; -: implementors* ( classes -- words ) - all-words [ - "methods" word-prop keys - swap [ key? ] curry contains? - ] with subset ; +M: method-body smart-usage + "method-generic" word-prop smart-usage ; -: implementors ( class -- seq ) - dup associate implementors* ; +GENERIC: implementors ( class/classes -- seq ) + +M: class implementors + all-words [ "methods" word-prop key? ] with filter ; + +M: assoc implementors + all-words [ + "methods" word-prop keys + swap [ key? ] curry contains? + ] with filter ; : forget-methods ( class -- ) [ implementors ] [ [ swap 2array ] curry ] bi map forget-all ; M: class forget* ( class -- ) - [ forget-methods ] - [ update-map- ] - [ call-next-method ] - tri ; + [ + class-usages [ + drop + [ forget-methods ] + [ update-map- ] + [ reset-class ] + tri + ] assoc-each + ] + [ call-next-method ] bi ; -M: assoc update-methods ( assoc -- ) - implementors* [ make-generic ] each ; +M: assoc update-methods ( class assoc -- ) + implementors [ update-generic ] with each ; : define-generic ( word combination -- ) over "combination" word-prop over = [ diff --git a/core/generic/math/math.factor b/core/generic/math/math.factor index 884ab8027e..1c1368a6c2 100755 --- a/core/generic/math/math.factor +++ b/core/generic/math/math.factor @@ -3,27 +3,27 @@ USING: arrays generic hashtables kernel kernel.private math namespaces sequences words quotations layouts combinators sequences.private classes classes.builtin classes.algebra -definitions ; +definitions math.order ; IN: generic.math PREDICATE: math-class < class dup null bootstrap-word eq? [ drop f ] [ - number bootstrap-word class< + number bootstrap-word class<= ] if ; : last/first ( seq -- pair ) [ peek ] [ first ] bi 2array ; : math-precedence ( class -- pair ) { - { [ dup null class< ] [ drop { -1 -1 } ] } + { [ dup null class<= ] [ drop { -1 -1 } ] } { [ dup math-class? ] [ class-types last/first ] } [ drop { 100 100 } ] } cond ; : math-class-max ( class class -- class ) - [ [ math-precedence ] compare 0 > ] most ; + [ [ math-precedence ] compare +gt+ eq? ] most ; : (math-upgrade) ( max class -- quot ) dupd = [ drop [ ] ] [ "coercer" word-prop [ ] or ] if ; diff --git a/core/generic/standard/engines/engines.factor b/core/generic/standard/engines/engines.factor index 1f0b80e016..20e22fde82 100644 --- a/core/generic/standard/engines/engines.factor +++ b/core/generic/standard/engines/engines.factor @@ -26,8 +26,8 @@ M: method-body engine>quot 1quotation ; alist>quot ; : split-methods ( assoc class -- first second ) - [ [ nip class< not ] curry assoc-subset ] - [ [ nip class< ] curry assoc-subset ] 2bi ; + [ [ nip class<= not ] curry assoc-filter ] + [ [ nip class<= ] curry assoc-filter ] 2bi ; : convert-methods ( assoc class word -- assoc' ) over >r >r split-methods dup assoc-empty? [ diff --git a/core/generic/standard/engines/predicate/predicate.factor b/core/generic/standard/engines/predicate/predicate.factor index 5335074dea..9c810592a0 100644 --- a/core/generic/standard/engines/predicate/predicate.factor +++ b/core/generic/standard/engines/predicate/predicate.factor @@ -11,19 +11,18 @@ C: predicate-dispatch-engine [ >r "predicate" word-prop picker prepend r> ] assoc-map ; : keep-going? ( assoc -- ? ) - assumed get swap second first class< ; + assumed get swap second first class<= ; : prune-redundant-predicates ( assoc -- default assoc' ) { { [ dup empty? ] [ drop [ "Unreachable" throw ] { } ] } { [ dup length 1 = ] [ first second { } ] } - { [ dup keep-going? ] [ 1 tail-slice prune-redundant-predicates ] } - [ [ first second ] [ 1 tail-slice ] bi ] + { [ dup keep-going? ] [ rest-slice prune-redundant-predicates ] } + [ [ first second ] [ rest-slice ] bi ] } cond ; : sort-methods ( assoc -- assoc' ) - [ keys sort-classes ] - [ [ dupd at ] curry ] bi { } map>assoc ; + >alist [ keys sort-classes ] keep extract-keys ; M: predicate-dispatch-engine engine>quot methods>> clone diff --git a/core/generic/standard/engines/tag/tag.factor b/core/generic/standard/engines/tag/tag.factor index 6344bec536..c1e72a65de 100644 --- a/core/generic/standard/engines/tag/tag.factor +++ b/core/generic/standard/engines/tag/tag.factor @@ -38,7 +38,7 @@ C: hi-tag-dispatch-engine \ hi-tag bootstrap-word \ convert-methods ; -: num-hi-tags num-types get num-tags get - ; +: num-hi-tags ( -- n ) num-types get num-tags get - ; : hi-tag-number ( class -- n ) "type" word-prop num-tags get - ; diff --git a/core/generic/standard/engines/tuple/tuple.factor b/core/generic/standard/engines/tuple/tuple.factor index 7639d1d499..9a780383b5 100644 --- a/core/generic/standard/engines/tuple/tuple.factor +++ b/core/generic/standard/engines/tuple/tuple.factor @@ -4,7 +4,7 @@ USING: kernel classes.tuple.private hashtables assocs sorting accessors combinators sequences slots.private math.parser words effects namespaces generic generic.standard.engines classes.algebra math math.private kernel.private -quotations arrays ; +quotations arrays definitions ; IN: generic.standard.engines.tuple TUPLE: echelon-dispatch-engine n methods ; @@ -44,7 +44,7 @@ M: trivial-tuple-dispatch-engine engine>quot >alist V{ } clone [ hashcode 1array ] distribute-buckets [ ] map ; -: word-hashcode% [ 1 slot ] % ; +: word-hashcode% ( -- ) [ 1 slot ] % ; : class-hash-dispatch-quot ( methods -- quot ) [ @@ -64,8 +64,9 @@ M: engine-word stack-effect [ extra-values ] [ stack-effect ] bi dup [ clone [ length + ] change-in ] [ 2drop f ] if ; -M: engine-word compiled-crossref? - drop t ; +M: engine-word crossref? drop t ; + +M: engine-word irrelevant? drop t ; : remember-engine ( word -- ) generic get "engines" word-prop push ; @@ -77,7 +78,7 @@ M: engine-word compiled-crossref? : define-engine-word ( quot -- word ) >r dup r> define ; -: array-nth% 2 + , [ slot { word } declare ] % ; +: array-nth% ( n -- ) 2 + , [ slot { word } declare ] % ; : tuple-layout-superclasses ( obj -- array ) { tuple } declare @@ -127,8 +128,6 @@ M: echelon-dispatch-engine engine>quot 1 slot { tuple-layout } declare 5 slot ; inline -: unclip-last [ 1 head* ] [ peek ] bi ; - M: tuple-dispatch-engine engine>quot [ picker % diff --git a/core/generic/standard/standard-tests.factor b/core/generic/standard/standard-tests.factor index 1bff9ae15d..93956fec00 100644 --- a/core/generic/standard/standard-tests.factor +++ b/core/generic/standard/standard-tests.factor @@ -3,9 +3,10 @@ USING: tools.test math math.functions math.constants generic.standard strings sequences arrays kernel accessors words float-arrays byte-arrays bit-arrays parser namespaces quotations inference vectors growable hashtables sbufs -prettyprint byte-vectors bit-vectors float-vectors ; +prettyprint byte-vectors bit-vectors float-vectors definitions +generic sets graphs assocs ; -GENERIC: lo-tag-test +GENERIC: lo-tag-test ( obj -- obj' ) M: integer lo-tag-test 3 + ; @@ -20,7 +21,7 @@ M: complex lo-tag-test sq ; [ -1/2 ] [ 1+1/2 lo-tag-test ] unit-test [ -16 ] [ C{ 0 4 } lo-tag-test ] unit-test -GENERIC: hi-tag-test +GENERIC: hi-tag-test ( obj -- obj' ) M: string hi-tag-test ", in bed" append ; @@ -52,7 +53,7 @@ TUPLE: circle < shape radius ; C: circle -GENERIC: area +GENERIC: area ( shape -- n ) M: abstract-rectangle area [ width>> ] [ height>> ] bi * ; @@ -62,15 +63,15 @@ M: circle area radius>> sq pi * ; [ 12 ] [ 4 3 2 area ] unit-test [ t ] [ 2 area 4 pi * = ] unit-test -GENERIC: perimiter +GENERIC: perimiter ( shape -- n ) -: rectangle-perimiter + 2 * ; +: rectangle-perimiter ( n -- n ) + 2 * ; M: rectangle perimiter [ width>> ] [ height>> ] bi rectangle-perimiter ; -: hypotenuse [ sq ] bi@ + sqrt ; +: hypotenuse ( a b -- c ) [ sq ] bi@ + sqrt ; M: parallelogram perimiter [ width>> ] @@ -82,7 +83,7 @@ M: circle perimiter 2 * pi * ; [ 14 ] [ 4 3 perimiter ] unit-test [ 30 ] [ 10 4 3 perimiter ] unit-test -GENERIC: big-mix-test +GENERIC: big-mix-test ( obj -- obj' ) M: object big-mix-test drop "object" ; @@ -124,7 +125,7 @@ M: circle big-mix-test drop "circle" ; [ "tuple" ] [ H{ } big-mix-test ] unit-test [ "object" ] [ \ + big-mix-test ] unit-test -GENERIC: small-lo-tag +GENERIC: small-lo-tag ( obj -- obj ) M: fixnum small-lo-tag drop "fixnum" ; @@ -225,7 +226,7 @@ M: b funky* "b" , call-next-method ; M: c funky* "c" , call-next-method ; -: funky [ funky* ] { } make ; +: funky ( obj -- seq ) [ funky* ] { } make ; [ { "b" "x" "z" } ] [ T{ b } funky ] unit-test @@ -287,3 +288,24 @@ M: sbuf no-stack-effect-decl ; [ ] [ \ no-stack-effect-decl see ] unit-test [ ] [ \ no-stack-effect-decl word-def . ] unit-test + +! Cross-referencing with generic words +TUPLE: xref-tuple-1 ; +TUPLE: xref-tuple-2 < xref-tuple-1 ; + +: (xref-test) ( obj -- ) drop ; + +GENERIC: xref-test ( obj -- ) + +M: xref-tuple-1 xref-test (xref-test) ; +M: xref-tuple-2 xref-test (xref-test) ; + +[ t ] [ + \ xref-test + \ xref-tuple-1 \ xref-test method [ usage unique ] closure key? +] unit-test + +[ t ] [ + \ xref-test + \ xref-tuple-2 \ xref-test method [ usage unique ] closure key? +] unit-test diff --git a/core/generic/standard/standard.factor b/core/generic/standard/standard.factor index 98194e7ef3..f58d016c22 100644 --- a/core/generic/standard/standard.factor +++ b/core/generic/standard/standard.factor @@ -81,14 +81,8 @@ ERROR: no-method object generic ; "methods" word-prop [ generic get mangle-method ] assoc-map [ find-default default set ] - [ - generic get "inline" word-prop [ - - ] [ - - ] if - ] bi - engine>quot + [ ] + bi engine>quot ] } cleave ] with-scope ; diff --git a/core/io/streams/duplex/authors.txt b/core/grouping/authors.txt similarity index 100% rename from core/io/streams/duplex/authors.txt rename to core/grouping/authors.txt diff --git a/core/grouping/grouping-docs.factor b/core/grouping/grouping-docs.factor new file mode 100644 index 0000000000..894412d922 --- /dev/null +++ b/core/grouping/grouping-docs.factor @@ -0,0 +1,100 @@ +USING: help.markup help.syntax sequences strings ; +IN: grouping + +ARTICLE: "grouping" "Groups and clumps" +"A virtual sequence for splitting a sequence into disjoint, fixed-length subsequences:" +{ $subsection groups } +{ $subsection } +{ $subsection } +"A virtual sequence for splitting a sequence into overlapping, fixed-length subsequences:" +{ $subsection clumps } +{ $subsection } +{ $subsection } +"The difference can be summarized as the following:" +{ $list + { "With groups, the subsequences form the original sequence when concatenated:" + { $unchecked-example "dup n groups concat sequence= ." "t" } + } + { "With clumps, collecting the first element of each subsequence but the last one, together with the last subseqence, yields the original sequence:" + { $unchecked-example "dup n clumps unclip-last >r [ first ] map r> append sequence= ." "t" } + } +} ; + +ABOUT: "grouping" + +HELP: groups +{ $class-description "Instances are virtual sequences whose elements are disjoint fixed-length subsequences of an underlying sequence. Groups are mutable and resizable if the underlying sequence is mutable and resizable, respectively." +$nl +"New groups are created by calling " { $link } " and " { $link } "." } +{ $see-also group } ; + +HELP: group +{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "array" "a sequence of sequences" } } +{ $description "Splits the sequence into disjoint groups of " { $snippet "n" } " elements and collects the groups into a new array." } +{ $notes "If the sequence length is not a multiple of " { $snippet "n" } ", the final subsequence in the list will be shorter than " { $snippet "n" } " elements." } +{ $examples + { $example "USING: splitting prettyprint ;" "{ 3 1 3 3 7 } 2 group ." "{ { 3 1 } { 3 3 } { 7 } }" } +} ; + +HELP: +{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "groups" groups } } +{ $description "Outputs a virtual sequence whose elements are disjoint subsequences of " { $snippet "n" } " elements from the underlying sequence." } +{ $examples + { $example + "USING: arrays kernel prettyprint sequences splitting ;" + "9 >array 3 dup reverse-here concat >array ." "{ 6 7 8 3 4 5 0 1 2 }" + } +} ; + +HELP: +{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "groups" groups } } +{ $description "Outputs a virtual sequence whose elements are overlapping subsequences of " { $snippet "n" } " elements from the underlying sequence." } +{ $examples + { $example + "USING: arrays kernel prettyprint sequences splitting ;" + "9 >array 3 " + "dup [ reverse-here ] each concat >array ." + "{ 2 1 0 5 4 3 8 7 6 }" + } +} ; + +HELP: clumps +{ $class-description "Instances are virtual sequences whose elements are overlapping fixed-length subsequences o an underlying sequence. Clumps are mutable and resizable if the underlying sequence is mutable and resizable, respectively." +$nl +"New clumps are created by calling " { $link } " and " { $link } "." } ; + +HELP: clump +{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "array" "a sequence of sequences" } } +{ $description "Splits the sequence into overlapping clumps of " { $snippet "n" } " elements and collects the clumps into a new array." } +{ $errors "Throws an error if " { $snippet "n" } " is smaller than the length of the sequence." } +{ $examples + { $example "USING: splitting prettyprint ;" "{ 3 1 3 3 7 } 2 clump ." "{ { 3 1 } { 1 3 } { 3 3 } { 3 7 } }" } +} ; + +HELP: +{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "clumps" clumps } } +{ $description "Outputs a virtual sequence whose elements are overlapping subsequences of " { $snippet "n" } " elements from the underlying sequence." } +{ $examples + "Running averages:" + { $example + "USING: splitting sequences math prettyprint kernel ;" + "IN: scratchpad" + ": share-price" + " { 13/50 51/100 13/50 1/10 4/5 17/20 33/50 3/25 19/100 3/100 } ;" + "" + "share-price 4 [ [ sum ] [ length ] bi / ] map ." + "{ 113/400 167/400 201/400 241/400 243/400 91/200 1/4 }" + } +} ; + +HELP: +{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "clumps" clumps } } +{ $description "Outputs a virtual sequence whose elements are overlapping slices of " { $snippet "n" } " elements from the underlying sequence." } ; + +{ clumps groups } related-words + +{ clump group } related-words + +{ } related-words + +{ } related-words diff --git a/core/grouping/grouping-tests.factor b/core/grouping/grouping-tests.factor new file mode 100644 index 0000000000..dcf62e1117 --- /dev/null +++ b/core/grouping/grouping-tests.factor @@ -0,0 +1,12 @@ +USING: grouping tools.test kernel sequences arrays ; +IN: grouping.tests + +[ { 1 2 3 } 0 group ] must-fail + +[ { "hell" "o wo" "rld" } ] [ "hello world" 4 group ] unit-test + +[ { V{ "a" "b" } V{ f f } } ] [ + V{ "a" "b" } clone 2 + 2 over set-length + >array +] unit-test diff --git a/core/grouping/grouping.factor b/core/grouping/grouping.factor new file mode 100644 index 0000000000..c12d43160c --- /dev/null +++ b/core/grouping/grouping.factor @@ -0,0 +1,68 @@ +! Copyright (C) 2005, 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: kernel math math.order strings arrays vectors sequences +accessors ; +IN: grouping + +TUPLE: abstract-groups seq n ; + +: check-groups dup 0 <= [ "Invalid group count" throw ] when ; inline + +: new-groups ( seq n class -- groups ) + >r check-groups r> boa ; inline + +GENERIC: group@ ( n groups -- from to seq ) + +M: abstract-groups nth group@ subseq ; + +M: abstract-groups set-nth group@ 0 swap copy ; + +M: abstract-groups like drop { } like ; + +INSTANCE: abstract-groups sequence + +TUPLE: groups < abstract-groups ; + +: ( seq n -- groups ) + groups new-groups ; inline + +M: groups length + [ seq>> length ] [ n>> ] bi [ + 1- ] keep /i ; + +M: groups set-length + [ n>> * ] [ seq>> ] bi set-length ; + +M: groups group@ + [ n>> [ * dup ] keep + ] [ seq>> ] bi [ length min ] keep ; + +TUPLE: sliced-groups < groups ; + +: ( seq n -- groups ) + sliced-groups new-groups ; inline + +M: sliced-groups nth group@ ; + +TUPLE: clumps < abstract-groups ; + +: ( seq n -- clumps ) + clumps new-groups ; inline + +M: clumps length + [ seq>> length ] [ n>> ] bi - 1+ ; + +M: clumps set-length + [ n>> + 1- ] [ seq>> ] bi set-length ; + +M: clumps group@ + [ n>> over + ] [ seq>> ] bi ; + +TUPLE: sliced-clumps < groups ; + +: ( seq n -- clumps ) + sliced-clumps new-groups ; inline + +M: sliced-clumps nth group@ ; + +: group ( seq n -- array ) { } like ; + +: clump ( seq n -- array ) { } like ; diff --git a/core/grouping/summary.txt b/core/grouping/summary.txt new file mode 100644 index 0000000000..3695129a07 --- /dev/null +++ b/core/grouping/summary.txt @@ -0,0 +1 @@ +Grouping sequence elements into subsequences diff --git a/core/grouping/tags.txt b/core/grouping/tags.txt new file mode 100644 index 0000000000..42d711b32b --- /dev/null +++ b/core/grouping/tags.txt @@ -0,0 +1 @@ +collections diff --git a/core/hashtables/hashtables-docs.factor b/core/hashtables/hashtables-docs.factor index aff59ee8a5..e3b21e629e 100755 --- a/core/hashtables/hashtables-docs.factor +++ b/core/hashtables/hashtables-docs.factor @@ -10,9 +10,7 @@ $nl $nl "The " { $link hash-count } " slot is the number of entries including deleted entries, and " { $link hash-deleted } " is the number of deleted entries." { $subsection } -{ $subsection nth-pair } { $subsection set-nth-pair } -{ $subsection find-pair } "If a hashtable's keys are mutated, or if hashing algorithms change, hashtables can be rehashed:" { $subsection rehash } ; @@ -74,24 +72,12 @@ HELP: new-key@ { $values { "key" "a key" } { "hash" hashtable } { "array" "the underlying array of the hashtable" } { "n" "the index where the key would be stored" } { "empty?" "a boolean indicating whether the location is currently empty" } } { $description "Searches the hashtable for the key using a linear probing strategy. If the key is not present in the hashtable, outputs the index where it should be stored." } ; -HELP: nth-pair -{ $values { "n" "an index in the sequence" } { "seq" "a sequence" } { "key" "the first element of the pair" } { "value" "the second element of the pair" } } -{ $description "Fetches the elements with index " { $snippet "n" } " and " { $snippet "n+1" } ", respectively." } -{ $warning "This word is in the " { $vocab-link "hashtables.private" } " vocabulary because it does not perform bounds checks." } ; - -{ nth-pair set-nth-pair } related-words - HELP: set-nth-pair { $values { "value" "the second element of the pair" } { "key" "the first element of the pair" } { "seq" "a sequence" } { "n" "an index in the sequence" } } { $description "Stores a pair of values into the elements with index " { $snippet "n" } " and " { $snippet "n+1" } ", respectively." } { $warning "This word is in the " { $vocab-link "hashtables.private" } " vocabulary because it does not perform bounds checks." } { $side-effects "seq" } ; -HELP: find-pair -{ $values { "array" "an array of pairs" } { "quot" "a quotation with stack effect " { $snippet "( key value -- ? )" } } { "key" "the successful key" } { "value" "the successful value" } { "?" "a boolean of whether there was success" } } -{ $description "Applies a quotation to successive pairs in the array, yielding the first successful pair." } -{ $warning "This word is in the " { $vocab-link "hashtables.private" } " vocabulary because passing an array of odd length can lead to memory corruption." } ; - HELP: reset-hash { $values { "n" "a positive integer specifying hashtable capacity" } { "hash" hashtable } } { $description "Resets the underlying array of the hashtable to a new array with the given capacity. Removes all entries from the hashtable." } diff --git a/core/hashtables/hashtables-tests.factor b/core/hashtables/hashtables-tests.factor index f4e76aa68e..4e80ed1f6e 100755 --- a/core/hashtables/hashtables-tests.factor +++ b/core/hashtables/hashtables-tests.factor @@ -10,7 +10,7 @@ continuations ; [ ] [ 1000 [ dup sq ] H{ } map>assoc "testhash" set ] unit-test [ V{ } ] -[ 1000 [ dup sq swap "testhash" get at = not ] subset ] +[ 1000 [ dup sq swap "testhash" get at = not ] filter ] unit-test [ t ] diff --git a/core/hashtables/hashtables.factor b/core/hashtables/hashtables.factor index ea2f67255c..a1dba07fb0 100755 --- a/core/hashtables/hashtables.factor +++ b/core/hashtables/hashtables.factor @@ -1,7 +1,7 @@ -! Copyright (C) 2005, 2007 Slava Pestov. +! Copyright (C) 2005, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: arrays kernel kernel.private slots.private math assocs - math.private sequences sequences.private vectors ; +math.private sequences sequences.private vectors grouping ; IN: hashtables r 2 fixnum+fast r> ; inline - -: (find-pair) ( quot i array -- key value ? ) - 2dup array-capacity eq? [ - 3drop f f f - ] [ - 2dup array-nth tombstone? [ - find-pair-next (find-pair) - ] [ - [ nth-pair rot call ] 3keep roll [ - nth-pair >r nip r> t - ] [ - find-pair-next (find-pair) - ] if - ] if - ] if ; inline - -: find-pair ( array quot -- key value ? ) - 0 rot (find-pair) ; inline - -: (rehash) ( hash array -- ) - [ swap pick (set-hash) drop f ] find-pair 2drop 2drop ; +: (rehash) ( hash alist -- ) + swap [ swapd (set-hash) drop ] curry assoc-each ; : hash-large? ( hash -- ? ) [ hash-count 3 fixnum*fast ] @@ -98,7 +74,7 @@ IN: hashtables [ hash-deleted 10 fixnum*fast ] [ hash-count ] bi fixnum> ; : grow-hash ( hash -- ) - [ dup hash-array swap assoc-size 1+ ] keep + [ dup >alist swap assoc-size 1+ ] keep [ reset-hash ] keep swap (rehash) ; @@ -136,8 +112,8 @@ M: hashtable assoc-size ( hash -- n ) dup hash-count swap hash-deleted - ; : rehash ( hash -- ) - dup hash-array - dup length ((empty)) pick set-hash-array + dup >alist + over hash-array length ((empty)) pick set-hash-array 0 pick set-hash-count 0 pick set-hash-deleted (rehash) ; @@ -148,8 +124,8 @@ M: hashtable set-at ( value key hash -- ) : associate ( value key -- hash ) 2 [ set-at ] keep ; -M: hashtable assoc-find ( hash quot -- key value ? ) - >r hash-array r> find-pair ; +M: hashtable >alist + hash-array 2 [ first tombstone? not ] filter ; M: hashtable clone (clone) dup hash-array clone over set-hash-array ; diff --git a/core/heaps/heaps-docs.factor b/core/heaps/heaps-docs.factor index f9224eafeb..d1003ac2f8 100755 --- a/core/heaps/heaps-docs.factor +++ b/core/heaps/heaps-docs.factor @@ -1,4 +1,5 @@ -USING: heaps.private help.markup help.syntax kernel math assocs ; +USING: heaps.private help.markup help.syntax kernel math assocs +math.order ; IN: heaps ARTICLE: "heaps" "Heaps" diff --git a/core/heaps/heaps-tests.factor b/core/heaps/heaps-tests.factor index b22d8818c1..d55b547b8f 100755 --- a/core/heaps/heaps-tests.factor +++ b/core/heaps/heaps-tests.factor @@ -3,7 +3,7 @@ USING: arrays kernel math namespaces tools.test heaps heaps.private math.parser random assocs sequences sorting -accessors ; +accessors math.order ; IN: heaps.tests [ heap-pop ] must-fail diff --git a/core/heaps/heaps.factor b/core/heaps/heaps.factor index 02a8b8d88b..57f0e0ac72 100755 --- a/core/heaps/heaps.factor +++ b/core/heaps/heaps.factor @@ -2,7 +2,7 @@ ! Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel math sequences arrays assocs sequences.private -growable accessors ; +growable accessors math.order ; IN: heaps MIXIN: priority-queue @@ -92,11 +92,11 @@ M: priority-queue heap-size ( heap -- n ) GENERIC: heap-compare ( pair1 pair2 heap -- ? ) -: (heap-compare) drop [ entry-key ] compare 0 ; inline +: (heap-compare) drop [ entry-key ] compare ; inline -M: min-heap heap-compare (heap-compare) > ; +M: min-heap heap-compare (heap-compare) +gt+ eq? ; -M: max-heap heap-compare (heap-compare) < ; +M: max-heap heap-compare (heap-compare) +lt+ eq? ; : heap-bounds-check? ( m heap -- ? ) heap-size >= ; inline diff --git a/core/inference/backend/backend-docs.factor b/core/inference/backend/backend-docs.factor index 91314d1312..2fd867f442 100755 --- a/core/inference/backend/backend-docs.factor +++ b/core/inference/backend/backend-docs.factor @@ -43,9 +43,9 @@ HELP: consume/produce { $values { "node" "a dataflow node" } { "effect" "an instance of " { $link effect } } } { $description "Adds a node to the dataflow graph that calls " { $snippet "word" } " with a stack effect of " { $snippet "effect" } "." } ; -HELP: no-effect +HELP: cannot-infer-effect { $values { "word" word } } -{ $description "Throws a " { $link no-effect } " error." } +{ $description "Throws a " { $link cannot-infer-effect } " error." } { $error-description "Thrown when inference encounters a call to a word which is already known not to have a static stack effect, due to a prior inference attempt failing." } ; HELP: inline-word @@ -61,8 +61,8 @@ HELP: effect-error { $description "Throws an " { $link effect-error } "." } { $error-description "Thrown when a word's inferred stack effect does not match its declared stack effect." } ; -HELP: recursive-declare-error -{ $error-description "Thrown when inference encounters a recursive call to a word lacking a stack effect declaration. Recursive words must declare a stack effect in order to compile. Due to implementation detail, generic words are recursive, and thus the same restriction applies." } ; +HELP: missing-effect +{ $error-description "Thrown when inference encounters a word lacking a stack effect declaration. Stack effects of words must be declared, with the exception of words which only push literals on the stack." } ; HELP: recursive-quotation-error { $error-description "Thrown when a quotation calls itself, directly or indirectly, within the same word. Stack effect inference becomes equivalent to the halting problem if quotation recursion has to be taken into account, hence it is not permitted." } diff --git a/core/inference/backend/backend.factor b/core/inference/backend/backend.factor index f60748a5ac..080e77af02 100755 --- a/core/inference/backend/backend.factor +++ b/core/inference/backend/backend.factor @@ -4,7 +4,7 @@ USING: inference.dataflow inference.state arrays generic io io.streams.string kernel math namespaces parser prettyprint sequences strings vectors words quotations effects classes continuations debugger assocs combinators compiler.errors -generic.standard.engines.tuple accessors ; +generic.standard.engines.tuple accessors math.order definitions ; IN: inference.backend : recursive-label ( word -- label/f ) @@ -21,6 +21,28 @@ M: engine-word inline? M: word inline? "inline" word-prop ; +SYMBOL: visited + +: reset-on-redefine { "inferred-effect" "cannot-infer" } ; inline + +: (redefined) ( word -- ) + dup visited get key? [ drop ] [ + [ reset-on-redefine reset-props ] + [ dup visited get set-at ] + [ + crossref get at keys + [ word? ] filter + [ + [ reset-on-redefine [ word-prop ] with contains? ] + [ inline? ] + bi or + ] filter + [ (redefined) ] each + ] tri + ] if ; + +M: word redefined H{ } clone visited [ (redefined) ] with-variable ; + : local-recursive-state ( -- assoc ) recursive-state get dup keys [ dup word? [ inline? ] when not ] find drop @@ -60,7 +82,7 @@ M: object value-literal \ literal-expected inference-warning ; : value-vector ( n -- vector ) [ drop ] V{ } map-as ; : add-inputs ( seq stack -- n stack ) - tuck [ length ] compare dup 0 > + tuck [ length ] bi@ - dup 0 > [ dup value-vector [ swapd push-all ] keep ] [ drop 0 swap ] if ; @@ -68,8 +90,9 @@ M: object value-literal \ literal-expected inference-warning ; meta-d [ add-inputs ] change d-in [ + ] change ; : current-effect ( -- effect ) - d-in get meta-d get length - terminated? get over set-effect-terminated? ; + d-in get + meta-d get length + terminated? get >>terminated? ; : init-inference ( -- ) terminated? off @@ -93,13 +116,13 @@ M: wrapper apply-object terminated? on #terminate node, ; : infer-quot ( quot rstate -- ) - recursive-state get >r - recursive-state set - [ apply-object terminated? get not ] all? drop - r> recursive-state set ; + recursive-state get [ + recursive-state set + [ apply-object terminated? get not ] all? drop + ] dip recursive-state set ; : infer-quot-recursive ( quot word label -- ) - recursive-state get -rot 2array prefix infer-quot ; + 2array recursive-state get swap prefix infer-quot ; : time-bomb ( error -- ) [ throw ] curry recursive-state get infer-quot ; @@ -114,9 +137,9 @@ TUPLE: recursive-quotation-error quot ; value-literal recursive-quotation-error inference-error ] [ dup value-literal callable? [ - dup value-literal - over value-recursion - rot f 2array prefix infer-quot + [ value-literal ] + [ [ value-recursion ] keep f 2array prefix ] + bi infer-quot ] [ drop bad-call ] if @@ -169,26 +192,26 @@ TUPLE: too-many-r> ; meta-d get push-all ; : if-inline ( word true false -- ) - >r >r dup inline? r> r> if ; inline + [ dup inline? ] 2dip if ; inline : consume/produce ( effect node -- ) - over effect-in over consume-values - over effect-out over produce-values - node, - effect-terminated? [ terminate ] when ; + [ [ in>> ] dip consume-values ] + [ [ out>> ] dip produce-values ] + [ node, terminated?>> [ terminate ] when ] + 2tri ; GENERIC: constructor ( value -- word/f ) GENERIC: infer-uncurry ( value -- ) M: curried infer-uncurry - drop pop-d dup curried-obj push-d curried-quot push-d ; + drop pop-d [ obj>> push-d ] [ quot>> push-d ] bi ; M: curried constructor drop \ curry ; M: composed infer-uncurry - drop pop-d dup composed-quot1 push-d composed-quot2 push-d ; + drop pop-d [ quot1>> push-d ] [ quot2>> push-d ] bi ; M: composed constructor drop \ compose ; @@ -233,13 +256,13 @@ M: object constructor drop f ; DEFER: unify-values : unify-curries ( seq -- value ) - dup [ curried-obj ] map unify-values - swap [ curried-quot ] map unify-values + [ [ obj>> ] map unify-values ] + [ [ quot>> ] map unify-values ] bi ; : unify-composed ( seq -- value ) - dup [ composed-quot1 ] map unify-values - swap [ composed-quot2 ] map unify-values + [ [ quot1>> ] map unify-values ] + [ [ quot2>> ] map unify-values ] bi ; TUPLE: cannot-unify-specials ; @@ -261,7 +284,7 @@ TUPLE: cannot-unify-specials ; : balanced? ( in out -- ? ) [ dup [ length - ] [ 2drop f ] if ] 2map - [ ] subset all-equal? ; + sift all-equal? ; TUPLE: unbalanced-branches-error quots in out ; @@ -270,7 +293,7 @@ TUPLE: unbalanced-branches-error quots in out ; : unify-inputs ( max-d-in d-in meta-d -- meta-d ) dup [ - [ >r - r> length + ] keep add-inputs nip + [ [ - ] dip length + ] keep add-inputs nip ] [ 2nip ] if ; @@ -281,7 +304,7 @@ TUPLE: unbalanced-branches-error quots in out ; 2dup balanced? [ over supremum -rot [ >r dupd r> unify-inputs ] 2map - [ ] subset unify-stacks + sift unify-stacks rot drop ] [ unbalanced-branches-error @@ -296,21 +319,24 @@ TUPLE: unbalanced-branches-error quots in out ; [ swap at ] curry map ; : datastack-effect ( seq -- ) - dup quotation branch-variable - over d-in branch-variable - rot meta-d active-variable - unify-effect meta-d set d-in set ; + [ quotation branch-variable ] + [ d-in branch-variable ] + [ meta-d active-variable ] tri + unify-effect + [ d-in set ] [ meta-d set ] bi* ; : retainstack-effect ( seq -- ) - dup quotation branch-variable - over length 0 - rot meta-r active-variable - unify-effect meta-r set drop ; + [ quotation branch-variable ] + [ length 0 ] + [ meta-r active-variable ] tri + unify-effect + [ drop ] [ meta-r set ] bi* ; : unify-effects ( seq -- ) - dup datastack-effect - dup retainstack-effect - [ terminated? swap at ] all? terminated? set ; + [ datastack-effect ] + [ retainstack-effect ] + [ [ terminated? swap at ] all? terminated? set ] + tri ; : unify-dataflow ( effects -- nodes ) dataflow-graph branch-variable ; @@ -325,14 +351,17 @@ TUPLE: unbalanced-branches-error quots in out ; : infer-branch ( last value -- namespace ) [ copy-inference - dup value-literal quotation set - infer-quot-value + + [ value-literal quotation set ] + [ infer-quot-value ] + bi + terminated? get [ drop ] [ call node, ] if ] H{ } make-assoc ; inline : (infer-branches) ( last branches -- list ) [ infer-branch ] with map - dup unify-effects unify-dataflow ; inline + [ unify-effects ] [ unify-dataflow ] bi ; inline : infer-branches ( last branches node -- ) #! last is a quotation which provides a #return or a #values @@ -353,24 +382,43 @@ TUPLE: unbalanced-branches-error quots in out ; #call consume/produce ] if ; -TUPLE: no-effect word ; +TUPLE: cannot-infer-effect word ; -: no-effect ( word -- * ) \ no-effect inference-warning ; +: cannot-infer-effect ( word -- * ) + \ cannot-infer-effect inference-warning ; -TUPLE: effect-error word effect ; +TUPLE: effect-error word inferred declared ; -: effect-error ( word effect -- * ) +: effect-error ( word inferred declared -- * ) \ effect-error inference-error ; +TUPLE: missing-effect word ; + +: effect-required? ( word -- ? ) + { + { [ dup inline? ] [ drop f ] } + { [ dup deferred? ] [ drop f ] } + { [ dup crossref? not ] [ drop f ] } + [ word-def [ [ word? ] [ primitive? not ] bi and ] contains? ] + } cond ; + +: ?missing-effect ( word -- ) + dup effect-required? + [ missing-effect inference-error ] [ drop ] if ; + : check-effect ( word effect -- ) - dup pick stack-effect effect<= - [ 2drop ] [ effect-error ] if ; + over stack-effect { + { [ dup not ] [ 2drop ?missing-effect ] } + { [ 2dup effect<= ] [ 3drop ] } + [ effect-error ] + } cond ; : finish-word ( word -- ) current-effect - 2dup check-effect - over recorded get push - "inferred-effect" set-word-prop ; + [ check-effect ] + [ drop recorded get push ] + [ "inferred-effect" set-word-prop ] + 2tri ; : infer-word ( word -- effect ) [ @@ -382,12 +430,11 @@ TUPLE: effect-error word effect ; finish-word current-effect ] with-scope - ] [ ] [ t "no-effect" set-word-prop ] cleanup ; + ] [ ] [ t "cannot-infer" set-word-prop ] cleanup ; : custom-infer ( word -- ) #! Customized inference behavior - dup +inlined+ depends-on - "infer" word-prop call ; + [ +inlined+ depends-on ] [ "infer" word-prop call ] bi ; : cached-infer ( word -- ) dup "inferred-effect" word-prop make-call-node ; @@ -395,18 +442,16 @@ TUPLE: effect-error word effect ; : apply-word ( word -- ) { { [ dup "infer" word-prop ] [ custom-infer ] } - { [ dup "no-effect" word-prop ] [ no-effect ] } + { [ dup "cannot-infer" word-prop ] [ cannot-infer-effect ] } { [ dup "inferred-effect" word-prop ] [ cached-infer ] } [ dup infer-word make-call-node ] } cond ; -TUPLE: recursive-declare-error word ; - -: declared-infer ( word -- ) +: declared-infer ( word -- ) dup stack-effect [ make-call-node ] [ - \ recursive-declare-error inference-error + \ missing-effect inference-error ] if* ; GENERIC: collect-label-info* ( label node -- ) @@ -434,47 +479,67 @@ M: #return collect-label-info* dup node-param #return node, dataflow-graph get 1array over set-node-children ; -: inlined-block? "inlined-block" word-prop ; +: inlined-block? ( word -- ? ) + "inlined-block" word-prop ; -: gensym dup t "inlined-block" set-word-prop ; +: ( -- word ) + gensym dup t "inlined-block" set-word-prop ; : inline-block ( word -- #label data ) [ copy-inference nest-node - dup word-def swap + [ word-def ] [ ] bi [ infer-quot-recursive ] 2keep #label unnest-node dup collect-label-info ] H{ } make-assoc ; : join-values ( #label -- ) - calls>> [ node-in-d ] map meta-d get suffix + calls>> [ in-d>> ] map meta-d get suffix unify-lengths unify-stacks meta-d [ length tail* ] change ; : splice-node ( node -- ) - dup node-successor [ - dup node, penultimate-node f over set-node-successor - dup current-node set - ] when drop ; + dup successor>> [ + [ node, ] [ penultimate-node ] bi + f >>successor + current-node set + ] [ drop ] if ; -: apply-infer ( hash -- ) - { meta-d meta-r d-in terminated? } - [ swap [ at ] curry map ] keep - [ set ] 2each ; +: apply-infer ( data -- ) + { meta-d meta-r d-in terminated? } swap extract-keys + namespace swap update ; + +: current-stack-height ( -- n ) + d-in get meta-d get length - ; + +: word-stack-height ( word -- n ) + stack-effect effect-height ; + +: bad-recursive-declaration ( word inferred -- ) + dup 0 < [ 0 swap ] [ 0 ] if + over stack-effect + effect-error ; + +: check-stack-height ( word height -- ) + over word-stack-height over = + [ 2drop ] [ bad-recursive-declaration ] if ; + +: inline-recursive-word ( word #label -- ) + current-stack-height [ + flatten-meta-d [ join-values inline-block apply-infer ] dip >>in-d + [ node, ] + [ calls>> [ [ flatten-curries ] modify-values ] each ] + [ word>> ] + tri + ] dip + current-stack-height - + check-stack-height ; : inline-word ( word -- ) - dup inline-block over recursive-label? [ - flatten-meta-d >r - drop join-values inline-block apply-infer - r> over set-node-in-d - dup node, - calls>> [ - [ flatten-curries ] modify-values - ] each - ] [ - apply-infer node-child node-successor splice-node drop - ] if ; + dup inline-block over recursive-label? + [ drop inline-recursive-word ] + [ apply-infer node-child successor>> splice-node drop ] if ; M: word apply-object [ diff --git a/core/inference/class/class-tests.factor b/core/inference/class/class-tests.factor index 0c4ff82798..770763bfb6 100755 --- a/core/inference/class/class-tests.factor +++ b/core/inference/class/class-tests.factor @@ -5,7 +5,7 @@ sequences words inference.class quotations alien alien.c-types strings sbufs sequences.private slots.private combinators definitions compiler.units system layouts vectors optimizer.math.partial accessors -optimizer.inlining ; +optimizer.inlining math.order ; [ t ] [ T{ literal-constraint f 1 2 } T{ literal-constraint f 1 2 } equal? ] unit-test @@ -142,7 +142,7 @@ M: object xyz ; [ f ] [ [ length ] \ slot inlined? ] unit-test ! We don't want to use = to compare literals -: foo reverse ; +: foo ( seq -- seq' ) reverse ; \ foo [ [ diff --git a/core/inference/class/class.factor b/core/inference/class/class.factor index 6d5b708f34..2f7058ba96 100755 --- a/core/inference/class/class.factor +++ b/core/inference/class/class.factor @@ -41,11 +41,11 @@ C: interval-constraint GENERIC: apply-constraint ( constraint -- ) GENERIC: constraint-satisfied? ( constraint -- ? ) -: `input node get in-d>> nth ; -: `output node get out-d>> nth ; -: class, , ; -: literal, , ; -: interval, , ; +: `input ( n -- value ) node get in-d>> nth ; +: `output ( n -- value ) node get out-d>> nth ; +: class, ( class value -- ) , ; +: literal, ( literal value -- ) , ; +: interval, ( interval value -- ) , ; M: f apply-constraint drop ; @@ -143,7 +143,7 @@ M: literal-constraint constraint-satisfied? [ swap literal>> eql? ] [ 2drop f ] if ; M: class-constraint constraint-satisfied? - [ value>> value-class* ] [ class>> ] bi class< ; + [ value>> value-class* ] [ class>> ] bi class<= ; M: pair apply-constraint first2 2dup constraints get set-at @@ -152,16 +152,16 @@ M: pair apply-constraint M: pair constraint-satisfied? first constraint-satisfied? ; -: extract-keys ( seq assoc -- newassoc ) - [ dupd at ] curry H{ } map>assoc [ nip ] assoc-subset f assoc-like ; +: valid-keys ( seq assoc -- newassoc ) + extract-keys [ nip ] assoc-filter f assoc-like ; : annotate-node ( node -- ) #! Annotate the node with the currently-inferred set of #! value classes. dup node-values { - [ value-intervals get extract-keys >>intervals ] - [ value-classes get extract-keys >>classes ] - [ value-literals get extract-keys >>literals ] + [ value-intervals get valid-keys >>intervals ] + [ value-classes get valid-keys >>classes ] + [ value-literals get valid-keys >>literals ] [ 2drop ] } cleave ; @@ -330,7 +330,7 @@ M: #return infer-classes-around [ ] [ node-input-classes ] [ in-d>> [ value-class* ] map ] tri classes= not [ fixed-point? off - [ in-d>> value-classes get extract-keys ] keep + [ in-d>> value-classes get valid-keys ] keep set-node-classes ] [ drop ] if ] [ call-next-method ] if diff --git a/core/inference/dataflow/dataflow.factor b/core/inference/dataflow/dataflow.factor index bb66a5386c..734c1c551c 100755 --- a/core/inference/dataflow/dataflow.factor +++ b/core/inference/dataflow/dataflow.factor @@ -6,7 +6,7 @@ inference.state accessors combinators ; IN: inference.dataflow ! Computed value -: \ counter ; +: ( -- value ) \ counter ; ! Literal value TUPLE: value < identity-tuple literal uid recursion ; @@ -88,7 +88,7 @@ M: object flatten-curry , ; : r-tail ( n -- seq ) dup zero? [ drop f ] [ meta-r get swap tail* ] if ; -: node-child node-children first ; +: node-child ( node -- child ) node-children first ; TUPLE: #label < node word loop? returns calls ; @@ -217,9 +217,9 @@ M: #call-label calls-label* param>> eq? ; SYMBOL: node-stack -: >node node-stack get push ; -: node> node-stack get pop ; -: node@ node-stack get peek ; +: >node ( node -- ) node-stack get push ; +: node> ( -- node ) node-stack get pop ; +: node@ ( -- node ) node-stack get peek ; : iterate-next ( -- node ) node@ successor>> ; @@ -300,7 +300,7 @@ SYMBOL: node-stack dup in-d>> first node-class ; : active-children ( node -- seq ) - children>> [ last-node ] map [ #terminate? not ] subset ; + children>> [ last-node ] map [ #terminate? not ] filter ; DEFER: #tail? diff --git a/core/inference/errors/errors.factor b/core/inference/errors/errors.factor index f565420cac..4a75040243 100644 --- a/core/inference/errors/errors.factor +++ b/core/inference/errors/errors.factor @@ -5,20 +5,18 @@ USING: inference.backend inference.dataflow kernel generic sequences prettyprint io words arrays inspector effects debugger assocs accessors ; +M: inference-error error-help error>> error-help ; + M: inference-error error. dup rstate>> keys [ dup value? [ value-literal ] when ] map dup empty? [ "Word: " write dup peek . ] unless swap error>> error. "Nesting: " write . ; -M: inference-error error-help drop f ; - M: unbalanced-branches-error error. "Unbalanced branches:" print - dup unbalanced-branches-error-quots - over unbalanced-branches-error-in - rot unbalanced-branches-error-out [ length ] map - 3array flip [ [ bl ] [ pprint ] interleave nl ] each ; + [ quots>> ] [ in>> ] [ out>> [ length ] map ] tri 3array flip + [ [ bl ] [ pprint ] interleave nl ] each ; M: literal-expected summary drop "Literal value expected" ; @@ -31,25 +29,23 @@ M: too-many-r> summary drop "Quotation pops retain stack elements which it did not push" ; -M: no-effect error. - "Unable to infer stack effect of " write no-effect-word . ; +M: cannot-infer-effect error. + "Unable to infer stack effect of " write word>> . ; -M: recursive-declare-error error. - "The recursive word " write - recursive-declare-error-word pprint +M: missing-effect error. + "The word " write + word>> pprint " must declare a stack effect" print ; M: effect-error error. "Stack effects of the word " write - dup effect-error-word pprint - " do not match." print - "Declared: " write - dup effect-error-word stack-effect effect>string . - "Inferred: " write effect-error-effect effect>string . ; + [ word>> pprint " do not match." print ] + [ "Inferred: " write inferred>> effect>string . ] + [ "Declared: " write declared>> effect>string . ] tri ; M: recursive-quotation-error error. "The quotation " write - recursive-quotation-error-quot pprint + quot>> pprint " calls itself." print "Stack effect inference is undecidable when quotation-level recursion is permitted." print ; diff --git a/core/inference/inference-docs.factor b/core/inference/inference-docs.factor index e32c94ed37..5900e5a844 100755 --- a/core/inference/inference-docs.factor +++ b/core/inference/inference-docs.factor @@ -83,13 +83,13 @@ ARTICLE: "inference-errors" "Inference errors" "Main wrapper for all inference errors:" { $subsection inference-error } "Specific inference errors:" -{ $subsection no-effect } +{ $subsection cannot-infer-effect } { $subsection literal-expected } { $subsection too-many->r } { $subsection too-many-r> } { $subsection unbalanced-branches-error } { $subsection effect-error } -{ $subsection recursive-declare-error } ; +{ $subsection missing-effect } ; ARTICLE: "inference" "Stack effect inference" "The stack effect inference tool is used to check correctness of code before it is run. It is also used by the compiler to build a dataflow graph on which optimizations can be performed. Only words for which a stack effect can be inferred will compile." @@ -108,7 +108,8 @@ $nl { $subsection "inference-limitations" } { $subsection "inference-errors" } { $subsection "dataflow-graphs" } -{ $subsection "compiler-transforms" } ; +{ $subsection "compiler-transforms" } +{ $see-also "effects" } ; ABOUT: "inference" @@ -135,7 +136,7 @@ HELP: infer HELP: infer. { $values { "quot" "a quotation" } } -{ $description "Attempts to infer the quotation's stack effect, and prints this data to the " { $link stdio } " stream." } +{ $description "Attempts to infer the quotation's stack effect, and prints this data to " { $link output-stream } "." } { $errors "Throws an " { $link inference-error } " if stack effect inference fails." } ; { infer infer. } related-words diff --git a/core/inference/inference-tests.factor b/core/inference/inference-tests.factor index f688f60e56..7f073bfad9 100755 --- a/core/inference/inference-tests.factor +++ b/core/inference/inference-tests.factor @@ -5,7 +5,7 @@ sequences strings vectors words quotations effects tools.test continuations generic.standard sorting assocs definitions prettyprint io inspector classes.tuple classes.union classes.predicate debugger threads.private io.streams.string -io.timeouts io.thread sequences.private ; +io.timeouts io.thread sequences.private destructors ; IN: inference.tests [ ] [ [ 1 ] dataflow [ ] transform-nodes drop ] unit-test @@ -48,20 +48,12 @@ IN: inference.tests ] must-fail ! Test inference of termination of control flow -: termination-test-1 - "foo" throw ; +: termination-test-1 ( -- * ) "foo" throw ; -: termination-test-2 [ termination-test-1 ] [ 3 ] if ; +: termination-test-2 ( ? -- x ) [ termination-test-1 ] [ 3 ] if ; { 1 1 } [ termination-test-2 ] must-infer-as -: infinite-loop infinite-loop ; - -[ [ infinite-loop ] infer ] must-fail - -: no-base-case-1 dup [ no-base-case-1 ] [ no-base-case-1 ] if ; -[ [ no-base-case-1 ] infer ] must-fail - : simple-recursion-1 ( obj -- obj ) dup [ simple-recursion-1 ] [ ] if ; @@ -131,7 +123,7 @@ SYMBOL: sym-test { 0 1 } [ sym-test ] must-infer-as -: terminator-branch +: terminator-branch ( a -- b ) dup [ length ] [ @@ -198,11 +190,10 @@ DEFER: blah4 [ [ [ 1 ] [ ] bad-combinator ] infer ] must-fail ! Regression -: bad-input# +{ 2 2 } [ dup string? [ 2array throw ] unless - over string? [ 2array throw ] unless ; - -{ 2 2 } [ bad-input# ] must-infer-as + over string? [ 2array throw ] unless +] must-infer-as ! Regression @@ -224,7 +215,7 @@ DEFER: do-crap* { 2 1 } [ too-deep ] must-infer-as ! Error reporting is wrong -MATH: xyz +MATH: xyz ( a b -- c ) M: fixnum xyz 2array ; M: float xyz [ 3 ] bi@ swapd >r 2array swap r> 2array swap ; @@ -448,7 +439,7 @@ DEFER: bar ! Incorrect stack declarations on inline recursive words should ! be caught : fooxxx ( a b -- c ) over [ foo ] when ; inline -: barxxx fooxxx ; +: barxxx ( a b -- c ) fooxxx ; [ [ barxxx ] infer ] must-fail @@ -472,9 +463,7 @@ M: string my-hook "a string" ; DEFER: deferred-word -: calls-deferred-word [ deferred-word ] [ 3 ] if ; - -{ 1 1 } [ calls-deferred-word ] must-infer-as +{ 1 1 } [ [ deferred-word ] [ 3 ] if ] must-infer-as USE: inference.dataflow @@ -547,3 +536,36 @@ ERROR: custom-error ; [ [ missing->r-check ] infer ] must-fail { 1 0 } [ [ ] map-children ] must-infer-as + +! Corner case +[ [ [ f dup ] [ dup ] [ ] unfold ] infer ] must-fail + +[ [ [ f dup ] [ ] [ ] while ] infer ] must-fail + +: erg's-inference-bug ( -- ) f dup [ erg's-inference-bug ] when ; inline + +[ [ erg's-inference-bug ] infer ] must-fail + +! : inference-invalidation-a ( -- ); +! : inference-invalidation-b ( quot -- ) [ inference-invalidation-a ] dip call ; inline +! : inference-invalidation-c ( a b -- c ) [ + ] inference-invalidation-b ; +! +! [ 7 ] [ 4 3 inference-invalidation-c ] unit-test +! +! { 2 1 } [ [ + ] inference-invalidation-b ] must-infer-as +! +! [ ] [ "IN: inference.tests : inference-invalidation-a 1 2 ;" eval ] unit-test +! +! [ 3 ] [ inference-invalidation-c ] unit-test +! +! { 0 1 } [ inference-invalidation-c ] must-infer-as +! +! GENERIC: inference-invalidation-d ( obj -- ) +! +! M: object inference-invalidation-d inference-invalidation-c 2drop ; +! +! \ inference-invalidation-d must-infer +! +! [ ] [ "IN: inference.tests : inference-invalidation-a ;" eval ] unit-test +! +! [ [ inference-invalidation-d ] infer ] must-fail diff --git a/core/inference/inference.factor b/core/inference/inference.factor index 3f52eaadf4..d73e43cdfc 100755 --- a/core/inference/inference.factor +++ b/core/inference/inference.factor @@ -29,6 +29,6 @@ M: callable dataflow-with : forget-errors ( -- ) all-words [ - dup subwords [ f "no-effect" set-word-prop ] each - f "no-effect" set-word-prop + dup subwords [ f "cannot-infer" set-word-prop ] each + f "cannot-infer" set-word-prop ] each ; diff --git a/core/inference/known-words/known-words.factor b/core/inference/known-words/known-words.factor index b68c98d25d..3282cbb5e2 100755 --- a/core/inference/known-words/known-words.factor +++ b/core/inference/known-words/known-words.factor @@ -356,13 +356,13 @@ M: object infer-call \ setenv { object fixnum } { } set-primitive-effect -\ exists? { string } { object } set-primitive-effect +\ (exists?) { string } { object } set-primitive-effect \ (directory) { string } { array } set-primitive-effect \ gc { } { } set-primitive-effect -\ gc-time { } { integer } set-primitive-effect +\ gc-stats { } { array } set-primitive-effect \ save-image { string } { } set-primitive-effect @@ -372,7 +372,7 @@ M: object infer-call t over set-effect-terminated? set-primitive-effect -\ data-room { } { integer array } set-primitive-effect +\ data-room { } { integer integer array } set-primitive-effect \ data-room make-flushable \ code-room { } { integer integer integer integer } set-primitive-effect @@ -583,7 +583,7 @@ set-primitive-effect \ (set-os-envs) { array } { } set-primitive-effect -\ do-primitive [ \ do-primitive no-effect ] "infer" set-word-prop +\ do-primitive [ \ do-primitive cannot-infer-effect ] "infer" set-word-prop \ dll-valid? { object } { object } set-primitive-effect diff --git a/core/inference/state/state-tests.factor b/core/inference/state/state-tests.factor index 84d72bdd9b..21f59bf020 100644 --- a/core/inference/state/state-tests.factor +++ b/core/inference/state/state-tests.factor @@ -1,5 +1,10 @@ IN: inference.state.tests -USING: tools.test inference.state words ; +USING: tools.test inference.state words kernel namespaces +definitions ; + +: computing-dependencies ( quot -- dependencies ) + H{ } clone [ dependencies rot with-variable ] keep ; + inline SYMBOL: a SYMBOL: b diff --git a/core/inference/state/state.factor b/core/inference/state/state.factor index a426f410e2..1d1ccaa2a9 100755 --- a/core/inference/state/state.factor +++ b/core/inference/state/state.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: assocs namespaces sequences kernel words ; +USING: assocs namespaces sequences kernel definitions ; IN: inference.state ! Nesting state to solve recursion @@ -12,16 +12,16 @@ SYMBOL: d-in ! Compile-time data stack SYMBOL: meta-d -: push-d meta-d get push ; -: pop-d meta-d get pop ; -: peek-d meta-d get peek ; +: push-d ( obj -- ) meta-d get push ; +: pop-d ( -- obj ) meta-d get pop ; +: peek-d ( -- obj ) meta-d get peek ; ! Compile-time retain stack SYMBOL: meta-r -: push-r meta-r get push ; -: pop-r meta-r get pop ; -: peek-r meta-r get peek ; +: push-r ( obj -- ) meta-r get push ; +: pop-r ( -- obj ) meta-r get pop ; +: peek-r ( -- obj ) meta-r get peek ; ! Head of dataflow IR SYMBOL: dataflow-graph @@ -36,10 +36,6 @@ SYMBOL: dependencies 2dup at +inlined+ eq? [ 3drop ] [ set-at ] if ] [ 3drop ] if ; -: computing-dependencies ( quot -- dependencies ) - H{ } clone [ dependencies rot with-variable ] keep ; - inline - ! Did the current control-flow path throw an error? SYMBOL: terminated? diff --git a/core/inference/transforms/transforms-tests.factor b/core/inference/transforms/transforms-tests.factor index a5b898315a..f90dd2350c 100755 --- a/core/inference/transforms/transforms-tests.factor +++ b/core/inference/transforms/transforms-tests.factor @@ -3,10 +3,10 @@ USING: sequences inference.transforms tools.test math kernel quotations inference accessors combinators words arrays classes ; -: compose-n-quot >quotation ; -: compose-n compose-n-quot call ; +: compose-n-quot ( word -- quot' ) >quotation ; +: compose-n ( quot -- ) compose-n-quot call ; \ compose-n [ compose-n-quot ] 2 define-transform -: compose-n-test 2 \ + compose-n ; +: compose-n-test ( a b c -- x ) 2 \ + compose-n ; [ 6 ] [ 1 2 3 compose-n-test ] unit-test @@ -20,25 +20,12 @@ classes ; [ 512 ] [ 1 { { 1+ 8 } } bitfield-quot call ] unit-test -\ new must-infer - -TUPLE: a-tuple x y z ; - -: set-slots-test ( x y z -- ) - { set-a-tuple-x set-a-tuple-y } set-slots ; - -\ set-slots-test must-infer - -: set-slots-test-2 - { set-a-tuple-x set-a-tuple-x } set-slots ; - -[ [ set-slots-test-2 ] infer ] must-fail - TUPLE: color r g b ; C: color -: cleave-test { [ r>> ] [ g>> ] [ b>> ] } cleave ; +: cleave-test ( color -- r g b ) + { [ r>> ] [ g>> ] [ b>> ] } cleave ; { 1 3 } [ cleave-test ] must-infer-as @@ -46,13 +33,13 @@ C: color [ 1 2 3 ] [ 1 2 3 \ cleave-test word-def call ] unit-test -: 2cleave-test { [ 2array ] [ + ] [ - ] } 2cleave ; +: 2cleave-test ( a b -- c d e ) { [ 2array ] [ + ] [ - ] } 2cleave ; [ { 1 2 } 3 -1 ] [ 1 2 2cleave-test ] unit-test [ { 1 2 } 3 -1 ] [ 1 2 \ 2cleave-test word-def call ] unit-test -: spread-test { [ sq ] [ neg ] [ recip ] } spread ; +: spread-test ( a b c -- d e f ) { [ sq ] [ neg ] [ recip ] } spread ; [ 16 -3 1/6 ] [ 4 3 6 spread-test ] unit-test diff --git a/core/inference/transforms/transforms.factor b/core/inference/transforms/transforms.factor index 624dcbbf98..5ca10c7545 100755 --- a/core/inference/transforms/transforms.factor +++ b/core/inference/transforms/transforms.factor @@ -3,7 +3,7 @@ USING: arrays kernel words sequences generic math namespaces quotations assocs combinators math.bitfields inference.backend inference.dataflow inference.state classes.tuple.private effects -inspector hashtables classes generic sets ; +inspector hashtables classes generic sets definitions ; IN: inference.transforms : pop-literals ( n -- rstate seq ) @@ -32,7 +32,7 @@ IN: inference.transforms drop [ no-case ] ] [ dup peek quotation? [ - dup peek swap 1 head* + dup peek swap but-last ] [ [ no-case ] swap ] if case>quot diff --git a/core/inspector/inspector-docs.factor b/core/inspector/inspector-docs.factor index 84ae34480d..ab1c38b0b7 100644 --- a/core/inspector/inspector-docs.factor +++ b/core/inspector/inspector-docs.factor @@ -108,4 +108,4 @@ HELP: me HELP: inspector-hook { $var-description "A quotation with stack effect " { $snippet "( obj -- )" } ", called by the inspector to display an overview of an object." $nl -"The default implementation calls " { $link describe } " which outputs on the " { $link stdio } " stream, but the graphical listener sets this variable so that calling " { $link inspect } " in the UI opens the graphical inspector." } ; +"The default implementation calls " { $link describe } " which outputs on " { $link output-stream } ", but the graphical listener sets this variable so that calling " { $link inspect } " in the UI opens the graphical inspector." } ; diff --git a/core/inspector/inspector.factor b/core/inspector/inspector.factor index c9bfbfad54..0ab016b0fa 100755 --- a/core/inspector/inspector.factor +++ b/core/inspector/inspector.factor @@ -96,7 +96,7 @@ SYMBOL: +editable+ : namestack. ( seq -- ) [ - [ global eq? not ] subset + [ global eq? not ] filter [ keys ] map concat prune ] keep [ dupd assoc-stack ] curry H{ } map>assoc describe ; diff --git a/core/io/backend/backend-docs.factor b/core/io/backend/backend-docs.factor index 8bf761e2a6..48b49ed32b 100644 --- a/core/io/backend/backend-docs.factor +++ b/core/io/backend/backend-docs.factor @@ -9,4 +9,4 @@ HELP: init-io { $contract "Initializes the I/O system. Called on startup." } ; HELP: init-stdio -{ $contract "Initializes the global " { $link stdio } " stream. Called on startup." } ; +{ $contract "Initializes the global " { $link input-stream } " and " { $link output-stream } ". Called on startup." } ; diff --git a/core/io/backend/backend.factor b/core/io/backend/backend.factor index 44b1eea349..0760063f0d 100755 --- a/core/io/backend/backend.factor +++ b/core/io/backend/backend.factor @@ -11,8 +11,10 @@ HOOK: init-io io-backend ( -- ) HOOK: (init-stdio) io-backend ( -- stdin stdout stderr ) : init-stdio ( -- ) - (init-stdio) utf8 stderr set-global - utf8 stdio set-global ; + (init-stdio) + [ utf8 input-stream set-global ] + [ utf8 output-stream set-global ] + [ utf8 error-stream set-global ] tri* ; HOOK: io-multiplex io-backend ( ms -- ) diff --git a/core/io/binary/binary-docs.factor b/core/io/binary/binary-docs.factor index edf65491fe..ab82abe146 100644 --- a/core/io/binary/binary-docs.factor +++ b/core/io/binary/binary-docs.factor @@ -1,17 +1,17 @@ -USING: help.markup help.syntax io math ; +USING: help.markup help.syntax io math byte-arrays ; IN: io.binary ARTICLE: "stream-binary" "Working with binary data" -"The core stream words read and write strings. Packed binary integers can be read and written by converting to and from sequences of bytes. Floating point numbers can be read and written by converting them into a their bitwise integer representation (" { $link "floats" } ")." +"Stream words on binary streams only read and write byte arrays. Packed binary integers can be read and written by converting to and from sequences of bytes. Floating point numbers can be read and written by converting them into a their bitwise integer representation (" { $link "floats" } ")." $nl "There are two ways to order the bytes making up an integer; " { $emphasis "little endian" } " byte order outputs the least significant byte first, and the most significant byte last, whereas " { $emphasis "big endian" } " is the other way around." $nl -"Consider the hexadecimal integer "{ $snippet "HEX: cafebabe" } ". Big endian byte order yields the following sequence of bytes:" +"Consider the hexadecimal integer "{ $snippet "HEX: cafebabe" } ". Little endian byte order yields the following sequence of bytes:" { $table { "Byte:" "1" "2" "3" "4" } { "Value:" { $snippet "be" } { $snippet "ba" } { $snippet "fe" } { $snippet "ca" } } } -"Compare this with little endian byte order:" +"Compare this with big endian byte order:" { $table { "Byte:" "1" "2" "3" "4" } { "Value:" { $snippet "ca" } { $snippet "fe" } { $snippet "ba" } { $snippet "be" } } @@ -42,11 +42,11 @@ HELP: nth-byte { $description "Outputs the " { $snippet "n" } "th least significant byte of the sign-extended 2's complement representation of " { $snippet "x" } "." } ; HELP: >le -{ $values { "x" integer } { "n" "a non-negative integer" } { "str" "a string" } } +{ $values { "x" integer } { "n" "a non-negative integer" } { "byte-array" byte-array } } { $description "Converts an integer " { $snippet "x" } " into a string of " { $snippet "n" } " bytes in little endian order. Truncation will occur if the integer is not in the range " { $snippet "[-2^(8n),2^(8n))" } "." } ; HELP: >be -{ $values { "x" integer } { "n" "a non-negative integer" } { "str" "a string" } } +{ $values { "x" integer } { "n" "a non-negative integer" } { "byte-array" byte-array } } { $description "Converts an integer " { $snippet "x" } " into a string of " { $snippet "n" } " bytes in big endian order. Truncation will occur if the integer is not in the range " { $snippet "[-2^(8n),2^(8n))" } "." } ; HELP: mask-byte diff --git a/core/io/binary/binary.factor b/core/io/binary/binary.factor index f2ede93fd5..f3d236433f 100755 --- a/core/io/binary/binary.factor +++ b/core/io/binary/binary.factor @@ -10,8 +10,8 @@ IN: io.binary : nth-byte ( x n -- b ) -8 * shift mask-byte ; inline -: >le ( x n -- str ) [ nth-byte ] with B{ } map-as ; -: >be ( x n -- str ) >le dup reverse-here ; +: >le ( x n -- byte-array ) [ nth-byte ] with B{ } map-as ; +: >be ( x n -- byte-array ) >le dup reverse-here ; : d>w/w ( d -- w1 w2 ) dup HEX: ffffffff bitand diff --git a/core/io/crc32/crc32-docs.factor b/core/io/crc32/crc32-docs.factor deleted file mode 100644 index 7f85ee2b4e..0000000000 --- a/core/io/crc32/crc32-docs.factor +++ /dev/null @@ -1,17 +0,0 @@ -USING: help.markup help.syntax math ; -IN: io.crc32 - -HELP: crc32 -{ $values { "seq" "a sequence of bytes" } { "n" integer } } -{ $description "Computes the CRC32 checksum of a sequence of bytes." } ; - -HELP: lines-crc32 -{ $values { "seq" "a sequence of strings" } { "n" integer } } -{ $description "Computes the CRC32 checksum of a sequence of lines of bytes." } ; - -ARTICLE: "io.crc32" "CRC32 checksum calculation" -"The CRC32 checksum algorithm provides a quick but unreliable way to detect changes in data." -{ $subsection crc32 } -{ $subsection lines-crc32 } ; - -ABOUT: "io.crc32" diff --git a/core/io/crc32/crc32-tests.factor b/core/io/crc32/crc32-tests.factor deleted file mode 100644 index 5eafae23cb..0000000000 --- a/core/io/crc32/crc32-tests.factor +++ /dev/null @@ -1,5 +0,0 @@ -USING: io.crc32 kernel math tools.test namespaces ; - -[ 0 ] [ "" crc32 ] unit-test -[ HEX: cbf43926 ] [ "123456789" crc32 ] unit-test - diff --git a/core/io/encodings/binary/binary.factor b/core/io/encodings/binary/binary.factor old mode 100644 new mode 100755 index 5038628ed9..e54163f632 --- a/core/io/encodings/binary/binary.factor +++ b/core/io/encodings/binary/binary.factor @@ -3,6 +3,6 @@ USING: io.encodings kernel ; IN: io.encodings.binary -TUPLE: binary ; +SINGLETON: binary M: binary drop ; M: binary drop ; diff --git a/core/io/encodings/encodings-docs.factor b/core/io/encodings/encodings-docs.factor index 8a176ce4ec..92471acb5d 100644 --- a/core/io/encodings/encodings-docs.factor +++ b/core/io/encodings/encodings-docs.factor @@ -12,8 +12,7 @@ ARTICLE: "io.encodings" "I/O encodings" ARTICLE: "encodings-constructors" "Manually constructing an encoded stream" "The following words can be used to construct encoded streams. Note that they are usually not used directly, but rather by the stream constructors themselves. Most stream constructors take an encoding descriptor as a parameter and internally call these constructors." { $subsection } -{ $subsection } -{ $subsection } ; +{ $subsection } ; HELP: { $values { "stream" "an output stream" } @@ -29,16 +28,6 @@ HELP: { $description "Wraps the given stream in a new stream using the given encoding for all input. The encoding descriptor can either be a class or an instance of something conforming to the " { $link "encodings-protocol" } "." } $low-level-note ; -HELP: -{ $values { "stream-in" "an input stream" } - { "stream-out" "an output stream" } - { "encoding" "an encoding descriptor" } - { "duplex" "an encoded duplex stream" } } -{ $description "Wraps the given streams in an encoder or decoder stream, and puts them together in a duplex stream for input and output. If either input stream is already encoded, that encoding is stripped off before it is reencoded. The encoding descriptor must conform to the " { $link "encodings-protocol" } "." } -$low-level-note ; - -{ } related-words - ARTICLE: "encodings-descriptors" "Encoding descriptors" "An encoding descriptor is something which can be used for input or output streams to encode or decode files. It must conform to the " { $link "encodings-protocol" } ". Encodings which you can use are defined in the following vocabularies:" { $subsection "io.encodings.binary" } diff --git a/core/io/encodings/encodings-tests.factor b/core/io/encodings/encodings-tests.factor index 397d1ea89c..ea74490858 100755 --- a/core/io/encodings/encodings-tests.factor +++ b/core/io/encodings/encodings-tests.factor @@ -1,36 +1,37 @@ -USING: io.files io.streams.string io -tools.test kernel io.encodings.ascii ; +USING: io.files io.streams.string io io.streams.byte-array +tools.test kernel io.encodings.ascii io.encodings.utf8 +namespaces accessors io.encodings ; IN: io.streams.encodings.tests -: ( resource -- stream ) - resource-path ascii ; - [ { } ] -[ "core/io/test/empty-file.txt" lines ] +[ "resource:core/io/test/empty-file.txt" ascii lines ] unit-test : lines-test ( stream -- line1 line2 ) - [ readln readln ] with-stream ; + [ readln readln ] with-input-stream ; [ "This is a line." "This is another line." ] [ - "core/io/test/windows-eol.txt" lines-test + "resource:core/io/test/windows-eol.txt" + ascii lines-test ] unit-test [ "This is a line." "This is another line." ] [ - "core/io/test/mac-os-eol.txt" lines-test + "resource:core/io/test/mac-os-eol.txt" + ascii lines-test ] unit-test [ "This is a line." "This is another line." ] [ - "core/io/test/unix-eol.txt" lines-test + "resource:core/io/test/unix-eol.txt" + ascii lines-test ] unit-test [ @@ -56,3 +57,19 @@ unit-test dup stream-readln drop stream-read1 ] unit-test + +[ utf8 ascii ] [ + "foo" utf8 [ + input-stream get code>> + ascii decode-input + input-stream get code>> + ] with-byte-reader +] unit-test + +[ utf8 ascii ] [ + utf8 [ + output-stream get code>> + ascii encode-output + output-stream get code>> + ] with-byte-writer drop +] unit-test diff --git a/core/io/encodings/encodings.factor b/core/io/encodings/encodings.factor index 4559cec666..3fe6f9d6aa 100755 --- a/core/io/encodings/encodings.factor +++ b/core/io/encodings/encodings.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2008 Daniel Ehrenberg. ! See http://factorcode.org/license.txt for BSD license. USING: math kernel sequences sbufs vectors namespaces growable -strings io classes continuations combinators io.styles -io.streams.plain splitting io.streams.duplex byte-arrays +strings io classes continuations destructors combinators +io.styles io.streams.plain splitting byte-arrays sequences.private accessors ; IN: io.encodings @@ -30,8 +30,7 @@ ERROR: encode-error ; new ; -M: tuple f decoder boa ; +M: object f decoder boa ; : >decoder< ( decoder -- stream encoding ) [ stream>> ] [ code>> ] bi ; @@ -104,8 +103,7 @@ M: decoder stream-readln ( stream -- str ) M: decoder dispose decoder-stream dispose ; ! Encoding -M: tuple-class new ; -M: tuple encoder boa ; +M: object encoder boa ; : >encoder< ( encoder -- stream encoding ) [ stream>> ] [ code>> ] bi ; @@ -121,16 +119,16 @@ M: encoder dispose encoder-stream dispose ; M: encoder stream-flush encoder-stream stream-flush ; INSTANCE: encoder plain-writer - -! Rebinding duplex streams which have not read anything yet - -: reencode ( stream encoding -- newstream ) - over encoder? [ >r encoder-stream r> ] when ; - -: redecode ( stream encoding -- newstream ) - over decoder? [ >r decoder-stream r> ] when ; - PRIVATE> -: ( stream-in stream-out encoding -- duplex ) - tuck reencode >r redecode r> ; +: re-encode ( stream encoding -- newstream ) + over encoder? [ >r encoder-stream r> ] when ; + +: encode-output ( encoding -- ) + output-stream [ swap re-encode ] change ; + +: re-decode ( stream encoding -- newstream ) + over decoder? [ >r decoder-stream r> ] when ; + +: decode-input ( encoding -- ) + input-stream [ swap re-decode ] change ; diff --git a/core/io/encodings/utf16/utf16-tests.factor b/core/io/encodings/utf16/utf16-tests.factor index 0d171ee9aa..ac5caba61c 100755 --- a/core/io/encodings/utf16/utf16-tests.factor +++ b/core/io/encodings/utf16/utf16-tests.factor @@ -24,7 +24,7 @@ IN: io.encodings.utf16.tests [ { HEX: ff HEX: fe 120 0 52 216 30 221 } ] [ { CHAR: x HEX: 1d11e } utf16 encode >array ] unit-test : correct-endian - code>> class little-endian? [ utf16le = ] [ utf16be = ] if ; + code>> little-endian? [ utf16le = ] [ utf16be = ] if ; [ t ] [ B{ } utf16n correct-endian ] unit-test [ t ] [ utf16n correct-endian ] unit-test diff --git a/core/io/encodings/utf16/utf16.factor b/core/io/encodings/utf16/utf16.factor index 9093132e5f..c0aaadc947 100755 --- a/core/io/encodings/utf16/utf16.factor +++ b/core/io/encodings/utf16/utf16.factor @@ -4,11 +4,11 @@ USING: math kernel sequences sbufs vectors namespaces io.binary io.encodings combinators splitting io byte-arrays inspector ; IN: io.encodings.utf16 -TUPLE: utf16be ; +SINGLETON: utf16be -TUPLE: utf16le ; +SINGLETON: utf16le -TUPLE: utf16 ; +SINGLETON: utf16 -{ $values { "path" "a pathname string" } { "encoding" "an encoding descriptor" { "stream" "an input stream" } } - { "stream" "an input stream" } } +{ + $values + { "path" "a pathname string" } + { "encoding" "an encoding descriptor" } + { "stream" "an input stream" } +} { $description "Outputs an input stream for reading from the specified pathname using the given encoding." } { $errors "Throws an error if the file is unreadable." } ; @@ -201,17 +205,17 @@ HELP: HELP: with-file-reader { $values { "path" "a pathname string" } { "encoding" "an encoding descriptor" } { "quot" "a quotation" } } -{ $description "Opens a file for reading and calls the quotation using " { $link with-stream } "." } +{ $description "Opens a file for reading and calls the quotation using " { $link with-input-stream } "." } { $errors "Throws an error if the file is unreadable." } ; HELP: with-file-writer { $values { "path" "a pathname string" } { "encoding" "an encoding descriptor" } { "quot" "a quotation" } } -{ $description "Opens a file for writing using the given encoding and calls the quotation using " { $link with-stream } "." } +{ $description "Opens a file for writing using the given encoding and calls the quotation using " { $link with-output-stream } "." } { $errors "Throws an error if the file cannot be opened for writing." } ; HELP: with-file-appender { $values { "path" "a pathname string" } { "encoding" "an encoding descriptor" } { "quot" "a quotation" } } -{ $description "Opens a file for appending using the given encoding and calls the quotation using " { $link with-stream } "." } +{ $description "Opens a file for appending using the given encoding and calls the quotation using " { $link with-output-stream } "." } { $errors "Throws an error if the file cannot be opened for writing." } ; HELP: set-file-lines @@ -269,11 +273,11 @@ $nl HELP: append-path { $values { "str1" "a string" } { "str2" "a string" } { "str" "a string" } } -{ $description "Concatenates two pathnames." } ; +{ $description "Appends " { $snippet "str1" } " and " { $snippet "str2" } " to form a pathname." } ; HELP: prepend-path { $values { "str1" "a string" } { "str2" "a string" } { "str" "a string" } } -{ $description "Concatenates two pathnames." } ; +{ $description "Appends " { $snippet "str2" } " and " { $snippet "str1" } " to form a pathname." } ; { append-path prepend-path } related-words @@ -296,8 +300,8 @@ HELP: exists? { $description "Tests if the file named by " { $snippet "path" } " exists." } ; HELP: directory? -{ $values { "path" "a pathname string" } { "?" "a boolean" } } -{ $description "Tests if " { $snippet "path" } " names a directory." } ; +{ $values { "file-info" file-info } { "?" "a boolean" } } +{ $description "Tests if " { $snippet "file-info" } " is a directory." } ; HELP: (directory) { $values { "path" "a pathname string" } { "seq" "a sequence of " { $snippet "{ name dir? }" } " pairs" } } diff --git a/core/io/files/files-tests.factor b/core/io/files/files-tests.factor index 5efbb9496d..e201d663a6 100755 --- a/core/io/files/files-tests.factor +++ b/core/io/files/files-tests.factor @@ -1,11 +1,16 @@ IN: io.files.tests USING: tools.test io.files io.files.private io threads kernel continuations io.encodings.ascii io.files.unique sequences -strings accessors io.encodings.utf8 ; +strings accessors io.encodings.utf8 math destructors ; + +\ exists? must-infer +\ (exists?) must-infer +\ file-info must-infer +\ link-info must-infer [ ] [ "blahblah" temp-file dup exists? [ delete-directory ] [ drop ] if ] unit-test [ ] [ "blahblah" temp-file make-directory ] unit-test -[ t ] [ "blahblah" temp-file directory? ] unit-test +[ t ] [ "blahblah" temp-file file-info directory? ] unit-test [ t ] [ [ temp-directory "loldir" append-path delete-directory ] ignore-errors @@ -43,6 +48,8 @@ strings accessors io.encodings.utf8 ; "file4" temp-file delete-file ] unit-test +[ "file5" temp-file delete-file ] ignore-errors + [ ] [ temp-directory [ "file5" touch-file @@ -50,6 +57,8 @@ strings accessors io.encodings.utf8 ; ] with-directory ] unit-test +[ "file6" temp-file delete-file ] ignore-errors + [ ] [ temp-directory [ "file6" touch-file @@ -62,6 +71,9 @@ strings accessors io.encodings.utf8 ; [ "awk" ] [ "/usr/libexec/awk///" file-name ] unit-test [ "" ] [ "" file-name ] unit-test +[ "freetype6.dll" ] [ "resource:freetype6.dll" file-name ] unit-test +[ "freetype6.dll" ] [ "resource:/freetype6.dll" file-name ] unit-test + [ ] [ { "Hello world." } "test-foo.txt" temp-file ascii set-file-lines @@ -95,6 +107,8 @@ strings accessors io.encodings.utf8 ; [ f ] [ "test-bar.txt" temp-file exists? ] unit-test +[ "test-blah" temp-file delete-tree ] ignore-errors + [ ] [ "test-blah" temp-file make-directory ] unit-test [ ] [ @@ -135,13 +149,13 @@ strings accessors io.encodings.utf8 ; [ { { "kernel" t } } ] [ "core" resource-path [ - "." directory [ first "kernel" = ] subset + "." directory [ first "kernel" = ] filter ] with-directory ] unit-test [ { { "kernel" t } } ] [ "resource:core" [ - "." directory [ first "kernel" = ] subset + "." directory [ first "kernel" = ] filter ] with-directory ] unit-test @@ -259,3 +273,6 @@ strings accessors io.encodings.utf8 ; [ t ] [ "resource:core" absolute-path? ] unit-test [ f ] [ "" absolute-path? ] unit-test + +[ "touch-twice-test" temp-file delete-file ] ignore-errors +[ ] [ 2 [ "touch-twice-test" temp-file touch-file ] times ] unit-test diff --git a/core/io/files/files.factor b/core/io/files/files.factor index 061e6386da..56a9a461cf 100755 --- a/core/io/files/files.factor +++ b/core/io/files/files.factor @@ -2,8 +2,8 @@ ! See http://factorcode.org/license.txt for BSD license. USING: io.backend io.files.private io hashtables kernel math memory namespaces sequences strings assocs arrays definitions -system combinators splitting sbufs continuations io.encodings -io.encodings.binary init accessors ; +system combinators splitting sbufs continuations destructors +io.encodings io.encodings.binary init accessors math.order ; IN: io.files HOOK: (file-reader) io-backend ( path -- stream ) @@ -25,13 +25,13 @@ HOOK: (file-appender) io-backend ( path -- stream ) lines ; : with-file-reader ( path encoding quot -- ) - >r r> with-stream ; inline + >r r> with-input-stream ; inline : file-contents ( path encoding -- str ) contents ; : with-file-writer ( path encoding quot -- ) - >r r> with-stream ; inline + >r r> with-output-stream ; inline : set-file-lines ( seq path encoding -- ) [ [ print ] each ] with-file-writer ; @@ -40,7 +40,7 @@ HOOK: (file-appender) io-backend ( path -- stream ) [ write ] with-file-writer ; : with-file-appender ( path encoding quot -- ) - >r r> with-stream ; inline + >r r> with-output-stream ; inline ! Pathnames : path-separator? ( ch -- ? ) os windows? "/\\" "/" ? member? ; @@ -54,7 +54,7 @@ HOOK: (file-appender) io-backend ( path -- stream ) [ path-separator? ] left-trim ; : last-path-separator ( path -- n ? ) - [ length 1- ] keep [ path-separator? ] find-last* ; + [ length 1- ] keep [ path-separator? ] find-last-from ; HOOK: root-directory? io-backend ( path -- ? ) @@ -92,7 +92,7 @@ ERROR: no-parent-directory path ; : append-path-empty ( path1 path2 -- path' ) { { [ dup head.? ] [ - 1 tail left-trim-separators append-path-empty + rest left-trim-separators append-path-empty ] } { [ dup head..? ] [ drop no-parent-directory ] } [ nip ] @@ -122,7 +122,7 @@ PRIVATE> { [ over empty? ] [ append-path-empty ] } { [ dup empty? ] [ drop ] } { [ dup absolute-path? ] [ nip ] } - { [ dup head.? ] [ 1 tail left-trim-separators append-path ] } + { [ dup head.? ] [ rest left-trim-separators append-path ] } { [ dup head..? ] [ 2 tail left-trim-separators >r parent-directory r> append-path @@ -142,9 +142,14 @@ PRIVATE> : file-name ( path -- string ) dup root-directory? [ right-trim-separators - dup last-path-separator [ 1+ tail ] [ drop ] if + dup last-path-separator [ 1+ tail ] [ + drop "resource:" ?head [ file-name ] when + ] if ] unless ; +: file-extension ( filename -- extension ) + "." last-split1 nip ; + ! File info TUPLE: file-info type size permissions modified ; @@ -170,11 +175,9 @@ SYMBOL: +socket+ SYMBOL: +unknown+ ! File metadata -: exists? ( path -- ? ) - normalize-path (exists?) ; +: exists? ( path -- ? ) normalize-path (exists?) ; -: directory? ( path -- ? ) - file-info file-info-type +directory+ = ; +: directory? ( file-info -- ? ) type>> +directory+ = ; " + "\"data.txt\" utf8 " "dup stream-readln number>string over stream-read 16 group" "swap dispose" } "This code has two problems: it has some unnecessary stack shuffling, and if either " { $link stream-readln } " or " { $link stream-read } " throws an I/O error, the stream is not closed because " { $link dispose } " is never reached. So we can add a call to " { $link with-disposal } " to ensure the stream is always closed:" { $code "USING: continuations kernel io io.files math.parser splitting ;" - "\"data.txt\" [" + "\"data.txt\" utf8 [" " dup stream-readln number>string over stream-read" " 16 group" "] with-disposal" @@ -51,17 +51,34 @@ ARTICLE: "stdio" "The default stream" "This code is robust however it is more complex than it needs to be since. This is where the default stream words come in; using them, the above can be rewritten as follows:" { $code "USING: continuations kernel io io.files math.parser splitting ;" - "\"data.txt\" [" + "\"data.txt\" utf8 [" " readln number>string read 16 group" - "] with-stream" + "] with-input-stream" } -"The default stream is stored in a dynamically-scoped variable:" -{ $subsection stdio } -"Unless rebound in a child namespace, this variable will be set to a console stream for interacting with the user." +"An even better implementation that takes advantage of a utility word:" +{ $code + "USING: continuations kernel io io.files math.parser splitting ;" + "\"data.txt\" utf8 [" + " readln number>string read 16 group" + "] with-file-reader" +} +"The default input stream is stored in a dynamically-scoped variable:" +{ $subsection input-stream } +"Unless rebound in a child namespace, this variable will be set to a console stream for reading input from the user." +$nl +"Words reading from the default input stream:" { $subsection read1 } { $subsection read } { $subsection read-until } { $subsection readln } +"A pair of combinators for rebinding the " { $link input-stream } " variable:" +{ $subsection with-input-stream } +{ $subsection with-input-stream* } +"The default output stream is stored in a dynamically-scoped variable:" +{ $subsection output-stream } +"Unless rebound in a child namespace, this variable will be set to a console stream for showing output to the user." +$nl +"Words writing to the default input stream:" { $subsection flush } { $subsection write1 } { $subsection write } @@ -78,9 +95,12 @@ ARTICLE: "stdio" "The default stream" { $subsection with-row } { $subsection with-cell } { $subsection write-cell } -"A pair of combinators support rebinding the " { $link stdio } " variable:" -{ $subsection with-stream } -{ $subsection with-stream* } ; +"A pair of combinators for rebinding the " { $link output-stream } " variable:" +{ $subsection with-output-stream } +{ $subsection with-output-stream* } +"A pair of combinators for rebinding both default streams at once:" +{ $subsection with-streams } +{ $subsection with-streams* } ; ARTICLE: "stream-utils" "Stream utilities" "There are a few useful stream-related words which are not generic, but merely built up from the stream protocol." @@ -105,7 +125,7 @@ $nl ABOUT: "streams" HELP: stream-readln -{ $values { "stream" "an input stream" } { "str" string } } +{ $values { "stream" "an input stream" } { "str/f" "a string or " { $link f } } } { $contract "Reads a line of input from the stream. Outputs " { $link f } " on stream exhaustion." } { $notes "Most code only works on one stream at a time and should instead use " { $link readln } "; see " { $link "stdio" } "." } $io-error ; @@ -119,7 +139,7 @@ $io-error ; HELP: stream-read { $values { "n" "a non-negative integer" } { "stream" "an input stream" } { "str/f" "a string or " { $link f } } } { $contract "Reads " { $snippet "n" } " characters of input from the stream. Outputs a truncated string or " { $link f } " on stream exhaustion." } -{ $notes "Most code only works on one stream at a time and should instead use " { $link read1 } "; see " { $link "stdio" } "." } +{ $notes "Most code only works on one stream at a time and should instead use " { $link read } "; see " { $link "stdio" } "." } $io-error ; HELP: stream-read-until @@ -204,62 +224,65 @@ HELP: stream-copy { $description "Copies the contents of one stream into another, closing both streams when done." } $io-error ; -HELP: stdio -{ $var-description "Holds a stream, used for various implicit stream operations. Rebound using " { $link with-stream } " and " { $link with-stream* } "." } ; +HELP: input-stream +{ $var-description "Holds an input stream for various implicit stream operations. Rebound using " { $link with-input-stream } " and " { $link with-input-stream* } "." } ; + +HELP: output-stream +{ $var-description "Holds an output stream for various implicit stream operations. Rebound using " { $link with-output-stream } " and " { $link with-output-stream* } "." } ; HELP: readln { $values { "str/f" "a string or " { $link f } } } -{ $description "Reads a line of input from the " { $link stdio } " stream. Outputs " { $link f } " on stream exhaustion." } +{ $description "Reads a line of input from " { $link input-stream } ". Outputs " { $link f } " on stream exhaustion." } $io-error ; HELP: read1 { $values { "ch/f" "a character or " { $link f } } } -{ $description "Reads a character of input from the " { $link stdio } " stream. Outputs " { $link f } " on stream exhaustion." } +{ $description "Reads a character of input from " { $link input-stream } ". Outputs " { $link f } " on stream exhaustion." } $io-error ; HELP: read { $values { "n" "a non-negative integer" } { "str/f" "a string or " { $link f } } } -{ $description "Reads " { $snippet "n" } " characters of input from the " { $link stdio } " stream. Outputs a truncated string or " { $link f } " on stream exhaustion." } +{ $description "Reads " { $snippet "n" } " characters of input from " { $link input-stream } ". Outputs a truncated string or " { $link f } " on stream exhaustion." } $io-error ; HELP: read-until { $values { "seps" string } { "str/f" "a string or " { $link f } } { "sep/f" "a character or " { $link f } } } -{ $contract "Reads characters from the " { $link stdio } " stream. until the first occurrence of a separator character, or stream exhaustion. In the former case, the separator character is pushed on the stack, and is not part of the output string. In the latter case, the entire stream contents are output, along with " { $link f } "." } +{ $contract "Reads characters from " { $link input-stream } ". until the first occurrence of a separator character, or stream exhaustion. In the former case, the separator character is pushed on the stack, and is not part of the output string. In the latter case, the entire stream contents are output, along with " { $link f } "." } $io-error ; HELP: write1 { $values { "ch" "a character" } } -{ $contract "Writes a character of output to the " { $link stdio } " stream. If the stream does buffering, output may not be performed immediately; use " { $link flush } " to force output." } +{ $contract "Writes a character of output to " { $link output-stream } ". If the stream does buffering, output may not be performed immediately; use " { $link flush } " to force output." } $io-error ; HELP: write { $values { "str" string } } -{ $description "Writes a string of output to the " { $link stdio } " stream. If the stream does buffering, output may not be performed immediately; use " { $link flush } " to force output." } +{ $description "Writes a string of output to " { $link output-stream } ". If the stream does buffering, output may not be performed immediately; use " { $link flush } " to force output." } $io-error ; HELP: flush -{ $description "Waits for any pending output to the " { $link stdio } " stream to complete." } +{ $description "Waits for any pending output on " { $link output-stream } " to complete." } $io-error ; HELP: nl -{ $description "Writes a line terminator to the " { $link stdio } " stream. If the stream does buffering, output may not be performed immediately; use " { $link flush } " to force output." } +{ $description "Writes a line terminator to " { $link output-stream } ". If the stream does buffering, output may not be performed immediately; use " { $link flush } " to force output." } $io-error ; HELP: format { $values { "str" string } { "style" "a hashtable" } } -{ $description "Writes formatted text to the " { $link stdio } " stream. If the stream does buffering, output may not be performed immediately; use " { $link flush } " to force output." } +{ $description "Writes formatted text to " { $link output-stream } ". If the stream does buffering, output may not be performed immediately; use " { $link flush } " to force output." } { $notes "Details are in the documentation for " { $link stream-format } "." } $io-error ; HELP: with-nesting -{ $values { "style" "a hashtable" } { "quot" "a quotation" } } -{ $description "Calls the quotation in a new dynamic scope with the " { $link stdio } " stream rebound to a nested paragraph stream, with formatting information applied." } +{ $values { "style" "a hashtable" } { "quot" quotation } } +{ $description "Calls the quotation in a new dynamic scope with " { $link output-stream } " rebound to a nested paragraph stream, with formatting information applied." } { $notes "Details are in the documentation for " { $link make-block-stream } "." } $io-error ; HELP: tabular-output { $values { "style" "a hashtable" } { "quot" quotation } } -{ $description "Calls a quotation which emits a series of equal-length table rows using " { $link with-row } ". The results are laid out in a tabular fashion on the " { $link stdio } " stream." +{ $description "Calls a quotation which emits a series of equal-length table rows using " { $link with-row } ". The results are laid out in a tabular fashion on " { $link output-stream } "." $nl "The " { $snippet "style" } " hashtable holds table style information. See " { $link "table-styles" } "." } { $examples @@ -279,7 +302,7 @@ $io-error ; HELP: with-cell { $values { "quot" quotation } } -{ $description "Calls a quotation in a new scope with the " { $link stdio } " stream rebound. Output performed by the quotation is displayed in a table cell. This word can only be called inside the quotation given to " { $link with-row } "." } +{ $description "Calls a quotation in a new scope with " { $link output-stream } " rebound. Output performed by the quotation is displayed in a table cell. This word can only be called inside the quotation given to " { $link with-row } "." } $io-error ; HELP: write-cell @@ -288,34 +311,54 @@ HELP: write-cell $io-error ; HELP: with-style -{ $values { "style" "a hashtable" } { "quot" "a quotation" } } +{ $values { "style" "a hashtable" } { "quot" quotation } } { $description "Calls the quotation in a new dynamic scope where calls to " { $link write } ", " { $link format } " and other stream output words automatically inherit style settings from " { $snippet "style" } "." } { $notes "Details are in the documentation for " { $link make-span-stream } "." } $io-error ; HELP: print { $values { "string" string } } -{ $description "Writes a newline-terminated string to the " { $link stdio } " stream." } +{ $description "Writes a newline-terminated string to " { $link output-stream } "." } $io-error ; -HELP: with-stream -{ $values { "stream" "an input or output stream" } { "quot" "a quotation" } } -{ $description "Calls the quotation in a new dynamic scope, with the " { $link stdio } " variable rebound to " { $snippet "stream" } ". The stream is closed if the quotation returns or throws an error." } ; +HELP: with-input-stream +{ $values { "stream" "an input stream" } { "quot" quotation } } +{ $description "Calls the quotation in a new dynamic scope, with " { $link input-stream } " rebound to " { $snippet "stream" } ". The stream is closed if the quotation returns or throws an error." } ; -{ with-stream with-stream* } related-words +HELP: with-output-stream +{ $values { "stream" "an output stream" } { "quot" quotation } } +{ $description "Calls the quotation in a new dynamic scope, with " { $link output-stream } " rebound to " { $snippet "stream" } ". The stream is closed if the quotation returns or throws an error." } ; -HELP: with-stream* -{ $values { "stream" "an input or output stream" } { "quot" "a quotation" } } -{ $description "Calls the quotation in a new dynamic scope, with the " { $link stdio } " variable rebound to " { $snippet "stream" } "." } -{ $notes "This word does not close the stream. Compare with " { $link with-stream } "." } ; +HELP: with-streams +{ $values { "input" "an input stream" } { "output" "an output stream" } { "quot" quotation } } +{ $description "Calls the quotation in a new dynamic scope, with " { $link input-stream } " rebound to " { $snippet "input" } " and " { $link output-stream } " rebound to " { $snippet "output" } ". The stream is closed if the quotation returns or throws an error." } ; + +HELP: with-streams* +{ $values { "input" "an input stream" } { "output" "an output stream" } { "quot" quotation } } +{ $description "Calls the quotation in a new dynamic scope, with " { $link input-stream } " rebound to " { $snippet "input" } " and " { $link output-stream } " rebound to " { $snippet "output" } "." } +{ $notes "This word does not close the stream. Compare with " { $link with-streams } "." } ; + +{ with-input-stream with-input-stream* } related-words + +{ with-output-stream with-output-stream* } related-words + +HELP: with-input-stream* +{ $values { "stream" "an input stream" } { "quot" quotation } } +{ $description "Calls the quotation in a new dynamic scope, with " { $link input-stream } " rebound to " { $snippet "stream" } "." } +{ $notes "This word does not close the stream. Compare with " { $link with-input-stream } "." } ; + +HELP: with-output-stream* +{ $values { "stream" "an output stream" } { "quot" quotation } } +{ $description "Calls the quotation in a new dynamic scope, with " { $link output-stream } " rebound to " { $snippet "stream" } "." } +{ $notes "This word does not close the stream. Compare with " { $link with-output-stream } "." } ; HELP: bl -{ $description "Outputs a space character (" { $snippet "\" \"" } ")." } +{ $description "Outputs a space character (" { $snippet "\" \"" } ") to " { $link output-stream } "." } $io-error ; HELP: write-object { $values { "str" string } { "obj" "an object" } } -{ $description "Writes a string to the " { $link stdio } " stream, associating it with the object. If formatted output is supported, the string will become a clickable presentation of the object, otherwise this word behaves like a call to " { $link write } "." } +{ $description "Writes a string to " { $link output-stream } ", associating it with the object. If formatted output is supported, the string will become a clickable presentation of the object, otherwise this word behaves like a call to " { $link write } "." } $io-error ; HELP: lines diff --git a/core/io/io-tests.factor b/core/io/io-tests.factor index b7d1cf81c8..af40cf8737 100755 --- a/core/io/io-tests.factor +++ b/core/io/io-tests.factor @@ -1,6 +1,6 @@ USING: arrays io io.files kernel math parser strings system tools.test words namespaces io.encodings.8-bit -io.encodings.binary ; +io.encodings.binary sequences ; IN: io.tests [ f ] [ @@ -8,21 +8,18 @@ IN: io.tests "foo" "io.tests" lookup ] unit-test -: ( resource -- stream ) - resource-path latin1 ; - [ "This is a line.\rThis is another line.\r" ] [ - "core/io/test/mac-os-eol.txt" - [ 500 read ] with-stream + "resource:core/io/test/mac-os-eol.txt" latin1 + [ 500 read ] with-input-stream ] unit-test [ 255 ] [ - "core/io/test/binary.txt" - [ read1 ] with-stream >fixnum + "resource:core/io/test/binary.txt" latin1 + [ read1 ] with-input-stream >fixnum ] unit-test ! Make sure we use correct to_c_string form when writing @@ -36,11 +33,12 @@ IN: io.tests } ] [ [ - "core/io/test/separator-test.txt" [ + "resource:core/io/test/separator-test.txt" + latin1 [ "J" read-until 2array , "i" read-until 2array , "X" read-until 2array , - ] with-stream + ] with-input-stream ] { } make ] unit-test @@ -50,11 +48,10 @@ IN: io.tests ] with-file-reader ] unit-test -! [ "" ] [ 0 read ] unit-test - -! [ ] [ "123" write 9000 CHAR: x write flush ] unit-test - -! [ -! "/core/io/test/binary.txt" -! [ 0.2 read ] with-stream -! ] must-fail +! Test EOF behavior +[ 10 ] [ + image binary [ + 0 read drop + 10 read length + ] with-file-reader +] unit-test diff --git a/core/io/io.factor b/core/io/io.factor index ef9eae7902..e8521f923c 100755 --- a/core/io/io.factor +++ b/core/io/io.factor @@ -1,10 +1,10 @@ ! Copyright (C) 2003, 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: hashtables generic kernel math namespaces sequences -continuations assocs io.styles ; +continuations destructors assocs io.styles ; IN: io -GENERIC: stream-readln ( stream -- str ) +GENERIC: stream-readln ( stream -- str/f ) GENERIC: stream-read1 ( stream -- ch/f ) GENERIC: stream-read ( n stream -- str/f ) GENERIC: stream-read-until ( seps stream -- str/f sep/f ) @@ -30,39 +30,53 @@ GENERIC: stream-write-table ( table-cells style stream -- ) [ 2dup (stream-copy) ] [ dispose dispose ] [ ] cleanup ; -! Default stream -SYMBOL: stdio +! Default streams +SYMBOL: input-stream +SYMBOL: output-stream +SYMBOL: error-stream -! Default error stream -SYMBOL: stderr +: readln ( -- str/f ) input-stream get stream-readln ; +: read1 ( -- ch/f ) input-stream get stream-read1 ; +: read ( n -- str/f ) input-stream get stream-read ; +: read-until ( seps -- str/f sep/f ) input-stream get stream-read-until ; +: read-partial ( n -- str/f ) input-stream get stream-read-partial ; -: readln ( -- str/f ) stdio get stream-readln ; -: read1 ( -- ch/f ) stdio get stream-read1 ; -: read ( n -- str/f ) stdio get stream-read ; -: read-until ( seps -- str/f sep/f ) stdio get stream-read-until ; +: write1 ( ch -- ) output-stream get stream-write1 ; +: write ( str -- ) output-stream get stream-write ; +: flush ( -- ) output-stream get stream-flush ; -: write1 ( ch -- ) stdio get stream-write1 ; -: write ( str -- ) stdio get stream-write ; -: flush ( -- ) stdio get stream-flush ; +: nl ( -- ) output-stream get stream-nl ; +: format ( str style -- ) output-stream get stream-format ; -: nl ( -- ) stdio get stream-nl ; -: format ( str style -- ) stdio get stream-format ; +: with-input-stream* ( stream quot -- ) + input-stream swap with-variable ; inline -: with-stream* ( stream quot -- ) - stdio swap with-variable ; inline +: with-input-stream ( stream quot -- ) + [ with-input-stream* ] curry with-disposal ; inline -: with-stream ( stream quot -- ) - [ with-stream* ] curry with-disposal ; inline +: with-output-stream* ( stream quot -- ) + output-stream swap with-variable ; inline + +: with-output-stream ( stream quot -- ) + [ with-output-stream* ] curry with-disposal ; inline + +: with-streams* ( input output quot -- ) + [ output-stream set input-stream set ] prepose with-scope ; inline + +: with-streams ( input output quot -- ) + [ [ with-streams* ] 3curry ] + [ [ drop dispose dispose ] 3curry ] 3bi + [ ] cleanup ; inline : tabular-output ( style quot -- ) - swap >r { } make r> stdio get stream-write-table ; inline + swap >r { } make r> output-stream get stream-write-table ; inline : with-row ( quot -- ) { } make , ; inline : with-cell ( quot -- ) - H{ } stdio get make-cell-stream - [ swap with-stream ] keep , ; inline + H{ } output-stream get make-cell-stream + [ swap with-output-stream ] keep , ; inline : write-cell ( str -- ) [ write ] with-cell ; inline @@ -71,13 +85,14 @@ SYMBOL: stderr swap dup assoc-empty? [ drop call ] [ - stdio get make-span-stream swap with-stream + output-stream get make-span-stream swap with-output-stream ] if ; inline : with-nesting ( style quot -- ) - >r stdio get make-block-stream r> with-stream ; inline + >r output-stream get make-block-stream + r> with-output-stream ; inline -: print ( string -- ) stdio get stream-print ; +: print ( string -- ) output-stream get stream-print ; : bl ( -- ) " " write ; @@ -85,9 +100,9 @@ SYMBOL: stderr presented associate format ; : lines ( stream -- seq ) - [ [ readln dup ] [ ] [ drop ] unfold ] with-stream ; + [ [ readln dup ] [ ] [ drop ] unfold ] with-input-stream ; : contents ( stream -- str ) [ [ 65536 read dup ] [ ] [ drop ] unfold concat f like - ] with-stream ; + ] with-input-stream ; diff --git a/core/io/streams/byte-array/byte-array-docs.factor b/core/io/streams/byte-array/byte-array-docs.factor index 741725af41..7b27621343 100644 --- a/core/io/streams/byte-array/byte-array-docs.factor +++ b/core/io/streams/byte-array/byte-array-docs.factor @@ -25,10 +25,10 @@ HELP: HELP: with-byte-reader { $values { "encoding" "an encoding descriptor" } { "quot" quotation } { "byte-array" byte-array } } -{ $description "Calls the quotation in a new dynamic scope with " { $link stdio } " rebound to an input stream for reading from a byte array using an encoding." } ; +{ $description "Calls the quotation in a new dynamic scope with " { $link input-stream } " rebound to an input stream for reading from a byte array using an encoding." } ; HELP: with-byte-writer { $values { "encoding" "an encoding descriptor" } { "quot" quotation } { "byte-array" byte-array } } -{ $description "Calls the quotation in a new dynamic scope with " { $link stdio } " rebound to an output stream writing data to a byte array using an encoding." } ; +{ $description "Calls the quotation in a new dynamic scope with " { $link output-stream } " rebound to an output stream writing data to a byte array using an encoding." } ; diff --git a/core/io/streams/byte-array/byte-array.factor b/core/io/streams/byte-array/byte-array.factor index 2a8441ff23..28d789d66f 100644 --- a/core/io/streams/byte-array/byte-array.factor +++ b/core/io/streams/byte-array/byte-array.factor @@ -1,16 +1,16 @@ USING: byte-arrays byte-vectors kernel io.encodings io.streams.string -sequences io namespaces io.encodings.private ; +sequences io namespaces io.encodings.private accessors ; IN: io.streams.byte-array : ( encoding -- stream ) 512 swap ; : with-byte-writer ( encoding quot -- byte-array ) - >r r> [ stdio get ] compose with-stream* - dup encoder? [ encoder-stream ] when >byte-array ; inline + >r r> [ output-stream get ] compose with-output-stream* + dup encoder? [ stream>> ] when >byte-array ; inline : ( byte-array encoding -- stream ) >r >byte-vector dup reverse-here r> ; : with-byte-reader ( byte-array encoding quot -- ) - >r r> with-stream ; inline + >r r> with-input-stream* ; inline diff --git a/core/io/streams/c/c.factor b/core/io/streams/c/c.factor index 372acbe0c1..365d5b7c5d 100755 --- a/core/io/streams/c/c.factor +++ b/core/io/streams/c/c.factor @@ -2,37 +2,42 @@ ! See http://factorcode.org/license.txt for BSD license. USING: kernel kernel.private namespaces io io.encodings sequences math generic threads.private classes io.backend -io.streams.duplex io.files continuations byte-arrays ; +io.files continuations destructors byte-arrays accessors ; IN: io.streams.c -TUPLE: c-writer handle ; +TUPLE: c-writer handle disposed ; -C: c-writer +: ( handle -- stream ) f c-writer boa ; M: c-writer stream-write1 - c-writer-handle fputc ; + dup check-disposed + handle>> fputc ; M: c-writer stream-write - c-writer-handle fwrite ; + dup check-disposed + handle>> fwrite ; M: c-writer stream-flush - c-writer-handle fflush ; + dup check-disposed + handle>> fflush ; -M: c-writer dispose - c-writer-handle fclose ; +M: c-writer dispose* + handle>> fclose ; -TUPLE: c-reader handle ; +TUPLE: c-reader handle disposed ; -C: c-reader +: ( handle -- stream ) f c-reader boa ; M: c-reader stream-read - c-reader-handle fread ; + dup check-disposed + handle>> fread ; M: c-reader stream-read-partial stream-read ; M: c-reader stream-read1 - c-reader-handle fgetc ; + dup check-disposed + handle>> fgetc ; : read-until-loop ( stream delim -- ch ) over stream-read1 dup [ @@ -42,11 +47,12 @@ M: c-reader stream-read1 ] if ; M: c-reader stream-read-until + dup check-disposed [ swap read-until-loop ] B{ } make swap over empty? over not and [ 2drop f f ] when ; -M: c-reader dispose - c-reader-handle fclose ; +M: c-reader dispose* + handle>> fclose ; M: object init-io ; diff --git a/core/io/streams/duplex/duplex-docs.factor b/core/io/streams/duplex/duplex-docs.factor deleted file mode 100755 index c9691af5ba..0000000000 --- a/core/io/streams/duplex/duplex-docs.factor +++ /dev/null @@ -1,19 +0,0 @@ -USING: help.markup help.syntax io continuations ; -IN: io.streams.duplex - -ARTICLE: "io.streams.duplex" "Duplex streams" -"Duplex streams combine an input stream and an output stream into a bidirectional stream." -{ $subsection duplex-stream } -{ $subsection } ; - -ABOUT: "io.streams.duplex" - -HELP: duplex-stream -{ $class-description "A bidirectional stream wrapping an input and output stream." } ; - -HELP: -{ $values { "in" "an input stream" } { "out" "an output stream" } { "stream" " a duplex stream" } } -{ $description "Creates a duplex stream. Writing to a duplex stream will write to " { $snippet "out" } ", and reading from a duplex stream will read from " { $snippet "in" } ". Closing a duplex stream closes both the input and output streams." } ; - -HELP: stream-closed-twice -{ $error-description "This error is thrown when performing an I/O operation on a " { $link duplex-stream } " which has been closed with " { $link dispose } "." } ; diff --git a/core/io/streams/duplex/duplex.factor b/core/io/streams/duplex/duplex.factor deleted file mode 100755 index 40f0cb6e73..0000000000 --- a/core/io/streams/duplex/duplex.factor +++ /dev/null @@ -1,77 +0,0 @@ -! Copyright (C) 2005, 2008 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: kernel continuations io accessors ; -IN: io.streams.duplex - -! We ensure that the stream can only be closed once, to preserve -! integrity of duplex I/O ports. - -TUPLE: duplex-stream in out closed ; - -: ( in out -- stream ) - f duplex-stream boa ; - -ERROR: stream-closed-twice ; - -> [ stream-closed-twice ] when ; inline - -: in ( duplex -- stream ) check-closed in>> ; - -: out ( duplex -- stream ) check-closed out>> ; - -PRIVATE> - -M: duplex-stream stream-flush - out stream-flush ; - -M: duplex-stream stream-readln - in stream-readln ; - -M: duplex-stream stream-read1 - in stream-read1 ; - -M: duplex-stream stream-read-until - in stream-read-until ; - -M: duplex-stream stream-read-partial - in stream-read-partial ; - -M: duplex-stream stream-read - in stream-read ; - -M: duplex-stream stream-write1 - out stream-write1 ; - -M: duplex-stream stream-write - out stream-write ; - -M: duplex-stream stream-nl - out stream-nl ; - -M: duplex-stream stream-format - out stream-format ; - -M: duplex-stream make-span-stream - out make-span-stream ; - -M: duplex-stream make-block-stream - out make-block-stream ; - -M: duplex-stream make-cell-stream - out make-cell-stream ; - -M: duplex-stream stream-write-table - out stream-write-table ; - -M: duplex-stream dispose - #! The output stream is closed first, in case both streams - #! are attached to the same file descriptor, the output - #! buffer needs to be flushed before we close the fd. - dup closed>> [ - t >>closed - [ dup out>> dispose ] - [ dup in>> dispose ] [ ] cleanup - ] unless drop ; diff --git a/core/io/streams/nested/nested.factor b/core/io/streams/nested/nested.factor index fd67910b6f..bb6a7a9111 100755 --- a/core/io/streams/nested/nested.factor +++ b/core/io/streams/nested/nested.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2006, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: arrays generic assocs kernel namespaces strings -quotations io continuations accessors sequences ; +quotations io continuations destructors accessors sequences ; IN: io.streams.nested TUPLE: filter-writer stream ; diff --git a/core/io/streams/string/string-docs.factor b/core/io/streams/string/string-docs.factor index 5b09baa56d..b87e5ca591 100644 --- a/core/io/streams/string/string-docs.factor +++ b/core/io/streams/string/string-docs.factor @@ -17,7 +17,7 @@ HELP: HELP: with-string-writer { $values { "quot" quotation } { "str" string } } -{ $description "Calls the quotation in a new dynamic scope with " { $link stdio } " rebound to a new string writer. The accumulated string is output when the quotation returns." } ; +{ $description "Calls the quotation in a new dynamic scope with " { $link output-stream } " rebound to a new string writer. The accumulated string is output when the quotation returns." } ; HELP: { $values { "str" string } { "stream" "an input stream" } } @@ -26,4 +26,4 @@ HELP: HELP: with-string-reader { $values { "str" string } { "quot" quotation } } -{ $description "Calls the quotation in a new dynamic scope with " { $link stdio } " rebound to an input stream reading " { $snippet "str" } " from beginning to end." } ; +{ $description "Calls the quotation in a new dynamic scope with " { $link input-stream } " rebound to an input stream reading " { $snippet "str" } " from beginning to end." } ; diff --git a/core/io/streams/string/string-tests.factor b/core/io/streams/string/string-tests.factor index ca117534da..3512ac871d 100644 --- a/core/io/streams/string/string-tests.factor +++ b/core/io/streams/string/string-tests.factor @@ -35,7 +35,7 @@ unit-test "J" read-until 2array , "i" read-until 2array , "X" read-until 2array , - ] with-stream + ] with-input-stream ] { } make ] unit-test diff --git a/core/io/streams/string/string.factor b/core/io/streams/string/string.factor index b7ff37a971..d2b092abe8 100755 --- a/core/io/streams/string/string.factor +++ b/core/io/streams/string/string.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2003, 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: io kernel math namespaces sequences sbufs strings -generic splitting growable continuations io.streams.plain -io.encodings io.encodings.private ; +generic splitting growable continuations destructors +io.streams.plain io.encodings math.order ; IN: io.streams.string M: growable dispose drop ; @@ -15,7 +15,7 @@ M: growable stream-flush drop ; 512 ; : with-string-writer ( quot -- str ) - swap [ stdio get ] compose with-stream* + swap [ output-stream get ] compose with-output-stream* >string ; inline M: growable stream-read1 dup empty? [ drop f ] [ pop ] if ; @@ -26,7 +26,8 @@ M: growable stream-read1 dup empty? [ drop f ] [ pop ] if ; : growable-read-until ( growable n -- str ) >fixnum dupd tail-slice swap harden-as dup reverse-here ; -: find-last-sep swap [ memq? ] curry find-last drop ; +: find-last-sep ( seq seps -- n ) + swap [ memq? ] curry find-last drop ; M: growable stream-read-until [ find-last-sep ] keep over [ @@ -49,14 +50,14 @@ M: growable stream-read M: growable stream-read-partial stream-read ; -TUPLE: null ; +SINGLETON: null M: null decode-char drop stream-read1 ; : ( str -- stream ) >sbuf dup reverse-here null ; : with-string-reader ( str quot -- ) - >r r> with-stream ; inline + >r r> with-input-stream ; inline INSTANCE: growable plain-writer @@ -67,17 +68,13 @@ INSTANCE: growable plain-writer ] unless ; : map-last ( seq quot -- seq ) - swap dup length - [ zero? rot [ call ] keep swap ] 2map nip ; inline + >r dup length [ zero? ] r> compose 2map ; inline : format-table ( table -- seq ) flip [ format-column ] map-last flip [ " " join ] map ; M: plain-writer stream-write-table - [ drop format-table [ print ] each ] with-stream* ; + [ drop format-table [ print ] each ] with-output-stream* ; M: plain-writer make-cell-stream 2drop ; - -M: growable stream-readln ( stream -- str ) - "\r\n" over stream-read-until handle-readln ; diff --git a/core/kernel/kernel-docs.factor b/core/kernel/kernel-docs.factor index 4578e2a93f..82f0db1364 100755 --- a/core/kernel/kernel-docs.factor +++ b/core/kernel/kernel-docs.factor @@ -1,7 +1,7 @@ USING: generic help.markup help.syntax math memory -namespaces sequences kernel.private layouts sorting classes +namespaces sequences kernel.private layouts classes kernel.private vectors combinators quotations strings words -assocs arrays ; +assocs arrays math.order ; IN: kernel ARTICLE: "shuffle-words" "Shuffle words" @@ -97,6 +97,7 @@ $nl "Certain shuffle words can also be expressed in terms of the spread combinators. Internalizing such identities can help with understanding and writing code using spread combinators:" { $code ": dip [ ] bi* ;" + ": 2dip [ ] [ ] tri* ;" "" ": slip [ call ] [ ] bi* ;" ": 2slip [ call ] [ ] [ ] tri* ;" @@ -148,7 +149,7 @@ $nl { $subsection "spread-shuffle-equivalence" } ; ARTICLE: "apply-combinators" "Apply combinators" -"The apply combinators apply multiple quotations to multiple values. The " { $snippet "@" } " suffix signifies application." +"The apply combinators apply a single quotation to multiple values. The " { $snippet "@" } " suffix signifies application." $nl "Two quotations:" { $subsection bi@ } @@ -164,8 +165,9 @@ ARTICLE: "slip-keep-combinators" "The slip and keep combinators" { $subsection slip } { $subsection 2slip } { $subsection 3slip } -"The dip combinator invokes the quotation at the top of the stack, hiding the value underneath:" +"The dip combinators invoke the quotation at the top of the stack, hiding the values underneath:" { $subsection dip } +{ $subsection 2dip } "The keep combinators invoke a quotation which takes a number of values off the stack, and then they restore those values:" { $subsection keep } { $subsection 2keep } @@ -179,6 +181,7 @@ ARTICLE: "compositional-combinators" "Compositional combinators" { $subsection with } { $subsection compose } { $subsection 3compose } +{ $subsection prepose } "Quotations also implement the sequence protocol, and can be manipulated with sequence words; see " { $link "quotations" } "." ; ARTICLE: "implementing-combinators" "Implementing combinators" @@ -190,10 +193,7 @@ ARTICLE: "implementing-combinators" "Implementing combinators" ": keep ( x quot -- x )" " over >r call r> ; inline" } -"Word inlining is documented in " { $link "declarations" } "." -$nl -"A looping combinator:" -{ $subsection while } ; +"Word inlining is documented in " { $link "declarations" } "." ; ARTICLE: "booleans" "Booleans" "In Factor, any object that is not " { $link f } " has a true value, and " { $link f } " has a false value. The " { $link t } " object is the canonical true value." @@ -219,6 +219,16 @@ $nl { $example "t \\ t eq? ." "t" } "Many words which search collections confuse the case of no element being present with an element being found equal to " { $link f } ". If this distinction is imporant, there is usually an alternative word which can be used; for example, compare " { $link at } " with " { $link at* } "." ; +ARTICLE: "conditionals-boolean-equivalence" "Expressing conditionals with boolean logic" +"Certain simple conditional forms can be expressed in a simpler manner using boolean logic." +$nl +"The following two lines are equivalent:" +{ $code "[ drop f ] unless" "swap and" } +"The following two lines are equivalent:" +{ $code "[ ] [ ] ?if" "swap or" } +"The following two lines are equivalent, where " { $snippet "L" } " is a literal:" +{ $code "[ L ] unless*" "L or" } ; + ARTICLE: "conditionals" "Conditionals and logic" "The basic conditionals:" { $subsection if } @@ -238,10 +248,11 @@ ARTICLE: "conditionals" "Conditionals and logic" { $subsection and } { $subsection or } { $subsection xor } +{ $subsection "conditionals-boolean-equivalence" } "See " { $link "combinators" } " for forms which abstract away common patterns involving multiple nested branches." { $see-also "booleans" "bitwise-arithmetic" both? either? } ; -ARTICLE: "equality" "Equality and comparison testing" +ARTICLE: "equality" "Equality" "There are two distinct notions of ``sameness'' when it comes to objects. You can test if two references point to the same object (" { $emphasis "identity comparison" } "), or you can test if two objects are equal in a domain-specific sense, usually by being instances of the same class, and having equal slot values (" { $emphasis "value comparison" } "). Both notions of equality are equality relations in the mathematical sense." $nl "Identity comparison:" @@ -250,15 +261,8 @@ $nl { $subsection = } "Custom value comparison methods:" { $subsection equal? } +"Utility class:" { $subsection identity-tuple } -"Some types of objects also have an intrinsic order allowing sorting using " { $link natural-sort } ":" -{ $subsection <=> } -{ $subsection compare } -"Utilities for comparing objects:" -{ $subsection after? } -{ $subsection before? } -{ $subsection after=? } -{ $subsection before=? } "An object can be cloned; the clone has distinct identity but equal value:" { $subsection clone } ; @@ -393,29 +397,6 @@ HELP: identity-tuple { $unchecked-example "T{ foo } dup clone = ." "f" } } ; -HELP: <=> -{ $values { "obj1" object } { "obj2" object } { "n" real } } -{ $contract - "Compares two objects using an intrinsic total order, for example, the natural order for real numbers and lexicographic order for strings." - $nl - "The output value is one of the following:" - { $list - { "positive - indicating that " { $snippet "obj1" } " follows " { $snippet "obj2" } } - { "zero - indicating that " { $snippet "obj1" } " is equal to " { $snippet "obj2" } } - { "negative - indicating that " { $snippet "obj1" } " precedes " { $snippet "obj2" } } - } - "The default implementation treats the two objects as sequences, and recursively compares their elements. So no extra work is required to compare sequences lexicographically." -} ; - -{ <=> compare natural-sort sort-keys sort-values } related-words - -HELP: compare -{ $values { "obj1" object } { "obj2" object } { "quot" "a quotation with stack effect " { $snippet "( obj -- newobj )" } } { "n" integer } } -{ $description "Compares the results of applying the quotation to both objects via " { $link <=> } "." } -{ $examples - { $example "USING: kernel prettyprint sequences ;" "\"hello\" \"hi\" [ length ] compare ." "3" } -} ; - HELP: clone { $values { "obj" object } { "cloned" "a new object" } } { $contract "Outputs a new object equal to the given object. This is not guaranteed to actually copy the object; it does nothing with immutable objects, and does not copy words either. However, sequences and tuples can be cloned to obtain a shallow copy of the original." } ; @@ -659,7 +640,7 @@ HELP: tri* "The following two lines are equivalent:" { $code "[ p ] [ q ] [ r ] tri*" - ">r >r q r> q r> r" + ">r >r p r> q r> r" } } ; @@ -747,17 +728,19 @@ $nl HELP: unless* { $values { "cond" "a generalized boolean" } { "false" "a quotation " } } -{ $description "Variant of " { $link if* } " with no true quotation." -$nl +{ $description "Variant of " { $link if* } " with no true quotation." } +{ $notes "The following two lines are equivalent:" { $code "X [ Y ] unless*" "X dup [ ] [ drop Y ] if" } } ; HELP: ?if { $values { "default" object } { "cond" "a generalized boolean" } { "true" "a quotation with stack effect " { $snippet "( cond -- )" } } { "false" "a quotation with stack effect " { $snippet "( default -- )" } } } -{ $description "If the condition is " { $link f } ", the " { $snippet "false" } " quotation is called with the " { $snippet "default" } " value on the stack. Otherwise, the " { $snippet "true" } " quotation is called with the condition on the stack." -$nl +{ $description "If the condition is " { $link f } ", the " { $snippet "false" } " quotation is called with the " { $snippet "default" } " value on the stack. Otherwise, the " { $snippet "true" } " quotation is called with the condition on the stack." } +{ $notes "The following two lines are equivalent:" -{ $code "[ X ] [ Y ] ?if" "dup [ nip X ] [ drop Y ] if" } } ; +{ $code "[ X ] [ Y ] ?if" "dup [ nip X ] [ drop Y ] if" } +"The following two lines are equivalent:" +{ $code "[ ] [ ] ?if" "swap or" } } ; HELP: die { $description "Starts the front-end processor (FEP), which is a low-level debugger which can inspect memory addresses and the like. The FEP is also entered when a critical error occurs." } @@ -865,8 +848,16 @@ HELP: compose ( quot1 quot2 -- compose ) "However, " { $link compose } " runs in constant time, and the optimizing compiler is able to compile code which calls composed quotations." } ; + +HELP: prepose +{ $values { "quot1" callable } { "quot2" callable } { "compose" compose } } +{ $description "Quotation composition. Outputs a " { $link callable } " which calls " { $snippet "quot2" } " followed by " { $snippet "quot1" } "." } +{ $notes "See " { $link compose } " for details." } ; + +{ compose prepose } related-words + HELP: 3compose -{ $values { "quot1" callable } { "quot2" callable } { "quot3" callable } { "curry" curry } } +{ $values { "quot1" callable } { "quot2" callable } { "quot3" callable } { "compose" compose } } { $description "Quotation composition. Outputs a " { $link callable } " which calls " { $snippet "quot1" } ", " { $snippet "quot2" } " and then " { $snippet "quot3" } "." } { $notes "The three quotations must leave the retain stack in the same state on exit as it was on entry, so for example, the following code is not allowed:" @@ -893,6 +884,14 @@ HELP: dip { $code "[ foo bar ] dip" } } ; +HELP: 2dip +{ $values { "obj1" object } { "obj2" object } { "quot" quotation } } +{ $description "Calls " { $snippet "quot" } " with " { $snippet "obj1" } " and " { $snippet "obj2" } " hidden on the retain stack." } +{ $notes "The following are equivalent:" + { $code ">r >r foo bar r> r>" } + { $code "[ foo bar ] 2dip" } +} ; + HELP: while { $values { "pred" "a quotation with stack effect " { $snippet "( -- ? )" } } { "body" "a quotation" } { "tail" "a quotation" } } { $description "Repeatedly calls " { $snippet "pred" } ". If it yields " { $link f } ", iteration stops, otherwise " { $snippet "body" } " is called. After iteration stops, " { $snippet "tail" } " is called." } diff --git a/core/kernel/kernel.factor b/core/kernel/kernel.factor index 95f0d60720..61f687c95a 100755 --- a/core/kernel/kernel.factor +++ b/core/kernel/kernel.factor @@ -57,6 +57,8 @@ DEFER: if : dip ( obj quot -- obj ) swap slip ; inline +: 2dip ( obj1 obj2 quot -- obj1 obj2 ) -rot 2slip ; inline + ! Keepers : keep ( x quot -- x ) over slip ; inline @@ -70,7 +72,7 @@ DEFER: if >r keep r> call ; inline : tri ( x p q r -- ) - >r pick >r bi r> r> call ; inline + >r >r keep r> keep r> call ; inline ! Double cleavers : 2bi ( x y p q -- ) @@ -88,14 +90,14 @@ DEFER: if ! Spreaders : bi* ( x y p q -- ) - >r swap slip r> call ; inline + >r dip r> call ; inline : tri* ( x y z p q r -- ) - >r rot >r bi* r> r> call ; inline + >r >r 2dip r> dip r> call ; inline ! Double spreaders : 2bi* ( w x y z p q -- ) - >r -rot 2slip r> call ; inline + >r 2dip r> call ; inline ! Appliers : bi@ ( x y quot -- ) @@ -133,8 +135,6 @@ M: identity-tuple equal? 2drop f ; : = ( obj1 obj2 -- ? ) 2dup eq? [ 2drop t ] [ equal? ] if ; inline -GENERIC: <=> ( obj1 obj2 -- n ) - GENERIC: clone ( obj -- cloned ) M: object clone ; @@ -158,7 +158,10 @@ M: callstack clone (clone) ; : with ( param obj quot -- obj curry ) swapd [ swapd call ] 2curry ; inline -: 3compose ( quot1 quot2 quot3 -- curry ) +: prepose ( quot1 quot2 -- compose ) + swap compose ; inline + +: 3compose ( quot1 quot2 quot3 -- compose ) compose compose ; inline ! Booleans @@ -176,8 +179,6 @@ M: callstack clone (clone) ; : either? ( x y quot -- ? ) bi@ or ; inline -: compare ( obj1 obj2 quot -- n ) bi@ <=> ; inline - : most ( x y quot -- z ) >r 2dup r> call [ drop ] [ nip ] if ; inline diff --git a/core/layouts/layouts.factor b/core/layouts/layouts.factor index 879862c926..19fe03202c 100755 --- a/core/layouts/layouts.factor +++ b/core/layouts/layouts.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: namespaces math words kernel assocs classes -kernel.private ; +math.order kernel.private ; IN: layouts SYMBOL: tag-mask diff --git a/core/libc/libc-docs.factor b/core/libc/libc-docs.factor index 45d6b94326..5e285bf26d 100644 --- a/core/libc/libc-docs.factor +++ b/core/libc/libc-docs.factor @@ -1,4 +1,4 @@ -USING: help.markup help.syntax alien ; +USING: help.markup help.syntax alien destructors ; IN: libc HELP: malloc @@ -36,5 +36,13 @@ HELP: with-malloc { $values { "size" "a positive integer" } { "quot" "a quotation with stack effect " { $snippet "( c-ptr -- )" } } } { $description "Allocates a zeroed block of " { $snippet "n" } " bytes and passes it to the quotation. When the quotation returns, the block is freed." } ; +HELP: &free +{ $values { "alien" c-ptr } } +{ $description "Marks the block of memory for unconditional deallocation at the end of the current " { $link with-destructors } " scope." } ; + +HELP: |free +{ $values { "alien" c-ptr } } +{ $description "Marks the object for deallocation in the event of an error at the end of the current " { $link with-destructors } " scope." } ; + ! Defined in alien-docs.factor ABOUT: "malloc" diff --git a/core/libc/libc-tests.factor b/core/libc/libc-tests.factor new file mode 100755 index 0000000000..249399bdd0 --- /dev/null +++ b/core/libc/libc-tests.factor @@ -0,0 +1,11 @@ +IN: libc.tests +USING: libc libc.private tools.test namespaces assocs +destructors kernel ; + +100 malloc "block" set + +[ t ] [ "block" get mallocs get key? ] unit-test + +[ ] [ [ "block" get &free drop ] with-destructors ] unit-test + +[ f ] [ "block" get mallocs get key? ] unit-test diff --git a/core/libc/libc.factor b/core/libc/libc.factor index 756d29e551..dff6e9e0f1 100755 --- a/core/libc/libc.factor +++ b/core/libc/libc.factor @@ -1,8 +1,9 @@ ! Copyright (C) 2004, 2005 Mackenzie Straight -! Copyright (C) 2007 Slava Pestov -! Copyright (C) 2007 Doug Coleman +! Copyright (C) 2007, 2008 Slava Pestov +! Copyright (C) 2007, 2008 Doug Coleman ! See http://factorcode.org/license.txt for BSD license. -USING: alien assocs continuations init kernel namespaces ; +USING: alien assocs continuations destructors init kernel +namespaces accessors ; IN: libc : with-malloc ( size quot -- ) swap 1 calloc [ swap keep ] [ free ] [ ] cleanup ; inline + +: strlen ( alien -- len ) + "size_t" "libc" "strlen" { "char*" } alien-invoke ; + +> free ; + +PRIVATE> + +: &free ( alien -- alien ) + dup f memory-destructor boa &dispose drop ; inline + +: |free ( alien -- alien ) + dup f memory-destructor boa |dispose drop ; inline diff --git a/core/listener/listener-docs.factor b/core/listener/listener-docs.factor index 755c79ac68..beea9005b4 100755 --- a/core/listener/listener-docs.factor +++ b/core/listener/listener-docs.factor @@ -32,14 +32,14 @@ HELP: listener-hook HELP: read-quot { $values { "quot/f" "a parsed quotation, or " { $link f } " indicating end of file" } } -{ $description "Reads a Factor expression which possibly spans more than one line from " { $link stdio } " stream. Additional lines of input are read while the parser stack height is greater than one. Since structural parsing words push partial quotations on the stack, this will keep on reading input until all delimited parsing words are terminated." } ; +{ $description "Reads a Factor expression which possibly spans more than one line from " { $link input-stream } ". Additional lines of input are read while the parser stack height is greater than one. Since structural parsing words push partial quotations on the stack, this will keep on reading input until all delimited parsing words are terminated." } ; HELP: listen -{ $description "Prompts for an expression on the " { $link stdio } " stream and evaluates it. On end of file, " { $link quit-flag } " is set to terminate the listener loop." } -{ $errors "If the expression input by the user throws an error, the error is printed to the " { $link stdio } " stream and the word returns normally." } ; +{ $description "Prompts for an expression on " { $link input-stream } " and evaluates it. On end of file, " { $link quit-flag } " is set to terminate the listener loop." } +{ $errors "If the expression input by the user throws an error, the error is printed to " { $link output-stream } " and the word returns normally." } ; HELP: listener -{ $description "Prompts for expressions on the " { $link stdio } " stream and evaluates them until end of file is reached." } ; +{ $description "Prompts for expressions on " { $link input-stream } " and evaluates them until end of file is reached." } ; HELP: bye { $description "Exits the current listener." } diff --git a/core/listener/listener-tests.factor b/core/listener/listener-tests.factor index 2c05c049a7..24449049e0 100755 --- a/core/listener/listener-tests.factor +++ b/core/listener/listener-tests.factor @@ -51,6 +51,6 @@ IN: listener.tests [ [ ] [ "IN: listener.tests : hello\n\"world\" ;" parse-interactive - drop + drop ] unit-test ] with-file-vocabs diff --git a/core/listener/listener.factor b/core/listener/listener.factor index ddb29bb768..e00e64f4bc 100755 --- a/core/listener/listener.factor +++ b/core/listener/listener.factor @@ -2,8 +2,8 @@ ! See http://factorcode.org/license.txt for BSD license. USING: arrays hashtables io kernel math math.parser memory namespaces parser sequences strings io.styles -io.streams.duplex vectors words generic system combinators -continuations debugger definitions compiler.units accessors ; +vectors words generic system combinators continuations debugger +definitions compiler.units accessors ; IN: listener SYMBOL: quit-flag @@ -35,10 +35,7 @@ GENERIC: stream-read-quot ( stream -- quot/f ) M: object stream-read-quot V{ } clone read-quot-loop ; -M: duplex-stream stream-read-quot - duplex-stream-in stream-read-quot ; - -: read-quot ( -- quot/f ) stdio get stream-read-quot ; +: read-quot ( -- quot/f ) input-stream get stream-read-quot ; : bye ( -- ) quit-flag on ; @@ -46,9 +43,13 @@ M: duplex-stream stream-read-quot "( " in get " )" 3append H{ { background { 1 0.7 0.7 1 } } } format bl flush ; +SYMBOL: error-hook + +[ print-error-and-restarts ] error-hook set-global + : listen ( -- ) listener-hook get call prompt. - [ read-quot [ try ] [ bye ] if* ] + [ read-quot [ [ error-hook get call ] recover ] [ bye ] if* ] [ dup parse-error? [ error-hook get call diff --git a/core/math/bitfields/bitfields-tests.factor b/core/math/bitfields/bitfields-tests.factor index 6dfc51f440..70533ac33f 100755 --- a/core/math/bitfields/bitfields-tests.factor +++ b/core/math/bitfields/bitfields-tests.factor @@ -10,7 +10,7 @@ IN: math.bitfields.tests : a 1 ; inline : b 2 ; inline -: foo { a b } flags ; +: foo ( -- flags ) { a b } flags ; [ 3 ] [ foo ] unit-test [ 3 ] [ { a b } flags ] unit-test diff --git a/core/math/bitfields/bitfields.factor b/core/math/bitfields/bitfields.factor index 77cc40180e..a0fb17ef48 100644 --- a/core/math/bitfields/bitfields.factor +++ b/core/math/bitfields/bitfields.factor @@ -3,7 +3,7 @@ USING: arrays kernel math sequences words ; IN: math.bitfields -GENERIC: (bitfield) inline +GENERIC: (bitfield) ( value accum shift -- newaccum ) M: integer (bitfield) ( value accum shift -- newaccum ) swapd shift bitor ; diff --git a/core/math/floats/floats.factor b/core/math/floats/floats.factor index 30abd9cad6..5cd6f067a9 100755 --- a/core/math/floats/floats.factor +++ b/core/math/floats/floats.factor @@ -6,8 +6,6 @@ IN: math.floats.private M: fixnum >float fixnum>float ; M: bignum >float bignum>float ; -M: float zero? dup 0.0 float= swap -0.0 float= or ; - M: float >fixnum float>fixnum ; M: float >bignum float>bignum ; M: float >float ; @@ -22,4 +20,7 @@ M: float + float+ ; M: float - float- ; M: float * float* ; M: float / float/f ; +M: float /f float/f ; M: float mod float-mod ; + +M: real abs dup 0 < [ neg ] when ; diff --git a/core/math/integers/integers-tests.factor b/core/math/integers/integers-tests.factor index fe8e5bddc8..f428df33ae 100755 --- a/core/math/integers/integers-tests.factor +++ b/core/math/integers/integers-tests.factor @@ -1,5 +1,5 @@ -USING: kernel math namespaces prettyprint -math.private continuations tools.test sequences ; +USING: kernel math math.functions namespaces prettyprint +math.private continuations tools.test sequences random ; IN: math.integers.tests [ "-8" ] [ -8 unparse ] unit-test @@ -191,3 +191,31 @@ unit-test [ f ] [ -128 power-of-2? ] unit-test [ f ] [ 0 power-of-2? ] unit-test [ t ] [ 1 power-of-2? ] unit-test + +: ratio>float ( a b -- f ) [ >bignum ] bi@ /f ; + +[ 5. ] [ 5 1 ratio>float ] unit-test +[ 4. ] [ 4 1 ratio>float ] unit-test +[ 2. ] [ 2 1 ratio>float ] unit-test +[ .5 ] [ 1 2 ratio>float ] unit-test +[ .75 ] [ 3 4 ratio>float ] unit-test +[ 1. ] [ 2000 2^ 2000 2^ 1+ ratio>float ] unit-test +[ -1. ] [ 2000 2^ neg 2000 2^ 1+ ratio>float ] unit-test +[ 0.4 ] [ 6 15 ratio>float ] unit-test + +[ HEX: 3fe553522d230931 ] +[ 61967020039 92984792073 ratio>float double>bits ] unit-test + +: random-integer ( -- n ) + 32 random-bits + 1 random zero? [ neg ] when + 1 random zero? [ >bignum ] when ; + +[ t ] [ + 1000 [ + drop + random-integer + random-integer + [ >float / ] [ /f ] 2bi 0.1 ~ + ] all? +] unit-test diff --git a/core/math/integers/integers.factor b/core/math/integers/integers.factor index 70a6d2e087..6563a1cd11 100755 --- a/core/math/integers/integers.factor +++ b/core/math/integers/integers.factor @@ -1,4 +1,5 @@ ! Copyright (C) 2004, 2007 Slava Pestov. +! Copyright (C) 2008, Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: kernel kernel.private sequences sequences.private math math.private combinators ; @@ -22,6 +23,8 @@ M: fixnum + fixnum+ ; M: fixnum - fixnum- ; M: fixnum * fixnum* ; M: fixnum /i fixnum/i ; +M: fixnum /f >r >float r> >float float/f ; + M: fixnum mod fixnum-mod ; M: fixnum /mod fixnum/mod ; @@ -67,4 +70,57 @@ M: bignum bitnot bignum-bitnot ; M: bignum bit? bignum-bit? ; M: bignum (log2) bignum-log2 ; -M: integer zero? 0 number= ; +! Converting ratios to floats. Based on FLOAT-RATIO from +! sbcl/src/code/float.lisp, which has the following license: + +! "The software is in the public domain and is +! provided with absolutely no warranty." + +! First step: pre-scaling +: twos ( x -- y ) dup 1- bitxor log2 ; inline + +: scale-denonimator ( den -- scaled-den scale' ) + dup twos neg [ shift ] keep ; inline + +: pre-scale ( num den -- scale shifted-num scaled-den ) + 2dup [ log2 ] bi@ - + tuck [ neg 54 + shift ] [ >r scale-denonimator r> + ] 2bi* + -rot ; inline + +! Second step: loop +: shift-mantissa ( scale mantissa -- scale' mantissa' ) + [ 1+ ] [ 2/ ] bi* ; inline + +: /f-loop ( scale mantissa den -- scale' fraction-and-guard rem ) + [ 2dup /i log2 53 > ] + [ >r shift-mantissa r> ] + [ ] while /mod ; inline + +! Third step: post-scaling +: unscaled-float ( mantissa -- n ) + 52 2^ 1- bitand 1022 52 shift bitor bits>double ; inline + +: scale-float ( scale mantissa -- float' ) + >r dup 0 < [ neg 2^ recip ] [ 2^ ] if r> * ; inline + +: post-scale ( scale mantissa -- n ) + 2/ dup log2 52 > [ shift-mantissa ] when + unscaled-float scale-float ; inline + +! Main word +: /f-abs ( m n -- f ) + over zero? [ + 2drop 0.0 + ] [ + dup zero? [ + 2drop 1.0/0.0 + ] [ + pre-scale + /f-loop over odd? + [ zero? [ 1+ ] unless ] [ drop ] if + post-scale + ] if + ] if ; inline + +M: bignum /f ( m n -- f ) + [ [ abs ] bi@ /f-abs ] [ [ 0 < ] bi@ xor ] 2bi [ neg ] when ; diff --git a/core/math/intervals/intervals-docs.factor b/core/math/intervals/intervals-docs.factor index 7eb20090ab..59fb0df18e 100644 --- a/core/math/intervals/intervals-docs.factor +++ b/core/math/intervals/intervals-docs.factor @@ -1,4 +1,4 @@ -USING: help.markup help.syntax math ; +USING: help.markup help.syntax math math.order ; IN: math.intervals ARTICLE: "math-intervals-new" "Creating intervals" diff --git a/core/math/intervals/intervals-tests.factor b/core/math/intervals/intervals-tests.factor index 5204d7d45a..82ec51b3f1 100755 --- a/core/math/intervals/intervals-tests.factor +++ b/core/math/intervals/intervals-tests.factor @@ -1,5 +1,5 @@ -USING: math.intervals kernel sequences words math arrays -prettyprint tools.test random vocabs combinators ; +USING: math.intervals kernel sequences words math math.order +arrays prettyprint tools.test random vocabs combinators ; IN: math.intervals.tests [ T{ interval f { 1 t } { 2 t } } ] [ 1 2 [a,b] ] unit-test @@ -177,7 +177,7 @@ IN: math.intervals.tests { 3 [ (a,b] ] } } case ; -: random-op +: random-op ( -- pair ) { { + interval+ } { - interval- } @@ -192,7 +192,7 @@ IN: math.intervals.tests ] when random ; -: interval-test +: interval-test ( -- ? ) random-interval random-interval random-op ! 3dup . . . 0 pick interval-contains? over first { / /i } member? and [ 3drop t @@ -204,7 +204,7 @@ IN: math.intervals.tests [ t ] [ 40000 [ drop interval-test ] all? ] unit-test -: random-comparison +: random-comparison ( -- pair ) { { < interval< } { <= interval<= } @@ -212,7 +212,7 @@ IN: math.intervals.tests { >= interval>= } } random ; -: comparison-test +: comparison-test ( -- ? ) random-interval random-interval random-comparison [ >r [ random-element ] bi@ r> first execute ] 3keep second execute dup incomparable eq? [ diff --git a/core/math/intervals/intervals.factor b/core/math/intervals/intervals.factor index 77d60e67f8..7d05196007 100755 --- a/core/math/intervals/intervals.factor +++ b/core/math/intervals/intervals.factor @@ -1,16 +1,16 @@ ! Copyright (C) 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. ! Based on Slate's src/unfinished/interval.slate by Brian Rice. -USING: kernel sequences arrays math combinators ; +USING: kernel sequences arrays math combinators math.order ; IN: math.intervals TUPLE: interval from to ; C: interval -: open-point f 2array ; +: open-point ( n -- endpoint ) f 2array ; -: closed-point t 2array ; +: closed-point ( n -- endpoint ) t 2array ; : [a,b] ( a b -- interval ) >r closed-point r> closed-point ; @@ -197,7 +197,8 @@ SYMBOL: incomparable [ interval-to ] bi@ = and and ; -: (interval<) over interval-from over interval-from endpoint< ; +: (interval<) ( i1 i2 -- i1 i2 ? ) + over interval-from over interval-from endpoint< ; : interval< ( i1 i2 -- ? ) { diff --git a/core/math/math-docs.factor b/core/math/math-docs.factor index c8a763b5f7..b15f09e49d 100755 --- a/core/math/math-docs.factor +++ b/core/math/math-docs.factor @@ -79,28 +79,6 @@ HELP: >= { $values { "x" real } { "y" real } { "?" "a boolean" } } { $description "Tests if " { $snippet "x" } " is greater than or equal to " { $snippet "y" } "." } ; -HELP: before? -{ $values { "obj1" "an object" } { "obj2" "an object" } { "?" "a boolean" } } -{ $description "Tests if " { $snippet "obj1" } " comes before " { $snippet "obj2" } " using an intrinsic total order." } -{ $notes "Implemented using " { $link <=> } "." } ; - -HELP: after? -{ $values { "obj1" "an object" } { "obj2" "an object" } { "?" "a boolean" } } -{ $description "Tests if " { $snippet "obj1" } " comes after " { $snippet "obj2" } " using an intrinsic total order." } -{ $notes "Implemented using " { $link <=> } "." } ; - -HELP: before=? -{ $values { "obj1" "an object" } { "obj2" "an object" } { "?" "a boolean" } } -{ $description "Tests if " { $snippet "obj1" } " comes before or equals " { $snippet "obj2" } " using an intrinsic total order." } -{ $notes "Implemented using " { $link <=> } "." } ; - -HELP: after=? -{ $values { "obj1" "an object" } { "obj2" "an object" } { "?" "a boolean" } } -{ $description "Tests if " { $snippet "obj1" } " comes after or equals " { $snippet "obj2" } " using an intrinsic total order." } -{ $notes "Implemented using " { $link <=> } "." } ; - -{ before? after? before=? after=? } related-words - HELP: + { $values { "x" number } { "y" number } { "z" number } } @@ -275,19 +253,6 @@ HELP: recip { $description "Computes a number's multiplicative inverse." } { $errors "Throws an error if " { $snippet "x" } " is the integer 0." } ; -HELP: max -{ $values { "x" real } { "y" real } { "z" real } } -{ $description "Outputs the greatest of two real numbers." } ; - -HELP: min -{ $values { "x" real } { "y" real } { "z" real } } -{ $description "Outputs the smallest of two real numbers." } ; - -HELP: between? -{ $values { "x" real } { "y" real } { "z" real } { "?" "a boolean" } } -{ $description "Tests if " { $snippet "x" } " is in the interval " { $snippet "[y,z]" } "." } -{ $notes "As per the closed interval notation, the end-points are included in the interval." } ; - HELP: rem { $values { "x" integer } { "y" integer } { "z" integer } } { $description @@ -333,10 +298,6 @@ HELP: times { $description "Calls the quotation " { $snippet "n" } " times." } { $notes "If you need to pass the current index to the quotation, use " { $link each } "." } ; -HELP: [-] -{ $values { "x" real } { "y" real } { "z" real } } -{ $description "Subtracts " { $snippet "y" } " from " { $snippet "x" } ". If the result is less than zero, outputs zero." } ; - HELP: fp-nan? { $values { "x" real } { "?" "a boolean" } } { $description "Tests if " { $snippet "x" } " is an IEEE Not-a-Number value. While " { $snippet "x" } " can be any real number, this word will only ever yield true if " { $snippet "x" } " is a " { $link float } "." } ; diff --git a/core/math/math.factor b/core/math/math.factor index 14cbe68351..0218ded6ff 100755 --- a/core/math/math.factor +++ b/core/math/math.factor @@ -17,15 +17,11 @@ MATH: <= ( x y -- ? ) foldable MATH: > ( x y -- ? ) foldable MATH: >= ( x y -- ? ) foldable -: after? ( obj1 obj2 -- ? ) <=> 0 > ; inline -: before? ( obj1 obj2 -- ? ) <=> 0 < ; inline -: after=? ( obj1 obj2 -- ? ) <=> 0 >= ; inline -: before=? ( obj1 obj2 -- ? ) <=> 0 <= ; inline - MATH: + ( x y -- z ) foldable MATH: - ( x y -- z ) foldable MATH: * ( x y -- z ) foldable MATH: / ( x y -- z ) foldable +MATH: /f ( x y -- z ) foldable MATH: /i ( x y -- z ) foldable MATH: mod ( x y -- z ) foldable @@ -38,6 +34,8 @@ GENERIC# shift 1 ( x n -- y ) foldable GENERIC: bitnot ( x -- y ) foldable GENERIC# bit? 1 ( x n -- ? ) foldable +GENERIC: abs ( x -- y ) foldable + (log2) ] if ; foldable -GENERIC: zero? ( x -- ? ) foldable - -M: object zero? drop f ; - +: zero? ( x -- ? ) 0 number= ; inline : 1+ ( x -- y ) 1 + ; inline : 1- ( x -- y ) 1 - ; inline : 2/ ( x -- y ) -1 shift ; inline : sq ( x -- y ) dup * ; inline : neg ( x -- -x ) 0 swap - ; inline : recip ( x -- y ) 1 swap / ; inline +: sgn ( x -- n ) dup 0 < [ drop -1 ] [ 0 > 1 0 ? ] if ; inline : ?1+ [ 1+ ] [ 0 ] if* ; inline -: /f ( x y -- z ) >r >float r> >float float/f ; inline - -: max ( x y -- z ) [ > ] most ; inline -: min ( x y -- z ) [ < ] most ; inline - -: between? ( x y z -- ? ) - pick >= [ >= ] [ 2drop f ] if ; inline - : rem ( x y -- z ) tuck mod over + swap mod ; foldable -: sgn ( x -- n ) dup 0 < [ drop -1 ] [ 0 > 1 0 ? ] if ; inline - -: [-] ( x y -- z ) - 0 max ; inline - : 2^ ( n -- 2^n ) 1 swap shift ; inline : even? ( n -- ? ) 1 bitand zero? ; @@ -96,13 +80,6 @@ M: number equal? number= ; M: real hashcode* nip >fixnum ; -M: real <=> - ; - -! real and sequence overlap. we disambiguate: -M: integer hashcode* nip >fixnum ; - -M: integer <=> - ; - GENERIC: fp-nan? ( x -- ? ) M: object fp-nan? @@ -161,7 +138,7 @@ PRIVATE> iterate-prep (each-integer) ; inline : times ( n quot -- ) - [ drop ] swap compose each-integer ; inline + [ drop ] prepose each-integer ; inline : find-integer ( n quot -- i ) iterate-prep (find-integer) ; inline diff --git a/core/math/order/order-docs.factor b/core/math/order/order-docs.factor new file mode 100644 index 0000000000..23ea1058ad --- /dev/null +++ b/core/math/order/order-docs.factor @@ -0,0 +1,94 @@ +USING: help.markup help.syntax kernel math quotations +math.private words ; +IN: math.order + +HELP: <=> +{ $values { "obj1" object } { "obj2" object } { "symbol" symbol } } +{ $contract + "Compares two objects using an intrinsic total order, for example, the natural order for real numbers and lexicographic order for strings." + $nl + "The output value is one of the following:" + { $list + { { $link +lt+ } " - indicating that " { $snippet "obj1" } " precedes " { $snippet "obj2" } } + { { $link +eq+ } " - indicating that " { $snippet "obj1" } " is equal to " { $snippet "obj2" } } + { { $link +gt+ } " - indicating that " { $snippet "obj1" } " follows " { $snippet "obj2" } } + } +} ; + +HELP: +lt+ +{ $description "Returned by " { $link <=> } " when the first object is strictly less than the second object." } ; + +HELP: +eq+ +{ $description "Returned by " { $link <=> } " when the first object is equal to the second object." } ; + +HELP: +gt+ +{ $description "Returned by " { $link <=> } " when the first object is strictly greater than the second object." } ; + +HELP: invert-comparison +{ $values { "symbol" symbol } + { "new-symbol" symbol } } +{ $description "Invert the comparison symbol returned by " { $link <=> } ". The output for the symbol " { $snippet "+eq+" } " is itself." } +{ $examples + { $example "USING: math.order prettyprint ;" "+lt+ invert-comparison ." "+gt+" } } ; + +HELP: compare +{ $values { "obj1" object } { "obj2" object } { "quot" "a quotation with stack effect " { $snippet "( obj -- newobj )" } } { "symbol" "a comparison symbol, +lt+, +eq+, or +gt+" } } +{ $description "Compares the results of applying the quotation to both objects via " { $link <=> } "." } +{ $examples { $example "USING: kernel math.order prettyprint sequences ;" "\"hello\" \"hi\" [ length ] compare ." "+gt+" } +} ; + +HELP: max +{ $values { "x" real } { "y" real } { "z" real } } +{ $description "Outputs the greatest of two real numbers." } ; + +HELP: min +{ $values { "x" real } { "y" real } { "z" real } } +{ $description "Outputs the smallest of two real numbers." } ; + +HELP: between? +{ $values { "x" real } { "y" real } { "z" real } { "?" "a boolean" } } +{ $description "Tests if " { $snippet "x" } " is in the interval " { $snippet "[y,z]" } "." } +{ $notes "As per the closed interval notation, the end-points are included in the interval." } ; + +HELP: before? +{ $values { "obj1" "an object" } { "obj2" "an object" } { "?" "a boolean" } } +{ $description "Tests if " { $snippet "obj1" } " comes before " { $snippet "obj2" } " using an intrinsic total order." } +{ $notes "Implemented using " { $link <=> } "." } ; + +HELP: after? +{ $values { "obj1" "an object" } { "obj2" "an object" } { "?" "a boolean" } } +{ $description "Tests if " { $snippet "obj1" } " comes after " { $snippet "obj2" } " using an intrinsic total order." } +{ $notes "Implemented using " { $link <=> } "." } ; + +HELP: before=? +{ $values { "obj1" "an object" } { "obj2" "an object" } { "?" "a boolean" } } +{ $description "Tests if " { $snippet "obj1" } " comes before or equals " { $snippet "obj2" } " using an intrinsic total order." } +{ $notes "Implemented using " { $link <=> } "." } ; + +HELP: after=? +{ $values { "obj1" "an object" } { "obj2" "an object" } { "?" "a boolean" } } +{ $description "Tests if " { $snippet "obj1" } " comes after or equals " { $snippet "obj2" } " using an intrinsic total order." } +{ $notes "Implemented using " { $link <=> } "." } ; + +{ before? after? before=? after=? } related-words + +HELP: [-] +{ $values { "x" real } { "y" real } { "z" real } } +{ $description "Subtracts " { $snippet "y" } " from " { $snippet "x" } ". If the result is less than zero, outputs zero." } ; + +ARTICLE: "math.order" "Ordered objects" +"Some classes have an intrinsic order amongst instances:" +{ $subsection <=> } +{ $subsection compare } +{ $subsection invert-comparison } +"The above words return one of the following symbols:" +{ $subsection +lt+ } +{ $subsection +eq+ } +{ $subsection +gt+ } +"Utilities for comparing objects:" +{ $subsection after? } +{ $subsection before? } +{ $subsection after=? } +{ $subsection before=? } ; + +ABOUT: "math.order" diff --git a/core/math/order/order-tests.factor b/core/math/order/order-tests.factor new file mode 100644 index 0000000000..665537be5d --- /dev/null +++ b/core/math/order/order-tests.factor @@ -0,0 +1,9 @@ +USING: kernel math.order tools.test ; +IN: math.order.tests + +[ +lt+ ] [ "ab" "abc" <=> ] unit-test +[ +gt+ ] [ "abc" "ab" <=> ] unit-test +[ +lt+ ] [ 3 4 <=> ] unit-test +[ +eq+ ] [ 4 4 <=> ] unit-test +[ +gt+ ] [ 4 3 <=> ] unit-test + diff --git a/core/math/order/order.factor b/core/math/order/order.factor new file mode 100644 index 0000000000..76fe058ffa --- /dev/null +++ b/core/math/order/order.factor @@ -0,0 +1,41 @@ +! Copyright (C) 2008 Slava Pestov, Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: kernel math ; +IN: math.order + +SYMBOL: +lt+ +SYMBOL: +eq+ +SYMBOL: +gt+ + +: invert-comparison ( symbol -- new-symbol ) + #! Can't use case, index or nth here + dup +lt+ eq? [ drop +gt+ ] [ +eq+ eq? +eq+ +lt+ ? ] if ; + +GENERIC: <=> ( obj1 obj2 -- symbol ) + +M: real <=> 2dup < [ 2drop +lt+ ] [ number= +eq+ +gt+ ? ] if ; + +GENERIC: before? ( obj1 obj2 -- ? ) +GENERIC: after? ( obj1 obj2 -- ? ) +GENERIC: before=? ( obj1 obj2 -- ? ) +GENERIC: after=? ( obj1 obj2 -- ? ) + +M: object before? ( obj1 obj2 -- ? ) <=> +lt+ eq? ; +M: object after? ( obj1 obj2 -- ? ) <=> +gt+ eq? ; +M: object before=? ( obj1 obj2 -- ? ) <=> +gt+ eq? not ; +M: object after=? ( obj1 obj2 -- ? ) <=> +lt+ eq? not ; + +M: real before? ( obj1 obj2 -- ? ) < ; +M: real after? ( obj1 obj2 -- ? ) > ; +M: real before=? ( obj1 obj2 -- ? ) <= ; +M: real after=? ( obj1 obj2 -- ? ) >= ; + +: min ( x y -- z ) [ before? ] most ; inline +: max ( x y -- z ) [ after? ] most ; inline + +: between? ( x y z -- ? ) + pick after=? [ after=? ] [ 2drop f ] if ; inline + +: [-] ( x y -- z ) - 0 max ; inline + +: compare ( obj1 obj2 quot -- symbol ) bi@ <=> ; inline diff --git a/core/math/parser/parser-tests.factor b/core/math/parser/parser-tests.factor index baa6634a9f..15234ee310 100755 --- a/core/math/parser/parser-tests.factor +++ b/core/math/parser/parser-tests.factor @@ -98,3 +98,9 @@ unit-test [ 1 1 >base ] must-fail [ 1 0 >base ] must-fail [ 1 -1 >base ] must-fail + +[ "0.0/0.0" ] [ 0.0 0.0 / number>string ] unit-test + +[ "1.0/0.0" ] [ 1.0 0.0 / number>string ] unit-test + +[ "-1.0/0.0" ] [ -1.0 0.0 / number>string ] unit-test diff --git a/core/math/parser/parser.factor b/core/math/parser/parser.factor index 1a1a080564..5d048f0b8e 100755 --- a/core/math/parser/parser.factor +++ b/core/math/parser/parser.factor @@ -43,7 +43,7 @@ DEFER: base> SYMBOL: radix SYMBOL: negative? -: sign negative? get "-" "+" ? ; +: sign ( -- str ) negative? get "-" "+" ? ; : with-radix ( radix quot -- ) radix swap with-variable ; inline @@ -140,9 +140,9 @@ M: ratio >base M: float >base drop { + { [ dup fp-nan? ] [ drop "0.0/0.0" ] } { [ dup 1.0/0.0 = ] [ drop "1.0/0.0" ] } { [ dup -1.0/0.0 = ] [ drop "-1.0/0.0" ] } - { [ dup fp-nan? ] [ drop "0.0/0.0" ] } [ float>string fix-float ] } cond ; diff --git a/core/memory/memory-docs.factor b/core/memory/memory-docs.factor index 75876a3c8f..38f39ec588 100755 --- a/core/memory/memory-docs.factor +++ b/core/memory/memory-docs.factor @@ -40,10 +40,6 @@ HELP: instances HELP: gc ( -- ) { $description "Performs a full garbage collection." } ; -HELP: gc-time ( -- n ) -{ $values { "n" "a timestamp in milliseconds" } } -{ $description "Outputs the total time spent in garbage collection during this Factor session." } ; - HELP: data-room ( -- cards generations ) { $values { "cards" "number of bytes reserved for card marking" } { "generations" "array of free/total bytes pairs" } } { $description "Queries the runtime for memory usage information." } ; diff --git a/core/mirrors/mirrors-docs.factor b/core/mirrors/mirrors-docs.factor index e3ebfefa5f..60de841568 100755 --- a/core/mirrors/mirrors-docs.factor +++ b/core/mirrors/mirrors-docs.factor @@ -30,6 +30,7 @@ HELP: { $examples { $example "USING: assocs mirrors prettyprint ;" + "IN: scratchpad" "TUPLE: circle center radius ;" "C: circle" "{ 100 50 } 15 >alist ." diff --git a/core/namespaces/namespaces-docs.factor b/core/namespaces/namespaces-docs.factor index 971477cd4d..1da3bc45db 100755 --- a/core/namespaces/namespaces-docs.factor +++ b/core/namespaces/namespaces-docs.factor @@ -87,7 +87,7 @@ HELP: +@ { $description "Adds " { $snippet "n" } " to the value of the variable. A variable value of " { $link f } " is interpreted as being zero." } { $side-effects "variable" } { $examples - { $example "USING: namespaces prettyprint ;" "SYMBOL: foo\n1 foo +@\n10 foo +@\nfoo get ." "11" } + { $example "USING: namespaces prettyprint ;" "IN: scratchpad" "SYMBOL: foo\n1 foo +@\n10 foo +@\nfoo get ." "11" } } ; HELP: inc diff --git a/core/namespaces/namespaces-tests.factor b/core/namespaces/namespaces-tests.factor index 8dc065c04a..4c11e2389f 100644 --- a/core/namespaces/namespaces-tests.factor +++ b/core/namespaces/namespaces-tests.factor @@ -1,5 +1,5 @@ -IN: namespaces.tests USING: kernel namespaces tools.test words ; +IN: namespaces.tests H{ } clone "test-namespace" set diff --git a/core/optimizer/backend/backend.factor b/core/optimizer/backend/backend.factor index 9630f9dc70..9b70ccdd9d 100755 --- a/core/optimizer/backend/backend.factor +++ b/core/optimizer/backend/backend.factor @@ -87,7 +87,7 @@ M: node optimize-node* drop t f ; : compute-value-substitutions ( #call/#merge #return/#values -- assoc ) [ out-d>> ] [ in-d>> ] bi* 2array unify-lengths flip - [ = not ] assoc-subset >hashtable ; + [ = not ] assoc-filter >hashtable ; : cleanup-inlining ( #return/#values -- newnode changed? ) dup node-successor [ diff --git a/core/optimizer/control/control.factor b/core/optimizer/control/control.factor index 976156db77..f3f9f51991 100755 --- a/core/optimizer/control/control.factor +++ b/core/optimizer/control/control.factor @@ -75,7 +75,7 @@ USE: prettyprint M: #call-label collect-label-info* node-param label-info get at node-stack get over third tail - [ [ #label? ] subset [ node-param ] map ] keep + [ [ #label? ] filter [ node-param ] map ] keep [ node-successor #tail? ] all? 2array swap second push ; @@ -91,7 +91,7 @@ SYMBOL: potential-loops : remove-non-tail-calls ( -- ) label-info get - [ nip second [ second ] all? ] assoc-subset + [ nip second [ second ] all? ] assoc-filter [ first ] assoc-map potential-loops set ; @@ -154,14 +154,15 @@ SYMBOL: potential-loops node-literal t ] [ node-class { - { [ dup null class< ] [ drop f f ] } - { [ dup \ f class-not class< ] [ drop t t ] } - { [ dup \ f class< ] [ drop f t ] } + { [ dup null class<= ] [ drop f f ] } + { [ dup \ f class-not class<= ] [ drop t t ] } + { [ dup \ f class<= ] [ drop f t ] } [ drop f f ] } cond ] if ; -: fold-if-branch? dup node-in-d first known-boolean-value? ; +: fold-if-branch? ( node -- value ? ) + dup node-in-d first known-boolean-value? ; : fold-if-branch ( node value -- node' ) over drop-inputs >r @@ -214,7 +215,7 @@ SYMBOL: potential-loops : clone-node ( node -- newnode ) clone dup [ clone ] modify-values ; -: lift-branch +: lift-branch ( node tail -- ) over last-node clone-node dup node-in-d \ #merge out-node diff --git a/core/optimizer/def-use/def-use-tests.factor b/core/optimizer/def-use/def-use-tests.factor index 914018437a..f49ab7fcba 100755 --- a/core/optimizer/def-use/def-use-tests.factor +++ b/core/optimizer/def-use/def-use-tests.factor @@ -1,6 +1,6 @@ IN: optimizer.def-use.tests USING: inference inference.dataflow optimizer optimizer.def-use -namespaces assocs kernel sequences math tools.test words ; +namespaces assocs kernel sequences math tools.test words sets ; [ 3 { 1 1 1 } ] [ [ 1 2 3 ] dataflow compute-def-use drop @@ -11,10 +11,6 @@ namespaces assocs kernel sequences math tools.test words ; dataflow compute-def-use drop compute-dead-literals keys [ value-literal ] map ; -: subset? [ member? ] curry all? ; - -: set= 2dup subset? >r swap subset? r> and ; - [ { [ + ] } ] [ [ [ 1 2 3 ] [ + ] over drop drop ] kill-set ] unit-test diff --git a/core/optimizer/def-use/def-use.factor b/core/optimizer/def-use/def-use.factor index 66bffd9767..a2e9f88135 100755 --- a/core/optimizer/def-use/def-use.factor +++ b/core/optimizer/def-use/def-use.factor @@ -56,7 +56,7 @@ UNION: #killable : purge-invariants ( stacks -- seq ) #! Output a sequence of values which are not present in the #! same position in each sequence of the stacks sequence. - unify-lengths flip [ all-eq? not ] subset concat ; + unify-lengths flip [ all-eq? not ] filter concat ; M: #label node-def-use [ @@ -75,7 +75,7 @@ M: #branch node-def-use dup branch-def-use (node-def-use) ; : compute-dead-literals ( -- values ) - def-use get [ >r value? r> empty? and ] assoc-subset ; + def-use get [ >r value? r> empty? and ] assoc-filter ; DEFER: kill-nodes SYMBOL: dead-literals diff --git a/core/optimizer/inlining/inlining.factor b/core/optimizer/inlining/inlining.factor index 33c8244b4c..9e8f805acf 100755 --- a/core/optimizer/inlining/inlining.factor +++ b/core/optimizer/inlining/inlining.factor @@ -7,7 +7,7 @@ combinators classes classes.algebra generic.math optimizer.math.partial continuations optimizer.def-use optimizer.backend generic.standard optimizer.specializers optimizer.def-use optimizer.pattern-match generic.standard -optimizer.control kernel.private ; +optimizer.control kernel.private definitions ; IN: optimizer.inlining : remember-inlining ( node history -- ) @@ -61,12 +61,8 @@ DEFER: (flat-length) [ dispatch# node-class# ] keep specific-method ; : inline-standard-method ( node word -- node ) - 2dup dispatching-class dup [ - over +inlined+ depends-on - swap method 1quotation f splice-quot - ] [ - 3drop t - ] if ; + 2dup dispatching-class dup + [ swap method 1quotation f splice-quot ] [ 3drop t ] if ; ! Partial dispatch of math-generic words : normalize-math-class ( class -- class' ) @@ -77,7 +73,7 @@ DEFER: (flat-length) float real complex number object - } [ class< ] with find nip ; + } [ class<= ] with find nip ; : inlining-math-method ( #call word -- quot/f ) swap node-input-classes @@ -111,7 +107,7 @@ DEFER: (flat-length) : comparable? ( actual testing -- ? ) #! If actual is a subset of testing or if the two classes #! are disjoint, return t. - 2dup class< >r classes-intersect? not r> or ; + 2dup class<= >r classes-intersect? not r> or ; : optimize-predicate? ( #call -- ? ) dup node-param "predicating" word-prop dup [ @@ -132,7 +128,7 @@ DEFER: (flat-length) : evaluate-predicate ( #call -- ? ) dup node-param "predicating" word-prop >r - node-class-first r> class< ; + node-class-first r> class<= ; : optimize-predicate ( #call -- node ) #! If the predicate is followed by a branch we fold it diff --git a/core/optimizer/known-words/known-words.factor b/core/optimizer/known-words/known-words.factor index 6e1aacff44..d1dbefe26b 100755 --- a/core/optimizer/known-words/known-words.factor +++ b/core/optimizer/known-words/known-words.factor @@ -4,7 +4,7 @@ IN: optimizer.known-words USING: alien arrays generic hashtables inference.dataflow inference.class kernel assocs math math.private kernel.private sequences words parser vectors strings sbufs io namespaces -assocs quotations sequences.private io.binary io.crc32 +assocs quotations sequences.private io.binary io.streams.string layouts splitting math.intervals math.floats.private classes.tuple classes.tuple.private classes classes.algebra optimizer.def-use optimizer.backend @@ -126,8 +126,6 @@ sequences.private combinators ; \ >sbuf { string } "specializer" set-word-prop -\ crc32 { string } "specializer" set-word-prop - \ split, { string string } "specializer" set-word-prop \ memq? { array } "specializer" set-word-prop diff --git a/core/optimizer/math/math.factor b/core/optimizer/math/math.factor index ab8a1f3eda..72e64d5b95 100755 --- a/core/optimizer/math/math.factor +++ b/core/optimizer/math/math.factor @@ -96,7 +96,7 @@ optimizer.math.partial generic.standard system accessors ; : math-closure ( class -- newclass ) { null fixnum bignum integer rational float real number } - [ class< ] with find nip number or ; + [ class<= ] with find nip number or ; : fits? ( interval class -- ? ) "interval" word-prop dup @@ -108,7 +108,7 @@ optimizer.math.partial generic.standard system accessors ; dup r> at swap or ; : won't-overflow? ( interval node -- ? ) - node-in-d [ value-class* fixnum class< ] all? + node-in-d [ value-class* fixnum class<= ] all? swap fixnum fits? and ; : post-process ( class interval node -- classes intervals ) @@ -214,7 +214,7 @@ optimizer.math.partial generic.standard system accessors ; : twiddle-interval ( i1 -- i2 ) dup [ node get node-in-d - [ value-class* integer class< ] all? + [ value-class* integer class<= ] all? [ integral-closure ] when ] when ; @@ -293,7 +293,7 @@ most-negative-fixnum most-positive-fixnum [a,b] ! Removing overflow checks : remove-overflow-check? ( #call -- ? ) dup out-d>> first node-class - [ fixnum class< ] [ null eq? not ] bi and ; + [ fixnum class<= ] [ null eq? not ] bi and ; { { + [ fixnum+fast ] } @@ -356,7 +356,7 @@ most-negative-fixnum most-positive-fixnum [a,b] dup #call? [ node-param eq? ] [ 2drop f ] if ; : coerced-to-fixnum? ( #call -- ? ) - dup dup node-in-d [ node-class integer class< ] with all? + dup dup node-in-d [ node-class integer class<= ] with all? [ \ >fixnum consumed-by? ] [ drop f ] if ; { @@ -377,7 +377,7 @@ most-negative-fixnum most-positive-fixnum [a,b] : convert-rem-to-and? ( #call -- ? ) dup node-in-d { - { [ 2dup first node-class integer class< not ] [ f ] } + { [ 2dup first node-class integer class<= not ] [ f ] } { [ 2dup second node-literal integer? not ] [ f ] } { [ 2dup second node-literal power-of-2? not ] [ f ] } [ t ] diff --git a/core/optimizer/math/partial/partial.factor b/core/optimizer/math/partial/partial.factor index bbe1d0a83f..8b5e25deb1 100644 --- a/core/optimizer/math/partial/partial.factor +++ b/core/optimizer/math/partial/partial.factor @@ -85,7 +85,7 @@ PREDICATE: math-partial < word : define-math-ops ( op -- ) { fixnum bignum float } [ [ dup 3array ] [ swap method ] 2bi ] with { } map>assoc - [ nip ] assoc-subset + [ nip ] assoc-filter [ word-def peek ] assoc-map % ; SYMBOL: math-ops @@ -155,7 +155,7 @@ SYMBOL: fast-math-ops [ drop math-class-max swap specific-method >boolean ] if ; : (derived-ops) ( word assoc -- words ) - swap [ rot first eq? nip ] curry assoc-subset values ; + swap [ rot first eq? nip ] curry assoc-filter values ; : derived-ops ( word -- words ) [ 1array ] diff --git a/core/optimizer/optimizer-tests.factor b/core/optimizer/optimizer-tests.factor index 6f4ae2c1d5..7032e58b3f 100755 --- a/core/optimizer/optimizer-tests.factor +++ b/core/optimizer/optimizer-tests.factor @@ -101,7 +101,7 @@ TUPLE: pred-test ; ! regression GENERIC: void-generic ( obj -- * ) -: breakage "hi" void-generic ; +: breakage ( -- * ) "hi" void-generic ; [ t ] [ \ breakage compiled? ] unit-test [ breakage ] must-fail @@ -116,12 +116,12 @@ GENERIC: void-generic ( obj -- * ) ! another regression : constant-branch-fold-0 "hey" ; foldable -: constant-branch-fold-1 constant-branch-fold-0 "hey" = ; inline +: constant-branch-fold-1 ( -- ? ) constant-branch-fold-0 "hey" = ; inline [ 1 ] [ [ constant-branch-fold-1 [ 1 ] [ 2 ] if ] compile-call ] unit-test ! another regression : foo f ; -: bar foo 4 4 = and ; +: bar ( -- ? ) foo 4 4 = and ; [ f ] [ bar ] unit-test ! ensure identities are working in some form @@ -131,7 +131,7 @@ GENERIC: void-generic ( obj -- * ) ] unit-test ! compiling with a non-literal class failed -: -regression ; +: -regression ( class -- tuple ) ; [ t ] [ \ -regression compiled? ] unit-test @@ -254,7 +254,7 @@ TUPLE: silly-tuple a b ; [ ] [ [ ] dataflow optimize drop ] unit-test ! Make sure we have sane heuristics -: should-inline? method flat-length 10 <= ; +: should-inline? ( generic class -- ? ) method flat-length 10 <= ; [ t ] [ \ fixnum \ shift should-inline? ] unit-test [ f ] [ \ array \ equal? should-inline? ] unit-test @@ -264,7 +264,7 @@ TUPLE: silly-tuple a b ; [ t ] [ \ sbuf \ set-nth-unsafe should-inline? ] unit-test ! Regression -: lift-throw-tail-regression +: lift-throw-tail-regression ( obj -- obj str ) dup integer? [ "an integer" ] [ dup string? [ "a string" ] [ "error" throw @@ -294,7 +294,7 @@ TUPLE: silly-tuple a b ; GENERIC: generic-inline-test ( x -- y ) M: integer generic-inline-test ; -: generic-inline-test-1 +: generic-inline-test-1 ( -- x ) 1 generic-inline-test generic-inline-test @@ -319,7 +319,7 @@ M: integer generic-inline-test ; HINTS: recursive-inline-hang array ; -: recursive-inline-hang-1 +: recursive-inline-hang-1 ( -- a ) { } recursive-inline-hang ; [ t ] [ \ recursive-inline-hang-1 compiled? ] unit-test @@ -350,7 +350,7 @@ USE: sequences.private [ 2 4 6.0 0 ] [ counter-example' ] unit-test -: member-test { + - * / /i } member? ; +: member-test ( obj -- ? ) { + - * / /i } member? ; \ member-test must-infer [ ] [ \ member-test word-dataflow optimize 2drop ] unit-test diff --git a/core/optimizer/pattern-match/pattern-match.factor b/core/optimizer/pattern-match/pattern-match.factor index 5beb2555f0..51fa254a25 100755 --- a/core/optimizer/pattern-match/pattern-match.factor +++ b/core/optimizer/pattern-match/pattern-match.factor @@ -12,7 +12,7 @@ SYMBOL: @ @ get [ eq? ] [ @ set t ] if* ; : match-class ( value spec -- ? ) - >r node get swap node-class r> class< ; + >r node get swap node-class r> class<= ; : value-match? ( value spec -- ? ) { diff --git a/core/optimizer/specializers/specializers.factor b/core/optimizer/specializers/specializers.factor index b33a9e8fc2..c3702e9805 100755 --- a/core/optimizer/specializers/specializers.factor +++ b/core/optimizer/specializers/specializers.factor @@ -12,7 +12,7 @@ IN: optimizer.specializers : make-specializer ( classes -- quot ) dup length [ (picker) 2array ] 2map - [ drop object eq? not ] assoc-subset + [ drop object eq? not ] assoc-filter dup empty? [ drop [ t ] ] [ [ (make-specializer) ] { } assoc>map unclip [ swap [ f ] \ if 3array append [ ] like ] reduce diff --git a/core/parser/parser-docs.factor b/core/parser/parser-docs.factor index 23363c30ad..1dc47432d3 100755 --- a/core/parser/parser-docs.factor +++ b/core/parser/parser-docs.factor @@ -5,7 +5,7 @@ quotations namespaces compiler.units assocs ; IN: parser ARTICLE: "vocabulary-search-shadow" "Shadowing word names" -"If adding a vocabulary to the search path results in a word in another vocabulary becoming inaccessible due to the new vocabulary defining a word with the same name, a message is printed to the " { $link stdio } " stream. Except when debugging suspected name clashes, these messages can be ignored." +"If adding a vocabulary to the search path results in a word in another vocabulary becoming inaccessible due to the new vocabulary defining a word with the same name, we say that the old word has been " { $emphasis "shadowed" } "." $nl "Here is an example where shadowing occurs:" { $code @@ -13,18 +13,18 @@ $nl "USING: sequences io ;" "" ": append" - " \"foe::append calls sequences::append\" print append ;" + " \"foe::append calls sequences:append\" print append ;" "" "IN: fee" "" ": append" - " \"fee::append calls fee::append\" print append ;" + " \"fee::append calls fee:append\" print append ;" "" "IN: fox" "USE: foe" "" ": append" - " \"fox::append calls foe::append\" print append ;" + " \"fox::append calls foe:append\" print append ;" "" "\"1234\" \"5678\" append print" "" @@ -33,12 +33,13 @@ $nl } "When placed in a source file and run, the above code produces the following output:" { $code - "foe::append calls sequences::append" + "foe:append calls sequences:append" "12345678" - "fee::append calls foe::append" - "foe::append calls sequences::append" + "fee:append calls foe:append" + "foe:append calls sequences:append" "12345678" -} ; +} +"The " { $vocab-link "qualified" } " vocabulary contains some tools for helping with shadowing." ; ARTICLE: "vocabulary-search-errors" "Word lookup errors" "If the parser cannot not find a word in the current vocabulary search path, it attempts to look for the word in all loaded vocabularies. Then, one of three things happen:" @@ -51,9 +52,11 @@ ARTICLE: "vocabulary-search-errors" "Word lookup errors" ARTICLE: "vocabulary-search" "Vocabulary search path" "When the parser reads a token, it attempts to look up a word named by that token. The lookup is performed by searching each vocabulary in the search path, in order." $nl -"For a source file the vocabulary search path starts off with two vocabularies:" -{ $code "syntax\nscratchpad" } -"The " { $vocab-link "syntax" } " vocabulary consists of a set of parsing words for reading Factor data and defining new words. The " { $vocab-link "scratchpad" } " vocabulary is the default vocabulary for new word definitions." +"For a source file the vocabulary search path starts off with one vocabulary:" +{ $code "syntax" } +"The " { $vocab-link "syntax" } " vocabulary consists of a set of parsing words for reading Factor data and defining new words." +$nl +"In the listener, the " { $vocab-link "scratchpad" } " is the default vocabulary for new word definitions. However, when loading source files, there is no default vocabulary. Defining words before declaring a vocabulary with " { $link POSTPONE: IN: } " results in an error." $nl "At the interactive listener, the default search path contains many more vocabularies. Details on the default search path and parser invocation are found in " { $link "parser" } "." $nl @@ -185,7 +188,7 @@ $nl ABOUT: "parser" -: $parsing-note +: $parsing-note ( children -- ) drop "This word should only be called from parsing words." $notes ; @@ -213,7 +216,7 @@ HELP: save-location { $description "Saves the location of a definition and associates this definition with the current source file." } ; HELP: parser-notes -{ $var-description "A boolean controlling whether the parser will print various notes and warnings. Switched on by default. If a source file is being run for its effect on the " { $link stdio } " stream, this variable should be switched off, to prevent parser notes from polluting the output." } ; +{ $var-description "A boolean controlling whether the parser will print various notes and warnings. Switched on by default. If a source file is being run for its effect on " { $link output-stream } ", this variable should be switched off, to prevent parser notes from polluting the output." } ; HELP: parser-notes? { $values { "?" "a boolean" } } @@ -294,6 +297,10 @@ HELP: use HELP: in { $var-description "A variable holding the name of the current vocabulary for new definitions." } ; +HELP: current-vocab +{ $values { "str" "a vocabulary" } } +{ $description "Returns the vocabulary stored in the " { $link in } " symbol. Throws an error if the current vocabulary is " { $link f } "." } ; + HELP: (use+) { $values { "vocab" "an assoc mapping strings to words" } } { $description "Adds an assoc at the front of the search path." } @@ -323,7 +330,7 @@ HELP: set-in $parsing-note ; HELP: create-in -{ $values { "string" "a word name" } { "word" "a new word" } } +{ $values { "str" "a word name" } { "word" "a new word" } } { $description "Creates a word in the current vocabulary. Until re-defined, the word throws an error when invoked." } $parsing-note ; @@ -424,9 +431,9 @@ HELP: lexer-factory { $var-description "A variable holding a quotation with stack effect " { $snippet "( lines -- lexer )" } ". This quotation is called by the parser to create " { $link lexer } " instances. This variable can be rebound to a quotation which outputs a custom tuple delegating to " { $link lexer } " to customize syntax." } ; HELP: parse-effect -{ $values { "effect" "an instance of " { $link effect } } } +{ $values { "end" string } { "effect" "an instance of " { $link effect } } } { $description "Parses a stack effect from the current input line." } -{ $examples "This word is used by " { $link POSTPONE: ( } " to parse stack effect declarations." } +{ $examples "This word is used by " { $link POSTPONE: ( } " and " { $link POSTPONE: (( } " to parse stack effect declarations." } $parsing-note ; HELP: parse-base @@ -451,7 +458,7 @@ HELP: bootstrap-syntax HELP: with-file-vocabs { $values { "quot" quotation } } -{ $description "Calls the quotation in a scope with the initial the vocabulary search path for parsing a file. This consists of the " { $snippet "syntax" } " vocabulary together with the " { $snippet "scratchpad" } " vocabulary." } ; +{ $description "Calls the quotation in a scope with the initial the vocabulary search path for parsing a file. This consists of just the " { $snippet "syntax" } " vocabulary." } ; HELP: parse-fresh { $values { "lines" "a sequence of strings" } { "quot" quotation } } @@ -500,7 +507,7 @@ HELP: bootstrap-file HELP: eval>string { $values { "str" string } { "output" string } } -{ $description "Evaluates the Factor code in " { $snippet "str" } " with the " { $link stdio } " stream rebound to a string output stream, then outputs the resulting string." } ; +{ $description "Evaluates the Factor code in " { $snippet "str" } " with " { $link output-stream } " rebound to a string output stream, then outputs the resulting string." } ; HELP: staging-violation { $values { "word" word } } diff --git a/core/parser/parser-tests.factor b/core/parser/parser-tests.factor index ab193e1c02..df6c9dadc5 100755 --- a/core/parser/parser-tests.factor +++ b/core/parser/parser-tests.factor @@ -3,6 +3,7 @@ io.streams.string namespaces classes effects source-files assocs sequences strings io.files definitions continuations sorting classes.tuple compiler.units debugger vocabs vocabs.loader accessors ; + IN: parser.tests [ @@ -429,3 +430,60 @@ must-fail-with [ "USE: this-better-not-exist" eval ] must-fail + +[ ": foo ;" eval ] [ error>> no-current-vocab? ] must-fail-with + +[ 92 ] [ "CHAR: \\" eval ] unit-test +[ 92 ] [ "CHAR: \\\\" eval ] unit-test + +[ ] [ + { + "IN: parser.tests" + "USING: math arrays ;" + "GENERIC: change-combination" + "M: integer change-combination 1 ;" + "M: array change-combination 2 ;" + } "\n" join "change-combination-test" parse-stream drop +] unit-test + +[ ] [ + { + "IN: parser.tests" + "USING: math arrays ;" + "GENERIC# change-combination 1" + "M: integer change-combination 1 ;" + "M: array change-combination 2 ;" + } "\n" join "change-combination-test" parse-stream drop +] unit-test + +[ 2 ] [ + "change-combination" "parser.tests" lookup + "methods" word-prop assoc-size +] unit-test + +[ ] [ + 2 [ + "IN: parser.tests DEFER: twice-fails FORGET: twice-fails MIXIN: twice-fails" + "twice-fails-test" parse-stream drop + ] times +] unit-test + +[ [ ] ] [ + "IN: parser.tests : staging-problem-test-1 1 ; : staging-problem-test-2 staging-problem-test-1 ;" + "staging-problem-test" parse-stream +] unit-test + +[ t ] [ "staging-problem-test-1" "parser.tests" lookup >boolean ] unit-test + +[ t ] [ "staging-problem-test-2" "parser.tests" lookup >boolean ] unit-test + +[ [ ] ] [ + "IN: parser.tests << : staging-problem-test-1 1 ; >> : staging-problem-test-2 staging-problem-test-1 ;" + "staging-problem-test" parse-stream +] unit-test + +[ t ] [ "staging-problem-test-1" "parser.tests" lookup >boolean ] unit-test + +[ t ] [ "staging-problem-test-2" "parser.tests" lookup >boolean ] unit-test + +[ "DEFER: blah" eval ] [ error>> no-current-vocab? ] must-fail-with diff --git a/core/parser/parser.factor b/core/parser/parser.factor index 7639ebaa69..e99f2b850b 100755 --- a/core/parser/parser.factor +++ b/core/parser/parser.factor @@ -63,7 +63,7 @@ t parser-notes set-global : skip ( i seq ? -- n ) over >r - [ swap CHAR: \s eq? xor ] curry find* drop + [ swap CHAR: \s eq? xor ] curry find-from drop [ r> drop ] [ r> length ] if* ; : change-lexer-column ( lexer quot -- ) @@ -132,7 +132,7 @@ name>char-hook global [ "{" ?head-slice [ CHAR: } over index cut-slice >r >string name>char-hook get call r> - 1 tail-slice + rest-slice ] [ 6 cut-slice >r hex> r> ] if ; @@ -146,7 +146,7 @@ name>char-hook global [ : (parse-string) ( str -- m ) dup [ "\"\\" member? ] find dup [ - >r cut-slice >r % r> 1 tail-slice r> + >r cut-slice >r % r> rest-slice r> dup CHAR: " = [ drop slice-from ] [ @@ -207,7 +207,7 @@ SYMBOL: in : add-use ( seq -- ) [ use+ ] each ; : set-use ( seq -- ) - [ vocab-words ] map [ ] subset >vector use set ; + [ vocab-words ] V{ } map-as sift use set ; : check-vocab-string ( name -- name ) dup string? @@ -221,6 +221,8 @@ ERROR: unexpected want got ; PREDICATE: unexpected-eof < unexpected unexpected-got not ; +M: parsing-word stack-effect drop (( parsed -- parsed )) ; + : unexpected-eof ( word -- * ) f unexpected ; : (parse-tokens) ( accum end -- accum ) @@ -233,8 +235,16 @@ PREDICATE: unexpected-eof < unexpected : parse-tokens ( end -- seq ) 100 swap (parse-tokens) >array ; -: create-in ( string -- word ) - in get create dup set-word dup save-location ; +ERROR: no-current-vocab ; + +M: no-current-vocab summary ( obj -- ) + drop "Not in a vocabulary; IN: form required" ; + +: current-vocab ( -- str ) + in get [ no-current-vocab ] unless* ; + +: create-in ( str -- word ) + current-vocab create dup set-word dup save-location ; : CREATE ( -- word ) scan create-in ; @@ -243,7 +253,7 @@ PREDICATE: unexpected-eof < unexpected : CREATE-WORD ( -- word ) CREATE dup reset-generic ; : create-class-in ( word -- word ) - in get create + current-vocab create dup save-class-location dup predicate-word dup set-word save-location ; @@ -262,7 +272,7 @@ M: no-word-error summary : no-word ( name -- newword ) dup no-word-error boa - swap words-named [ forward-reference? not ] subset + swap words-named [ forward-reference? not ] filter word-restarts throw-restarts dup word-vocabulary (use+) ; @@ -270,7 +280,7 @@ M: no-word-error summary dup forward-reference? [ drop use get - [ at ] with map [ ] subset + [ at ] with map sift [ forward-reference? not ] find nip ] [ nip @@ -337,6 +347,11 @@ M: invalid-slot-name summary [ >r tuple parse-tuple-slots r> prefix ] } case 3dup check-slot-shadowing ; +ERROR: not-in-a-method-error ; + +M: not-in-a-method-error summary + drop "call-next-method can only be called in a method definition" ; + ERROR: staging-violation word ; M: staging-violation summary @@ -344,9 +359,7 @@ M: staging-violation summary "A parsing word cannot be used in the same file it is defined in." ; : execute-parsing ( word -- ) - new-definitions get [ - dupd first key? [ staging-violation ] when - ] when* + dup changed-definitions get key? [ staging-violation ] when execute ; : parse-step ( accum end -- accum ? ) @@ -354,7 +367,7 @@ M: staging-violation summary { [ 2dup eq? ] [ 2drop f ] } { [ dup not ] [ drop unexpected-eof t ] } { [ dup delimiter? ] [ unexpected t ] } - { [ dup parsing? ] [ nip execute-parsing t ] } + { [ dup parsing-word? ] [ nip execute-parsing t ] } [ pick push drop t ] } cond ; @@ -381,15 +394,15 @@ SYMBOL: lexer-factory lexer-factory get call (parse-lines) ; ! Parsing word utilities -: parse-effect ( -- effect ) - ")" parse-tokens "(" over member? [ - "Stack effect declaration must not contain (" throw - ] [ +: parse-effect ( end -- effect ) + parse-tokens dup { "(" "((" } intersect empty? [ { "--" } split1 dup [ ] [ "Stack effect declaration must contain --" throw ] if + ] [ + "Stack effect declaration must not contain ( or ((" throw ] if ; ERROR: bad-number ; @@ -403,22 +416,25 @@ ERROR: bad-number ; : parse-definition ( -- quot ) \ ; parse-until >quotation ; -: (:) CREATE-WORD parse-definition ; +: (:) ( -- word def ) CREATE-WORD parse-definition ; SYMBOL: current-class SYMBOL: current-generic -: (M:) - CREATE-METHOD +: with-method-definition ( quot -- parsed ) [ + >r [ "method-class" word-prop current-class set ] [ "method-generic" word-prop current-generic set ] [ ] tri - parse-definition - ] with-scope ; + r> call + ] with-scope ; inline + +: (M:) ( method def -- ) + CREATE-METHOD [ parse-definition ] with-method-definition ; : scan-object ( -- object ) - scan-word dup parsing? + scan-word dup parsing-word? [ V{ } clone swap execute first ] when ; GENERIC: expected>string ( obj -- str ) @@ -440,8 +456,7 @@ SYMBOL: bootstrap-syntax : with-file-vocabs ( quot -- ) [ - "scratchpad" in set - { "syntax" "scratchpad" } set-use + f in set { "syntax" } set-use bootstrap-syntax get [ use get push ] when* call ] with-scope ; inline @@ -506,10 +521,10 @@ SYMBOL: interactive-vocabs ] if ; : filter-moved ( assoc1 assoc2 -- seq ) - assoc-diff [ + swap assoc-diff [ drop where dup [ first ] when file get source-file-path = - ] assoc-subset keys ; + ] assoc-filter keys ; : removed-definitions ( -- assoc1 assoc2 ) new-definitions old-definitions @@ -524,7 +539,7 @@ SYMBOL: interactive-vocabs : reset-removed-classes ( -- ) removed-classes - filter-moved [ class? ] subset [ reset-class ] each ; + filter-moved [ class? ] filter [ reset-class ] each ; : fix-class-words ( -- ) #! If a class word had a compound definition which was diff --git a/core/prettyprint/backend/backend.factor b/core/prettyprint/backend/backend.factor index c9933d5be2..3df408cb10 100755 --- a/core/prettyprint/backend/backend.factor +++ b/core/prettyprint/backend/backend.factor @@ -1,14 +1,17 @@ ! Copyright (C) 2003, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: arrays byte-arrays bit-arrays generic hashtables io -assocs kernel math namespaces sequences strings sbufs io.styles -vectors words prettyprint.config prettyprint.sections quotations -io io.files math.parser effects classes.tuple -classes.tuple.private classes float-arrays ; +USING: arrays byte-arrays byte-vectors bit-arrays generic +hashtables io assocs kernel math namespaces sequences strings +sbufs io.styles vectors words prettyprint.config +prettyprint.sections quotations io io.files math.parser effects +classes.tuple math.order classes.tuple.private classes +float-arrays combinators ; IN: prettyprint.backend GENERIC: pprint* ( obj -- ) +M: effect pprint* effect>string "(" swap ")" 3append text ; + : ?effect-height ( word -- n ) stack-effect [ effect-height ] [ 0 ] if* ; @@ -25,9 +28,11 @@ GENERIC: pprint* ( obj -- ) : word-style ( word -- style ) dup "word-style" word-prop >hashtable [ [ - dup presented set - dup parsing? over delimiter? rot t eq? or or - [ bold font-style set ] when + [ presented set ] + [ + [ parsing-word? ] [ delimiter? ] [ t eq? ] tri or or + [ bold font-style set ] when + ] bi ] bind ] keep ; @@ -42,13 +47,16 @@ GENERIC: pprint* ( obj -- ) ; inline M: word pprint* - dup parsing? [ + dup parsing-word? [ \ POSTPONE: [ pprint-word ] pprint-prefix ] [ - dup "break-before" word-prop line-break - dup pprint-word - dup ?start-group dup ?end-group - "break-after" word-prop line-break + { + [ "break-before" word-prop line-break ] + [ pprint-word ] + [ ?start-group ] + [ ?end-group ] + [ "break-after" word-prop line-break ] + } cleave ] if ; M: real pprint* number>string text ; @@ -140,6 +148,7 @@ M: compose pprint-delims drop \ [ \ ] ; M: array pprint-delims drop \ { \ } ; M: byte-array pprint-delims drop \ B{ \ } ; M: bit-array pprint-delims drop \ ?{ \ } ; +M: byte-vector pprint-delims drop \ BV{ \ } ; M: float-array pprint-delims drop \ F{ \ } ; M: vector pprint-delims drop \ V{ \ } ; M: hashtable pprint-delims drop \ H{ \ } ; @@ -152,6 +161,7 @@ GENERIC: >pprint-sequence ( obj -- seq ) M: object >pprint-sequence ; M: vector >pprint-sequence ; +M: byte-vector >pprint-sequence ; M: curry >pprint-sequence ; M: compose >pprint-sequence ; M: hashtable >pprint-sequence >alist ; diff --git a/core/prettyprint/prettyprint-docs.factor b/core/prettyprint/prettyprint-docs.factor index 7cc141be22..f7f0f7ee44 100755 --- a/core/prettyprint/prettyprint-docs.factor +++ b/core/prettyprint/prettyprint-docs.factor @@ -135,7 +135,7 @@ ARTICLE: "prettyprint" "The prettyprinter" $nl "Prettyprinter words are found in the " { $vocab-link "prettyprint" } " vocabulary." $nl -"The key words to print an object to the " { $link stdio } " stream; the first two emit a trailing newline, the second two do not:" +"The key words to print an object to " { $link output-stream } "; the first two emit a trailing newline, the second two do not:" { $subsection . } { $subsection short. } { $subsection pprint } @@ -161,17 +161,17 @@ ABOUT: "prettyprint" HELP: with-pprint { $values { "obj" object } { "quot" quotation } } -{ $description "Sets up the prettyprinter and calls the quotation in a new scope. The quotation should add sections to the top-level block. When the quotation returns, the top-level block is printed to the " { $link stdio } " stream." } ; +{ $description "Sets up the prettyprinter and calls the quotation in a new scope. The quotation should add sections to the top-level block. When the quotation returns, the top-level block is printed to " { $link output-stream } "." } ; HELP: pprint { $values { "obj" object } } -{ $description "Prettyprints an object to the " { $link stdio } " stream. Output is influenced by many variables; see " { $link "prettyprint-variables" } "." } ; +{ $description "Prettyprints an object to " { $link output-stream } ". Output is influenced by many variables; see " { $link "prettyprint-variables" } "." } ; { pprint pprint* with-pprint } related-words HELP: . { $values { "obj" object } } -{ $description "Prettyprints an object to the " { $link stdio } " stream with a trailing line break. Output is influenced by many variables; see " { $link "prettyprint-variables" } "." } ; +{ $description "Prettyprints an object to " { $link output-stream } " with a trailing line break. Output is influenced by many variables; see " { $link "prettyprint-variables" } "." } ; HELP: unparse { $values { "obj" object } { "str" "Factor source string" } } @@ -179,11 +179,11 @@ HELP: unparse HELP: pprint-short { $values { "obj" object } } -{ $description "Prettyprints an object to the " { $link stdio } " stream. This word rebinds printer control variables to enforce ``shorter'' output. See " { $link "prettyprint-variables" } "." } ; +{ $description "Prettyprints an object to " { $link output-stream } ". This word rebinds printer control variables to enforce ``shorter'' output. See " { $link "prettyprint-variables" } "." } ; HELP: short. { $values { "obj" object } } -{ $description "Prettyprints an object to the " { $link stdio } " stream with a trailing line break. This word rebinds printer control variables to enforce ``shorter'' output." } ; +{ $description "Prettyprints an object to " { $link output-stream } " with a trailing line break. This word rebinds printer control variables to enforce ``shorter'' output." } ; HELP: .b { $values { "n" "an integer" } } @@ -242,8 +242,16 @@ HELP: definer { $values { "defspec" "a definition specifier" } { "start" word } { "end" "a word or " { $link f } } } { $contract "Outputs the parsing words which delimit the definition." } { $examples - { $example "USING: definitions prettyprint ;" ": foo ; \\ foo definer . ." ";\nPOSTPONE: :" } - { $example "USING: definitions prettyprint ;" "SYMBOL: foo \\ foo definer . ." "f\nPOSTPONE: SYMBOL:" } + { $example "USING: definitions prettyprint ;" + "IN: scratchpad" + ": foo ; \\ foo definer . ." + ";\nPOSTPONE: :" + } + { $example "USING: definitions prettyprint ;" + "IN: scratchpad" + "SYMBOL: foo \\ foo definer . ." + "f\nPOSTPONE: SYMBOL:" + } } { $notes "This word is used in the implementation of " { $link see } "." } ; diff --git a/core/prettyprint/prettyprint-tests.factor b/core/prettyprint/prettyprint-tests.factor index e94670992c..d5f4dd5906 100755 --- a/core/prettyprint/prettyprint-tests.factor +++ b/core/prettyprint/prettyprint-tests.factor @@ -34,23 +34,6 @@ unit-test [ "SBUF\" hello world\"" ] [ SBUF" hello world" unparse ] unit-test - -[ "( a b -- c d )" ] [ - { "a" "b" } { "c" "d" } effect>string -] unit-test - -[ "( -- c d )" ] [ - { } { "c" "d" } effect>string -] unit-test - -[ "( a b -- )" ] [ - { "a" "b" } { } effect>string -] unit-test - -[ "( -- )" ] [ - { } { } effect>string -] unit-test - [ "W{ \\ + }" ] [ [ W{ \ + } ] first unparse ] unit-test [ ] [ \ fixnum see ] unit-test @@ -114,7 +97,7 @@ unit-test [ parse-fresh drop ] with-compilation-unit [ "prettyprint.tests" lookup see - ] with-string-writer "\n" split 1 head* + ] with-string-writer "\n" split but-last ] keep = ] with-scope ; @@ -334,5 +317,13 @@ PREDICATE: predicate-see-test < integer even? ; [ \ predicate-see-test see ] with-string-writer ] unit-test +INTERSECTION: intersection-see-test sequence number ; + +[ "USING: math sequences ;\nIN: prettyprint.tests\nINTERSECTION: intersection-see-test sequence number ;\n" ] [ + [ \ intersection-see-test see ] with-string-writer +] unit-test + [ ] [ \ compose see ] unit-test [ ] [ \ curry see ] unit-test + +[ "POSTPONE: [" ] [ \ [ unparse ] unit-test diff --git a/core/prettyprint/prettyprint.factor b/core/prettyprint/prettyprint.factor index 981c8dcfd0..298fc83e9d 100755 --- a/core/prettyprint/prettyprint.factor +++ b/core/prettyprint/prettyprint.factor @@ -4,11 +4,11 @@ IN: prettyprint USING: arrays generic generic.standard assocs io kernel math namespaces sequences strings io.styles io.streams.string vectors words prettyprint.backend prettyprint.sections -prettyprint.config sorting splitting math.parser vocabs +prettyprint.config sorting splitting grouping math.parser vocabs definitions effects classes.builtin classes.tuple io.files classes continuations hashtables classes.mixin classes.union -classes.predicate classes.singleton combinators quotations -sets ; +classes.intersection classes.predicate classes.singleton +combinators quotations sets accessors ; : make-pprint ( obj quot -- block in use ) [ @@ -45,7 +45,7 @@ sets ; ] if ; : vocabs. ( in use -- ) - dupd remove [ { "syntax" "scratchpad" } member? not ] subset + dupd remove [ { "syntax" "scratchpad" } member? not ] filter use. in. ; : with-use ( obj quot -- ) @@ -145,46 +145,51 @@ GENERIC: see ( defspec -- ) definer drop pprint-word ; : stack-effect. ( word -- ) - dup parsing? over symbol? or not swap stack-effect and + [ [ parsing-word? ] [ symbol? ] bi or not ] [ stack-effect ] bi and [ effect>string comment. ] when* ; : word-synopsis ( word -- ) - dup seeing-word - dup definer. - dup pprint-word - stack-effect. ; + { + [ seeing-word ] + [ definer. ] + [ pprint-word ] + [ stack-effect. ] + } cleave ; M: word synopsis* word-synopsis ; M: simple-generic synopsis* word-synopsis ; M: standard-generic synopsis* - dup definer. - dup seeing-word - dup pprint-word - dup dispatch# pprint* - stack-effect. ; + { + [ definer. ] + [ seeing-word ] + [ pprint-word ] + [ dispatch# pprint* ] + [ stack-effect. ] + } cleave ; M: hook-generic synopsis* - dup definer. - dup seeing-word - dup pprint-word - dup "combination" word-prop hook-combination-var pprint* - stack-effect. ; + { + [ definer. ] + [ seeing-word ] + [ pprint-word ] + [ "combination" word-prop hook-combination-var pprint* ] + [ stack-effect. ] + } cleave ; M: method-spec synopsis* first2 method synopsis* ; M: method-body synopsis* - dup dup - definer. - "method-class" word-prop pprint-word - "method-generic" word-prop pprint-word ; + [ definer. ] + [ "method-class" word-prop pprint-word ] + [ "method-generic" word-prop pprint-word ] tri ; M: mixin-instance synopsis* - dup definer. - dup mixin-instance-class pprint-word - mixin-instance-mixin pprint-word ; + [ definer. ] + [ class>> pprint-word ] + [ mixin>> pprint-word ] tri ; M: pathname synopsis* pprint* ; @@ -220,7 +225,7 @@ M: word declarations. POSTPONE: flushable } [ declaration. ] with each ; -: pprint-; \ ; pprint-word ; +: pprint-; ( -- ) \ ; pprint-word ; : (see) ( spec -- ) ; +M: intersection-class see-class* + ; + M: mixin-class see-class* ( -- pprinter ) 0 1 f 0 pprinter boa ; +: ( -- pprinter ) 0 1 0 pprinter boa ; : record-vocab ( word -- ) word-vocabulary [ dup pprinter-use get set-at ] when* ; @@ -34,7 +34,7 @@ TUPLE: pprinter last-newline line-count end-printing indent ; ] [ pprinter get (>>last-newline) line-limit? [ - "..." write pprinter get end-printing>> continue + "..." write pprinter get return ] when pprinter get [ 1+ ] change-line-count drop nl do-indent @@ -171,7 +171,7 @@ M: block section-fits? ( section -- ? ) line-limit? [ drop t ] [ call-next-method ] if ; : pprint-sections ( block advancer -- ) - swap sections>> [ line-break? not ] subset + swap sections>> [ line-break? not ] filter unclip pprint-section [ dup rot call pprint-section ] with each ; inline @@ -190,9 +190,9 @@ M: block short-section ( block -- ) : if-nonempty ( block quot -- ) >r dup empty-block? [ drop ] r> if ; inline -: ( ( ( (> [ [ - >r pprinter get (>>end-printing) r> short-section - ] curry callcc0 + ] curry with-return ] with-nesting ] if-nonempty ] with-variable ; ! Long section layout algorithm : chop-break ( seq -- seq ) - dup peek line-break? [ 1 head-slice* chop-break ] when ; + dup peek line-break? [ but-last-slice chop-break ] when ; SYMBOL: prev SYMBOL: next -: split-groups [ t , ] when ; +: split-groups ( ? -- ) [ t , ] when ; M: f section-start-group? drop t ; @@ -310,7 +309,7 @@ M: f section-end-group? drop f ; 2dup 1+ swap ?nth next set swap nth dup split-before dup , split-after ] with each - ] { } make { t } split [ empty? not ] subset ; + ] { } make { t } split harvest ; : break-group? ( seq -- ? ) [ first section-fits? ] [ peek section-fits? not ] bi and ; diff --git a/core/quotations/quotations.factor b/core/quotations/quotations.factor index c0f15a9388..f3436c9a91 100755 --- a/core/quotations/quotations.factor +++ b/core/quotations/quotations.factor @@ -50,14 +50,16 @@ M: curry nth INSTANCE: curry immutable-sequence M: compose length - dup compose-first length - swap compose-second length + ; + [ compose-first length ] + [ compose-second length ] bi + ; -M: compose nth +M: compose virtual-seq compose-first ; + +M: compose virtual@ 2dup compose-first length < [ compose-first ] [ - [ compose-first length - ] keep compose-second - ] if nth ; + [ compose-first length - ] [ compose-second ] bi + ] if ; -INSTANCE: compose immutable-sequence +INSTANCE: compose virtual-sequence diff --git a/core/sequences/sequences-docs.factor b/core/sequences/sequences-docs.factor index 0dea0f43d9..86a2aa12f6 100755 --- a/core/sequences/sequences-docs.factor +++ b/core/sequences/sequences-docs.factor @@ -1,5 +1,5 @@ -USING: arrays bit-arrays help.markup help.syntax -sequences.private vectors strings sbufs kernel math ; +USING: arrays bit-arrays help.markup help.syntax math +sequences.private vectors strings sbufs kernel math.order ; IN: sequences ARTICLE: "sequences-unsafe" "Unsafe sequence operations" @@ -94,6 +94,9 @@ ARTICLE: "sequences-slices" "Subsequences and slices" { $subsection tail } { $subsection head* } { $subsection tail* } +"Removing the first or last element:" +{ $subsection rest } +{ $subsection but-last } "Taking a sequence apart into a head and a tail:" { $subsection unclip } { $subsection cut } @@ -105,6 +108,8 @@ ARTICLE: "sequences-slices" "Subsequences and slices" { $subsection } { $subsection head-slice } { $subsection tail-slice } +{ $subsection but-last-slice } +{ $subsection rest-slice } { $subsection head-slice* } { $subsection tail-slice* } "Taking a sequence apart into a head and a tail:" @@ -127,7 +132,7 @@ ARTICLE: "sequences-combinators" "Sequence combinators" { $subsection unfold } "Filtering:" { $subsection push-if } -{ $subsection subset } ; +{ $subsection filter } ; ARTICLE: "sequences-tests" "Testing sequences" "Testing for an empty sequence:" @@ -153,17 +158,17 @@ ARTICLE: "sequences-tests" "Testing sequences" ARTICLE: "sequences-search" "Searching sequences" "Finding the index of an element:" { $subsection index } -{ $subsection index* } +{ $subsection index-from } { $subsection last-index } -{ $subsection last-index* } +{ $subsection last-index-from } "Finding the start of a subsequence:" { $subsection start } { $subsection start* } "Finding the index of an element satisfying a predicate:" { $subsection find } -{ $subsection find* } +{ $subsection find-from } { $subsection find-last } -{ $subsection find-last* } ; +{ $subsection find-last-from } ; ARTICLE: "sequences-destructive" "Destructive operations" "These words modify their input, instead of creating a new sequence." @@ -186,7 +191,6 @@ $nl "Other destructive words:" { $subsection move } { $subsection exchange } -{ $subsection push-new } { $subsection copy } { $subsection replace-slice } { $see-also set-nth push pop "sequences-stacks" } ; @@ -227,6 +231,7 @@ $nl { $subsection "sequences-search" } { $subsection "sequences-comparing" } { $subsection "sequences-split" } +{ $subsection "grouping" } { $subsection "sequences-destructive" } { $subsection "sequences-stacks" } { $subsection "sequences-sorting" } @@ -500,9 +505,9 @@ HELP: find { $snippet "( elt -- ? )" } } { "i" "the index of the first match, or f" } { "elt" "the first matching element, or " { $link f } } } -{ $description "A simpler variant of " { $link find* } " where the starting index is 0." } ; +{ $description "A simpler variant of " { $link find-from } " where the starting index is 0." } ; -HELP: find* +HELP: find-from { $values { "n" "a starting index" } { "seq" sequence } { "quot" "a quotation with stack effect " @@ -513,9 +518,9 @@ HELP: find* HELP: find-last { $values { "seq" sequence } { "quot" "a quotation with stack effect " { $snippet "( elt -- ? )" } } { "i" "the index of the first match, or f" } { "elt" "the first matching element, or " { $link f } } } -{ $description "A simpler variant of " { $link find-last* } " where the starting index is one less than the length of the sequence." } ; +{ $description "A simpler variant of " { $link find-last-from } " where the starting index is one less than the length of the sequence." } ; -HELP: find-last* +HELP: find-last-from { $values { "n" "a starting index" } { "seq" sequence } { "quot" "a quotation with stack effect " { $snippet "( elt -- ? )" } } { "i" "the index of the first match, or f" } { "elt" "the first matching element, or " { $link f } } } { $description "Applies the quotation to each element of the sequence in reverse order, until it outputs a true value or the start of the sequence is reached. If the quotation yields a true value for some sequence element, the word outputs the element index and the element itself. Otherwise, the word outputs an index of f and " { $link f } " as the element." } ; @@ -530,9 +535,9 @@ HELP: all? HELP: push-if { $values { "elt" object } { "quot" "a quotation with stack effect " { $snippet "( elt -- ? )" } } { "accum" "a resizable mutable sequence" } } { $description "Adds the element at the end of the sequence if the quotation yields a true value." } -{ $notes "This word is a factor of " { $link subset } "." } ; +{ $notes "This word is a factor of " { $link filter } "." } ; -HELP: subset +HELP: filter { $values { "seq" sequence } { "quot" "a quotation with stack effect " { $snippet "( elt -- ? )" } } { "subseq" "a new sequence" } } { $description "Applies the quotation to each element in turn, and outputs a new sequence containing the elements of the original sequence for which the quotation output a true value." } ; @@ -562,9 +567,9 @@ HELP: index { $values { "obj" object } { "seq" sequence } { "n" "an index" } } { $description "Outputs the index of the first element in the sequence equal to " { $snippet "obj" } ". If no element is found, outputs " { $link f } "." } ; -{ index index* last-index last-index* member? memq? } related-words +{ index index-from last-index last-index-from member? memq? } related-words -HELP: index* +HELP: index-from { $values { "obj" object } { "i" "a start index" } { "seq" sequence } { "n" "an index" } } { $description "Outputs the index of the first element in the sequence equal to " { $snippet "obj" } ", starting the search from the " { $snippet "i" } "th element. If no element is found, outputs " { $link f } "." } ; @@ -572,7 +577,7 @@ HELP: last-index { $values { "obj" object } { "seq" sequence } { "n" "an index" } } { $description "Outputs the index of the last element in the sequence equal to " { $snippet "obj" } "; the sequence is traversed back to front. If no element is found, outputs " { $link f } "." } ; -HELP: last-index* +HELP: last-index-from { $values { "obj" object } { "i" "a start index" } { "seq" sequence } { "n" "an index" } } { $description "Outputs the index of the last element in the sequence equal to " { $snippet "obj" } ", traversing the sequence backwards starting from the " { $snippet "i" } "th element and finishing at the first. If no element is found, outputs " { $link f } "." } ; @@ -619,22 +624,7 @@ HELP: replace-slice { $errors "Throws an error if " { $snippet "new" } " contains elements whose types are not permissible in " { $snippet "seq" } "." } { $side-effects "seq" } ; -HELP: push-new -{ $values { "elt" object } { "seq" "a resizable mutable sequence" } } -{ $description "Removes all elements equal to " { $snippet "elt" } ", and adds " { $snippet "elt" } " at the end of the sequence." } -{ $examples - { $example - "USING: namespaces prettyprint sequences ;" - "V{ \"beans\" \"salsa\" \"cheese\" } \"v\" set" - "\"nachos\" \"v\" get push-new" - "\"salsa\" \"v\" get push-new" - "\"v\" get ." - "V{ \"beans\" \"cheese\" \"nachos\" \"salsa\" }" - } -} -{ $side-effects "seq" } ; - -{ push push-new prefix suffix } related-words +{ push prefix suffix } related-words HELP: suffix { $values { "seq" sequence } { "elt" object } { "newseq" sequence } } @@ -816,8 +806,8 @@ HELP: 3append HELP: subseq { $values { "from" "a non-negative integer" } { "to" "a non-negative integer" } { "seq" sequence } { "subseq" "a new sequence" } } -{ $description "Outputs a new sequence consisting of all elements starting from and including " { $snippet "m" } ", and up to but not including " { $snippet "n" } "." } -{ $errors "Throws an error if " { $snippet "m" } " or " { $snippet "n" } " is out of bounds." } ; +{ $description "Outputs a new sequence consisting of all elements starting from and including " { $snippet "from" } ", and up to but not including " { $snippet "to" } "." } +{ $errors "Throws an error if " { $snippet "from" } " or " { $snippet "to" } " is out of bounds." } ; HELP: clone-like { $values { "seq" sequence } { "exemplar" sequence } { "newseq" "a new sequence" } } @@ -834,6 +824,17 @@ HELP: tail-slice { $description "Outputs a virtual sequence sharing storage with all elements from the " { $snippet "n" } "th index until the end of the input sequence." } { $errors "Throws an error if the index is out of bounds." } ; +HELP: but-last-slice +{ $values { "seq" sequence } { "slice" "a slice" } } +{ $description "Outputs a virtual sequence sharing storage with all but the last element of the input sequence." } +{ $errors "Throws an error on an empty sequence." } ; + +HELP: rest-slice +{ $values { "seq" sequence } { "slice" "a slice" } } +{ $description "Outputs a virtual sequence sharing storage with all elements from the 1st index until the end of the input sequence." } +{ $notes "Equivalent to " { $snippet "1 tail" } } +{ $errors "Throws an error on an empty sequence." } ; + HELP: head-slice* { $values { "seq" sequence } { "n" "a non-negative integer" } { "slice" "a slice" } } { $description "Outputs a virtual sequence sharing storage with all elements of " { $snippet "seq" } " until the " { $snippet "n" } "th element from the end. In other words, it outputs a sequence of the first " { $snippet "l-n" } " elements of the input sequence, where " { $snippet "l" } " is its length." } @@ -854,6 +855,16 @@ HELP: tail { $description "Outputs a new sequence consisting of the input sequence with the first n items removed." } { $errors "Throws an error if the index is out of bounds." } ; +HELP: but-last +{ $values { "seq" sequence } { "headseq" "a new sequence" } } +{ $description "Outputs a new sequence consisting of the input sequence with the last item removed." } +{ $errors "Throws an error on an empty sequence." } ; + +HELP: rest +{ $values { "seq" sequence } { "tailseq" "a new sequence" } } +{ $description "Outputs a new sequence consisting of the input sequence with the first item removed." } +{ $errors "Throws an error on an empty sequence." } ; + HELP: head* { $values { "seq" sequence } { "n" "a non-negative integer" } { "headseq" "a new sequence" } } { $description "Outputs a new sequence consisting of all elements of " { $snippet "seq" } " until the " { $snippet "n" } "th element from the end. In other words, it outputs a sequence of the first " { $snippet "l-n" } " elements of the input sequence, where " { $snippet "l" } " is its length." } diff --git a/core/sequences/sequences-tests.factor b/core/sequences/sequences-tests.factor index 100184798c..81384a40c4 100755 --- a/core/sequences/sequences-tests.factor +++ b/core/sequences/sequences-tests.factor @@ -27,7 +27,7 @@ IN: sequences.tests [ "hello world" "aeiou" [ member? ] curry find ] unit-test [ 4 CHAR: o ] -[ 3 "hello world" "aeiou" [ member? ] curry find* ] unit-test +[ 3 "hello world" "aeiou" [ member? ] curry find-from ] unit-test [ f ] [ 3 [ ] member? ] unit-test [ f ] [ 3 [ 1 2 ] member? ] unit-test @@ -39,18 +39,18 @@ IN: sequences.tests [ 4 ] [ CHAR: x "tuvwxyz" >vector index ] unit-test -[ f ] [ CHAR: x 5 "tuvwxyz" >vector index* ] unit-test +[ f ] [ CHAR: x 5 "tuvwxyz" >vector index-from ] unit-test -[ f ] [ CHAR: a 0 "tuvwxyz" >vector index* ] unit-test +[ f ] [ CHAR: a 0 "tuvwxyz" >vector index-from ] unit-test [ f ] [ [ "Hello" { } 0.75 ] [ string? ] all? ] unit-test [ t ] [ [ ] [ ] all? ] unit-test [ t ] [ [ "hi" t 0.5 ] [ ] all? ] unit-test -[ [ 1 2 3 ] ] [ [ 1 4 2 5 3 6 ] [ 4 < ] subset ] unit-test -[ { 4 2 6 } ] [ { 1 4 2 5 3 6 } [ 2 mod 0 = ] subset ] unit-test +[ [ 1 2 3 ] ] [ [ 1 4 2 5 3 6 ] [ 4 < ] filter ] unit-test +[ { 4 2 6 } ] [ { 1 4 2 5 3 6 } [ 2 mod 0 = ] filter ] unit-test -[ [ 3 ] ] [ [ 1 2 3 ] 2 [ swap < ] curry subset ] unit-test +[ [ 3 ] ] [ [ 1 2 3 ] 2 [ swap < ] curry filter ] unit-test [ "hello world how are you" ] [ { "hello" "world" "how" "are" "you" } " " join ] @@ -169,9 +169,9 @@ unit-test [ 3 "a" ] [ { "a" "b" "c" "a" "d" } [ "a" = ] find-last ] unit-test -[ f f ] [ 100 { 1 2 3 } [ 1 = ] find* ] unit-test -[ f f ] [ 100 { 1 2 3 } [ 1 = ] find-last* ] unit-test -[ f f ] [ -1 { 1 2 3 } [ 1 = ] find* ] unit-test +[ f f ] [ 100 { 1 2 3 } [ 1 = ] find-from ] unit-test +[ f f ] [ 100 { 1 2 3 } [ 1 = ] find-last-from ] unit-test +[ f f ] [ -1 { 1 2 3 } [ 1 = ] find-from ] unit-test [ 0 ] [ { "a" "b" "c" } { "A" "B" "C" } mismatch ] unit-test @@ -187,9 +187,6 @@ unit-test [ V{ "a" "b" } V{ } ] [ { "X" "a" "b" } { "X" } drop-prefix [ >vector ] bi@ ] unit-test -[ -1 ] [ "ab" "abc" <=> ] unit-test -[ 1 ] [ "abc" "ab" <=> ] unit-test - [ 1 4 9 16 16 V{ f 1 4 9 16 } ] [ V{ } clone "cache-test" set 1 "cache-test" get [ sq ] cache-nth @@ -218,12 +215,6 @@ unit-test 3 V{ 1 2 3 4 5 6 } clone [ delete-nth ] keep ] unit-test -[ V{ 1 2 3 } ] -[ 3 V{ 1 2 } clone [ push-new ] keep ] unit-test - -[ V{ 1 2 3 } ] -[ 3 V{ 1 3 2 } clone [ push-new ] keep ] unit-test - ! erg's random tester found this one [ SBUF" 12341234" ] [ 9 dup "1234" swap push-all dup dup swap push-all diff --git a/core/sequences/sequences.factor b/core/sequences/sequences.factor index 924d9a05cb..4854ff8001 100755 --- a/core/sequences/sequences.factor +++ b/core/sequences/sequences.factor @@ -1,7 +1,8 @@ ! Copyright (C) 2005, 2008 Slava Pestov, Daniel Ehrenberg. ! See http://factorcode.org/license.txt for BSD license. +USING: kernel kernel.private slots.private math math.private +math.order ; IN: sequences -USING: kernel kernel.private slots.private math math.private ; MIXIN: sequence @@ -36,7 +37,7 @@ M: sequence lengthen 2dup length > [ set-length ] [ 2drop ] if ; : set-third ( third seq -- ) 2 swap set-nth ; inline : set-fourth ( fourth seq -- ) 3 swap set-nth ; inline -: push ( elt seq -- ) dup length swap set-nth ; +: push ( elt seq -- ) [ length ] [ set-nth ] bi ; : bounds-check? ( n seq -- ? ) length 1- 0 swap between? ; inline @@ -100,13 +101,13 @@ M: integer nth-unsafe drop ; INSTANCE: integer immutable-sequence : first2-unsafe - [ 0 swap nth-unsafe ] keep 1 swap nth-unsafe ; inline + [ 0 swap nth-unsafe 1 ] [ nth-unsafe ] bi ; inline : first3-unsafe - [ first2-unsafe ] keep 2 swap nth-unsafe ; inline + [ first2-unsafe 2 ] [ nth-unsafe ] bi ; inline : first4-unsafe - [ first3-unsafe ] keep 3 swap nth-unsafe ; inline + [ first3-unsafe 3 ] [ nth-unsafe ] bi ; inline : exchange-unsafe ( m n seq -- ) [ tuck nth-unsafe >r nth-unsafe r> ] 3keep tuck @@ -179,7 +180,7 @@ M: reversed length reversed-seq length ; INSTANCE: reversed virtual-sequence -: reverse ( seq -- newseq ) [ ] keep like ; +: reverse ( seq -- newseq ) [ ] [ like ] bi ; ! A slice of another sequence. TUPLE: slice from to seq ; @@ -201,7 +202,7 @@ ERROR: slice-error reason ; M: slice virtual-seq slice-seq ; -M: slice virtual@ [ slice-from + ] keep slice-seq ; +M: slice virtual@ [ slice-from + ] [ slice-seq ] bi ; M: slice length dup slice-to swap slice-from - ; @@ -209,10 +210,14 @@ M: slice length dup slice-to swap slice-from - ; : tail-slice ( seq n -- slice ) (tail) ; +: rest-slice ( seq -- slice ) 1 tail-slice ; + : head-slice* ( seq n -- slice ) from-end head-slice ; : tail-slice* ( seq n -- slice ) from-end tail-slice ; +: but-last-slice ( seq -- slice ) 1 head-slice* ; + INSTANCE: slice virtual-sequence ! One element repeated many times @@ -248,16 +253,20 @@ INSTANCE: repetition immutable-sequence PRIVATE> : subseq ( from to seq -- subseq ) - [ check-slice prepare-subseq (copy) ] keep like ; + [ check-slice prepare-subseq (copy) ] [ like ] bi ; : head ( seq n -- headseq ) (head) subseq ; : tail ( seq n -- tailseq ) (tail) subseq ; +: rest ( seq -- tailseq ) 1 tail ; + : head* ( seq n -- headseq ) from-end head ; : tail* ( seq n -- tailseq ) from-end tail ; +: but-last ( seq -- headseq ) 1 head* ; + : copy ( src i dst -- ) pick length >r 3dup check-copy spin 0 r> (copy) drop ; inline @@ -267,11 +276,12 @@ M: sequence clone-like M: immutable-sequence clone-like like ; -: push-all ( src dest -- ) [ length ] keep copy ; +: push-all ( src dest -- ) [ length ] [ copy ] bi ; : ((append)) ( seq1 seq2 accum -- accum ) - [ >r over length r> copy ] keep - [ 0 swap copy ] keep ; inline + [ >r over length r> copy ] + [ 0 swap copy ] + [ ] tri ; inline : (append) ( seq1 seq2 exemplar -- newseq ) >r over length over length + r> @@ -279,8 +289,8 @@ M: immutable-sequence clone-like like ; : (3append) ( seq1 seq2 seq3 exemplar -- newseq ) >r pick length pick length pick length + + r> [ - [ >r pick length pick length + r> copy ] keep - ((append)) + [ >r pick length pick length + r> copy ] + [ ((append)) ] bi ] new-like ; inline : append ( seq1 seq2 -- newseq ) over (append) ; @@ -323,7 +333,7 @@ M: immutable-sequence clone-like like ; : (find) ( seq quot quot' -- i elt ) pick >r >r (each) r> call r> finish-find ; inline -: (find*) ( n seq quot quot' -- i elt ) +: (find-from) ( n seq quot quot' -- i elt ) >r >r 2dup bounds-check? [ r> r> (find) ] [ @@ -332,7 +342,7 @@ M: immutable-sequence clone-like like ; : (monotonic) ( seq quot -- ? ) [ 2dup nth-unsafe rot 1+ rot nth-unsafe ] - swap compose curry ; inline + prepose curry ; inline : (interleave) ( n elt between quot -- ) roll zero? [ nip ] [ swapd 2slip ] if call ; inline @@ -373,14 +383,14 @@ PRIVATE> : 2all? ( seq1 seq2 quot -- ? ) (2each) all-integers? ; inline -: find* ( n seq quot -- i elt ) - [ (find-integer) ] (find*) ; inline +: find-from ( n seq quot -- i elt ) + [ (find-integer) ] (find-from) ; inline : find ( seq quot -- i elt ) [ find-integer ] (find) ; inline -: find-last* ( n seq quot -- i elt ) - [ nip find-last-integer ] (find*) ; inline +: find-last-from ( n seq quot -- i elt ) + [ nip find-last-integer ] (find-from) ; inline : find-last ( seq quot -- i elt ) [ >r 1- r> find-last-integer ] (find) ; inline @@ -394,7 +404,7 @@ PRIVATE> : pusher ( quot -- quot accum ) V{ } clone [ [ push-if ] 2curry ] keep ; inline -: subset ( seq quot -- subseq ) +: filter ( seq quot -- subseq ) over >r pusher >r each r> r> like ; inline : monotonic? ( seq quot -- ? ) @@ -414,14 +424,14 @@ PRIVATE> : index ( obj seq -- n ) [ = ] with find drop ; -: index* ( obj i seq -- n ) - rot [ = ] curry find* drop ; +: index-from ( obj i seq -- n ) + rot [ = ] curry find-from drop ; : last-index ( obj seq -- n ) [ = ] with find-last drop ; -: last-index* ( obj i seq -- n ) - rot [ = ] curry find-last* drop ; +: last-index-from ( obj i seq -- n ) + rot [ = ] curry find-last-from drop ; : contains? ( seq quot -- ? ) find drop >boolean ; inline @@ -433,7 +443,13 @@ PRIVATE> [ eq? ] with contains? ; : remove ( obj seq -- newseq ) - [ = not ] with subset ; + [ = not ] with filter ; + +: sift ( seq -- newseq ) + [ ] filter ; + +: harvest ( seq -- newseq ) + [ empty? not ] filter ; : cache-nth ( i seq quot -- elt ) 2over ?nth dup [ @@ -472,7 +488,7 @@ M: slice equal? over slice? [ sequence= ] [ 2drop f ] if ; : move ( to from seq -- ) 2over number= - [ 3drop ] [ [ nth swap ] keep set-nth ] if ; inline + [ 3drop ] [ [ nth swap ] [ set-nth ] bi ] if ; inline : (delete) ( elt store scan seq -- elt store scan seq ) 2dup length < [ @@ -483,8 +499,6 @@ M: slice equal? over slice? [ sequence= ] [ 2drop f ] if ; : delete ( elt seq -- ) 0 0 rot (delete) nip set-length drop ; -: push-new ( elt seq -- ) [ delete ] 2keep push ; - : prefix ( seq elt -- newseq ) over >r over length 1+ r> [ [ 0 swap set-nth-unsafe ] keep @@ -497,9 +511,9 @@ M: slice equal? over slice? [ sequence= ] [ 2drop f ] if ; [ 0 swap copy ] keep ] new-like ; -: peek ( seq -- elt ) dup length 1- swap nth ; +: peek ( seq -- elt ) [ length 1- ] [ nth ] bi ; -: pop* ( seq -- ) dup length 1- swap set-length ; +: pop* ( seq -- ) [ length 1- ] [ set-length ] bi ; : move-backward ( shift from to seq -- ) 2over number= [ @@ -519,7 +533,7 @@ M: slice equal? over slice? [ sequence= ] [ 2drop f ] if ; : (open-slice) ( shift from to seq ? -- ) [ - >r >r 1- r> 1- r> move-forward + >r [ 1- ] bi@ r> move-forward ] [ >r >r over - r> r> move-backward ] if ; @@ -544,7 +558,7 @@ M: slice equal? over slice? [ sequence= ] [ 2drop f ] if ; copy ; : pop ( seq -- elt ) - dup length 1- swap [ nth ] 2keep set-length ; + [ length 1- ] [ [ nth ] [ set-length ] 2bi ] bi ; : all-equal? ( seq -- ? ) [ = ] monotonic? ; @@ -609,7 +623,7 @@ M: slice equal? over slice? [ sequence= ] [ 2drop f ] if ; ] if ; : cut-slice ( seq n -- before after ) - [ head-slice ] 2keep tail-slice ; + [ head-slice ] [ tail-slice ] 2bi ; : midpoint@ ( seq -- n ) length 2/ ; inline @@ -634,10 +648,10 @@ M: slice equal? over slice? [ sequence= ] [ 2drop f ] if ; ] if ; inline : cut ( seq n -- before after ) - [ head ] 2keep tail ; + [ head ] [ tail ] 2bi ; : cut* ( seq n -- before after ) - [ head* ] 2keep tail* ; + [ head* ] [ tail* ] 2bi ; : start* ( subseq seq n -- i ) pick length pick length swap - 1+ - [ (start) ] find* + [ (start) ] find-from swap >r 3drop r> ; : start ( subseq seq -- i ) 0 start* ; inline @@ -662,10 +676,16 @@ PRIVATE> tuck tail-slice >r tail-slice r> ; : unclip ( seq -- rest first ) - dup 1 tail swap first ; + [ rest ] [ first ] bi ; + +: unclip-last ( seq -- butlast last ) + [ but-last ] [ peek ] bi ; : unclip-slice ( seq -- rest first ) - dup 1 tail-slice swap first ; + [ rest-slice ] [ first ] bi ; + +: unclip-last-slice ( seq -- butfirst last ) + [ but-last-slice ] [ peek ] bi ; : ( seq -- slice ) dup slice? [ { } like ] when 0 over length rot ; @@ -680,7 +700,7 @@ PRIVATE> [ 1+ head ] [ 0 head ] if* ; inline : trim ( seq quot -- newseq ) - [ left-trim ] keep right-trim ; inline + [ left-trim ] [ right-trim ] bi ; inline : sum ( seq -- n ) 0 [ + ] binary-reduce ; : product ( seq -- n ) 1 [ * ] binary-reduce ; diff --git a/core/sets/sets-docs.factor b/core/sets/sets-docs.factor index 8b6859260d..205d4d34bf 100644 --- a/core/sets/sets-docs.factor +++ b/core/sets/sets-docs.factor @@ -2,7 +2,7 @@ USING: kernel help.markup help.syntax sequences ; IN: sets ARTICLE: "sets" "Set-theoretic operations on sequences" -"Set-theoretic operations on sequences are defined on the " { $vocab-link "sets" } " vocabulary. These operations use hashtables internally to achieve linear running time." +"Set-theoretic operations on sequences are defined on the " { $vocab-link "sets" } " vocabulary. All of these operations use hashtables internally to achieve linear running time." $nl "Remove duplicates:" { $subsection prune } @@ -12,8 +12,32 @@ $nl { $subsection diff } { $subsection intersect } { $subsection union } +{ $subsection subset? } +{ $subsection set= } +"A word used to implement the above:" +{ $subsection unique } +"Adding elements to sets:" +{ $subsection adjoin } +{ $subsection conjoin } { $see-also member? memq? contains? all? "assocs-sets" } ; +ABOUT: "sets" + +HELP: adjoin +{ $values { "elt" object } { "seq" "a resizable mutable sequence" } } +{ $description "Removes all elements equal to " { $snippet "elt" } ", and adds " { $snippet "elt" } " at the end of the sequence." } +{ $examples + { $example + "USING: namespaces prettyprint sets ;" + "V{ \"beans\" \"salsa\" \"cheese\" } \"v\" set" + "\"nachos\" \"v\" get adjoin" + "\"salsa\" \"v\" get adjoin" + "\"v\" get ." + "V{ \"beans\" \"cheese\" \"nachos\" \"salsa\" }" + } +} +{ $side-effects "seq" } ; + HELP: unique { $values { "seq" "a sequence" } { "assoc" "an assoc" } } { $description "Outputs a new assoc where the keys and values are equal." } @@ -39,9 +63,9 @@ HELP: all-unique? HELP: diff { $values { "seq1" sequence } { "seq2" sequence } { "newseq" sequence } } -{ $description "Outputs a sequence consisting of elements present in " { $snippet "seq2" } " but not " { $snippet "seq1" } ", comparing elements for equality." +{ $description "Outputs a sequence consisting of elements present in " { $snippet "seq1" } " but not " { $snippet "seq2" } ", comparing elements for equality." } { $examples - { $example "USING: sets prettyprint ;" "{ 1 2 3 } { 2 3 4 } diff ." "{ 4 }" } + { $example "USING: sets prettyprint ;" "{ 1 2 3 } { 2 3 4 } diff ." "{ 1 }" } } ; HELP: intersect @@ -59,3 +83,11 @@ HELP: union } ; { diff intersect union } related-words + +HELP: subset? +{ $values { "seq1" sequence } { "seq2" sequence } { "?" "a boolean" } } +{ $description "Tests if every element of " { $snippet "seq1" } " is contained in " { $snippet "seq2" } "." } ; + +HELP: set= +{ $values { "seq1" sequence } { "seq2" sequence } { "?" "a boolean" } } +{ $description "Tests if both sequences contain the same elements, disregrading order and duplicates." } ; diff --git a/core/sets/sets-tests.factor b/core/sets/sets-tests.factor index 4f8c8cd103..b6e6443afa 100644 --- a/core/sets/sets-tests.factor +++ b/core/sets/sets-tests.factor @@ -11,7 +11,13 @@ IN: sets.tests [ { 2 3 } ] [ { 1 2 3 } { 2 3 4 } intersect ] unit-test [ { } ] [ { } { } diff ] unit-test -[ { 4 } ] [ { 1 2 3 } { 2 3 4 } diff ] unit-test +[ { 1 } ] [ { 1 2 3 } { 2 3 4 } diff ] unit-test [ V{ } ] [ { } { } union ] unit-test [ V{ 1 2 3 4 } ] [ { 1 2 3 } { 2 3 4 } union ] unit-test + +[ V{ 1 2 3 } ] +[ 3 V{ 1 2 } clone [ adjoin ] keep ] unit-test + +[ V{ 1 2 3 } ] +[ 3 V{ 1 3 2 } clone [ adjoin ] keep ] unit-test diff --git a/core/sets/sets.factor b/core/sets/sets.factor index 31c39c6105..5fbec9a7c8 100644 --- a/core/sets/sets.factor +++ b/core/sets/sets.factor @@ -3,10 +3,14 @@ USING: assocs hashtables kernel sequences vectors ; IN: sets +: adjoin ( elt seq -- ) [ delete ] [ push ] 2bi ; + +: conjoin ( elt assoc -- ) dupd set-at ; + : (prune) ( elt hash vec -- ) - 3dup drop key? - [ [ drop dupd set-at ] [ nip push ] [ ] 3tri ] unless - 3drop ; inline + 3dup drop key? [ 3drop ] [ + [ drop conjoin ] [ nip push ] 3bi + ] if ; inline : prune ( seq -- newseq ) [ ] [ length ] [ length ] tri @@ -16,16 +20,22 @@ IN: sets [ dup ] H{ } map>assoc ; : (all-unique?) ( elt hash -- ? ) - 2dup key? [ 2drop f ] [ dupd set-at t ] if ; + 2dup key? [ 2drop f ] [ conjoin t ] if ; : all-unique? ( seq -- ? ) dup length [ (all-unique?) ] curry all? ; : intersect ( seq1 seq2 -- newseq ) - unique [ key? ] curry subset ; + unique [ key? ] curry filter ; : diff ( seq1 seq2 -- newseq ) - swap unique [ key? not ] curry subset ; + unique [ key? not ] curry filter ; : union ( seq1 seq2 -- newseq ) append prune ; + +: subset? ( seq1 seq2 -- ? ) + unique [ key? ] curry all? ; + +: set= ( seq1 seq2 -- ? ) + [ unique ] bi@ = ; diff --git a/core/slots/deprecated/deprecated.factor b/core/slots/deprecated/deprecated.factor index 2ec8f3d0d1..3e2f899774 100755 --- a/core/slots/deprecated/deprecated.factor +++ b/core/slots/deprecated/deprecated.factor @@ -86,7 +86,7 @@ PREDICATE: slot-writer < word "writing" word-prop >boolean ; { [ over string? ] [ >r dupd r> short-slot ] } { [ over array? ] [ long-slot ] } } cond - ] 2map [ ] subset nip ; + ] 2map sift nip ; : slot-of-reader ( reader specs -- spec/f ) [ slot-spec-reader eq? ] with find nip ; diff --git a/core/slots/slots-docs.factor b/core/slots/slots-docs.factor index 29facb31f2..8cd86606bc 100755 --- a/core/slots/slots-docs.factor +++ b/core/slots/slots-docs.factor @@ -118,19 +118,11 @@ HELP: define-slot-word { $description "Defines " { $snippet "word" } " to be a simple type-checking generic word that receives the slot number on the stack as a fixnum." } $low-level-note ; -HELP: reader-effect -{ $values { "class" class } { "spec" slot-spec } { "effect" "an instance of " { $link effect } } } -{ $description "The stack effect of slot reader words is " { $snippet "( object -- value )" } "." } ; - HELP: define-reader { $values { "class" class } { "name" string } { "slot" integer } } { $description "Defines a reader word to read a slot from instances of " { $snippet "class" } "." } $low-level-note ; -HELP: writer-effect -{ $values { "class" class } { "spec" slot-spec } { "effect" "an instance of " { $link effect } } } -{ $description "The stack effect of slot writer words is " { $snippet "( value obj -- )" } "." } ; - HELP: define-writer { $values { "class" class } { "name" string } { "slot" integer } } { $description "Defines a generic word " { $snippet "writer" } " to write a new value to a slot in instances of " { $snippet "class" } "." } diff --git a/core/slots/slots.factor b/core/slots/slots.factor index e46e507b9d..cf77fb14e4 100755 --- a/core/slots/slots.factor +++ b/core/slots/slots.factor @@ -27,36 +27,28 @@ C: slot-spec >r "accessors" create dup r> "declared-effect" set-word-prop ; -: reader-effect T{ effect f { "object" } { "value" } } ; inline - : reader-word ( name -- word ) - ">>" append reader-effect create-accessor ; + ">>" append (( object -- value )) create-accessor ; : define-reader ( class slot name -- ) reader-word object reader-quot define-slot-word ; -: writer-effect T{ effect f { "value" "object" } { } } ; inline - : writer-word ( name -- word ) - "(>>" swap ")" 3append writer-effect create-accessor ; + "(>>" swap ")" 3append (( value object -- )) create-accessor ; : define-writer ( class slot name -- ) writer-word [ set-slot ] define-slot-word ; -: setter-effect T{ effect f { "object" "value" } { "object" } } ; inline - : setter-word ( name -- word ) - ">>" prepend setter-effect create-accessor ; + ">>" prepend (( object value -- object )) create-accessor ; : define-setter ( name -- ) dup setter-word dup deferred? [ [ \ over , swap writer-word , ] [ ] make define-inline ] [ 2drop ] if ; -: changer-effect T{ effect f { "object" "quot" } { "object" } } ; inline - : changer-word ( name -- word ) - "change-" prepend changer-effect create-accessor ; + "change-" prepend (( object quot -- object )) create-accessor ; : define-changer ( name -- ) dup changer-word dup deferred? [ diff --git a/core/sorting/sorting-docs.factor b/core/sorting/sorting-docs.factor index 4fa5c7974d..5827a711c8 100644 --- a/core/sorting/sorting-docs.factor +++ b/core/sorting/sorting-docs.factor @@ -1,5 +1,6 @@ -USING: sorting help.markup help.syntax kernel words math -sequences ; +USING: help.markup help.syntax kernel words math +sequences math.order ; +IN: sorting ARTICLE: "sequences-sorting" "Sorting and binary search" "Sorting and binary search combinators all take comparator quotations with stack effect " { $snippet "( elt1 elt2 -- n )" } " that order the two given elements and output a value whose sign denotes the result:" @@ -61,3 +62,5 @@ HELP: binsearch* { $description "Variant of " { $link binsearch } " which outputs the found element rather than its index in the sequence." $nl "Outputs " { $link f } " if the sequence is empty. If the sequence has at least one element, this word always outputs a sequence element." } ; + +{ <=> compare natural-sort sort-keys sort-values } related-words diff --git a/core/sorting/sorting-tests.factor b/core/sorting/sorting-tests.factor index 732aeb045d..a56c41b620 100755 --- a/core/sorting/sorting-tests.factor +++ b/core/sorting/sorting-tests.factor @@ -1,5 +1,5 @@ -USING: sorting sequences kernel math random tools.test -vectors ; +USING: sorting sequences kernel math math.order random +tools.test vectors ; IN: sorting.tests [ [ ] ] [ [ ] natural-sort ] unit-test @@ -19,10 +19,10 @@ unit-test [ 3 ] [ { 1 2 3 4 } midpoint ] unit-test -[ f ] [ 3 { } [ - ] binsearch ] unit-test -[ 0 ] [ 3 { 3 } [ - ] binsearch ] unit-test -[ 1 ] [ 2 { 1 2 3 } [ - ] binsearch ] unit-test -[ 3 ] [ 4 { 1 2 3 4 5 6 } [ - ] binsearch ] unit-test -[ 1 ] [ 3.5 { 1 2 3 4 5 6 7 8 } [ - ] binsearch ] unit-test -[ 3 ] [ 5.5 { 1 2 3 4 5 6 7 8 } [ - ] binsearch ] unit-test -[ 10 ] [ 10 20 >vector [ - ] binsearch ] unit-test +[ f ] [ 3 { } [ <=> ] binsearch ] unit-test +[ 0 ] [ 3 { 3 } [ <=> ] binsearch ] unit-test +[ 1 ] [ 2 { 1 2 3 } [ <=> ] binsearch ] unit-test +[ 3 ] [ 4 { 1 2 3 4 5 6 } [ <=> ] binsearch ] unit-test +[ 2 ] [ 3.5 { 1 2 3 4 5 6 7 8 } [ <=> ] binsearch ] unit-test +[ 4 ] [ 5.5 { 1 2 3 4 5 6 7 8 } [ <=> ] binsearch ] unit-test +[ 10 ] [ 10 20 >vector [ <=> ] binsearch ] unit-test diff --git a/core/sorting/sorting.factor b/core/sorting/sorting.factor index 5f81b17187..dac1c08e46 100755 --- a/core/sorting/sorting.factor +++ b/core/sorting/sorting.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2005, 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: arrays kernel math sequences vectors -sequences sequences.private growable ; +USING: arrays kernel math sequences vectors math.order +sequences sequences.private growable math.order ; IN: sorting DEFER: sort @@ -17,7 +17,7 @@ DEFER: sort dup slice-from 1+ swap set-slice-from ; inline : smallest ( iter1 iter2 quot -- elt ) - >r over this over this r> call 0 < + >r over this over this r> call +lt+ eq? -rot ? [ this ] keep next ; inline : (merge) ( iter1 iter2 quot accum -- ) @@ -58,13 +58,13 @@ PRIVATE> [ midpoint@ ] keep nth-unsafe ; inline : partition ( seq n -- slice ) - 1 < swap halves ? ; inline + +gt+ eq? not swap halves ? ; inline : (binsearch) ( elt quot seq -- i ) dup length 1 <= [ slice-from 2nip ] [ - [ midpoint swap call ] 3keep roll dup zero? + [ midpoint swap call ] 3keep roll dup +eq+ eq? [ drop dup slice-from swap midpoint@ + 2nip ] [ partition (binsearch) ] if ] if ; inline diff --git a/core/source-files/source-files.factor b/core/source-files/source-files.factor index 5703b631f4..36a1806e12 100755 --- a/core/source-files/source-files.factor +++ b/core/source-files/source-files.factor @@ -3,8 +3,8 @@ USING: arrays definitions generic assocs kernel math namespaces prettyprint sequences strings vectors words quotations inspector io.styles io combinators sorting splitting math.parser effects -continuations debugger io.files io.crc32 vocabs hashtables -graphs compiler.units io.encodings.utf8 accessors ; +continuations debugger io.files checksums checksums.crc32 vocabs +hashtables graphs compiler.units io.encodings.utf8 accessors ; IN: source-files SYMBOL: source-files @@ -15,11 +15,11 @@ checksum uses definitions ; : record-checksum ( lines source-file -- ) - >r lines-crc32 r> set-source-file-checksum ; + >r crc32 checksum-lines r> set-source-file-checksum ; : (xref-source) ( source-file -- pathname uses ) dup source-file-path - swap source-file-uses [ crossref? ] subset ; + swap source-file-uses [ crossref? ] filter ; : xref-source ( source-file -- ) (xref-source) crossref get add-vertex ; diff --git a/core/splitting/splitting-docs.factor b/core/splitting/splitting-docs.factor index 5000dbf5fd..472b303059 100644 --- a/core/splitting/splitting-docs.factor +++ b/core/splitting/splitting-docs.factor @@ -9,12 +9,6 @@ ARTICLE: "sequences-split" "Splitting sequences" { $subsection ?tail-slice } { $subsection split1 } { $subsection split } -"Grouping elements:" -{ $subsection group } -"A virtual sequence for grouping elements:" -{ $subsection groups } -{ $subsection } -{ $subsection } "Splitting a string into lines:" { $subsection string-lines } ; @@ -35,41 +29,6 @@ HELP: split { $description "Splits " { $snippet "seq" } " at each occurrence of an element of " { $snippet "separators" } ", and outputs an array of pieces. The pieces do not include the elements along which the sequence was split." } { $examples { $example "USING: prettyprint splitting ;" "\"hello world-how are you?\" \" -\" split ." "{ \"hello\" \"world\" \"how\" \"are\" \"you?\" }" } } ; -HELP: groups -{ $class-description "Instances are virtual sequences whose elements are fixed-length subsequences or slices of an underlying sequence. Groups are mutable and resizable if the underlying sequence is mutable and resizable, respectively." -$nl -"New groups are created by calling " { $link } " and " { $link } "." } -{ $see-also group } ; - -HELP: group -{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "array" "a sequence of sequences" } } -{ $description "Splits the sequence into groups of " { $snippet "n" } " elements and collects the groups into a new array." } -{ $notes "If the sequence length is not a multiple of " { $snippet "n" } ", the final subsequence in the list will be shorter than " { $snippet "n" } " elements." } ; - -HELP: -{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "groups" groups } } -{ $description "Outputs a virtual sequence whose elements are subsequences consisting of groups of " { $snippet "n" } " elements from the underlying sequence." } -{ $examples - { $example - "USING: arrays kernel prettyprint sequences splitting ;" - "9 >array 3 dup reverse-here concat >array ." "{ 6 7 8 3 4 5 0 1 2 }" - } -} ; - -HELP: -{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "groups" groups } } -{ $description "Outputs a virtual sequence whose elements are slices consisting of groups of " { $snippet "n" } " elements from the underlying sequence." } -{ $examples - { $example - "USING: arrays kernel prettyprint sequences splitting ;" - "9 >array 3 " - "dup [ reverse-here ] each concat >array ." - "{ 2 1 0 5 4 3 8 7 6 }" - } -} ; - -{ group } related-words - HELP: ?head { $values { "seq" "a sequence" } { "begin" "a sequence" } { "newseq" "a new sequence" } { "?" "a boolean" } } { $description "Tests if " { $snippet "seq" } " starts with " { $snippet "begin" } ". If there is a match, outputs the subrange of " { $snippet "seq" } " excluding " { $snippet "begin" } ", and " { $link t } ". If there is no match, outputs " { $snippet "seq" } " and " { $link f } "." } ; diff --git a/core/splitting/splitting-tests.factor b/core/splitting/splitting-tests.factor index 34757e6b22..0f3dbdea1b 100644 --- a/core/splitting/splitting-tests.factor +++ b/core/splitting/splitting-tests.factor @@ -1,10 +1,6 @@ USING: splitting tools.test kernel sequences arrays ; IN: splitting.tests -[ { 1 2 3 } 0 group ] must-fail - -[ { "hell" "o wo" "rld" } ] [ "hello world" 4 group ] unit-test - [ "hello" "world ." ] [ "hello world ." " " split1 ] unit-test [ "hello" "world-+." ] [ "hello-+world-+." "-+" split1 ] unit-test [ "goodbye" f ] [ "goodbye" " " split1 ] unit-test @@ -56,9 +52,3 @@ unit-test [ { "hello" "hi" } ] [ "hello\nhi" string-lines ] unit-test [ { "hello" "hi" } ] [ "hello\rhi" string-lines ] unit-test [ { "hello" "hi" } ] [ "hello\r\nhi" string-lines ] unit-test - -[ { V{ "a" "b" } V{ f f } } ] [ - V{ "a" "b" } clone 2 - 2 over set-length - >array -] unit-test diff --git a/core/splitting/splitting.factor b/core/splitting/splitting.factor index f840ca15ad..c30ea462c1 100755 --- a/core/splitting/splitting.factor +++ b/core/splitting/splitting.factor @@ -1,42 +1,9 @@ -! Copyright (C) 2005, 2007 Slava Pestov. +! Copyright (C) 2005, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel math namespaces strings arrays vectors sequences -sets ; +sets math.order accessors ; IN: splitting -TUPLE: groups seq n sliced? ; - -: check-groups 0 <= [ "Invalid group count" throw ] when ; - -: ( seq n -- groups ) - dup check-groups f groups boa ; inline - -: ( seq n -- groups ) - t over set-groups-sliced? ; - -M: groups length - dup groups-seq length swap groups-n [ + 1- ] keep /i ; - -M: groups set-length - [ groups-n * ] keep groups-seq set-length ; - -: group@ ( n groups -- from to seq ) - [ groups-n [ * dup ] keep + ] keep - groups-seq [ length min ] keep ; - -M: groups nth - [ group@ ] keep - groups-sliced? [ ] [ subseq ] if ; - -M: groups set-nth - group@ 0 swap copy ; - -M: groups like drop { } like ; - -INSTANCE: groups sequence - -: group ( seq n -- array ) { } like ; - : ?head ( seq begin -- newseq ? ) 2dup head? [ length tail t ] [ drop f ] if ; @@ -61,7 +28,7 @@ INSTANCE: groups sequence dup [ swap ] when ; : (split) ( separators n seq -- ) - 3dup rot [ member? ] curry find* drop + 3dup rot [ member? ] curry find-from drop [ [ swap subseq , ] 2keep 1+ swap (split) ] [ swap dup zero? [ drop ] [ tail ] if , drop ] if* ; inline @@ -74,7 +41,7 @@ INSTANCE: groups sequence 1array ] [ "\n" split [ - 1 head-slice* [ + but-last-slice [ "\r" ?tail drop "\r" split ] map ] keep peek "\r" split suffix concat diff --git a/core/strings/strings-tests.factor b/core/strings/strings-tests.factor index 961c8cdf6e..44e1d8859f 100755 --- a/core/strings/strings-tests.factor +++ b/core/strings/strings-tests.factor @@ -1,4 +1,4 @@ -USING: continuations kernel math namespaces strings +USING: continuations kernel math math.order namespaces strings strings.private sbufs tools.test sequences vectors arrays memory prettyprint io.streams.null ; IN: strings.tests @@ -31,6 +31,8 @@ IN: strings.tests [ t ] [ "abc" "abd" before? ] unit-test [ t ] [ "z" "abd" after? ] unit-test +[ "abc" ] [ "abc" "abd" min ] unit-test +[ "z" ] [ "z" "abd" max ] unit-test [ 0 10 "hello" subseq ] must-fail diff --git a/core/syntax/syntax-docs.factor b/core/syntax/syntax-docs.factor index a2d15d2981..db1b875eb6 100755 --- a/core/syntax/syntax-docs.factor +++ b/core/syntax/syntax-docs.factor @@ -190,7 +190,7 @@ HELP: delimiter HELP: parsing { $syntax ": foo ... ; parsing" } { $description "Declares the most recently defined word as a parsing word." } -{ $examples "In the below example, the " { $snippet "world" } " word is never called, however its body references a parsing word which executes immediately:" { $example "USE: io" "<< : hello \"Hello parser!\" print ; parsing >>\n: world hello ;" "Hello parser!" } } ; +{ $examples "In the below example, the " { $snippet "world" } " word is never called, however its body references a parsing word which executes immediately:" { $example "USE: io" "IN: scratchpad" "<< : hello \"Hello parser!\" print ; parsing >>\n: world hello ;" "Hello parser!" } } ; HELP: inline { $syntax ": foo ... ; inline" } @@ -319,9 +319,9 @@ HELP: POSTPONE: { $notes "This word is used inside parsing words to delegate further action to another parsing word, and to refer to parsing words literally from literal arrays and such." } ; HELP: : -{ $syntax ": word definition... ;" } +{ $syntax ": word ( stack -- effect ) definition... ;" } { $values { "word" "a new word to define" } { "definition" "a word definition" } } -{ $description "Defines a word in the current vocabulary." } +{ $description "Defines a word with the given stack effect in the current vocabulary. The stack effect is optional for words which only push literals on the stack." } { $examples { $code ": ask-name ( -- name )\n \"What is your name? \" write readln ;\n: greet ( name -- )\n \"Greetings, \" write print ;\n: friend ( -- )\n ask-name greet ;" } } ; { POSTPONE: : POSTPONE: ; define } related-words @@ -338,7 +338,7 @@ HELP: SYMBOL: { $syntax "SYMBOL: word" } { $values { "word" "a new word to define" } } { $description "Defines a new symbol word in the current vocabulary. Symbols push themselves on the stack when executed, and are used to identify variables (see " { $link "namespaces" } ") as well as for storing crufties in word properties (see " { $link "word-props" } ")." } -{ $examples { $example "USE: prettyprint" "SYMBOL: foo\nfoo ." "foo" } } ; +{ $examples { $example "USE: prettyprint" "IN: scratchpad" "SYMBOL: foo\nfoo ." "foo" } } ; { define-symbol POSTPONE: SYMBOL: } related-words @@ -346,7 +346,7 @@ HELP: \ { $syntax "\\ word" } { $values { "word" "a word" } } { $description "Reads the next word from the input and appends a wrapper holding the word to the parse tree. When the evaluator encounters a wrapper, it pushes the wrapped word literally on the data stack." } -{ $examples "The following two lines are equivalent:" { $code "0 \\ execute\n0 " } } ; +{ $examples "The following two lines are equivalent:" { $code "0 \\ execute\n0 " } "If " { $snippet "foo" } " is a symbol, the following two lines are equivalent:" { $code "foo" "\\ foo" } } ; HELP: DEFER: { $syntax "DEFER: word" } @@ -413,7 +413,21 @@ HELP: ( { $syntax "( inputs -- outputs )" } { $values { "inputs" "a list of tokens" } { "outputs" "a list of tokens" } } { $description "Declares the stack effect of the most recently defined word, storing a new " { $link effect } " instance in the " { $snippet "\"declared-effect\"" } " word property." } -{ $notes "Recursive words must have a declared stack effect to compile. See " { $link "effect-declaration" } " for details." } ; +{ $notes "All words except those only pushing literals on the stack must have a stack effect declaration. See " { $link "effect-declaration" } " for details." } ; + +HELP: (( +{ $syntax "(( inputs -- outputs ))" } +{ $values { "inputs" "a list of tokens" } { "outputs" "a list of tokens" } } +{ $description "Literal stack effect syntax." } +{ $notes "Useful for meta-programming with " { $link define-declared } "." } +{ $examples + { $code + "SYMBOL: my-dynamic-word" + "USING: math random words ;" + "3 { [ + ] [ - ] [ * ] [ / ] } random curry" + "(( x -- y )) define-declared" + } +} ; HELP: ! { $syntax "! comment..." } @@ -472,6 +486,7 @@ HELP: HOOK: { $examples { $example "USING: io namespaces ;" + "IN: scratchpad" "SYMBOL: transport" "TUPLE: land-transport ;" "TUPLE: air-transport ;" @@ -495,14 +510,17 @@ HELP: M: HELP: UNION: { $syntax "UNION: class members... ;" } { $values { "class" "a new class word to define" } { "members" "a list of class words separated by whitespace" } } -{ $description "Defines a union class. An object is an instance of a union class if it is an instance of one of its members." } -{ $notes "Union classes are used to associate the same method with several different classes, as well as to conveniently define predicates." } ; +{ $description "Defines a union class. An object is an instance of a union class if it is an instance of one of its members." } ; + +HELP: INTERSECTION: +{ $syntax "INTERSECTION: class participants... ;" } +{ $values { "class" "a new class word to define" } { "participants" "a list of class words separated by whitespace" } } +{ $description "Defines an intersection class. An object is an instance of a union class if it is an instance of all of its participants." } ; HELP: MIXIN: { $syntax "MIXIN: class" } { $values { "class" "a new class word to define" } } { $description "Defines a mixin class. A mixin is similar to a union class, except it has no members initially, and new members can be added with the " { $link POSTPONE: INSTANCE: } " word." } -{ $notes "Mixins classes are used to mark implementations of a protocol and define default methods." } { $examples "The " { $link sequence } " and " { $link assoc } " mixin classes." } ; HELP: INSTANCE: @@ -522,6 +540,9 @@ HELP: PREDICATE: "it satisfies the predicate" } "Each predicate must be defined as a subclass of some other class. This ensures that predicates inheriting from disjoint classes do not need to be exhaustively tested during method dispatch." +} +{ $examples + { $code "USING: math ;" "PREDICATE: positive < integer 0 > ;" } } ; HELP: TUPLE: diff --git a/core/syntax/syntax.factor b/core/syntax/syntax.factor index 566f5471f4..a0d601e2ad 100755 --- a/core/syntax/syntax.factor +++ b/core/syntax/syntax.factor @@ -1,12 +1,13 @@ ! Copyright (C) 2004, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: alien arrays bit-arrays byte-arrays +USING: alien arrays bit-arrays byte-arrays byte-vectors definitions generic hashtables kernel math namespaces parser sequences strings sbufs vectors words quotations io assocs splitting classes.tuple generic.standard generic.math classes io.files vocabs float-arrays -classes.union classes.mixin classes.predicate classes.singleton -compiler.units combinators debugger ; +classes.union classes.intersection classes.mixin +classes.predicate classes.singleton compiler.units +combinators debugger ; IN: bootstrap.syntax ! These words are defined as a top-level form, instead of with @@ -79,6 +80,7 @@ IN: bootstrap.syntax "{" [ \ } [ >array ] parse-literal ] define-syntax "V{" [ \ } [ >vector ] parse-literal ] define-syntax "B{" [ \ } [ >byte-array ] parse-literal ] define-syntax + "BV{" [ \ } [ >byte-vector ] parse-literal ] define-syntax "?{" [ \ } [ >bit-array ] parse-literal ] define-syntax "F{" [ \ } [ >float-array ] parse-literal ] define-syntax "H{" [ \ } [ >hashtable ] parse-literal ] define-syntax @@ -98,8 +100,8 @@ IN: bootstrap.syntax ] define-syntax "DEFER:" [ - scan in get create - dup old-definitions get first delete-at + scan current-vocab create + dup old-definitions get [ delete-at ] with each set-word ] define-syntax @@ -134,6 +136,10 @@ IN: bootstrap.syntax CREATE-CLASS parse-definition define-union-class ] define-syntax + "INTERSECTION:" [ + CREATE-CLASS parse-definition define-intersection-class + ] define-syntax + "MIXIN:" [ CREATE-CLASS define-mixin-class ] define-syntax @@ -152,8 +158,7 @@ IN: bootstrap.syntax ] define-syntax "SINGLETON:" [ - scan create-class-in - dup save-location define-singleton-class + CREATE-CLASS define-singleton-class ] define-syntax "TUPLE:" [ @@ -177,20 +182,29 @@ IN: bootstrap.syntax ] define-syntax "(" [ - parse-effect word + ")" parse-effect word [ swap "declared-effect" set-word-prop ] [ drop ] if* ] define-syntax + "((" [ + "))" parse-effect parsed + ] define-syntax + "MAIN:" [ scan-word in get vocab set-vocab-main ] define-syntax "<<" [ - [ \ >> parse-until >quotation ] with-compilation-unit - call + [ + \ >> parse-until >quotation + ] with-nested-compilation-unit call ] define-syntax "call-next-method" [ - current-class get literalize parsed - current-generic get literalize parsed - \ (call-next-method) parsed + current-class get current-generic get + 2dup [ word? ] both? [ + [ literalize parsed ] bi@ + \ (call-next-method) parsed + ] [ + not-in-a-method-error + ] if ] define-syntax ] with-compilation-unit diff --git a/core/threads/threads-docs.factor b/core/threads/threads-docs.factor index 3f9ff54ac8..7d8791d493 100755 --- a/core/threads/threads-docs.factor +++ b/core/threads/threads-docs.factor @@ -116,10 +116,13 @@ $nl "Other threads may interrupt the sleep by calling " { $link interrupt } "." } ; HELP: sleep -{ $values { "ms" "a non-negative integer" } } -{ $description "Suspends the current thread for " { $snippet "ms" } " milliseconds." +{ $values { "dt" "a duration" } } +{ $description "Suspends the current thread for the given duration." $nl -"Other threads may interrupt the sleep by calling " { $link interrupt } "." } ; +"Other threads may interrupt the sleep by calling " { $link interrupt } "." } +{ $examples + { $code "USING: threads calendar ;" "10 seconds sleep" } +} ; HELP: interrupt { $values { "thread" thread } } diff --git a/core/threads/threads-tests.factor b/core/threads/threads-tests.factor index 0ac607f0ed..122b7f1d59 100755 --- a/core/threads/threads-tests.factor +++ b/core/threads/threads-tests.factor @@ -1,9 +1,10 @@ USING: namespaces io tools.test threads kernel -concurrency.combinators math ; +concurrency.combinators concurrency.promises locals math +words ; IN: threads.tests 3 "x" set -namespace [ [ yield 2 "x" set ] bind ] curry "Test" spawn drop +[ 2 "x" set ] "Test" spawn drop [ 2 ] [ yield "x" get ] unit-test [ ] [ [ flush ] "flush test" spawn drop flush ] unit-test [ ] [ [ "Errors, errors" throw ] "error test" spawn drop ] unit-test @@ -27,3 +28,16 @@ yield "i" tget ] parallel-map ] unit-test + +[ [ 3 throw ] "A" suspend ] [ 3 = ] must-fail-with + +:: spawn-namespace-test ( -- ) + [let | p [ ] g [ gensym ] | + [ + g "x" set + [ "x" get p fulfill ] "B" spawn drop + ] with-scope + p ?promise g eq? + ] ; + +[ t ] [ spawn-namespace-test ] unit-test diff --git a/core/threads/threads.factor b/core/threads/threads.factor index 2f9c3a73de..c23ced42b9 100755 --- a/core/threads/threads.factor +++ b/core/threads/threads.factor @@ -1,17 +1,18 @@ ! Copyright (C) 2004, 2008 Slava Pestov. ! Copyright (C) 2005 Mackenzie Straight. ! See http://factorcode.org/license.txt for BSD license. -IN: threads USING: arrays hashtables heaps kernel kernel.private math namespaces sequences vectors continuations continuations.private -dlists assocs system combinators init boxes accessors ; +dlists assocs system combinators init boxes accessors +math.order ; +IN: threads SYMBOL: initial-thread TUPLE: thread name quot exit-handler id -continuation state +continuation state runnable mailbox variables sleep-entry ; : self ( -- thread ) 40 getenv ; inline @@ -36,11 +37,11 @@ mailbox variables sleep-entry ; : thread-registered? ( thread -- ? ) id>> threads key? ; -: check-unregistered +: check-unregistered ( thread -- thread ) dup thread-registered? [ "Thread already stopped" throw ] when ; -: check-registered +: check-registered ( thread -- thread ) dup thread-registered? [ "Thread is not running" throw ] unless ; @@ -90,9 +91,11 @@ PRIVATE> [ sleep-queue heap-peek nip millis [-] ] } cond ; +DEFER: stop + r check-registered dup r> sleep-queue heap-push* >>sleep-entry drop ; @@ -110,36 +113,57 @@ PRIVATE> [ ] while drop ; +: start ( namestack thread -- ) + [ + set-self + set-namestack + V{ } set-catchstack + { } set-retainstack + { } set-datastack + self quot>> [ call stop ] call-clear + ] 2 (throw) ; + +DEFER: next + +: no-runnable-threads ( -- * ) + ! We should never be in a state where the only threads + ! are sleeping; the I/O wait thread is always runnable. + ! However, if it dies, we handle this case + ! semi-gracefully. + ! + ! And if sleep-time outputs f, there are no sleeping + ! threads either... so WTF. + sleep-time [ die 0 ] unless* (sleep) next ; + +: (next) ( arg thread -- * ) + f >>state + dup set-self + dup runnable>> [ + continuation>> box> continue-with + ] [ + t >>runnable start + ] if ; + : next ( -- * ) expire-sleep-loop run-queue dup dlist-empty? [ - ! We should never be in a state where the only threads - ! are sleeping; the I/O wait thread is always runnable. - ! However, if it dies, we handle this case - ! semi-gracefully. - ! - ! And if sleep-time outputs f, there are no sleeping - ! threads either... so WTF. - drop sleep-time [ die 0 ] unless* (sleep) next + drop no-runnable-threads ] [ - pop-back - dup array? [ first2 ] [ f swap ] if dup set-self - f >>state - continuation>> box> - continue-with + pop-back dup array? [ first2 ] [ f swap ] if (next) ] if ; PRIVATE> : stop ( -- ) - self dup exit-handler>> call - unregister-thread next ; + self [ exit-handler>> call ] [ unregister-thread ] bi next ; : suspend ( quot state -- obj ) [ - self continuation>> >box - self (>>state) - self swap call next + >r + >r self swap call + r> self (>>state) + r> self continuation>> >box + next ] callcc1 2nip ; inline : yield ( -- ) [ resume ] f suspend drop ; @@ -152,7 +176,7 @@ M: integer sleep-until M: f sleep-until drop [ drop ] "interrupt" suspend drop ; -GENERIC: sleep ( ms -- ) +GENERIC: sleep ( dt -- ) M: real sleep millis + >integer sleep-until ; @@ -165,16 +189,7 @@ M: real sleep ] when drop ; : (spawn) ( thread -- ) - [ - resume-now [ - dup set-self - dup register-thread - V{ } set-catchstack - { } set-retainstack - >r { } set-datastack r> - quot>> [ call stop ] call-clear - ] 1 (throw) - ] "spawn" suspend 2drop ; + [ register-thread ] [ namestack swap resume-with ] bi ; : spawn ( quot name -- thread ) [ (spawn) ] keep ; @@ -183,8 +198,8 @@ M: real sleep >r [ [ ] [ ] while ] curry r> spawn ; : in-thread ( quot -- ) - >r datastack namestack r> - [ >r set-namestack set-datastack r> call ] 3curry + >r datastack r> + [ >r set-datastack r> call ] 2curry "Thread" spawn drop ; GENERIC: error-in-thread ( error thread -- ) @@ -198,6 +213,7 @@ GENERIC: error-in-thread ( error thread -- ) initial-thread global [ drop f "Initial" ] cache >>continuation + t >>runnable f >>state dup register-thread set-self ; diff --git a/core/vocabs/loader/loader.factor b/core/vocabs/loader/loader.factor index 1489750154..04cf9a2ac1 100755 --- a/core/vocabs/loader/loader.factor +++ b/core/vocabs/loader/loader.factor @@ -50,18 +50,18 @@ H{ } clone root-cache set-global SYMBOL: load-help? -: source-was-loaded t swap set-vocab-source-loaded? ; +: source-was-loaded ( vocab -- ) t swap set-vocab-source-loaded? ; -: source-wasn't-loaded f swap set-vocab-source-loaded? ; +: source-wasn't-loaded ( vocab -- ) f swap set-vocab-source-loaded? ; : load-source ( vocab -- ) [ source-wasn't-loaded ] keep [ vocab-source-path [ bootstrap-file ] when* ] keep source-was-loaded ; -: docs-were-loaded t swap set-vocab-docs-loaded? ; +: docs-were-loaded ( vocab -- ) t swap set-vocab-docs-loaded? ; -: docs-weren't-loaded f swap set-vocab-docs-loaded? ; +: docs-weren't-loaded ( vocab -- ) f swap set-vocab-docs-loaded? ; : load-docs ( vocab -- ) load-help? get [ diff --git a/core/vocabs/vocabs.factor b/core/vocabs/vocabs.factor index 24a00189e4..57951e8642 100755 --- a/core/vocabs/vocabs.factor +++ b/core/vocabs/vocabs.factor @@ -76,14 +76,14 @@ SYMBOL: load-vocab-hook ! ( name -- ) : words-named ( str -- seq ) dictionary get values [ vocab-words at ] with map - [ ] subset ; + sift ; : child-vocab? ( prefix name -- ? ) 2dup = pick empty? or [ 2drop t ] [ swap CHAR: . suffix head? ] if ; : child-vocabs ( vocab -- seq ) - vocab-name vocabs [ child-vocab? ] with subset ; + vocab-name vocabs [ child-vocab? ] with filter ; TUPLE: vocab-link name ; diff --git a/core/words/words-docs.factor b/core/words/words-docs.factor index f259378f7e..9699844192 100755 --- a/core/words/words-docs.factor +++ b/core/words/words-docs.factor @@ -197,7 +197,7 @@ HELP: execute ( word -- ) { $values { "word" word } } { $description "Executes a word." } { $examples - { $example "USING: kernel io words ;" ": twice dup execute execute ;\n: hello \"Hello\" print ;\n\\ hello twice" "Hello\nHello" } + { $example "USING: kernel io words ;" "IN: scratchpad" ": twice dup execute execute ;\n: hello \"Hello\" print ;\n\\ hello twice" "Hello\nHello" } } ; HELP: word-props ( word -- props ) @@ -278,7 +278,7 @@ HELP: reset-generic $low-level-note { $side-effects "word" } ; -HELP: +HELP: ( name vocab -- word ) { $values { "name" string } { "vocab" string } { "word" word } } { $description "Allocates an uninterned word with the specified name and vocabulary, and a blank word property hashtable. User code should call " { $link gensym } " to create uninterned words and " { $link create } " to create interned words." } ; @@ -300,7 +300,7 @@ HELP: word HELP: set-word { $values { "word" word } } -{ $description "Sets the recently defined word. Usually you would call " { $link save-location } " on a newly-defined word instead, which will in turn call this word." } ; +{ $description "Sets the recently defined word." } ; HELP: lookup { $values { "name" string } { "vocab" string } { "word" "a word or " { $link f } } } @@ -334,7 +334,7 @@ HELP: bootstrap-word { $values { "word" word } { "target" word } } { $description "Looks up a word with the same name and vocabulary as the given word, performing a transformation to handle parsing words in the target dictionary. Used during bootstrap to transfer host words to the target dictionary." } ; -HELP: parsing? +HELP: parsing-word? { $values { "obj" object } { "?" "a boolean" } } { $description "Tests if an object is a parsing word declared by " { $link POSTPONE: parsing } "." } { $notes "Outputs " { $link f } " if the object is not a word." } ; diff --git a/core/words/words-tests.factor b/core/words/words-tests.factor index 694e54cf96..2a164ab11d 100755 --- a/core/words/words-tests.factor +++ b/core/words/words-tests.factor @@ -68,7 +68,7 @@ FORGET: another-forgotten : foe fee ; : fie foe ; -[ t ] [ \ fee usage [ word? ] subset empty? ] unit-test +[ t ] [ \ fee usage [ word? ] filter empty? ] unit-test [ t ] [ \ foe usage empty? ] unit-test [ f ] [ \ foe crossref get key? ] unit-test @@ -80,7 +80,7 @@ FORGET: foe ] unit-test [ t ] [ - \ * usage [ word? ] subset [ crossref? ] all? + \ * usage [ word? ] filter [ crossref? ] all? ] unit-test DEFER: calls-a-gensym diff --git a/core/words/words.factor b/core/words/words.factor index 3466544eef..22d22d83fb 100755 --- a/core/words/words.factor +++ b/core/words/words.factor @@ -2,7 +2,8 @@ ! See http://factorcode.org/license.txt for BSD license. USING: arrays definitions graphs assocs kernel kernel.private slots.private math namespaces sequences strings vectors sbufs -quotations assocs hashtables sorting words.private vocabs ; +quotations assocs hashtables sorting words.private vocabs +math.order sets ; IN: words : word ( -- word ) \ word get-global ; @@ -101,7 +102,7 @@ SYMBOL: compiled-crossref compiled-crossref global [ H{ } assoc-like ] change-at : compiled-xref ( word dependencies -- ) - [ drop compiled-crossref? ] assoc-subset + [ drop crossref? ] assoc-filter 2dup "compiled-uses" set-word-prop compiled-crossref get add-vertex* ; @@ -113,46 +114,31 @@ compiled-crossref global [ H{ } assoc-like ] change-at dup compiled-unxref compiled-crossref get delete-at ; -SYMBOL: +inlined+ -SYMBOL: +called+ - : compiled-usage ( word -- assoc ) compiled-crossref get at ; -: compiled-usages ( words -- seq ) - [ [ dup ] H{ } map>assoc dup ] keep [ - compiled-usage [ nip +inlined+ eq? ] assoc-subset update - ] with each keys ; +: compiled-usages ( assoc -- seq ) + clone [ + dup [ + [ + [ compiled-usage ] dip + +inlined+ eq? [ + [ nip +inlined+ eq? ] assoc-filter + ] when + ] dip swap update + ] curry assoc-each + ] keep keys ; - - -: redefined ( word -- ) - H{ } clone visited [ (redefined) ] with-variable ; +M: object redefined drop ; : define ( word def -- ) [ ] like over unxref over redefined over set-word-def - dup changed-definition + dup +inlined+ changed-definition dup crossref? [ dup xref ] when drop ; : define-declared ( word def effect -- ) @@ -174,7 +160,9 @@ PRIVATE> : define-symbol ( word -- ) dup [ ] curry define-inline ; -: reset-word ( word -- ) +GENERIC: reset-word ( word -- ) + +M: word reset-word { "unannotated-def" "parsing" "inline" "foldable" "flushable" @@ -217,8 +205,7 @@ ERROR: bad-create name vocab ; : constructor-word ( name vocab -- word ) >r "<" swap ">" 3append r> create ; -: parsing? ( obj -- ? ) - dup word? [ "parsing" word-prop ] [ drop f ] if ; +PREDICATE: parsing-word < word "parsing" word-prop ; : delimiter? ( obj -- ? ) dup word? [ "delimiter" word-prop ] [ drop f ] if ; @@ -241,6 +228,6 @@ M: word hashcode* M: word literalize ; -: ?word-name dup word? [ word-name ] when ; +: ?word-name ( word -- name ) dup word? [ word-name ] when ; : xref-words ( -- ) all-words [ xref ] each ; diff --git a/extra/alarms/alarms-docs.factor b/extra/alarms/alarms-docs.factor index 80a0c14079..b25df236c9 100755 --- a/extra/alarms/alarms-docs.factor +++ b/extra/alarms/alarms-docs.factor @@ -2,7 +2,7 @@ IN: alarms USING: help.markup help.syntax calendar quotations ; HELP: alarm -{ $class-description "An alarm. Cancel passed to " { $link cancel-alarm } "." } ; +{ $class-description "An alarm. Can be passed to " { $link cancel-alarm } "." } ; HELP: add-alarm { $values { "quot" quotation } { "time" timestamp } { "frequency" "a " { $link duration } " or " { $link f } } { "alarm" alarm } } diff --git a/extra/alarms/alarms.factor b/extra/alarms/alarms.factor index bd1f02c44c..ddc1d34121 100755 --- a/extra/alarms/alarms.factor +++ b/extra/alarms/alarms.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: arrays calendar combinators generic init kernel math namespaces sequences heaps boxes threads debugger quotations -assocs ; +assocs math.order ; IN: alarms TUPLE: alarm quot time interval entry ; diff --git a/extra/alias/alias.factor b/extra/alias/alias.factor new file mode 100755 index 0000000000..f468340e53 --- /dev/null +++ b/extra/alias/alias.factor @@ -0,0 +1,16 @@ +USING: words quotations kernel effects sequences parser ; +IN: alias + +PREDICATE: alias < word "alias" word-prop ; + +M: alias reset-word + [ call-next-method ] [ f "alias" set-word-prop ] bi ; + +M: alias stack-effect + word-def first stack-effect ; + +: define-alias ( new old -- ) + [ 1quotation define-inline ] + [ drop t "alias" set-word-prop ] 2bi ; + +: ALIAS: CREATE-WORD scan-word define-alias ; parsing diff --git a/extra/ascii/ascii-tests.factor b/extra/ascii/ascii-tests.factor index b2b13b1d78..7dacce734b 100644 --- a/extra/ascii/ascii-tests.factor +++ b/extra/ascii/ascii-tests.factor @@ -1,5 +1,5 @@ -IN: ascii.tests USING: ascii tools.test sequences kernel math ; +IN: ascii.tests [ t ] [ CHAR: a letter? ] unit-test [ f ] [ CHAR: A letter? ] unit-test @@ -8,7 +8,6 @@ USING: ascii tools.test sequences kernel math ; [ t ] [ CHAR: 0 digit? ] unit-test [ f ] [ CHAR: x digit? ] unit-test - [ 4 ] [ 0 "There are Four Upper Case characters" [ LETTER? [ 1+ ] when ] each diff --git a/extra/ascii/ascii.factor b/extra/ascii/ascii.factor index e4a365cd1b..30b801a950 100755 --- a/extra/ascii/ascii.factor +++ b/extra/ascii/ascii.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2005, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: sequences math kernel ; +USING: kernel math math.order sequences ; IN: ascii : blank? ( ch -- ? ) " \t\n\r" member? ; inline diff --git a/extra/asn1/asn1-tests.factor b/extra/asn1/asn1-tests.factor index 329ba8256d..1908e28d39 100755 --- a/extra/asn1/asn1-tests.factor +++ b/extra/asn1/asn1-tests.factor @@ -1,16 +1,16 @@ USING: asn1 asn1.ldap io io.streams.string tools.test ; [ 6 ] [ - "\u000002\u000001\u000006" [ asn-syntax read-ber ] with-stream + "\u000002\u000001\u000006" [ asn-syntax read-ber ] with-input-stream ] unit-test [ "testing" ] [ - "\u000004\u000007testing" [ asn-syntax read-ber ] with-stream + "\u000004\u000007testing" [ asn-syntax read-ber ] with-input-stream ] unit-test [ { 1 { 3 "Administrator" "ad_is_bogus" } } ] [ "0$\u000002\u000001\u000001`\u00001f\u000002\u000001\u000003\u000004\rAdministrator\u000080\u00000bad_is_bogus" - [ asn-syntax read-ber ] with-stream + [ asn-syntax read-ber ] with-input-stream ] unit-test [ diff --git a/extra/asn1/asn1.factor b/extra/asn1/asn1.factor index 32e3602f8f..7b46aa87de 100644 --- a/extra/asn1/asn1.factor +++ b/extra/asn1/asn1.factor @@ -48,7 +48,7 @@ SYMBOL: elements TUPLE: element syntax id tag tagclass encoding contentlength newobj objtype ; -: element new ; +: ( -- element ) element new ; : set-id ( -- boolean ) read1 dup elements get set-element-id ; @@ -98,7 +98,7 @@ DEFER: read-ber SYMBOL: end -: (read-array) ( stream -- ) +: (read-array) ( -- ) elements get element-id [ elements get element-syntax read-ber dup end = [ drop ] [ , (read-array) ] if @@ -106,7 +106,7 @@ SYMBOL: end : read-array ( -- array ) [ (read-array) ] { } make ; -: set-case ( -- ) +: set-case ( -- object ) elements get element-newobj elements get element-objtype { { "boolean" [ "\0" = not ] } diff --git a/extra/assocs/lib/lib.factor b/extra/assocs/lib/lib.factor index 92fb9aac81..c3e487a9fc 100755 --- a/extra/assocs/lib/lib.factor +++ b/extra/assocs/lib/lib.factor @@ -1,10 +1,7 @@ USING: arrays assocs kernel vectors sequences namespaces -random math.parser ; +random math.parser math fry ; IN: assocs.lib -: >set ( seq -- hash ) - [ dup ] H{ } map>assoc ; - : ref-at ( table key -- value ) swap at ; : put-at* ( table key value -- ) swap rot set-at ; @@ -38,8 +35,13 @@ IN: assocs.lib : insert ( value variable -- ) namespace insert-at ; : generate-key ( assoc -- str ) - >r 256 random-bits >hex r> + >r 32 random-bits >hex r> 2dup key? [ nip generate-key ] [ drop ] if ; : set-at-unique ( value assoc -- key ) dup generate-key [ swap set-at ] keep ; + +: histogram ( assoc quot -- assoc' ) + H{ } clone [ + swap [ change-at ] 2curry assoc-each + ] keep ; diff --git a/extra/bank/authors.txt b/extra/bank/authors.txt new file mode 100644 index 0000000000..e9c193bac7 --- /dev/null +++ b/extra/bank/authors.txt @@ -0,0 +1 @@ +Alex Chapman diff --git a/extra/bank/bank-tests.factor b/extra/bank/bank-tests.factor new file mode 100644 index 0000000000..2aa31f1e85 --- /dev/null +++ b/extra/bank/bank-tests.factor @@ -0,0 +1,34 @@ +USING: accessors arrays bank calendar kernel math math.functions namespaces tools.test tools.walker ; +IN: bank.tests + +SYMBOL: my-account +[ + "Alex's Take Over the World Fund" 0.07 1 2007 11 1 6101.94 open-account my-account set + [ 6137 ] [ my-account get 2007 12 2 process-to-date balance>> round >integer ] unit-test + [ 6137 ] [ my-account get 2007 12 2 process-to-date balance>> round >integer ] unit-test +] with-scope + +[ + "Petty Cash" 0.07 1 2006 12 1 10962.18 open-account my-account set + [ 11027 ] [ my-account get 2007 1 2 process-to-date balance>> round >integer ] unit-test +] with-scope + +[ + "Saving to buy a pony" 0.0725 1 2008 3 3 11106.24 open-account my-account set + [ 8416 ] [ + my-account get [ + 2008 3 11 -750 "Need to buy food" , + 2008 3 25 -500 "Going to a party" , + 2008 4 8 -800 "Losing interest in the pony..." , + 2008 4 8 -700 "Buying a rocking horse" , + ] { } make inserting-transactions balance>> round >integer + ] unit-test +] with-scope + +[ + [ 6781 ] [ + "..." 0.07 1 2007 4 10 4398.50 open-account + 2007 10 26 2000 "..." 1array inserting-transactions + 2008 4 10 process-to-date dup balance>> swap unpaid-interest>> + round >integer + ] unit-test +] with-scope diff --git a/extra/bank/bank.factor b/extra/bank/bank.factor new file mode 100644 index 0000000000..a409c97815 --- /dev/null +++ b/extra/bank/bank.factor @@ -0,0 +1,69 @@ +! Copyright (C) 2008 Alex Chapman +! See http://factorcode.org/license.txt for BSD license. +USING: accessors calendar kernel math math.order money sequences ; +IN: bank + +TUPLE: account name interest-rate interest-payment-day opening-date transactions unpaid-interest interest-last-paid ; + +: ( name interest-rate interest-payment-day opening-date -- account ) + V{ } clone 0 pick account boa ; + +TUPLE: transaction date amount description ; +C: transaction + +: >>transaction ( account transaction -- account ) + over transactions>> push ; + +: total ( transactions -- balance ) + 0 [ amount>> + ] reduce ; + +: balance>> ( account -- balance ) transactions>> total ; + +: open-account ( name interest-rate interest-payment-day opening-date opening-balance -- account ) + >r [ ] keep r> "Account Opened" >>transaction ; + +: daily-rate ( yearly-rate day -- daily-rate ) + days-in-year / ; + +: daily-rate>> ( account date -- rate ) + [ interest-rate>> ] dip daily-rate ; + +: transactions-on-date ( account date -- transactions ) + [ before? ] curry filter ; + +: balance-on-date ( account date -- balance ) + transactions-on-date total ; + +: pay-interest ( account date -- ) + over unpaid-interest>> "Interest Credit" + >>transaction 0 >>unpaid-interest drop ; + +: interest-payment-day? ( account date -- ? ) + day>> swap interest-payment-day>> = ; + +: ?pay-interest ( account date -- ) + 2dup interest-payment-day? [ pay-interest ] [ 2drop ] if ; + +: unpaid-interest+ ( account amount -- account ) + over unpaid-interest>> + >>unpaid-interest ; + +: accumulate-interest ( account date -- ) + [ dupd daily-rate>> over balance>> * unpaid-interest+ ] keep + >>interest-last-paid drop ; + +: process-day ( account date -- ) + 2dup accumulate-interest ?pay-interest ; + +: each-day ( quot start end -- ) + 2dup before? [ + >r dup >r over >r swap call r> r> 1 days time+ r> each-day + ] [ + 3drop + ] if ; + +: process-to-date ( account date -- account ) + over interest-last-paid>> 1 days time+ + [ dupd process-day ] spin each-day ; + +: inserting-transactions ( account transactions -- account ) + [ [ date>> process-to-date ] keep >>transaction ] each ; diff --git a/extra/bank/summary.txt b/extra/bank/summary.txt new file mode 100644 index 0000000000..efd88787a5 --- /dev/null +++ b/extra/bank/summary.txt @@ -0,0 +1 @@ +Bank account simulator for compound interest calculated daily and paid monthly diff --git a/extra/base64/base64.factor b/extra/base64/base64.factor index 074640c536..600a8f4c3d 100644 --- a/extra/base64/base64.factor +++ b/extra/base64/base64.factor @@ -1,5 +1,5 @@ USING: kernel math sequences namespaces io.binary splitting - strings hashtables ; +grouping strings hashtables ; IN: base64 bignum , @@ -21,9 +22,9 @@ IN: benchmark.dispatch2 1 [ + ] curry , ] { } make ; -: don't-flush-me drop ; +: don't-flush-me ( obj -- ) drop ; -: dispatch-test +: dispatch-test ( -- ) 1000000 sequences [ [ 0 swap nth don't-flush-me ] each ] curry times ; diff --git a/extra/benchmark/dispatch3/dispatch3.factor b/extra/benchmark/dispatch3/dispatch3.factor index 409d6d4a0f..4e4712a1a9 100644 --- a/extra/benchmark/dispatch3/dispatch3.factor +++ b/extra/benchmark/dispatch3/dispatch3.factor @@ -1,5 +1,5 @@ -USING: sequences math mirrors splitting kernel namespaces -assocs alien.syntax columns ; +USING: sequences math mirrors splitting grouping +kernel namespaces assocs alien.syntax columns ; IN: benchmark.dispatch3 GENERIC: g ( obj -- str ) @@ -14,7 +14,7 @@ M: number g drop "number" ; M: object g drop "object" ; -: objects +: objects ( -- seq ) [ H{ } , \ + , @@ -42,7 +42,7 @@ M: object g drop "object" ; ALIEN: 1234 , ] { } make ; -: dispatch-test +: dispatch-test ( -- ) 2000000 objects [ [ g drop ] each ] curry times ; MAIN: dispatch-test diff --git a/extra/benchmark/dispatch4/dispatch4.factor b/extra/benchmark/dispatch4/dispatch4.factor index a92772a923..2f989b7723 100755 --- a/extra/benchmark/dispatch4/dispatch4.factor +++ b/extra/benchmark/dispatch4/dispatch4.factor @@ -2,7 +2,7 @@ USING: kernel.private kernel sequences math combinators sequences.private ; IN: benchmark.dispatch4 -: foobar-1 +: foobar-1 ( n -- val ) dup { [ 0 eq? [ 0 ] [ "x" ] if ] [ 1 eq? [ 1 ] [ "x" ] if ] @@ -26,7 +26,7 @@ IN: benchmark.dispatch4 [ 19 eq? [ 19 ] [ "x" ] if ] } dispatch ; -: foobar-2 +: foobar-2 ( n -- val ) { { [ dup 0 eq? ] [ drop 0 ] } { [ dup 1 eq? ] [ drop 1 ] } @@ -50,14 +50,14 @@ IN: benchmark.dispatch4 { [ dup 19 eq? ] [ drop 19 ] } } cond ; -: foobar-test-1 +: foobar-test-1 ( -- ) 20000000 [ 20 [ foobar-1 drop ] each ] times ; -: foobar-test-2 +: foobar-test-2 ( -- ) 20000000 [ 20 [ foobar-2 drop diff --git a/extra/benchmark/dispatch5/dispatch5.factor b/extra/benchmark/dispatch5/dispatch5.factor index a2f096695b..727d288765 100755 --- a/extra/benchmark/dispatch5/dispatch5.factor +++ b/extra/benchmark/dispatch5/dispatch5.factor @@ -65,7 +65,7 @@ TUPLE: x30 ; INSTANCE: x30 g : my-classes ( -- seq ) - "benchmark.dispatch5" words [ tuple-class? ] subset ; + "benchmark.dispatch5" words [ tuple-class? ] filter ; : a-bunch-of-objects ( -- seq ) my-classes [ new ] map ; diff --git a/extra/benchmark/fasta/fasta.factor b/extra/benchmark/fasta/fasta.factor index 215b677e16..015f762c7b 100755 --- a/extra/benchmark/fasta/fasta.factor +++ b/extra/benchmark/fasta/fasta.factor @@ -81,7 +81,7 @@ HINTS: random fixnum ; write-description [let | k! [ 0 ] alu [ ] | [| len | k len alu make-repeat-fasta k! ] split-lines - ] with-locals ; inline + ] ; inline : fasta ( n out -- ) homo-sapiens make-cumulative @@ -103,8 +103,8 @@ HINTS: random fixnum ; drop ] with-file-writer - ] with-locals ; + ] ; -: run-fasta 2500000 reverse-complement-in fasta ; +: run-fasta ( -- ) 2500000 reverse-complement-in fasta ; MAIN: run-fasta diff --git a/extra/benchmark/fib1/fib1.factor b/extra/benchmark/fib1/fib1.factor index ad7fb0e7e1..20f18032f0 100644 --- a/extra/benchmark/fib1/fib1.factor +++ b/extra/benchmark/fib1/fib1.factor @@ -9,6 +9,6 @@ IN: benchmark.fib1 swap 1 fixnum-fast fast-fixnum-fib fixnum+fast ] if ; -: fib-main 34 fast-fixnum-fib 9227465 assert= ; +: fib-main ( -- ) 34 fast-fixnum-fib 9227465 assert= ; MAIN: fib-main diff --git a/extra/benchmark/fib2/fib2.factor b/extra/benchmark/fib2/fib2.factor index bedfedf6b0..043a98f394 100644 --- a/extra/benchmark/fib2/fib2.factor +++ b/extra/benchmark/fib2/fib2.factor @@ -8,6 +8,6 @@ IN: benchmark.fib2 1 fixnum- dup fixnum-fib swap 1 fixnum- fixnum-fib fixnum+ ] if ; -: fib-main 34 fixnum-fib 9227465 assert= ; +: fib-main ( -- ) 34 fixnum-fib 9227465 assert= ; MAIN: fib-main diff --git a/extra/benchmark/fib3/fib3.factor b/extra/benchmark/fib3/fib3.factor index c2b86f6bfa..13eaef8e0c 100644 --- a/extra/benchmark/fib3/fib3.factor +++ b/extra/benchmark/fib3/fib3.factor @@ -4,6 +4,6 @@ IN: benchmark.fib3 : fib ( m -- n ) dup 1 <= [ drop 1 ] [ dup 1 - fib swap 2 - fib + ] if ; -: fib-main 34 fib 9227465 assert= ; +: fib-main ( -- ) 34 fib 9227465 assert= ; MAIN: fib-main diff --git a/extra/benchmark/fib4/fib4.factor b/extra/benchmark/fib4/fib4.factor index a6415fb50f..7cf756e11f 100644 --- a/extra/benchmark/fib4/fib4.factor +++ b/extra/benchmark/fib4/fib4.factor @@ -17,6 +17,6 @@ C: box swap box-i swap box-i + ] if ; -: fib-main T{ box f 34 } tuple-fib T{ box f 9227465 } assert= ; +: fib-main ( -- ) T{ box f 34 } tuple-fib T{ box f 9227465 } assert= ; MAIN: fib-main diff --git a/extra/benchmark/fib5/fib5.factor b/extra/benchmark/fib5/fib5.factor index 6f4765af7b..7b33a5b2b4 100644 --- a/extra/benchmark/fib5/fib5.factor +++ b/extra/benchmark/fib5/fib5.factor @@ -14,6 +14,6 @@ SYMBOL: n ] if ] with-scope ; -: fib-main 30 namespace-fib 1346269 assert= ; +: fib-main ( -- ) 30 namespace-fib 1346269 assert= ; MAIN: fib-main diff --git a/extra/benchmark/fib6/fib6.factor b/extra/benchmark/fib6/fib6.factor index cc42028df6..594b451876 100755 --- a/extra/benchmark/fib6/fib6.factor +++ b/extra/benchmark/fib6/fib6.factor @@ -1,7 +1,7 @@ IN: benchmark.fib6 USING: math kernel alien ; -: fib +: fib ( x -- y ) "int" { "int" } "cdecl" [ dup 1 <= [ drop 1 ] [ 1- dup fib swap 1- fib + @@ -9,6 +9,6 @@ USING: math kernel alien ; ] alien-callback "int" { "int" } "cdecl" alien-indirect ; -: fib-main 25 fib drop ; +: fib-main ( -- ) 25 fib drop ; MAIN: fib-main diff --git a/extra/benchmark/iteration/iteration.factor b/extra/benchmark/iteration/iteration.factor index 61c22d5a29..f49d21d5a3 100644 --- a/extra/benchmark/iteration/iteration.factor +++ b/extra/benchmark/iteration/iteration.factor @@ -4,14 +4,14 @@ kernel ; : ( from to -- seq ) dup ; inline -: vector-iter 100 [ 0 100000 >vector [ ] map drop ] times ; -: array-iter 100 [ 0 100000 >array [ ] map drop ] times ; -: string-iter 100 [ 0 100000 >string [ ] map drop ] times ; -: sbuf-iter 100 [ 0 100000 >sbuf [ ] map drop ] times ; -: reverse-iter 100 [ 0 100000 >vector [ ] map drop ] times ; -: dot-iter 100 [ 0 100000 dup v. drop ] times ; +: vector-iter ( -- ) 100 [ 0 100000 >vector [ ] map drop ] times ; +: array-iter ( -- ) 100 [ 0 100000 >array [ ] map drop ] times ; +: string-iter ( -- ) 100 [ 0 100000 >string [ ] map drop ] times ; +: sbuf-iter ( -- ) 100 [ 0 100000 >sbuf [ ] map drop ] times ; +: reverse-iter ( -- ) 100 [ 0 100000 >vector [ ] map drop ] times ; +: dot-iter ( -- ) 100 [ 0 100000 dup v. drop ] times ; -: iter-main +: iter-main ( -- ) vector-iter array-iter string-iter diff --git a/extra/benchmark/knucleotide/knucleotide.factor b/extra/benchmark/knucleotide/knucleotide.factor index e06b81f6de..6bd2d69cfa 100644 --- a/extra/benchmark/knucleotide/knucleotide.factor +++ b/extra/benchmark/knucleotide/knucleotide.factor @@ -56,7 +56,7 @@ IN: benchmark.knucleotide drop ; : knucleotide ( -- ) - "extra/benchmark/knucleotide/knucleotide-input.txt" resource-path + "resource:extra/benchmark/knucleotide/knucleotide-input.txt" ascii [ read-input ] with-file-reader process-input ; diff --git a/extra/benchmark/mandel/mandel.factor b/extra/benchmark/mandel/mandel.factor index b890fdc8e8..5adbb7c668 100755 --- a/extra/benchmark/mandel/mandel.factor +++ b/extra/benchmark/mandel/mandel.factor @@ -1,5 +1,5 @@ IN: benchmark.mandel -USING: arrays io kernel math namespaces sequences +USING: arrays io kernel math math.order namespaces sequences byte-arrays byte-vectors math.functions math.parser io.files colors.hsv io.encodings.binary ; @@ -54,7 +54,7 @@ SYMBOL: cols : ppm-header ( w h -- ) "P6\n" % swap # " " % # "\n255\n" % ; -: buf-size width height * 3 * 100 + ; +: buf-size ( -- n ) width height * 3 * 100 + ; : mandel ( -- data ) [ diff --git a/extra/benchmark/md5/md5.factor b/extra/benchmark/md5/md5.factor index 3043725acd..8a259c1217 100644 --- a/extra/benchmark/md5/md5.factor +++ b/extra/benchmark/md5/md5.factor @@ -1,7 +1,7 @@ -USING: crypto.md5 io.files kernel ; +USING: checksums checksums.md5 io.files kernel ; IN: benchmark.md5 : md5-primes-list ( -- ) - "extra/math/primes/list/list.factor" resource-path file>md5 drop ; + "resource:extra/math/primes/list/list.factor" md5 checksum-file drop ; MAIN: md5-primes-list diff --git a/extra/benchmark/nsieve-bits/nsieve-bits.factor b/extra/benchmark/nsieve-bits/nsieve-bits.factor index fe70246cb5..18dced09cc 100644 --- a/extra/benchmark/nsieve-bits/nsieve-bits.factor +++ b/extra/benchmark/nsieve-bits/nsieve-bits.factor @@ -31,6 +31,6 @@ bit-arrays namespaces io ; dup 1- 2^ 10000 * nsieve-bits. 2 - 2^ 10000 * nsieve-bits. ; -: nsieve-bits-main* 11 nsieve-bits-main ; +: nsieve-bits-main* ( -- ) 11 nsieve-bits-main ; MAIN: nsieve-bits-main* diff --git a/extra/benchmark/nsieve/nsieve.factor b/extra/benchmark/nsieve/nsieve.factor index 7cae1e2a9b..1e327d901a 100644 --- a/extra/benchmark/nsieve/nsieve.factor +++ b/extra/benchmark/nsieve/nsieve.factor @@ -30,6 +30,6 @@ arrays namespaces io ; dup 1 - 2^ 10000 * nsieve. 2 - 2^ 10000 * nsieve. ; -: nsieve-main* 9 nsieve-main ; +: nsieve-main* ( -- ) 9 nsieve-main ; MAIN: nsieve-main* diff --git a/extra/benchmark/partial-sums/partial-sums.factor b/extra/benchmark/partial-sums/partial-sums.factor index b4bb1fa8d2..2d8cdc40c7 100644 --- a/extra/benchmark/partial-sums/partial-sums.factor +++ b/extra/benchmark/partial-sums/partial-sums.factor @@ -3,7 +3,8 @@ prettyprint words hints ; IN: benchmark.partial-sums : summing ( n quot -- y ) - [ + ] compose 0.0 -rot 1 -rot (each-integer) ; inline + [ >float ] swap [ + ] 3compose + 0.0 -rot 1 -rot (each-integer) ; inline : 2/3^k ( n -- y ) [ 2.0 3.0 / swap 1- ^ ] summing ; @@ -57,6 +58,6 @@ HINTS: gregory fixnum ; ] with each ] tabular-output ; -: partial-sums-main 2500000 partial-sums ; +: partial-sums-main ( -- ) 2500000 partial-sums ; MAIN: partial-sums-main diff --git a/extra/benchmark/random/random.factor b/extra/benchmark/random/random.factor index 775595709a..985c9a59b2 100755 --- a/extra/benchmark/random/random.factor +++ b/extra/benchmark/random/random.factor @@ -1,7 +1,8 @@ USING: io.files io.encodings.ascii random math.parser io math ; IN: benchmark.random -: random-numbers-path "random-numbers.txt" temp-file ; +: random-numbers-path ( -- path ) + "random-numbers.txt" temp-file ; : write-random-numbers ( n -- ) random-numbers-path ascii [ diff --git a/extra/benchmark/raytracer/raytracer.factor b/extra/benchmark/raytracer/raytracer.factor index 3ec8cb4245..7d7ec244fb 100755 --- a/extra/benchmark/raytracer/raytracer.factor +++ b/extra/benchmark/raytracer/raytracer.factor @@ -169,7 +169,7 @@ DEFER: create ( level c r -- scene ) [ [ oversampling sq / pgm-pixel ] each ] each ] B{ } make ; -: raytracer-main +: raytracer-main ( -- ) run "raytracer.pnm" temp-file binary set-file-contents ; MAIN: raytracer-main diff --git a/extra/benchmark/recursive/recursive.factor b/extra/benchmark/recursive/recursive.factor index f69547df60..c8bae8a56a 100755 --- a/extra/benchmark/recursive/recursive.factor +++ b/extra/benchmark/recursive/recursive.factor @@ -32,6 +32,6 @@ IN: benchmark.recursive HINTS: recursive fixnum ; -: recursive-main 11 recursive ; +: recursive-main ( -- ) 11 recursive ; MAIN: recursive-main diff --git a/extra/benchmark/reverse-complement/reverse-complement-tests.factor b/extra/benchmark/reverse-complement/reverse-complement-tests.factor index c66de87cb5..883124105b 100755 --- a/extra/benchmark/reverse-complement/reverse-complement-tests.factor +++ b/extra/benchmark/reverse-complement/reverse-complement-tests.factor @@ -1,13 +1,13 @@ IN: benchmark.reverse-complement.tests -USING: tools.test benchmark.reverse-complement crypto.md5 +USING: tools.test benchmark.reverse-complement +checksums checksums.md5 io.files kernel ; [ "c071aa7e007a9770b2fb4304f55a17e5" ] [ - "extra/benchmark/reverse-complement/reverse-complement-test-in.txt" - "extra/benchmark/reverse-complement/reverse-complement-test-out.txt" - [ resource-path ] bi@ + "resource:extra/benchmark/reverse-complement/reverse-complement-test-in.txt" + "resource:extra/benchmark/reverse-complement/reverse-complement-test-out.txt" reverse-complement - "extra/benchmark/reverse-complement/reverse-complement-test-out.txt" - resource-path file>md5str + "resource:extra/benchmark/reverse-complement/reverse-complement-test-out.txt" + md5 checksum-file hex-string ] unit-test diff --git a/extra/benchmark/reverse-complement/reverse-complement.factor b/extra/benchmark/reverse-complement/reverse-complement.factor index d83b720187..b7c1db043c 100755 --- a/extra/benchmark/reverse-complement/reverse-complement.factor +++ b/extra/benchmark/reverse-complement/reverse-complement.factor @@ -1,6 +1,6 @@ USING: io io.files io.streams.duplex kernel sequences sequences.private strings vectors words memoize splitting -hints unicode.case continuations io.encodings.ascii ; +grouping hints unicode.case continuations io.encodings.ascii ; IN: benchmark.reverse-complement MEMO: trans-map ( -- str ) @@ -32,18 +32,16 @@ HINTS: do-line vector string ; readln [ do-line (reverse-complement) ] [ show-seq ] if* ; : reverse-complement ( infile outfile -- ) - ascii [ - swap ascii [ - swap [ - 500000 (reverse-complement) - ] with-stream - ] with-disposal - ] with-disposal ; + ascii [ + ascii [ + 500000 (reverse-complement) + ] with-file-reader + ] with-file-writer ; -: reverse-complement-in +: reverse-complement-in ( -- path ) "reverse-complement-in.txt" temp-file ; -: reverse-complement-out +: reverse-complement-out ( -- path ) "reverse-complement-out.txt" temp-file ; : reverse-complement-main ( -- ) diff --git a/extra/benchmark/sha1/sha1.factor b/extra/benchmark/sha1/sha1.factor index 897d83ea0e..d5ff5673c2 100644 --- a/extra/benchmark/sha1/sha1.factor +++ b/extra/benchmark/sha1/sha1.factor @@ -1,7 +1,7 @@ -USING: crypto.sha1 io.files kernel ; +USING: checksums checksums.sha1 io.files kernel ; IN: benchmark.sha1 : sha1-primes-list ( -- ) - "extra/math/primes/list/list.factor" resource-path file>sha1 drop ; + "resource:extra/math/primes/list/list.factor" sha1 checksum-file drop ; MAIN: sha1-primes-list diff --git a/extra/benchmark/sockets/sockets.factor b/extra/benchmark/sockets/sockets.factor index 25212c7264..66c9c11167 100755 --- a/extra/benchmark/sockets/sockets.factor +++ b/extra/benchmark/sockets/sockets.factor @@ -1,16 +1,17 @@ USING: io.sockets io kernel math threads io.encodings.ascii -debugger tools.time prettyprint concurrency.count-downs -namespaces arrays continuations ; +io.streams.duplex debugger tools.time prettyprint +concurrency.count-downs namespaces arrays continuations +destructors ; IN: benchmark.sockets SYMBOL: counter : number-of-requests 1 ; -: server-addr "127.0.0.1" 7777 ; +: server-addr ( -- addr ) "127.0.0.1" 7777 ; : server-loop ( server -- ) - dup accept [ + dup accept drop [ [ read1 CHAR: x = [ "server" get dispose @@ -30,17 +31,17 @@ SYMBOL: counter ] ignore-errors ; : simple-client ( -- ) - server-addr ascii [ + server-addr ascii [ CHAR: b write1 flush number-of-requests [ CHAR: a dup write1 flush read1 assert= ] times counter get count-down - ] with-stream ; + ] with-client ; : stop-server ( -- ) - server-addr ascii [ + server-addr ascii [ CHAR: x write1 - ] with-stream ; + ] with-client ; : clients ( n -- ) dup pprint " clients: " write [ diff --git a/extra/benchmark/sort/sort.factor b/extra/benchmark/sort/sort.factor index cd6189fe22..983a9e86b1 100755 --- a/extra/benchmark/sort/sort.factor +++ b/extra/benchmark/sort/sort.factor @@ -2,7 +2,7 @@ USING: kernel sequences sorting benchmark.random math.parser io.files io.encodings.ascii ; IN: benchmark.sort -: sort-benchmark +: sort-benchmark ( -- ) random-numbers-path ascii file-lines [ string>number ] map natural-sort drop ; diff --git a/extra/benchmark/typecheck1/typecheck1.factor b/extra/benchmark/typecheck1/typecheck1.factor index fd7bb6e802..434094a2a3 100644 --- a/extra/benchmark/typecheck1/typecheck1.factor +++ b/extra/benchmark/typecheck1/typecheck1.factor @@ -3,8 +3,8 @@ IN: benchmark.typecheck1 TUPLE: hello n ; -: foo 0 100000000 [ over hello-n + ] times ; +: foo ( obj -- obj n ) 0 100000000 [ over hello-n + ] times ; -: typecheck-main 0 hello boa foo 2drop ; +: typecheck-main ( -- ) 0 hello boa foo 2drop ; MAIN: typecheck-main diff --git a/extra/benchmark/typecheck2/typecheck2.factor b/extra/benchmark/typecheck2/typecheck2.factor index 0dfcc17c66..f408389e69 100644 --- a/extra/benchmark/typecheck2/typecheck2.factor +++ b/extra/benchmark/typecheck2/typecheck2.factor @@ -3,10 +3,10 @@ IN: benchmark.typecheck2 TUPLE: hello n ; -: hello-n* dup tuple? [ 3 slot ] [ 3 throw ] if ; +: hello-n* ( obj -- value ) dup tuple? [ 3 slot ] [ 3 throw ] if ; -: foo 0 100000000 [ over hello-n* + ] times ; +: foo ( obj -- obj n ) 0 100000000 [ over hello-n* + ] times ; -: typecheck-main 0 hello boa foo 2drop ; +: typecheck-main ( -- ) 0 hello boa foo 2drop ; MAIN: typecheck-main diff --git a/extra/benchmark/typecheck3/typecheck3.factor b/extra/benchmark/typecheck3/typecheck3.factor index 3ca6a9f9e7..b15d81df56 100644 --- a/extra/benchmark/typecheck3/typecheck3.factor +++ b/extra/benchmark/typecheck3/typecheck3.factor @@ -3,10 +3,10 @@ IN: benchmark.typecheck3 TUPLE: hello n ; -: hello-n* dup tag 2 eq? [ 3 slot ] [ 3 throw ] if ; +: hello-n* ( obj -- val ) dup tag 2 eq? [ 3 slot ] [ 3 throw ] if ; -: foo 0 100000000 [ over hello-n* + ] times ; +: foo ( obj -- obj n ) 0 100000000 [ over hello-n* + ] times ; -: typecheck-main 0 hello boa foo 2drop ; +: typecheck-main ( -- ) 0 hello boa foo 2drop ; MAIN: typecheck-main diff --git a/extra/benchmark/typecheck4/typecheck4.factor b/extra/benchmark/typecheck4/typecheck4.factor index cc3310fef6..a2595810be 100644 --- a/extra/benchmark/typecheck4/typecheck4.factor +++ b/extra/benchmark/typecheck4/typecheck4.factor @@ -3,10 +3,10 @@ IN: benchmark.typecheck4 TUPLE: hello n ; -: hello-n* 3 slot ; +: hello-n* ( obj -- val ) 3 slot ; -: foo 0 100000000 [ over hello-n* + ] times ; +: foo ( obj -- obj n ) 0 100000000 [ over hello-n* + ] times ; -: typecheck-main 0 hello boa foo 2drop ; +: typecheck-main ( -- ) 0 hello boa foo 2drop ; MAIN: typecheck-main diff --git a/extra/bitfields/bitfields.factor b/extra/bitfields/bitfields.factor index fca0568adf..7d3ef89759 100644 --- a/extra/bitfields/bitfields.factor +++ b/extra/bitfields/bitfields.factor @@ -93,7 +93,7 @@ M: check< summary drop "Number exceeds upper bound" ; >r keys r> define-slots ; : filter-pad ( slots -- slots ) - [ drop padding-name? not ] assoc-subset ; + [ drop padding-name? not ] assoc-filter ; : define-bitfield ( classname slots -- ) [ @@ -101,7 +101,7 @@ M: check< summary drop "Number exceeds upper bound" ; >ranges filter-pad [ define-setters ] 2keep define-accessors ] with-compilation-unit ; -: parse-bitfield +: parse-bitfield ( -- ) scan ";" parse-tokens parse-slots define-bitfield ; : BITFIELD: diff --git a/extra/boids/boids.factor b/extra/boids/boids.factor index 4ea20629c1..4151b44cfb 100644 --- a/extra/boids/boids.factor +++ b/extra/boids/boids.factor @@ -3,6 +3,7 @@ USING: kernel namespaces math math.constants math.functions + math.order math.vectors math.trig combinators arrays sequences random vars @@ -113,10 +114,10 @@ over boid-vel -rot relative-position angle-between ; { [ cohesion-radius> in-range? ] [ cohesion-view-angle> in-view? ] [ eq? not ] } - <--&& ; + 2&& ; : cohesion-neighborhood ( self -- boids ) - boids> [ within-cohesion-neighborhood? ] with subset ; + boids> [ within-cohesion-neighborhood? ] with filter ; : cohesion-force ( self -- force ) dup cohesion-neighborhood @@ -133,10 +134,10 @@ over boid-vel -rot relative-position angle-between ; { [ separation-radius> in-range? ] [ separation-view-angle> in-view? ] [ eq? not ] } - <--&& ; + 2&& ; : separation-neighborhood ( self -- boids ) - boids> [ within-separation-neighborhood? ] with subset ; + boids> [ within-separation-neighborhood? ] with filter ; : separation-force ( self -- force ) dup separation-neighborhood @@ -153,10 +154,10 @@ over boid-vel -rot relative-position angle-between ; { [ alignment-radius> in-range? ] [ alignment-view-angle> in-view? ] [ eq? not ] } - <--&& ; + 2&& ; : alignment-neighborhood ( self -- boids ) -boids> [ within-alignment-neighborhood? ] with subset ; +boids> [ within-alignment-neighborhood? ] with filter ; : alignment-force ( self -- force ) alignment-neighborhood diff --git a/extra/bootstrap/help/help.factor b/extra/bootstrap/help/help.factor index 4326fcf61b..e2a2288988 100755 --- a/extra/bootstrap/help/help.factor +++ b/extra/bootstrap/help/help.factor @@ -3,7 +3,7 @@ help.definitions io io.files kernel namespaces vocabs sequences parser vocabs.loader ; IN: bootstrap.help -: load-help +: load-help ( -- ) "alien.syntax" require "compiler" require @@ -11,7 +11,7 @@ IN: bootstrap.help [ drop ] load-vocab-hook [ vocabs - [ vocab-docs-loaded? not ] subset + [ vocab-docs-loaded? not ] filter [ load-docs ] each ] with-variable ; diff --git a/extra/bootstrap/image/download/download.factor b/extra/bootstrap/image/download/download.factor index a186954ef0..c2e80fee9a 100644 --- a/extra/bootstrap/image/download/download.factor +++ b/extra/bootstrap/image/download/download.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. IN: bootstrap.image.download -USING: http.client crypto.md5 splitting assocs kernel io.files -bootstrap.image sequences io ; +USING: http.client checksums checksums.openssl splitting assocs +kernel io.files bootstrap.image sequences io ; : url "http://factorcode.org/images/latest/" ; @@ -12,8 +12,11 @@ bootstrap.image sequences io ; : need-new-image? ( image -- ? ) dup exists? - [ dup file>md5str swap download-checksums at = not ] - [ drop t ] if ; + [ + [ openssl-md5 checksum-file hex-string ] + [ download-checksums at ] + bi = not + ] [ drop t ] if ; : download-image ( arch -- ) boot-image-name dup need-new-image? [ diff --git a/extra/bootstrap/image/upload/upload.factor b/extra/bootstrap/image/upload/upload.factor index ab26a4ff13..de13b4aed4 100755 --- a/extra/bootstrap/image/upload/upload.factor +++ b/extra/bootstrap/image/upload/upload.factor @@ -1,8 +1,9 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. +USING: checksums checksums.openssl splitting assocs +kernel io.files bootstrap.image sequences io namespaces +io.launcher math io.encodings.ascii ; IN: bootstrap.image.upload -USING: http.client crypto.md5 splitting assocs kernel io.files -bootstrap.image sequences io namespaces io.launcher math io.encodings.ascii ; SYMBOL: upload-images-destination @@ -11,13 +12,17 @@ SYMBOL: upload-images-destination "slava@factorcode.org:/var/www/factorcode.org/newsite/images/latest/" or ; -: checksums "checksums.txt" temp-file ; +: checksums ( -- temp ) "checksums.txt" temp-file ; -: boot-image-names images [ boot-image-name ] map ; +: boot-image-names ( -- seq ) images [ boot-image-name ] map ; : compute-checksums ( -- ) checksums ascii [ - boot-image-names [ dup write bl file>md5str print ] each + boot-image-names [ + [ write bl ] + [ openssl-md5 checksum-file hex-string print ] + bi + ] each ] with-file-writer ; : upload-images ( -- ) diff --git a/extra/bubble-chamber/particle/muon/colors/colors.factor b/extra/bubble-chamber/particle/muon/colors/colors.factor index ab72f65b4b..e68fff5efd 100644 --- a/extra/bubble-chamber/particle/muon/colors/colors.factor +++ b/extra/bubble-chamber/particle/muon/colors/colors.factor @@ -1,5 +1,5 @@ -USING: kernel sequences math math.constants accessors +USING: kernel sequences math math.constants math.order accessors processing processing.color ; diff --git a/extra/builder/benchmark/benchmark.factor b/extra/builder/benchmark/benchmark.factor deleted file mode 100644 index 9e5e932831..0000000000 --- a/extra/builder/benchmark/benchmark.factor +++ /dev/null @@ -1,43 +0,0 @@ - -USING: kernel continuations arrays assocs sequences sorting math - io io.styles prettyprint builder.util ; - -IN: builder.benchmark - -! : passing-benchmarks ( table -- table ) -! [ second first2 number? swap number? and ] subset ; - -: passing-benchmarks ( table -- table ) [ second number? ] subset ; - -! : simplify-table ( table -- table ) [ first2 second 2array ] map ; - -: benchmark-difference ( old-table benchmark-result -- result-diff ) - first2 >r - tuck swap at - r> - swap - - 2array ; - -: compare-tables ( old new -- table ) - [ passing-benchmarks ] bi@ - [ benchmark-difference ] with map ; - -: benchmark-deltas ( -- table ) - "../benchmarks" "benchmarks" [ eval-file ] bi@ - compare-tables - sort-values ; - -: benchmark-deltas. ( deltas -- ) - standard-table-style - [ - [ [ "Benchmark" write ] with-cell [ "Delta (ms)" write ] with-cell ] - with-row - [ [ swap [ write ] with-cell pprint-cell ] with-row ] - assoc-each - ] - tabular-output ; - -: show-benchmark-deltas ( -- ) - [ benchmark-deltas benchmark-deltas. ] - [ drop "Error generating benchmark deltas" . ] - recover ; \ No newline at end of file diff --git a/extra/builder/release/branch/branch.factor b/extra/builder/release/branch/branch.factor index 6218a2ea90..6b1266bb45 100644 --- a/extra/builder/release/branch/branch.factor +++ b/extra/builder/release/branch/branch.factor @@ -21,7 +21,7 @@ IN: builder.release.branch { "scp" my-boot-image-name - "factorcode.org:/var/www/factorcode.org/newsite/images/clean" + { "factorcode.org:/var/www/factorcode.org/newsite/images/clean/" platform } } to-strings try-process ; diff --git a/extra/builder/report/report.factor b/extra/builder/report/report.factor index 101d259f7c..2ac8482a76 100644 --- a/extra/builder/report/report.factor +++ b/extra/builder/report/report.factor @@ -15,8 +15,8 @@ IN: builder.report "Build directory: " write build-dir print "git id: " write "git-id" eval-file print nl - status-vm get f = [ "compile-log" cat "vm compile error" throw ] when - status-boot get f = [ "boot-log" cat "Boot error" throw ] when + status-vm get f = [ "compile-log" cat "vm compile error" throw ] when + status-boot get f = [ "boot-log" 100 cat-n "Boot error" throw ] when status-test get f = [ "test-log" 100 cat-n "Test error" throw ] when "Boot time: " write "boot-time" eval-file milli-seconds>time print diff --git a/extra/builder/test/test.factor b/extra/builder/test/test.factor index 957af28dc1..2a0769f278 100644 --- a/extra/builder/test/test.factor +++ b/extra/builder/test/test.factor @@ -3,6 +3,7 @@ USING: kernel namespaces assocs io.files io.encodings.utf8 prettyprint help.lint benchmark + tools.time bootstrap.stage2 tools.test tools.vocabs builder.util ; @@ -26,8 +27,8 @@ IN: builder.test : do-all ( -- ) bootstrap-time get "../boot-time" utf8 [ . ] with-file-writer - [ do-load ] runtime "../load-time" utf8 [ . ] with-file-writer - [ do-tests ] runtime "../test-time" utf8 [ . ] with-file-writer + [ do-load ] benchmark "../load-time" utf8 [ . ] with-file-writer + [ do-tests ] benchmark "../test-time" utf8 [ . ] with-file-writer do-help-lint do-benchmarks ; diff --git a/extra/builder/util/util.factor b/extra/builder/util/util.factor index 3b0834b190..db3b476365 100644 --- a/extra/builder/util/util.factor +++ b/extra/builder/util/util.factor @@ -12,11 +12,9 @@ IN: builder.util ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -: runtime ( quot -- time ) benchmark nip ; - : minutes>ms ( min -- ms ) 60 * 1000 * ; -: file>string ( file -- string ) utf8 [ stdio get contents ] with-file-reader ; +: file>string ( file -- string ) utf8 file-contents ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -43,12 +41,17 @@ DEFER: to-strings : host-name* ( -- name ) host-name "." split first ; +! : datestamp ( -- string ) +! now `{ ,[ dup timestamp-year ] +! ,[ dup timestamp-month ] +! ,[ dup timestamp-day ] +! ,[ dup timestamp-hour ] +! ,[ timestamp-minute ] } +! [ pad-00 ] map "-" join ; + : datestamp ( -- string ) - now `{ ,[ dup timestamp-year ] - ,[ dup timestamp-month ] - ,[ dup timestamp-day ] - ,[ dup timestamp-hour ] - ,[ timestamp-minute ] } + now + { year>> month>> day>> hour>> minute>> } [ pad-00 ] map "-" join ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -107,5 +110,5 @@ USE: prettyprint ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! : git-id ( -- id ) - { "git" "show" } utf8 [ readln ] with-stream + { "git" "show" } utf8 [ readln ] with-input-stream " " split second ; diff --git a/extra/bunny/bunny.factor b/extra/bunny/bunny.factor index 43b9edcd00..b315e4ca5a 100755 --- a/extra/bunny/bunny.factor +++ b/extra/bunny/bunny.factor @@ -4,7 +4,7 @@ opengl.glu shuffle http.client vectors namespaces ui.gadgets ui.gadgets.canvas ui.render ui splitting combinators tools.time system combinators.lib float-arrays continuations opengl.demo-support multiline ui.gestures bunny.fixed-pipeline -bunny.cel-shaded bunny.outlined bunny.model ; +bunny.cel-shaded bunny.outlined bunny.model accessors destructors ; IN: bunny TUPLE: bunny-gadget model geom draw-seq draw-n ; @@ -13,38 +13,33 @@ TUPLE: bunny-gadget model geom draw-seq draw-n ; 0.0 0.0 0.375 maybe-download read-model { set-delegate - set-bunny-gadget-model + (>>model) } bunny-gadget construct ; : bunny-gadget-draw ( gadget -- draw ) - { bunny-gadget-draw-n bunny-gadget-draw-seq } + { draw-n>> draw-seq>> } get-slots nth ; : bunny-gadget-next-draw ( gadget -- ) - dup { bunny-gadget-draw-seq bunny-gadget-draw-n } + dup { draw-seq>> draw-n>> } get-slots 1+ swap length mod - swap [ set-bunny-gadget-draw-n ] keep relayout-1 ; + >>draw-n relayout-1 ; M: bunny-gadget graft* ( gadget -- ) GL_DEPTH_TEST glEnable - dup bunny-gadget-model - over { - [ ] - [ ] - [ ] - } map-call-with [ ] subset - 0 - roll { - set-bunny-gadget-geom - set-bunny-gadget-draw-seq - set-bunny-gadget-draw-n - } set-slots ; + dup model>> >>geom + dup + [ ] + [ ] + [ ] tri 3array + sift >>draw-seq + 0 >>draw-n + drop ; M: bunny-gadget ungraft* ( gadget -- ) - { bunny-gadget-geom bunny-gadget-draw-seq } get-slots - [ [ dispose ] when* ] each - [ dispose ] when* ; + [ geom>> [ dispose ] when* ] + [ draw-seq>> [ [ dispose ] when* ] each ] bi ; M: bunny-gadget draw-gadget* ( gadget -- ) 0.15 0.15 0.15 1.0 glClearColor @@ -52,7 +47,7 @@ M: bunny-gadget draw-gadget* ( gadget -- ) dup demo-gadget-set-matrices GL_MODELVIEW glMatrixMode 0.02 -0.105 0.0 glTranslatef - { bunny-gadget-geom bunny-gadget-draw } get-slots + { geom>> bunny-gadget-draw } get-slots draw-bunny ; M: bunny-gadget pref-dim* ( gadget -- dim ) diff --git a/extra/bunny/cel-shaded/cel-shaded.factor b/extra/bunny/cel-shaded/cel-shaded.factor index d4f0b7612d..8285cd776f 100644 --- a/extra/bunny/cel-shaded/cel-shaded.factor +++ b/extra/bunny/cel-shaded/cel-shaded.factor @@ -1,5 +1,6 @@ -USING: arrays bunny.model continuations kernel multiline opengl opengl.shaders - opengl.capabilities opengl.gl sequences sequences.lib ; +USING: arrays bunny.model continuations destructors kernel +multiline opengl opengl.shaders opengl.capabilities opengl.gl +sequences sequences.lib accessors ; IN: bunny.cel-shaded STRING: vertex-shader-source @@ -68,11 +69,12 @@ TUPLE: bunny-cel-shaded program ; : ( gadget -- draw ) drop cel-shading-supported? [ + bunny-cel-shaded new vertex-shader-source check-gl-shader cel-shaded-fragment-shader-lib-source check-gl-shader cel-shaded-fragment-shader-main-source check-gl-shader 3array check-gl-program - { set-bunny-cel-shaded-program } bunny-cel-shaded construct + >>program ] [ f ] if ; : (draw-cel-shaded-bunny) ( geom program -- ) @@ -85,8 +87,8 @@ TUPLE: bunny-cel-shaded program ; } [ bunny-geom ] with-gl-program ; M: bunny-cel-shaded draw-bunny - bunny-cel-shaded-program (draw-cel-shaded-bunny) ; + program>> (draw-cel-shaded-bunny) ; M: bunny-cel-shaded dispose - bunny-cel-shaded-program delete-gl-program ; + program>> delete-gl-program ; diff --git a/extra/bunny/fixed-pipeline/fixed-pipeline.factor b/extra/bunny/fixed-pipeline/fixed-pipeline.factor index f3fb68e515..0bad9cc943 100644 --- a/extra/bunny/fixed-pipeline/fixed-pipeline.factor +++ b/extra/bunny/fixed-pipeline/fixed-pipeline.factor @@ -1,4 +1,4 @@ -USING: alien.c-types continuations kernel +USING: alien.c-types continuations destructors kernel opengl opengl.gl bunny.model ; IN: bunny.fixed-pipeline @@ -6,7 +6,7 @@ TUPLE: bunny-fixed-pipeline ; : ( gadget -- draw ) drop - { } bunny-fixed-pipeline construct ; + bunny-fixed-pipeline new ; M: bunny-fixed-pipeline draw-bunny drop diff --git a/extra/bunny/model/model.factor b/extra/bunny/model/model.factor index 897a30c417..b1f2f19d9c 100755 --- a/extra/bunny/model/model.factor +++ b/extra/bunny/model/model.factor @@ -2,17 +2,18 @@ USING: alien alien.c-types arrays sequences math math.vectors math.matrices math.parser io io.files kernel opengl opengl.gl opengl.glu io.encodings.ascii opengl.capabilities shuffle http.client vectors splitting tools.time system combinators -float-arrays continuations namespaces sequences.lib ; +float-arrays continuations destructors namespaces sequences.lib +accessors ; IN: bunny.model : numbers ( str -- seq ) - " " split [ string>number ] map [ ] subset ; + " " split [ string>number ] map sift ; : (parse-model) ( vs is -- vs is ) readln [ numbers { { [ dup length 5 = ] [ 3 head pick push ] } - { [ dup first 3 = ] [ 1 tail over push ] } + { [ dup first 3 = ] [ rest over push ] } [ drop ] } cond (parse-model) ] when* ; @@ -34,14 +35,12 @@ IN: bunny.model [ normalize ] map ; : read-model ( stream -- model ) - "Reading model" print flush [ - ascii [ parse-model ] with-file-reader - [ normals ] 2keep 3array - ] time ; + ascii [ parse-model ] with-file-reader + [ normals ] 2keep 3array ; -: model-path "bun_zipper.ply" temp-file ; +: model-path ( -- path ) "bun_zipper.ply" temp-file ; -: model-url "http://factorcode.org/bun_zipper.ply" ; +: model-url ( -- url ) "http://factorcode.org/bun_zipper.ply" ; : maybe-download ( -- path ) model-path dup exists? [ @@ -85,24 +84,24 @@ M: bunny-dlist bunny-geom bunny-dlist-list glCallList ; M: bunny-buffers bunny-geom - dup { - bunny-buffers-array - bunny-buffers-element-array - } get-slots [ + dup { array>> element-array>> } get-slots [ { GL_VERTEX_ARRAY GL_NORMAL_ARRAY } [ GL_DOUBLE 0 0 buffer-offset glNormalPointer - dup bunny-buffers-nv "double" heap-size * buffer-offset - 3 GL_DOUBLE 0 roll glVertexPointer - bunny-buffers-ni - GL_TRIANGLES swap GL_UNSIGNED_INT 0 buffer-offset glDrawElements + [ + nv>> "double" heap-size * buffer-offset + 3 GL_DOUBLE 0 roll glVertexPointer + ] [ + ni>> + GL_TRIANGLES swap GL_UNSIGNED_INT 0 buffer-offset glDrawElements + ] bi ] all-enabled-client-state ] with-array-element-buffers ; M: bunny-dlist dispose - bunny-dlist-list delete-dlist ; + list>> delete-dlist ; M: bunny-buffers dispose - { bunny-buffers-array bunny-buffers-element-array } get-slots + { array>> element-array>> } get-slots delete-gl-buffer delete-gl-buffer ; : ( model -- geom ) diff --git a/extra/bunny/outlined/outlined.factor b/extra/bunny/outlined/outlined.factor index 6a2f54cceb..f3ee4594c7 100755 --- a/extra/bunny/outlined/outlined.factor +++ b/extra/bunny/outlined/outlined.factor @@ -1,6 +1,7 @@ -USING: arrays bunny.model bunny.cel-shaded continuations kernel -math multiline opengl opengl.shaders opengl.framebuffers -opengl.gl opengl.capabilities sequences ui.gadgets combinators ; +USING: arrays bunny.model bunny.cel-shaded continuations +destructors kernel math multiline opengl opengl.shaders +opengl.framebuffers opengl.gl opengl.capabilities sequences +ui.gadgets combinators accessors ; IN: bunny.outlined STRING: outlined-pass1-fragment-shader-main-source @@ -139,9 +140,9 @@ TUPLE: bunny-outlined : ( gadget -- draw ) outlining-supported? [ pass1-program pass2-program { - set-bunny-outlined-gadget - set-bunny-outlined-pass1-program - set-bunny-outlined-pass2-program + (>>gadget) + (>>pass1-program) + (>>pass2-program) } bunny-outlined construct ] [ drop f ] if ; @@ -169,35 +170,33 @@ TUPLE: bunny-outlined ] with-framebuffer ; : dispose-framebuffer ( draw -- ) - dup bunny-outlined-framebuffer-dim [ + dup framebuffer-dim>> [ { - [ bunny-outlined-framebuffer [ delete-framebuffer ] when* ] - [ bunny-outlined-color-texture [ delete-texture ] when* ] - [ bunny-outlined-normal-texture [ delete-texture ] when* ] - [ bunny-outlined-depth-texture [ delete-texture ] when* ] - [ f swap set-bunny-outlined-framebuffer-dim ] + [ framebuffer>> [ delete-framebuffer ] when* ] + [ color-texture>> [ delete-texture ] when* ] + [ normal-texture>> [ delete-texture ] when* ] + [ depth-texture>> [ delete-texture ] when* ] + [ f >>framebuffer-dim drop ] } cleave ] [ drop ] if ; : remake-framebuffer-if-needed ( draw -- ) - dup bunny-outlined-gadget rect-dim - over bunny-outlined-framebuffer-dim + dup [ gadget>> dim>> ] [ framebuffer-dim>> ] bi over = - [ 2drop ] - [ - swap dup dispose-framebuffer >r - dup GL_RGBA16F_ARB GL_RGBA (framebuffer-texture) - swap dup GL_RGBA16F_ARB GL_RGBA (framebuffer-texture) - swap dup GL_DEPTH_COMPONENT32 GL_DEPTH_COMPONENT (framebuffer-texture) - swap >r - [ (make-framebuffer) ] 3keep - r> r> { - set-bunny-outlined-framebuffer - set-bunny-outlined-color-texture - set-bunny-outlined-normal-texture - set-bunny-outlined-depth-texture - set-bunny-outlined-framebuffer-dim - } set-slots + [ 2drop ] [ + [ dup dispose-framebuffer dup ] dip { + [ + GL_RGBA16F_ARB GL_RGBA (framebuffer-texture) + [ >>color-texture drop ] keep + ] [ + GL_RGBA16F_ARB GL_RGBA (framebuffer-texture) + [ >>normal-texture drop ] keep + ] [ + GL_DEPTH_COMPONENT32 GL_DEPTH_COMPONENT (framebuffer-texture) + [ >>depth-texture drop ] keep + ] + } 2cleave + (make-framebuffer) >>framebuffer drop ] if ; : clear-framebuffer ( -- ) @@ -209,31 +208,34 @@ TUPLE: bunny-outlined GL_COLOR_BUFFER_BIT glClear ; : (pass1) ( geom draw -- ) - dup bunny-outlined-framebuffer [ + dup framebuffer>> [ clear-framebuffer { GL_COLOR_ATTACHMENT0_EXT GL_COLOR_ATTACHMENT1_EXT } set-draw-buffers - bunny-outlined-pass1-program (draw-cel-shaded-bunny) + pass1-program>> (draw-cel-shaded-bunny) ] with-framebuffer ; : (pass2) ( draw -- ) - init-matrices - dup bunny-outlined-color-texture GL_TEXTURE_2D GL_TEXTURE0 bind-texture-unit - dup bunny-outlined-normal-texture GL_TEXTURE_2D GL_TEXTURE1 bind-texture-unit - dup bunny-outlined-depth-texture GL_TEXTURE_2D GL_TEXTURE2 bind-texture-unit - bunny-outlined-pass2-program { - { "colormap" [ 0 glUniform1i ] } - { "normalmap" [ 1 glUniform1i ] } - { "depthmap" [ 2 glUniform1i ] } - { "line_color" [ 0.1 0.0 0.1 1.0 glUniform4f ] } - } [ { -1.0 -1.0 } { 1.0 1.0 } rect-vertices ] with-gl-program ; + init-matrices { + [ color-texture>> GL_TEXTURE_2D GL_TEXTURE0 bind-texture-unit ] + [ normal-texture>> GL_TEXTURE_2D GL_TEXTURE1 bind-texture-unit ] + [ depth-texture>> GL_TEXTURE_2D GL_TEXTURE2 bind-texture-unit ] + [ + pass2-program>> { + { "colormap" [ 0 glUniform1i ] } + { "normalmap" [ 1 glUniform1i ] } + { "depthmap" [ 2 glUniform1i ] } + { "line_color" [ 0.1 0.0 0.1 1.0 glUniform4f ] } + } [ { -1.0 -1.0 } { 1.0 1.0 } rect-vertices ] + with-gl-program + ] + } cleave ; M: bunny-outlined draw-bunny - dup remake-framebuffer-if-needed - [ (pass1) ] keep (pass2) ; + [ remake-framebuffer-if-needed ] + [ (pass1) ] + [ (pass2) ] tri ; M: bunny-outlined dispose - { - [ bunny-outlined-pass1-program [ delete-gl-program ] when* ] - [ bunny-outlined-pass2-program [ delete-gl-program ] when* ] - [ dispose-framebuffer ] - } cleave ; + [ pass1-program>> [ delete-gl-program ] when* ] + [ pass2-program>> [ delete-gl-program ] when* ] + [ dispose-framebuffer ] tri ; diff --git a/extra/cairo/cairo.factor b/extra/cairo/cairo.factor new file mode 100755 index 0000000000..46d3e42c2b --- /dev/null +++ b/extra/cairo/cairo.factor @@ -0,0 +1,36 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: cairo.ffi kernel accessors sequences +namespaces fry continuations destructors ; +IN: cairo + +TUPLE: cairo-t alien ; +C: cairo-t +M: cairo-t dispose ( alien -- ) alien>> cairo_destroy ; + +TUPLE: cairo-surface-t alien ; +C: cairo-surface-t +M: cairo-surface-t dispose ( alien -- ) alien>> cairo_surface_destroy ; + +: check-cairo ( cairo_status_t -- ) + dup CAIRO_STATUS_SUCCESS = [ drop ] + [ cairo_status_to_string "Cairo error: " prepend throw ] if ; + +SYMBOL: cairo +: cr ( -- cairo ) cairo get ; + +: (with-cairo) ( cairo-t quot -- ) + >r alien>> cairo r> [ cr cairo_status check-cairo ] + compose with-variable ; inline + +: with-cairo ( cairo quot -- ) + >r r> [ (with-cairo) ] curry with-disposal ; inline + +: (with-surface) ( cairo-surface-t quot -- ) + >r alien>> r> [ cairo_surface_status check-cairo ] bi ; inline + +: with-surface ( cairo_surface quot -- ) + >r r> [ (with-surface) ] curry with-disposal ; inline + +: with-cairo-from-surface ( cairo_surface quot -- ) + '[ cairo_create , with-cairo ] with-surface ; inline diff --git a/extra/cairo/ffi/ffi.factor b/extra/cairo/ffi/ffi.factor index 200c85c929..451806c0a7 100644 --- a/extra/cairo/ffi/ffi.factor +++ b/extra/cairo/ffi/ffi.factor @@ -1,24 +1,48 @@ -! Bindings for Cairo library -! Copyright (c) 2007 Sampo Vuori -! License: http://factorcode.org/license.txt +! Copyright (c) 2007 Sampo Vuori +! Copyright (c) 2008 Matthew Willis +! +! Adapted from cairo.h, version 1.5.14 +! License: http://factorcode.org/license.txt -! Unimplemented: -! - most of the font stuff -! - most of the matrix stuff -! - most of the query functions +USING: system combinators alien alien.syntax kernel +alien.c-types accessors sequences arrays ui.gadgets ; -USING: alien alien.syntax combinators system ; IN: cairo.ffi - << "cairo" { - { [ os winnt? ] [ "libcairo-2.dll" ] } - ! { [ os macosx? ] [ "libcairo.dylib" ] } - { [ os macosx? ] [ "/opt/local/lib/libcairo.dylib" ] } - { [ os unix? ] [ "libcairo.so.2" ] } - } cond "cdecl" add-library >> + { [ os winnt? ] [ "libcairo-2.dll" ] } + { [ os macosx? ] [ "libcairo.dylib" ] } + { [ os unix? ] [ "libcairo.so.2" ] } +} cond "cdecl" add-library >> LIBRARY: cairo +FUNCTION: int cairo_version ( ) ; +FUNCTION: char* cairo_version_string ( ) ; + +TYPEDEF: int cairo_bool_t + +! I am leaving these and other void* types as opaque structures +TYPEDEF: void* cairo_t +TYPEDEF: void* cairo_surface_t + +C-STRUCT: cairo_matrix_t + { "double" "xx" } + { "double" "yx" } + { "double" "xy" } + { "double" "yy" } + { "double" "x0" } + { "double" "y0" } ; + +TYPEDEF: void* cairo_pattern_t + +TYPEDEF: void* cairo_destroy_func_t +: cairo-destroy-func ( quot -- callback ) + >r "void" { "void*" } "cdecl" r> alien-callback ; inline + +! See cairo.h for details +C-STRUCT: cairo_user_data_key_t + { "int" "unused" } ; + TYPEDEF: int cairo_status_t C-ENUM: CAIRO_STATUS_SUCCESS @@ -44,137 +68,326 @@ C-ENUM: CAIRO_STATUS_INVALID_DSC_COMMENT CAIRO_STATUS_INVALID_INDEX CAIRO_STATUS_CLIP_NOT_REPRESENTABLE -; + CAIRO_STATUS_TEMP_FILE_ERROR + CAIRO_STATUS_INVALID_STRIDE ; TYPEDEF: int cairo_content_t -: CAIRO_CONTENT_COLOR HEX: 1000 ; -: CAIRO_CONTENT_ALPHA HEX: 2000 ; -: CAIRO_CONTENT_COLOR_ALPHA HEX: 3000 ; +: CAIRO_CONTENT_COLOR HEX: 1000 ; +: CAIRO_CONTENT_ALPHA HEX: 2000 ; +: CAIRO_CONTENT_COLOR_ALPHA HEX: 3000 ; +TYPEDEF: void* cairo_write_func_t +: cairo-write-func ( quot -- callback ) + >r "cairo_status_t" { "void*" "uchar*" "int" } + "cdecl" r> alien-callback ; inline + +TYPEDEF: void* cairo_read_func_t +: cairo-read-func ( quot -- callback ) + >r "cairo_status_t" { "void*" "uchar*" "int" } + "cdecl" r> alien-callback ; inline + +! Functions for manipulating state objects +FUNCTION: cairo_t* +cairo_create ( cairo_surface_t* target ) ; + +FUNCTION: cairo_t* +cairo_reference ( cairo_t* cr ) ; + +FUNCTION: void +cairo_destroy ( cairo_t* cr ) ; + +FUNCTION: uint +cairo_get_reference_count ( cairo_t* cr ) ; + +FUNCTION: void* +cairo_get_user_data ( cairo_t* cr, cairo_user_data_key_t* key ) ; + +FUNCTION: cairo_status_t +cairo_set_user_data ( cairo_t* cr, cairo_user_data_key_t* key, void* user_data, cairo_destroy_func_t destroy ) ; + +FUNCTION: void +cairo_save ( cairo_t* cr ) ; + +FUNCTION: void +cairo_restore ( cairo_t* cr ) ; + +FUNCTION: void +cairo_push_group ( cairo_t* cr ) ; + +FUNCTION: void +cairo_push_group_with_content ( cairo_t* cr, cairo_content_t content ) ; + +FUNCTION: cairo_pattern_t* +cairo_pop_group ( cairo_t* cr ) ; + +FUNCTION: void +cairo_pop_group_to_source ( cairo_t* cr ) ; + +! Modify state TYPEDEF: int cairo_operator_t C-ENUM: CAIRO_OPERATOR_CLEAR + CAIRO_OPERATOR_SOURCE CAIRO_OPERATOR_OVER CAIRO_OPERATOR_IN CAIRO_OPERATOR_OUT CAIRO_OPERATOR_ATOP + CAIRO_OPERATOR_DEST CAIRO_OPERATOR_DEST_OVER CAIRO_OPERATOR_DEST_IN CAIRO_OPERATOR_DEST_OUT CAIRO_OPERATOR_DEST_ATOP + CAIRO_OPERATOR_XOR CAIRO_OPERATOR_ADD - CAIRO_OPERATOR_SATURATE -; + CAIRO_OPERATOR_SATURATE ; -TYPEDEF: int cairo_line_cap_t -C-ENUM: - CAIRO_LINE_CAP_BUTT - CAIRO_LINE_CAP_ROUND - CAIRO_LINE_CAP_SQUARE -; +FUNCTION: void +cairo_set_operator ( cairo_t* cr, cairo_operator_t op ) ; -TYPEDEF: int cair_line_join_t -C-ENUM: - CAIRO_LINE_JOIN_MITER - CAIRO_LINE_JOIN_ROUND - CAIRO_LINE_JOIN_BEVEL -; +FUNCTION: void +cairo_set_source ( cairo_t* cr, cairo_pattern_t* source ) ; -TYPEDEF: int cairo_fill_rule_t -C-ENUM: - CAIRO_FILL_RULE_WINDING - CAIRO_FILL_RULE_EVEN_ODD -; +FUNCTION: void +cairo_set_source_rgb ( cairo_t* cr, double red, double green, double blue ) ; -TYPEDEF: int cairo_font_slant_t -C-ENUM: - CAIRO_FONT_SLANT_NORMAL - CAIRO_FONT_SLANT_ITALIC - CAIRO_FONT_SLANT_OBLIQUE -; +FUNCTION: void +cairo_set_source_rgba ( cairo_t* cr, double red, double green, double blue, double alpha ) ; -TYPEDEF: int cairo_font_weight_t -C-ENUM: - CAIRO_FONT_WEIGHT_NORMAL - CAIRO_FONT_WEIGHT_BOLD -; +FUNCTION: void +cairo_set_source_surface ( cairo_t* cr, cairo_surface_t* surface, double x, double y ) ; -C-STRUCT: cairo_font_t - { "int" "refcount" } - { "uint" "scale" } ; - -C-STRUCT: cairo_rectangle_t - { "short" "x" } - { "short" "y" } - { "ushort" "width" } - { "ushort" "height" } ; - -C-STRUCT: cairo_clip_rec_t - { "cairo_rectangle_t" "rect" } - { "void*" "region" } - { "void*" "surface" } ; - -C-STRUCT: cairo_matrix_t - { "void*" "m" } ; - -C-STRUCT: cairo_gstate_t - { "uint" "operator" } - { "double" "tolerance" } - { "double" "line_width" } - { "uint" "line_cap" } - { "uint" "line_join" } - { "double" "miter_limit" } - { "uint" "fill_rule" } - { "void*" "dash" } - { "int" "num_dashes" } - { "double" "dash_offset" } - { "char*" "font_family " } - { "uint" "font_slant" } - { "uint" "font_weight" } - { "void*" "font" } - { "void*" "surface" } - { "void*" "pattern " } - { "double" "alpha" } - { "cairo_clip_rec_t" "clip" } - { "double" "pixels_per_inch" } - { "cairo_matrix_t" "font_matrix" } - { "cairo_matrix_t" "ctm" } - { "cairo_matrix_t" "ctm_inverse" } - { "void*" "path" } - { "void*" "pen_regular" } - { "void*" "next" } ; - -C-STRUCT: cairo_t - { "uint" "ref_count" } - { "cairo_gstate_t*" "gstate" } - { "uint" "status ! cairo_status_t" } ; - -C-STRUCT: cairo_matrix_t - { "double" "xx" } - { "double" "yx" } - { "double" "xy" } - { "double" "yy" } - { "double" "x0" } - { "double" "y0" } ; - -TYPEDEF: int cairo_format_t -C-ENUM: - CAIRO_FORMAT_ARGB32 - CAIRO_FORMAT_RGB24 - CAIRO_FORMAT_A8 - CAIRO_FORMAT_A1 -; +FUNCTION: void +cairo_set_tolerance ( cairo_t* cr, double tolerance ) ; TYPEDEF: int cairo_antialias_t C-ENUM: CAIRO_ANTIALIAS_DEFAULT CAIRO_ANTIALIAS_NONE CAIRO_ANTIALIAS_GRAY - CAIRO_ANTIALIAS_SUBPIXEL -; + CAIRO_ANTIALIAS_SUBPIXEL ; + +FUNCTION: void +cairo_set_antialias ( cairo_t* cr, cairo_antialias_t antialias ) ; + +TYPEDEF: int cairo_fill_rule_t +C-ENUM: + CAIRO_FILL_RULE_WINDING + CAIRO_FILL_RULE_EVEN_ODD ; + +FUNCTION: void +cairo_set_fill_rule ( cairo_t* cr, cairo_fill_rule_t fill_rule ) ; + +FUNCTION: void +cairo_set_line_width ( cairo_t* cr, double width ) ; + +TYPEDEF: int cairo_line_cap_t +C-ENUM: + CAIRO_LINE_CAP_BUTT + CAIRO_LINE_CAP_ROUND + CAIRO_LINE_CAP_SQUARE ; + +FUNCTION: void +cairo_set_line_cap ( cairo_t* cr, cairo_line_cap_t line_cap ) ; + +TYPEDEF: int cairo_line_join_t +C-ENUM: + CAIRO_LINE_JOIN_MITER + CAIRO_LINE_JOIN_ROUND + CAIRO_LINE_JOIN_BEVEL ; + +FUNCTION: void +cairo_set_line_join ( cairo_t* cr, cairo_line_join_t line_join ) ; + +FUNCTION: void +cairo_set_dash ( cairo_t* cr, double* dashes, int num_dashes, double offset ) ; + +FUNCTION: void +cairo_set_miter_limit ( cairo_t* cr, double limit ) ; + +FUNCTION: void +cairo_translate ( cairo_t* cr, double tx, double ty ) ; + +FUNCTION: void +cairo_scale ( cairo_t* cr, double sx, double sy ) ; + +FUNCTION: void +cairo_rotate ( cairo_t* cr, double angle ) ; + +FUNCTION: void +cairo_transform ( cairo_t* cr, cairo_matrix_t* matrix ) ; + +FUNCTION: void +cairo_set_matrix ( cairo_t* cr, cairo_matrix_t* matrix ) ; + +FUNCTION: void +cairo_identity_matrix ( cairo_t* cr ) ; + +FUNCTION: void +cairo_user_to_device ( cairo_t* cr, double* x, double* y ) ; + +FUNCTION: void +cairo_user_to_device_distance ( cairo_t* cr, double* dx, double* dy ) ; + +FUNCTION: void +cairo_device_to_user ( cairo_t* cr, double* x, double* y ) ; + +FUNCTION: void +cairo_device_to_user_distance ( cairo_t* cr, double* dx, double* dy ) ; + +! Path creation functions +FUNCTION: void +cairo_new_path ( cairo_t* cr ) ; + +FUNCTION: void +cairo_move_to ( cairo_t* cr, double x, double y ) ; + +FUNCTION: void +cairo_new_sub_path ( cairo_t* cr ) ; + +FUNCTION: void +cairo_line_to ( cairo_t* cr, double x, double y ) ; + +FUNCTION: void +cairo_curve_to ( cairo_t* cr, double x1, double y1, double x2, double y2, double x3, double y3 ) ; + +FUNCTION: void +cairo_arc ( cairo_t* cr, double xc, double yc, double radius, double angle1, double angle2 ) ; + +FUNCTION: void +cairo_arc_negative ( cairo_t* cr, double xc, double yc, double radius, double angle1, double angle2 ) ; + +FUNCTION: void +cairo_rel_move_to ( cairo_t* cr, double dx, double dy ) ; + +FUNCTION: void +cairo_rel_line_to ( cairo_t* cr, double dx, double dy ) ; + +FUNCTION: void +cairo_rel_curve_to ( cairo_t* cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3 ) ; + +FUNCTION: void +cairo_rectangle ( cairo_t* cr, double x, double y, double width, double height ) ; + +FUNCTION: void +cairo_close_path ( cairo_t* cr ) ; + +FUNCTION: void +cairo_path_extents ( cairo_t* cr, double* x1, double* y1, double* x2, double* y2 ) ; + +! Painting functions +FUNCTION: void +cairo_paint ( cairo_t* cr ) ; + +FUNCTION: void +cairo_paint_with_alpha ( cairo_t* cr, double alpha ) ; + +FUNCTION: void +cairo_mask ( cairo_t* cr, cairo_pattern_t* pattern ) ; + +FUNCTION: void +cairo_mask_surface ( cairo_t* cr, cairo_surface_t* surface, double surface_x, double surface_y ) ; + +FUNCTION: void +cairo_stroke ( cairo_t* cr ) ; + +FUNCTION: void +cairo_stroke_preserve ( cairo_t* cr ) ; + +FUNCTION: void +cairo_fill ( cairo_t* cr ) ; + +FUNCTION: void +cairo_fill_preserve ( cairo_t* cr ) ; + +FUNCTION: void +cairo_copy_page ( cairo_t* cr ) ; + +FUNCTION: void +cairo_show_page ( cairo_t* cr ) ; + +! Insideness testing +FUNCTION: cairo_bool_t +cairo_in_stroke ( cairo_t* cr, double x, double y ) ; + +FUNCTION: cairo_bool_t +cairo_in_fill ( cairo_t* cr, double x, double y ) ; + +! Rectangular extents +FUNCTION: void +cairo_stroke_extents ( cairo_t* cr, double* x1, double* y1, double* x2, double* y2 ) ; + +FUNCTION: void +cairo_fill_extents ( cairo_t* cr, double* x1, double* y1, double* x2, double* y2 ) ; + +! Clipping +FUNCTION: void +cairo_reset_clip ( cairo_t* cr ) ; + +FUNCTION: void +cairo_clip ( cairo_t* cr ) ; + +FUNCTION: void +cairo_clip_preserve ( cairo_t* cr ) ; + +FUNCTION: void +cairo_clip_extents ( cairo_t* cr, double* x1, double* y1, double* x2, double* y2 ) ; + +C-STRUCT: cairo_rectangle_t + { "double" "x" } + { "double" "y" } + { "double" "width" } + { "double" "height" } ; + +C-STRUCT: cairo_rectangle_list_t + { "cairo_status_t" "status" } + { "cairo_rectangle_t*" "rectangles" } + { "int" "num_rectangles" } ; + +FUNCTION: cairo_rectangle_list_t* +cairo_copy_clip_rectangle_list ( cairo_t* cr ) ; + +FUNCTION: void +cairo_rectangle_list_destroy ( cairo_rectangle_list_t* rectangle_list ) ; + +! Font/Text functions + +TYPEDEF: void* cairo_scaled_font_t + +TYPEDEF: void* cairo_font_face_t + +C-STRUCT: cairo_glyph_t + { "ulong" "index" } + { "double" "x" } + { "double" "y" } ; + +C-STRUCT: cairo_text_extents_t + { "double" "x_bearing" } + { "double" "y_bearing" } + { "double" "width" } + { "double" "height" } + { "double" "x_advance" } + { "double" "y_advance" } ; + +C-STRUCT: cairo_font_extents_t + { "double" "ascent" } + { "double" "descent" } + { "double" "height" } + { "double" "max_x_advance" } + { "double" "max_y_advance" } ; + +TYPEDEF: int cairo_font_slant_t +C-ENUM: + CAIRO_FONT_SLANT_NORMAL + CAIRO_FONT_SLANT_ITALIC + CAIRO_FONT_SLANT_OBLIQUE ; + +TYPEDEF: int cairo_font_weight_t +C-ENUM: + CAIRO_FONT_WEIGHT_NORMAL + CAIRO_FONT_WEIGHT_BOLD ; TYPEDEF: int cairo_subpixel_order_t C-ENUM: @@ -182,8 +395,7 @@ C-ENUM: CAIRO_SUBPIXEL_ORDER_RGB CAIRO_SUBPIXEL_ORDER_BGR CAIRO_SUBPIXEL_ORDER_VRGB - CAIRO_SUBPIXEL_ORDER_VBGR -; + CAIRO_SUBPIXEL_ORDER_VBGR ; TYPEDEF: int cairo_hint_style_t C-ENUM: @@ -191,270 +403,548 @@ C-ENUM: CAIRO_HINT_STYLE_NONE CAIRO_HINT_STYLE_SLIGHT CAIRO_HINT_STYLE_MEDIUM - CAIRO_HINT_STYLE_FULL -; + CAIRO_HINT_STYLE_FULL ; TYPEDEF: int cairo_hint_metrics_t C-ENUM: CAIRO_HINT_METRICS_DEFAULT CAIRO_HINT_METRICS_OFF - CAIRO_HINT_METRICS_ON -; + CAIRO_HINT_METRICS_ON ; -FUNCTION: char* cairo_status_to_string ( cairo_status_t status ) ; -FUNCTION: cairo_status_t cairo_status ( cairo_t* cr ) ; +TYPEDEF: void* cairo_font_options_t -: cairo_create ( cairo_surface_t -- cairo_t ) - "cairo_t*" "cairo" "cairo_create" [ "void*" ] alien-invoke ; +FUNCTION: cairo_font_options_t* +cairo_font_options_create ( ) ; -: cairo_reference ( cairo_t -- cairo_t ) - "cairo_t*" "cairo" "cairo_reference" [ "cairo_t*" ] alien-invoke ; +FUNCTION: cairo_font_options_t* +cairo_font_options_copy ( cairo_font_options_t* original ) ; -: cairo_destroy ( cairo_t -- ) - "void" "cairo" "cairo_destroy" [ "cairo_t*" ] alien-invoke ; +FUNCTION: void +cairo_font_options_destroy ( cairo_font_options_t* options ) ; -: cairo_save ( cairo_t -- ) - "void" "cairo" "cairo_save" [ "cairo_t*" ] alien-invoke ; +FUNCTION: cairo_status_t +cairo_font_options_status ( cairo_font_options_t* options ) ; -: cairo_restore ( cairo_t -- ) - "void" "cairo" "cairo_restore" [ "cairo_t*" ] alien-invoke ; +FUNCTION: void +cairo_font_options_merge ( cairo_font_options_t* options, cairo_font_options_t* other ) ; -: cairo_set_operator ( cairo_t cairo_operator_t -- ) - "void" "cairo" "cairo_set_operator" [ "cairo_t*" "int" ] alien-invoke ; +FUNCTION: cairo_bool_t +cairo_font_options_equal ( cairo_font_options_t* options, cairo_font_options_t* other ) ; -: cairo_set_source ( cairo_t cairo_pattern_t -- ) - "void" "cairo" "cairo_set_source" [ "cairo_t*" "void*" ] alien-invoke ; +FUNCTION: ulong +cairo_font_options_hash ( cairo_font_options_t* options ) ; -: cairo_set_source_rgb ( cairo_t red green blue -- ) - "void" "cairo" "cairo_set_source_rgb" [ "cairo_t*" "double" "double" "double" ] alien-invoke ; +FUNCTION: void +cairo_font_options_set_antialias ( cairo_font_options_t* options, cairo_antialias_t antialias ) ; -: cairo_set_source_rgba ( cairo_t red green blue alpha -- ) - "void" "cairo" "cairo_set_source_rgb" [ "cairo_t*" "double" "double" "double" "double" ] alien-invoke ; +FUNCTION: cairo_antialias_t +cairo_font_options_get_antialias ( cairo_font_options_t* options ) ; -: cairo_set_source_surface ( cairo_t cairo_surface_t x y -- ) - "void" "cairo" "cairo_set_source_surface" [ "cairo_t*" "void*" "double" "double" ] alien-invoke ; +FUNCTION: void +cairo_font_options_set_subpixel_order ( cairo_font_options_t* options, cairo_subpixel_order_t subpixel_order ) ; -: cairo_set_tolerance ( cairo_t tolerance -- ) - "void" "cairo" "cairo_set_tolerance" [ "cairo_t*" "double" ] alien-invoke ; +FUNCTION: cairo_subpixel_order_t +cairo_font_options_get_subpixel_order ( cairo_font_options_t* options ) ; -: cairo_image_surface_create_for_data ( data format width height stride -- cairo_surface_t ) - "void*" "cairo" "cairo_image_surface_create_for_data" [ "void*" "uint" "int" "int" "int" ] alien-invoke ; - +FUNCTION: void +cairo_font_options_set_hint_style ( cairo_font_options_t* options, cairo_hint_style_t hint_style ) ; -: cairo_set_antialias ( cairo_t cairo_antialias_t -- ) - "void" "cairo" "cairo_set_antialias" [ "cairo_t*" "int" ] alien-invoke ; +FUNCTION: cairo_hint_style_t +cairo_font_options_get_hint_style ( cairo_font_options_t* options ) ; -: cairo_set_fill_rule ( cairo_t cairo_fill_rule_t -- ) - "void" "cairo" "cairo_set_fill_rule" [ "cairo_t*" "int" ] alien-invoke ; +FUNCTION: void +cairo_font_options_set_hint_metrics ( cairo_font_options_t* options, cairo_hint_metrics_t hint_metrics ) ; -: cairo_set_line_width ( cairo_t width -- ) - "void" "cairo" "cairo_set_line_width" [ "cairo_t*" "double" ] alien-invoke ; +FUNCTION: cairo_hint_metrics_t +cairo_font_options_get_hint_metrics ( cairo_font_options_t* options ) ; -: cairo_set_line_cap ( cairo_t cairo_line_cap_t -- ) - "void" "cairo" "cairo_set_line_cap" [ "cairo_t*" "int" ] alien-invoke ; +! This interface is for dealing with text as text, not caring about the +! font object inside the the cairo_t. -: cairo_set_line_join ( cairo_t cairo_line_join_t -- ) - "void" "cairo" "cairo_set_line_join" [ "cairo_t*" "int" ] alien-invoke ; +FUNCTION: void +cairo_select_font_face ( cairo_t* cr, char* family, cairo_font_slant_t slant, cairo_font_weight_t weight ) ; -: cairo_set_dash ( cairo_t dashes num_dashes offset -- ) - "void" "cairo" "cairo_set_dash" [ "cairo_t*" "double" "int" "double" ] alien-invoke ; +FUNCTION: void +cairo_set_font_size ( cairo_t* cr, double size ) ; -: cairo_set_miter_limit ( cairo_t limit -- ) - "void" "cairo" "cairo_set_miter_limit" [ "cairo_t*" "double" ] alien-invoke ; +FUNCTION: void +cairo_set_font_matrix ( cairo_t* cr, cairo_matrix_t* matrix ) ; -: cairo_translate ( cairo_t x y -- ) - "void" "cairo" "cairo_translate" [ "cairo_t*" "double" "double" ] alien-invoke ; +FUNCTION: void +cairo_get_font_matrix ( cairo_t* cr, cairo_matrix_t* matrix ) ; -: cairo_scale ( cairo_t sx sy -- ) - "void" "cairo" "cairo_scale" [ "cairo_t*" "double" "double" ] alien-invoke ; +FUNCTION: void +cairo_set_font_options ( cairo_t* cr, cairo_font_options_t* options ) ; -: cairo_rotate ( cairo_t angle -- ) - "void" "cairo" "cairo_rotate" [ "cairo_t*" "double" ] alien-invoke ; +FUNCTION: void +cairo_get_font_options ( cairo_t* cr, cairo_font_options_t* options ) ; -: cairo_transform ( cairo_t cairo_matrix_t -- ) - "void" "cairo" "cairo_transform" [ "cairo_t*" "cairo_matrix_t*" ] alien-invoke ; +FUNCTION: void +cairo_set_font_face ( cairo_t* cr, cairo_font_face_t* font_face ) ; -: cairo_set_matrix ( cairo_t cairo_matrix_t -- ) - "void" "cairo" "cairo_set_matrix" [ "cairo_t*" "cairo_matrix_t*" ] alien-invoke ; +FUNCTION: cairo_font_face_t* +cairo_get_font_face ( cairo_t* cr ) ; -: cairo_identity_matrix ( cairo_t -- ) - "void" "cairo" "cairo_identity_matrix" [ "cairo_t*" ] alien-invoke ; +FUNCTION: void +cairo_set_scaled_font ( cairo_t* cr, cairo_scaled_font_t* scaled_font ) ; -! cairo path creating functions +FUNCTION: cairo_scaled_font_t* +cairo_get_scaled_font ( cairo_t* cr ) ; -: cairo_new_path ( cairo_t -- ) - "void" "cairo" "cairo_new_path" [ "cairo_t*" ] alien-invoke ; +FUNCTION: void +cairo_show_text ( cairo_t* cr, char* utf8 ) ; -: cairo_move_to ( cairo_t x y -- ) - "void" "cairo" "cairo_move_to" [ "cairo_t*" "double" "double" ] alien-invoke ; +FUNCTION: void +cairo_show_glyphs ( cairo_t* cr, cairo_glyph_t* glyphs, int num_glyphs ) ; -: cairo_new_sub_path ( cairo_t -- ) - "void" "cairo" "cairo_new_sub_path" [ "cairo_t*" ] alien-invoke ; - -: cairo_line_to ( cairo_t x y -- ) - "void" "cairo" "cairo_line_to" [ "cairo_t*" "double" "double" ] alien-invoke ; +FUNCTION: void +cairo_text_path ( cairo_t* cr, char* utf8 ) ; -: cairo_curve_to ( cairo_t x1 y1 x2 y2 x3 y3 -- ) - "void" "cairo" "cairo_curve_to" [ "cairo_t*" "double" "double" "double" "double" "double" "double" ] alien-invoke ; +FUNCTION: void +cairo_glyph_path ( cairo_t* cr, cairo_glyph_t* glyphs, int num_glyphs ) ; -: cairo_arc ( cairo_t xc yc radius angle1 angle2 -- ) - "void" "cairo" "cairo_arc" [ "cairo_t*" "double" "double" "double" "double" "double" ] alien-invoke ; +FUNCTION: void +cairo_text_extents ( cairo_t* cr, char* utf8, cairo_text_extents_t* extents ) ; -: cairo_arc_negative ( cairo_t xc yc radius angle1 angle2 -- ) - "void" "cairo" "cairo_arc_negative" [ "cairo_t*" "double" "double" "double" "double" "double" ] alien-invoke ; - -: cairo_rel_move_to ( cairo_t dx dy -- ) - "void" "cairo" "cairo_rel_move_to" [ "cairo_t*" "double" "double" ] alien-invoke ; - -: cairo_rel_line_to ( cairo_t dx dy -- ) - "void" "cairo" "cairo_rel_line_to" [ "cairo_t*" "double" "double" ] alien-invoke ; +FUNCTION: void +cairo_glyph_extents ( cairo_t* cr, cairo_glyph_t* glyphs, int num_glyphs, cairo_text_extents_t* extents ) ; -: cairo_rel_curve_to ( cairo_t dx1 dy1 dx2 dy2 dx3 dy3 -- ) - "void" "cairo" "cairo_rel_curve_to" [ "cairo_t*" "double" "double" "double" "double" "double" "double" ] alien-invoke ; +FUNCTION: void +cairo_font_extents ( cairo_t* cr, cairo_font_extents_t* extents ) ; -: cairo_rectangle ( cairo_t x y width height -- ) - "void" "cairo" "cairo_rectangle" [ "cairo_t*" "double" "double" "double" "double" ] alien-invoke ; +! Generic identifier for a font style -: cairo_close_path ( cairo_t -- ) - "void" "cairo" "cairo_close_path" [ "cairo_t*" ] alien-invoke ; +FUNCTION: cairo_font_face_t* +cairo_font_face_reference ( cairo_font_face_t* font_face ) ; + +FUNCTION: void +cairo_font_face_destroy ( cairo_font_face_t* font_face ) ; + +FUNCTION: uint +cairo_font_face_get_reference_count ( cairo_font_face_t* font_face ) ; + +FUNCTION: cairo_status_t +cairo_font_face_status ( cairo_font_face_t* font_face ) ; + +TYPEDEF: int cairo_font_type_t +C-ENUM: + CAIRO_FONT_TYPE_TOY + CAIRO_FONT_TYPE_FT + CAIRO_FONT_TYPE_WIN32 + CAIRO_FONT_TYPE_QUARTZ ; + +FUNCTION: cairo_font_type_t +cairo_font_face_get_type ( cairo_font_face_t* font_face ) ; + +FUNCTION: void* +cairo_font_face_get_user_data ( cairo_font_face_t* font_face, cairo_user_data_key_t* key ) ; + +FUNCTION: cairo_status_t +cairo_font_face_set_user_data ( cairo_font_face_t* font_face, cairo_user_data_key_t* key, void* user_data, cairo_destroy_func_t destroy ) ; + +! Portable interface to general font features. + +FUNCTION: cairo_scaled_font_t* +cairo_scaled_font_create ( cairo_font_face_t* font_face, cairo_matrix_t* font_matrix, cairo_matrix_t* ctm, cairo_font_options_t* options ) ; + +FUNCTION: cairo_scaled_font_t* +cairo_scaled_font_reference ( cairo_scaled_font_t* scaled_font ) ; + +FUNCTION: void +cairo_scaled_font_destroy ( cairo_scaled_font_t* scaled_font ) ; + +FUNCTION: uint +cairo_scaled_font_get_reference_count ( cairo_scaled_font_t* scaled_font ) ; + +FUNCTION: cairo_status_t +cairo_scaled_font_status ( cairo_scaled_font_t* scaled_font ) ; + +FUNCTION: cairo_font_type_t +cairo_scaled_font_get_type ( cairo_scaled_font_t* scaled_font ) ; + +FUNCTION: void* +cairo_scaled_font_get_user_data ( cairo_scaled_font_t* scaled_font, cairo_user_data_key_t* key ) ; + +FUNCTION: cairo_status_t +cairo_scaled_font_set_user_data ( cairo_scaled_font_t* scaled_font, cairo_user_data_key_t* key, void* user_data, cairo_destroy_func_t destroy ) ; + +FUNCTION: void +cairo_scaled_font_extents ( cairo_scaled_font_t* scaled_font, cairo_font_extents_t* extents ) ; + +FUNCTION: void +cairo_scaled_font_text_extents ( cairo_scaled_font_t* scaled_font, char* utf8, cairo_text_extents_t* extents ) ; + +FUNCTION: void +cairo_scaled_font_glyph_extents ( cairo_scaled_font_t* scaled_font, cairo_glyph_t* glyphs, int num_glyphs, cairo_text_extents_t* extents ) ; + +FUNCTION: cairo_font_face_t* +cairo_scaled_font_get_font_face ( cairo_scaled_font_t* scaled_font ) ; + +FUNCTION: void +cairo_scaled_font_get_font_matrix ( cairo_scaled_font_t* scaled_font, cairo_matrix_t* font_matrix ) ; + +FUNCTION: void +cairo_scaled_font_get_ctm ( cairo_scaled_font_t* scaled_font, cairo_matrix_t* ctm ) ; + +FUNCTION: void +cairo_scaled_font_get_font_options ( cairo_scaled_font_t* scaled_font, cairo_font_options_t* options ) ; + +! Query functions + +FUNCTION: cairo_operator_t +cairo_get_operator ( cairo_t* cr ) ; + +FUNCTION: cairo_pattern_t* +cairo_get_source ( cairo_t* cr ) ; + +FUNCTION: double +cairo_get_tolerance ( cairo_t* cr ) ; + +FUNCTION: cairo_antialias_t +cairo_get_antialias ( cairo_t* cr ) ; + +FUNCTION: cairo_bool_t +cairo_has_current_point ( cairo_t* cr ) ; + +FUNCTION: void +cairo_get_current_point ( cairo_t* cr, double* x, double* y ) ; + +FUNCTION: cairo_fill_rule_t +cairo_get_fill_rule ( cairo_t* cr ) ; + +FUNCTION: double +cairo_get_line_width ( cairo_t* cr ) ; + +FUNCTION: cairo_line_cap_t +cairo_get_line_cap ( cairo_t* cr ) ; + +FUNCTION: cairo_line_join_t +cairo_get_line_join ( cairo_t* cr ) ; + +FUNCTION: double +cairo_get_miter_limit ( cairo_t* cr ) ; + +FUNCTION: int +cairo_get_dash_count ( cairo_t* cr ) ; + +FUNCTION: void +cairo_get_dash ( cairo_t* cr, double* dashes, double* offset ) ; + +FUNCTION: void +cairo_get_matrix ( cairo_t* cr, cairo_matrix_t* matrix ) ; + +FUNCTION: cairo_surface_t* +cairo_get_target ( cairo_t* cr ) ; + +FUNCTION: cairo_surface_t* +cairo_get_group_target ( cairo_t* cr ) ; + +TYPEDEF: int cairo_path_data_type_t +C-ENUM: + CAIRO_PATH_MOVE_TO + CAIRO_PATH_LINE_TO + CAIRO_PATH_CURVE_TO + CAIRO_PATH_CLOSE_PATH ; + +! NEED TO DO UNION HERE +C-STRUCT: cairo_path_data_t-point + { "double" "x" } + { "double" "y" } ; + +C-STRUCT: cairo_path_data_t-header + { "cairo_path_data_type_t" "type" } + { "int" "length" } ; + +C-UNION: cairo_path_data_t "cairo_path_data_t-point" "cairo_path_data_t-header" ; + +C-STRUCT: cairo_path_t + { "cairo_status_t" "status" } + { "cairo_path_data_t*" "data" } + { "int" "num_data" } ; + +FUNCTION: cairo_path_t* +cairo_copy_path ( cairo_t* cr ) ; + +FUNCTION: cairo_path_t* +cairo_copy_path_flat ( cairo_t* cr ) ; + +FUNCTION: void +cairo_append_path ( cairo_t* cr, cairo_path_t* path ) ; + +FUNCTION: void +cairo_path_destroy ( cairo_path_t* path ) ; + +! Error status queries + +FUNCTION: cairo_status_t +cairo_status ( cairo_t* cr ) ; + +FUNCTION: char* +cairo_status_to_string ( cairo_status_t status ) ; ! Surface manipulation -: cairo_surface_create_similar ( cairo_surface_t cairo_content_t width height -- cairo_surface_t ) - "cairo_surface_t*" "cairo" "cairo_surface_create_similar" [ "cairo_surface_t*" "uint" "int" "int" ] alien-invoke ; +FUNCTION: cairo_surface_t* +cairo_surface_create_similar ( cairo_surface_t* other, cairo_content_t content, int width, int height ) ; -: cairo_surface_reference ( cairo_surface_t -- cairo_surface_t ) - "cairo_surface_t*" "cairo" "cairo_surface_reference" [ "cairo_surface_t*" ] alien-invoke ; +FUNCTION: cairo_surface_t* +cairo_surface_reference ( cairo_surface_t* surface ) ; -: cairo_surface_finish ( cairo_surface_t -- ) - "void" "cairo" "cairo_surface_finish" [ "cairo_surface_t*" ] alien-invoke ; +FUNCTION: void +cairo_surface_finish ( cairo_surface_t* surface ) ; -: cairo_surface_destroy ( cairo_surface_t -- ) - "void" "cairo" "cairo_surface_destroy" [ "cairo_surface_t*" ] alien-invoke ; +FUNCTION: void +cairo_surface_destroy ( cairo_surface_t* surface ) ; -: cairo_surface_get_reference_count ( cairo_surface_t -- count ) - "uint" "cairo" "cairo_surface_get_reference_count" [ "cairo_surface_t*" ] alien-invoke ; +FUNCTION: uint +cairo_surface_get_reference_count ( cairo_surface_t* surface ) ; -: cairo_surface_status ( cairo_surface_t -- cairo_status_t ) - "uint" "cairo" "cairo_surface_status" [ "cairo_surface_t*" ] alien-invoke ; +FUNCTION: cairo_status_t +cairo_surface_status ( cairo_surface_t* surface ) ; -: cairo_surface_flush ( cairo_surface_t -- ) - "void" "cairo" "cairo_surface_flush" [ "cairo_surface_t*" ] alien-invoke ; +TYPEDEF: int cairo_surface_type_t +C-ENUM: + CAIRO_SURFACE_TYPE_IMAGE + CAIRO_SURFACE_TYPE_PDF + CAIRO_SURFACE_TYPE_PS + CAIRO_SURFACE_TYPE_XLIB + CAIRO_SURFACE_TYPE_XCB + CAIRO_SURFACE_TYPE_GLITZ + CAIRO_SURFACE_TYPE_QUARTZ + CAIRO_SURFACE_TYPE_WIN32 + CAIRO_SURFACE_TYPE_BEOS + CAIRO_SURFACE_TYPE_DIRECTFB + CAIRO_SURFACE_TYPE_SVG + CAIRO_SURFACE_TYPE_OS2 + CAIRO_SURFACE_TYPE_WIN32_PRINTING + CAIRO_SURFACE_TYPE_QUARTZ_IMAGE ; -! painting functions -: cairo_paint ( cairo_t -- ) - "void" "cairo" "cairo_paint" [ "cairo_t*" ] alien-invoke ; +FUNCTION: cairo_surface_type_t +cairo_surface_get_type ( cairo_surface_t* surface ) ; -: cairo_paint_with_alpha ( cairo_t alpha -- ) - "void" "cairo" "cairo_paint_with_alpha" [ "cairo_t*" "double" ] alien-invoke ; +FUNCTION: cairo_content_t +cairo_surface_get_content ( cairo_surface_t* surface ) ; -: cairo_mask ( cairo_t cairo_pattern_t -- ) - "void" "cairo" "cairo_mask" [ "cairo_t*" "void*" ] alien-invoke ; +FUNCTION: cairo_status_t +cairo_surface_write_to_png ( cairo_surface_t* surface, char* filename ) ; -: cairo_mask_surface ( cairo_t cairo_pattern_t surface-x surface-y -- ) - "void" "cairo" "cairo_mask_surface" [ "cairo_t*" "void*" "double" "double" ] alien-invoke ; +FUNCTION: cairo_status_t +cairo_surface_write_to_png_stream ( cairo_surface_t* surface, cairo_write_func_t write_func, void* closure ) ; -: cairo_stroke ( cairo_t -- ) - "void" "cairo" "cairo_stroke" [ "cairo_t*" ] alien-invoke ; +FUNCTION: void* +cairo_surface_get_user_data ( cairo_surface_t* surface, cairo_user_data_key_t* key ) ; -: cairo_stroke_preserve ( cairo_t -- ) - "void" "cairo" "cairo_stroke_preserve" [ "cairo_t*" ] alien-invoke ; +FUNCTION: cairo_status_t +cairo_surface_set_user_data ( cairo_surface_t* surface, cairo_user_data_key_t* key, void* user_data, cairo_destroy_func_t destroy ) ; -: cairo_fill ( cairo_t -- ) - "void" "cairo" "cairo_fill" [ "cairo_t*" ] alien-invoke ; +FUNCTION: void +cairo_surface_get_font_options ( cairo_surface_t* surface, cairo_font_options_t* options ) ; -: cairo_fill_preserve ( cairo_t -- ) - "void" "cairo" "cairo_fill_preserve" [ "cairo_t*" ] alien-invoke ; +FUNCTION: void +cairo_surface_flush ( cairo_surface_t* surface ) ; -: cairo_copy_page ( cairo_t -- ) - "void" "cairo" "cairo_copy_page" [ "cairo_t*" ] alien-invoke ; +FUNCTION: void +cairo_surface_mark_dirty ( cairo_surface_t* surface ) ; -: cairo_show_page ( cairo_t -- ) - "void" "cairo" "cairo_show_page" [ "cairo_t*" ] alien-invoke ; +FUNCTION: void +cairo_surface_mark_dirty_rectangle ( cairo_surface_t* surface, int x, int y, int width, int height ) ; -! insideness testing -: cairo_in_stroke ( cairo_t x y -- t/f ) - "int" "cairo" "cairo_in_stroke" [ "cairo_t*" "double" "double" ] alien-invoke ; +FUNCTION: void +cairo_surface_set_device_offset ( cairo_surface_t* surface, double x_offset, double y_offset ) ; -: cairo_in_fill ( cairo_t x y -- t/f ) - "int" "cairo" "cairo_in_fill" [ "cairo_t*" "double" "double" ] alien-invoke ; +FUNCTION: void +cairo_surface_get_device_offset ( cairo_surface_t* surface, double* x_offset, double* y_offset ) ; -! rectangular extents -: cairo_stroke_extents ( cairo_t x1 y1 x2 y2 -- ) - "void" "cairo" "cairo_stroke_extents" [ "cairo_t*" "double" "double" "double" "double" ] alien-invoke ; +FUNCTION: void +cairo_surface_set_fallback_resolution ( cairo_surface_t* surface, double x_pixels_per_inch, double y_pixels_per_inch ) ; -: cairo_fill_extents ( cairo_t x1 y1 x2 y2 -- ) - "void" "cairo" "cairo_fill_extents" [ "cairo_t*" "double" "double" "double" "double" ] alien-invoke ; +FUNCTION: void +cairo_surface_copy_page ( cairo_surface_t* surface ) ; -! clipping -: cairo_reset_clip ( cairo_t -- ) - "void" "cairo" "cairo_reset_clip" [ "cairo_t*" ] alien-invoke ; +FUNCTION: void +cairo_surface_show_page ( cairo_surface_t* surface ) ; -: cairo_clip ( cairo_t -- ) - "void" "cairo" "cairo_clip" [ "cairo_t*" ] alien-invoke ; +! Image-surface functions -: cairo_clip_preserve ( cairo_t -- ) - "void" "cairo" "cairo_clip_preserve" [ "cairo_t*" ] alien-invoke ; +TYPEDEF: int cairo_format_t +C-ENUM: + CAIRO_FORMAT_ARGB32 + CAIRO_FORMAT_RGB24 + CAIRO_FORMAT_A8 + CAIRO_FORMAT_A1 + CAIRO_FORMAT_RGB16_565 ; +FUNCTION: cairo_surface_t* +cairo_image_surface_create ( cairo_format_t format, int width, int height ) ; -: cairo_pattern_create_linear ( x0 y0 x1 y1 -- cairo_pattern_t ) - "void*" "cairo" "cairo_pattern_create_linear" [ "double" "double" "double" "double" ] alien-invoke ; +FUNCTION: int +cairo_format_stride_for_width ( cairo_format_t format, int width ) ; -: cairo_pattern_create_radial ( cx0 cy0 radius0 cx1 cy1 radius1 -- cairo_pattern_t ) - "void*" "cairo" "cairo_pattern_create_radial" [ "double" "double" "double" "double" "double" "double" ] alien-invoke ; +FUNCTION: cairo_surface_t* +cairo_image_surface_create_for_data ( uchar* data, cairo_format_t format, int width, int height, int stride ) ; -: cairo_pattern_add_color_stop_rgba ( pattern offset red green blue alpha -- status ) - "uint" "cairo" "cairo_pattern_add_color_stop_rgba" [ "void*" "double" "double" "double" "double" "double" ] alien-invoke ; +FUNCTION: uchar* +cairo_image_surface_get_data ( cairo_surface_t* surface ) ; -: cairo_show_text ( cairo_t msg_utf8 -- ) - "void" "cairo" "cairo_show_text" [ "cairo_t*" "char*" ] alien-invoke ; +FUNCTION: cairo_format_t +cairo_image_surface_get_format ( cairo_surface_t* surface ) ; -: cairo_text_path ( cairo_t msg_utf8 -- ) - "void" "cairo" "cairo_text_path" [ "cairo_t*" "char*" ] alien-invoke ; +FUNCTION: int +cairo_image_surface_get_width ( cairo_surface_t* surface ) ; -: cairo_select_font_face ( cairo_t family font_slant font_weight -- ) - "void" "cairo" "cairo_select_font_face" [ "cairo_t*" "char*" "uint" "uint" ] alien-invoke ; +FUNCTION: int +cairo_image_surface_get_height ( cairo_surface_t* surface ) ; -: cairo_set_font_size ( cairo_t scale -- ) - "void" "cairo" "cairo_set_font_size" [ "cairo_t*" "double" ] alien-invoke ; +FUNCTION: int +cairo_image_surface_get_stride ( cairo_surface_t* surface ) ; -: cairo_set_font_matrix ( cairo_t cairo_matrix_t -- ) - "void" "cairo" "cairo_set_font_matrix" [ "cairo_t*" "cairo_matrix_t*" ] alien-invoke ; +FUNCTION: cairo_surface_t* +cairo_image_surface_create_from_png ( char* filename ) ; -: cairo_get_font_matrix ( cairo_t cairo_matrix_t -- ) - "void" "cairo" "cairo_get_font_matrix" [ "cairo_t*" "cairo_matrix_t*" ] alien-invoke ; +FUNCTION: cairo_surface_t* +cairo_image_surface_create_from_png_stream ( cairo_read_func_t read_func, void* closure ) ; -FUNCTION: uchar* cairo_image_surface_get_data ( cairo_surface_t* surface ) ; -FUNCTION: cairo_format_t cairo_image_surface_get_format ( cairo_surface_t* surface ) ; -FUNCTION: int cairo_image_surface_get_width ( cairo_surface_t* surface ) ; -FUNCTION: int cairo_image_surface_get_height ( cairo_surface_t* surface ) ; -FUNCTION: int cairo_image_surface_get_stride ( cairo_surface_t* surface ) ; +! Pattern creation functions -! Cairo pdf +FUNCTION: cairo_pattern_t* +cairo_pattern_create_rgb ( double red, double green, double blue ) ; -: cairo_pdf_surface_create ( filename width height -- surface ) - "void*" "cairo" "cairo_pdf_surface_create" [ "char*" "double" "double" ] alien-invoke ; +FUNCTION: cairo_pattern_t* +cairo_pattern_create_rgba ( double red, double green, double blue, double alpha ) ; -! Missing: +FUNCTION: cairo_pattern_t* +cairo_pattern_create_for_surface ( cairo_surface_t* surface ) ; -! cairo_public cairo_surface_t * -! cairo_pdf_surface_create_for_stream (cairo_write_func_t write_func, -! void *closure, -! double width_in_points, -! double height_in_points); +FUNCTION: cairo_pattern_t* +cairo_pattern_create_linear ( double x0, double y0, double x1, double y1 ) ; -: cairo_pdf_surface_set_size ( surface width height -- ) - "void" "cairo" "cairo_pdf_surface_set_size" [ "void*" "double" "double" ] alien-invoke ; +FUNCTION: cairo_pattern_t* +cairo_pattern_create_radial ( double cx0, double cy0, double radius0, double cx1, double cy1, double radius1 ) ; -! Cairo png +FUNCTION: cairo_pattern_t* +cairo_pattern_reference ( cairo_pattern_t* pattern ) ; -TYPEDEF: void* cairo_write_func_t -TYPEDEF: void* cairo_read_func_t +FUNCTION: void +cairo_pattern_destroy ( cairo_pattern_t* pattern ) ; -FUNCTION: cairo_surface_t* cairo_image_surface_create_from_png ( char* filename ) ; +FUNCTION: uint +cairo_pattern_get_reference_count ( cairo_pattern_t* pattern ) ; -FUNCTION: cairo_surface_t* cairo_image_surface_create_from_png_stream ( cairo_read_func_t read_func, void* closure ) ; +FUNCTION: cairo_status_t +cairo_pattern_status ( cairo_pattern_t* pattern ) ; -FUNCTION: cairo_status_t cairo_surface_write_to_png ( cairo_surface_t* surface, char* filename ) ; +FUNCTION: void* +cairo_pattern_get_user_data ( cairo_pattern_t* pattern, cairo_user_data_key_t* key ) ; -FUNCTION: cairo_status_t cairo_surface_write_to_png_stream ( cairo_surface_t* surface, cairo_write_func_t write_func, void* closure ) ; +FUNCTION: cairo_status_t +cairo_pattern_set_user_data ( cairo_pattern_t* pattern, cairo_user_data_key_t* key, void* user_data, cairo_destroy_func_t destroy ) ; + +TYPEDEF: int cairo_pattern_type_t +C-ENUM: + CAIRO_PATTERN_TYPE_SOLID + CAIRO_PATTERN_TYPE_SURFACE + CAIRO_PATTERN_TYPE_LINEAR + CAIRO_PATTERN_TYPE_RADIA ; + +FUNCTION: cairo_pattern_type_t +cairo_pattern_get_type ( cairo_pattern_t* pattern ) ; + +FUNCTION: void +cairo_pattern_add_color_stop_rgb ( cairo_pattern_t* pattern, double offset, double red, double green, double blue ) ; + +FUNCTION: void +cairo_pattern_add_color_stop_rgba ( cairo_pattern_t* pattern, double offset, double red, double green, double blue, double alpha ) ; + +FUNCTION: void +cairo_pattern_set_matrix ( cairo_pattern_t* pattern, cairo_matrix_t* matrix ) ; + +FUNCTION: void +cairo_pattern_get_matrix ( cairo_pattern_t* pattern, cairo_matrix_t* matrix ) ; + +TYPEDEF: int cairo_extend_t +C-ENUM: + CAIRO_EXTEND_NONE + CAIRO_EXTEND_REPEAT + CAIRO_EXTEND_REFLECT + CAIRO_EXTEND_PAD ; + +FUNCTION: void +cairo_pattern_set_extend ( cairo_pattern_t* pattern, cairo_extend_t extend ) ; + +FUNCTION: cairo_extend_t +cairo_pattern_get_extend ( cairo_pattern_t* pattern ) ; + +TYPEDEF: int cairo_filter_t +C-ENUM: + CAIRO_FILTER_FAST + CAIRO_FILTER_GOOD + CAIRO_FILTER_BEST + CAIRO_FILTER_NEAREST + CAIRO_FILTER_BILINEAR + CAIRO_FILTER_GAUSSIAN ; + +FUNCTION: void +cairo_pattern_set_filter ( cairo_pattern_t* pattern, cairo_filter_t filter ) ; + +FUNCTION: cairo_filter_t +cairo_pattern_get_filter ( cairo_pattern_t* pattern ) ; + +FUNCTION: cairo_status_t +cairo_pattern_get_rgba ( cairo_pattern_t* pattern, double* red, double* green, double* blue, double* alpha ) ; + +FUNCTION: cairo_status_t +cairo_pattern_get_surface ( cairo_pattern_t* pattern, cairo_surface_t* *surface ) ; + +FUNCTION: cairo_status_t +cairo_pattern_get_color_stop_rgba ( cairo_pattern_t* pattern, int index, double* offset, double* red, double* green, double* blue, double* alpha ) ; + +FUNCTION: cairo_status_t +cairo_pattern_get_color_stop_count ( cairo_pattern_t* pattern, int* count ) ; + +FUNCTION: cairo_status_t +cairo_pattern_get_linear_points ( cairo_pattern_t* pattern, double* x0, double* y0, double* x1, double* y1 ) ; + +FUNCTION: cairo_status_t +cairo_pattern_get_radial_circles ( cairo_pattern_t* pattern, double* x0, double* y0, double* r0, double* x1, double* y1, double* r1 ) ; + +! Matrix functions + +FUNCTION: void +cairo_matrix_init ( cairo_matrix_t* matrix, double xx, double yx, double xy, double yy, double x0, double y0 ) ; + +FUNCTION: void +cairo_matrix_init_identity ( cairo_matrix_t* matrix ) ; + +FUNCTION: void +cairo_matrix_init_translate ( cairo_matrix_t* matrix, double tx, double ty ) ; + +FUNCTION: void +cairo_matrix_init_scale ( cairo_matrix_t* matrix, double sx, double sy ) ; + +FUNCTION: void +cairo_matrix_init_rotate ( cairo_matrix_t* matrix, double radians ) ; + +FUNCTION: void +cairo_matrix_translate ( cairo_matrix_t* matrix, double tx, double ty ) ; + +FUNCTION: void +cairo_matrix_scale ( cairo_matrix_t* matrix, double sx, double sy ) ; + +FUNCTION: void +cairo_matrix_rotate ( cairo_matrix_t* matrix, double radians ) ; + +FUNCTION: cairo_status_t +cairo_matrix_invert ( cairo_matrix_t* matrix ) ; + +FUNCTION: void +cairo_matrix_multiply ( cairo_matrix_t* result, cairo_matrix_t* a, cairo_matrix_t* b ) ; + +FUNCTION: void +cairo_matrix_transform_distance ( cairo_matrix_t* matrix, double* dx, double* dy ) ; + +FUNCTION: void +cairo_matrix_transform_point ( cairo_matrix_t* matrix, double* x, double* y ) ; + +! Functions to be used while debugging (not intended for use in production code) +FUNCTION: void +cairo_debug_reset_static_data ( ) ; diff --git a/extra/cairo/gadgets/gadgets.factor b/extra/cairo/gadgets/gadgets.factor new file mode 100644 index 0000000000..c9fef618f8 --- /dev/null +++ b/extra/cairo/gadgets/gadgets.factor @@ -0,0 +1,57 @@ +! Copyright (C) 2008 Matthew Willis. +! See http://factorcode.org/license.txt for BSD license. +USING: sequences math opengl.gadgets kernel +byte-arrays cairo.ffi cairo io.backend +ui.gadgets accessors opengl.gl +arrays ; + +IN: cairo.gadgets + +: width>stride ( width -- stride ) 4 * ; + +: copy-cairo ( dim quot -- byte-array ) + >r first2 over width>stride + [ * nip dup CAIRO_FORMAT_ARGB32 ] + [ cairo_image_surface_create_for_data ] 3bi + r> with-cairo-from-surface ; inline + +TUPLE: cairo-gadget < texture-gadget dim quot ; + +: ( dim quot -- gadget ) + cairo-gadget construct-gadget + swap >>quot + swap >>dim ; + +M: cairo-gadget cache-key* [ dim>> ] [ quot>> ] bi 2array ; + +: render-cairo ( dim quot -- bytes format ) + >r 2^-bounds r> copy-cairo GL_BGRA ; inline + +! M: cairo-gadget render* +! [ dim>> dup ] [ quot>> ] bi +! render-cairo render-bytes* ; + +! maybe also texture>png +! : cairo>png ( gadget path -- ) +! >r [ cairo>bytes CAIRO_FORMAT_ARGB32 ] [ width>> ] +! [ height>> ] tri over width>stride +! cairo_image_surface_create_for_data +! r> [ cairo_surface_write_to_png check-cairo ] curry with-surface ; + +: copy-surface ( surface -- ) + cr swap 0 0 cairo_set_source_surface + cr cairo_paint ; + +TUPLE: png-gadget < texture-gadget path ; +: ( path -- gadget ) + png-gadget construct-gadget + swap >>path ; + +M: png-gadget render* + path>> normalize-path cairo_image_surface_create_from_png + [ cairo_image_surface_get_width ] + [ cairo_image_surface_get_height 2array dup 2^-bounds ] + [ [ copy-surface ] curry copy-cairo ] tri + GL_BGRA render-bytes* ; + +M: png-gadget cache-key* path>> ; diff --git a/extra/cairo/lib/lib.factor b/extra/cairo/lib/lib.factor deleted file mode 100755 index 4f532cd9ec..0000000000 --- a/extra/cairo/lib/lib.factor +++ /dev/null @@ -1,39 +0,0 @@ -! Copyright (C) 2008 Doug Coleman. -! See http://factorcode.org/license.txt for BSD license. -USING: alien.c-types cairo.ffi continuations destructors -kernel libc locals math shuffle accessors ; -IN: cairo.lib - -TUPLE: cairo-t alien ; -C: cairo-t -M: cairo-t dispose ( alien -- ) alien>> cairo_destroy ; -: cairo-t-destroy-always ( alien -- ) add-always-destructor ; -: cairo-t-destroy-later ( alien -- ) add-error-destructor ; - -TUPLE: cairo-surface-t alien ; -C: cairo-surface-t -M: cairo-surface-t dispose ( alien -- ) alien>> cairo_surface_destroy ; - -: cairo-surface-t-destroy-always ( alien -- ) - add-always-destructor ; - -: cairo-surface-t-destroy-later ( alien -- ) - add-error-destructor ; - -: cairo-surface>array ( surface -- cairo-t byte-array ) - [ - dup - [ drop CAIRO_FORMAT_ARGB32 ] - [ cairo_image_surface_get_width ] - [ cairo_image_surface_get_height ] tri - over 4 * - 2dup * [ - malloc dup free-always [ - 5 -nrot cairo_image_surface_create_for_data - dup cairo-surface-t-destroy-always - cairo_create dup cairo-t-destroy-later - [ swap 0 0 cairo_set_source_surface ] keep - dup cairo_paint - ] keep - ] keep memory>byte-array - ] with-destructors ; diff --git a/extra/cairo/png/png.factor b/extra/cairo/png/png.factor deleted file mode 100755 index 1bbad29835..0000000000 --- a/extra/cairo/png/png.factor +++ /dev/null @@ -1,65 +0,0 @@ -! Copyright (C) 2008 Doug Coleman. -! See http://factorcode.org/license.txt for BSD license. -USING: arrays kernel accessors math ui.gadgets ui.render -opengl.gl byte-arrays namespaces opengl cairo.ffi cairo.lib -inspector sequences combinators io.backend ; -IN: cairo.png - -TUPLE: png surface width height cairo-t array ; -TUPLE: png-gadget png ; - -ERROR: cairo-error string ; - -: check-zero ( n -- n ) - dup zero? [ - "PNG dimension is 0" cairo-error - ] when ; - -: cairo-png-error ( n -- ) - { - { CAIRO_STATUS_NO_MEMORY [ "Cairo: no memory" cairo-error ] } - { CAIRO_STATUS_FILE_NOT_FOUND [ "Cairo: file not found" cairo-error ] } - { CAIRO_STATUS_READ_ERROR [ "Cairo: read error" cairo-error ] } - [ drop ] - } cond ; - -: ( path -- png ) - normalize-path - cairo_image_surface_create_from_png - dup cairo_surface_status cairo-png-error - dup [ cairo_image_surface_get_width check-zero ] - [ cairo_image_surface_get_height check-zero ] [ ] tri - cairo-surface>array png boa ; - -: write-png ( png path -- ) - >r png-surface r> - cairo_surface_write_to_png - zero? [ "write png failed" throw ] unless ; - -: ( path -- gadget ) - png-gadget construct-gadget swap - >>png ; - -M: png-gadget pref-dim* ( gadget -- ) - png>> - [ width>> ] [ height>> ] bi 2array ; - -M: png-gadget draw-gadget* ( gadget -- ) - origin get [ - 0 0 glRasterPos2i - 1.0 -1.0 glPixelZoom - png>> - [ width>> ] - [ height>> GL_RGBA GL_UNSIGNED_BYTE ] - ! [ height>> GL_BGRA GL_UNSIGNED_BYTE ] - [ array>> ] tri - glDrawPixels - ] with-translation ; - -M: png-gadget graft* ( gadget -- ) - drop ; - -M: png-gadget ungraft* ( gadget -- ) - png>> surface>> cairo_destroy ; - -! "resource:misc/icons/Factor_1x16.png" USE: cairo.png gadget. diff --git a/extra/cairo/samples/samples.factor b/extra/cairo/samples/samples.factor new file mode 100644 index 0000000000..0e83381349 --- /dev/null +++ b/extra/cairo/samples/samples.factor @@ -0,0 +1,147 @@ +! Copyright (C) 2008 Matthew Willis +! See http://factorcode.org/license.txt for BSD license. +! +! these samples are a subset of the samples on +! http://cairographics.org/samples/ +USING: cairo cairo.ffi locals math.constants math +io.backend kernel alien.c-types libc namespaces ; + +IN: cairo.samples + +:: arc ( -- ) + [let | xc [ 128.0 ] + yc [ 128.0 ] + radius [ 100.0 ] + angle1 [ pi 1/4 * ] + angle2 [ pi ] | + cr 10.0 cairo_set_line_width + cr xc yc radius angle1 angle2 cairo_arc + cr cairo_stroke + + ! draw helping lines + cr 1 0.2 0.2 0.6 cairo_set_source_rgba + cr 6.0 cairo_set_line_width + + cr xc yc 10.0 0 2 pi * cairo_arc + cr cairo_fill + + cr xc yc radius angle1 angle1 cairo_arc + cr xc yc cairo_line_to + cr xc yc radius angle2 angle2 cairo_arc + cr xc yc cairo_line_to + cr cairo_stroke + ] ; + +: clip ( -- ) + cr 128 128 76.8 0 2 pi * cairo_arc + cr cairo_clip + cr cairo_new_path + + cr 0 0 256 256 cairo_rectangle + cr cairo_fill + cr 0 1 0 cairo_set_source_rgb + cr 0 0 cairo_move_to + cr 256 256 cairo_line_to + cr 256 0 cairo_move_to + cr 0 256 cairo_line_to + cr 10 cairo_set_line_width + cr cairo_stroke ; + +:: clip-image ( -- ) + [let* | png [ "resource:misc/icons/Factor_128x128.png" + normalize-path cairo_image_surface_create_from_png ] + w [ png cairo_image_surface_get_width ] + h [ png cairo_image_surface_get_height ] | + cr 128 128 76.8 0 2 pi * cairo_arc + cr cairo_clip + cr cairo_new_path + + cr 192.0 w / 192.0 h / cairo_scale + cr png 32 32 cairo_set_source_surface + cr cairo_paint + png cairo_surface_destroy + ] ; + +:: dash ( -- ) + [let | dashes [ { 50 10 10 10 } >c-double-array ] + ndash [ 4 ] | + cr dashes ndash -50 cairo_set_dash + cr 10 cairo_set_line_width + cr 128.0 25.6 cairo_move_to + cr 230.4 230.4 cairo_line_to + cr -102.4 0 cairo_rel_line_to + cr 51.2 230.4 51.2 128.0 128.0 128.0 cairo_curve_to + cr cairo_stroke + ] ; + +:: gradient ( -- ) + [let | pat [ 0 0 0 256 cairo_pattern_create_linear ] + radial [ 115.2 102.4 25.6 102.4 102.4 128.0 + cairo_pattern_create_radial ] | + pat 1 0 0 0 1 cairo_pattern_add_color_stop_rgba + pat 0 1 1 1 1 cairo_pattern_add_color_stop_rgba + cr 0 0 256 256 cairo_rectangle + cr pat cairo_set_source + cr cairo_fill + pat cairo_pattern_destroy + + radial 0 1 1 1 1 cairo_pattern_add_color_stop_rgba + radial 1 0 0 0 1 cairo_pattern_add_color_stop_rgba + cr radial cairo_set_source + cr 128.0 128.0 76.8 0 2 pi * cairo_arc + cr cairo_fill + radial cairo_pattern_destroy + ] ; + +: text ( -- ) + cr "Serif" CAIRO_FONT_SLANT_NORMAL CAIRO_FONT_WEIGHT_BOLD + cairo_select_font_face + cr 50 cairo_set_font_size + cr 10 135 cairo_move_to + cr "Hello" cairo_show_text + + cr 70 165 cairo_move_to + cr "factor" cairo_text_path + cr 0.5 0.5 1 cairo_set_source_rgb + cr cairo_fill_preserve + cr 0 0 0 cairo_set_source_rgb + cr 2.56 cairo_set_line_width + cr cairo_stroke + + ! draw helping lines + cr 1 0.2 0.2 0.6 cairo_set_source_rgba + cr 10 135 5.12 0 2 pi * cairo_arc + cr cairo_close_path + cr 70 165 5.12 0 2 pi * cairo_arc + cr cairo_fill ; + +: utf8 ( -- ) + cr "Sans" CAIRO_FONT_SLANT_NORMAL CAIRO_FONT_WEIGHT_NORMAL + cairo_select_font_face + cr 50 cairo_set_font_size + "cairo_text_extents_t" malloc-object + cr "日本語" pick cairo_text_extents + cr over + [ cairo_text_extents_t-width 2 / ] + [ cairo_text_extents_t-x_bearing ] bi + + 128 swap - pick + [ cairo_text_extents_t-height 2 / ] + [ cairo_text_extents_t-y_bearing ] bi + + 128 swap - cairo_move_to + free + cr "日本語" cairo_show_text + + cr 1 0.2 0.2 0.6 cairo_set_source_rgba + cr 6 cairo_set_line_width + cr 128 0 cairo_move_to + cr 0 256 cairo_rel_line_to + cr 0 128 cairo_move_to + cr 256 0 cairo_rel_line_to + cr cairo_stroke ; + + USING: quotations cairo.gadgets ui.gadgets.panes sequences ; + : samples ( -- ) + { arc clip clip-image dash gradient text utf8 } + [ { 256 256 } swap 1quotation gadget. ] each ; + + MAIN: samples diff --git a/extra/calendar/calendar-tests.factor b/extra/calendar/calendar-tests.factor index c05d4f60eb..7d9716ae1a 100755 --- a/extra/calendar/calendar-tests.factor +++ b/extra/calendar/calendar-tests.factor @@ -1,5 +1,5 @@ USING: arrays calendar kernel math sequences tools.test -continuations system ; +continuations system math.order threads ; IN: calendar.tests \ time+ must-infer @@ -131,16 +131,16 @@ IN: calendar.tests [ t ] [ 2004 1 1 23 0 0 9+1/2 hours >gmt 2004 1 1 13 30 0 instant = ] unit-test -[ 0 ] [ 2004 1 1 13 30 0 instant +[ +eq+ ] [ 2004 1 1 13 30 0 instant 2004 1 1 12 30 0 -1 hours <=> ] unit-test -[ 1 ] [ 2004 1 1 13 30 0 instant +[ +gt+ ] [ 2004 1 1 13 30 0 instant 2004 1 1 12 30 0 instant <=> ] unit-test -[ -1 ] [ 2004 1 1 12 30 0 instant +[ +lt+ ] [ 2004 1 1 12 30 0 instant 2004 1 1 13 30 0 instant <=> ] unit-test -[ 1 ] [ 2005 1 1 12 30 0 instant +[ +gt+ ] [ 2005 1 1 12 30 0 instant 2004 1 1 13 30 0 instant <=> ] unit-test [ t ] [ now timestamp>millis millis - 1000 < ] unit-test @@ -163,3 +163,7 @@ IN: calendar.tests [ t ] [ 5 months checktime+ ] unit-test [ t ] [ 5 years checktime+ ] unit-test + +[ t ] [ now 50 milliseconds sleep now before? ] unit-test +[ t ] [ now 50 milliseconds sleep now swap after? ] unit-test +[ t ] [ now 50 milliseconds sleep now 50 milliseconds sleep now swapd between? ] unit-test diff --git a/extra/calendar/calendar.factor b/extra/calendar/calendar.factor index 2f93bf8218..e3cf849109 100755 --- a/extra/calendar/calendar.factor +++ b/extra/calendar/calendar.factor @@ -3,7 +3,8 @@ USING: arrays kernel math math.functions namespaces sequences strings system vocabs.loader calendar.backend threads -accessors combinators locals classes.tuple ; +accessors combinators locals classes.tuple math.order +memoize ; IN: calendar TUPLE: timestamp year month day hour minute second gmt-offset ; @@ -89,14 +90,14 @@ PRIVATE> : >time< ( timestamp -- hour minute second ) [ hour>> ] [ minute>> ] [ second>> ] tri ; -: instant ( -- dt ) 0 0 0 0 0 0 ; -: years ( n -- dt ) instant swap >>year ; -: months ( n -- dt ) instant swap >>month ; -: days ( n -- dt ) instant swap >>day ; +MEMO: instant ( -- dt ) 0 0 0 0 0 0 ; +: years ( n -- dt ) instant clone swap >>year ; +: months ( n -- dt ) instant clone swap >>month ; +: days ( n -- dt ) instant clone swap >>day ; : weeks ( n -- dt ) 7 * days ; -: hours ( n -- dt ) instant swap >>hour ; -: minutes ( n -- dt ) instant swap >>minute ; -: seconds ( n -- dt ) instant swap >>second ; +: hours ( n -- dt ) instant clone swap >>hour ; +: minutes ( n -- dt ) instant clone swap >>minute ; +: seconds ( n -- dt ) instant clone swap >>second ; : milliseconds ( n -- dt ) 1000 / seconds ; GENERIC: leap-year? ( obj -- ? ) @@ -273,14 +274,15 @@ M: timestamp time- M: duration time- before time+ ; -: 0 0 0 0 0 0 instant ; +MEMO: ( -- timestamp ) +0 0 0 0 0 0 instant ; : valid-timestamp? ( timestamp -- ? ) clone instant >>gmt-offset dup time- time+ = ; -: unix-1970 ( -- timestamp ) - 1970 1 1 0 0 0 instant ; foldable +MEMO: unix-1970 ( -- timestamp ) + 1970 1 1 0 0 0 instant ; : millis>timestamp ( n -- timestamp ) >r unix-1970 r> milliseconds time+ ; diff --git a/extra/calendar/format/format-tests.factor b/extra/calendar/format/format-tests.factor index 1ba892bef3..3efe33e265 100755 --- a/extra/calendar/format/format-tests.factor +++ b/extra/calendar/format/format-tests.factor @@ -1,5 +1,5 @@ USING: calendar.format calendar kernel math tools.test -io.streams.string accessors io ; +io.streams.string accessors io math.order ; IN: calendar.format.tests [ 0 ] [ @@ -43,3 +43,22 @@ IN: calendar.format.tests ] unit-test [ t ] [ now dup timestamp>rfc822 rfc822>timestamp time- 1 seconds before? ] unit-test + +[ t ] [ now dup timestamp>cookie-string cookie-string>timestamp time- 1 seconds before? ] unit-test + +[ "Sun, 4 May 2008 07:00:00" ] [ + "Sun May 04 07:00:00 2008 GMT" cookie-string>timestamp + timestamp>string +] unit-test + +[ + T{ timestamp f + 2008 + 5 + 26 + 0 + 37 + 42.12345 + T{ duration f 0 0 0 -5 0 0 } + } +] [ "2008-05-26T00:37:42.12345-05:00" rfc3339>timestamp ] unit-test diff --git a/extra/calendar/format/format.factor b/extra/calendar/format/format.factor index 7bdaea70b5..15dee79006 100755 --- a/extra/calendar/format/format.factor +++ b/extra/calendar/format/format.factor @@ -1,8 +1,50 @@ -USING: math math.parser kernel sequences io calendar +USING: math math.order math.parser math.functions kernel sequences io accessors arrays io.streams.string splitting -combinators accessors debugger ; +combinators accessors debugger +calendar calendar.format.macros ; IN: calendar.format +: pad-00 ( n -- str ) number>string 2 CHAR: 0 pad-left ; + +: pad-0000 ( n -- str ) number>string 4 CHAR: 0 pad-left ; + +: pad-00000 ( n -- str ) number>string 5 CHAR: 0 pad-left ; + +: write-00 ( n -- ) pad-00 write ; + +: write-0000 ( n -- ) pad-0000 write ; + +: write-00000 ( n -- ) pad-00000 write ; + +: hh ( time -- ) hour>> write-00 ; + +: mm ( time -- ) minute>> write-00 ; + +: ss ( time -- ) second>> >integer write-00 ; + +: D ( time -- ) day>> number>string write ; + +: DD ( time -- ) day>> write-00 ; + +: DAY ( time -- ) day-of-week day-abbreviations3 nth write ; + +: MM ( time -- ) month>> write-00 ; + +: MONTH ( time -- ) month>> month-abbreviations nth write ; + +: YYYY ( time -- ) year>> write-0000 ; + +: YYYYY ( time -- ) year>> write-00000 ; + +: expect ( str -- ) + read1 swap member? [ "Parse error" throw ] unless ; + +: read-00 ( -- n ) 2 read string>number ; + +: read-000 ( -- n ) 3 read string>number ; + +: read-0000 ( -- n ) 4 read string>number ; + GENERIC: day. ( obj -- ) M: integer day. ( n -- ) @@ -25,7 +67,7 @@ M: array month. ( pair -- ) ] with each nl ; M: timestamp month. ( timestamp -- ) - { year>> month>> } get-slots 2array month. ; + [ year>> ] [ month>> ] bi 2array month. ; GENERIC: year. ( obj -- ) @@ -35,43 +77,29 @@ M: integer year. ( n -- ) M: timestamp year. ( timestamp -- ) year>> year. ; -: pad-00 number>string 2 CHAR: 0 pad-left ; - -: pad-0000 number>string 4 CHAR: 0 pad-left ; - -: write-00 pad-00 write ; - -: write-0000 pad-0000 write ; - : (timestamp>string) ( timestamp -- ) - dup day-of-week day-abbreviations3 nth write ", " write - dup day>> number>string write bl - dup month>> month-abbreviations nth write bl - dup year>> number>string write bl - dup hour>> write-00 ":" write - dup minute>> write-00 ":" write - second>> >integer write-00 ; + { DAY ", " D " " MONTH " " YYYY " " hh ":" mm ":" ss } formatted ; : timestamp>string ( timestamp -- str ) [ (timestamp>string) ] with-string-writer ; : (write-gmt-offset) ( duration -- ) - [ hour>> write-00 ] [ minute>> write-00 ] bi ; + [ hh ] [ mm ] bi ; : write-gmt-offset ( gmt-offset -- ) - dup instant <=> sgn { - { 0 [ drop "GMT" write ] } - { -1 [ "-" write before (write-gmt-offset) ] } - { 1 [ "+" write (write-gmt-offset) ] } + dup instant <=> { + { +eq+ [ drop "GMT" write ] } + { +lt+ [ "-" write before (write-gmt-offset) ] } + { +gt+ [ "+" write (write-gmt-offset) ] } } case ; : timestamp>rfc822 ( timestamp -- str ) #! RFC822 timestamp format #! Example: Tue, 15 Nov 1994 08:12:31 +0200 [ - dup (timestamp>string) - " " write - gmt-offset>> write-gmt-offset + [ (timestamp>string) " " write ] + [ gmt-offset>> write-gmt-offset ] + bi ] with-string-writer ; : timestamp>http-string ( timestamp -- str ) @@ -79,40 +107,32 @@ M: timestamp year. ( timestamp -- ) #! Example: Tue, 15 Nov 1994 08:12:31 GMT >gmt timestamp>rfc822 ; +: (timestamp>cookie-string) ( timestamp -- ) + >gmt + { DAY ", " DD "-" MONTH "-" YYYY " " hh ":" mm ":" ss " GMT" } formatted ; + +: timestamp>cookie-string ( timestamp -- str ) + [ (timestamp>cookie-string) ] with-string-writer ; + : (write-rfc3339-gmt-offset) ( duration -- ) - [ hour>> write-00 CHAR: : write1 ] - [ minute>> write-00 ] bi ; + [ hh ":" write ] [ mm ] bi ; : write-rfc3339-gmt-offset ( duration -- ) - dup instant <=> sgn { - { 0 [ drop "Z" write ] } - { -1 [ CHAR: - write1 before (write-rfc3339-gmt-offset) ] } - { 1 [ CHAR: + write1 (write-rfc3339-gmt-offset) ] } + dup instant <=> { + { +eq+ [ drop "Z" write ] } + { +lt+ [ "-" write before (write-rfc3339-gmt-offset) ] } + { +gt+ [ "+" write (write-rfc3339-gmt-offset) ] } } case ; : (timestamp>rfc3339) ( timestamp -- ) { - [ year>> number>string write CHAR: - write1 ] - [ month>> write-00 CHAR: - write1 ] - [ day>> write-00 CHAR: T write1 ] - [ hour>> write-00 CHAR: : write1 ] - [ minute>> write-00 CHAR: : write1 ] - [ second>> >fixnum write-00 ] + YYYY "-" MM "-" DD "T" hh ":" mm ":" ss [ gmt-offset>> write-rfc3339-gmt-offset ] - } cleave ; + } formatted ; : timestamp>rfc3339 ( timestamp -- str ) [ (timestamp>rfc3339) ] with-string-writer ; -: expect ( str -- ) - read1 swap member? [ "Parse error" throw ] unless ; - -: read-00 2 read string>number ; - -: read-000 3 read string>number ; - -: read-0000 4 read string>number ; - : signed-gmt-offset ( dt ch -- dt' ) { { CHAR: + [ 1 ] } { CHAR: - [ -1 ] } } case time* ; @@ -131,28 +151,33 @@ M: timestamp year. ( timestamp -- ) : read-hms ( -- h m s ) read-00 ":" expect read-00 ":" expect read-00 ; +: read-rfc3339-seconds ( s -- s' ch ) + "+-Z" read-until >r + [ string>number ] [ length 10 swap ^ ] bi / + r> ; + : (rfc3339>timestamp) ( -- timestamp ) read-ymd "Tt" expect read-hms - read1 { { CHAR: . [ read-000 1000 / + read1 ] } [ ] } case + read1 { { CHAR: . [ read-rfc3339-seconds ] } [ ] } case read-rfc3339-gmt-offset ; : rfc3339>timestamp ( str -- timestamp ) [ (rfc3339>timestamp) ] with-string-reader ; -ERROR: invalid-rfc822-date ; +ERROR: invalid-timestamp-format ; -: check-rfc822-date ( obj/f -- obj ) [ invalid-rfc822-date ] unless* ; +: check-timestamp ( obj/f -- obj ) + [ invalid-timestamp-format ] unless* ; : read-token ( seps -- token ) - [ read-until ] keep member? check-rfc822-date drop ; + [ read-until ] keep member? check-timestamp drop ; : read-sp ( -- token ) " " read-token ; : checked-number ( str -- n ) - string>number check-rfc822-date ; + string>number check-timestamp ; : parse-rfc822-gmt-offset ( string -- dt ) dup "GMT" = [ drop instant ] [ @@ -163,10 +188,10 @@ ERROR: invalid-rfc822-date ; : (rfc822>timestamp) ( -- timestamp ) timestamp new - "," read-token day-abbreviations3 member? check-rfc822-date drop + "," read-token day-abbreviations3 member? check-timestamp drop read1 CHAR: \s assert= read-sp checked-number >>day - read-sp month-abbreviations index check-rfc822-date >>month + read-sp month-abbreviations index check-timestamp >>month read-sp checked-number >>year ":" read-token checked-number >>hour ":" read-token checked-number >>minute @@ -176,6 +201,42 @@ ERROR: invalid-rfc822-date ; : rfc822>timestamp ( str -- timestamp ) [ (rfc822>timestamp) ] with-string-reader ; +: (cookie-string>timestamp-1) ( -- timestamp ) + timestamp new + "," read-token day-abbreviations3 member? check-timestamp drop + read1 CHAR: \s assert= + "-" read-token checked-number >>day + "-" read-token month-abbreviations index check-timestamp >>month + read-sp checked-number >>year + ":" read-token checked-number >>hour + ":" read-token checked-number >>minute + " " read-token checked-number >>second + readln parse-rfc822-gmt-offset >>gmt-offset ; + +: cookie-string>timestamp-1 ( str -- timestamp ) + [ (cookie-string>timestamp-1) ] with-string-reader ; + +: (cookie-string>timestamp-2) ( -- timestamp ) + timestamp new + read-sp day-abbreviations3 member? check-timestamp drop + read-sp month-abbreviations index check-timestamp >>month + read-sp checked-number >>day + ":" read-token checked-number >>hour + ":" read-token checked-number >>minute + " " read-token checked-number >>second + read-sp checked-number >>year + readln parse-rfc822-gmt-offset >>gmt-offset ; + +: cookie-string>timestamp-2 ( str -- timestamp ) + [ (cookie-string>timestamp-2) ] with-string-reader ; + +: cookie-string>timestamp ( str -- timestamp ) + { + [ cookie-string>timestamp-1 ] + [ cookie-string>timestamp-2 ] + [ rfc822>timestamp ] + } attempt-all-quots ; + : (ymdhms>timestamp) ( -- timestamp ) read-ymd " " expect read-hms instant ; @@ -195,41 +256,30 @@ ERROR: invalid-rfc822-date ; [ (ymd>timestamp) ] with-string-reader ; : (timestamp>ymd) ( timestamp -- ) - dup timestamp-year write-0000 - "-" write - dup timestamp-month write-00 - "-" write - timestamp-day write-00 ; + { YYYY "-" MM "-" DD } formatted ; : timestamp>ymd ( timestamp -- str ) [ (timestamp>ymd) ] with-string-writer ; -: (timestamp>hms) - dup timestamp-hour write-00 - ":" write - dup timestamp-minute write-00 - ":" write - timestamp-second >integer write-00 ; +: (timestamp>hms) ( timestamp -- ) + { hh ":" mm ":" ss } formatted ; : timestamp>hms ( timestamp -- str ) [ (timestamp>hms) ] with-string-writer ; : timestamp>ymdhms ( timestamp -- str ) - >gmt [ - dup (timestamp>ymd) - " " write - (timestamp>hms) + >gmt + { (timestamp>ymd) " " (timestamp>hms) } formatted ] with-string-writer ; : file-time-string ( timestamp -- string ) [ - [ month>> month-abbreviations nth write ] keep bl - [ day>> number>string 2 32 pad-left write ] keep bl - dup now [ year>> ] bi@ = [ - [ hour>> write-00 ] keep ":" write - minute>> write-00 - ] [ - year>> number>string 5 32 pad-left write - ] if + { + MONTH " " DD " " + [ + dup now [ year>> ] bi@ = + [ [ hh ":" write ] [ mm ] bi ] [ YYYYY ] if + ] + } formatted ] with-string-writer ; diff --git a/extra/calendar/format/macros/macros-tests.factor b/extra/calendar/format/macros/macros-tests.factor new file mode 100644 index 0000000000..544332770f --- /dev/null +++ b/extra/calendar/format/macros/macros-tests.factor @@ -0,0 +1,15 @@ +USING: tools.test kernel ; +IN: calendar.format.macros + +[ 2 ] [ { [ 2 ] } attempt-all-quots ] unit-test + +[ 2 ] [ { [ 1 throw ] [ 2 ] } attempt-all-quots ] unit-test + +[ { [ 1 throw ] } attempt-all-quots ] [ 1 = ] must-fail-with + +: compiled-test-1 ( -- n ) + { [ 1 throw ] [ 2 ] } attempt-all-quots ; + +\ compiled-test-1 must-infer + +[ 2 ] [ compiled-test-1 ] unit-test diff --git a/extra/calendar/format/macros/macros.factor b/extra/calendar/format/macros/macros.factor new file mode 100644 index 0000000000..6d6dd3ae23 --- /dev/null +++ b/extra/calendar/format/macros/macros.factor @@ -0,0 +1,19 @@ +USING: macros kernel words quotations io sequences combinators +continuations ; +IN: calendar.format.macros + +MACRO: formatted ( spec -- ) + [ + { + { [ dup word? ] [ 1quotation ] } + { [ dup quotation? ] [ ] } + [ [ nip write ] curry [ ] like ] + } cond + ] map [ cleave ] curry ; + +MACRO: attempt-all-quots ( quots -- ) + dup length 1 = [ first ] [ + unclip swap + [ nip attempt-all-quots ] curry + [ recover ] 2curry + ] if ; diff --git a/extra/checksums/adler-32/adler-32-docs.factor b/extra/checksums/adler-32/adler-32-docs.factor new file mode 100755 index 0000000000..3e4e5d8210 --- /dev/null +++ b/extra/checksums/adler-32/adler-32-docs.factor @@ -0,0 +1,11 @@ +USING: help.markup help.syntax ; +IN: checksums.adler-32 + +HELP: adler-32 +{ $class-description "Adler-32 checksum algorithm." } ; + +ARTICLE: "checksums.adler-32" "Adler-32 checksum" +"The Adler-32 checksum algorithm implements simple and fast checksum. It is used in zlib and rsync." +{ $subsection adler-32 } ; + +ABOUT: "checksums.adler-32" diff --git a/extra/checksums/adler-32/adler-32-tests.factor b/extra/checksums/adler-32/adler-32-tests.factor new file mode 100644 index 0000000000..ccee74baae --- /dev/null +++ b/extra/checksums/adler-32/adler-32-tests.factor @@ -0,0 +1,5 @@ +USING: checksums.adler-32 checksums strings tools.test ; +IN: checksums.adler-32.tests + +[ 300286872 ] [ "Wikipedia" adler-32 checksum-bytes ] unit-test +[ 2679885283 ] [ 10000 CHAR: a adler-32 checksum-bytes ] unit-test diff --git a/extra/checksums/adler-32/adler-32.factor b/extra/checksums/adler-32/adler-32.factor new file mode 100644 index 0000000000..1be4bfb584 --- /dev/null +++ b/extra/checksums/adler-32/adler-32.factor @@ -0,0 +1,15 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: checksums classes.singleton kernel math math.ranges +math.vectors sequences ; +IN: checksums.adler-32 + +SINGLETON: adler-32 + +: adler-32-modulus 65521 ; inline + +M: adler-32 checksum-bytes ( bytes checksum -- value ) + drop + [ sum 1+ ] + [ [ dup length [1,b] v. ] [ length ] bi + ] bi + [ adler-32-modulus mod ] bi@ 16 shift bitor ; diff --git a/extra/crypto/sha1/authors.txt b/extra/checksums/adler-32/authors.txt old mode 100755 new mode 100644 similarity index 100% rename from extra/crypto/sha1/authors.txt rename to extra/checksums/adler-32/authors.txt diff --git a/extra/crypto/sha2/authors.txt b/extra/checksums/md5/authors.txt similarity index 100% rename from extra/crypto/sha2/authors.txt rename to extra/checksums/md5/authors.txt diff --git a/extra/checksums/md5/md5-docs.factor b/extra/checksums/md5/md5-docs.factor new file mode 100755 index 0000000000..4e475b18a0 --- /dev/null +++ b/extra/checksums/md5/md5-docs.factor @@ -0,0 +1,11 @@ +USING: help.markup help.syntax ; +IN: checksums.md5 + +HELP: md5 +{ $class-description "MD5 checksum algorithm." } ; + +ARTICLE: "checksums.md5" "MD5 checksum" +"The MD5 checksum algorithm implements a one-way hash function. While it is widely used, many weaknesses are known and it should not be used in new applications (" { $url "http://www.schneier.com/blog/archives/2005/03/more_hash_funct.html" } ")." +{ $subsection md5 } ; + +ABOUT: "checksums.md5" diff --git a/extra/checksums/md5/md5-tests.factor b/extra/checksums/md5/md5-tests.factor new file mode 100755 index 0000000000..8e314f7c28 --- /dev/null +++ b/extra/checksums/md5/md5-tests.factor @@ -0,0 +1,10 @@ +USING: kernel math namespaces checksums checksums.md5 tools.test byte-arrays ; + +[ "d41d8cd98f00b204e9800998ecf8427e" ] [ "" >byte-array md5 checksum-bytes hex-string ] unit-test +[ "0cc175b9c0f1b6a831c399e269772661" ] [ "a" >byte-array md5 checksum-bytes hex-string ] unit-test +[ "900150983cd24fb0d6963f7d28e17f72" ] [ "abc" >byte-array md5 checksum-bytes hex-string ] unit-test +[ "f96b697d7cb7938d525a2f31aaf161d0" ] [ "message digest" >byte-array md5 checksum-bytes hex-string ] unit-test +[ "c3fcd3d76192e4007dfb496cca67e13b" ] [ "abcdefghijklmnopqrstuvwxyz" >byte-array md5 checksum-bytes hex-string ] unit-test +[ "d174ab98d277d9f5a5611c2c9f419d9f" ] [ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" >byte-array md5 checksum-bytes hex-string ] unit-test +[ "57edf4a22be3c955ac49da2e2107b67a" ] [ "12345678901234567890123456789012345678901234567890123456789012345678901234567890" >byte-array md5 checksum-bytes hex-string ] unit-test + diff --git a/extra/crypto/md5/md5.factor b/extra/checksums/md5/md5.factor similarity index 85% rename from extra/crypto/md5/md5.factor rename to extra/checksums/md5/md5.factor index 45e10da74d..f0e0c71c19 100755 --- a/extra/crypto/md5/md5.factor +++ b/extra/checksums/md5/md5.factor @@ -1,10 +1,10 @@ ! See http://www.faqs.org/rfcs/rfc1321.html USING: kernel io io.binary io.files io.streams.byte-array math -math.functions math.parser namespaces splitting strings +math.functions math.parser namespaces splitting grouping strings sequences crypto.common byte-arrays locals sequences.private -io.encodings.binary symbols math.bitfields.lib ; -IN: crypto.md5 +io.encodings.binary symbols math.bitfields.lib checksums ; +IN: checksums.md5 md5) ( -- ) +: stream>md5 ( -- ) 64 read [ process-md5-block ] keep - length 64 = [ (stream>md5) ] when ; + length 64 = [ stream>md5 ] when ; : get-md5 ( -- str ) [ a b c d ] [ get 4 >le ] map concat >byte-array ; PRIVATE> -: stream>md5 ( stream -- byte-array ) - [ initialize-md5 (stream>md5) get-md5 ] with-stream ; +SINGLETON: md5 -: byte-array>md5 ( byte-array -- checksum ) - binary stream>md5 ; +INSTANCE: md5 checksum -: byte-array>md5str ( byte-array -- md5-string ) - byte-array>md5 hex-string ; - -: file>md5 ( path -- byte-array ) - binary stream>md5 ; - -: file>md5str ( path -- md5-string ) - file>md5 hex-string ; +M: md5 checksum-stream ( stream -- byte-array ) + drop [ initialize-md5 stream>md5 get-md5 ] with-input-stream ; diff --git a/extra/checksums/null/null.factor b/extra/checksums/null/null.factor new file mode 100644 index 0000000000..d3ab878a12 --- /dev/null +++ b/extra/checksums/null/null.factor @@ -0,0 +1,8 @@ +USING: checksums kernel ; +IN: checksums.null + +SINGLETON: null + +INSTANCE: null checksum + +M: null checksum-bytes drop ; diff --git a/extra/checksums/openssl/openssl-docs.factor b/extra/checksums/openssl/openssl-docs.factor new file mode 100644 index 0000000000..fd067997a7 --- /dev/null +++ b/extra/checksums/openssl/openssl-docs.factor @@ -0,0 +1,35 @@ +IN: checksums.openssl +USING: help.syntax help.markup ; + +HELP: openssl-checksum +{ $class-description "The class of checksum algorithms implemented by OpenSSL. The exact set of algorithms supported depends on how the OpenSSL library was compiled; " { $snippet "md5" } " and " { $snippet "sha1" } " should be universally available." } ; + +HELP: ( name -- checksum ) +{ $values { "name" "an EVP message digest name" } { "checksum" openssl-checksum } } +{ $description "Creates a new OpenSSL checksum object." } ; + +HELP: openssl-md5 +{ $description "The OpenSSL MD5 message digest implementation." } ; + +HELP: openssl-sha1 +{ $description "The OpenSSL SHA1 message digest implementation." } ; + +HELP: unknown-digest +{ $error-description "Thrown by checksum words if they are passed an " { $link openssl-checksum } " naming a message digest not supported by OpenSSL." } ; + +ARTICLE: "checksums.openssl" "OpenSSL checksums" +"The OpenSSL library provides a large number of efficient checksum (message digest) algorithms which may be used independently of its SSL functionality." +{ $subsection openssl-checksum } +"Constructing a checksum from a known name:" +{ $subsection } +"Two utility words:" +{ $subsection openssl-md5 } +{ $subsection openssl-sha1 } +"An error thrown if the digest name is unrecognized:" +{ $subsection unknown-digest } +"An example where we compute the SHA1 checksum of a string using the OpenSSL implementation of SHA1:" +{ $example "USING: byte-arrays checksums checksums.openssl prettyprint ;" "\"hello world\" >byte-array openssl-sha1 checksum-bytes hex-string ." "\"2aae6c35c94fcfb415dbe95f408b9ce91ee846ed\"" } +"If we use the Factor implementation, we get the same result, just slightly slower:" +{ $example "USING: byte-arrays checksums checksums.sha1 prettyprint ;" "\"hello world\" >byte-array sha1 checksum-bytes hex-string ." "\"2aae6c35c94fcfb415dbe95f408b9ce91ee846ed\"" } ; + +ABOUT: "checksums.openssl" diff --git a/extra/checksums/openssl/openssl-tests.factor b/extra/checksums/openssl/openssl-tests.factor new file mode 100644 index 0000000000..253069c952 --- /dev/null +++ b/extra/checksums/openssl/openssl-tests.factor @@ -0,0 +1,28 @@ +IN: checksums.openssl.tests +USING: byte-arrays checksums.openssl checksums tools.test +accessors kernel system ; + +[ + B{ 201 238 222 100 92 200 182 188 138 255 129 163 115 88 240 136 } +] +[ + "Hello world from the openssl binding" >byte-array + "md5" checksum-bytes +] unit-test + +[ + B{ 63 113 237 255 181 5 152 241 136 181 43 95 160 105 44 87 49 82 115 0 } +] +[ + "Hello world from the openssl binding" >byte-array + "sha1" checksum-bytes +] unit-test + +[ + "Bad checksum test" >byte-array + "no such checksum" + checksum-bytes +] [ [ unknown-digest? ] [ name>> "no such checksum" = ] bi and ] +must-fail-with + +[ ] [ image openssl-sha1 checksum-file drop ] unit-test diff --git a/extra/checksums/openssl/openssl.factor b/extra/checksums/openssl/openssl.factor new file mode 100644 index 0000000000..d42febb541 --- /dev/null +++ b/extra/checksums/openssl/openssl.factor @@ -0,0 +1,63 @@ +! Copyright (C) 2008 Slava Pestov +! See http://factorcode.org/license.txt for BSD license. +USING: accessors byte-arrays alien.c-types kernel continuations +destructors sequences io openssl openssl.libcrypto checksums ; +IN: checksums.openssl + +ERROR: unknown-digest name ; + +TUPLE: openssl-checksum name ; + +: openssl-md5 T{ openssl-checksum f "md5" } ; + +: openssl-sha1 T{ openssl-checksum f "sha1" } ; + +INSTANCE: openssl-checksum checksum + +C: openssl-checksum + + ( -- ctx ) + "EVP_MD_CTX" + dup EVP_MD_CTX_init evp-md-context boa ; + +M: evp-md-context dispose + handle>> EVP_MD_CTX_cleanup drop ; + +: with-evp-md-context ( quot -- ) + maybe-init-ssl >r r> with-disposal ; inline + +: digest-named ( name -- md ) + dup EVP_get_digestbyname + [ ] [ unknown-digest ] ?if ; + +: set-digest ( name ctx -- ) + handle>> swap digest-named f EVP_DigestInit_ex ssl-error ; + +: checksum-loop ( ctx -- ) + dup handle>> + 4096 read-partial dup [ + dup length EVP_DigestUpdate ssl-error + checksum-loop + ] [ 3drop ] if ; + +: digest-value ( ctx -- value ) + handle>> + EVP_MAX_MD_SIZE 0 + [ EVP_DigestFinal_ex ssl-error ] 2keep + *int memory>byte-array ; + +PRIVATE> + +M: openssl-checksum checksum-stream + name>> swap [ + [ + [ set-digest ] + [ checksum-loop ] + [ digest-value ] + tri + ] with-evp-md-context + ] with-input-stream ; diff --git a/extra/destructors/authors.txt b/extra/checksums/sha1/authors.txt old mode 100644 new mode 100755 similarity index 100% rename from extra/destructors/authors.txt rename to extra/checksums/sha1/authors.txt diff --git a/extra/checksums/sha1/sha1-docs.factor b/extra/checksums/sha1/sha1-docs.factor new file mode 100644 index 0000000000..2c9093865f --- /dev/null +++ b/extra/checksums/sha1/sha1-docs.factor @@ -0,0 +1,11 @@ +USING: help.markup help.syntax ; +IN: checksums.sha1 + +HELP: sha1 +{ $class-description "SHA1 checksum algorithm." } ; + +ARTICLE: "checksums.sha1" "SHA1 checksum" +"The SHA1 checksum algorithm implements a one-way hash function. It is generally considered to be stronger than MD5, however there is a known algorithm for finding collisions more effectively than a brute-force search (" { $url "http://www.schneier.com/blog/archives/2005/02/sha1_broken.html" } ")." +{ $subsection sha1 } ; + +ABOUT: "checksums.sha1" diff --git a/extra/crypto/sha1/sha1-tests.factor b/extra/checksums/sha1/sha1-tests.factor similarity index 69% rename from extra/crypto/sha1/sha1-tests.factor rename to extra/checksums/sha1/sha1-tests.factor index 14307355c2..808d37d1e4 100755 --- a/extra/crypto/sha1/sha1-tests.factor +++ b/extra/checksums/sha1/sha1-tests.factor @@ -1,14 +1,14 @@ -USING: arrays kernel math namespaces sequences tools.test crypto.sha1 ; +USING: arrays kernel math namespaces sequences tools.test checksums checksums.sha1 ; -[ "a9993e364706816aba3e25717850c26c9cd0d89d" ] [ "abc" byte-array>sha1str ] unit-test -[ "84983e441c3bd26ebaae4aa1f95129e5e54670f1" ] [ "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" byte-array>sha1str ] unit-test +[ "a9993e364706816aba3e25717850c26c9cd0d89d" ] [ "abc" sha1 checksum-bytes hex-string ] unit-test +[ "84983e441c3bd26ebaae4aa1f95129e5e54670f1" ] [ "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" sha1 checksum-bytes hex-string ] unit-test ! [ "34aa973cd4c4daa4f61eeb2bdbad27316534016f" ] [ 1000000 CHAR: a fill string>sha1str ] unit-test ! takes a long time... [ "dea356a2cddd90c7a7ecedc5ebb563934f460452" ] [ "0123456701234567012345670123456701234567012345670123456701234567" -10 swap concat byte-array>sha1str ] unit-test +10 swap concat sha1 checksum-bytes hex-string ] unit-test [ ";\u00009b\u0000fd\u0000cdK\u0000a3^s\u0000d0*\u0000e3\\\u0000b5\u000013<\u0000e8wA\u0000b2\u000083\u0000d20\u0000f1\u0000e6\u0000cc\u0000d8\u00001e\u00009c\u000004\u0000d7PT]\u0000ce,\u000001\u000012\u000080\u000096\u000099" ] [ "\u000066\u000053\u0000f1\u00000c\u00001a\u0000fa\u0000b5\u00004c\u000061\u0000c8\u000025\u000075\u0000a8\u00004a\u0000fe\u000030\u0000d8\u0000aa\u00001a\u00003a\u000096\u000096\u0000b3\u000018\u000099\u000092\u0000bf\u0000e1\u0000cb\u00007f\u0000a6\u0000a7" - byte-array>sha1-interleave + sha1-interleave ] unit-test diff --git a/extra/crypto/sha1/sha1.factor b/extra/checksums/sha1/sha1.factor similarity index 82% rename from extra/crypto/sha1/sha1.factor rename to extra/checksums/sha1/sha1.factor index 37e92db60f..6427e0e8eb 100755 --- a/extra/crypto/sha1/sha1.factor +++ b/extra/checksums/sha1/sha1.factor @@ -1,8 +1,8 @@ USING: arrays combinators crypto.common kernel io io.encodings.binary io.files io.streams.byte-array math.vectors strings sequences namespaces math parser sequences vectors -io.binary hashtables symbols math.bitfields.lib ; -IN: crypto.sha1 +io.binary hashtables symbols math.bitfields.lib checksums ; +IN: checksums.sha1 ! Implemented according to RFC 3174. @@ -99,30 +99,22 @@ SYMBOLS: h0 h1 h2 h3 h4 A B C D E w K ; [ (process-sha1-block) ] each ] if ; -: (stream>sha1) ( -- ) +: stream>sha1 ( -- ) 64 read [ process-sha1-block ] keep - length 64 = [ (stream>sha1) ] when ; + length 64 = [ stream>sha1 ] when ; : get-sha1 ( -- str ) [ [ h0 h1 h2 h3 h4 ] [ get 4 >be % ] each ] "" make ; -: stream>sha1 ( stream -- sha1 ) - [ initialize-sha1 (stream>sha1) get-sha1 ] with-stream ; +SINGLETON: sha1 -: byte-array>sha1 ( string -- sha1 ) - binary stream>sha1 ; +INSTANCE: sha1 checksum -: byte-array>sha1str ( string -- str ) - byte-array>sha1 hex-string ; +M: sha1 checksum-stream ( stream -- sha1 ) + drop [ initialize-sha1 stream>sha1 get-sha1 ] with-input-stream ; -: byte-array>sha1-bignum ( string -- n ) - byte-array>sha1 be> ; - -: file>sha1 ( file -- sha1 ) - binary stream>sha1 ; - -: byte-array>sha1-interleave ( string -- seq ) +: sha1-interleave ( string -- seq ) [ zero? ] left-trim - dup length odd? [ 1 tail ] when - seq>2seq [ byte-array>sha1 ] bi@ + dup length odd? [ rest ] when + seq>2seq [ sha1 checksum-bytes ] bi@ 2seq>seq ; diff --git a/extra/http/server/sessions/authors.txt b/extra/checksums/sha2/authors.txt similarity index 100% rename from extra/http/server/sessions/authors.txt rename to extra/checksums/sha2/authors.txt diff --git a/extra/checksums/sha2/sha2-docs.factor b/extra/checksums/sha2/sha2-docs.factor new file mode 100644 index 0000000000..6a128552fd --- /dev/null +++ b/extra/checksums/sha2/sha2-docs.factor @@ -0,0 +1,11 @@ +USING: help.markup help.syntax ; +IN: checksums.sha2 + +HELP: sha-256 +{ $class-description "SHA-256 checksum algorithm." } ; + +ARTICLE: "checksums.sha2" "SHA2 checksum" +"The SHA2 checksum algorithm implements a one-way hash function. It is generally considered to be pretty strong." +{ $subsection sha-256 } ; + +ABOUT: "checksums.sha2" diff --git a/extra/crypto/sha2/sha2-tests.factor b/extra/checksums/sha2/sha2-tests.factor similarity index 51% rename from extra/crypto/sha2/sha2-tests.factor rename to extra/checksums/sha2/sha2-tests.factor index 8fe655f205..2f4e3c51c4 100755 --- a/extra/crypto/sha2/sha2-tests.factor +++ b/extra/checksums/sha2/sha2-tests.factor @@ -1,7 +1,7 @@ -USING: arrays kernel math namespaces sequences tools.test crypto.sha2 ; -[ "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" ] [ "" byte-array>sha-256-string ] unit-test -[ "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" ] [ "abc" byte-array>sha-256-string ] unit-test -[ "f7846f55cf23e14eebeab5b4e1550cad5b509e3348fbc4efa3a1413d393cb650" ] [ "message digest" byte-array>sha-256-string ] unit-test -[ "71c480df93d6ae2f1efad1447c66c9525e316218cf51fc8d9ed832f2daf18b73" ] [ "abcdefghijklmnopqrstuvwxyz" byte-array>sha-256-string ] unit-test -[ "db4bfcbd4da0cd85a60c3c37d3fbd8805c77f15fc6b1fdfe614ee0a7c8fdb4c0" ] [ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" byte-array>sha-256-string ] unit-test -[ "f371bc4a311f2b009eef952dd83ca80e2b60026c8e935592d0f9c308453c813e" ] [ "12345678901234567890123456789012345678901234567890123456789012345678901234567890" byte-array>sha-256-string ] unit-test +USING: arrays kernel math namespaces sequences tools.test checksums.sha2 checksums ; +[ "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" ] [ "" sha-256 checksum-bytes hex-string ] unit-test +[ "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" ] [ "abc" sha-256 checksum-bytes hex-string ] unit-test +[ "f7846f55cf23e14eebeab5b4e1550cad5b509e3348fbc4efa3a1413d393cb650" ] [ "message digest" sha-256 checksum-bytes hex-string ] unit-test +[ "71c480df93d6ae2f1efad1447c66c9525e316218cf51fc8d9ed832f2daf18b73" ] [ "abcdefghijklmnopqrstuvwxyz" sha-256 checksum-bytes hex-string ] unit-test +[ "db4bfcbd4da0cd85a60c3c37d3fbd8805c77f15fc6b1fdfe614ee0a7c8fdb4c0" ] [ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" sha-256 checksum-bytes hex-string ] unit-test +[ "f371bc4a311f2b009eef952dd83ca80e2b60026c8e935592d0f9c308453c813e" ] [ "12345678901234567890123456789012345678901234567890123456789012345678901234567890" sha-256 checksum-bytes hex-string ] unit-test diff --git a/extra/crypto/sha2/sha2.factor b/extra/checksums/sha2/sha2.factor similarity index 93% rename from extra/crypto/sha2/sha2.factor rename to extra/checksums/sha2/sha2.factor index 0acc5c1388..6cf7914e6c 100755 --- a/extra/crypto/sha2/sha2.factor +++ b/extra/checksums/sha2/sha2.factor @@ -1,6 +1,7 @@ -USING: crypto.common kernel splitting math sequences namespaces -io.binary symbols math.bitfields.lib ; -IN: crypto.sha2 +USING: crypto.common kernel splitting grouping +math sequences namespaces io.binary symbols +math.bitfields.lib checksums ; +IN: checksums.sha2 -: byte-array>sha-256 ( string -- string ) - [ +SINGLETON: sha-256 + +INSTANCE: sha-256 checksum + +M: sha-256 checksum-bytes + drop [ K-256 K set initial-H-256 H set 4 word-size set 64 block-size set byte-array>sha2 ] with-scope ; - -: byte-array>sha-256-string ( string -- hexstring ) - byte-array>sha-256 hex-string ; diff --git a/extra/circular/circular-tests.factor b/extra/circular/circular-tests.factor index 9023ab1dba..105e3790aa 100755 --- a/extra/circular/circular-tests.factor +++ b/extra/circular/circular-tests.factor @@ -27,3 +27,15 @@ circular strings ; ! This no longer fails ! [ "test" 5 swap nth ] must-fail ! [ "foo" CHAR: b 3 rot set-nth ] must-fail + +[ { } ] [ 3 >array ] unit-test +[ { 1 2 } ] [ + 3 + [ 1 swap push-growing-circular ] keep + [ 2 swap push-growing-circular ] keep >array +] unit-test +[ { 3 4 5 } ] [ + 3 dup { 1 2 3 4 5 } [ + swap push-growing-circular + ] with each >array +] unit-test diff --git a/extra/circular/circular.factor b/extra/circular/circular.factor index 77dfb55766..5d2378120f 100755 --- a/extra/circular/circular.factor +++ b/extra/circular/circular.factor @@ -19,10 +19,6 @@ M: circular length seq>> length ; M: circular virtual@ circular-wrap seq>> ; -M: circular nth virtual@ nth ; - -M: circular set-nth virtual@ set-nth ; - M: circular virtual-seq seq>> ; : change-circular-start ( n circular -- ) @@ -36,3 +32,20 @@ M: circular virtual-seq seq>> ; 0 ; INSTANCE: circular virtual-sequence + +TUPLE: growing-circular < circular length ; + +M: growing-circular length length>> ; + +: full? ( circular -- ? ) + [ length ] [ seq>> length ] bi = ; + +: set-peek ( elt seq -- ) + [ length 1- ] keep set-nth ; + +: push-growing-circular ( elt circular -- ) + dup full? [ push-circular ] + [ [ 1+ ] change-length set-peek ] if ; + +: ( capacity -- growing-circular ) + { } new-sequence 0 0 growing-circular boa ; diff --git a/extra/classes/tuple/lib/lib-docs.factor b/extra/classes/tuple/lib/lib-docs.factor index 34dd181d3b..0c4c11e46f 100644 --- a/extra/classes/tuple/lib/lib-docs.factor +++ b/extra/classes/tuple/lib/lib-docs.factor @@ -6,6 +6,7 @@ HELP: >tuple< { $description "Explodes the tuple so that tuple slots are on the stack in the order listed in the tuple." } { $example "USING: kernel prettyprint classes.tuple.lib ;" + "IN: scratchpad" "TUPLE: foo a b c ;" "1 2 3 \\ foo boa \\ foo >tuple< .s" "1\n2\n3" @@ -18,6 +19,7 @@ HELP: >tuple*< { $description "Explodes the tuple so that tuple slots ending with '*' are on the stack in the order listed in the tuple." } { $example "USING: kernel prettyprint classes.tuple.lib ;" + "IN: scratchpad" "TUPLE: foo a bb* ccc dddd* ;" "1 2 3 4 \\ foo boa \\ foo >tuple*< .s" "2\n4" diff --git a/extra/classes/tuple/lib/lib.factor b/extra/classes/tuple/lib/lib.factor index 38104a45db..10261a1df7 100755 --- a/extra/classes/tuple/lib/lib.factor +++ b/extra/classes/tuple/lib/lib.factor @@ -7,11 +7,11 @@ IN: classes.tuple.lib [ slot-spec-reader ] map [ get-slots ] curry ; MACRO: >tuple< ( class -- ) - all-slots 1 tail-slice reader-slots ; + all-slots rest-slice reader-slots ; MACRO: >tuple*< ( class -- ) all-slots - [ slot-spec-name "*" tail? ] subset + [ slot-spec-name "*" tail? ] filter reader-slots ; diff --git a/extra/cocoa/application/application-docs.factor b/extra/cocoa/application/application-docs.factor index ad2f8ffbd9..55fa5e10b8 100644 --- a/extra/cocoa/application/application-docs.factor +++ b/extra/cocoa/application/application-docs.factor @@ -26,9 +26,9 @@ HELP: with-cocoa { $values { "quot" quotation } } { $description "Sets up an autorelease pool, initializes the " { $snippet "NSApplication" } " singleton, and calls the quotation." } ; -HELP: do-events -{ $values { "app" "an " { $snippet "NSApplication" } } } -{ $description "Processes any pending events in the queue. Does not block." } ; +HELP: do-event +{ $values { "app" "an " { $snippet "NSApplication" } } { "?" "a boolean" } } +{ $description "Processes a pending event in the queue, if any, returning a boolean indicating if there was one. Does not block." } ; HELP: add-observer { $values { "observer" "an " { $snippet "NSObject" } } { "selector" string } { "name" "an " { $snippet "NSString" } } { "object" "an " { $snippet "NSObject" } } } @@ -49,7 +49,7 @@ ARTICLE: "cocoa-application-utils" "Cocoa application utilities" { $subsection NSApp } { $subsection with-autorelease-pool } { $subsection with-cocoa } -{ $subsection do-events } +{ $subsection do-event } { $subsection add-observer } { $subsection remove-observer } { $subsection install-delegate } ; diff --git a/extra/cocoa/application/application.factor b/extra/cocoa/application/application.factor index 2ae17a1604..90159c1656 100755 --- a/extra/cocoa/application/application.factor +++ b/extra/cocoa/application/application.factor @@ -29,9 +29,6 @@ IN: cocoa.application : do-event ( app -- ? ) dup next-event [ -> sendEvent: t ] [ drop f ] if* ; -: do-events ( app -- ) - dup do-event [ do-events ] [ drop ] if ; - : add-observer ( observer selector name object -- ) >r >r >r >r NSNotificationCenter -> defaultCenter r> r> sel_registerName diff --git a/extra/cocoa/messages/messages.factor b/extra/cocoa/messages/messages.factor index df3f84d451..624a6d802b 100755 --- a/extra/cocoa/messages/messages.factor +++ b/extra/cocoa/messages/messages.factor @@ -4,7 +4,7 @@ USING: alien alien.c-types alien.strings alien.compiler arrays assocs combinators compiler inference.transforms kernel math namespaces parser prettyprint prettyprint.sections quotations sequences strings words cocoa.runtime io macros -memoize debugger io.encodings.ascii ; +memoize debugger io.encodings.ascii effects ; IN: cocoa.messages : make-sender ( method function -- quot ) @@ -142,7 +142,7 @@ H{ } assoc-union alien>objc-types set-global : objc-struct-type ( i string -- ctype ) - 2dup CHAR: = -rot index* swap subseq + 2dup CHAR: = -rot index-from swap subseq dup c-types get key? [ "Warning: no such C type: " write dup print drop "void*" @@ -196,7 +196,8 @@ H{ : define-objc-class-word ( name quot -- ) [ over , , \ unless-defined , dup , \ objc-class , - ] [ ] make >r "cocoa.classes" create r> define ; + ] [ ] make >r "cocoa.classes" create r> + (( -- class )) define-declared ; : import-objc-class ( name quot -- ) 2dup unless-defined diff --git a/extra/cocoa/views/views.factor b/extra/cocoa/views/views.factor index 7b8de9067c..ca631d5dea 100644 --- a/extra/cocoa/views/views.factor +++ b/extra/cocoa/views/views.factor @@ -74,3 +74,17 @@ PRIVATE> -> locationInWindow f -> convertPoint:fromView: dup NSPoint-x swap NSPoint-y r> -> frame NSRect-h swap - 2array ; + +USE: opengl.gl +USE: alien.syntax + +: NSOpenGLCPSwapInterval 222 ; + +LIBRARY: OpenGL + +TYPEDEF: int CGLError +TYPEDEF: void* CGLContextObj +TYPEDEF: int CGLContextParameter + +FUNCTION: CGLError CGLSetParameter ( CGLContextObj ctx, CGLContextParameter pname, GLint* params ) ; + diff --git a/extra/combinators/lib/lib-docs.factor b/extra/combinators/lib/lib-docs.factor index c88ce8d9f9..ccb1fca9a1 100755 --- a/extra/combinators/lib/lib-docs.factor +++ b/extra/combinators/lib/lib-docs.factor @@ -23,7 +23,7 @@ HELP: ndip { $example "USING: combinators.lib kernel prettyprint ;" "1 2 [ dup ] 1 ndip .s" "1\n1\n2" } { $example "USING: combinators.lib kernel prettyprint ;" "1 2 3 [ drop ] 2 ndip .s" "2\n3" } } -{ $see-also dip dipd } ; +{ $see-also dip 2dip } ; HELP: nslip { $values { "n" number } } @@ -47,10 +47,10 @@ HELP: nkeep } { $see-also keep nslip } ; -HELP: && -{ $values { "quots" "a sequence of quotations with stack effect " { $snippet "( ... -- ... ? )" } } { "?" "a boolean" } } -{ $description "Calls each quotation in turn; outputs " { $link f } " if one of the quotations output " { $link f } ", otherwise outputs " { $link t } ". As soon as a quotation outputs " { $link f } ", evaluation stops and subsequent quotations are not called." } ; +! HELP: && +! { $values { "quots" "a sequence of quotations with stack effect " { $snippet "( ... -- ... ? )" } } { "?" "a boolean" } } +! { $description "Calls each quotation in turn; outputs " { $link f } " if one of the quotations output " { $link f } ", otherwise outputs " { $link t } ". As soon as a quotation outputs " { $link f } ", evaluation stops and subsequent quotations are not called." } ; -HELP: || -{ $values { "quots" "a sequence of quotations with stack effect " { $snippet "( ... -- ... ? )" } } { "?" "a boolean" } } -{ $description "Calls each quotation in turn; outputs " { $link t } " if one of the quotations output " { $link t } ", otherwise outputs " { $link f } ". As soon as a quotation outputs " { $link t } ", evaluation stops and subsequent quotations are not called." } ; +! HELP: || +! { $values { "quots" "a sequence of quotations with stack effect " { $snippet "( ... -- ... ? )" } } { "?" "a boolean" } } +! { $description "Calls each quotation in turn; outputs " { $link t } " if one of the quotations output " { $link t } ", otherwise outputs " { $link f } ". As soon as a quotation outputs " { $link t } ", evaluation stops and subsequent quotations are not called." } ; diff --git a/extra/combinators/lib/lib-tests.factor b/extra/combinators/lib/lib-tests.factor index ed481f72e6..78916bb027 100755 --- a/extra/combinators/lib/lib-tests.factor +++ b/extra/combinators/lib/lib-tests.factor @@ -5,9 +5,6 @@ IN: combinators.lib.tests [ 5 ] [ [ 10 random ] [ 5 = ] generate ] unit-test [ t ] [ [ 10 random ] [ even? ] generate even? ] unit-test -{ 6 2 } [ 1 2 [ 5 + ] dip ] unit-test -{ 6 2 1 } [ 1 2 1 [ 5 + ] dipd ] unit-test - [ [ 99 ] 1 2 3 4 5 5 nslip ] must-infer { 99 1 2 3 4 5 } [ [ 99 ] 1 2 3 4 5 5 nslip ] unit-test [ 1 2 3 4 5 [ drop drop drop drop drop 2 ] 5 nkeep ] must-infer @@ -19,18 +16,25 @@ IN: combinators.lib.tests [ { 1 2 } { 2 4 } { 3 8 } { 4 16 } { 5 32 } ] [ 1 2 3 4 5 [ dup 2^ 2array ] 5 napply ] unit-test [ [ dup 2^ 2array ] 5 napply ] must-infer +[ { "xyc" "xyd" } ] [ "x" "y" { "c" "d" } [ 3append ] 2 nwith map ] unit-test + +[ { "foo" "xbarx" } ] +[ + { "oof" "bar" } { [ reverse ] [ "x" swap "x" 3append ] } parallel-call +] unit-test + ! && [ t ] [ 3 { [ dup number? ] [ dup odd? ] [ dup 0 > ] - } && nip + } 0&& nip ] unit-test [ f ] [ 3 { [ dup number? ] [ dup even? ] [ dup 0 > ] - } && nip + } 0&& nip ] unit-test ! || @@ -38,13 +42,13 @@ IN: combinators.lib.tests [ t ] [ 4 { [ dup array? ] [ dup number? ] [ 3 throw ] - } || nip + } 0|| nip ] unit-test [ f ] [ 4 { [ dup array? ] [ dup vector? ] [ dup float? ] - } || nip + } 0|| nip ] unit-test diff --git a/extra/combinators/lib/lib.factor b/extra/combinators/lib/lib.factor index 84b41a91ff..a838b246e4 100755 --- a/extra/combinators/lib/lib.factor +++ b/extra/combinators/lib/lib.factor @@ -4,7 +4,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: kernel combinators fry namespaces quotations hashtables sequences assocs arrays inference effects math math.ranges -arrays.lib shuffle macros bake continuations ; +arrays.lib shuffle macros continuations locals ; IN: combinators.lib @@ -20,17 +20,15 @@ MACRO: nslip ( n -- ) dup saver [ call ] rot restorer 3append ; MACRO: nkeep ( n -- ) [ ] [ 1+ ] [ ] tri - [ [ , ndup ] dip , -nrot , nslip ] - bake ; + '[ [ , ndup ] dip , -nrot , nslip ] ; : 4keep ( w x y z quot -- w x y z ) 4 nkeep ; inline MACRO: ncurry ( n -- ) [ curry ] n*quot ; -MACRO: nwith ( quot n -- ) - tuck 1+ dup - [ , -nrot [ , nrot , call ] , ncurry ] - bake ; +MACRO:: nwith ( quot n -- ) + [let | n' [ n 1+ ] | + [ n' -nrot [ n' nrot quot call ] n ncurry ] ] ; MACRO: napply ( n -- ) 2 [a,b] @@ -40,8 +38,6 @@ MACRO: napply ( n -- ) : 3apply ( obj obj obj quot -- ) 3 napply ; inline -: dipd ( x y quot -- y ) 2 ndip ; inline - : 2with ( param1 param2 obj quot -- obj curry ) with with ; inline @@ -67,21 +63,68 @@ MACRO: napply ( n -- ) ! short circuiting words ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -: short-circuit ( quots quot default -- quot ) - 1quotation -rot { } map>assoc alist>quot ; +! : short-circuit ( quots quot default -- quot ) +! 1quotation -rot { } map>assoc alist>quot ; -MACRO: && ( quots -- ? ) - [ [ not ] append [ f ] ] t short-circuit ; +! MACRO: && ( quots -- ? ) +! [ [ not ] append [ f ] ] t short-circuit ; -MACRO: <-&& ( quots -- ) - [ [ dup ] prepend [ not ] append [ f ] ] t short-circuit - [ nip ] append ; +! MACRO: <-&& ( quots -- ) +! [ [ dup ] prepend [ not ] append [ f ] ] t short-circuit +! [ nip ] append ; -MACRO: <--&& ( quots -- ) - [ [ 2dup ] prepend [ not ] append [ f ] ] t short-circuit - [ 2nip ] append ; +! MACRO: <--&& ( quots -- ) +! [ [ 2dup ] prepend [ not ] append [ f ] ] t short-circuit +! [ 2nip ] append ; -MACRO: || ( quots -- ? ) [ [ t ] ] f short-circuit ; +! or + +! MACRO: || ( quots -- ? ) [ [ t ] ] f short-circuit ; + +! MACRO: 0|| ( quots -- ? ) [ [ t ] ] f short-circuit ; + +! MACRO: 1|| ( quots -- ? ) +! [ [ dup ] prepend [ t ] ] f short-circuit [ nip ] append ; + +! MACRO: 2|| ( quots -- ? ) +! [ [ 2dup ] prepend [ t ] ] f short-circuit [ 2nip ] append ; + +! MACRO: 3|| ( quots -- ? ) +! [ [ 3dup ] prepend [ t ] ] f short-circuit [ 3nip ] append ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +MACRO: 0&& ( quots -- quot ) + [ '[ drop @ dup not ] [ drop f ] 2array ] map + { [ t ] [ ] } suffix + '[ f , cond ] ; + +MACRO: 1&& ( quots -- quot ) + [ '[ drop dup @ dup not ] [ drop drop f ] 2array ] map + { [ t ] [ nip ] } suffix + '[ f , cond ] ; + +MACRO: 2&& ( quots -- quot ) + [ '[ drop 2dup @ dup not ] [ drop 2drop f ] 2array ] map + { [ t ] [ 2nip ] } suffix + '[ f , cond ] ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +MACRO: 0|| ( quots -- quot ) + [ '[ drop @ dup ] [ ] 2array ] map + { [ drop t ] [ f ] } suffix + '[ f , cond ] ; + +MACRO: 1|| ( quots -- quot ) + [ '[ drop dup @ dup ] [ nip ] 2array ] map + { [ drop drop t ] [ f ] } suffix + '[ f , cond ] ; + +MACRO: 2|| ( quots -- quot ) + [ '[ drop 2dup @ dup ] [ 2nip ] 2array ] map + { [ drop 2drop t ] [ f ] } suffix + '[ f , cond ] ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ifte @@ -110,8 +153,8 @@ MACRO: switch ( quot -- ) ! : pcall ( seq quots -- seq ) [ call ] 2map ; MACRO: parallel-call ( quots -- ) - [ [ unclip % r> dup >r push ] bake ] map concat - [ V{ } clone >r % drop r> >array ] bake ; + [ '[ [ unclip @ ] dip [ push ] keep ] ] map concat + '[ V{ } clone @ nip >array ] ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! map-call and friends @@ -169,3 +212,8 @@ MACRO: multikeep ( word out-indexes -- ... ) : generate ( generator predicate -- obj ) [ dup ] swap [ dup [ nip ] unless not ] 3compose swap [ ] do-while ; + +MACRO: predicates ( seq -- quot/f ) + dup [ 1quotation [ drop ] prepend ] map + >r [ [ dup ] prepend ] map r> zip [ drop f ] suffix + [ cond ] curry ; diff --git a/extra/concurrency/combinators/combinators-docs.factor b/extra/concurrency/combinators/combinators-docs.factor index 0db235d9e6..a23301c1e2 100755 --- a/extra/concurrency/combinators/combinators-docs.factor +++ b/extra/concurrency/combinators/combinators-docs.factor @@ -6,20 +6,32 @@ HELP: parallel-map { $description "Spawns a new thread for applying " { $snippet "quot" } " to every element of " { $snippet "seq" } ", collecting the results at the end." } { $errors "Throws an error if one of the iterations throws an error." } ; +HELP: 2parallel-map +{ $values { "seq1" sequence } { "seq2" sequence } { "quot" "a quotation with stack effect " { $snippet "( elt -- newelt )" } } { "newseq" sequence } } +{ $description "Spawns a new thread for applying " { $snippet "quot" } " to pairwise elements of " { $snippet "seq1" } " and " { $snippet "seq2" } ", collecting the results at the end." } +{ $errors "Throws an error if one of the iterations throws an error." } ; + HELP: parallel-each { $values { "seq" sequence } { "quot" "a quotation with stack effect " { $snippet "( elt -- )" } } } { $description "Spawns a new thread for applying " { $snippet "quot" } " to every element of " { $snippet "seq" } ", blocking until all quotations complete." } { $errors "Throws an error if one of the iterations throws an error." } ; -HELP: parallel-subset +HELP: 2parallel-each +{ $values { "seq1" sequence } { "seq2" sequence } { "quot" "a quotation with stack effect " { $snippet "( elt -- )" } } } +{ $description "Spawns a new thread for applying " { $snippet "quot" } " to pairwise elements of " { $snippet "seq1" } " and " { $snippet "seq2" } ", blocking until all quotations complete." } +{ $errors "Throws an error if one of the iterations throws an error." } ; + +HELP: parallel-filter { $values { "seq" sequence } { "quot" "a quotation with stack effect " { $snippet "( elt -- ? )" } } { "newseq" sequence } } { $description "Spawns a new thread for applying " { $snippet "quot" } " to every element of " { $snippet "seq" } ", collecting the elements for which the quotation yielded a true value." } { $errors "Throws an error if one of the iterations throws an error." } ; ARTICLE: "concurrency.combinators" "Concurrent combinators" -"The " { $vocab-link "concurrency.combinators" } " vocabulary provides concurrent variants of " { $link each } ", " { $link map } " and " { $link subset } ":" +"The " { $vocab-link "concurrency.combinators" } " vocabulary provides concurrent variants of " { $link each } ", " { $link map } " and " { $link filter } ":" { $subsection parallel-each } +{ $subsection 2parallel-each } { $subsection parallel-map } -{ $subsection parallel-subset } ; +{ $subsection 2parallel-map } +{ $subsection parallel-filter } ; ABOUT: "concurrency.combinators" diff --git a/extra/concurrency/combinators/combinators-tests.factor b/extra/concurrency/combinators/combinators-tests.factor index 731a740983..562111242d 100755 --- a/extra/concurrency/combinators/combinators-tests.factor +++ b/extra/concurrency/combinators/combinators-tests.factor @@ -1,10 +1,12 @@ IN: concurrency.combinators.tests USING: concurrency.combinators tools.test random kernel math -concurrency.mailboxes threads sequences accessors ; +concurrency.mailboxes threads sequences accessors arrays ; [ [ drop ] parallel-each ] must-infer +{ 2 0 } [ [ 2drop ] 2parallel-each ] must-infer-as [ [ ] parallel-map ] must-infer -[ [ ] parallel-subset ] must-infer +{ 2 1 } [ [ 2array ] 2parallel-map ] must-infer-as +[ [ ] parallel-filter ] must-infer [ { 1 4 9 } ] [ { 1 2 3 } [ sq ] parallel-map ] unit-test @@ -14,7 +16,7 @@ concurrency.mailboxes threads sequences accessors ; [ error>> "Even" = ] must-fail-with [ V{ 0 3 6 9 } ] -[ 10 [ 3 mod zero? ] parallel-subset ] unit-test +[ 10 [ 3 mod zero? ] parallel-filter ] unit-test [ 10 ] [ @@ -22,3 +24,24 @@ concurrency.mailboxes threads sequences accessors ; 10 over [ push ] curry parallel-each length ] unit-test + +[ { 10 20 30 } ] [ + { 1 4 3 } { 10 5 10 } [ * ] 2parallel-map +] unit-test + +[ { -9 -1 -7 } ] [ + { 1 4 3 } { 10 5 10 } [ - ] 2parallel-map +] unit-test + +[ + { 1 4 3 } { 1 0 1 } [ / drop ] 2parallel-each +] must-fail + +[ 20 ] +[ + V{ } clone + 10 10 pick [ [ push ] [ push ] bi ] curry 2parallel-each + length +] unit-test + +[ { f } [ "OOPS" throw ] parallel-each ] must-fail diff --git a/extra/concurrency/combinators/combinators.factor b/extra/concurrency/combinators/combinators.factor index 76c3cfa77d..eab0ed4cb4 100755 --- a/extra/concurrency/combinators/combinators.factor +++ b/extra/concurrency/combinators/combinators.factor @@ -4,14 +4,27 @@ USING: concurrency.futures concurrency.count-downs sequences kernel ; IN: concurrency.combinators -: parallel-map ( seq quot -- newseq ) - [ curry future ] curry map dup [ ?future ] change-each ; - inline +: (parallel-each) ( n quot -- ) + >r r> keep await ; inline : parallel-each ( seq quot -- ) - over length - [ [ >r curry r> spawn-stage ] 2curry each ] keep await ; + over length [ + [ >r curry r> spawn-stage ] 2curry each + ] (parallel-each) ; inline + +: 2parallel-each ( seq1 seq2 quot -- ) + 2over min-length [ + [ >r 2curry r> spawn-stage ] 2curry 2each + ] (parallel-each) ; inline + +: parallel-filter ( seq quot -- newseq ) + over >r pusher >r each r> r> like ; inline + +: future-values dup [ ?future ] change-each ; inline + +: parallel-map ( seq quot -- newseq ) + [ curry future ] curry map future-values ; inline -: parallel-subset ( seq quot -- newseq ) - over >r pusher >r each r> r> like ; inline +: 2parallel-map ( seq1 seq2 quot -- newseq ) + [ 2curry future ] curry 2map future-values ; diff --git a/extra/concurrency/count-downs/count-downs.factor b/extra/concurrency/count-downs/count-downs.factor index 6a75f7206c..93cef250a1 100755 --- a/extra/concurrency/count-downs/count-downs.factor +++ b/extra/concurrency/count-downs/count-downs.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: dlists kernel math concurrency.promises -concurrency.mailboxes ; +concurrency.mailboxes debugger accessors ; IN: concurrency.count-downs ! http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/CountDownLatch.html @@ -9,9 +9,7 @@ IN: concurrency.count-downs TUPLE: count-down n promise ; : count-down-check ( count-down -- ) - dup count-down-n zero? [ - t swap count-down-promise fulfill - ] [ drop ] if ; + dup n>> zero? [ t swap promise>> fulfill ] [ drop ] if ; : ( n -- count-down ) dup 0 < [ "Invalid count for count down" throw ] when @@ -19,15 +17,12 @@ TUPLE: count-down n promise ; dup count-down-check ; : count-down ( count-down -- ) - dup count-down-n dup zero? [ - "Count down already done" throw - ] [ - 1- over set-count-down-n - count-down-check - ] if ; + dup n>> dup zero? + [ "Count down already done" throw ] + [ 1- >>n count-down-check ] if ; : await-timeout ( count-down timeout -- ) - >r count-down-promise r> ?promise-timeout drop ; + >r promise>> r> ?promise-timeout ?linked t assert= ; : await ( count-down -- ) f await-timeout ; @@ -35,5 +30,4 @@ TUPLE: count-down n promise ; : spawn-stage ( quot count-down -- ) [ [ count-down ] curry compose ] keep "Count down stage" - swap count-down-promise - promise-mailbox spawn-linked-to drop ; + swap promise>> mailbox>> spawn-linked-to drop ; diff --git a/extra/concurrency/distributed/distributed-tests.factor b/extra/concurrency/distributed/distributed-tests.factor index e2abd6deb9..ca1da0deaa 100755 --- a/extra/concurrency/distributed/distributed-tests.factor +++ b/extra/concurrency/distributed/distributed-tests.factor @@ -13,7 +13,7 @@ concurrency.messaging continuations ; [ ] [ test-node dup 1array swap (start-node) ] unit-test -[ ] [ yield ] unit-test +[ ] [ 100 sleep ] unit-test [ ] [ [ diff --git a/extra/concurrency/distributed/distributed.factor b/extra/concurrency/distributed/distributed.factor index 6704272305..c637f4baa3 100755 --- a/extra/concurrency/distributed/distributed.factor +++ b/extra/concurrency/distributed/distributed.factor @@ -3,7 +3,7 @@ USING: serialize sequences concurrency.messaging threads io io.server qualified arrays namespaces kernel io.encodings.binary accessors ; -QUALIFIED: io.sockets +FROM: io.sockets => host-name with-client ; IN: concurrency.distributed SYMBOL: local-node @@ -23,7 +23,7 @@ SYMBOL: local-node : start-node ( port -- ) [ internet-server ] - [ io.sockets:host-name swap io.sockets: ] bi + [ host-name swap ] bi (start-node) ; TUPLE: remote-process id node ; @@ -31,8 +31,7 @@ TUPLE: remote-process id node ; C: remote-process : send-remote-message ( message node -- ) - binary io.sockets: - [ serialize ] with-stream ; + binary [ serialize ] with-client ; M: remote-process send ( message thread -- ) [ id>> 2array ] [ node>> ] bi diff --git a/extra/concurrency/exchangers/exchangers.factor b/extra/concurrency/exchangers/exchangers.factor index d9d6809602..6b44886eda 100755 --- a/extra/concurrency/exchangers/exchangers.factor +++ b/extra/concurrency/exchangers/exchangers.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel threads boxes ; +USING: kernel threads boxes accessors ; IN: concurrency.exchangers ! Motivated by @@ -12,10 +12,10 @@ TUPLE: exchanger thread object ; exchanger boa ; : exchange ( obj exchanger -- newobj ) - dup exchanger-thread box-full? [ - dup exchanger-object box> - >r exchanger-thread box> resume-with r> + dup thread>> occupied>> [ + dup object>> box> + >r thread>> box> resume-with r> ] [ - [ exchanger-object >box ] keep - [ exchanger-thread >box ] curry "exchange" suspend + [ object>> >box ] keep + [ thread>> >box ] curry "exchange" suspend ] if ; diff --git a/extra/concurrency/flags/flags-tests.factor b/extra/concurrency/flags/flags-tests.factor index f23ea95167..9d3f6de98c 100755 --- a/extra/concurrency/flags/flags-tests.factor +++ b/extra/concurrency/flags/flags-tests.factor @@ -1,11 +1,12 @@ IN: concurrency.flags.tests -USING: tools.test concurrency.flags kernel threads locals ; +USING: tools.test concurrency.flags concurrency.combinators +kernel threads locals accessors ; :: flag-test-1 ( -- ) [let | f [ ] | [ f raise-flag ] "Flag test" spawn drop f lower-flag - f flag-value? + f value>> ] ; [ f ] [ flag-test-1 ] unit-test @@ -14,7 +15,7 @@ USING: tools.test concurrency.flags kernel threads locals ; [let | f [ ] | [ 1000 sleep f raise-flag ] "Flag test" spawn drop f lower-flag - f flag-value? + f value>> ] ; [ f ] [ flag-test-2 ] unit-test @@ -22,7 +23,7 @@ USING: tools.test concurrency.flags kernel threads locals ; :: flag-test-3 ( -- ) [let | f [ ] | f raise-flag - f flag-value? + f value>> ] ; [ t ] [ flag-test-3 ] unit-test @@ -31,7 +32,7 @@ USING: tools.test concurrency.flags kernel threads locals ; [let | f [ ] | [ f raise-flag ] "Flag test" spawn drop f wait-for-flag - f flag-value? + f value>> ] ; [ t ] [ flag-test-4 ] unit-test @@ -40,7 +41,13 @@ USING: tools.test concurrency.flags kernel threads locals ; [let | f [ ] | [ 1000 sleep f raise-flag ] "Flag test" spawn drop f wait-for-flag - f flag-value? + f value>> ] ; [ t ] [ flag-test-5 ] unit-test + +[ ] [ + { 1 2 } + [ [ 1000 sleep raise-flag ] curry "Flag test" spawn drop ] + [ [ wait-for-flag drop ] curry parallel-each ] bi +] unit-test diff --git a/extra/concurrency/flags/flags.factor b/extra/concurrency/flags/flags.factor index b3c76a7a01..ec260961d0 100755 --- a/extra/concurrency/flags/flags.factor +++ b/extra/concurrency/flags/flags.factor @@ -1,22 +1,20 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: boxes kernel threads ; +USING: dlists kernel threads concurrency.conditions accessors ; IN: concurrency.flags -TUPLE: flag value? thread ; +TUPLE: flag value threads ; -: ( -- flag ) f flag boa ; +: ( -- flag ) f flag boa ; : raise-flag ( flag -- ) - dup flag-value? [ - t over set-flag-value? - dup flag-thread [ resume ] if-box? - ] unless drop ; + dup value>> [ drop ] [ t >>value threads>> notify-all ] if ; + +: wait-for-flag-timeout ( flag timeout -- ) + over value>> [ 2drop ] [ >r threads>> r> "flag" wait ] if ; : wait-for-flag ( flag -- ) - dup flag-value? [ drop ] [ - [ flag-thread >box ] curry "flag" suspend drop - ] if ; + f wait-for-flag-timeout ; : lower-flag ( flag -- ) - dup wait-for-flag f swap set-flag-value? ; + [ wait-for-flag ] [ f >>value drop ] bi ; diff --git a/extra/concurrency/mailboxes/mailboxes-tests.factor b/extra/concurrency/mailboxes/mailboxes-tests.factor index 7fe09cdcf5..61c57bb9e9 100755 --- a/extra/concurrency/mailboxes/mailboxes-tests.factor +++ b/extra/concurrency/mailboxes/mailboxes-tests.factor @@ -1,7 +1,7 @@ IN: concurrency.mailboxes.tests USING: concurrency.mailboxes concurrency.count-downs vectors sequences threads tools.test math kernel strings namespaces -continuations calendar ; +continuations calendar destructors ; [ V{ 1 2 3 } ] [ 0 diff --git a/extra/concurrency/mailboxes/mailboxes.factor b/extra/concurrency/mailboxes/mailboxes.factor index ac03197708..aa03d3d8ee 100755 --- a/extra/concurrency/mailboxes/mailboxes.factor +++ b/extra/concurrency/mailboxes/mailboxes.factor @@ -1,17 +1,13 @@ ! Copyright (C) 2005, 2008 Chris Double, Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. IN: concurrency.mailboxes -USING: dlists threads sequences continuations +USING: dlists threads sequences continuations destructors namespaces random math quotations words kernel arrays assocs -init system concurrency.conditions accessors ; +init system concurrency.conditions accessors debugger ; -TUPLE: mailbox threads data closed ; +TUPLE: mailbox threads data disposed ; -: check-closed ( mailbox -- ) - closed>> [ "Mailbox closed" throw ] when ; inline - -M: mailbox dispose - t >>closed threads>> notify-all ; +M: mailbox dispose* threads>> notify-all ; : ( -- mailbox ) f mailbox boa ; @@ -27,7 +23,7 @@ M: mailbox dispose >r threads>> r> "mailbox" wait ; : block-unless-pred ( mailbox timeout pred -- ) - pick check-closed + pick check-disposed pick data>> over dlist-contains? [ 3drop ] [ @@ -35,7 +31,7 @@ M: mailbox dispose ] if ; inline : block-if-empty ( mailbox timeout -- mailbox ) - over check-closed + over check-disposed over mailbox-empty? [ 2dup wait-for-mailbox block-if-empty ] [ @@ -62,7 +58,7 @@ M: mailbox dispose : while-mailbox-empty ( mailbox quot -- ) over mailbox-empty? [ - dup >r swap slip r> while-mailbox-empty + dup >r dip r> while-mailbox-empty ] [ 2drop ] if ; inline @@ -75,7 +71,7 @@ M: mailbox dispose f swap mailbox-get-timeout? ; inline : wait-for-close-timeout ( mailbox timeout -- ) - over closed>> + over disposed>> [ 2drop ] [ 2dup wait-for-mailbox wait-for-close-timeout ] if ; : wait-for-close ( mailbox -- ) @@ -83,9 +79,13 @@ M: mailbox dispose TUPLE: linked-error error thread ; +M: linked-error error. + [ thread>> error-in-thread. ] [ error>> error. ] bi ; + C: linked-error -: ?linked dup linked-error? [ rethrow ] when ; +: ?linked ( message -- message ) + dup linked-error? [ rethrow ] when ; TUPLE: linked-thread < thread supervisor ; diff --git a/extra/concurrency/messaging/messaging.factor b/extra/concurrency/messaging/messaging.factor index 66c5e421fa..e77760408c 100755 --- a/extra/concurrency/messaging/messaging.factor +++ b/extra/concurrency/messaging/messaging.factor @@ -17,7 +17,7 @@ GENERIC: send ( message thread -- ) M: thread send ( message thread -- ) check-registered mailbox-of mailbox-put ; -: my-mailbox self mailbox-of ; +: my-mailbox ( -- mailbox ) self mailbox-of ; : receive ( -- message ) my-mailbox mailbox-get ?linked ; diff --git a/extra/contributors/contributors-tests.factor b/extra/contributors/contributors-tests.factor new file mode 100644 index 0000000000..1476715588 --- /dev/null +++ b/extra/contributors/contributors-tests.factor @@ -0,0 +1,5 @@ +IN: contributors.tests +USING: contributors tools.test ; + +\ contributors must-infer +[ ] [ contributors ] unit-test diff --git a/extra/contributors/contributors.factor b/extra/contributors/contributors.factor index 868e968169..9f2d5a55fa 100755 --- a/extra/contributors/contributors.factor +++ b/extra/contributors/contributors.factor @@ -1,13 +1,13 @@ ! Copyright (C) 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: io.files io.launcher io.styles io hashtables kernel -sequences sequences.lib assocs system sorting math.parser -sets ; +USING: io.files io.launcher io.styles io.encodings.ascii io +hashtables kernel sequences sequences.lib assocs system sorting +math.parser sets ; IN: contributors : changelog ( -- authors ) image parent-directory [ - "git-log --pretty=format:%an" lines + "git-log --pretty=format:%an" ascii lines ] with-directory ; : patch-counts ( authors -- assoc ) diff --git a/extra/http/mime/authors.txt b/extra/cords/authors.txt old mode 100755 new mode 100644 similarity index 100% rename from extra/http/mime/authors.txt rename to extra/cords/authors.txt diff --git a/extra/cords/cords-tests.factor b/extra/cords/cords-tests.factor new file mode 100644 index 0000000000..0058c8f07a --- /dev/null +++ b/extra/cords/cords-tests.factor @@ -0,0 +1,5 @@ +IN: cords.tests +USING: cords strings tools.test kernel sequences ; + +[ "hello world" ] [ "hello" " world" cord-append dup like ] unit-test +[ "hello world" ] [ { "he" "llo" " world" } cord-concat dup like ] unit-test diff --git a/extra/cords/cords.factor b/extra/cords/cords.factor new file mode 100644 index 0000000000..f5cc89f8d5 --- /dev/null +++ b/extra/cords/cords.factor @@ -0,0 +1,70 @@ +! Copysecond (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors assocs sequences sorting math math.order +arrays combinators kernel ; +IN: cords + +> length ] [ second>> length ] bi + ; + +M: simple-cord virtual-seq first>> ; + +M: simple-cord virtual@ + 2dup first>> length < + [ first>> ] [ [ first>> length - ] [ second>> ] bi ] if ; + +TUPLE: multi-cord count seqs ; + +M: multi-cord length count>> ; + +M: multi-cord virtual@ + dupd + seqs>> [ first <=> ] binsearch* + [ first - ] [ second ] bi ; + +M: multi-cord virtual-seq + seqs>> dup empty? [ drop f ] [ first second ] if ; + +: ( seqs -- cord ) + dup length 2 = [ + first2 simple-cord boa + ] [ + [ 0 [ length + ] accumulate ] keep zip multi-cord boa + ] if ; + +PRIVATE> + +UNION: cord simple-cord multi-cord ; + +INSTANCE: cord virtual-sequence + +INSTANCE: multi-cord virtual-sequence + +: cord-append ( seq1 seq2 -- cord ) + { + { [ over empty? ] [ nip ] } + { [ dup empty? ] [ drop ] } + { [ 2dup [ cord? ] both? ] [ [ seqs>> values ] bi@ append ] } + { [ over cord? ] [ [ seqs>> values ] dip suffix ] } + { [ dup cord? ] [ seqs>> values swap prefix ] } + [ 2array ] + } cond ; + +: cord-concat ( seqs -- cord ) + { + { [ dup empty? ] [ drop f ] } + { [ dup length 1 = ] [ first ] } + [ + [ + { + { [ dup cord? ] [ seqs>> values ] } + { [ dup empty? ] [ drop { } ] } + [ 1array ] + } cond + ] map concat + ] + } cond ; diff --git a/extra/cords/summary.txt b/extra/cords/summary.txt new file mode 100644 index 0000000000..3c69862b71 --- /dev/null +++ b/extra/cords/summary.txt @@ -0,0 +1 @@ +Virtual sequence concatenation diff --git a/extra/cords/tags.txt b/extra/cords/tags.txt new file mode 100644 index 0000000000..42d711b32b --- /dev/null +++ b/extra/cords/tags.txt @@ -0,0 +1 @@ +collections diff --git a/extra/core-foundation/fsevents/fsevents.factor b/extra/core-foundation/fsevents/fsevents.factor index 67a4e59d04..f14dba6433 100644 --- a/extra/core-foundation/fsevents/fsevents.factor +++ b/extra/core-foundation/fsevents/fsevents.factor @@ -3,7 +3,7 @@ USING: alien alien.c-types alien.strings alien.syntax kernel math sequences namespaces assocs init accessors continuations combinators core-foundation core-foundation.run-loop -io.encodings.utf8 ; +io.encodings.utf8 destructors ; IN: core-foundation.fsevents ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! @@ -149,11 +149,12 @@ FUNCTION: CFStringRef FSEventStreamCopyDescription ( FSEventStreamRef streamRef SYMBOL: event-stream-callbacks -: event-stream-counter \ event-stream-counter counter ; +: event-stream-counter ( -- n ) + \ event-stream-counter counter ; [ event-stream-callbacks global - [ [ drop expired? not ] assoc-subset H{ } assoc-like ] change-at + [ [ drop expired? not ] assoc-filter H{ } assoc-like ] change-at ] "core-foundation" add-init-hook : add-event-source-callback ( quot -- id ) @@ -187,7 +188,7 @@ SYMBOL: event-stream-callbacks dup [ call drop ] [ 3drop ] if ] alien-callback ; -TUPLE: event-stream info handle closed ; +TUPLE: event-stream info handle disposed ; : ( quot paths latency flags -- event-stream ) >r >r >r @@ -197,13 +198,10 @@ TUPLE: event-stream info handle closed ; dup enable-event-stream f event-stream boa ; -M: event-stream dispose - dup closed>> [ drop ] [ - t >>closed - { - [ info>> remove-event-source-callback ] - [ handle>> disable-event-stream ] - [ handle>> FSEventStreamInvalidate ] - [ handle>> FSEventStreamRelease ] - } cleave - ] if ; +M: event-stream dispose* + { + [ info>> remove-event-source-callback ] + [ handle>> disable-event-stream ] + [ handle>> FSEventStreamInvalidate ] + [ handle>> FSEventStreamRelease ] + } cleave ; diff --git a/extra/cpu/8080/emulator/emulator.factor b/extra/cpu/8080/emulator/emulator.factor index ecc998e99c..b0ffb6ae54 100755 --- a/extra/cpu/8080/emulator/emulator.factor +++ b/extra/cpu/8080/emulator/emulator.factor @@ -3,7 +3,7 @@ ! USING: kernel math sequences words arrays io io.files namespaces math.parser assocs quotations parser parser-combinators -tools.time io.encodings.binary ; +tools.time io.encodings.binary sequences.deep symbols combinators ; IN: cpu.8080.emulator TUPLE: cpu b c d e f h l a pc sp halted? last-interrupt cycles ram ; @@ -563,29 +563,18 @@ SYMBOL: rom-root { "M" { flag-m? } } } at ; -SYMBOL: $1 -SYMBOL: $2 -SYMBOL: $3 -SYMBOL: $4 +SYMBOLS: $1 $2 $3 $4 ; : replace-patterns ( vector tree -- tree ) - #! Copy the tree, replacing each occurence of - #! $1, $2, etc with the relevant item from the - #! given index. - dup quotation? over [ ] = not and [ ! vector tree - dup first swap 1 tail ! vector car cdr - >r dupd replace-patterns ! vector v R: cdr - swap r> replace-patterns >r 1quotation r> append - ] [ ! vector value - dup $1 = [ drop 0 over nth ] when - dup $2 = [ drop 1 over nth ] when - dup $3 = [ drop 2 over nth ] when - dup $4 = [ drop 3 over nth ] when - nip - ] if ; - -: test-rp - { 4 5 3 } [ 1 $2 [ $1 4 ] ] replace-patterns ; + [ + { + { $1 [ first ] } + { $2 [ second ] } + { $3 [ third ] } + { $4 [ fourth ] } + [ nip ] + } case + ] with deep-map ; : (emulate-RST) ( n cpu -- ) #! RST nn @@ -766,7 +755,7 @@ SYMBOL: $4 "H" token <|> "L" token <|> [ register-lookup ] <@ ; -: all-flags +: all-flags ( -- parser ) #! A parser for 16-bit flags. "NZ" token "NC" token <|> @@ -777,7 +766,7 @@ SYMBOL: $4 "P" token <|> "M" token <|> [ flag-lookup ] <@ ; -: 16-bit-registers +: 16-bit-registers ( -- parser ) #! A parser for 16-bit registers. On a successfull parse the #! parse tree contains a vector. The first item in the vector #! is the getter word for that register with stack effect @@ -1098,27 +1087,27 @@ SYMBOL: $4 16-bit-registers indirect <&> just [ first2 swap first2 swap >r prepend r> curry ] <@ ; -: LD-RR,NN-instruction +: LD-RR,NN-instruction ( -- parser ) #! LD BC,nn "LD-RR,NN" "LD" complex-instruction 16-bit-registers sp <&> ",nn" token <& just [ first2 swap curry ] <@ ; -: LD-R,N-instruction +: LD-R,N-instruction ( -- parser ) #! LD B,n "LD-R,N" "LD" complex-instruction 8-bit-registers sp <&> ",n" token <& just [ first2 swap curry ] <@ ; -: LD-(RR),N-instruction +: LD-(RR),N-instruction ( -- parser ) "LD-(RR),N" "LD" complex-instruction 16-bit-registers indirect sp <&> ",n" token <& just [ first2 swap curry ] <@ ; -: LD-(RR),R-instruction +: LD-(RR),R-instruction ( -- parser ) #! LD (BC),A "LD-(RR),R" "LD" complex-instruction 16-bit-registers indirect sp <&> @@ -1126,84 +1115,84 @@ SYMBOL: $4 8-bit-registers <&> just [ first2 swap first2 swap >r prepend r> curry ] <@ ; -: LD-R,R-instruction +: LD-R,R-instruction ( -- parser ) "LD-R,R" "LD" complex-instruction 8-bit-registers sp <&> "," token <& 8-bit-registers <&> just [ first2 swap first2 swap >r prepend r> curry ] <@ ; -: LD-RR,RR-instruction +: LD-RR,RR-instruction ( -- parser ) "LD-RR,RR" "LD" complex-instruction 16-bit-registers sp <&> "," token <& 16-bit-registers <&> just [ first2 swap first2 swap >r prepend r> curry ] <@ ; -: LD-R,(RR)-instruction +: LD-R,(RR)-instruction ( -- parser ) "LD-R,(RR)" "LD" complex-instruction 8-bit-registers sp <&> "," token <& 16-bit-registers indirect <&> just [ first2 swap first2 swap >r prepend r> curry ] <@ ; -: LD-(NN),RR-instruction +: LD-(NN),RR-instruction ( -- parser ) "LD-(NN),RR" "LD" complex-instruction "nn" token indirect sp <& "," token <& 16-bit-registers <&> just [ first2 swap curry ] <@ ; -: LD-(NN),R-instruction +: LD-(NN),R-instruction ( -- parser ) "LD-(NN),R" "LD" complex-instruction "nn" token indirect sp <& "," token <& 8-bit-registers <&> just [ first2 swap curry ] <@ ; -: LD-RR,(NN)-instruction +: LD-RR,(NN)-instruction ( -- parser ) "LD-RR,(NN)" "LD" complex-instruction 16-bit-registers sp <&> "," token <& "nn" token indirect <& just [ first2 swap curry ] <@ ; -: LD-R,(NN)-instruction +: LD-R,(NN)-instruction ( -- parser ) "LD-R,(NN)" "LD" complex-instruction 8-bit-registers sp <&> "," token <& "nn" token indirect <& just [ first2 swap curry ] <@ ; -: OUT-(N),R-instruction +: OUT-(N),R-instruction ( -- parser ) "OUT-(N),R" "OUT" complex-instruction "n" token indirect sp <& "," token <& 8-bit-registers <&> just [ first2 swap curry ] <@ ; -: IN-R,(N)-instruction +: IN-R,(N)-instruction ( -- parser ) "IN-R,(N)" "IN" complex-instruction 8-bit-registers sp <&> "," token <& "n" token indirect <& just [ first2 swap curry ] <@ ; -: EX-(RR),RR-instruction +: EX-(RR),RR-instruction ( -- parser ) "EX-(RR),RR" "EX" complex-instruction 16-bit-registers indirect sp <&> "," token <& 16-bit-registers <&> just [ first2 swap first2 swap >r prepend r> curry ] <@ ; -: EX-RR,RR-instruction +: EX-RR,RR-instruction ( -- parser ) "EX-RR,RR" "EX" complex-instruction 16-bit-registers sp <&> "," token <& 16-bit-registers <&> just [ first2 swap first2 swap >r prepend r> curry ] <@ ; -: 8080-generator-parser +: 8080-generator-parser ( -- parser ) NOP-instruction RST-0-instruction <|> RST-8-instruction <|> @@ -1296,7 +1285,7 @@ SYMBOL: last-opcode #! that would implement that instruction. dup " " join instruction-quotations >r "_" join [ "emulate-" % % ] "" make create-in dup last-instruction global set-at - r> define ; + r> (( cpu -- )) define-declared ; : INSTRUCTION: ";" parse-tokens parse-instructions ; parsing diff --git a/extra/cpu/8080/test/test.factor b/extra/cpu/8080/test/test.factor index 85f27d7e40..f88db2935f 100755 --- a/extra/cpu/8080/test/test.factor +++ b/extra/cpu/8080/test/test.factor @@ -1,5 +1,5 @@ USING: kernel cpu.8080 cpu.8080.emulator math math io -tools.time combinators sequences io.files ; +tools.time combinators sequences io.files io.encodings.ascii ; IN: cpu.8080.test : step ( cpu -- ) @@ -29,7 +29,7 @@ IN: cpu.8080.test : >ppm ( cpu filename -- cpu ) #! Dump the current screen image to a ppm image file with the given name. - [ + ascii [ "P3" print "256 224" print "1" print @@ -45,7 +45,7 @@ IN: cpu.8080.test ] each-8bit drop ] each drop nl ] each - ] with-stream ; + ] with-file-writer ; : time-test ( -- ) test-cpu [ 1000000 run-n drop ] time ; diff --git a/extra/crypto/common/common-docs.factor b/extra/crypto/common/common-docs.factor deleted file mode 100644 index 559c7934d0..0000000000 --- a/extra/crypto/common/common-docs.factor +++ /dev/null @@ -1,13 +0,0 @@ -USING: help.markup help.syntax kernel math sequences quotations -math.private ; -IN: crypto.common - -HELP: hex-string -{ $values { "seq" "a sequence" } { "str" "a string" } } -{ $description "Converts a sequence of values from 0-255 to a string of hex numbers from 0-ff." } -{ $examples - { $example "USING: crypto.common io ;" "B{ 1 2 3 4 } hex-string print" "01020304" } -} -{ $notes "Numbers are zero-padded on the left." } ; - - diff --git a/extra/crypto/common/common.factor b/extra/crypto/common/common.factor index a714727ad9..651bd51774 100644 --- a/extra/crypto/common/common.factor +++ b/extra/crypto/common/common.factor @@ -1,5 +1,6 @@ -USING: arrays kernel io io.binary sbufs splitting strings sequences -namespaces math math.parser parser hints math.bitfields.lib ; +USING: arrays kernel io io.binary sbufs splitting grouping +strings sequences namespaces math math.parser parser +hints math.bitfields.lib assocs ; IN: crypto.common : w+ ( int int -- int ) + 32 bits ; inline @@ -39,9 +40,6 @@ SYMBOL: big-endian? : update-old-new ( old new -- ) [ get >r get r> ] 2keep >r >r w+ dup r> set r> set ; inline -: hex-string ( seq -- str ) - [ [ >hex 2 48 pad-left % ] each ] "" make ; - : slice3 ( n seq -- a b c ) >r dup 3 + r> first3 ; : seq>2seq ( seq -- seq1 seq2 ) @@ -50,7 +48,7 @@ SYMBOL: big-endian? : 2seq>seq ( seq1 seq2 -- seq ) #! { aceg } { bdfh } -> { abcdefgh } - [ 2array flip concat ] keep like ; + [ zip concat ] keep like ; : mod-nth ( n seq -- elt ) #! 5 "abcd" -> b diff --git a/extra/crypto/hmac/hmac.factor b/extra/crypto/hmac/hmac.factor index 91d404aead..6e30f19775 100755 --- a/extra/crypto/hmac/hmac.factor +++ b/extra/crypto/hmac/hmac.factor @@ -1,18 +1,19 @@ -USING: arrays combinators crypto.common crypto.md5 crypto.sha1 -crypto.md5.private io io.binary io.files io.streams.byte-array -kernel math math.vectors memoize sequences io.encodings.binary ; +USING: arrays combinators crypto.common checksums checksums.md5 +checksums.sha1 checksums.md5.private io io.binary io.files +io.streams.byte-array kernel math math.vectors memoize sequences +io.encodings.binary ; IN: crypto.hmac : sha1-hmac ( Ko Ki -- hmac ) initialize-sha1 process-sha1-block - (stream>sha1) get-sha1 + stream>sha1 get-sha1 initialize-sha1 >r process-sha1-block r> process-sha1-block get-sha1 ; : md5-hmac ( Ko Ki -- hmac ) initialize-md5 process-md5-block - (stream>md5) get-md5 + stream>md5 get-md5 initialize-md5 >r process-md5-block r> process-md5-block get-md5 ; @@ -29,7 +30,7 @@ MEMO: opad ( -- seq ) 64 HEX: 5c ; ipad seq-bitxor ; : stream>sha1-hmac ( K stream -- hmac ) - [ init-hmac sha1-hmac ] with-stream ; + [ init-hmac sha1-hmac ] with-input-stream ; : file>sha1-hmac ( K path -- hmac ) binary stream>sha1-hmac ; @@ -38,7 +39,7 @@ MEMO: opad ( -- seq ) 64 HEX: 5c ; binary stream>sha1-hmac ; : stream>md5-hmac ( K stream -- hmac ) - [ init-hmac md5-hmac ] with-stream ; + [ init-hmac md5-hmac ] with-input-stream ; : file>md5-hmac ( K path -- hmac ) binary stream>md5-hmac ; diff --git a/extra/crypto/md5/md5-docs.factor b/extra/crypto/md5/md5-docs.factor deleted file mode 100755 index 667e0449ae..0000000000 --- a/extra/crypto/md5/md5-docs.factor +++ /dev/null @@ -1,18 +0,0 @@ -USING: help.markup help.syntax kernel math sequences quotations -crypto.common byte-arrays ; -IN: crypto.md5 - -HELP: stream>md5 -{ $values { "stream" "a stream" } { "byte-array" "md5 hash" } } -{ $description "Take the MD5 hash until end of stream." } -{ $notes "Used to implement " { $link byte-array>md5 } " and " { $link file>md5 } ". Call " { $link hex-string } " to convert to the canonical string representation." } ; - -HELP: byte-array>md5 -{ $values { "byte-array" byte-array } { "checksum" "an md5 hash" } } -{ $description "Outputs the MD5 hash of a byte array." } -{ $notes "Call " { $link hex-string } " to convert to the canonical string representation." } ; - -HELP: file>md5 -{ $values { "path" "a path" } { "byte-array" "byte-array md5 hash" } } -{ $description "Outputs the MD5 hash of a file." } -{ $notes "Call " { $link hex-string } " to convert to the canonical string representation." } ; diff --git a/extra/crypto/md5/md5-tests.factor b/extra/crypto/md5/md5-tests.factor deleted file mode 100755 index 73bd240455..0000000000 --- a/extra/crypto/md5/md5-tests.factor +++ /dev/null @@ -1,10 +0,0 @@ -USING: kernel math namespaces crypto.md5 tools.test byte-arrays ; - -[ "d41d8cd98f00b204e9800998ecf8427e" ] [ "" >byte-array byte-array>md5str ] unit-test -[ "0cc175b9c0f1b6a831c399e269772661" ] [ "a" >byte-array byte-array>md5str ] unit-test -[ "900150983cd24fb0d6963f7d28e17f72" ] [ "abc" >byte-array byte-array>md5str ] unit-test -[ "f96b697d7cb7938d525a2f31aaf161d0" ] [ "message digest" >byte-array byte-array>md5str ] unit-test -[ "c3fcd3d76192e4007dfb496cca67e13b" ] [ "abcdefghijklmnopqrstuvwxyz" >byte-array byte-array>md5str ] unit-test -[ "d174ab98d277d9f5a5611c2c9f419d9f" ] [ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" >byte-array byte-array>md5str ] unit-test -[ "57edf4a22be3c955ac49da2e2107b67a" ] [ "12345678901234567890123456789012345678901234567890123456789012345678901234567890" >byte-array byte-array>md5str ] unit-test - diff --git a/extra/csv/authors.txt b/extra/csv/authors.txt new file mode 100644 index 0000000000..0be42b2faa --- /dev/null +++ b/extra/csv/authors.txt @@ -0,0 +1 @@ +Phil Dawes diff --git a/extra/csv/csv-docs.factor b/extra/csv/csv-docs.factor new file mode 100644 index 0000000000..c9f39900ab --- /dev/null +++ b/extra/csv/csv-docs.factor @@ -0,0 +1,21 @@ +USING: help.syntax help.markup kernel prettyprint sequences ; +IN: csv + +HELP: csv +{ $values { "stream" "a stream" } + { "rows" "an array of arrays of fields" } } +{ $description "parses a csv stream into an array of row arrays" +} ; + +HELP: csv-row +{ $values { "stream" "a stream" } + { "row" "an array of fields" } } +{ $description "parses a row from a csv stream" +} ; + + +HELP: with-delimiter +{ $values { "char" "field delimiter (e.g. CHAR: \t)" } + { "quot" "a quotation" } } +{ $description "Sets the field delimiter for csv or csv-row words " +} ; diff --git a/extra/csv/csv-tests.factor b/extra/csv/csv-tests.factor new file mode 100644 index 0000000000..7e96dbc0a6 --- /dev/null +++ b/extra/csv/csv-tests.factor @@ -0,0 +1,70 @@ +USING: io.streams.string csv tools.test shuffle ; +IN: csv.tests + +! I like to name my unit tests +: named-unit-test ( name output input -- ) + nipd unit-test ; inline + +! tests nicked from the wikipedia csv article +! http://en.wikipedia.org/wiki/Comma-separated_values + +"Fields are separated by commas" +[ { { "1997" "Ford" "E350" } } ] +[ "1997,Ford,E350" csv ] named-unit-test + +"ignores whitespace before and after elements. n.b.specifically prohibited by RFC 4180, which states, 'Spaces are considered part of a field and should not be ignored.'" +[ { { "1997" "Ford" "E350" } } ] +[ "1997, Ford , E350" csv ] named-unit-test + +"keeps spaces in quotes" +[ { { "1997" "Ford" "E350" "Super, luxurious truck" } } ] +[ "1997,Ford,E350,\"Super, luxurious truck\"" csv ] named-unit-test + +"double quotes mean escaped in quotes" +[ { { "1997" "Ford" "E350" "Super \"luxurious\" truck" } } ] +[ "1997,Ford,E350,\"Super \"\"luxurious\"\" truck\"" + csv ] named-unit-test + +"Fields with embedded line breaks must be delimited by double-quote characters." +[ { { "1997" "Ford" "E350" "Go get one now\nthey are going fast" } } ] +[ "1997,Ford,E350,\"Go get one now\nthey are going fast\"" + csv ] named-unit-test + +"Fields with leading or trailing spaces must be delimited by double-quote characters. (See comment about leading and trailing spaces above)" +[ { { "1997" "Ford" "E350" " Super luxurious truck " } } ] +[ "1997,Ford,E350,\" Super luxurious truck \"" + csv ] named-unit-test + +"Fields may always be delimited by double-quote characters, whether necessary or not." +[ { { "1997" "Ford" "E350" } } ] +[ "\"1997\",\"Ford\",\"E350\"" csv ] named-unit-test + +"The first record in a csv file may contain column names in each of the fields." +[ { { "Year" "Make" "Model" } + { "1997" "Ford" "E350" } + { "2000" "Mercury" "Cougar" } } ] +[ "Year,Make,Model\n1997,Ford,E350\n2000,Mercury,Cougar" + csv ] named-unit-test + + +! !!!!!!!! other tests + +[ { { "Phil Dawes" } } ] +[ "\"Phil Dawes\"" csv ] unit-test + +[ { { "1" "2" "3" } { "4" "5" "6" } } ] +[ "1,2,3\n4,5,6\n" csv ] unit-test + +"trims leading and trailing whitespace - n.b. this isn't really conformant, but lots of csv seems to assume this" +[ { { "foo yeah" "bah" "baz" } } ] +[ " foo yeah , bah ,baz\n" csv ] named-unit-test + + +"allows setting of delimiting character" +[ { { "foo" "bah" "baz" } } ] +[ "foo\tbah\tbaz\n" CHAR: \t [ csv ] with-delimiter ] named-unit-test + +"Quoted field followed immediately by newline" +[ { { "foo" "bar" } + { "1" "2" } } ] +[ "foo,\"bar\"\n1,2" csv ] named-unit-test diff --git a/extra/csv/csv.factor b/extra/csv/csv.factor new file mode 100644 index 0000000000..8ba0832b29 --- /dev/null +++ b/extra/csv/csv.factor @@ -0,0 +1,71 @@ +! Copyright (C) 2007, 2008 Phil Dawes +! See http://factorcode.org/license.txt for BSD license. + +! Simple CSV Parser +! Phil Dawes phil@phildawes.net + +USING: kernel sequences io namespaces combinators unicode.categories vars ; +IN: csv + +DEFER: quoted-field + +VAR: delimiter + +! trims whitespace from either end of string +: trim-whitespace ( str -- str ) + [ blank? ] trim ; inline + +: skip-to-field-end ( -- endchar ) + "\n" delimiter> suffix read-until nip ; inline + +: not-quoted-field ( -- endchar ) + "\"\n" delimiter> suffix read-until ! " + dup + { { CHAR: " [ drop drop quoted-field ] } ! " + { delimiter> [ swap trim-whitespace % ] } + { CHAR: \n [ swap trim-whitespace % ] } + { f [ swap trim-whitespace % ] } ! eof + } case ; + +: maybe-escaped-quote ( -- endchar ) + read1 dup + { { CHAR: " [ , quoted-field ] } ! " is an escaped quote + { delimiter> [ ] } ! end of quoted field + { CHAR: \n [ ] } + [ 2drop skip-to-field-end ] ! end of quoted field + padding + } case ; + +: quoted-field ( -- endchar ) + "\"" read-until ! " + drop % maybe-escaped-quote ; + +: field ( -- sep string ) + [ not-quoted-field ] "" make ; ! trim-whitespace + +: (row) ( -- sep ) + field , + dup delimiter> = [ drop (row) ] when ; + +: row ( -- eof? array[string] ) + [ (row) ] { } make ; + +: append-if-row-not-empty ( row -- ) + dup { "" } = [ drop ] [ , ] if ; + +: (csv) ( -- ) + row append-if-row-not-empty + [ (csv) ] when ; + +: init-vars ( -- ) + delimiter> [ CHAR: , >delimiter ] unless ; inline + +: csv-row ( stream -- row ) + init-vars + [ row nip ] with-input-stream ; + +: csv ( stream -- rows ) + init-vars + [ [ (csv) ] { } make ] with-input-stream ; + +: with-delimiter ( char quot -- ) + delimiter swap with-variable ; inline diff --git a/extra/csv/summary.txt b/extra/csv/summary.txt new file mode 100644 index 0000000000..503cc1b38d --- /dev/null +++ b/extra/csv/summary.txt @@ -0,0 +1 @@ +CSV parser diff --git a/extra/db/db.factor b/extra/db/db.factor index 91128a7ffb..8d1feca6c7 100755 --- a/extra/db/db.factor +++ b/extra/db/db.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: arrays assocs classes continuations kernel math +USING: arrays assocs classes continuations destructors kernel math namespaces sequences sequences.lib classes.tuple words strings tools.walker accessors combinators.lib ; IN: db @@ -25,7 +25,7 @@ GENERIC: make-db* ( seq class -- db ) GENERIC: db-open ( db -- db ) HOOK: db-close db ( handle -- ) -: dispose-statements ( seq -- ) [ dispose drop ] assoc-each ; +: dispose-statements ( assoc -- ) values dispose-each ; : dispose-db ( db -- ) dup db [ @@ -35,36 +35,17 @@ HOOK: db-close db ( handle -- ) handle>> db-close ] with-variable ; -! TUPLE: sql sql in-params out-params ; TUPLE: statement handle sql in-params out-params bind-params bound? type ; TUPLE: simple-statement < statement ; TUPLE: prepared-statement < statement ; -SINGLETON: throwable -SINGLETON: nonthrowable - -: make-throwable ( obj -- obj' ) - dup sequence? [ - [ make-throwable ] map - ] [ - throwable >>type - ] if ; - -: make-nonthrowable ( obj -- obj' ) - dup sequence? [ - [ make-nonthrowable ] map - ] [ - nonthrowable >>type - ] if ; - TUPLE: result-set sql in-params out-params handle n max ; : construct-statement ( sql in out class -- statement ) new swap >>out-params swap >>in-params - swap >>sql - throwable >>type ; + swap >>sql ; HOOK: db ( str in out -- statement ) HOOK: db ( str in out -- statement ) @@ -82,12 +63,9 @@ GENERIC: more-rows? ( result-set -- ? ) GENERIC: execute-statement* ( statement type -- ) -M: throwable execute-statement* ( statement type -- ) +M: object execute-statement* ( statement type -- ) drop query-results dispose ; -M: nonthrowable execute-statement* ( statement type -- ) - drop [ query-results dispose ] [ 2drop ] recover ; - : execute-statement ( statement -- ) dup sequence? [ [ execute-statement ] each @@ -128,9 +106,9 @@ M: nonthrowable execute-statement* ( statement type -- ) : query-map ( statement quot -- seq ) accumulator >r query-each r> { } like ; inline -: with-db ( db seq quot -- ) +: with-db ( seq class quot -- ) >r make-db db-open db r> - [ db get swap [ drop ] swap compose with-disposal ] curry with-variable ; + [ db get swap [ drop ] prepose with-disposal ] curry with-variable ; inline : default-query ( query -- result-set ) diff --git a/extra/db/errors/errors.factor b/extra/db/errors/errors.factor new file mode 100644 index 0000000000..1e0d1e7fb4 --- /dev/null +++ b/extra/db/errors/errors.factor @@ -0,0 +1,11 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: kernel ; +IN: db.errors + +ERROR: db-error ; +ERROR: sql-error ; + + +ERROR: table-exists ; +ERROR: bad-schema ; diff --git a/extra/db/mysql/mysql.factor b/extra/db/mysql/mysql.factor index f8700debaa..1767bf3d50 100755 --- a/extra/db/mysql/mysql.factor +++ b/extra/db/mysql/mysql.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for license. -USING: alien continuations io kernel prettyprint sequences -db db.mysql.ffi ; +USING: alien continuations destructors io kernel prettyprint +sequences db db.mysql.ffi ; IN: db.mysql TUPLE: mysql-db handle host user password db port ; diff --git a/extra/db/pools/pools-tests.factor b/extra/db/pools/pools-tests.factor new file mode 100644 index 0000000000..f0534a1d34 --- /dev/null +++ b/extra/db/pools/pools-tests.factor @@ -0,0 +1,8 @@ +IN: db.pools.tests +USING: db.pools tools.test ; + +\ must-infer + +{ 2 0 } [ [ ] with-db-pool ] must-infer-as + +{ 1 0 } [ [ ] with-pooled-db ] must-infer-as diff --git a/extra/db/pools/pools.factor b/extra/db/pools/pools.factor new file mode 100644 index 0000000000..63153c451e --- /dev/null +++ b/extra/db/pools/pools.factor @@ -0,0 +1,21 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors kernel arrays namespaces sequences continuations +io.pools db ; +IN: db.pools + +TUPLE: db-pool < pool db params ; + +: ( params db -- pool ) + db-pool + swap >>db + swap >>params ; + +: with-db-pool ( db params quot -- ) + >r r> with-pool ; inline + +M: db-pool make-connection ( pool -- ) + [ params>> ] [ db>> ] bi make-db db-open ; + +: with-pooled-db ( pool quot -- ) + [ db swap with-variable ] curry with-pooled-connection ; inline diff --git a/extra/db/postgresql/ffi/ffi.factor b/extra/db/postgresql/ffi/ffi.factor index ee5ba622e5..4358d7f3de 100755 --- a/extra/db/postgresql/ffi/ffi.factor +++ b/extra/db/postgresql/ffi/ffi.factor @@ -52,7 +52,6 @@ IN: db.postgresql.ffi : InvalidOid 0 ; inline -TYPEDEF: int size_t TYPEDEF: int ConnStatusType TYPEDEF: int ExecStatusType TYPEDEF: int PostgresPollingStatusType @@ -282,7 +281,7 @@ FUNCTION: void PQclear ( PGresult* res ) ; FUNCTION: void PQfreemem ( void* ptr ) ; ! Exists for backward compatibility. -: PQfreeNotify PQfreemem ; +: PQfreeNotify ( ptr -- ) PQfreemem ; ! ! Make an empty PGresult with given status (some apps find this diff --git a/extra/db/postgresql/lib/lib.factor b/extra/db/postgresql/lib/lib.factor index 436d701803..e99bc41449 100755 --- a/extra/db/postgresql/lib/lib.factor +++ b/extra/db/postgresql/lib/lib.factor @@ -66,13 +66,11 @@ M: postgresql-result-null summary ( obj -- str ) : param-types ( statement -- seq ) in-params>> [ type>> type>oid ] map >c-uint-array ; -: malloc-byte-array/length - [ malloc-byte-array dup free-always ] [ length ] bi ; +: malloc-byte-array/length ( byte-array -- alien length ) + [ malloc-byte-array &free ] [ length ] bi ; -: default-param-value - number>string* dup [ - utf8 malloc-string dup free-always - ] when 0 ; +: default-param-value ( obj -- alien n ) + number>string* dup [ utf8 malloc-string &free ] when 0 ; : param-values ( statement -- seq seq2 ) [ bind-params>> ] [ in-params>> ] bi @@ -128,8 +126,8 @@ C: postgresql-malloc-destructor M: postgresql-malloc-destructor dispose ( obj -- ) alien>> PQfreemem ; -: postgresql-free-always ( alien -- ) - add-always-destructor ; +: &postgresql-free ( alien -- alien ) + dup &dispose drop ; inline : pq-get-blob ( handle row column -- obj/f ) [ PQgetvalue ] 3keep 3dup PQgetlength @@ -142,7 +140,7 @@ M: postgresql-malloc-destructor dispose ( obj -- ) PQunescapeBytea dup zero? [ postgresql-result-error-message throw ] [ - dup postgresql-free-always + &postgresql-free ] if ] keep *uint memory>byte-array @@ -154,7 +152,7 @@ M: postgresql-malloc-destructor dispose ( obj -- ) : postgresql-column-typed ( handle row column type -- obj ) dup array? [ first ] when { - { +native-id+ [ pq-get-number ] } + { +db-assigned-id+ [ pq-get-number ] } { +random-id+ [ pq-get-number ] } { INTEGER [ pq-get-number ] } { BIG-INTEGER [ pq-get-number ] } diff --git a/extra/db/postgresql/postgresql.factor b/extra/db/postgresql/postgresql.factor index 687146af11..f55897db88 100755 --- a/extra/db/postgresql/postgresql.factor +++ b/extra/db/postgresql/postgresql.factor @@ -5,7 +5,8 @@ kernel math math.parser namespaces prettyprint quotations sequences debugger db db.postgresql.lib db.postgresql.ffi db.tuples db.types tools.annotations math.ranges combinators sequences.lib classes locals words tools.walker -namespaces.lib accessors random db.queries ; +namespaces.lib accessors random db.queries destructors ; +USE: tools.walker IN: db.postgresql TUPLE: postgresql-db < db @@ -48,7 +49,8 @@ M: literal-bind postgresql-bind-conversion ( tuple literal-bind -- obj ) nip value>> ; M: generator-bind postgresql-bind-conversion ( tuple generate-bind -- obj ) - nip singleton>> eval-generator ; + dup generator-singleton>> eval-generator + [ swap slot-name>> rot set-slot-named ] [ ] bi ; M: postgresql-statement bind-tuple ( tuple statement -- ) tuck in-params>> @@ -158,7 +160,7 @@ M: postgresql-db bind# ( spec obj -- ) M: postgresql-db create-sql-statement ( class -- seq ) [ [ create-table-sql , ] keep - dup db-columns find-primary-key native-id? + dup db-columns find-primary-key db-assigned-id-spec? [ create-function-sql , ] [ drop ] if ] { } make ; @@ -173,17 +175,17 @@ M: postgresql-db create-sql-statement ( class -- seq ) : drop-table-sql ( table -- statement ) [ - "drop table " 0% 0% ";" 0% drop + "drop table " 0% 0% drop ] query-make ; M: postgresql-db drop-sql-statement ( class -- seq ) [ [ drop-table-sql , ] keep - dup db-columns find-primary-key native-id? + dup db-columns find-primary-key db-assigned-id-spec? [ drop-function-sql , ] [ drop ] if ] { } make ; -M: postgresql-db ( class -- statement ) +M: postgresql-db ( class -- statement ) [ "select add_" 0% 0% "(" 0% @@ -193,7 +195,7 @@ M: postgresql-db ( class -- statement ) ");" 0% ] query-make ; -M: postgresql-db ( class -- statement ) +M: postgresql-db ( class -- statement ) [ "insert into " 0% 0% "(" 0% @@ -204,8 +206,10 @@ M: postgresql-db ( class -- statement ) [ ", " 0% ] [ dup type>> +random-id+ = [ [ - drop bind-name% - f random-id-generator + bind-name% + slot-name>> + f + random-id-generator ] [ type>> ] bi 1, ] [ bind% @@ -219,8 +223,8 @@ M: postgresql-db insert-tuple* ( tuple statement -- ) M: postgresql-db persistent-table ( -- hashtable ) H{ - { +native-id+ { "integer" "serial primary key" f } } - { +assigned-id+ { f f "primary key" } } + { +db-assigned-id+ { "integer" "serial primary key" f } } + { +user-assigned-id+ { f f "primary key" } } { +random-id+ { "bigint" "bigint primary key" f } } { TEXT { "text" "text" f } } { VARCHAR { "varchar" "varchar" f } } diff --git a/extra/db/queries/queries.factor b/extra/db/queries/queries.factor index c9fd9a38a4..59ee60aa1f 100644 --- a/extra/db/queries/queries.factor +++ b/extra/db/queries/queries.factor @@ -1,17 +1,15 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: accessors kernel math namespaces sequences random -strings -math.bitfields.lib namespaces.lib db db.tuples db.types -math.intervals ; +strings math.parser math.intervals combinators +math.bitfields.lib namespaces.lib db db.tuples db.types ; IN: db.queries GENERIC: where ( specs obj -- ) : maybe-make-retryable ( statement -- statement ) - dup in-params>> [ generator-bind? ] contains? [ - make-retryable - ] when ; + dup in-params>> [ generator-bind? ] contains? + [ make-retryable ] when ; : query-make ( class quot -- ) >r sql-props r> @@ -35,14 +33,6 @@ M: db ( class -- statement ) where-primary-key% ] query-make ; -M: db ( specs table -- sql ) - [ - "delete from " 0% 0% - " where " 0% - find-primary-key - dup column-name>> 0% " = " 0% bind% - ] query-make ; - M: random-id-generator eval-generator ( singleton -- obj ) drop system-random-generator get [ @@ -52,18 +42,40 @@ M: random-id-generator eval-generator ( singleton -- obj ) : interval-comparison ( ? str -- str ) "from" = " >" " <" ? swap [ "= " append ] when ; +: fp-infinity? ( float -- ? ) + dup float? [ + double>bits -52 shift 11 2^ 1- [ bitand ] keep = + ] [ + drop f + ] if ; + +: (infinite-interval?) ( interval -- ?1 ?2 ) + [ from>> ] [ to>> ] bi + [ first fp-infinity? ] bi@ ; + +: double-infinite-interval? ( obj -- ? ) + dup interval? [ (infinite-interval?) and ] [ drop f ] if ; + +: infinite-interval? ( obj -- ? ) + dup interval? [ (infinite-interval?) or ] [ drop f ] if ; + : where-interval ( spec obj from/to -- ) - pick column-name>> 0% - >r first2 r> interval-comparison 0% - bind# ; + over first fp-infinity? [ + 3drop + ] [ + pick column-name>> 0% + >r first2 r> interval-comparison 0% + bind# + ] if ; : in-parens ( quot -- ) "(" 0% call ")" 0% ; inline M: interval where ( spec obj -- ) [ - [ from>> "from" where-interval " and " 0% ] - [ to>> "to" where-interval ] 2bi + [ from>> "from" where-interval ] [ + nip infinite-interval? [ " and " 0% ] unless + ] [ to>> "to" where-interval ] 2tri ] in-parens ; M: sequence where ( spec obj -- ) @@ -80,12 +92,29 @@ M: integer where ( spec obj -- ) object-where ; M: string where ( spec obj -- ) object-where ; +: filter-slots ( tuple specs -- specs' ) + [ + slot-name>> swap get-slot-named + dup double-infinite-interval? [ drop f ] when + ] with filter ; + : where-clause ( tuple specs -- ) - " where " 0% [ - " and " 0% + dupd filter-slots + dup empty? [ + 2drop ] [ - 2dup slot-name>> swap get-slot-named where - ] interleave drop ; + " where " 0% [ + " and " 0% + ] [ + 2dup slot-name>> swap get-slot-named where + ] interleave drop + ] if ; + +M: db ( tuple table -- sql ) + [ + "delete from " 0% 0% + where-clause + ] query-make ; M: db ( tuple class -- statement ) [ @@ -94,7 +123,38 @@ M: db ( tuple class -- statement ) [ dup column-name>> 0% 2, ] interleave " from " 0% 0% - dupd - [ slot-name>> swap get-slot-named ] with subset - dup empty? [ 2drop ] [ where-clause ] if ";" 0% + where-clause ] query-make ; + +: do-group ( tuple groups -- ) + [ + ", " join " group by " prepend append + ] curry change-sql drop ; + +: do-order ( tuple order -- ) + [ + ", " join " order by " prepend append + ] curry change-sql drop ; + +: do-offset ( tuple n -- ) + [ + number>string " offset " prepend append + ] curry change-sql drop ; + +: do-limit ( tuple n -- ) + [ + number>string " limit " prepend append + ] curry change-sql drop ; + +: make-advanced-statement ( tuple advanced -- tuple' ) + dupd + { + [ group>> [ do-group ] [ drop ] if* ] + [ order>> [ do-order ] [ drop ] if* ] + [ limit>> [ do-limit ] [ drop ] if* ] + [ offset>> [ do-offset ] [ drop ] if* ] + } 2cleave ; + +M: db ( tuple class group order limit offset -- tuple ) + advanced-statement boa + [ ] dip make-advanced-statement ; diff --git a/extra/db/sql/sql-tests.factor b/extra/db/sql/sql-tests.factor index cab7b83ced..0b57c2d8fa 100644 --- a/extra/db/sql/sql-tests.factor +++ b/extra/db/sql/sql-tests.factor @@ -4,9 +4,11 @@ IN: db.sql.tests ! TUPLE: person name age ; : insert-1 { insert - { table "person" } - { columns "name" "age" } - { values "erg" 26 } + { + { table "person" } + { columns "name" "age" } + { values "erg" 26 } + } } ; : update-1 diff --git a/extra/db/sql/sql.factor b/extra/db/sql/sql.factor index 4561424a9d..ae748731b1 100755 --- a/extra/db/sql/sql.factor +++ b/extra/db/sql/sql.factor @@ -1,17 +1,16 @@ -USING: kernel parser quotations classes.tuple words +USING: kernel parser quotations classes.tuple words math.order namespaces.lib namespaces sequences arrays combinators prettyprint strings math.parser sequences.lib math symbols ; -USE: tools.walker IN: db.sql SYMBOLS: insert update delete select distinct columns from as where group-by having order-by limit offset is-null desc all any count avg table values ; -: input-spec, 1, ; -: output-spec, 2, ; -: input, 3, ; -: output, 4, ; +: input-spec, ( obj -- ) 1, ; +: output-spec, ( obj -- ) 2, ; +: input, ( obj -- ) 3, ; +: output, ( obj -- ) 4, ; DEFER: sql% diff --git a/extra/db/sqlite/lib/lib.factor b/extra/db/sqlite/lib/lib.factor index 9f29b9e6fb..b652e8fed7 100755 --- a/extra/db/sqlite/lib/lib.factor +++ b/extra/db/sqlite/lib/lib.factor @@ -4,24 +4,25 @@ USING: alien.c-types arrays assocs kernel math math.parser namespaces sequences db.sqlite.ffi db combinators continuations db.types calendar.format serialize io.streams.byte-array byte-arrays io.encodings.binary -tools.walker io.backend ; +io.backend db.errors ; IN: db.sqlite.lib -: sqlite-error ( n -- * ) - sqlite-error-messages nth throw ; +ERROR: sqlite-error < db-error n string ; +ERROR: sqlite-sql-error < sql-error n string ; -: sqlite-statement-error-string ( -- str ) - db get db-handle sqlite3_errmsg ; +: throw-sqlite-error ( n -- * ) + dup sqlite-error-messages nth sqlite-error ; : sqlite-statement-error ( -- * ) - sqlite-statement-error-string throw ; + SQLITE_ERROR + db get db-handle sqlite3_errmsg sqlite-sql-error ; : sqlite-check-result ( n -- ) { - { [ dup SQLITE_OK = ] [ drop ] } - { [ dup SQLITE_ERROR = ] [ sqlite-statement-error ] } - [ sqlite-error ] - } cond ; + { SQLITE_OK [ ] } + { SQLITE_ERROR [ sqlite-statement-error ] } + [ throw-sqlite-error ] + } case ; : sqlite-open ( path -- db ) normalize-path @@ -106,7 +107,7 @@ IN: db.sqlite.lib object>bytes sqlite-bind-blob-by-name ] } - { +native-id+ [ sqlite-bind-int-by-name ] } + { +db-assigned-id+ [ sqlite-bind-int-by-name ] } { +random-id+ [ sqlite-bind-int64-by-name ] } { NULL [ sqlite-bind-null-by-name ] } [ no-sql-type ] @@ -132,7 +133,7 @@ IN: db.sqlite.lib : sqlite-column-typed ( handle index type -- obj ) dup array? [ first ] when { - { +native-id+ [ sqlite3_column_int64 ] } + { +db-assigned-id+ [ sqlite3_column_int64 ] } { +random-id+ [ sqlite3-column-uint64 ] } { INTEGER [ sqlite3_column_int ] } { BIG-INTEGER [ sqlite3_column_int64 ] } @@ -158,12 +159,11 @@ IN: db.sqlite.lib dup sqlite-#columns [ sqlite-column ] with map ; : sqlite-step-has-more-rows? ( prepared -- bool ) - dup SQLITE_ROW = [ - drop t - ] [ - dup SQLITE_DONE = - [ drop ] [ sqlite-check-result ] if f - ] if ; + { + { SQLITE_ROW [ t ] } + { SQLITE_DONE [ f ] } + [ sqlite-check-result f ] + } case ; : sqlite-next ( prepared -- ? ) sqlite3_step sqlite-step-has-more-rows? ; diff --git a/extra/db/sqlite/sqlite.factor b/extra/db/sqlite/sqlite.factor index 2407613eca..cc4e4d116a 100755 --- a/extra/db/sqlite/sqlite.factor +++ b/extra/db/sqlite/sqlite.factor @@ -6,7 +6,7 @@ prettyprint sequences strings classes.tuple alien.c-types continuations db.sqlite.lib db.sqlite.ffi db.tuples words combinators.lib db.types combinators math.intervals io namespaces.lib accessors vectors math.ranges random -math.bitfields.lib db.queries ; +math.bitfields.lib db.queries destructors ; USE: tools.walker IN: db.sqlite @@ -16,7 +16,7 @@ M: sqlite-db make-db* ( path db -- db ) swap >>path ; M: sqlite-db db-open ( db -- db ) - [ path>> sqlite-open ] [ swap >>handle ] bi ; + dup path>> sqlite-open >>handle ; M: sqlite-db db-close ( handle -- ) sqlite-close ; M: sqlite-db dispose ( db -- ) dispose-db ; @@ -79,8 +79,10 @@ M: literal-bind sqlite-bind-conversion ( tuple literal-bind -- array ) ; M: generator-bind sqlite-bind-conversion ( tuple generate-bind -- array ) - nip [ key>> ] [ singleton>> eval-generator ] [ type>> ] tri - ; + tuck + [ generator-singleton>> eval-generator tuck ] [ slot-name>> ] bi + rot set-slot-named + >r [ key>> ] [ type>> ] bi r> swap ; M: sqlite-statement bind-tuple ( tuple statement -- ) [ @@ -129,19 +131,20 @@ M: sqlite-db create-sql-statement ( class -- statement ) M: sqlite-db drop-sql-statement ( class -- statement ) [ "drop table " 0% 0% ";" 0% drop ] query-make ; -M: sqlite-db ( tuple -- statement ) +M: sqlite-db ( tuple -- statement ) [ "insert into " 0% 0% "(" 0% - maybe-remove-id + remove-db-assigned-id dup [ ", " 0% ] [ column-name>> 0% ] interleave ") values(" 0% [ ", " 0% ] [ dup type>> +random-id+ = [ + [ slot-name>> ] [ column-name>> ":" prepend dup 0% random-id-generator - ] [ type>> ] bi 1, + ] [ type>> ] tri 1, ] [ bind% ] if @@ -149,8 +152,8 @@ M: sqlite-db ( tuple -- statement ) ");" 0% ] query-make ; -M: sqlite-db ( tuple -- statement ) - ; +M: sqlite-db ( tuple -- statement ) + ; M: sqlite-db bind# ( spec obj -- ) >r @@ -163,8 +166,8 @@ M: sqlite-db bind% ( spec -- ) M: sqlite-db persistent-table ( -- assoc ) H{ - { +native-id+ { "integer primary key" "integer primary key" "primary key" } } - { +assigned-id+ { f f "primary key" } } + { +db-assigned-id+ { "integer primary key" "integer primary key" "primary key" } } + { +user-assigned-id+ { f f "primary key" } } { +random-id+ { "integer primary key" "integer primary key" "primary key" } } { INTEGER { "integer" "integer" "primary key" } } { BIG-INTEGER { "bigint" "bigint" } } @@ -194,4 +197,3 @@ M: sqlite-db compound ( str seq -- str' ) { "default" [ first number>string join-space ] } [ 2drop ] } case ; - diff --git a/extra/db/tuples/tuples-tests.factor b/extra/db/tuples/tuples-tests.factor index 066bf1ce96..f9a597e814 100755 --- a/extra/db/tuples/tuples-tests.factor +++ b/extra/db/tuples/tuples-tests.factor @@ -2,8 +2,9 @@ ! See http://factorcode.org/license.txt for BSD license. USING: io.files kernel tools.test db db.tuples classes db.types continuations namespaces math math.ranges -prettyprint tools.walker calendar sequences db.sqlite -math.intervals db.postgresql accessors random math.bitfields.lib ; +prettyprint calendar sequences db.sqlite math.intervals +db.postgresql accessors random math.bitfields.lib +math.ranges strings sequences.lib ; IN: db.tuples.tests TUPLE: person the-id the-name the-number the-real @@ -21,7 +22,7 @@ ts date time blob factor-blob ; set-person-factor-blob } person construct ; -: ( id name age real ts date time blob factor-blob -- person ) +: ( id name age real ts date time blob factor-blob -- person ) [ set-person-the-id ] keep ; SYMBOL: person1 @@ -30,6 +31,7 @@ SYMBOL: person3 SYMBOL: person4 : test-tuples ( -- ) + [ ] [ person recreate-table ] unit-test [ ] [ person ensure-table ] unit-test [ ] [ person drop-table ] unit-test [ ] [ person create-table ] unit-test @@ -67,7 +69,7 @@ SYMBOL: person4 ] [ T{ person f f f 10 3.14 } select-tuples ] unit-test - [ ] [ person1 get delete-tuple ] unit-test + [ ] [ person1 get delete-tuples ] unit-test [ f ] [ T{ person f 1 } select-tuple ] unit-test [ ] [ person3 get insert-tuple ] unit-test @@ -106,10 +108,10 @@ SYMBOL: person4 [ ] [ person drop-table ] unit-test ; -: native-person-schema ( -- ) +: db-assigned-person-schema ( -- ) person "PERSON" { - { "the-id" "ID" +native-id+ } + { "the-id" "ID" +db-assigned-id+ } { "the-name" "NAME" { VARCHAR 256 } +not-null+ } { "the-number" "AGE" INTEGER { +default+ 0 } } { "the-real" "REAL" DOUBLE { +default+ 0.3 } } @@ -132,10 +134,10 @@ SYMBOL: person4 T{ timestamp f f f f 12 34 56 T{ duration f 0 0 0 0 0 0 } } f H{ { 1 2 } { 3 4 } { 5 "lol" } } person4 set ; -: assigned-person-schema ( -- ) +: user-assigned-person-schema ( -- ) person "PERSON" { - { "the-id" "ID" INTEGER +assigned-id+ } + { "the-id" "ID" INTEGER +user-assigned-id+ } { "the-name" "NAME" { VARCHAR 256 } +not-null+ } { "the-number" "AGE" INTEGER { +default+ 0 } } { "the-real" "REAL" DOUBLE { +default+ 0.3 } } @@ -145,27 +147,27 @@ SYMBOL: person4 { "blob" "B" BLOB } { "factor-blob" "FB" FACTOR-BLOB } } define-persistent - 1 "billy" 10 3.14 f f f f f person1 set - 2 "johnny" 10 3.14 f f f f f person2 set + 1 "billy" 10 3.14 f f f f f person1 set + 2 "johnny" 10 3.14 f f f f f person2 set 3 "teddy" 10 3.14 T{ timestamp f 2008 3 5 16 24 11 T{ duration f 0 0 0 0 0 0 } } T{ timestamp f 2008 11 22 0 0 0 T{ duration f 0 0 0 0 0 0 } } T{ timestamp f f f f 12 34 56 T{ duration f 0 0 0 0 0 0 } } B{ 115 116 111 114 101 105 110 97 98 108 111 98 } - f person3 set + f person3 set 4 "eddie" 10 3.14 T{ timestamp f 2008 3 5 16 24 11 T{ duration f 0 0 0 0 0 0 } } T{ timestamp f 2008 11 22 0 0 0 T{ duration f 0 0 0 0 0 0 } } T{ timestamp f f f f 12 34 56 T{ duration f 0 0 0 0 0 0 } } - f H{ { 1 2 } { 3 4 } { 5 "lol" } } person4 set ; + f H{ { 1 2 } { 3 4 } { 5 "lol" } } person4 set ; TUPLE: paste n summary author channel mode contents timestamp annotations ; TUPLE: annotation n paste-id summary author mode contents ; -: native-paste-schema ( -- ) +: db-assigned-paste-schema ( -- ) paste "PASTE" { - { "n" "ID" +native-id+ } + { "n" "ID" +db-assigned-id+ } { "summary" "SUMMARY" TEXT } { "author" "AUTHOR" TEXT } { "channel" "CHANNEL" TEXT } @@ -177,7 +179,7 @@ TUPLE: annotation n paste-id summary author mode contents ; annotation "ANNOTATION" { - { "n" "ID" +native-id+ } + { "n" "ID" +db-assigned-id+ } { "paste-id" "PASTE_ID" INTEGER { +foreign-id+ paste "n" } } { "summary" "SUMMARY" TEXT } { "author" "AUTHOR" TEXT } @@ -197,8 +199,8 @@ TUPLE: annotation n paste-id summary author mode contents ; : test-sqlite ( quot -- ) >r "tuples-test.db" temp-file sqlite-db r> with-db ; -: test-postgresql ( -- ) ->r { "localhost" "postgres" "foob" "factor-test" } postgresql-db r> with-db ; +: test-postgresql ( quot -- ) + >r { "localhost" "postgres" "foob" "factor-test" } postgresql-db r> with-db ; : test-repeated-insert [ ] [ person ensure-table ] unit-test @@ -210,7 +212,7 @@ TUPLE: serialize-me id data ; : test-serialize ( -- ) serialize-me "SERIALIZED" { - { "id" "ID" +native-id+ } + { "id" "ID" +db-assigned-id+ } { "data" "DATA" FACTOR-BLOB } } define-persistent [ serialize-me drop-table ] [ drop ] recover @@ -223,10 +225,16 @@ TUPLE: serialize-me id data ; TUPLE: exam id name score ; +: random-exam ( -- exam ) + f + 6 [ CHAR: a CHAR: b [a,b] random ] replicate >string + 100 random + exam boa ; + : test-intervals ( -- ) exam "EXAM" { - { "id" "ID" +native-id+ } + { "id" "ID" +db-assigned-id+ } { "name" "NAME" TEXT } { "score" "SCORE" INTEGER } } define-persistent @@ -292,6 +300,46 @@ TUPLE: exam id name score ; } ] [ T{ exam f T{ range f 1 3 1 } } select-tuples + ] unit-test + + [ + { + T{ exam f 2 "Stan" 80 } + T{ exam f 3 "Kenny" 60 } + T{ exam f 4 "Cartman" 41 } + } + ] [ + T{ exam f T{ interval f { 2 t } { 1.0/0.0 f } } } select-tuples + ] unit-test + + [ + { + T{ exam f 1 "Kyle" 100 } + } + ] [ + T{ exam f T{ interval f { -1.0/0.0 t } { 2 f } } } select-tuples + ] unit-test + + [ + { + T{ exam f 1 "Kyle" 100 } + T{ exam f 2 "Stan" 80 } + T{ exam f 3 "Kenny" 60 } + T{ exam f 4 "Cartman" 41 } + } + ] [ + T{ exam f T{ interval f { -1.0/0.0 t } { 1/0. f } } } select-tuples + ] unit-test + + [ + { + T{ exam f 1 "Kyle" 100 } + T{ exam f 2 "Stan" 80 } + T{ exam f 3 "Kenny" 60 } + T{ exam f 4 "Cartman" 41 } + } + ] [ + T{ exam } select-tuples ] unit-test ; TUPLE: bignum-test id m n o ; @@ -304,7 +352,7 @@ TUPLE: bignum-test id m n o ; : test-bignum bignum-test "BIGNUM_TEST" { - { "id" "ID" +native-id+ } + { "id" "ID" +db-assigned-id+ } { "m" "M" BIG-INTEGER } { "n" "N" UNSIGNED-BIG-INTEGER } { "o" "O" SIGNED-BIG-INTEGER } @@ -328,9 +376,9 @@ C: secret { "message" "MESSAGE" TEXT } } define-persistent - [ ] [ secret ensure-table ] unit-test + [ ] [ secret recreate-table ] unit-test - [ ] [ f "kilroy was here" insert-tuple ] unit-test + [ t ] [ f "kilroy was here" [ insert-tuple ] keep n>> integer? ] unit-test [ ] [ f "kilroy was here2" insert-tuple ] unit-test @@ -345,17 +393,17 @@ C: secret T{ secret } select-tuples length 3 = ] unit-test ; -[ native-person-schema test-tuples ] test-sqlite -[ assigned-person-schema test-tuples ] test-sqlite -[ assigned-person-schema test-repeated-insert ] test-sqlite +[ db-assigned-person-schema test-tuples ] test-sqlite +[ user-assigned-person-schema test-tuples ] test-sqlite +[ user-assigned-person-schema test-repeated-insert ] test-sqlite [ test-bignum ] test-sqlite [ test-serialize ] test-sqlite [ test-intervals ] test-sqlite [ test-random-id ] test-sqlite -[ native-person-schema test-tuples ] test-postgresql -[ assigned-person-schema test-tuples ] test-postgresql -[ assigned-person-schema test-repeated-insert ] test-postgresql +[ db-assigned-person-schema test-tuples ] test-postgresql +[ user-assigned-person-schema test-tuples ] test-postgresql +[ user-assigned-person-schema test-repeated-insert ] test-postgresql [ test-bignum ] test-postgresql [ test-serialize ] test-postgresql [ test-intervals ] test-postgresql @@ -373,11 +421,48 @@ TUPLE: does-not-persist ; [ class \ not-persistent = ] must-fail-with ] test-postgresql + +TUPLE: suparclass id a ; + +suparclass f { + { "id" "ID" +db-assigned-id+ } + { "a" "A" INTEGER } +} define-persistent + +TUPLE: subbclass < suparclass b ; + +subbclass "SUBCLASS" { + { "b" "B" TEXT } +} define-persistent + +TUPLE: fubbclass < subbclass ; + +fubbclass "FUBCLASS" { } define-persistent + +: test-db-inheritance ( -- ) + [ ] [ subbclass ensure-table ] unit-test + [ ] [ fubbclass ensure-table ] unit-test + + [ ] [ + subbclass new 5 >>a "hi" >>b dup insert-tuple id>> "id" set + ] unit-test + + [ t "hi" 5 ] [ + subbclass new "id" get >>id select-tuple + [ subbclass? ] [ b>> ] [ a>> ] tri + ] unit-test + + [ ] [ fubbclass new 0 >>a "hi" >>b insert-tuple ] unit-test + + [ t ] [ fubbclass new select-tuples [ fubbclass? ] all? ] unit-test ; + +[ test-db-inheritance ] test-sqlite + ! Don't comment these out. These words must infer \ bind-tuple must-infer \ insert-tuple must-infer \ update-tuple must-infer -\ delete-tuple must-infer +\ delete-tuples must-infer \ select-tuple must-infer \ define-persistent must-infer \ ensure-table must-infer diff --git a/extra/db/tuples/tuples.factor b/extra/db/tuples/tuples.factor index ce2236d23b..0fe2f3577e 100755 --- a/extra/db/tuples/tuples.factor +++ b/extra/db/tuples/tuples.factor @@ -3,7 +3,7 @@ USING: arrays assocs classes db kernel namespaces classes.tuple words sequences slots math accessors math.parser io prettyprint db.types continuations -mirrors sequences.lib tools.walker combinators.lib ; +destructors mirrors sequences.lib combinators.lib ; IN: db.tuples : define-persistent ( class table columns -- ) @@ -13,13 +13,13 @@ IN: db.tuples "db-columns" set-word-prop "db-relations" set-word-prop ; -ERROR: not-persistent ; +ERROR: not-persistent class ; : db-table ( class -- obj ) - "db-table" word-prop [ not-persistent ] unless* ; + dup "db-table" word-prop [ ] [ not-persistent ] ?if ; : db-columns ( class -- obj ) - "db-columns" word-prop ; + superclasses [ "db-columns" word-prop ] map concat ; : db-relations ( class -- obj ) "db-relations" word-prop ; @@ -37,16 +37,13 @@ SYMBOL: sql-counter HOOK: create-sql-statement db ( class -- obj ) HOOK: drop-sql-statement db ( class -- obj ) -HOOK: db ( class -- obj ) -HOOK: db ( class -- obj ) - +HOOK: db ( class -- obj ) +HOOK: db ( class -- obj ) HOOK: db ( class -- obj ) -HOOK: db ( class -- obj ) - -HOOK: db ( class -- obj ) -HOOK: db ( class -- obj ) - +HOOK: db ( tuple class -- obj ) HOOK: db ( tuple class -- tuple ) +TUPLE: advanced-statement group order offset limit ; +HOOK: db ( tuple class group order offset limit -- tuple ) HOOK: insert-tuple* db ( tuple statement -- ) @@ -65,7 +62,7 @@ SINGLETON: retryable [ bind-params>> ] [ in-params>> ] bi [ dup generator-bind? [ - singleton>> eval-generator >>value + generator-singleton>> eval-generator >>value ] [ drop ] if @@ -79,16 +76,16 @@ M: retryable execute-statement* ( statement type -- ) [ regenerate-params bind-statement* f ] cleanup ] curry 10 retry drop ; -: resulting-tuple ( row out-params -- tuple ) - dup first class>> new [ +: resulting-tuple ( class row out-params -- tuple ) + rot class new [ [ >r slot-name>> r> set-slot-named ] curry 2each ] keep ; -: query-tuples ( statement -- seq ) +: query-tuples ( exemplar-tuple statement -- seq ) [ out-params>> ] keep query-results [ - [ sql-row-typed swap resulting-tuple ] with query-map + [ sql-row-typed swap resulting-tuple ] with with query-map ] with-disposal ; : query-modify-tuple ( tuple statement -- ) @@ -113,39 +110,48 @@ M: retryable execute-statement* ( statement type -- ) : drop-table ( class -- ) drop-sql-statement [ execute-statement ] with-disposals ; -: ensure-table ( class -- ) +: recreate-table ( class -- ) [ - drop-sql-statement make-nonthrowable - [ execute-statement ] with-disposals + [ drop-sql-statement [ execute-statement ] with-disposals + ] curry ignore-errors ] [ create-table ] bi ; -: insert-native ( tuple -- ) +: ensure-table ( class -- ) + [ create-table ] curry ignore-errors ; + +: insert-db-assigned-statement ( tuple -- ) dup class - db get db-insert-statements [ ] cache + db get db-insert-statements [ ] cache [ bind-tuple ] 2keep insert-tuple* ; -: insert-nonnative ( tuple -- ) +: insert-user-assigned-statement ( tuple -- ) dup class - db get db-insert-statements [ ] cache + db get db-insert-statements [ ] cache [ bind-tuple ] keep execute-statement ; : insert-tuple ( tuple -- ) - dup class db-columns find-primary-key nonnative-id? - [ insert-nonnative ] [ insert-native ] if ; + dup class db-columns find-primary-key db-assigned-id-spec? + [ insert-db-assigned-statement ] [ insert-user-assigned-statement ] if ; : update-tuple ( tuple -- ) dup class db get db-update-statements [ ] cache [ bind-tuple ] keep execute-statement ; -: delete-tuple ( tuple -- ) - dup class - db get db-delete-statements [ ] cache - [ bind-tuple ] keep execute-statement ; - -: select-tuples ( tuple -- tuples ) - dup dup class [ - [ bind-tuple ] keep query-tuples +: delete-tuples ( tuple -- ) + dup dup class [ + [ bind-tuple ] keep execute-statement ] with-disposal ; -: select-tuple ( tuple -- tuple/f ) select-tuples ?first ; +: do-select ( exemplar-tuple statement -- tuples ) + [ [ bind-tuple ] [ query-tuples ] 2bi ] with-disposal ; + +: select-tuples ( tuple -- tuples ) + dup dup class do-select ; + +: count-tuples ( tuple -- n ) + select-tuples length ; + +: select-tuple ( tuple -- tuple/f ) + dup dup class f f f 1 + do-select ?first ; diff --git a/extra/db/types/types.factor b/extra/db/types/types.factor index 110a8a388a..03e6b15bdb 100755 --- a/extra/db/types/types.factor +++ b/extra/db/types/types.factor @@ -2,8 +2,8 @@ ! See http://factorcode.org/license.txt for BSD license. USING: arrays assocs db kernel math math.parser sequences continuations sequences.deep sequences.lib -words namespaces tools.walker slots slots.private classes -mirrors classes.tuple combinators calendar.format symbols +words namespaces slots slots.private classes mirrors +classes.tuple combinators calendar.format symbols classes.singleton accessors quotations random ; IN: db.types @@ -15,18 +15,17 @@ TUPLE: sql-spec class slot-name column-name type primary-key modifiers ; TUPLE: literal-bind key type value ; C: literal-bind -TUPLE: generator-bind key singleton type ; +TUPLE: generator-bind slot-name key generator-singleton type ; C: generator-bind SINGLETON: random-id-generator TUPLE: low-level-binding value ; C: low-level-binding -SINGLETON: +native-id+ -SINGLETON: +assigned-id+ +SINGLETON: +db-assigned-id+ +SINGLETON: +user-assigned-id+ SINGLETON: +random-id+ -UNION: +primary-key+ +native-id+ +assigned-id+ +random-id+ ; -UNION: +nonnative-id+ +random-id+ +assigned-id+ ; +UNION: +primary-key+ +db-assigned-id+ +user-assigned-id+ +random-id+ ; SYMBOLS: +autoincrement+ +serial+ +unique+ +default+ +null+ +not-null+ +foreign-id+ +has-many+ ; @@ -43,11 +42,11 @@ SYMBOLS: +autoincrement+ +serial+ +unique+ +default+ +null+ +not-null+ : primary-key? ( spec -- ? ) primary-key>> +primary-key+? ; -: native-id? ( spec -- ? ) - primary-key>> +native-id+? ; +: db-assigned-id-spec? ( spec -- ? ) + primary-key>> +db-assigned-id+? ; -: nonnative-id? ( spec -- ? ) - primary-key>> +nonnative-id+? ; +: assigned-id-spec? ( spec -- ? ) + primary-key>> +user-assigned-id+? ; : normalize-spec ( spec -- ) dup type>> dup +primary-key+? [ @@ -82,14 +81,14 @@ FACTOR-BLOB NULL ; : number>string* ( n/str -- str ) dup number? [ number>string ] when ; -: maybe-remove-id ( specs -- obj ) - [ +native-id+? not ] subset ; +: remove-db-assigned-id ( specs -- obj ) + [ +db-assigned-id+? not ] filter ; : remove-relations ( specs -- newcolumns ) - [ relation? not ] subset ; + [ relation? not ] filter ; : remove-id ( specs -- obj ) - [ primary-key>> not ] subset ; + [ primary-key>> not ] filter ; ! SQLite Types: http://www.sqlite.org/datatype3.html ! NULL INTEGER REAL TEXT BLOB @@ -143,7 +142,8 @@ HOOK: bind% db ( spec -- ) HOOK: bind# db ( spec obj -- ) : offset-of-slot ( str obj -- n ) - class "slots" word-prop slot-named slot-spec-offset ; + class superclasses [ "slots" word-prop ] map concat + slot-named slot-spec-offset ; : get-slot-named ( name obj -- value ) tuck offset-of-slot slot ; @@ -152,7 +152,7 @@ HOOK: bind# db ( spec obj -- ) tuck offset-of-slot set-slot ; : tuple>filled-slots ( tuple -- alist ) - [ nip ] assoc-subset ; + [ nip ] assoc-filter ; : tuple>params ( specs tuple -- obj ) [ diff --git a/extra/delegate/delegate-docs.factor b/extra/delegate/delegate-docs.factor index f123c3a802..e6a2ad7bf4 100644 --- a/extra/delegate/delegate-docs.factor +++ b/extra/delegate/delegate-docs.factor @@ -24,30 +24,17 @@ HELP: CONSULT: { define-consult POSTPONE: CONSULT: } related-words -HELP: define-mimic -{ $values { "group" "a protocol, generic word or tuple class" } { "mimicker" "a class" } { "mimicked" "a class" } } -{ $description "For the generic words in the group, the given mimicker copies the methods of the mimicked. This only works for the methods that have already been defined when the word is called." } -{ $notes "Usually, " { $link POSTPONE: MIMIC: } " should be used instead. This is only for runtime use." } ; - -HELP: MIMIC: -{ $syntax "MIMIC: group mimicker mimicked" } -{ $values { "group" "a protocol, generic word or tuple class" } { "mimicker" "a class" } { "mimicked" "a class" } } -{ $description "For the generic words in the group, the given mimicker copies the methods of the mimicked. This only works for the methods that have already been defined when the syntax is used. Mimicking overwrites existing methods." } ; - HELP: group-words { $values { "group" "a group" } { "words" "an array of words" } } -{ $description "Given a protocol, generic word or tuple class, this returns the corresponding generic words that this group contains." } ; +{ $description "Given a protocol or tuple class, this returns the corresponding generic words that this group contains." } ; ARTICLE: { "delegate" "intro" } "Delegation module" -"This vocabulary defines methods for consultation and mimicry, independent of the current Factor object system; it is a replacement for Factor's builtin delegation system. Fundamental to the concept of generic word groups, which can be specific protocols, generic words or tuple slot accessors. Fundamentally, a group is a word which has a method for " { $link group-words } ". To define a group as a set of words, use" +"This vocabulary defines methods for consultation and mimicry, independent of the current Factor object system; it is a replacement for Factor's builtin delegation system. Fundamental to the concept of generic word groups, which can be specific protocols, generic words or tuple slot accessors. Fundamentally, a group is a word which has a method for " { $link group-words } ". One type of group is a tuple, which consists of the slot words. To define a group as a set of words, use" { $subsection POSTPONE: PROTOCOL: } { $subsection define-protocol } "One method of object extension which this vocabulary defines is consultation. This is slightly different from the current Factor concept of delegation, in that instead of delegating for all generic words not implemented, only generic words included in a specific group are consulted. Additionally, instead of using a single hard-coded delegate slot, you can specify any quotation to execute in order to retrieve who to consult. The literal syntax and defining word are" { $subsection POSTPONE: CONSULT: } -{ $subsection define-consult } -"Another object extension mechanism is mimicry. This is the copying of methods in a group from one class to another. For certain applications, this is more appropriate than delegation, as it avoids the slicing problem. It is inappropriate for tuple slots, however. The literal syntax and defining word are" -{ $subsection POSTPONE: MIMIC: } -{ $subsection define-mimic } ; +{ $subsection define-consult } ; IN: delegate ABOUT: { "delegate" "intro" } diff --git a/extra/delegate/delegate-tests.factor b/extra/delegate/delegate-tests.factor old mode 100644 new mode 100755 index 5e0abcd5ba..ab0ea988ea --- a/extra/delegate/delegate-tests.factor +++ b/extra/delegate/delegate-tests.factor @@ -1,12 +1,8 @@ USING: delegate kernel arrays tools.test words math definitions -compiler.units parser generic prettyprint io.streams.string ; +compiler.units parser generic prettyprint io.streams.string +accessors ; IN: delegate.tests -DEFER: example -[ 1 ] [ \ example 1 "prop" set-word-prop \ example "prop" word-prop ] unit-test -[ ] [ \ example "prop" [ 1+ ] change-word-prop ] unit-test -[ 2 ] [ \ example "prop" word-prop ] unit-test - TUPLE: hello this that ; C: hello @@ -21,30 +17,65 @@ PROTOCOL: baz foo { bar 0 } { whoa 1 } ; : hello-test ( hello/goodbye -- array ) [ hello? ] [ hello-this ] [ hello-that ] tri 3array ; -CONSULT: baz goodbye goodbye-these ; -M: hello foo hello-this ; +CONSULT: baz goodbye these>> ; +M: hello foo this>> ; M: hello bar hello-test ; -M: hello whoa >r hello-this r> + ; +M: hello whoa >r this>> r> + ; GENERIC: bing ( c -- d ) PROTOCOL: bee bing ; -CONSULT: hello goodbye goodbye-those ; +CONSULT: hello goodbye those>> ; M: hello bing hello-test ; -MIMIC: bee goodbye hello [ 1 { t 1 0 } ] [ 1 0 [ foo ] [ bar ] bi ] unit-test [ { t 1 0 } ] [ 1 0 bing ] unit-test [ 1 ] [ 1 0 f foo ] unit-test [ { t 1 0 } ] [ 1 0 f bar ] unit-test -! [ { f 1 0 } ] [ f 1 0 bing ] unit-test [ 3 ] [ 1 0 2 whoa ] unit-test [ 3 ] [ 1 0 f 2 whoa ] unit-test -[ ] [ 10 [ "USE: delegate IN: delegate.tests CONSULT: baz goodbye goodbye-these ;" eval ] times ] unit-test -[ V{ goodbye } ] [ baz protocol-users ] unit-test +[ ] [ 3 [ "USE: delegate IN: delegate.tests CONSULT: baz goodbye goodbye-these ;" eval ] times ] unit-test +[ H{ { goodbye [ goodbye-these ] } } ] [ baz protocol-consult ] unit-test +[ H{ } ] [ bee protocol-consult ] unit-test -! [ "USING: delegate ;\nIN: delegate.tests\nPROTOCOL: baz foo bar { whoa 1 } ;\n" ] -! [ [ baz see ] with-string-writer ] unit-test +[ "USING: delegate ;\nIN: delegate.tests\nPROTOCOL: baz foo bar { whoa 1 } ;\n" ] [ [ baz see ] with-string-writer ] unit-test -! [ ] [ [ baz forget ] with-compilation-unit ] unit-test -! [ f ] [ goodbye baz method ] unit-test +GENERIC: one +M: integer one ; +GENERIC: two +M: integer two ; +GENERIC: three +M: integer three ; +GENERIC: four +M: integer four ; + +PROTOCOL: alpha one two ; +PROTOCOL: beta three ; + +TUPLE: hey value ; +C: hey +CONSULT: alpha hey value>> 1+ ; +CONSULT: beta hey value>> 1- ; + +[ 2 ] [ 1 one ] unit-test +[ 2 ] [ 1 two ] unit-test +[ 0 ] [ 1 three ] unit-test +[ { hey } ] [ alpha protocol-users ] unit-test +[ { hey } ] [ beta protocol-users ] unit-test +[ ] [ "USE: delegate IN: delegate.tests PROTOCOL: alpha one ;" eval ] unit-test +[ f ] [ hey \ two method ] unit-test +[ f ] [ hey \ four method ] unit-test +[ ] [ "USE: delegate IN: delegate.tests PROTOCOL: beta two three four ;" eval ] unit-test +[ { hey } ] [ alpha protocol-users ] unit-test +[ { hey } ] [ beta protocol-users ] unit-test +[ 2 ] [ 1 one ] unit-test +[ 0 ] [ 1 two ] unit-test +[ 0 ] [ 1 three ] unit-test +[ 0 ] [ 1 four ] unit-test +[ ] [ "USING: math accessors delegate ; IN: delegate.tests CONSULT: beta hey value>> 2 - ;" eval ] unit-test +[ 2 ] [ 1 one ] unit-test +[ -1 ] [ 1 two ] unit-test +[ -1 ] [ 1 three ] unit-test +[ -1 ] [ 1 four ] unit-test +[ ] [ "IN: delegate.tests FORGET: alpha" eval ] unit-test +[ f ] [ hey \ one method ] unit-test diff --git a/extra/delegate/delegate.factor b/extra/delegate/delegate.factor index 506d7175b6..c375dcf874 100755 --- a/extra/delegate/delegate.factor +++ b/extra/delegate/delegate.factor @@ -1,47 +1,95 @@ ! Copyright (C) 2007 Daniel Ehrenberg ! See http://factorcode.org/license.txt for BSD license. -USING: parser generic kernel classes words slots assocs sequences arrays -vectors definitions prettyprint combinators.lib math sets ; +USING: parser generic kernel classes words slots assocs +sequences arrays vectors definitions prettyprint combinators.lib +math hashtables sets ; IN: delegate +: protocol-words ( protocol -- words ) + \ protocol-words word-prop ; + +: protocol-consult ( protocol -- consulters ) + \ protocol-consult word-prop ; + +GENERIC: group-words ( group -- words ) + +M: tuple-class group-words + "slot-names" word-prop [ + [ reader-word ] [ writer-word ] bi + 2array [ 0 2array ] map + ] map concat ; + +! Consultation + +: consult-method ( word class quot -- ) + [ drop swap first create-method ] + [ nip swap first2 swapd [ ndip ] 2curry swap suffix ] 3bi + define ; + +: change-word-prop ( word prop quot -- ) + rot word-props swap change-at ; inline + +: register-protocol ( group class quot -- ) + rot \ protocol-consult [ swapd ?set-at ] change-word-prop ; + +: define-consult ( group class quot -- ) + [ register-protocol ] + [ rot group-words -rot [ consult-method ] 2curry each ] + 3bi ; + +: CONSULT: + scan-word scan-word parse-definition define-consult ; parsing + ! Protocols : cross-2each ( seq1 seq2 quot -- ) [ with each ] 2curry each ; inline : forget-all-methods ( classes words -- ) - [ 2array forget ] cross-2each ; - -: protocol-words ( protocol -- words ) - "protocol-words" word-prop ; + [ first method forget ] cross-2each ; : protocol-users ( protocol -- users ) - "protocol-users" word-prop ; + protocol-consult keys ; -: users-and-words ( protocol -- users words ) - [ protocol-users ] [ protocol-words ] bi ; +: lost-words ( protocol wordlist -- lost-words ) + >r protocol-words r> diff ; : forget-old-definitions ( protocol new-wordlist -- ) - >r users-and-words r> - diff forget-all-methods ; + [ drop protocol-users ] [ lost-words ] 2bi + forget-all-methods ; -: define-protocol ( protocol wordlist -- ) - ! 2dup forget-old-definitions - { } like "protocol-words" set-word-prop ; +: added-words ( protocol wordlist -- added-words ) + swap protocol-words diff ; + +: add-new-definitions ( protocol wordlist -- ) + [ drop protocol-consult >alist ] [ added-words ] 2bi + [ swap first2 consult-method ] cross-2each ; + +: initialize-protocol-props ( protocol wordlist -- ) + [ + drop \ protocol-consult + [ H{ } assoc-like ] change-word-prop + ] [ { } like \ protocol-words set-word-prop ] 2bi ; : fill-in-depth ( wordlist -- wordlist' ) [ dup word? [ 0 2array ] when ] map ; +: define-protocol ( protocol wordlist -- ) + fill-in-depth + [ forget-old-definitions ] + [ add-new-definitions ] + [ initialize-protocol-props ] 2tri ; + : PROTOCOL: CREATE-WORD - dup define-symbol - dup f "inline" set-word-prop - parse-definition fill-in-depth define-protocol ; parsing + [ define-symbol ] + [ f "inline" set-word-prop ] + [ parse-definition define-protocol ] tri ; parsing PREDICATE: protocol < word protocol-words ; ! Subclass of symbol? M: protocol forget* - [ users-and-words forget-all-methods ] [ call-next-method ] bi ; + [ f forget-old-definitions ] [ call-next-method ] bi ; : show-words ( wordlist' -- wordlist ) [ dup second zero? [ first ] when ] map ; @@ -52,51 +100,4 @@ M: protocol definer drop \ PROTOCOL: \ ; ; M: protocol synopsis* word-synopsis ; ! Necessary? -GENERIC: group-words ( group -- words ) - -M: protocol group-words - "protocol-words" word-prop ; - -M: tuple-class group-words - "slot-names" word-prop [ - [ reader-word ] [ writer-word ] bi - 2array [ 0 2array ] map - ] map concat ; - -! Consultation - -: define-consult-method ( word class quot -- ) - [ drop swap first create-method ] - [ nip swap first2 swapd [ ndip ] 2curry swap suffix ] 3bi define ; - -: change-word-prop ( word prop quot -- ) - >r swap word-props r> change-at ; inline - -: add ( item vector/f -- vector ) - 2dup member? [ nip ] [ ?push ] if ; - -: use-protocol ( class group -- ) - "protocol-users" [ add ] change-word-prop ; - -: define-consult ( group class quot -- ) - swapd >r 2dup use-protocol group-words swap r> - [ define-consult-method ] 2curry each ; - -: CONSULT: - scan-word scan-word parse-definition define-consult ; parsing - -! Mimic still needs to be updated - -: mimic-method ( mimicker mimicked generic -- ) - tuck method - [ [ create-method-in ] [ word-def ] bi* define ] - [ 2drop ] if* ; - -: define-mimic ( group mimicker mimicked -- ) - [ drop swap use-protocol ] [ - rot group-words -rot - [ rot first mimic-method ] 2curry each - ] 3bi ; - -: MIMIC: - scan-word scan-word scan-word define-mimic ; parsing +M: protocol group-words protocol-words ; diff --git a/extra/delegate/protocols/protocols.factor b/extra/delegate/protocols/protocols.factor index f1ad068fe2..81310c16c0 100755 --- a/extra/delegate/protocols/protocols.factor +++ b/extra/delegate/protocols/protocols.factor @@ -1,21 +1,26 @@ ! Copyright (C) 2007 Daniel Ehrenberg ! See http://factorcode.org/license.txt for BSD license. -USING: delegate sequences.private sequences assocs prettyprint.sections -io definitions kernel continuations ; +USING: delegate sequences.private sequences assocs +prettyprint.sections io definitions kernel continuations +listener ; IN: delegate.protocols PROTOCOL: sequence-protocol - clone clone-like like new-sequence new-resizable nth nth-unsafe - set-nth set-nth-unsafe length set-length lengthen ; + clone clone-like like new-sequence new-resizable nth + nth-unsafe set-nth set-nth-unsafe length set-length + lengthen ; PROTOCOL: assoc-protocol - at* assoc-size >alist set-at assoc-clone-like { assoc-find 1 } + at* assoc-size >alist set-at assoc-clone-like delete-at clear-assoc new-assoc assoc-like ; -PROTOCOL: stream-protocol - stream-read1 stream-read stream-read-until dispose +PROTOCOL: input-stream-protocol + stream-read1 stream-read stream-read-partial stream-readln + stream-read-until stream-read-quot ; + +PROTOCOL: output-stream-protocol stream-flush stream-write1 stream-write stream-format - stream-nl make-span-stream make-block-stream stream-readln + stream-nl make-span-stream make-block-stream make-cell-stream stream-write-table ; PROTOCOL: definition-protocol diff --git a/extra/descriptive/authors.txt b/extra/descriptive/authors.txt new file mode 100755 index 0000000000..504363d316 --- /dev/null +++ b/extra/descriptive/authors.txt @@ -0,0 +1 @@ +Daniel Ehrenberg diff --git a/extra/descriptive/descriptive-docs.factor b/extra/descriptive/descriptive-docs.factor new file mode 100755 index 0000000000..dc02f8bd9d --- /dev/null +++ b/extra/descriptive/descriptive-docs.factor @@ -0,0 +1,22 @@ +USING: help.syntax help.markup ; +IN: descriptive + +HELP: DESCRIPTIVE: +{ $syntax "DESCRIPTIVE: word ( inputs -- outputs ) definition ;" } +{ $description "Defines a word such that, if an error is thrown from within it, that error is wrapped in a descriptive tag including the arguments to that word." } ; + +HELP: DESCRIPTIVE:: +{ $syntax "DESCRIPTIVE:: word ( inputs -- outputs ) definition ;" } +{ $description "Defines a word which uses locals such that, if an error is thrown from within it, that error is wrapped in a descriptive tag including the arguments to that word." } ; + +HELP: descriptive +{ $class-description "The class of errors wrapping another error (in the underlying slot) which were thrown in a word (in the word slot) with a given set of arguments (in the args slot)." } ; + +ARTICLE: "descriptive" "Descriptive errors" +"This vocabulary defines automatic descriptive errors. Using it, you can define a word which acts as normal, except when it throws an error, the error is wrapped in a special descriptor declaring that an error was thrown from inside that word, and including the arguments given to that word. The error is of the following class:" +{ $subsection descriptive } +"To define words which throw descriptive errors, use the following words:" +{ $subsection POSTPONE: DESCRIPTIVE: } +{ $subsection POSTPONE: DESCRIPTIVE:: } ; + +ABOUT: "descriptive" diff --git a/extra/descriptive/descriptive-tests.factor b/extra/descriptive/descriptive-tests.factor new file mode 100755 index 0000000000..1582ca895d --- /dev/null +++ b/extra/descriptive/descriptive-tests.factor @@ -0,0 +1,16 @@ +USING: descriptive kernel math tools.test continuations prettyprint io.streams.string ; +IN: descriptive.tests + +DESCRIPTIVE: divide ( num denom -- fraction ) / ; + +[ 3 ] [ 9 3 divide ] unit-test +[ T{ descriptive-error f { { "num" 3 } { "denom" 0 } } "Division by zero" divide } ] [ [ 3 0 divide ] [ ] recover ] unit-test + +[ "USING: descriptive math ;\nIN: descriptive.tests\nDESCRIPTIVE: divide ( num denom -- fraction ) / ;\n" ] [ \ divide [ see ] with-string-writer ] unit-test + +DESCRIPTIVE:: divide* ( num denom -- fraction ) num denom / ; + +[ 3 ] [ 9 3 divide* ] unit-test +[ T{ descriptive-error f { { "num" 3 } { "denom" 0 } } "Division by zero" divide* } ] [ [ 3 0 divide* ] [ ] recover ] unit-test + +[ "USING: descriptive math ;\nIN: descriptive.tests\nDESCRIPTIVE:: divide* ( num denom -- fraction ) num denom / ;\n" ] [ \ divide* [ see ] with-string-writer ] unit-test diff --git a/extra/descriptive/descriptive.factor b/extra/descriptive/descriptive.factor new file mode 100755 index 0000000000..56d62d8634 --- /dev/null +++ b/extra/descriptive/descriptive.factor @@ -0,0 +1,45 @@ +USING: words kernel sequences combinators.lib locals +locals.private accessors parser namespaces continuations +inspector definitions arrays.lib arrays ; +IN: descriptive + +ERROR: descriptive-error args underlying word ; + +M: descriptive-error summary + word>> "The " swap word-name " word encountered an error." + 3append ; + +r narray r> swap 2array flip ] 2curry + [ 2 ndip descriptive-error ] 2curry ; + +: [descriptive] ( word def -- newdef ) + swap dup "declared-effect" word-prop in>> rethrower + [ recover ] 2curry ; +PRIVATE> + +: define-descriptive ( word def -- ) + [ "descriptive-definition" set-word-prop ] + [ dupd [descriptive] define ] 2bi ; + +: DESCRIPTIVE: + (:) define-descriptive ; parsing + +PREDICATE: descriptive < word + "descriptive-definition" word-prop ; + +M: descriptive definer drop \ DESCRIPTIVE: \ ; ; + +M: descriptive definition + "descriptive-definition" word-prop ; + +: DESCRIPTIVE:: + (::) define-descriptive ; parsing + +INTERSECTION: descriptive-lambda descriptive lambda-word ; + +M: descriptive-lambda definer drop \ DESCRIPTIVE:: \ ; ; + +M: descriptive-lambda definition + "lambda" word-prop body>> ; diff --git a/extra/descriptive/summary.txt b/extra/descriptive/summary.txt new file mode 100755 index 0000000000..635b448772 --- /dev/null +++ b/extra/descriptive/summary.txt @@ -0,0 +1 @@ +Descriptive errors generated automatically for specially defined words diff --git a/extra/destructors/destructors-docs.factor b/extra/destructors/destructors-docs.factor deleted file mode 100755 index f96931c412..0000000000 --- a/extra/destructors/destructors-docs.factor +++ /dev/null @@ -1,30 +0,0 @@ -USING: help.markup help.syntax libc kernel continuations ; -IN: destructors - -HELP: free-always -{ $values { "alien" "alien returned by malloc" } } -{ $description "Adds a destructor that will " { $link free } " the alien. The free will happen whenever the quotation passed to " { $link with-destructors } " ends." } -{ $see-also free-later } ; - -HELP: free-later -{ $values { "alien" "alien returned by malloc" } } -{ $description "Adds a destructor that will " { $link free } " the alien. The free will happen whenever the quotation passed to " { $link with-destructors } " errors or else the object will persist and manual cleanup is required later." } -{ $see-also free-always } ; - -HELP: close-always -{ $values { "handle" "an OS-dependent handle" } } -{ $description "Adds a destructor that will close the system resource upon reaching the end of the quotation passed to " { $link with-destructors } "." } -{ $see-also close-later } ; - -HELP: close-later -{ $values { "handle" "an OS-dependent handle" } } -{ $description "Adds a destructor that will close the system resource if an error occurs in the quotation passed to " { $link with-destructors } ". Otherwise, manual cleanup of the resource is required later." } -{ $see-also close-always } ; - -HELP: with-destructors -{ $values { "quot" "a quotation" } } -{ $description "Calls a quotation within a new dynamic scope. This quotation may register destructors, on any object, by wrapping the object in a destructor and implementing " { $link dispose } " on that object type. After the quotation finishes, if an error was thrown, all destructors are called and the error is then rethrown. However, if the quotation was successful, only those destructors created with an 'always cleanup' flag will be destroyed." } -{ $notes "Destructors are not allowed to throw exceptions. No exceptions." } -{ $examples - { $code "[ 10 malloc free-always ] with-destructors" } -} ; diff --git a/extra/destructors/destructors.factor b/extra/destructors/destructors.factor deleted file mode 100755 index 87b5740786..0000000000 --- a/extra/destructors/destructors.factor +++ /dev/null @@ -1,90 +0,0 @@ -! Copyright (C) 2007 Doug Coleman. -! See http://factorcode.org/license.txt for BSD license. -USING: continuations io.backend libc kernel namespaces -sequences system vectors ; -IN: destructors - -SYMBOL: error-destructors -SYMBOL: always-destructors - -TUPLE: destructor object destroyed? ; - -M: destructor dispose - dup destructor-destroyed? [ - drop - ] [ - dup destructor-object dispose - t swap set-destructor-destroyed? - ] if ; - -: ( obj -- newobj ) - f destructor boa ; - -: add-error-destructor ( obj -- ) - error-destructors get push ; - -: add-always-destructor ( obj -- ) - always-destructors get push ; - -: dispose-each ( seq -- ) - [ dispose ] each ; - -: do-always-destructors ( -- ) - always-destructors get dispose-each ; - -: do-error-destructors ( -- ) - error-destructors get dispose-each ; - -: with-destructors ( quot -- ) - [ - V{ } clone always-destructors set - V{ } clone error-destructors set - [ do-always-destructors ] - [ do-error-destructors ] cleanup - ] with-scope ; inline - -! Memory allocations -TUPLE: memory-destructor alien ; - -C: memory-destructor - -M: memory-destructor dispose ( obj -- ) - memory-destructor-alien free ; - -: free-always ( alien -- ) - add-always-destructor ; - -: free-later ( alien -- ) - add-error-destructor ; - -! Handles -TUPLE: handle-destructor alien ; - -C: handle-destructor - -HOOK: destruct-handle io-backend ( obj -- ) - -M: handle-destructor dispose ( obj -- ) - handle-destructor-alien destruct-handle ; - -: close-always ( handle -- ) - add-always-destructor ; - -: close-later ( handle -- ) - add-error-destructor ; - -! Sockets -TUPLE: socket-destructor alien ; - -C: socket-destructor - -HOOK: destruct-socket io-backend ( obj -- ) - -M: socket-destructor dispose ( obj -- ) - socket-destructor-alien destruct-socket ; - -: close-socket-always ( handle -- ) - add-always-destructor ; - -: close-socket-later ( handle -- ) - add-error-destructor ; diff --git a/extra/dns/cache/cache.factor b/extra/dns/cache/cache.factor new file mode 100644 index 0000000000..5c4539b913 --- /dev/null +++ b/extra/dns/cache/cache.factor @@ -0,0 +1,145 @@ + +USING: kernel system + combinators + vectors sequences assocs + math math.functions + prettyprint unicode.case + accessors + combinators.cleave + newfx + dns ; + +IN: dns.cache + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: cache ( -- table ) H{ } ; + +! key: 'name type class' (as string) +! val: entry + +TUPLE: entry time data ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: query->key ( query -- key ) + { [ name>> >lower ] [ type>> unparse ] [ class>> unparse ] } " " join ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: table-get ( query -- result ) query->key cache of ; + +: table-check ( query -- ? ) query->key cache key? ; + +: table-add ( query value -- ) [ query->key ] [ ] bi* cache at-mutate ; + +: table-rem ( query -- ) query->key cache delete-key-of drop ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: now ( -- seconds ) millis 1000.0 / round >integer ; + +: ttl->time ( ttl -- seconds ) now + ; + +: time->ttl ( time -- ttl ) now - ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +SYMBOL: NX + +: cache-nx ( query ttl -- ) ttl->time NX entry boa table-add ; + +: nx? ( obj -- ? ) dup entry? [ data>> NX = ] [ drop f ] if ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: query->rr ( query -- rr ) [ name>> ] [ type>> ] [ class>> ] tri f f rr boa ; + +: query+entry->rrs ( query entry -- rrs ) + swap ! entry query + query->rr ! entry rr + over ! entry rr entry + time>> time->ttl >>ttl ! entry rr + swap ! rr entry + data>> [ >r dup clone r> >>rdata ] map + nip ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: expired? ( entry -- ? ) time>> time->ttl 0 <= ; + +: cache-get* ( query -- rrs/NX/f ) + dup table-get ! query result + { + { [ dup f = ] [ 2drop f ] } ! not in the cache + { [ dup expired? ] [ drop table-rem f ] } ! here but expired + { [ dup nx? ] [ 2drop NX ] } ! negative result cached + { [ t ] [ query+entry->rrs ] } ! good to go + } + cond ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: cache-get ( query -- rrs/f ) + dup cache-get* dup NX = [ drop name>> name-error ] [ nip ] if ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: rr->entry ( rr -- entry ) + [ ttl>> ttl->time ] [ rdata>> {1} >vector ] bi entry boa ; + +: maybe-pushed-on ( obj seq -- ) + 2dup member-of? + [ 2drop ] + [ pushed-on ] + if ; + +: add-rr-to-entry ( rr entry -- ) + over ttl>> ttl->time >>time + [ rdata>> ] [ data>> ] bi* maybe-pushed-on ; + +: cache-add ( query rr -- ) + over table-get ! query rr entry + { + { [ dup f = ] [ drop rr->entry table-add ] } + { [ dup nx? ] [ drop over table-rem rr->entry table-add ] } + { [ dup expired? ] [ drop rr->entry table-add ] } + { [ t ] [ rot drop add-rr-to-entry ] } + } + cond ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: rr->query ( rr -- query ) [ name>> ] [ type>> ] [ class>> ] tri query boa ; + +: cache-add-rr ( rr -- ) [ rr->query ] [ ] bi cache-add ; + +: cache-add-rrs ( rrs -- ) [ cache-add-rr ] each ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! cache-name-error +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: message-soa ( message -- rr/soa ) + authority-section>> [ type>> SOA = ] filter 1st ; + +: cache-name-error ( message -- message ) + dup + [ message-query ] [ message-soa ttl>> ] bi + cache-nx ; + +: cache-message-records ( message -- message ) + dup + { + [ answer-section>> cache-add-rrs ] + [ authority-section>> cache-add-rrs ] + [ additional-section>> cache-add-rrs ] + } + cleave ; + +: cache-message ( message -- message ) + dup rcode>> NAME-ERROR = [ cache-name-error ] when + cache-message-records ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + diff --git a/extra/dns/dns.factor b/extra/dns/dns.factor new file mode 100644 index 0000000000..48380a0d57 --- /dev/null +++ b/extra/dns/dns.factor @@ -0,0 +1,492 @@ + +USING: kernel byte-arrays combinators strings arrays sequences splitting + grouping + math math.functions math.parser random + destructors + io io.binary io.sockets io.encodings.binary + accessors + combinators.cleave + newfx + symbols + ; + +IN: dns + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +TUPLE: query name type class ; + +TUPLE: rr name type class ttl rdata ; + +TUPLE: hinfo cpu os ; + +TUPLE: mx preference exchange ; + +TUPLE: soa mname rname serial refresh retry expire minimum ; + +TUPLE: message + id qr opcode aa tc rd ra z rcode + question-section + answer-section + authority-section + additional-section ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: random-id ( -- id ) 2 16 ^ random ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! TYPE +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +SYMBOLS: A NS MD MF CNAME SOA MB MG MR NULL WKS PTR HINFO MINFO MX TXT AAAA ; + +: type-table ( -- table ) + { + { A 1 } + { NS 2 } + { MD 3 } + { MF 4 } + { CNAME 5 } + { SOA 6 } + { MB 7 } + { MG 8 } + { MR 9 } + { NULL 10 } + { WKS 11 } + { PTR 12 } + { HINFO 13 } + { MINFO 14 } + { MX 15 } + { TXT 16 } + { AAAA 28 } + } ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! CLASS +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +SYMBOLS: IN CS CH HS ; + +: class-table ( -- table ) + { + { IN 1 } + { CS 2 } + { CH 3 } + { HS 4 } + } ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! OPCODE +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +SYMBOLS: QUERY IQUERY STATUS ; + +: opcode-table ( -- table ) + { + { QUERY 0 } + { IQUERY 1 } + { STATUS 2 } + } ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! RCODE +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +SYMBOLS: NO-ERROR FORMAT-ERROR SERVER-FAILURE NAME-ERROR NOT-IMPLEMENTED + REFUSED ; + +: rcode-table ( -- table ) + { + { NO-ERROR 0 } + { FORMAT-ERROR 1 } + { SERVER-FAILURE 2 } + { NAME-ERROR 3 } + { NOT-IMPLEMENTED 4 } + { REFUSED 5 } + } ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: ( -- message ) + message new + random-id >>id + 0 >>qr + QUERY >>opcode + 0 >>aa + 0 >>tc + 1 >>rd + 0 >>ra + 0 >>z + NO-ERROR >>rcode + { } >>question-section + { } >>answer-section + { } >>authority-section + { } >>additional-section ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: ip->ba ( ip -- ba ) "." split [ string>number ] map >byte-array ; + +: ipv6->ba ( ip -- ba ) ":" split [ 16 base> ] map [ 2 >be ] map concat ; + +: label->ba ( label -- ba ) [ >byte-array ] [ length ] bi prefix ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: uint8->ba ( n -- ba ) 1 >be ; +: uint16->ba ( n -- ba ) 2 >be ; +: uint32->ba ( n -- ba ) 4 >be ; +: uint64->ba ( n -- ba ) 8 >be ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: dn->ba ( dn -- ba ) "." split [ label->ba ] map concat ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: query->ba ( query -- ba ) + { + [ name>> dn->ba ] + [ type>> type-table of uint16->ba ] + [ class>> class-table of uint16->ba ] + } + concat ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: hinfo->ba ( rdata -- ba ) + [ cpu>> label->ba ] + [ os>> label->ba ] + bi append ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: mx->ba ( rdata -- ba ) + [ preference>> uint16->ba ] + [ exchange>> dn->ba ] + bi append ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: soa->ba ( rdata -- ba ) + { + [ mname>> dn->ba ] + [ rname>> dn->ba ] + [ serial>> uint32->ba ] + [ refresh>> uint32->ba ] + [ retry>> uint32->ba ] + [ expire>> uint32->ba ] + [ minimum>> uint32->ba ] + } + concat ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: rdata->ba ( type rdata -- ba ) + swap + { + { CNAME [ dn->ba ] } + { HINFO [ hinfo->ba ] } + { MX [ mx->ba ] } + { NS [ dn->ba ] } + { PTR [ dn->ba ] } + { SOA [ soa->ba ] } + { A [ ip->ba ] } + } + case ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: rr->ba ( rr -- ba ) + { + [ name>> dn->ba ] + [ type>> type-table of uint16->ba ] + [ class>> class-table of uint16->ba ] + [ ttl>> uint32->ba ] + [ + [ type>> ] [ rdata>> ] bi rdata->ba + [ length uint16->ba ] [ ] bi append + ] + } + concat ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: header-bits-ba ( message -- ba ) + { + [ qr>> 15 shift ] + [ opcode>> opcode-table of 11 shift ] + [ aa>> 10 shift ] + [ tc>> 9 shift ] + [ rd>> 8 shift ] + [ ra>> 7 shift ] + [ z>> 4 shift ] + [ rcode>> rcode-table of 0 shift ] + } + sum uint16->ba ; + +: message->ba ( message -- ba ) + { + [ id>> uint16->ba ] + [ header-bits-ba ] + [ question-section>> length uint16->ba ] + [ answer-section>> length uint16->ba ] + [ authority-section>> length uint16->ba ] + [ additional-section>> length uint16->ba ] + [ question-section>> [ query->ba ] map concat ] + [ answer-section>> [ rr->ba ] map concat ] + [ authority-section>> [ rr->ba ] map concat ] + [ additional-section>> [ rr->ba ] map concat ] + } + concat ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: get-single ( ba i -- n ) at ; +: get-double ( ba i -- n ) dup 2 + subseq be> ; +: get-quad ( ba i -- n ) dup 4 + subseq be> ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: label-length ( ba i -- length ) get-single ; + +: skip-label ( ba i -- ba i ) 2dup label-length + 1 + ; + +: null-label? ( ba i -- ? ) get-single 0 = ; + +: get-label ( ba i -- label ) [ 1 + ] [ skip-label nip ] 2bi subseq >string ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: bit-test ( a b -- ? ) bitand 0 = not ; + +: pointer? ( ba i -- ? ) get-single BIN: 11000000 bit-test ; + +: pointer ( ba i -- val ) get-double BIN: 0011111111111111 bitand ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: skip-name ( ba i -- ba i ) + { + { [ 2dup null-label? ] [ 1 + ] } + { [ 2dup pointer? ] [ 2 + ] } + { [ t ] [ skip-label skip-name ] } + } + cond ; + +: get-name ( ba i -- name ) + { + { [ 2dup null-label? ] [ 2drop "" ] } + { [ 2dup pointer? ] [ dupd pointer get-name ] } + { + [ t ] + [ + [ get-label ] + [ skip-label get-name ] + 2bi + "." swap 3append + ] + } + } + cond ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: get-query ( ba i -- query ) + [ get-name ] + [ + skip-name + [ 0 + get-double type-table key-of ] + [ 2 + get-double class-table key-of ] + 2bi + ] + 2bi query boa ; + +: skip-query ( ba i -- ba i ) skip-name 4 + ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: get-mx ( ba i -- mx ) [ get-double ] [ 2 + get-double ] 2bi mx boa ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: get-soa ( ba i -- soa ) + { + [ get-name ] + [ skip-name get-name ] + [ + skip-name + skip-name + { + [ 0 + get-quad ] + [ 4 + get-quad ] + [ 8 + get-quad ] + [ 12 + get-quad ] + [ 16 + get-quad ] + } + 2cleave + ] + } + 2cleave soa boa ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: get-ip ( ba i -- ip ) dup 4 + subseq >array [ number>string ] map "." join ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: get-ipv6 ( ba i -- ip ) + dup 16 + subseq 2 group [ be> 16 >base ] map ":" join ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: get-rdata ( ba i type -- rdata ) + { + { CNAME [ get-name ] } + { NS [ get-name ] } + { PTR [ get-name ] } + { MX [ get-mx ] } + { SOA [ get-soa ] } + { A [ get-ip ] } + { AAAA [ get-ipv6 ] } + } + case ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: get-rr ( ba i -- rr ) + [ get-name ] + [ + skip-name + { + [ 0 + get-double type-table key-of ] + [ 2 + get-double class-table key-of ] + [ 4 + get-quad ] + [ [ 10 + ] [ get-double type-table key-of ] 2bi get-rdata ] + } + 2cleave + ] + 2bi rr boa ; + +: skip-rr ( ba i -- ba i ) skip-name 8 + 2dup get-double + 2 + ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: get-question-section ( ba i count -- seq ba i ) + [ drop [ skip-query ] [ get-query ] 2bi ] map -rot ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: get-rr-section ( ba i count -- seq ba i ) + [ drop [ skip-rr ] [ get-rr ] 2bi ] map -rot ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: >> ( x n -- y ) neg shift ; + +: get-header-bits ( ba i -- qr opcode aa tc rd ra z rcode ) + get-double + { + [ 15 >> BIN: 1 bitand ] + [ 11 >> BIN: 111 bitand opcode-table key-of ] + [ 10 >> BIN: 1 bitand ] + [ 9 >> BIN: 1 bitand ] + [ 8 >> BIN: 1 bitand ] + [ 7 >> BIN: 1 bitand ] + [ 4 >> BIN: 111 bitand ] + [ BIN: 1111 bitand rcode-table key-of ] + } + cleave ; + +: parse-message ( ba -- message ) + 0 + { + [ get-double ] + [ 2 + get-header-bits ] + [ + 4 + + { + [ 8 + ] + [ 0 + get-double ] + [ 2 + get-double ] + [ 4 + get-double ] + [ 6 + get-double ] + } + 2cleave + >r >r >r + get-question-section r> + get-rr-section r> + get-rr-section r> + get-rr-section + 2drop + ] + } + 2cleave message boa ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: send-receive-udp ( ba server -- ba ) + f 0 + [ + [ send ] [ receive drop ] bi + ] + with-disposal ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: send-receive-tcp ( ba server -- ba ) + [ dup length 2 >be prepend ] [ ] bi* + binary + [ + write flush + 2 read be> read + ] + with-client ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: >dns-inet4 ( obj -- inet4 ) + dup string? + [ 53 ] + [ ] + if ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: ask-server ( message server -- message ) + [ message->ba ] [ >dns-inet4 ] bi* + 2dup + send-receive-udp parse-message + dup tc>> 1 = + [ drop send-receive-tcp parse-message ] + [ nip nip ] + if ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: dns-servers ( -- seq ) V{ } ; + +: dns-server ( -- server ) dns-servers random ; + +: ask ( message -- message ) dns-server ask-server ; + +: query->message ( query -- message ) swap {1} >>question-section ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: message-query ( message -- query ) question-section>> 1st ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +ERROR: name-error name ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: fully-qualified ( name -- name ) + { + { [ dup empty? ] [ "." append ] } + { [ dup peek CHAR: . = ] [ ] } + { [ t ] [ "." append ] } + } + cond ; diff --git a/extra/dns/forwarding/forwarding.factor b/extra/dns/forwarding/forwarding.factor new file mode 100644 index 0000000000..039b969ddd --- /dev/null +++ b/extra/dns/forwarding/forwarding.factor @@ -0,0 +1,105 @@ + +USING: kernel + combinators + vectors + sequences + io.sockets + accessors + combinators.lib + newfx + dns dns.cache dns.misc ; + +IN: dns.forwarding + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! DNS server - caching, forwarding +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: (socket) ( -- vec ) V{ f } ; + +: socket ( -- socket ) (socket) 1st ; + +: init-socket-on-port ( port -- ) + f swap 0 (socket) as-mutate ; + +: init-socket ( -- ) 53 init-socket-on-port ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: (upstream-server) ( -- vec ) V{ f } ; + +: upstream-server ( -- ip ) (upstream-server) 1st ; + +: set-upstream-server ( ip -- ) 0 (upstream-server) as-mutate ; + +: init-upstream-server ( -- ) + upstream-server not + [ resolv-conf-server set-upstream-server ] + when ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: rrs? ( obj -- ? ) { [ NX = not ] [ f = not ] } 1&& ; + +: query->answer/cache ( query -- rrs/NX/f ) + dup cache-get* dup { [ rrs? ] [ NX = ] } 1|| + [ nip ] + [ + drop + dup clone CNAME >>type cache-get* dup { [ NX = ] [ f = ] } 1|| + [ nip ] + [ ! query rrs + tuck ! rrs query rrs + 1st ! rrs query rr/cname + rdata>> ! rrs query name + >r clone r> >>name ! rrs query + query->answer/cache ! rrs rrs/NX/f + dup rrs? [ append ] [ nip ] if + ] + if + ] + if ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: answer-from-cache ( message -- message/f ) + dup message-query ! message query + dup query->answer/cache ! message query rrs/NX/f + { + { [ dup f = ] [ 3drop f ] } + { [ dup NX = ] [ 2drop NAME-ERROR >>rcode ] } + { [ t ] [ nip >>answer-section ] } + } + cond ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: answer-from-server ( message -- message ) + upstream-server ask-server + cache-message ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: find-answer ( message -- message ) + dup answer-from-cache dup + [ nip ] + [ drop answer-from-server ] + if ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: loop ( -- ) + socket receive ! byte-array addr-spec + swap ! addr-spec byte-array + parse-message ! addr-spec message + find-answer ! addr-spec message + message->ba ! addr-spec byte-array + swap ! byte-array addr-spec + socket send + loop ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: start ( -- ) init-socket init-upstream-server loop ; + +MAIN: start \ No newline at end of file diff --git a/extra/dns/misc/misc.factor b/extra/dns/misc/misc.factor new file mode 100644 index 0000000000..90731cec43 --- /dev/null +++ b/extra/dns/misc/misc.factor @@ -0,0 +1,12 @@ + +USING: kernel sequences splitting io.files io.encodings.utf8 random newfx ; + +IN: dns.misc + +: resolv-conf-servers ( -- seq ) + "/etc/resolv.conf" utf8 file-lines + [ " " split ] map + [ 1st "nameserver" = ] filter + [ 2nd ] map ; + +: resolv-conf-server ( -- ip ) resolv-conf-servers random ; \ No newline at end of file diff --git a/extra/dns/recursive/recursive.factor b/extra/dns/recursive/recursive.factor new file mode 100644 index 0000000000..3a74667845 --- /dev/null +++ b/extra/dns/recursive/recursive.factor @@ -0,0 +1,185 @@ + +USING: kernel continuations + combinators + sequences + math + random + unicode.case + accessors symbols + combinators.lib combinators.cleave + newfx + dns dns.cache ; + +IN: dns.recursive + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: root-dns-servers ( -- servers ) + { + "192.5.5.241" + "192.112.36.4" + "128.63.2.53" + "192.36.148.17" + "192.58.128.30" + "193.0.14.129" + "199.7.83.42" + "202.12.27.33" + "198.41.0.4" + } ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: {name-type-class} ( obj -- seq ) + [ name>> >lower ] [ type>> ] [ class>> ] tri {3} ; + +: rr=query? ( rr query -- ? ) [ {name-type-class} ] bi@ = ; + +: rr-filter ( rrs query -- rrs ) [ rr=query? ] curry filter ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: answer-hits ( message -- rrs ) + [ answer-section>> ] [ message-query ] bi rr-filter ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: name-hits ( message -- rrs ) + [ answer-section>> ] [ message-query clone A >>type ] bi rr-filter ; + +: cname-hits ( message -- rrs ) + [ answer-section>> ] [ message-query clone CNAME >>type ] bi rr-filter ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: authority-hits ( message -- rrs ) + authority-section>> [ type>> NS = ] filter ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +SYMBOLS: ANSWERED NO-NAME-SERVERS UNCLASSIFIED ; + +: classify-message ( message -- symbol ) + { + { [ dup rcode>> NAME-ERROR = ] [ drop NAME-ERROR ] } + { [ dup rcode>> SERVER-FAILURE = ] [ drop SERVER-FAILURE ] } + { [ dup answer-hits empty? not ] [ drop ANSWERED ] } + { [ dup cname-hits empty? not ] [ drop CNAME ] } + { [ dup authority-hits empty? ] [ drop NO-NAME-SERVERS ] } + { [ t ] [ drop UNCLASSIFIED ] } + } + cond ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +DEFER: name->ip + +! : name->ip/f ( name -- ip/f ) [ name->ip ] [ drop f ] recover ; + +! : extract-ns-ips ( message -- ips ) +! authority-hits [ rdata>> name->ip/f ] map [ ] filter ; + +: extract-ns-ips ( message -- ips ) + authority-hits [ rdata>> name->ip ] map [ ] filter ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: (recursive-query) ( query servers -- message ) + dup random ! query servers server + pick query->message 0 >>rd ! query servers server message + over ask-server ! query servers server message + cache-message ! query servers server message + dup classify-message ! query servers server message sym + { + { NAME-ERROR [ -roll 3drop ] } + { ANSWERED [ -roll 3drop ] } + { CNAME [ -roll 3drop ] } + { NO-NAME-SERVERS [ -roll 3drop ] } + { + SERVER-FAILURE + [ + -roll ! message query servers server + remove ! message query servers + dup empty? + [ 2drop ] + [ rot drop (recursive-query) ] + if + ] + } + [ ! query servers server message sym + drop nip nip ! query message + extract-ns-ips ! query ips + (recursive-query) + ] + } + case ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: cdr-name ( name -- name ) dup CHAR: . index 1+ tail ; + +: cache-get-ns ( name -- seq/f ) NS IN query boa cache-get ; + +: name->servers ( name -- servers ) + { + { [ dup "" = ] [ drop root-dns-servers ] } + { [ dup cache-get-ns ] [ cache-get-ns [ rdata>> name->ip ] map ] } + { [ t ] [ cdr-name name->servers ] } + } + cond ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: recursive-query ( query -- message ) + dup name>> name->servers (recursive-query) ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: canonical/cache ( name -- name ) + dup CNAME IN query boa cache-get dup [ nip 1st rdata>> ] [ drop ] if ; + +: name->ip/cache ( name -- ip/f ) + canonical/cache + A IN query boa cache-get dup [ random rdata>> ] [ ] if ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: name-hits? ( message -- message ? ) dup name-hits empty? not ; +: cname-hits? ( message -- message ? ) dup cname-hits empty? not ; + +! : name->ip/server ( name -- ip-or-f ) +! A IN query boa root-dns-servers recursive-query ! message +! { +! { [ name-hits? ] [ name-hits random rdata>> ] } +! { [ cname-hits? ] [ cname-hits random rdata>> name->ip ] } +! { [ t ] [ drop f ] } +! } +! cond ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: name->ip/server ( name -- ip-or-f ) + A IN query boa recursive-query ! message + { + { [ name-hits? ] [ name-hits random rdata>> ] } + { [ cname-hits? ] [ cname-hits random rdata>> name->ip ] } + { [ t ] [ drop f ] } + } + cond ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +! : name->ip ( name -- ip ) +! { [ name->ip/cache ] [ name->ip/server ] [ name-error ] } 1|| ; + +: name->ip ( name -- ip ) + dup name->ip/cache dup + [ nip ] + [ + drop dup name->ip/server dup + [ nip ] + [ drop name-error ] + if + ] + if ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/extra/dns/resolver/resolver.factor b/extra/dns/resolver/resolver.factor new file mode 100644 index 0000000000..2dae43b5d4 --- /dev/null +++ b/extra/dns/resolver/resolver.factor @@ -0,0 +1,49 @@ + +USING: kernel vectors sequences combinators random + accessors newfx dns dns.cache ; + +IN: dns.resolver + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: canonical/cache ( name -- name ) + dup CNAME IN query boa cache-get dup vector? ! name result ? + [ nip 1st rdata>> ] + [ drop ] + if ; + +: name->ip/cache ( name -- ip ) + canonical/cache + dup A IN query boa cache-get ! name result + { + { [ dup NX = ] [ 2drop f ] } + { [ dup f = ] [ 2drop f ] } + { [ t ] [ nip random rdata>> ] } + } + cond ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: canonical/server ( name -- name ) + dup CNAME IN query boa query->message ask cache-message answer-section>> + [ type>> CNAME = ] filter dup empty? not + [ nip 1st rdata>> ] + [ drop ] + if ; + +: name->ip/server ( name -- ip ) + canonical/server + dup A IN query boa query->message ask cache-message answer-section>> + [ type>> A = ] filter dup empty? not + [ nip random rdata>> ] + [ 2drop f ] + if ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: name->ip ( name -- ip ) + fully-qualified + dup name->ip/cache dup + [ nip ] + [ drop name->ip/server ] + if ; diff --git a/extra/dns/server/server.factor b/extra/dns/server/server.factor new file mode 100644 index 0000000000..e1c32af970 --- /dev/null +++ b/extra/dns/server/server.factor @@ -0,0 +1,132 @@ + +USING: kernel + combinators + sequences + math + io.sockets + unicode.case + accessors + combinators.cleave combinators.lib + newfx + dns dns.util ; + +IN: dns.server + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: records ( -- vector ) V{ } ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: {name-type-class} ( obj -- array ) + { [ name>> >lower ] [ type>> ] [ class>> ] } ; + +: rr=query? ( obj obj -- ? ) [ {name-type-class} ] bi@ = ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: matching-rrs ( query -- rrs ) records [ rr=query? ] with filter ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! query->rrs +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +DEFER: query->rrs + +: matching-rrs? ( query -- rrs/f ) matching-rrs [ empty? ] [ drop f ] [ ] 1if ; + +: matching-cname? ( query -- rrs/f ) + [ ] [ clone CNAME >>type matching-rrs ] bi ! query rrs + [ empty? not ] + [ 1st swap clone over rdata>> >>name query->rrs prefix-on ] + [ 2drop f ] + 1if ; + +: query->rrs ( query -- rrs/f ) { [ matching-rrs? ] [ matching-cname? ] } 1|| ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! have-answers +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: have-answers ( message -- message/f ) + dup message-query query->rrs ! message rrs/f + [ empty? ] [ 2drop f ] [ >>answer-section ] 1if ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! have-delegates? +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: cdr-name ( name -- name ) dup CHAR: . index 1+ tail ; + +: is-soa? ( name -- ? ) SOA IN query boa matching-rrs empty? not ; + +: have-ns? ( name -- rrs/f ) + NS IN query boa matching-rrs [ empty? ] [ drop f ] [ ] 1if ; + +: name->delegates ( name -- rrs-ns ) + { + [ "" = { } and ] + [ is-soa? { } and ] + [ have-ns? ] + [ cdr-name name->delegates ] + } + 1|| ; + +: have-delegates ( message -- message/f ) + dup message-query name>> name->delegates ! message rrs-ns + [ empty? ] + [ 2drop f ] + [ + dup [ rdata>> A IN query boa matching-rrs ] map concat + ! message rrs-ns rrs-a + [ >>authority-section ] + [ >>additional-section ] + bi* + ] + 1if ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! is-nx +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: is-nx ( message -- message/f ) + [ message-query name>> records [ name>> = ] with filter empty? ] + [ NAME-ERROR >>rcode ] + [ drop f ] + 1if ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: find-answer ( message -- message ) + { [ have-answers ] [ have-delegates ] [ is-nx ] [ ] } 1|| ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: (socket) ( -- vec ) V{ f } ; + +: socket ( -- socket ) (socket) 1st ; + +: init-socket-on-port ( port -- ) + f swap 0 (socket) as-mutate ; + +: init-socket ( -- ) 53 init-socket-on-port ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: loop ( -- ) + socket receive + swap + parse-message + find-answer + message->ba + swap + socket send + loop ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: start ( -- ) init-socket loop ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +MAIN: start diff --git a/extra/dns/stub/stub.factor b/extra/dns/stub/stub.factor new file mode 100644 index 0000000000..a15feb5759 --- /dev/null +++ b/extra/dns/stub/stub.factor @@ -0,0 +1,20 @@ + +USING: kernel sequences random accessors dns ; + +IN: dns.stub + +! Stub resolver +! +! Generally useful, but particularly when running a forwarding, +! caching, nameserver on localhost with multiple Factor instances +! querying it. + +: name->ip ( name -- ip ) + A IN query boa + query->message + ask + dup rcode>> NAME-ERROR = + [ message-query name>> name-error ] + [ answer-section>> [ type>> A = ] filter random rdata>> ] + if ; + diff --git a/extra/dns/util/util.factor b/extra/dns/util/util.factor new file mode 100644 index 0000000000..bee1cc111e --- /dev/null +++ b/extra/dns/util/util.factor @@ -0,0 +1,11 @@ + +USING: kernel macros fry ; + +IN: dns.util + +: tri-chain ( obj p q r -- x y z ) + >r >r call dup r> call dup r> call ; inline + +MACRO: 1if ( test then else -- ) '[ dup @ , , if ] ; + +! : 1if ( test then else -- ) >r >r >r dup r> call r> r> if ; inline ; \ No newline at end of file diff --git a/extra/documents/documents.factor b/extra/documents/documents.factor index 4fa4ed3c09..9e4802c2ef 100755 --- a/extra/documents/documents.factor +++ b/extra/documents/documents.factor @@ -1,7 +1,8 @@ ! Copyright (C) 2006, 2007 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. -USING: arrays io kernel math models namespaces sequences strings -splitting combinators unicode.categories ; +USING: accessors arrays io kernel math models namespaces +sequences strings splitting combinators unicode.categories +math.order ; IN: documents : +col ( loc n -- newloc ) >r first2 r> + 2array ; @@ -20,9 +21,9 @@ TUPLE: document locs ; V{ "" } clone V{ } clone { set-delegate set-document-locs } document construct ; -: add-loc document-locs push ; +: add-loc ( loc document -- ) locs>> push ; -: remove-loc document-locs delete ; +: remove-loc ( loc document -- ) locs>> delete ; : update-locs ( loc document -- ) document-locs [ set-model ] with each ; @@ -178,16 +179,16 @@ M: one-char-elt next-elt 2drop ; >r >r first2 swap r> doc-line r> call r> =col ; inline -: ((word-elt)) [ ?nth blank? ] 2keep ; +: ((word-elt)) ( n seq -- ? n seq ) [ ?nth blank? ] 2keep ; : break-detector ( ? -- quot ) [ >r blank? r> xor ] curry ; inline : (prev-word) ( ? col str -- col ) - rot break-detector find-last* drop ?1+ ; + rot break-detector find-last-from drop ?1+ ; : (next-word) ( ? col str -- col ) - [ rot break-detector find* drop ] keep + [ rot break-detector find-from drop ] keep over not [ nip length ] [ drop ] if ; TUPLE: one-word-elt ; diff --git a/extra/editors/editors.factor b/extra/editors/editors.factor index a15a12830c..ec8313363e 100755 --- a/extra/editors/editors.factor +++ b/extra/editors/editors.factor @@ -51,9 +51,7 @@ M: object find-parse-error [ file>> path>> ] [ line>> ] bi edit-location ] when* ; -: fix ( word -- ) - [ "Fixing " write pprint " and all usages..." print nl ] - [ [ usage ] keep prefix ] bi +: edit-each ( seq -- ) [ [ "Editing " write . ] [ @@ -63,3 +61,8 @@ M: object find-parse-error readln ] bi ] all? drop ; + +: fix ( word -- ) + [ "Fixing " write pprint " and all usages..." print nl ] + [ [ smart-usage ] keep prefix ] bi + edit-each ; diff --git a/extra/editors/jedit/jedit.factor b/extra/editors/jedit/jedit.factor index e4f19781ef..fe9abc0e76 100755 --- a/extra/editors/jedit/jedit.factor +++ b/extra/editors/jedit/jedit.factor @@ -25,11 +25,11 @@ IN: editors.jedit ] with-byte-writer ; : send-jedit-request ( request -- ) - jedit-server-info "localhost" rot binary [ + jedit-server-info "localhost" rot binary [ 4 >be write dup length 2 >be write write - ] with-stream ; + ] with-client ; : jedit-location ( file line -- ) number>string "+line:" prepend 2array diff --git a/extra/factory/commands/commands.factor b/extra/factory/commands/commands.factor index 5b0c575771..6bf5ee8d4f 100644 --- a/extra/factory/commands/commands.factor +++ b/extra/factory/commands/commands.factor @@ -35,7 +35,7 @@ pointer-window up-till-frame dup is? [ ] [ drop f ] if ; wm-root> <- children - [ <- mapped? ] subset + [ <- mapped? ] filter [ check-window-table ] map reverse @@ -64,7 +64,7 @@ drop ! wm-root> ! <- children -! [ <- mapped? ] subset +! [ <- mapped? ] filter ! [ check-window-table ] map ! reverse diff --git a/extra/factory/factory.factor b/extra/factory/factory.factor index ca534f12c1..6faf334fc3 100644 --- a/extra/factory/factory.factor +++ b/extra/factory/factory.factor @@ -13,7 +13,7 @@ IN: factory ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! : manage-windows ( -- ) -dpy get $default-root <- children [ <- mapped? ] subset +dpy get $default-root <- children [ <- mapped? ] filter [ $id new* drop ] each ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/extra/faq/faq.factor b/extra/faq/faq.factor index 1022a02d7e..3cb17cf08b 100644 --- a/extra/faq/faq.factor +++ b/extra/faq/faq.factor @@ -16,7 +16,7 @@ TUPLE: q/a question answer ; C: q/a : li>q/a ( li -- q/a ) - [ "br" tag-named*? not ] subset + [ "br" tag-named*? not ] filter [ "strong" tag-named*? ] find-after >r tag-children r> ; @@ -39,7 +39,7 @@ C: question-list : xml>question-list ( list -- question-list ) [ "title" swap at ] keep - tag-children [ tag? ] subset [ xml>q/a ] map + tag-children [ tag? ] filter [ xml>q/a ] map ; : question-list>xml ( question-list -- list ) @@ -85,7 +85,7 @@ C: faq : toc, ( faq -- ) "div" { { "style" "background-color: #eee; margin-left: 30%; margin-right: 30%; width: auto; padding: 5px; margin-top: 1em; margin-bottom: 1em" } } [ "strong" [ "The big questions" , ] tag, br, - faq-lists 1 tail dup length [ toc-link, ] 2each + faq-lists rest dup length [ toc-link, ] 2each ] tag*, ; : faq-sections, ( question-lists -- ) diff --git a/extra/farkup/farkup-tests.factor b/extra/farkup/farkup-tests.factor index 7176486f8e..17d286252e 100755 --- a/extra/farkup/farkup-tests.factor +++ b/extra/farkup/farkup-tests.factor @@ -16,10 +16,18 @@ IN: farkup.tests [ "

**

" ] [ "\\**" convert-farkup ] unit-test [ "" ] [ "\n\n" convert-farkup ] unit-test +[ "" ] [ "\r\n\r\n" convert-farkup ] unit-test +[ "" ] [ "\r\r\r\r" convert-farkup ] unit-test +[ "\n" ] [ "\r\r\r" convert-farkup ] unit-test [ "\n" ] [ "\n\n\n" convert-farkup ] unit-test [ "

foo

bar

" ] [ "foo\n\nbar" convert-farkup ] unit-test +[ "

foo

bar

" ] [ "foo\r\n\r\nbar" convert-farkup ] unit-test +[ "

foo

bar

" ] [ "foo\r\rbar" convert-farkup ] unit-test +[ "

foo

bar

" ] [ "foo\r\r\nbar" convert-farkup ] unit-test [ "\n

bar\n

" ] [ "\nbar\n" convert-farkup ] unit-test +[ "\n

bar\n

" ] [ "\rbar\r" convert-farkup ] unit-test +[ "\n

bar\n

" ] [ "\r\nbar\r\n" convert-farkup ] unit-test [ "

foo

\n

bar

" ] [ "foo\n\n\nbar" convert-farkup ] unit-test @@ -28,17 +36,17 @@ IN: farkup.tests [ "

|a

" ] [ "|a" convert-farkup ] unit-test -[ "

|a|

" ] +[ "
a
" ] [ "|a|" convert-farkup ] unit-test [ "
ab
" ] -[ "a|b" convert-farkup ] unit-test +[ "|a|b|" convert-farkup ] unit-test -[ "
ab
\n
cd
" ] -[ "a|b\nc|d" convert-farkup ] unit-test +[ "
ab
cd
" ] +[ "|a|b|\n|c|d|" convert-farkup ] unit-test -[ "
ab
\n
cd
\n" ] -[ "a|b\nc|d\n" convert-farkup ] unit-test +[ "
ab
cd
" ] +[ "|a|b|\n|c|d|\n" convert-farkup ] unit-test [ "

foo\n

aheading

\n

adfasd

" ] [ "*foo*\n=aheading=\nadfasd" convert-farkup ] unit-test @@ -54,12 +62,23 @@ IN: farkup.tests [ "

=

foo

" ] [ "===foo==" convert-farkup ] unit-test [ "

foo

=

" ] [ "=foo==" convert-farkup ] unit-test -[ "
int main()
" ] +[ "
int main()\n
" ] [ "[c{int main()}]" convert-farkup ] unit-test [ "

" ] [ "[[image:lol.jpg]]" convert-farkup ] unit-test [ "

\"teh

" ] [ "[[image:lol.jpg|teh lol]]" convert-farkup ] unit-test -[ "

" ] [ "[[lol.com]]" convert-farkup ] unit-test +[ "

lol.com

" ] [ "[[lol.com]]" convert-farkup ] unit-test [ "

haha

" ] [ "[[lol.com|haha]]" convert-farkup ] unit-test [ ] [ "[{}]" convert-farkup drop ] unit-test + +[ + "

Feature comparison:\n
aFactorJavaLisp
CoolnessYesNoNo
BadassYesNoNo
EnterpriseYesYesNo
KosherYesNoYes

" +] [ "Feature comparison:\n|a|Factor|Java|Lisp|\n|Coolness|Yes|No|No|\n|Badass|Yes|No|No|\n|Enterprise|Yes|Yes|No|\n|Kosher|Yes|No|Yes|\n" convert-farkup ] unit-test + +[ + "

Feature comparison:\n\n
aFactorJavaLisp
CoolnessYesNoNo
BadassYesNoNo
EnterpriseYesYesNo
KosherYesNoYes

" +] [ "Feature comparison:\n\n|a|Factor|Java|Lisp|\n|Coolness|Yes|No|No|\n|Badass|Yes|No|No|\n|Enterprise|Yes|Yes|No|\n|Kosher|Yes|No|Yes|\n" convert-farkup ] unit-test + +[ "

a-b

" ] [ "a-b" convert-farkup ] unit-test +[ "
  • a-b
" ] [ "-a-b" convert-farkup ] unit-test diff --git a/extra/farkup/farkup.factor b/extra/farkup/farkup.factor index 527ba8b4fa..1b51bb5752 100755 --- a/extra/farkup/farkup.factor +++ b/extra/farkup/farkup.factor @@ -2,21 +2,24 @@ ! See http://factorcode.org/license.txt for BSD license. USING: arrays io io.styles kernel memoize namespaces peg sequences strings html.elements xml.entities xmode.code2html -splitting io.streams.string html peg.parsers html.elements +splitting io.streams.string peg.parsers sequences.deep unicode.categories ; IN: farkup +SYMBOL: relative-link-prefix +SYMBOL: link-no-follow? + string escape-string ] action ; MEMO: delimiter ( -- parser ) - [ dup delimiters member? swap "\n=" member? not and ] satisfy + [ dup delimiters member? swap "\r\n=" member? not and ] satisfy [ 1string ] action ; : surround-with-foo ( string tag -- seq ) @@ -37,8 +40,11 @@ MEMO: emphasis ( -- parser ) "_" "em" delimited ; MEMO: superscript ( -- parser ) "^" "sup" delimited ; MEMO: subscript ( -- parser ) "~" "sub" delimited ; MEMO: inline-code ( -- parser ) "%" "code" delimited ; -MEMO: nl ( -- parser ) "\n" token ; -MEMO: 2nl ( -- parser ) "\n\n" token hide ; +MEMO: nl ( -- parser ) + "\r\n" token [ drop "\n" ] action + "\r" token [ drop "\n" ] action + "\n" token 3choice ; +MEMO: 2nl ( -- parser ) nl hide nl hide 2seq ; MEMO: h1 ( -- parser ) "=" "h1" delimited ; MEMO: h2 ( -- parser ) "==" "h2" delimited ; MEMO: h3 ( -- parser ) "===" "h3" delimited ; @@ -56,19 +62,30 @@ MEMO: eq ( -- parser ) : render-code ( string mode -- string' ) >r string-lines r> [ - [ - H{ { wrap-margin f } } [ - htmlize-lines - ] with-nesting - ] with-html-stream +
+            htmlize-lines
+        
] with-string-writer ; +: check-url ( href -- href' ) + CHAR: : over member? [ + dup { "http://" "https://" "ftp://" } [ head? ] with contains? + [ drop "/" ] unless + ] [ + relative-link-prefix get prepend + ] if ; + : escape-link ( href text -- href-esc text-esc ) - >r escape-quoted-string r> escape-string ; + >r check-url escape-quoted-string r> escape-string ; : make-link ( href text -- seq ) escape-link - [ "r , r> "\">" , [ , ] when* "" , ] { } make ; + [ + "r , r> + link-no-follow? get [ " nofollow=\"true\"" , ] when + "\">" , , "" , + ] { } make ; : make-image-link ( href alt -- seq ) escape-link @@ -93,7 +110,7 @@ MEMO: simple-link ( -- parser ) "[[" token hide , [ "|]" member? not ] satisfy repeat1 , "]]" token hide , - ] seq* [ first f make-link ] action ; + ] seq* [ first dup make-link ] action ; MEMO: labelled-link ( -- parser ) [ @@ -104,28 +121,32 @@ MEMO: labelled-link ( -- parser ) "]]" token hide , ] seq* [ first2 make-link ] action ; -MEMO: link ( -- parser ) [ image-link , simple-link , labelled-link , ] choice* ; +MEMO: link ( -- parser ) + [ image-link , simple-link , labelled-link , ] choice* ; DEFER: line MEMO: list-item ( -- parser ) [ - "-" token hide , line , + "-" token hide , ! text , + [ "\r\n" member? not ] satisfy repeat1 [ >string escape-string ] action , ] seq* [ "li" surround-with-foo ] action ; MEMO: list ( -- parser ) - list-item "\n" token hide list-of + list-item nl hide list-of [ "ul" surround-with-foo ] action ; MEMO: table-column ( -- parser ) text [ "td" surround-with-foo ] action ; MEMO: table-row ( -- parser ) - [ - table-column "|" token hide list-of-many , - ] seq* [ "tr" surround-with-foo ] action ; + "|" token hide + table-column "|" token hide list-of + "|" token hide nl hide optional 4seq + [ "tr" surround-with-foo ] action ; MEMO: table ( -- parser ) - table-row repeat1 [ "table" surround-with-foo ] action ; + table-row repeat1 + [ "table" surround-with-foo ] action ; MEMO: code ( -- parser ) [ @@ -138,6 +159,8 @@ MEMO: code ( -- parser ) MEMO: line ( -- parser ) [ + nl table 2seq , + nl list 2seq , text , strong , emphasis , link , superscript , subscript , inline-code , escaped-char , delimiter , eq , @@ -145,8 +168,8 @@ MEMO: line ( -- parser ) MEMO: paragraph ( -- parser ) line - "\n" token over 2seq repeat0 - "\n" token "\n" token ensure-not 2seq optional 3seq + nl over 2seq repeat0 + nl nl ensure-not 2seq optional 3seq [ dup [ dup string? not swap [ blank? ] all? or ] deep-all? [ "

" swap "

" 3array ] unless @@ -157,7 +180,7 @@ PRIVATE> PEG: parse-farkup ( -- parser ) [ list , table , h1 , h2 , h3 , h4 , code , paragraph , 2nl , nl , - ] choice* repeat0 "\n" token optional 2seq ; + ] choice* repeat0 nl optional 2seq ; : write-farkup ( parse-result -- ) [ dup string? [ write ] [ drop ] if ] deep-each ; diff --git a/extra/freetype/freetype.factor b/extra/freetype/freetype.factor index f34bdc9920..8572a8bd91 100755 --- a/extra/freetype/freetype.factor +++ b/extra/freetype/freetype.factor @@ -155,6 +155,16 @@ C-STRUCT: face { "face-size*" "size" } { "void*" "charmap" } ; +C-STRUCT: FT_Bitmap + { "int" "rows" } + { "int" "width" } + { "int" "pitch" } + { "void*" "buffer" } + { "short" "num_grays" } + { "char" "pixel_mode" } + { "char" "palette_mode" } + { "void*" "palette" } ; + FUNCTION: FT_Error FT_New_Face ( void* library, FT_Char* font, FT_Long index, face* face ) ; FUNCTION: FT_Error FT_New_Memory_Face ( void* library, FT_Byte* file_base, FT_Long file_size, FT_Long face_index, FT_Face* aface ) ; @@ -170,6 +180,15 @@ C-ENUM: FT_RENDER_MODE_LCD FT_RENDER_MODE_LCD_V ; +C-ENUM: + FT_PIXEL_MODE_NONE + FT_PIXEL_MODE_MONO + FT_PIXEL_MODE_GRAY + FT_PIXEL_MODE_GRAY2 + FT_PIXEL_MODE_GRAY4 + FT_PIXEL_MODE_LCD + FT_PIXEL_MODE_LCD_V ; + FUNCTION: int FT_Render_Glyph ( glyph* slot, int render_mode ) ; FUNCTION: void FT_Done_Face ( face* face ) ; @@ -177,3 +196,4 @@ FUNCTION: void FT_Done_Face ( face* face ) ; FUNCTION: void FT_Done_FreeType ( void* library ) ; FUNCTION: FT_Long FT_MulFix ( FT_Long a, FT_Long b ) ; + diff --git a/extra/fry/fry-docs.factor b/extra/fry/fry-docs.factor index 84d02d529d..7a444fecbc 100755 --- a/extra/fry/fry-docs.factor +++ b/extra/fry/fry-docs.factor @@ -87,7 +87,7 @@ $nl } ; ARTICLE: "fry.limitations" "Fried quotation limitations" -"As with " { $link "locals" } ", fried quotations cannot contain " { $link >r } " and " { $link r> } ". Unlike " { $link "locals" } ", using " { $link dip } " is not a suitable workaround since unlike closure conversion, fry conversion is not recursive, and so the quotation passed to " { $link dip } " cannot contain fry specifiers." ; +"As with " { $vocab-link "locals" } ", fried quotations cannot contain " { $link >r } " and " { $link r> } "." ; ARTICLE: "fry" "Fried quotations" "A " { $emphasis "fried quotation" } " differs from a literal quotation in that when it is evaluated, instead of just pushing itself on the stack, it consumes zero or more stack values and inserts them into the quotation." diff --git a/extra/fry/fry-tests.factor b/extra/fry/fry-tests.factor index 7586e254b2..6d6abba23c 100755 --- a/extra/fry/fry-tests.factor +++ b/extra/fry/fry-tests.factor @@ -48,3 +48,17 @@ sequences ; [ { 1 2 3 } ] [ 3 1 '[ , [ , + ] map ] call ] unit-test + +[ { 1 { 2 { 3 } } } ] [ + 1 2 3 '[ , [ , [ , 1array ] call 2array ] call 2array ] call +] unit-test + +{ 1 1 } [ '[ [ [ , ] ] ] ] must-infer-as + +[ { { { 3 } } } ] [ + 3 '[ [ [ , 1array ] call 1array ] call 1array ] call +] unit-test + +[ { { { 3 } } } ] [ + 3 '[ [ [ , 1array ] call 1array ] call 1array ] call +] unit-test diff --git a/extra/fry/fry.factor b/extra/fry/fry.factor index 7621af6899..f15a6b24c2 100755 --- a/extra/fry/fry.factor +++ b/extra/fry/fry.factor @@ -5,16 +5,16 @@ quotations arrays namespaces qualified ; QUALIFIED: namespaces IN: fry -: , "Only valid inside a fry" throw ; -: @ "Only valid inside a fry" throw ; -: _ "Only valid inside a fry" throw ; +: , ( -- * ) "Only valid inside a fry" throw ; +: @ ( -- * ) "Only valid inside a fry" throw ; +: _ ( -- * ) "Only valid inside a fry" throw ; DEFER: (shallow-fry) : ((shallow-fry)) ( accum quot adder -- result ) >r [ ] swap (shallow-fry) r> append swap dup empty? [ drop ] [ - [ swap compose ] curry append + [ prepose ] curry append ] if ; inline : (shallow-fry) ( accum quot -- result ) @@ -46,15 +46,22 @@ DEFER: (shallow-fry) shallow-fry ] if* ; +: fry-specifier? ( obj -- ? ) { , namespaces:, @ } member? ; + +: count-inputs ( quot -- n ) + [ + { + { [ dup callable? ] [ count-inputs ] } + { [ dup fry-specifier? ] [ drop 1 ] } + [ drop 0 ] + } cond + ] map sum ; + : fry ( quot -- quot' ) [ [ dup callable? [ - [ - [ { , namespaces:, @ } member? ] subset length - \ , % - ] - [ deep-fry % ] bi + [ count-inputs \ , % ] [ fry % ] bi ] [ namespaces:, ] if ] each ] [ ] make deep-fry ; diff --git a/extra/ftp/client/authors.txt b/extra/ftp/client/authors.txt new file mode 100644 index 0000000000..7c1b2f2279 --- /dev/null +++ b/extra/ftp/client/authors.txt @@ -0,0 +1 @@ +Doug Coleman diff --git a/extra/ftp/client/client.factor b/extra/ftp/client/client.factor new file mode 100644 index 0000000000..642d2ce8cd --- /dev/null +++ b/extra/ftp/client/client.factor @@ -0,0 +1,168 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors arrays classes.singleton combinators +continuations io io.encodings.binary io.encodings.utf8 +io.files io.sockets kernel io.streams.duplex math +math.parser sequences splitting namespaces strings fry ftp ; +IN: ftp.client + +: (ftp-response-code) ( str -- n ) + 3 head string>number ; + +: ftp-response-code ( string -- n/f ) + dup fourth CHAR: - = [ drop f ] [ (ftp-response-code) ] if ; + +: read-response-loop ( ftp-response -- ftp-response ) + readln + [ add-response-line ] [ ftp-response-code ] bi + over n>> = [ read-response-loop ] unless ; + +: read-response ( -- ftp-response ) + readln + [ (ftp-response-code) >>n ] + [ add-response-line ] + [ fourth CHAR: - = ] tri + [ read-response-loop ] when ; + +: ftp-command ( string -- ftp-response ) + ftp-send read-response ; + +: ftp-user ( ftp-client -- ftp-response ) + user>> "USER " prepend ftp-command ; + +: ftp-password ( ftp-client -- ftp-response ) + password>> "PASS " prepend ftp-command ; + +: ftp-set-binary ( -- ftp-response ) + "TYPE I" ftp-command ; + +: ftp-pwd ( -- ftp-response ) + "PWD" ftp-command ; + +: ftp-list ( -- ftp-response ) + "LIST" ftp-command ; + +: ftp-quit ( -- ftp-response ) + "QUIT" ftp-command ; + +: ftp-cwd ( directory -- ftp-response ) + "CWD " prepend ftp-command ; + +: ftp-retr ( filename -- ftp-response ) + "RETR " prepend ftp-command ; + +: parse-epsv ( ftp-response -- port ) + strings>> first + "|" split 2 tail* first string>number ; + +TUPLE: remote-file +type permissions links owner group size month day time year +name target ; + +: ( -- remote-file ) remote-file new ; + +: parse-permissions ( remote-file str -- remote-file ) + [ first ch>type >>type ] [ rest >>permissions ] bi ; + +: parse-list-11 ( lines -- seq ) + [ + 11 f pad-right + swap { + [ 0 swap nth parse-permissions ] + [ 1 swap nth string>number >>links ] + [ 2 swap nth >>owner ] + [ 3 swap nth >>group ] + [ 4 swap nth string>number >>size ] + [ 5 swap nth >>month ] + [ 6 swap nth >>day ] + [ 7 swap nth >>time ] + [ 8 swap nth >>name ] + [ 10 swap nth >>target ] + } cleave + ] map ; + +: parse-list-8 ( lines -- seq ) + [ + swap { + [ 0 swap nth parse-permissions ] + [ 1 swap nth string>number >>links ] + [ 2 swap nth >>owner ] + [ 3 swap nth >>size ] + [ 4 swap nth >>month ] + [ 5 swap nth >>day ] + [ 6 swap nth >>time ] + [ 7 swap nth >>name ] + } cleave + ] map ; + +: parse-list-3 ( lines -- seq ) + [ + swap { + [ 0 swap nth parse-permissions ] + [ 1 swap nth string>number >>links ] + [ 2 swap nth >>name ] + } cleave + ] map ; + +: parse-list ( ftp-response -- ftp-response ) + dup strings>> + [ " " split harvest ] map + dup length { + { 11 [ parse-list-11 ] } + { 9 [ parse-list-11 ] } + { 8 [ parse-list-8 ] } + { 3 [ parse-list-3 ] } + [ drop ] + } case >>parsed ; + +: ftp-epsv ( -- ftp-response ) + "EPSV" ftp-command ; + +ERROR: ftp-error got expected ; +: ftp-assert ( ftp-response n -- ) + 2dup >r n>> r> = [ 2drop ] [ ftp-error ] if ; + +: ftp-login ( ftp-client -- ) + read-response 220 ftp-assert + [ ftp-user 331 ftp-assert ] + [ ftp-password 230 ftp-assert ] bi + ftp-set-binary 200 ftp-assert ; + +: open-remote-port ( -- port ) + ftp-epsv + [ 229 ftp-assert ] [ parse-epsv ] bi ; + +: list ( ftp-client -- ftp-response ) + host>> open-remote-port utf8 drop + ftp-list 150 ftp-assert + lines + swap >>strings + read-response 226 ftp-assert + parse-list ; + +: ftp-get ( filename ftp-client -- ftp-response ) + host>> open-remote-port binary drop + swap + [ ftp-retr 150 ftp-assert drop ] + [ binary stream-copy ] 2bi + read-response dup 226 ftp-assert ; + +: ftp-connect ( ftp-client -- stream ) + [ host>> ] [ port>> ] bi utf8 drop ; + +GENERIC: ftp-download ( path obj -- ) + +: with-ftp-client ( ftp-client quot -- ) + dupd '[ + , [ ftp-login ] [ @ ] bi + ftp-quit drop + ] >r ftp-connect r> with-stream ; inline + +M: ftp-client ftp-download ( path ftp-client -- ) + [ + [ drop parent-directory ftp-cwd drop ] + [ >r file-name r> ftp-get drop ] 2bi + ] with-ftp-client ; + +M: string ftp-download ( path string -- ) + ftp-download ; diff --git a/extra/ftp/client/tags.txt b/extra/ftp/client/tags.txt new file mode 100644 index 0000000000..992ae12982 --- /dev/null +++ b/extra/ftp/client/tags.txt @@ -0,0 +1 @@ +network diff --git a/extra/ftp/ftp.factor b/extra/ftp/ftp.factor new file mode 100644 index 0000000000..b2b5ebc9aa --- /dev/null +++ b/extra/ftp/ftp.factor @@ -0,0 +1,63 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors arrays assocs combinators io io.files kernel +math.parser sequences strings ; +IN: ftp + +SINGLETON: active +SINGLETON: passive + +TUPLE: ftp-client host port user password mode state +command-promise ; + +: ( host -- ftp-client ) + ftp-client new + swap >>host + 21 >>port + "anonymous" >>user + "ftp@my.org" >>password ; + +: reset-ftp-client ( ftp-client -- ) + f >>user + f >>password + drop ; + +TUPLE: ftp-response n strings parsed ; + +: ( -- ftp-response ) + ftp-response new + V{ } clone >>strings ; + +: add-response-line ( ftp-response string -- ftp-response ) + over strings>> push ; + +: ftp-send ( string -- ) write "\r\n" write flush ; + +: ftp-ipv4 1 ; inline +: ftp-ipv6 2 ; inline + + +: ch>type ( ch -- type ) + { + { CHAR: d [ +directory+ ] } + { CHAR: l [ +symbolic-link+ ] } + { CHAR: - [ +regular-file+ ] } + [ drop +unknown+ ] + } case ; + +: type>ch ( type -- string ) + { + { +directory+ [ CHAR: d ] } + { +symbolic-link+ [ CHAR: l ] } + { +regular-file+ [ CHAR: - ] } + [ drop CHAR: - ] + } case ; + +: file-info>string ( file-info name -- string ) + >r [ [ type>> type>ch 1string ] [ drop "rwx------" append ] bi ] + [ size>> number>string 15 CHAR: \s pad-left ] bi r> + 3array " " join ; + +: directory-list ( -- seq ) + "" directory keys + [ [ link-info ] keep file-info>string ] map ; diff --git a/extra/ftp/server/server.factor b/extra/ftp/server/server.factor new file mode 100644 index 0000000000..cce69dde0f --- /dev/null +++ b/extra/ftp/server/server.factor @@ -0,0 +1,324 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors combinators io io.encodings.8-bit +io.encodings io.encodings.binary io.encodings.utf8 io.files +io.server io.sockets kernel math.parser namespaces sequences +ftp io.unix.launcher.parser unicode.case splitting assocs +classes io.server destructors calendar io.timeouts +io.streams.duplex threads continuations math +concurrency.promises byte-arrays ; +IN: ftp.server + +SYMBOL: client + +TUPLE: ftp-command raw tokenized ; + +: ( -- obj ) + ftp-command new ; + +TUPLE: ftp-get path ; + +: ( path -- obj ) + ftp-get new swap >>path ; + +TUPLE: ftp-put path ; + +: ( path -- obj ) + ftp-put new swap >>path ; + +TUPLE: ftp-list ; + +C: ftp-list + +: read-command ( -- ftp-command ) + readln + [ >>raw ] [ tokenize-command >>tokenized ] bi ; + +: (send-response) ( n string separator -- ) + rot number>string write write ftp-send ; + +: send-response ( ftp-response -- ) + [ n>> ] [ strings>> ] bi + [ but-last-slice [ "-" (send-response) ] with each ] + [ first " " (send-response) ] 2bi ; + +: server-response ( n string -- ) + + swap add-response-line + swap >>n + send-response ; + +: ftp-error ( string -- ) + 500 "Unrecognized command: " rot append server-response ; + +: send-banner ( -- ) + 220 "Welcome to " host-name append server-response ; + +: anonymous-only ( -- ) + 530 "This FTP server is anonymous only." server-response ; + +: handle-QUIT ( obj -- ) + drop 221 "Goodbye." server-response ; + +: handle-USER ( ftp-command -- ) + [ + tokenized>> second client get swap >>user drop + 331 "Please specify the password." server-response + ] [ + 2drop "bad USER" ftp-error + ] recover ; + +: handle-PASS ( ftp-command -- ) + [ + tokenized>> second client get swap >>password drop + 230 "Login successful" server-response + ] [ + 2drop "PASS error" ftp-error + ] recover ; + +ERROR: type-error type ; + +: parse-type ( string -- string' ) + >upper { + { "IMAGE" [ "Binary" ] } + { "I" [ "Binary" ] } + [ type-error ] + } case ; + +: handle-TYPE ( obj -- ) + [ + tokenized>> second parse-type + 200 "Switching to " rot " mode" 3append server-response + ] [ + 2drop "TYPE is binary only" ftp-error + ] recover ; + +: random-local-server ( -- server ) + remote-address get class new 0 >>port binary ; + +: port>bytes ( port -- hi lo ) + [ -8 shift ] keep [ HEX: ff bitand ] bi@ ; + +: handle-PWD ( obj -- ) + drop + 257 current-directory get "\"" swap "\"" 3append server-response ; + +: handle-SYST ( obj -- ) + drop + 215 "UNIX Type: L8" server-response ; + +: if-command-promise ( quot -- ) + >r client get command-promise>> r> + [ "Establish an active or passive connection first" ftp-error ] if* ; + +: handle-STOR ( obj -- ) + [ + tokenized>> second + [ >r r> fulfill ] if-command-promise + ] [ + 2drop + ] recover ; + +! EPRT |2|::1|62138| +! : handle-EPRT ( obj -- ) + ! tokenized>> second "|" split harvest ; + +: start-directory ( -- ) + 150 "Here comes the directory listing." server-response ; + +: finish-directory ( -- ) + 226 "Opening " server-response ; + +GENERIC: service-command ( stream obj -- ) + +M: ftp-list service-command ( stream obj -- ) + drop + start-directory + [ + utf8 encode-output + directory-list [ ftp-send ] each + ] with-output-stream + finish-directory ; + +: transfer-outgoing-file ( path -- ) + 150 "Opening BINARY mode data connection for " + rot + [ file-name ] [ + " " swap file-info file-info-size number>string + "(" " bytes)." swapd 3append append + ] bi 3append server-response ; + +: transfer-incoming-file ( path -- ) + 150 "Opening BINARY mode data connection for " rot append + server-response ; + +: finish-file-transfer ( -- ) + 226 "File send OK." server-response ; + +M: ftp-get service-command ( stream obj -- ) + [ + path>> + [ transfer-outgoing-file ] + [ binary swap stream-copy ] bi + finish-file-transfer + ] [ + 3drop "File transfer failed" ftp-error + ] recover ; + +M: ftp-put service-command ( stream obj -- ) + [ + path>> + [ transfer-incoming-file ] + [ binary stream-copy ] bi + finish-file-transfer + ] [ + 3drop "File transfer failed" ftp-error + ] recover ; + +: passive-loop ( server -- ) + [ + [ + |dispose + 30 seconds over set-timeout + accept drop &dispose + client get command-promise>> + 30 seconds ?promise-timeout + service-command + ] + [ client get f >>command-promise drop ] + [ drop ] cleanup + ] with-destructors ; + +: handle-LIST ( obj -- ) + drop + [ >r r> fulfill ] if-command-promise ; + +: handle-SIZE ( obj -- ) + [ + tokenized>> second file-info size>> + 213 swap number>string server-response + ] [ + 2drop + 550 "Could not get file size" server-response + ] recover ; + +: handle-RETR ( obj -- ) + [ tokenized>> second swap fulfill ] + curry if-command-promise ; + +: expect-connection ( -- port ) + random-local-server + client get >>command-promise drop + [ [ passive-loop ] curry in-thread ] + [ addr>> port>> ] bi ; + +: handle-PASV ( obj -- ) + drop client get passive >>mode drop + expect-connection + [ + "Entering Passive Mode (127,0,0,1," % + port>bytes [ number>string ] bi@ "," swap 3append % + ")" % + ] "" make 227 swap server-response ; + +: handle-EPSV ( obj -- ) + drop + client get command-promise>> [ + "You already have a passive stream" ftp-error + ] [ + 229 "Entering Extended Passive Mode (|||" + expect-connection number>string + "|)" 3append server-response + ] if ; + +! LPRT 6,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,242,186 +! : handle-LPRT ( obj -- ) tokenized>> "," split ; + +ERROR: not-a-directory ; + +: handle-CWD ( obj -- ) + [ + tokenized>> second dup directory? [ + set-current-directory + 250 "Directory successully changed." server-response + ] [ + not-a-directory throw + ] if + ] [ + 2drop + 550 "Failed to change directory." server-response + ] recover ; + +: unrecognized-command ( obj -- ) raw>> ftp-error ; + +: handle-client-loop ( -- ) + readln + [ >>raw ] + [ tokenize-command >>tokenized ] bi + dup tokenized>> first >upper { + { "USER" [ handle-USER t ] } + { "PASS" [ handle-PASS t ] } + { "ACCT" [ drop "ACCT unimplemented" ftp-error t ] } + { "CWD" [ handle-CWD t ] } + ! { "XCWD" [ ] } + ! { "CDUP" [ ] } + ! { "SMNT" [ ] } + + ! { "REIN" [ drop client get reset-ftp-client t ] } + { "QUIT" [ handle-QUIT f ] } + + ! { "PORT" [ ] } ! TODO + { "PASV" [ handle-PASV t ] } + ! { "MODE" [ ] } + { "TYPE" [ handle-TYPE t ] } + ! { "STRU" [ ] } + + ! { "ALLO" [ ] } + ! { "REST" [ ] } + { "STOR" [ handle-STOR t ] } + ! { "STOU" [ ] } + { "RETR" [ handle-RETR t ] } + { "LIST" [ handle-LIST t ] } + { "SIZE" [ handle-SIZE t ] } + ! { "NLST" [ ] } + ! { "APPE" [ ] } + ! { "RNFR" [ ] } + ! { "RNTO" [ ] } + ! { "DELE" [ handle-DELE t ] } + ! { "RMD" [ handle-RMD t ] } + ! ! { "XRMD" [ handle-XRMD t ] } + ! { "MKD" [ handle-MKD t ] } + { "PWD" [ handle-PWD t ] } + ! { "ABOR" [ ] } + + { "SYST" [ handle-SYST t ] } + ! { "STAT" [ ] } + ! { "HELP" [ ] } + + ! { "SITE" [ ] } + ! { "NOOP" [ ] } + + ! { "EPRT" [ handle-EPRT ] } + ! { "LPRT" [ handle-LPRT ] } + { "EPSV" [ handle-EPSV t ] } + ! { "LPSV" [ drop handle-LPSV t ] } + [ drop unrecognized-command t ] + } case [ handle-client-loop ] when ; + +: handle-client ( -- ) + [ + "" [ + host-name client set + send-banner handle-client-loop + ] with-directory + ] with-destructors ; + +: ftpd ( port -- ) + internet-server "ftp.server" + latin1 [ handle-client ] with-server ; + +: ftpd-main ( -- ) 2100 ftpd ; + +MAIN: ftpd-main + +! sudo tcpdump -i en1 -A -s 10000 tcp port 21 diff --git a/extra/ftp/server/tags.txt b/extra/ftp/server/tags.txt new file mode 100644 index 0000000000..992ae12982 --- /dev/null +++ b/extra/ftp/server/tags.txt @@ -0,0 +1 @@ +network diff --git a/extra/ftp/tags.txt b/extra/ftp/tags.txt new file mode 100644 index 0000000000..992ae12982 --- /dev/null +++ b/extra/ftp/tags.txt @@ -0,0 +1 @@ +network diff --git a/extra/furnace/actions/actions-tests.factor b/extra/furnace/actions/actions-tests.factor new file mode 100755 index 0000000000..60a526fb24 --- /dev/null +++ b/extra/furnace/actions/actions-tests.factor @@ -0,0 +1,41 @@ +USING: kernel furnace.actions validators +tools.test math math.parser multiline namespaces http +io.streams.string http.server sequences splitting accessors ; +IN: furnace.actions.tests + + + [ "a" param "b" param [ string>number ] bi@ + ] >>display +"action-1" set + +: lf>crlf "\n" split "\r\n" join ; + +STRING: action-request-test-1 +GET http://foo/bar?a=12&b=13 HTTP/1.1 + +blah +; + +[ 25 ] [ + action-request-test-1 lf>crlf + [ read-request ] with-string-reader + init-request + { } "action-1" get call-responder +] unit-test + + + "a" >>rest + [ "a" param string>number sq ] >>display +"action-2" set + +STRING: action-request-test-2 +GET http://foo/bar/123 HTTP/1.1 + +blah +; + +[ 25 ] [ + action-request-test-2 lf>crlf + [ read-request ] with-string-reader + init-request + { "5" } "action-2" get call-responder +] unit-test diff --git a/extra/furnace/actions/actions.factor b/extra/furnace/actions/actions.factor new file mode 100755 index 0000000000..1cef8e24e5 --- /dev/null +++ b/extra/furnace/actions/actions.factor @@ -0,0 +1,123 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors sequences kernel assocs combinators +validators http hashtables namespaces fry continuations locals +io arrays math boxes splitting urls +xml.entities +http.server +http.server.responses +furnace +furnace.flash +html.elements +html.components +html.components +html.templates.chloe +html.templates.chloe.syntax ; +IN: furnace.actions + +SYMBOL: params + +SYMBOL: rest + +: render-validation-messages ( -- ) + validation-messages get + dup empty? [ drop ] [ +
    + [
  • message>> escape-string write
  • ] each +
+ ] if ; + +CHLOE: validation-messages drop render-validation-messages ; + +TUPLE: action rest init display validate submit ; + +: new-action ( class -- action ) + new + [ ] >>init + [ <400> ] >>display + [ ] >>validate + [ <400> ] >>submit ; + +: ( -- action ) + action new-action ; + +: flashed-variables ( -- seq ) + { validation-messages named-validation-messages } ; + +: handle-get ( action -- response ) + '[ + , + [ init>> call ] + [ drop flashed-variables restore-flash ] + [ display>> call ] + tri + ] with-exit-continuation ; + +: validation-failed ( -- * ) + request get method>> "POST" = [ f ] [ <400> ] if exit-with ; + +: (handle-post) ( action -- response ) + [ validate>> call ] [ submit>> call ] bi ; + +: param ( name -- value ) + params get at ; + +: revalidate-url-key "__u" ; + +: check-url ( url -- ? ) + request get url>> + [ [ protocol>> ] [ host>> ] [ port>> ] tri 3array ] bi@ = ; + +: revalidate-url ( -- url/f ) + revalidate-url-key param dup [ >url dup check-url swap and ] when ; + +: handle-post ( action -- response ) + '[ + form-nesting-key params get at " " split + [ , (handle-post) ] + [ swap '[ , , nest-values ] ] reduce + call + ] with-exit-continuation + [ + revalidate-url + [ flashed-variables ] [ <403> ] if* + ] unless* ; + +: handle-rest ( path action -- assoc ) + rest>> dup [ [ "/" join ] dip associate ] [ 2drop f ] if ; + +: init-action ( path action -- ) + blank-values + init-validation + handle-rest + request get request-params assoc-union params set ; + +M: action call-responder* ( path action -- response ) + [ init-action ] keep + request get method>> { + { "GET" [ handle-get ] } + { "HEAD" [ handle-get ] } + { "POST" [ handle-post ] } + } case ; + +M: action modify-form + drop request get url>> revalidate-url-key hidden-form-field ; + +: check-validation ( -- ) + validation-failed? [ validation-failed ] when ; + +: validate-params ( validators -- ) + params get swap validate-values from-object + check-validation ; + +: validate-integer-id ( -- ) + { { "id" [ v-number ] } } validate-params ; + +TUPLE: page-action < action template ; + +: ( path -- response ) + resolve-template-path "text/html" ; + +: ( -- page ) + page-action new-action + dup '[ , template>> ] >>display ; diff --git a/extra/furnace/asides/asides.factor b/extra/furnace/asides/asides.factor new file mode 100644 index 0000000000..f6b4e2c15f --- /dev/null +++ b/extra/furnace/asides/asides.factor @@ -0,0 +1,73 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors namespaces sequences arrays kernel +assocs assocs.lib hashtables math.parser urls combinators +furnace http http.server http.server.filters furnace.sessions +html.elements html.templates.chloe.syntax ; +IN: furnace.asides + +TUPLE: asides < filter-responder ; + +C: asides + +: begin-aside* ( -- id ) + request get + [ url>> ] [ post-data>> ] [ method>> ] tri 3array + asides sget set-at-unique + session-changed ; + +: end-aside-post ( url post-data -- response ) + request [ + clone + swap >>post-data + swap >>url + ] change + request get url>> path>> split-path + asides get responder>> call-responder ; + +ERROR: end-aside-in-get-error ; + +: end-aside* ( url id -- response ) + request get method>> "POST" = [ end-aside-in-get-error ] unless + asides sget at [ + first3 { + { "GET" [ drop ] } + { "HEAD" [ drop ] } + { "POST" [ end-aside-post ] } + } case + ] [ ] ?if ; + +SYMBOL: aside-id + +: aside-id-key "__a" ; + +: begin-aside ( -- ) + begin-aside* aside-id set ; + +: end-aside ( default -- response ) + aside-id [ f ] change end-aside* ; + +M: asides call-responder* + dup asides set + aside-id-key request get request-params at aside-id set + call-next-method ; + +M: asides init-session* + H{ } clone asides sset + call-next-method ; + +M: asides link-attr ( tag -- ) + drop + "aside" optional-attr { + { "none" [ aside-id off ] } + { "begin" [ begin-aside ] } + { "current" [ ] } + { f [ ] } + } case ; + +M: asides modify-query ( query responder -- query' ) + drop + aside-id get [ aside-id-key associate assoc-union ] when* ; + +M: asides modify-form ( responder -- ) + drop aside-id get aside-id-key hidden-form-field ; diff --git a/extra/furnace/auth/auth.factor b/extra/furnace/auth/auth.factor new file mode 100755 index 0000000000..f78cea3835 --- /dev/null +++ b/extra/furnace/auth/auth.factor @@ -0,0 +1,43 @@ +! Copyright (c) 2008 Slava Pestov +! See http://factorcode.org/license.txt for BSD license. +USING: accessors assocs namespaces kernel sequences sets +http.server +http.server.filters +http.server.dispatchers +furnace.sessions +furnace.auth.providers ; +IN: furnace.auth + +SYMBOL: logged-in-user + +GENERIC: init-user-profile ( responder -- ) + +M: object init-user-profile drop ; + +M: dispatcher init-user-profile + default>> init-user-profile ; + +M: filter-responder init-user-profile + responder>> init-user-profile ; + +: profile ( -- assoc ) logged-in-user get profile>> ; + +: user-changed ( -- ) + logged-in-user get t >>changed? drop ; + +: uget ( key -- value ) + profile at ; + +: uset ( value key -- ) + profile set-at + user-changed ; + +: uchange ( quot key -- ) + profile swap change-at + user-changed ; inline + +SYMBOL: capabilities + +V{ } clone capabilities set-global + +: define-capability ( word -- ) capabilities get adjoin ; diff --git a/extra/http/server/auth/basic/basic.factor b/extra/furnace/auth/basic/basic.factor similarity index 69% rename from extra/http/server/auth/basic/basic.factor rename to extra/furnace/auth/basic/basic.factor index 04c0e62d07..c8d542c219 100755 --- a/extra/http/server/auth/basic/basic.factor +++ b/extra/furnace/auth/basic/basic.factor @@ -1,12 +1,12 @@ ! Copyright (c) 2007 Chris Double. ! See http://factorcode.org/license.txt for BSD license. USING: accessors quotations assocs kernel splitting -base64 html.elements io combinators http.server -http.server.auth.providers http.server.auth.providers.null -http sequences ; -IN: http.server.auth.basic +base64 html.elements io combinators sequences +http http.server.filters http.server.responses http.server +furnace.auth.providers furnace.auth.login ; +IN: furnace.auth.basic -TUPLE: basic-auth responder realm provider ; +TUPLE: basic-auth < filter-responder realm provider ; C: basic-auth @@ -36,6 +36,6 @@ C: basic-auth : logged-in? ( request responder -- ? ) provider>> swap "authorization" header authorization-ok? ; -M: basic-auth call-responder ( request path responder -- response ) +M: basic-auth call-responder* ( request path responder -- response ) pick over logged-in? - [ responder>> call-responder ] [ 2nip realm>> <401> ] if ; + [ call-next-method ] [ 2nip realm>> <401> ] if ; diff --git a/extra/http/server/auth/login/boilerplate.xml b/extra/furnace/auth/login/boilerplate.xml similarity index 100% rename from extra/http/server/auth/login/boilerplate.xml rename to extra/furnace/auth/login/boilerplate.xml diff --git a/extra/http/server/auth/login/edit-profile.xml b/extra/furnace/auth/login/edit-profile.xml similarity index 65% rename from extra/http/server/auth/login/edit-profile.xml rename to extra/furnace/auth/login/edit-profile.xml index 86a4e86551..6beaf5de6d 100644 --- a/extra/http/server/auth/login/edit-profile.xml +++ b/extra/furnace/auth/login/edit-profile.xml @@ -4,18 +4,18 @@ Edit Profile - + - + - + @@ -25,7 +25,7 @@ - + @@ -35,12 +35,12 @@ - + - + @@ -50,7 +50,7 @@ - + @@ -62,14 +62,7 @@

- - - invalid password - - - - passwords do not match - +

diff --git a/extra/http/server/auth/login/login-tests.factor b/extra/furnace/auth/login/login-tests.factor similarity index 52% rename from extra/http/server/auth/login/login-tests.factor rename to extra/furnace/auth/login/login-tests.factor index b69630a930..5095ebdb85 100755 --- a/extra/http/server/auth/login/login-tests.factor +++ b/extra/furnace/auth/login/login-tests.factor @@ -1,5 +1,5 @@ -IN: http.server.auth.login.tests -USING: tools.test http.server.auth.login ; +IN: furnace.auth.login.tests +USING: tools.test furnace.auth.login ; \ must-infer \ allow-registration must-infer diff --git a/extra/furnace/auth/login/login.factor b/extra/furnace/auth/login/login.factor new file mode 100755 index 0000000000..d0c4e00953 --- /dev/null +++ b/extra/furnace/auth/login/login.factor @@ -0,0 +1,388 @@ +! Copyright (c) 2008 Slava Pestov +! See http://factorcode.org/license.txt for BSD license. +USING: accessors quotations assocs kernel splitting +combinators sequences namespaces hashtables sets +fry arrays threads qualified random validators words +io +io.sockets +io.encodings.utf8 +io.encodings.string +io.binary +continuations +destructors +checksums +checksums.sha2 +validators +html.components +html.elements +urls +http +http.server +http.server.dispatchers +http.server.filters +http.server.responses +furnace +furnace.auth +furnace.auth.providers +furnace.auth.providers.db +furnace.actions +furnace.asides +furnace.flash +furnace.sessions +furnace.boilerplate ; +QUALIFIED: smtp +IN: furnace.auth.login + +: word>string ( word -- string ) + [ word-vocabulary ] [ drop ":" ] [ word-name ] tri 3append ; + +: words>strings ( seq -- seq' ) + [ word>string ] map ; + +: string>word ( string -- word ) + ":" split1 swap lookup ; + +: strings>words ( seq -- seq' ) + [ string>word ] map ; + +TUPLE: login < dispatcher users checksum ; + +TUPLE: protected < filter-responder description capabilities ; + +: users ( -- provider ) + login get users>> ; + +: encode-password ( string salt -- bytes ) + [ utf8 encode ] [ 4 >be ] bi* append + login get checksum>> checksum-bytes ; + +: >>encoded-password ( user string -- user ) + 32 random-bits [ encode-password ] keep + [ >>password ] [ >>salt ] bi* ; inline + +: valid-login? ( password user -- ? ) + [ salt>> encode-password ] [ password>> ] bi = ; + +: check-login ( password username -- user/f ) + users get-user dup [ [ valid-login? ] keep and ] [ 2drop f ] if ; + +! Destructor +TUPLE: user-saver user ; + +C: user-saver + +M: user-saver dispose + user>> dup changed?>> [ users update-user ] [ drop ] if ; + +: save-user-after ( user -- ) + &dispose drop ; + +! ! ! Login +: successful-login ( user -- response ) + username>> set-uid URL" $login" end-aside ; + +: login-failed ( -- * ) + "invalid username or password" validation-error + validation-failed ; + +: ( -- action ) + + [ + protected fget [ + [ description>> "description" set-value ] + [ capabilities>> words>strings "capabilities" set-value ] bi + ] when* + ] >>init + + { login "login" } >>template + + [ + { + { "username" [ v-required ] } + { "password" [ v-required ] } + } validate-params + + "password" value + "username" value check-login + [ successful-login ] [ login-failed ] if* + ] >>submit ; + +! ! ! New user registration + +: user-exists ( -- * ) + "username taken" validation-error + validation-failed ; + +: password-mismatch ( -- * ) + "passwords do not match" validation-error + validation-failed ; + +: same-password-twice ( -- ) + "new-password" value "verify-password" value = + [ password-mismatch ] unless ; + +: ( -- action ) + + { login "register" } >>template + + [ + { + { "username" [ v-username ] } + { "realname" [ [ v-one-line ] v-optional ] } + { "new-password" [ v-password ] } + { "verify-password" [ v-password ] } + { "email" [ [ v-email ] v-optional ] } + { "captcha" [ v-captcha ] } + } validate-params + + same-password-twice + ] >>validate + + [ + "username" value + "realname" value >>realname + "new-password" value >>encoded-password + "email" value >>email + H{ } clone >>profile + + users new-user [ user-exists ] unless* + + login get init-user-profile + + successful-login + ] >>submit ; + +! ! ! Editing user profile + +: ( -- action ) + + [ + logged-in-user get + [ username>> "username" set-value ] + [ realname>> "realname" set-value ] + [ email>> "email" set-value ] + tri + ] >>init + + { login "edit-profile" } >>template + + [ + uid "username" set-value + + { + { "realname" [ [ v-one-line ] v-optional ] } + { "password" [ ] } + { "new-password" [ [ v-password ] v-optional ] } + { "verify-password" [ [ v-password ] v-optional ] } + { "email" [ [ v-email ] v-optional ] } + } validate-params + + { "password" "new-password" "verify-password" } + [ value empty? not ] contains? [ + "password" value uid check-login + [ "incorrect password" validation-error ] unless + + same-password-twice + ] when + ] >>validate + + [ + logged-in-user get + + "new-password" value dup empty? + [ drop ] [ >>encoded-password ] if + + "realname" value >>realname + "email" value >>email + + t >>changed? + + drop + + URL" $login" end-aside + ] >>submit ; + +! ! ! Password recovery + +SYMBOL: lost-password-from + +: current-host ( -- string ) + request get url>> host>> host-name or ; + +: new-password-url ( user -- url ) + "recover-3" + swap [ + [ username>> "username" set ] + [ ticket>> "ticket" set ] + bi + ] H{ } make-assoc + derive-url ; + +: password-email ( user -- email ) + smtp: + [ "[ " % current-host % " ] password recovery" % ] "" make >>subject + lost-password-from get >>from + over email>> 1array >>to + [ + "This e-mail was sent by the application server on " % current-host % "\n" % + "because somebody, maybe you, clicked on a ``recover password'' link in the\n" % + "login form, and requested a new password for the user named ``" % + over username>> % "''.\n" % + "\n" % + "If you believe that this request was legitimate, you may click the below link in\n" % + "your browser to set a new password for your account:\n" % + "\n" % + swap new-password-url % + "\n\n" % + "Love,\n" % + "\n" % + " FactorBot\n" % + ] "" make >>body ; + +: send-password-email ( user -- ) + '[ , password-email smtp:send-email ] + "E-mail send thread" spawn drop ; + +: ( -- action ) + + { login "recover-1" } >>template + + [ + { + { "username" [ v-username ] } + { "email" [ v-email ] } + { "captcha" [ v-captcha ] } + } validate-params + ] >>validate + + [ + "email" value "username" value + users issue-ticket [ + send-password-email + ] when* + + URL" $login/recover-2" + ] >>submit ; + +: ( -- action ) + + { login "recover-2" } >>template ; + +: ( -- action ) + + [ + { + { "username" [ v-username ] } + { "ticket" [ v-required ] } + } validate-params + ] >>init + + { login "recover-3" } >>template + + [ + { + { "username" [ v-username ] } + { "ticket" [ v-required ] } + { "new-password" [ v-password ] } + { "verify-password" [ v-password ] } + } validate-params + + same-password-twice + ] >>validate + + [ + "ticket" value + "username" value + users claim-ticket [ + "new-password" value >>encoded-password + users update-user + + URL" $login/recover-4" + ] [ + <403> + ] if* + ] >>submit ; + +: ( -- action ) + + { login "recover-4" } >>template ; + +! ! ! Logout +: ( -- action ) + + [ + f set-uid + URL" $login" end-aside + ] >>submit ; + +! ! ! Authentication logic +: ( responder -- protected ) + protected new + swap >>responder ; + +: show-login-page ( -- response ) + begin-aside + URL" $login/login" { protected } ; + +: check-capabilities ( responder user -- ? ) + [ capabilities>> ] bi@ subset? ; + +M: protected call-responder* ( path responder -- response ) + dup protected set + uid dup [ + users get-user 2dup check-capabilities [ + [ logged-in-user set ] [ save-user-after ] bi + call-next-method + ] [ + 3drop show-login-page + ] if + ] [ + 3drop show-login-page + ] if ; + +M: login call-responder* ( path responder -- response ) + dup login set + call-next-method ; + +: ( responder -- responder' ) + + { login "boilerplate" } >>template ; + +: ( responder -- auth ) + login new-dispatcher + swap >>default + "login" add-responder + "logout" add-responder + users-in-db >>users + sha-256 >>checksum ; + +! ! ! Configuration + +: allow-edit-profile ( login -- login ) + + "edit your profile" >>description + + "edit-profile" add-responder ; + +: allow-registration ( login -- login ) + + "register" add-responder ; + +: allow-password-recovery ( login -- login ) + + "recover-password" add-responder + + "recover-2" add-responder + + "recover-3" add-responder + + "recover-4" add-responder ; + +: allow-edit-profile? ( -- ? ) + login get responders>> "edit-profile" swap key? ; + +: allow-registration? ( -- ? ) + login get responders>> "register" swap key? ; + +: allow-password-recovery? ( -- ? ) + login get responders>> "recover-password" swap key? ; diff --git a/extra/furnace/auth/login/login.xml b/extra/furnace/auth/login/login.xml new file mode 100644 index 0000000000..a7ac92bf44 --- /dev/null +++ b/extra/furnace/auth/login/login.xml @@ -0,0 +1,55 @@ + + + + + Login + + +

You must log in to .

+
+ + +

Your user must have the following capabilities:

+
    + +
  • +
    +
+
+ + + +
User name:
Real name:
Current password:
New password:
Verify:
E-mail:
+ + + + + + + + + + + +
User name:
Password:
+ +

+ + + + +

+ +
+ +

+ + Register + + | + + Recover Password + +

+ + diff --git a/extra/furnace/auth/login/recover-1.xml b/extra/furnace/auth/login/recover-1.xml new file mode 100644 index 0000000000..21fbe6fd39 --- /dev/null +++ b/extra/furnace/auth/login/recover-1.xml @@ -0,0 +1,39 @@ + + + + + Recover lost password: step 1 of 4 + +

Enter the username and e-mail address you used to register for this site, and you will receive a link for activating a new password.

+ + + + + + + + + + + + + + + + + + + + + + + + + +
User name:
E-mail:
Captcha:
Leave the captcha blank. Spam-bots will fill it indiscriminantly, so their attempts to e-mail you will be blocked.
+ + + +
+ +
diff --git a/extra/http/server/auth/login/recover-2.xml b/extra/furnace/auth/login/recover-2.xml similarity index 100% rename from extra/http/server/auth/login/recover-2.xml rename to extra/furnace/auth/login/recover-2.xml diff --git a/extra/furnace/auth/login/recover-3.xml b/extra/furnace/auth/login/recover-3.xml new file mode 100644 index 0000000000..2e412d1f18 --- /dev/null +++ b/extra/furnace/auth/login/recover-3.xml @@ -0,0 +1,40 @@ + + + + + Recover lost password: step 3 of 4 + +

Choose a new password for your account.

+ + + + + + + + + + + + + + + + + + + + + + + +
Password:
Verify password:
Enter your password twice to ensure it is correct.
+ +

+ + +

+ +
+ +
diff --git a/extra/http/server/auth/login/recover-4.xml b/extra/furnace/auth/login/recover-4.xml similarity index 60% rename from extra/http/server/auth/login/recover-4.xml rename to extra/furnace/auth/login/recover-4.xml index 3c10869fbd..f5d02fa858 100755 --- a/extra/http/server/auth/login/recover-4.xml +++ b/extra/furnace/auth/login/recover-4.xml @@ -4,6 +4,6 @@ Recover lost password: step 4 of 4 -

Your password has been reset. You may now log in.

+

Your password has been reset. You may now log in.

diff --git a/extra/furnace/auth/login/register.xml b/extra/furnace/auth/login/register.xml new file mode 100644 index 0000000000..9815f21945 --- /dev/null +++ b/extra/furnace/auth/login/register.xml @@ -0,0 +1,72 @@ + + + + + New User Registration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
User name:
Real name:
Specifying a real name is optional.
Password:
Verify:
Enter your password twice to ensure it is correct.
E-mail:
Specifying an e-mail address is optional. It enables the "recover password" feature.
Captcha:
Leave the captcha blank. Spam-bots will fill it indiscriminantly, so their attempts to register will be blocked.
+ +

+ + + + +

+ +
+ +
diff --git a/extra/furnace/auth/providers/assoc/assoc-tests.factor b/extra/furnace/auth/providers/assoc/assoc-tests.factor new file mode 100755 index 0000000000..8f9eeaa7a5 --- /dev/null +++ b/extra/furnace/auth/providers/assoc/assoc-tests.factor @@ -0,0 +1,35 @@ +IN: furnace.auth.providers.assoc.tests +USING: furnace.actions furnace.auth.providers +furnace.auth.providers.assoc furnace.auth.login +tools.test namespaces accessors kernel ; + + + >>users +login set + +[ t ] [ + "slava" + "foobar" >>encoded-password + "slava@factorcode.org" >>email + H{ } clone >>profile + users new-user + username>> "slava" = +] unit-test + +[ f ] [ + "slava" + H{ } clone >>profile + users new-user +] unit-test + +[ f ] [ "fdasf" "slava" check-login >boolean ] unit-test + +[ ] [ "foobar" "slava" check-login "user" set ] unit-test + +[ t ] [ "user" get >boolean ] unit-test + +[ ] [ "user" get "fdasf" >>encoded-password drop ] unit-test + +[ t ] [ "fdasf" "slava" check-login >boolean ] unit-test + +[ f ] [ "foobar" "slava" check-login >boolean ] unit-test diff --git a/extra/http/server/auth/providers/assoc/assoc.factor b/extra/furnace/auth/providers/assoc/assoc.factor similarity index 66% rename from extra/http/server/auth/providers/assoc/assoc.factor rename to extra/furnace/auth/providers/assoc/assoc.factor index 54f96480bc..f5a79d701b 100755 --- a/extra/http/server/auth/providers/assoc/assoc.factor +++ b/extra/furnace/auth/providers/assoc/assoc.factor @@ -1,8 +1,7 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -IN: http.server.auth.providers.assoc -USING: accessors assocs kernel -http.server.auth.providers ; +IN: furnace.auth.providers.assoc +USING: accessors assocs kernel furnace.auth.providers ; TUPLE: users-in-memory assoc ; @@ -15,5 +14,5 @@ M: users-in-memory get-user ( username provider -- user/f ) M: users-in-memory update-user ( user provider -- ) 2drop ; M: users-in-memory new-user ( user provider -- user/f ) - >r dup username>> r> assoc>> - 2dup key? [ 3drop f ] [ pick >r set-at r> ] if ; + [ dup username>> ] dip assoc>> + 2dup key? [ 3drop f ] [ pick [ set-at ] dip ] if ; diff --git a/extra/furnace/auth/providers/db/db-tests.factor b/extra/furnace/auth/providers/db/db-tests.factor new file mode 100755 index 0000000000..714dcb416f --- /dev/null +++ b/extra/furnace/auth/providers/db/db-tests.factor @@ -0,0 +1,47 @@ +IN: furnace.auth.providers.db.tests +USING: furnace.actions +furnace.auth.login +furnace.auth.providers +furnace.auth.providers.db tools.test +namespaces db db.sqlite db.tuples continuations +io.files accessors kernel ; + + + users-in-db >>users +login set + +[ "auth-test.db" temp-file delete-file ] ignore-errors + +"auth-test.db" temp-file sqlite-db [ + + init-users-table + + [ t ] [ + "slava" + "foobar" >>encoded-password + "slava@factorcode.org" >>email + H{ } clone >>profile + users new-user + username>> "slava" = + ] unit-test + + [ f ] [ + "slava" + H{ } clone >>profile + users new-user + ] unit-test + + [ f ] [ "fdasf" "slava" check-login >boolean ] unit-test + + [ ] [ "foobar" "slava" check-login "user" set ] unit-test + + [ t ] [ "user" get >boolean ] unit-test + + [ ] [ "user" get "fdasf" >>encoded-password drop ] unit-test + + [ ] [ "user" get users update-user ] unit-test + + [ t ] [ "fdasf" "slava" check-login >boolean ] unit-test + + [ f ] [ "foobar" "slava" check-login >boolean ] unit-test +] with-db diff --git a/extra/http/server/auth/providers/db/db.factor b/extra/furnace/auth/providers/db/db.factor similarity index 55% rename from extra/http/server/auth/providers/db/db.factor rename to extra/furnace/auth/providers/db/db.factor index deab40e8d4..66c1b3ec99 100755 --- a/extra/http/server/auth/providers/db/db.factor +++ b/extra/furnace/auth/providers/db/db.factor @@ -1,37 +1,36 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: db db.tuples db.types accessors -http.server.auth.providers kernel continuations +furnace.auth.providers kernel continuations classes.singleton ; -IN: http.server.auth.providers.db +IN: furnace.auth.providers.db user "USERS" { - { "username" "USERNAME" { VARCHAR 256 } +assigned-id+ } + { "username" "USERNAME" { VARCHAR 256 } +user-assigned-id+ } { "realname" "REALNAME" { VARCHAR 256 } } - { "password" "PASSWORD" { VARCHAR 256 } +not-null+ } + { "password" "PASSWORD" BLOB +not-null+ } + { "salt" "SALT" INTEGER +not-null+ } { "email" "EMAIL" { VARCHAR 256 } } { "ticket" "TICKET" { VARCHAR 256 } } + { "capabilities" "CAPABILITIES" FACTOR-BLOB } { "profile" "PROFILE" FACTOR-BLOB } + { "deleted" "DELETED" INTEGER +not-null+ } } define-persistent -: init-users-table user ensure-table ; +: init-users-table ( -- ) user ensure-table ; SINGLETON: users-in-db -: find-user ( username -- user ) - - swap >>username - select-tuple ; - M: users-in-db get-user - drop - find-user ; + drop select-tuple ; M: users-in-db new-user drop [ - dup username>> find-user [ + user new + over username>> >>username + select-tuple [ drop f ] [ dup insert-tuple diff --git a/extra/http/server/auth/providers/null/null.factor b/extra/furnace/auth/providers/null/null.factor similarity index 71% rename from extra/http/server/auth/providers/null/null.factor rename to extra/furnace/auth/providers/null/null.factor index 30f6dbd06e..39ea812ae7 100755 --- a/extra/http/server/auth/providers/null/null.factor +++ b/extra/furnace/auth/providers/null/null.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: http.server.auth.providers kernel ; -IN: http.server.auth.providers.null +USING: furnace.auth.providers kernel ; +IN: furnace.auth.providers.null TUPLE: no-users ; diff --git a/extra/http/server/auth/providers/providers.factor b/extra/furnace/auth/providers/providers.factor similarity index 76% rename from extra/http/server/auth/providers/providers.factor rename to extra/furnace/auth/providers/providers.factor index a867b2381e..1933fc8c59 100755 --- a/extra/http/server/auth/providers/providers.factor +++ b/extra/furnace/auth/providers/providers.factor @@ -1,12 +1,18 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel accessors random math.parser locals -sequences math crypto.sha2 ; -IN: http.server.auth.providers +sequences math ; +IN: furnace.auth.providers -TUPLE: user username realname password email ticket profile ; +TUPLE: user +username realname +password salt +email ticket capabilities profile deleted changed? ; -: user new H{ } clone >>profile ; +: ( username -- user ) + user new + swap >>username + 0 >>deleted ; GENERIC: get-user ( username provider -- user/f ) @@ -14,9 +20,6 @@ GENERIC: update-user ( user provider -- ) GENERIC: new-user ( user provider -- user/f ) -: check-login ( password username provider -- user/f ) - get-user dup [ [ password>> = ] keep and ] [ 2drop f ] if ; - ! Password recovery support :: issue-ticket ( email username provider -- user/f ) diff --git a/extra/furnace/boilerplate/boilerplate.factor b/extra/furnace/boilerplate/boilerplate.factor new file mode 100644 index 0000000000..7c5b7a0c81 --- /dev/null +++ b/extra/furnace/boilerplate/boilerplate.factor @@ -0,0 +1,25 @@ +! Copyright (c) 2008 Slava Pestov +! See http://factorcode.org/license.txt for BSD license. +USING: accessors kernel namespaces +html.templates html.templates.chloe +locals +http.server +http.server.filters +furnace ; +IN: furnace.boilerplate + +TUPLE: boilerplate < filter-responder template ; + +: ( responder -- boilerplate ) f boilerplate boa ; + +M:: boilerplate call-responder* ( path responder -- ) + path responder call-next-method + dup content-type>> "text/html" = [ + clone [| body | + [ + body + responder template>> resolve-template-path + with-boilerplate + ] + ] change-body + ] when ; diff --git a/extra/furnace/db/db-tests.factor b/extra/furnace/db/db-tests.factor new file mode 100644 index 0000000000..34357ae701 --- /dev/null +++ b/extra/furnace/db/db-tests.factor @@ -0,0 +1,4 @@ +IN: furnace.db.tests +USING: tools.test furnace.db ; + +\ must-infer diff --git a/extra/furnace/db/db.factor b/extra/furnace/db/db.factor new file mode 100755 index 0000000000..8487b4b3fc --- /dev/null +++ b/extra/furnace/db/db.factor @@ -0,0 +1,18 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: kernel accessors continuations namespaces destructors +db db.pools io.pools http.server http.server.filters +furnace.sessions ; +IN: furnace.db + +TUPLE: db-persistence < filter-responder pool ; + +: ( responder params db -- responder' ) + db-persistence boa ; + +M: db-persistence call-responder* + [ + pool>> [ acquire-connection ] keep + [ return-connection-later ] [ drop db set ] 2bi + ] + [ call-next-method ] bi ; diff --git a/extra/furnace/flash/flash.factor b/extra/furnace/flash/flash.factor new file mode 100644 index 0000000000..21fd20ccb4 --- /dev/null +++ b/extra/furnace/flash/flash.factor @@ -0,0 +1,38 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: namespaces assocs assocs.lib kernel sequences urls +http http.server http.server.filters http.server.redirection +furnace furnace.sessions ; +IN: furnace.flash + +: flash-id-key "__f" ; + +TUPLE: flash-scopes < filter-responder ; + +C: flash-scopes + +SYMBOL: flash-scope + +: fget ( key -- value ) flash-scope get at ; + +M: flash-scopes call-responder* + flash-id-key + request get request-params at + flash-scopes sget at flash-scope set + call-next-method ; + +M: flash-scopes init-session* + H{ } clone flash-scopes sset + call-next-method ; + +: make-flash-scope ( seq -- id ) + [ dup get ] H{ } map>assoc flash-scopes sget set-at-unique + session-changed ; + +: ( url seq -- response ) + make-flash-scope + [ clone ] dip flash-id-key set-query-param + ; + +: restore-flash ( seq -- ) + [ flash-scope get key? ] filter [ [ fget ] keep set ] each ; diff --git a/extra/furnace/furnace-tests.factor b/extra/furnace/furnace-tests.factor new file mode 100644 index 0000000000..223b20455d --- /dev/null +++ b/extra/furnace/furnace-tests.factor @@ -0,0 +1,35 @@ +IN: furnace.tests +USING: http.server.dispatchers http.server.responses +http.server furnace tools.test kernel namespaces accessors +io.streams.string ; +TUPLE: funny-dispatcher < dispatcher ; + +: funny-dispatcher new-dispatcher ; + +TUPLE: base-path-check-responder ; + +C: base-path-check-responder + +M: base-path-check-responder call-responder* + 2drop + "$funny-dispatcher" resolve-base-path + "text/plain" ; + +[ ] [ + + + + "c" add-responder + "b" add-responder + "a" add-responder + main-responder set +] unit-test + +[ "/a/b/" ] [ + V{ } responder-nesting set + "a/b/c" split-path main-responder get call-responder body>> +] unit-test + +[ "" ] +[ [ "&&&" "foo" hidden-form-field ] with-string-writer ] +unit-test diff --git a/extra/furnace/furnace.factor b/extra/furnace/furnace.factor new file mode 100644 index 0000000000..99ccf33eec --- /dev/null +++ b/extra/furnace/furnace.factor @@ -0,0 +1,193 @@ +! Copyright (C) 2003, 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors arrays kernel combinators assocs +continuations namespaces sequences splitting words +vocabs.loader classes strings +fry urls multiline present +xml +xml.data +xml.entities +xml.writer +html.components +html.elements +html.templates +html.templates.chloe +html.templates.chloe.syntax +http +http.server +http.server.redirection +http.server.responses +qualified ; +QUALIFIED-WITH: assocs a +EXCLUDE: xml.utilities => children>string ; +IN: furnace + +: nested-responders ( -- seq ) + responder-nesting get a:values ; + +: each-responder ( quot -- ) + nested-responders swap each ; inline + +: base-path ( string -- pair ) + dup responder-nesting get + [ second class word-name = ] with find nip + [ first ] [ "No such responder: " swap append throw ] ?if ; + +: resolve-base-path ( string -- string' ) + "$" ?head [ + [ + "/" split1 [ base-path [ "/" % % ] each "/" % ] dip % + ] "" make + ] when ; + +: vocab-path ( vocab -- path ) + dup vocab-dir vocab-append-path ; + +: resolve-template-path ( pair -- path ) + [ + first2 [ word-vocabulary vocab-path % ] [ "/" % % ] bi* + ] "" make ; + +GENERIC: modify-query ( query responder -- query' ) + +M: object modify-query drop ; + +GENERIC: adjust-url ( url -- url' ) + +M: url adjust-url + clone + [ [ modify-query ] each-responder ] change-query + [ resolve-base-path ] change-path + relative-to-request ; + +M: string adjust-url ; + +: ( url -- response ) + adjust-url request get method>> { + { "GET" [ ] } + { "HEAD" [ ] } + { "POST" [ ] } + } case ; + +GENERIC: modify-form ( responder -- ) + +M: object modify-form drop ; + +: request-params ( request -- assoc ) + dup method>> { + { "GET" [ url>> query>> ] } + { "HEAD" [ url>> query>> ] } + { "POST" [ + post-data>> + dup content-type>> "application/x-www-form-urlencoded" = + [ content>> ] [ drop f ] if + ] } + } case ; + +SYMBOL: exit-continuation + +: exit-with ( value -- ) + exit-continuation get continue-with ; + +: with-exit-continuation ( quot -- ) + '[ exit-continuation set @ ] callcc1 exit-continuation off ; + +! Chloe tags +: parse-query-attr ( string -- assoc ) + dup empty? + [ drop f ] [ "," split [ dup value ] H{ } map>assoc ] if ; + +CHLOE: atom + [ children>string ] + [ "href" required-attr ] + [ "query" optional-attr parse-query-attr ] tri + + swap >>query + swap >>path + adjust-url relative-to-request + add-atom-feed ; + +CHLOE: write-atom drop write-atom-feeds ; + +GENERIC: link-attr ( tag responder -- ) + +M: object link-attr 2drop ; + +: link-attrs ( tag -- ) + '[ , _ link-attr ] each-responder ; + +: a-start-tag ( tag -- ) + [ + + swap >>query + swap >>path + adjust-url relative-to-request =href + a> + ] with-scope ; + +CHLOE: a + [ a-start-tag ] + [ process-tag-children ] + [ drop ] + tri ; + +: hidden-form-field ( value name -- ) + over [ + + ] [ 2drop ] if ; + +: form-nesting-key "__n" ; + +: form-magic ( tag -- ) + [ modify-form ] each-responder + nested-values get " " join f like form-nesting-key hidden-form-field + "for" optional-attr [ "," split [ hidden render ] each ] when* ; + +: form-start-tag ( tag -- ) + [ + [ +
+ ] + [ form-magic ] bi + ] with-scope ; + +CHLOE: form + [ form-start-tag ] + [ process-tag-children ] + [ drop
] + tri ; + +STRING: button-tag-markup + + + +; + +: add-tag-attrs ( attrs tag -- ) + tag-attrs swap update ; + +CHLOE: button + button-tag-markup string>xml delegate + { + [ [ tag-attrs chloe-attrs-only ] dip add-tag-attrs ] + [ [ tag-attrs non-chloe-attrs-only ] dip "button" tag-named add-tag-attrs ] + [ [ children>string 1array ] dip "button" tag-named set-tag-children ] + [ nip ] + } 2cleave process-chloe-tag ; diff --git a/extra/furnace/json/json.factor b/extra/furnace/json/json.factor new file mode 100644 index 0000000000..a5188cd355 --- /dev/null +++ b/extra/furnace/json/json.factor @@ -0,0 +1,7 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: json.writer http.server.responses ; +IN: furnace.json + +: ( body -- response ) + >json "application/json" ; diff --git a/extra/furnace/sessions/authors.txt b/extra/furnace/sessions/authors.txt new file mode 100755 index 0000000000..7c1b2f2279 --- /dev/null +++ b/extra/furnace/sessions/authors.txt @@ -0,0 +1 @@ +Doug Coleman diff --git a/extra/furnace/sessions/sessions-tests.factor b/extra/furnace/sessions/sessions-tests.factor new file mode 100755 index 0000000000..a7a663ffa8 --- /dev/null +++ b/extra/furnace/sessions/sessions-tests.factor @@ -0,0 +1,152 @@ +IN: furnace.sessions.tests +USING: tools.test http furnace.sessions +furnace.actions http.server http.server.responses +math namespaces kernel accessors +prettyprint io.streams.string io.files splitting destructors +sequences db db.sqlite continuations urls math.parser +furnace ; + +: with-session + [ + [ [ save-session-after ] [ session set ] bi ] dip call + ] with-destructors ; inline + +TUPLE: foo ; + +C: foo + +M: foo init-session* drop 0 "x" sset ; + +M: foo call-responder* + 2drop + "x" [ 1+ ] schange + "x" sget number>string "text/html" ; + +: url-responder-mock-test + [ + + "GET" >>method + dup url>> + "id" get session-id-key set-query-param + "/" >>path drop + init-request + { } sessions get call-responder + [ write-response-body drop ] with-string-writer + ] with-destructors ; + +: sessions-mock-test + [ + + "GET" >>method + "cookies" get >>cookies + dup url>> "/" >>path drop + init-request + { } sessions get call-responder + [ write-response-body drop ] with-string-writer + ] with-destructors ; + +: + + [ [ ] "text/plain" exit-with ] >>display ; + +[ "auth-test.db" temp-file sqlite-db delete-file ] ignore-errors + +"auth-test.db" temp-file sqlite-db [ + + init-request + init-sessions-table + + [ ] [ + + sessions set + ] unit-test + + [ + [ ] [ + empty-session + 123 >>id session set + ] unit-test + + [ ] [ 3 "x" sset ] unit-test + + [ 9 ] [ "x" sget sq ] unit-test + + [ ] [ "x" [ 1- ] schange ] unit-test + + [ 4 ] [ "x" sget sq ] unit-test + + [ t ] [ session get changed?>> ] unit-test + ] with-scope + + [ t ] [ + begin-session id>> + get-session session? + ] unit-test + + [ { 5 0 } ] [ + [ + begin-session + dup [ 5 "a" sset ] with-session + dup [ "a" sget , ] with-session + dup [ "x" sget , ] with-session + drop + ] { } make + ] unit-test + + [ 0 ] [ + begin-session id>> + get-session [ "x" sget ] with-session + ] unit-test + + [ { 5 0 } ] [ + [ + begin-session id>> + dup get-session [ 5 "a" sset ] with-session + dup get-session [ "a" sget , ] with-session + dup get-session [ "x" sget , ] with-session + drop + ] { } make + ] unit-test + + [ ] [ + + sessions set + ] unit-test + + [ + + "GET" >>method + dup url>> "/" >>path drop + request set + { "etc" } sessions get call-responder response set + [ "1" ] [ [ response get write-response-body drop ] with-string-writer ] unit-test + response get + ] with-destructors + response set + + [ ] [ response get cookies>> "cookies" set ] unit-test + + [ "2" ] [ sessions-mock-test ] unit-test + [ "3" ] [ sessions-mock-test ] unit-test + [ "4" ] [ sessions-mock-test ] unit-test + + [ + [ ] [ + + "GET" >>method + dup url>> + "id" get session-id-key set-query-param + "/" >>path drop + request set + + [ + { } + call-responder + ] with-destructors response set + ] unit-test + + [ "text/plain" ] [ response get content-type>> ] unit-test + + [ f ] [ response get cookies>> empty? ] unit-test + ] with-scope +] with-db diff --git a/extra/furnace/sessions/sessions.factor b/extra/furnace/sessions/sessions.factor new file mode 100755 index 0000000000..b046ee40eb --- /dev/null +++ b/extra/furnace/sessions/sessions.factor @@ -0,0 +1,149 @@ +! Copyright (C) 2008 Doug Coleman, Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: assocs kernel math.intervals math.parser namespaces +random accessors quotations hashtables sequences continuations +fry calendar combinators destructors alarms +db db.tuples db.types +http http.server http.server.dispatchers http.server.filters +html.elements furnace ; +IN: furnace.sessions + +TUPLE: session id expires uid namespace changed? ; + +: ( id -- session ) + session new + swap >>id ; + +session "SESSIONS" +{ + { "id" "ID" +random-id+ system-random-generator } + { "expires" "EXPIRES" TIMESTAMP +not-null+ } + { "uid" "UID" { VARCHAR 255 } } + { "namespace" "NAMESPACE" FACTOR-BLOB } +} define-persistent + +: get-session ( id -- session ) + dup [ select-tuple ] when ; + +: init-sessions-table ( -- ) session ensure-table ; + +: start-expiring-sessions ( db seq -- ) + '[ + , , [ + session new + -1.0/0.0 now [a,b] >>expires + delete-tuples + ] with-db + ] 5 minutes every drop ; + +GENERIC: init-session* ( responder -- ) + +M: object init-session* drop ; + +M: dispatcher init-session* default>> init-session* ; + +M: filter-responder init-session* responder>> init-session* ; + +TUPLE: sessions < filter-responder timeout domain ; + +: ( responder -- responder' ) + sessions new + swap >>responder + 20 minutes >>timeout ; + +: (session-changed) ( session -- ) + t >>changed? drop ; + +: session-changed ( -- ) + session get (session-changed) ; + +: sget ( key -- value ) + session get namespace>> at ; + +: sset ( value key -- ) + session get + [ namespace>> set-at ] [ (session-changed) ] bi ; + +: schange ( key quot -- ) + session get + [ namespace>> swap change-at ] keep + (session-changed) ; inline + +: uid ( -- uid ) + session get uid>> ; + +: set-uid ( uid -- ) + session get [ (>>uid) ] [ (session-changed) ] bi ; + +: init-session ( session -- ) + session [ sessions get init-session* ] with-variable ; + +: cutoff-time ( -- time ) + sessions get timeout>> from-now ; + +: touch-session ( session -- ) + cutoff-time >>expires drop ; + +: empty-session ( -- session ) + f + H{ } clone >>namespace + dup touch-session ; + +: begin-session ( -- session ) + empty-session [ init-session ] [ insert-tuple ] [ ] tri ; + +! Destructor +TUPLE: session-saver session ; + +C: session-saver + +M: session-saver dispose + session>> dup changed?>> [ + [ touch-session ] [ update-tuple ] bi + ] [ drop ] if ; + +: save-session-after ( session -- ) + &dispose drop ; + +: existing-session ( path session -- response ) + [ session set ] [ save-session-after ] bi + sessions get responder>> call-responder ; + +: session-id-key "__s" ; + +: cookie-session-id ( request -- id/f ) + session-id-key get-cookie + dup [ value>> string>number ] when ; + +: post-session-id ( request -- id/f ) + session-id-key swap request-params at string>number ; + +: request-session-id ( -- id/f ) + request get dup method>> { + { "GET" [ cookie-session-id ] } + { "HEAD" [ cookie-session-id ] } + { "POST" [ post-session-id ] } + } case ; + +: request-session ( -- session/f ) + request-session-id get-session ; + +: ( id -- cookie ) + session-id-key + "$sessions" resolve-base-path >>path + sessions get timeout>> from-now >>expires + sessions get domain>> >>domain ; + +: put-session-cookie ( response -- response' ) + session get id>> number>string put-cookie ; + +M: sessions modify-form ( responder -- ) + drop session get id>> session-id-key hidden-form-field ; + +M: sessions call-responder* ( path responder -- response ) + sessions set + request-session [ begin-session ] unless* + existing-session put-session-cookie ; + +: logout-all-sessions ( uid -- ) + session new swap >>uid delete-tuples ; diff --git a/extra/furnace/syndication/syndication.factor b/extra/furnace/syndication/syndication.factor new file mode 100644 index 0000000000..7f60bcc746 --- /dev/null +++ b/extra/furnace/syndication/syndication.factor @@ -0,0 +1,53 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors kernel sequences fry sequences.lib +combinators syndication +http.server.responses http.server.redirection +furnace furnace.actions ; +IN: furnace.syndication + +GENERIC: feed-entry-title ( object -- string ) + +GENERIC: feed-entry-date ( object -- timestamp ) + +GENERIC: feed-entry-url ( object -- url ) + +GENERIC: feed-entry-description ( object -- description ) + +M: object feed-entry-description drop f ; + +GENERIC: >entry ( object -- entry ) + +M: entry >entry ; + +M: object >entry + + swap { + [ feed-entry-title >>title ] + [ feed-entry-date >>date ] + [ feed-entry-url >>url ] + [ feed-entry-description >>description ] + } cleave ; + +: process-entries ( seq -- seq' ) + 20 short head-slice [ + >entry clone + [ adjust-url relative-to-request ] change-url + ] map ; + +: ( body -- response ) + feed>xml "application/atom+xml" ; + +TUPLE: feed-action < action title url entries ; + +: ( -- action ) + feed-action new-action + dup '[ + feed new + , + [ title>> call >>title ] + [ url>> call adjust-url relative-to-request >>url ] + [ entries>> call process-entries >>entries ] + tri + + ] >>display ; diff --git a/extra/gap-buffer/gap-buffer.factor b/extra/gap-buffer/gap-buffer.factor index d3b946afe9..55a1276dd4 100644 --- a/extra/gap-buffer/gap-buffer.factor +++ b/extra/gap-buffer/gap-buffer.factor @@ -4,7 +4,8 @@ ! gap buffer -- largely influenced by Strandh and Villeneuve's Flexichain ! for a good introduction see: ! http://p-cos.net/lisp-ecoop/submissions/StrandhVilleneuveMoore.pdf -USING: kernel arrays sequences sequences.private circular math math.functions generic ; +USING: kernel arrays sequences sequences.private circular math +math.order math.functions generic ; IN: gap-buffer ! gap-start -- the first element of the gap diff --git a/extra/gap-buffer/tags.txt b/extra/gap-buffer/tags.txt index fd3a2d285a..b5e4471134 100644 --- a/extra/gap-buffer/tags.txt +++ b/extra/gap-buffer/tags.txt @@ -1,2 +1,2 @@ collections -collections sequences +sequences diff --git a/extra/io/nonblocking/authors.txt b/extra/geo-ip/authors.txt similarity index 100% rename from extra/io/nonblocking/authors.txt rename to extra/geo-ip/authors.txt diff --git a/extra/geo-ip/geo-ip.factor b/extra/geo-ip/geo-ip.factor new file mode 100644 index 0000000000..06a84929ba --- /dev/null +++ b/extra/geo-ip/geo-ip.factor @@ -0,0 +1,46 @@ +USING: kernel sequences io.files io.launcher io.encodings.ascii +io.streams.string http.client sequences.lib combinators +math.parser math.vectors math.intervals interval-maps memoize +csv accessors assocs strings math splitting ; +IN: geo-ip + +: db-path ( -- path ) "IpToCountry.csv" temp-file ; + +: db-url ( -- url ) "http://software77.net/cgi-bin/ip-country/geo-ip.pl?action=download" ; + +: download-db ( -- path ) + db-path dup exists? [ + db-url over ".gz" append download-to + { "gunzip" } over ".gz" append (normalize-path) suffix try-process + ] unless ; + +TUPLE: ip-entry from to registry assigned city cntry country ; + +: parse-ip-entry ( row -- ip-entry ) + 7 firstn { + [ string>number ] + [ string>number ] + [ ] + [ ] + [ ] + [ ] + [ ] + } spread ip-entry boa ; + +MEMO: ip-db ( -- seq ) + download-db ascii file-lines + [ "#" head? not ] filter "\n" join csv + [ parse-ip-entry ] map ; + +MEMO: ip-intervals ( -- interval-map ) + ip-db [ [ [ from>> ] [ to>> ] bi [a,b] ] keep ] { } map>assoc + ; + +GENERIC: lookup-ip ( ip -- ip-entry ) + +M: string lookup-ip + "." split [ string>number ] map + { HEX: 1000000 HEX: 10000 HEX: 100 1 } v. + lookup-ip ; + +M: integer lookup-ip ip-intervals interval-at ; diff --git a/extra/geo-ip/summary.txt b/extra/geo-ip/summary.txt new file mode 100644 index 0000000000..402d3230f1 --- /dev/null +++ b/extra/geo-ip/summary.txt @@ -0,0 +1 @@ +IP address geolocation using database from http://software77.net/cgi-bin/ip-country/ diff --git a/extra/geo-ip/tags.txt b/extra/geo-ip/tags.txt new file mode 100644 index 0000000000..0aef4feca8 --- /dev/null +++ b/extra/geo-ip/tags.txt @@ -0,0 +1 @@ +enterprise diff --git a/extra/gesture-logger/gesture-logger.factor b/extra/gesture-logger/gesture-logger.factor index 1977efd3f9..b9de7c1b74 100644 --- a/extra/gesture-logger/gesture-logger.factor +++ b/extra/gesture-logger/gesture-logger.factor @@ -15,13 +15,13 @@ TUPLE: gesture-logger stream ; M: gesture-logger handle-gesture* drop dup T{ button-down } = [ over request-focus ] when - swap gesture-logger-stream [ . ] with-stream* + swap gesture-logger-stream [ . ] with-output-stream* t ; M: gesture-logger user-input* gesture-logger-stream [ "User input: " write print - ] with-stream* t ; + ] with-output-stream* t ; : gesture-logger ( -- ) [ diff --git a/extra/globs/globs.factor b/extra/globs/globs.factor index 7204693016..c7d5413a47 100755 --- a/extra/globs/globs.factor +++ b/extra/globs/globs.factor @@ -1,18 +1,22 @@ ! Copyright (C) 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: parser-combinators regexp lazy-lists sequences kernel +USING: parser-combinators regexp lists sequences kernel promises strings unicode.case ; IN: globs [ >lower token ] <@ ; +: 'string' ( -- parser ) + 'char' <+> [ >lower token ] <@ ; -: 'escaped-char' "\\" token any-char-parser &> [ 1token ] <@ ; +: 'escaped-char' ( -- parser ) + "\\" token any-char-parser &> [ 1token ] <@ ; -: 'escaped-string' 'string' 'escaped-char' <|> ; +: 'escaped-string' ( -- parser ) + 'string' 'escaped-char' <|> ; DEFER: 'term' @@ -23,7 +27,7 @@ DEFER: 'term' 'glob' "," token nonempty-list-of "{" "}" surrounded-by [ ] <@ ; -LAZY: 'term' +LAZY: 'term' ( -- parser ) 'union' 'character-class' <|> "?" token [ drop any-char-parser ] <@ <|> @@ -32,7 +36,7 @@ LAZY: 'term' PRIVATE> -: 'glob' just parse-1 just ; +: ( string -- glob ) 'glob' just parse-1 just ; : glob-matches? ( input glob -- ? ) - >r >lower r> parse nil? not ; + [ >lower ] [ ] bi* parse nil? not ; diff --git a/extra/graphics/bitmap/bitmap.factor b/extra/graphics/bitmap/bitmap.factor index 861894c8f4..611319e28b 100755 --- a/extra/graphics/bitmap/bitmap.factor +++ b/extra/graphics/bitmap/bitmap.factor @@ -1,9 +1,9 @@ ! Copyright (C) 2007 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: alien arrays byte-arrays combinators -graphics.viewer io io.binary io.files kernel libc math -math.functions namespaces opengl opengl.gl prettyprint +USING: alien arrays byte-arrays combinators inspector +io.backend graphics.viewer io io.binary io.files kernel libc +math math.functions namespaces opengl opengl.gl prettyprint sequences strings ui ui.gadgets.panes io.encodings.binary ; IN: graphics.bitmap @@ -25,10 +25,14 @@ TUPLE: bitmap magic size reserved offset header-length width { 1 [ "1bit" throw ] } } case ; +ERROR: bitmap-magic ; + +M: bitmap-magic summary + drop "First two bytes of bitmap stream must be 'BM'" ; + : parse-file-header ( bitmap -- ) - 2 read [ over set-bitmap-magic ] keep "BM" = [ - "BITMAPFILEHEADER: First two bytes must be BM" throw - ] unless + 2 read >string dup "BM" = [ bitmap-magic ] unless + over set-bitmap-magic 4 read le> over set-bitmap-size 4 read le> over set-bitmap-reserved 4 read le> swap set-bitmap-offset ; @@ -59,7 +63,7 @@ TUPLE: bitmap magic size reserved offset header-length width dup color-index-length read swap set-bitmap-color-index ; : load-bitmap ( path -- bitmap ) - binary [ + normalize-path binary [ T{ bitmap } clone dup parse-file-header dup parse-bitmap-header @@ -113,20 +117,18 @@ M: bitmap height ( bitmap -- ) bitmap-height ; : bitmap. ( path -- ) load-bitmap gadget. ; -: bitmap-window ( path -- ) - load-bitmap [ "bitmap" open-window ] keep ; +: bitmap-window ( path -- gadget ) + load-bitmap [ "bitmap" open-window ] keep ; : test-bitmap24 ( -- ) - "extra/graphics/bitmap/test-data/thiswayup24.bmp" resource-path bitmap. ; + "resource:extra/graphics/bitmap/test-images/thiswayup24.bmp" bitmap. ; : test-bitmap8 ( -- ) - "extra/graphics/bitmap/test-data/rgb8bit.bmp" resource-path bitmap. ; + "resource:extra/graphics/bitmap/test-images/rgb8bit.bmp" bitmap. ; : test-bitmap4 ( -- ) - "extra/graphics/bitmap/test-data/rgb4bit.bmp" resource-path - load-bitmap ; - ! bitmap. ; + "resource:extra/graphics/bitmap/test-images/rgb4bit.bmp" bitmap. ; : test-bitmap1 ( -- ) - "extra/graphics/bitmap/test-data/1bit.bmp" resource-path bitmap. ; + "resource:extra/graphics/bitmap/test-images/1bit.bmp" bitmap. ; diff --git a/extra/hardware-info/linux/linux.factor b/extra/hardware-info/linux/linux.factor index de7b3f40a5..ba0cb0c170 100644 --- a/extra/hardware-info/linux/linux.factor +++ b/extra/hardware-info/linux/linux.factor @@ -1,4 +1,4 @@ -USING: alien alien.c-types kernel math sequences strings +USING: unix alien alien.c-types kernel math sequences strings io.unix.backend splitting ; IN: hardware-info.linux @@ -7,7 +7,7 @@ IN: hardware-info.linux : uname ( -- seq ) 65536 "char" [ (uname) io-error ] keep - "\0" split [ empty? not ] subset [ >string ] map + "\0" split harvest [ >string ] map 6 "" pad-right ; : sysname ( -- string ) uname first ; @@ -18,4 +18,4 @@ IN: hardware-info.linux : domainname ( -- string ) uname 5 swap nth ; : kernel-version ( -- seq ) - release ".-" split [ ] subset 5 "" pad-right ; + release ".-" split harvest 5 "" pad-right ; diff --git a/extra/hardware-info/windows/nt/nt.factor b/extra/hardware-info/windows/nt/nt.factor index 2599a33754..51af5c5949 100755 --- a/extra/hardware-info/windows/nt/nt.factor +++ b/extra/hardware-info/windows/nt/nt.factor @@ -35,7 +35,8 @@ M: winnt total-virtual-mem ( -- n ) M: winnt available-virtual-mem ( -- n ) memory-status MEMORYSTATUSEX-ullAvailVirtual ; -: pull-win32-string [ utf16n alien>string ] keep free ; +: pull-win32-string ( alien -- string ) + [ utf16n alien>string ] keep free ; : computer-name ( -- string ) MAX_COMPUTERNAME_LENGTH 1+ [ malloc ] keep diff --git a/extra/hello-world/hello-world.factor b/extra/hello-world/hello-world.factor index 709ecb1b58..03b3db9cfd 100644 --- a/extra/hello-world/hello-world.factor +++ b/extra/hello-world/hello-world.factor @@ -1,6 +1,6 @@ USE: io IN: hello-world -: hello "Hello world" print ; +: hello ( -- ) "Hello world" print ; MAIN: hello diff --git a/extra/help/cookbook/cookbook.factor b/extra/help/cookbook/cookbook.factor index 9b21bf7fff..9228666491 100755 --- a/extra/help/cookbook/cookbook.factor +++ b/extra/help/cookbook/cookbook.factor @@ -11,7 +11,7 @@ $nl $nl "Factor evaluates code left to right, and stores intermediate values on a " { $emphasis "stack" } ". If you think of the stack as a pile of papers, then " { $emphasis "pushing" } " a value on the stack corresponds to placing a piece of paper at the top of the pile, while " { $emphasis "popping" } " a value corresponds to removing the topmost piece." $nl -"Most words have a " { $emphasis "stack effect declaration" } ", for example " { $snippet "( x y -- z )" } " denotes that a word takes two inputs, with " { $snippet "y" } " at the top of the stack, and returns one output. Stack effect declarations can be viewed by browsing source code, or using tools such as " { $link see } ". See " { $link "effect-declaration" } "." +"All words except those which only push literals on the stack must have a " { $emphasis "stack effect declaration" } ", for example " { $snippet "( x y -- z )" } " denotes that a word takes two inputs, with " { $snippet "y" } " at the top of the stack, and returns one output. Stack effect declarations can be viewed by browsing source code, or using tools such as " { $link see } "; they are also checked by the compiler. See " { $link "effect-declaration" } "." $nl "Coming back to the example in the beginning of this article, the following series of steps occurs as the code is evaluated:" { $table @@ -41,7 +41,7 @@ ARTICLE: "cookbook-colon-defs" "Shuffle word and definition cookbook" "The " { $link dup } " word makes a copy of the value at the top of the stack:" { $example "5 dup * ." "25" } "The " { $link sq } " word is actually defined as follows:" -{ $code ": sq dup * ;" } +{ $code ": sq ( x -- y ) dup * ;" } "(You could have looked this up yourself by clicking on the " { $link sq } " word itself.)" $nl "Note the key elements in a word definition: The colon " { $link POSTPONE: : } " denotes the start of a word definition. The name of the new word must immediately follow. The word definition then continues on until the " { $link POSTPONE: ; } " token signifies the end of the definition. This type of word definition is called a " { $emphasis "compound definition." } @@ -60,11 +60,13 @@ $nl "This syntax will be familiar to anybody who has used Forth before. However the behavior is slightly different. In most Forth systems, the below code prints 2, because the definition of " { $snippet "b" } " still refers to the previous definition of " { $snippet "a" } ":" { $code ": a 1 ;" - ": b a 1 + ;" + ": b ( -- x ) a 1 + ;" ": a 2 ;" "b ." } "In Factor, this example will print 3 since word redefinition is explicitly supported." + $nl + "Indeed, redefining a word twice in the same source file is an error; this is almost always a mistake since there's no way to call the first definition. See " { $link "definition-checking" } "." } { $references { "A whole slew of shuffle words can be used to rearrange the stack. There are forms of word definition other than colon definition, words can be defined entirely at runtime, and word definitions can be " { $emphasis "annotated" } " with tracing calls and breakpoints without modifying the source code." } @@ -111,7 +113,7 @@ $nl "You can create a new array, only containing elements which satisfy some condition:" { $example ": negative? ( n -- ? ) 0 < ;" - "{ -12 10 16 0 -1 -3 -9 } [ negative? ] subset ." + "{ -12 10 16 0 -1 -3 -9 } [ negative? ] filter ." "{ -12 -1 -3 -9 }" } { $references @@ -205,8 +207,8 @@ ARTICLE: "cookbook-io" "Input and output cookbook" } "Send some bytes to a remote host:" { $code - "\"myhost\" 1033 " - "[ { 12 17 102 } >string write ] with-stream" + "\"myhost\" 1033 " + "[ { 12 17 102 } >string write ] with-client" } { $references { } diff --git a/extra/help/crossref/crossref.factor b/extra/help/crossref/crossref.factor index 0b17461a99..54ede93aa1 100644 --- a/extra/help/crossref/crossref.factor +++ b/extra/help/crossref/crossref.factor @@ -14,7 +14,7 @@ M: link uses collect-elements [ \ f or ] map ; : help-path ( topic -- seq ) - [ article-parent ] follow 1 tail ; + [ article-parent ] follow rest ; : set-article-parents ( parent article -- ) article-children [ set-article-parent ] with each ; diff --git a/extra/help/handbook/handbook.factor b/extra/help/handbook/handbook.factor index 15e3b8be1d..863a538b47 100755 --- a/extra/help/handbook/handbook.factor +++ b/extra/help/handbook/handbook.factor @@ -31,7 +31,7 @@ $nl { { $snippet "set-" { $emphasis "foo" } } { "sets " { $snippet "foo" } " to a new value" } { $links set-length } } { { $snippet { $emphasis "foo" } "-" { $emphasis "bar" } } { "(tuple accessors) outputs the value of the " { $snippet "bar" } " slot of the " { $snippet "foo" } " at the top of the stack" } { } } { { $snippet "set-" { $emphasis "foo" } "-" { $emphasis "bar" } } { "(tuple mutators) sets the value of the " { $snippet "bar" } " slot of the " { $snippet "foo" } " at the top of the stack" } { } } - { { $snippet "with-" { $emphasis "foo" } } { "performs some kind of initialization and cleanup related to " { $snippet "foo" } ", usually in a new dynamic scope" } { $links with-scope with-stream } } + { { $snippet "with-" { $emphasis "foo" } } { "performs some kind of initialization and cleanup related to " { $snippet "foo" } ", usually in a new dynamic scope" } { $links with-scope with-input-stream with-output-stream } } { { $snippet "$" { $emphasis "foo" } } { "help markup" } { $links $heading $emphasis } } } { $heading "Stack effect conventions" } @@ -104,6 +104,8 @@ $nl ARTICLE: "objects" "Objects" "An " { $emphasis "object" } " is any datum which may be identified. All values are objects in Factor. Each object carries type information, and types are checked at runtime; Factor is dynamically typed." { $subsection "equality" } +{ $subsection "math.order" } +{ $subsection "destructors" } { $subsection "classes" } { $subsection "tuples" } { $subsection "generic" } @@ -192,18 +194,22 @@ ARTICLE: "io" "Input and output" "Utilities:" { $subsection "stream-binary" } { $subsection "styles" } -{ $heading "Files" } -{ $subsection "io.files" } -{ $subsection "io.mmap" } -{ $subsection "io.monitors" } { $heading "Encodings" } { $subsection "encodings-introduction" } { $subsection "io.encodings" } { $subsection "io.encodings.string" } -{ $heading "Other features" } +{ $heading "Files" } +{ $subsection "io.files" } +{ $subsection "io.mmap" } +{ $subsection "io.monitors" } +{ $heading "Communications" } { $subsection "network-streams" } { $subsection "io.launcher" } -{ $subsection "io.timeouts" } ; +{ $subsection "io.pipes" } +{ $heading "Other features" } +{ $subsection "io.timeouts" } +{ $subsection "checksums" } +{ $see-also "destructors" } ; ARTICLE: "tools" "Developer tools" { $subsection "tools.vocabs" } @@ -228,13 +234,13 @@ ARTICLE: "article-index" "Article index" { $index [ articles get keys ] } ; ARTICLE: "primitive-index" "Primitive index" -{ $index [ all-words [ primitive? ] subset ] } ; +{ $index [ all-words [ primitive? ] filter ] } ; ARTICLE: "error-index" "Error index" { $index [ all-errors ] } ; ARTICLE: "type-index" "Type index" -{ $index [ builtins get [ ] subset ] } ; +{ $index [ builtins get sift ] } ; ARTICLE: "class-index" "Class index" { $index [ classes ] } ; diff --git a/extra/help/help-docs.factor b/extra/help/help-docs.factor index 1d2af5fb39..f20ce89263 100755 --- a/extra/help/help-docs.factor +++ b/extra/help/help-docs.factor @@ -113,7 +113,7 @@ ARTICLE: "help" "Help system" "The help system maintains documentation written in a simple markup language, along with cross-referencing and search. Documentation can either exist as free-standing " { $emphasis "articles" } " or be associated with words." { $subsection "browsing-help" } { $subsection "writing-help" } -{ $subsection "help.lint" } +{ $vocab-subsection "Help lint tool" "help.lint" } { $subsection "help-impl" } ; IN: help @@ -126,7 +126,7 @@ HELP: $title HELP: help { $values { "topic" "an article name or a word" } } { $description - "Displays a help article or documentation associated to a word on the " { $link stdio } " stream." + "Displays a help article or documentation associated to a word on " { $link output-stream } "." } ; HELP: about @@ -151,7 +151,7 @@ HELP: $index HELP: ($index) { $values { "articles" "a sequence of help articles" } } -{ $description "Writes a list of " { $link $subsection } " elements to the " { $link stdio } " stream." } ; +{ $description "Writes a list of " { $link $subsection } " elements to " { $link output-stream } "." } ; HELP: xref-help { $description "Update help cross-referencing. Usually this is done automatically." } ; @@ -168,11 +168,11 @@ HELP: $predicate HELP: print-element { $values { "element" "a markup element" } } -{ $description "Prints a markup element to the " { $link stdio } " stream." } ; +{ $description "Prints a markup element to " { $link output-stream } "." } ; HELP: print-content { $values { "element" "a markup element" } } -{ $description "Prints a top-level markup element to the " { $link stdio } " stream." } ; +{ $description "Prints a top-level markup element to " { $link output-stream } "." } ; HELP: simple-element { $class-description "Class of simple elements, which are just arrays of elements." } ; diff --git a/extra/help/help.factor b/extra/help/help.factor index e0b2709932..6c921fe0a2 100755 --- a/extra/help/help.factor +++ b/extra/help/help.factor @@ -29,7 +29,7 @@ M: predicate word-help* drop \ $predicate ; : all-articles ( -- seq ) articles get keys - all-words [ word-help ] subset append ; + all-words [ word-help ] filter append ; : xref-help ( -- ) all-articles [ xref-article ] each ; @@ -41,17 +41,17 @@ M: predicate word-help* drop \ $predicate ; [ dup article-title ] { } map>assoc sort-values keys ; : all-errors ( -- seq ) - all-words [ error? ] subset sort-articles ; + all-words [ error? ] filter sort-articles ; M: word article-name word-name ; M: word article-title - dup parsing? over symbol? or [ + dup [ parsing-word? ] [ symbol? ] bi or [ word-name ] [ - dup word-name - swap stack-effect - [ effect>string " " swap 3append ] when* + [ word-name ] + [ stack-effect [ effect>string " " prepend ] [ "" ] if* ] bi + append ] if ; M: word article-content @@ -114,15 +114,7 @@ M: word set-article-parent swap "help-parent" set-word-prop ; : $about ( element -- ) first vocab-help [ 1array $subsection ] when* ; -: (:help-multi) - "This error has multiple delegates:" print - ($index) nl - "Use \\ ... help to get help about a specific delegate." print ; - -: (:help-none) - drop "No help for this error. " print ; - -: (:help-debugger) +: :help-debugger ( -- ) nl "Debugger commands:" print nl @@ -135,12 +127,8 @@ M: word set-article-parent swap "help-parent" set-word-prop ; ":vars - list all variables at error time" print ; : :help ( -- ) - error get delegates [ error-help ] map [ ] subset - { - { [ dup empty? ] [ (:help-none) ] } - { [ dup length 1 = ] [ first help ] } - [ (:help-multi) ] - } cond (:help-debugger) ; + error get error-help [ help ] [ "No help for this error. " print ] if* + :help-debugger ; : remove-article ( name -- ) dup articles get key? [ diff --git a/extra/help/html/html.factor b/extra/help/html/html.factor new file mode 100644 index 0000000000..b1bf8958a8 --- /dev/null +++ b/extra/help/html/html.factor @@ -0,0 +1,5 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +IN: help.html + + diff --git a/extra/help/lint/lint.factor b/extra/help/lint/lint.factor index 28af93f295..2a8ea03d03 100755 --- a/extra/help/lint/lint.factor +++ b/extra/help/lint/lint.factor @@ -9,8 +9,8 @@ macros combinators.lib sequences.lib math sets ; IN: help.lint : check-example ( element -- ) - 1 tail [ - 1 head* "\n" join 1vector + rest [ + but-last "\n" join 1vector [ use [ clone ] change [ eval>string ] with-datastack @@ -23,7 +23,7 @@ IN: help.lint : extract-values ( element -- seq ) \ $values swap elements dup empty? [ - first 1 tail [ first ] map prune natural-sort + first rest [ first ] map prune natural-sort ] unless ; : effect-values ( word -- seq ) @@ -55,11 +55,11 @@ IN: help.lint r> assert= t ] - } && 3drop ; + } 0&& 3drop ; : check-see-also ( word element -- ) nip \ $see-also swap elements [ - 1 tail dup prune [ length ] bi@ assert= + rest dup prune [ length ] bi@ assert= ] each ; : vocab-exists? ( name -- ? ) @@ -75,7 +75,7 @@ IN: help.lint [ help ] with-string-writer drop ; : all-word-help ( words -- seq ) - [ word-help ] subset ; + [ word-help ] filter ; TUPLE: help-error topic ; @@ -131,7 +131,7 @@ M: help-error error. articles get keys "group-articles" set child-vocabs [ dup check-vocab ] { } map>assoc - [ nip empty? not ] assoc-subset + [ nip empty? not ] assoc-filter ] with-scope ; : typos. ( assoc -- ) @@ -150,12 +150,12 @@ M: help-error error. : help-lint-all ( -- ) "" help-lint ; : unlinked-words ( words -- seq ) - all-word-help [ article-parent not ] subset ; + all-word-help [ article-parent not ] filter ; : linked-undocumented-words ( -- seq ) all-words - [ word-help not ] subset - [ article-parent ] subset - [ "predicating" word-prop not ] subset ; + [ word-help not ] filter + [ article-parent ] filter + [ "predicating" word-prop not ] filter ; MAIN: help-lint diff --git a/extra/help/markup/markup.factor b/extra/help/markup/markup.factor index 2e2b34ebfd..32e4084150 100755 --- a/extra/help/markup/markup.factor +++ b/extra/help/markup/markup.factor @@ -22,8 +22,8 @@ SYMBOL: span SYMBOL: block SYMBOL: table -: last-span? last-element get span eq? ; -: last-block? last-element get block eq? ; +: last-span? ( -- ? ) last-element get span eq? ; +: last-block? ( -- ? ) last-element get block eq? ; : ($span) ( quot -- ) last-block? [ nl ] when @@ -58,18 +58,23 @@ M: f print-element drop ; ! Some spans -: $snippet [ snippet-style get print-element* ] ($span) ; +: $snippet ( children -- ) + [ snippet-style get print-element* ] ($span) ; -: $emphasis [ emphasis-style get print-element* ] ($span) ; +: $emphasis ( children -- ) + [ emphasis-style get print-element* ] ($span) ; -: $strong [ strong-style get print-element* ] ($span) ; +: $strong ( children -- ) + [ strong-style get print-element* ] ($span) ; -: $url [ url-style get print-element* ] ($span) ; +: $url ( children -- ) + [ url-style get print-element* ] ($span) ; -: $nl nl nl drop ; +: $nl ( children -- ) + nl nl drop ; ! Some blocks -: ($heading) +: ($heading) ( children quot -- ) last-element get [ nl ] when ($block) ; inline : $heading ( element -- ) @@ -230,7 +235,7 @@ M: word ($instance) M: string ($instance) dup a/an write bl $snippet ; -: $instance first ($instance) ; +: $instance ( children -- ) first ($instance) ; : values-row ( seq -- seq ) unclip \ $snippet swap ?word-name 2array @@ -278,18 +283,18 @@ M: string ($instance) drop "Shuffle word. Re-arranges the stack according to the stack effect pattern." $description ; -: $low-level-note +: $low-level-note ( children -- ) drop "Calling this word directly is not necessary in most cases. Higher-level words call it automatically." $notes ; -: $values-x/y +: $values-x/y ( children -- ) drop { { "x" number } { "y" number } } $values ; -: $io-error +: $io-error ( children -- ) drop "Throws an error if the I/O operation fails." $errors ; -: $prettyprinting-note +: $prettyprinting-note ( children -- ) drop { "This word should only be called from inside the " { $link with-pprint } " combinator." @@ -311,7 +316,7 @@ M: array elements* [ swap [ elements [ - 1 tail [ dup set ] each + rest [ dup set ] each ] each ] curry each ] H{ } make-assoc keys ; diff --git a/extra/help/syntax/syntax.factor b/extra/help/syntax/syntax.factor index 65120a5d01..877de30748 100755 --- a/extra/help/syntax/syntax.factor +++ b/extra/help/syntax/syntax.factor @@ -18,5 +18,5 @@ IN: help.syntax : ABOUT: scan-object in get vocab - dup changed-definition + dup +inlined+ changed-definition set-vocab-help ; parsing diff --git a/extra/help/tutorial/tutorial.factor b/extra/help/tutorial/tutorial.factor index f01840d927..cafa758c7e 100755 --- a/extra/help/tutorial/tutorial.factor +++ b/extra/help/tutorial/tutorial.factor @@ -123,8 +123,8 @@ $nl { $code "\"A man, a plan, a canal: Panama.\"" } "Now, place a quotation containing " { $link Letter? } " on the stack; quoting code places it on the stack instead of executing it immediately:" { $code "[ Letter? ]" } -"Finally, pass the string and the quotation to the " { $link subset } " word:" -{ $code "subset" } +"Finally, pass the string and the quotation to the " { $link filter } " word:" +{ $code "filter" } "Now the stack should contain the following string:" { "\"AmanaplanacanalPanama\"" } "This is almost what we want; we just need to convert the string to lower case now. This can be done by calling " { $link >lower } "; the " { $snippet ">" } " prefix is a naming convention for conversion operations, and should be read as ``to'':" @@ -132,10 +132,10 @@ $nl "Finally, let's print the top of the stack and discard it:" { $code "." } "This will output " { $snippet "amanaplanacanalpanama" } ". This string is in the form that we want, and we evaluated the following code to get it into this form:" -{ $code "[ Letter? ] subset >lower" } +{ $code "[ Letter? ] filter >lower" } "This code starts with a string on the stack, removes non-alphabetical characters, and converts the result to lower case, leaving a new string on the stack. We put this code in a new word, and add the new word to " { $snippet "palindrome.factor" } ":" -{ $code ": normalize ( str -- newstr ) [ Letter? ] subset >lower ;" } -"You will need to add " { $vocab-link "unicode.categories" } " to the vocabulary search path, so that " { $link Letter? } " can be used in the source file." +{ $code ": normalize ( str -- newstr ) [ Letter? ] filter >lower ;" } +"You will need to add " { $vocab-link "unicode.case" } " and " { $vocab-link "unicode.categories" } " to the vocabulary search path, so that " { $link Letter? } " can be used in the source file." $nl "We modify " { $snippet "palindrome?" } " to first apply " { $snippet "normalize" } " to its input:" { $code ": palindrome? ( str -- ? ) normalize dup reverse = ;" } diff --git a/extra/hexdump/hexdump.factor b/extra/hexdump/hexdump.factor index 468a8cf253..f444f5a4f2 100644 --- a/extra/hexdump/hexdump.factor +++ b/extra/hexdump/hexdump.factor @@ -1,5 +1,5 @@ USING: arrays io io.streams.string kernel math math.parser namespaces - prettyprint sequences sequences.lib splitting strings ascii ; +prettyprint sequences sequences.lib splitting grouping strings ascii ; IN: hexdump " "red" set-value ] unit-test + +[ "<jimmy>" ] [ + [ + "red" label render + ] with-string-writer +] unit-test + +[ "" ] [ + [ + "red" hidden render + ] with-string-writer +] unit-test + +[ ] [ "'jimmy'" "red" set-value ] unit-test + +[ "" ] [ + [ + "red" 5 >>size render + ] with-string-writer +] unit-test + +[ "" ] [ + [ + "red" 5 >>size render + ] with-string-writer +] unit-test + +[ ] [ + [ + "green" ; + +! Choice +TUPLE: choice size multiple choices ; + +: ( -- choice ) + choice new ; + +: render-option ( text selected? -- ) + ; + +: render-options ( options selected -- ) + '[ dup , member? render-option ] each ; + +M: choice render* + ; + +! Checkboxes +TUPLE: checkbox label ; + +: ( -- checkbox ) + checkbox new ; + +M: checkbox render* + + label>> escape-string write + ; + +! Link components +GENERIC: link-title ( obj -- string ) +GENERIC: link-href ( obj -- url ) + +M: string link-title ; +M: string link-href ; + +M: url link-title ; +M: url link-href ; + +SINGLETON: link + +M: link render* + 2drop + + link-title present escape-string write + ; + +! XMode code component +TUPLE: code mode ; + +: ( -- code ) + code new ; + +M: code render* + [ string-lines ] [ drop ] [ mode>> value ] tri* htmlize-lines ; + +! Farkup component +SINGLETON: farkup + +M: farkup render* + 2drop string-lines "\n" join convert-farkup write ; + +! Inspector component +SINGLETON: inspector + +M: inspector render* + 2drop [ describe ] with-html-stream ; + +! Diff component +SINGLETON: comparison + +M: comparison render* + 2drop htmlize-diff ; + +! HTML component +SINGLETON: html + +M: html render* 2drop write ; diff --git a/extra/html/elements/elements-tests.factor b/extra/html/elements/elements-tests.factor index aa6a017540..1178deab38 100644 --- a/extra/html/elements/elements-tests.factor +++ b/extra/html/elements/elements-tests.factor @@ -1,8 +1,5 @@ IN: html.elements.tests -USING: tools.test html html.elements io.streams.string ; - -: make-html-string - [ with-html-stream ] with-string-writer ; +USING: tools.test html.elements io.streams.string ; [ "" ] -[ [ ] make-html-string ] unit-test +[ [ ] with-string-writer ] unit-test diff --git a/extra/html/elements/elements.factor b/extra/html/elements/elements.factor index 41e29fc712..5fc4bd19ae 100644 --- a/extra/html/elements/elements.factor +++ b/extra/html/elements/elements.factor @@ -4,7 +4,8 @@ ! See http://factorcode.org/license.txt for BSD license. USING: io kernel namespaces prettyprint quotations -sequences strings words xml.entities compiler.units effects ; +sequences strings words xml.entities compiler.units effects +urls math math.parser combinators present ; IN: html.elements @@ -57,57 +58,57 @@ SYMBOL: html : print-html ( str -- ) write-html "\n" write-html ; +<< + : html-word ( name def effect -- ) #! Define 'word creating' word to allow #! dynamically creating words. >r >r elements-vocab create r> r> define-declared ; -: "<" swap ">" 3append ; - -: empty-effect T{ effect f 0 0 } ; +: ( str -- ) "<" swap ">" 3append ; : def-for-html-word- ( name -- ) #! Return the name and code for the patterned #! word. dup swap [ write-html ] curry - empty-effect html-word ; + (( -- )) html-word ; -: ">" append ; +: foo> ( str -- foo> ) ">" append ; : def-for-html-word-foo> ( name -- ) #! Return the name and code for the foo> patterned #! word. - foo> [ ">" write-html ] empty-effect html-word ; + foo> [ ">" write-html ] (( -- )) html-word ; -: "" 3append ; +: ( str -- ) "" 3append ; : def-for-html-word- ( name -- ) #! Return the name and code for the patterned #! word. - dup [ write-html ] curry empty-effect html-word ; + dup [ write-html ] curry (( -- )) html-word ; -: "<" swap "/>" 3append ; +: ( str -- ) "<" swap "/>" 3append ; : def-for-html-word- ( name -- ) #! Return the name and code for the patterned #! word. dup swap [ write-html ] curry - empty-effect html-word ; + (( -- )) html-word ; -: foo/> "/>" append ; +: foo/> ( str -- str/> ) "/>" append ; : def-for-html-word-foo/> ( name -- ) #! Return the name and code for the foo/> patterned #! word. - foo/> [ "/>" write-html ] empty-effect html-word ; + foo/> [ "/>" write-html ] (( -- )) html-word ; : define-closed-html-word ( name -- ) #! Given an HTML tag name, define the words for @@ -128,39 +129,53 @@ SYMBOL: html " " write-html write-html "='" write-html - escape-quoted-string write-html + present escape-quoted-string write-html "'" write-html ; -: attribute-effect T{ effect f { "string" } 0 } ; - : define-attribute-word ( name -- ) dup "=" prepend swap - [ write-attr ] curry attribute-effect html-word ; + [ write-attr ] curry (( string -- )) html-word ; +! Define some closed HTML tags [ - ! Define some closed HTML tags - [ - "h1" "h2" "h3" "h4" "h5" "h6" "h7" "h8" "h9" - "ol" "li" "form" "a" "p" "html" "head" "body" "title" - "b" "i" "ul" "table" "tbody" "tr" "td" "th" "pre" "textarea" - "script" "div" "span" "select" "option" "style" - ] [ define-closed-html-word ] each + "h1" "h2" "h3" "h4" "h5" "h6" "h7" "h8" "h9" + "ol" "li" "form" "a" "p" "html" "head" "body" "title" + "b" "i" "ul" "table" "tbody" "tr" "td" "th" "pre" "textarea" + "script" "div" "span" "select" "option" "style" "input" +] [ define-closed-html-word ] each - ! Define some open HTML tags - [ - "input" - "br" - "link" - "img" - ] [ define-open-html-word ] each +! Define some open HTML tags +[ + "input" + "br" + "link" + "img" +] [ define-open-html-word ] each - ! Define some attributes - [ - "method" "action" "type" "value" "name" - "size" "href" "class" "border" "rows" "cols" - "id" "onclick" "style" "valign" "accesskey" - "src" "language" "colspan" "onchange" "rel" - "width" "selected" "onsubmit" "xmlns" "lang" "xml:lang" - "media" "title" - ] [ define-attribute-word ] each -] with-compilation-unit +! Define some attributes +[ + "method" "action" "type" "value" "name" + "size" "href" "class" "border" "rows" "cols" + "id" "onclick" "style" "valign" "accesskey" + "src" "language" "colspan" "onchange" "rel" + "width" "selected" "onsubmit" "xmlns" "lang" "xml:lang" + "media" "title" "multiple" "checked" +] [ define-attribute-word ] each + +>> + +: xhtml-preamble ( -- ) + "" write-html + "" write-html ; + +: simple-page ( title quot -- ) + #! Call the quotation, with all output going to the + #! body of an html page with the given title. + xhtml-preamble + + swap write + call + ; inline + +: render-error ( message -- ) + escape-string write ; diff --git a/extra/html/html.factor b/extra/html/html.factor deleted file mode 100755 index 5c82b7f038..0000000000 --- a/extra/html/html.factor +++ /dev/null @@ -1,264 +0,0 @@ -! Copyright (C) 2004, 2006 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: generic assocs help http io io.styles io.files continuations -io.streams.string kernel math math.parser namespaces -quotations assocs sequences strings words html.elements -xml.entities sbufs continuations ; -IN: html - -GENERIC: browser-link-href ( presented -- href ) - -M: object browser-link-href drop f ; - -TUPLE: html-stream last-div? ; - -! A hack: stream-nl after with-nesting or tabular-output is -! ignored, so that HTML stream output looks like UI pane output -: test-last-div? ( stream -- ? ) - dup html-stream-last-div? - f rot set-html-stream-last-div? ; - -: not-a-div ( stream -- stream ) - dup test-last-div? drop ; inline - -: a-div ( stream -- straem ) - t over set-html-stream-last-div? ; inline - -: ( stream -- stream ) - html-stream construct-delegate ; - - over set-delegate ; - -: ( style stream class -- stream ) - >r (html-sub-stream) r> construct-delegate ; inline - -: end-sub-stream ( substream -- string style stream ) - dup delegate >string - over html-sub-stream-style - rot html-sub-stream-stream ; - -: delegate-write ( string -- ) - stdio get delegate stream-write ; - -: object-link-tag ( style quot -- ) - presented pick at [ - browser-link-href [ - call - ] [ call ] if* - ] [ call ] if* ; inline - -: hex-color, ( triplet -- ) - 3 head-slice - [ 255 * >fixnum >hex 2 CHAR: 0 pad-left % ] each ; - -: fg-css, ( color -- ) - "color: #" % hex-color, "; " % ; - -: bg-css, ( color -- ) - "background-color: #" % hex-color, "; " % ; - -: style-css, ( flag -- ) - dup - { italic bold-italic } member? - "font-style: " % "italic" "normal" ? % "; " % - { bold bold-italic } member? - "font-weight: " % "bold" "normal" ? % "; " % ; - -: size-css, ( size -- ) - "font-size: " % # "pt; " % ; - -: font-css, ( font -- ) - "font-family: " % % "; " % ; - -: apply-style ( style key quot -- style gadget ) - >r over at r> when* ; inline - -: make-css ( style quot -- str ) - "" make nip ; inline - -: span-css-style ( style -- str ) - [ - foreground [ fg-css, ] apply-style - background [ bg-css, ] apply-style - font [ font-css, ] apply-style - font-style [ style-css, ] apply-style - font-size [ size-css, ] apply-style - ] make-css ; - -: span-tag ( style quot -- ) - over span-css-style dup empty? [ - drop call - ] [ - call - ] if ; inline - -: format-html-span ( string style stream -- ) - [ - [ [ drop delegate-write ] span-tag ] object-link-tag - ] with-stream* ; - -TUPLE: html-span-stream ; - -M: html-span-stream dispose - end-sub-stream not-a-div format-html-span ; - -: border-css, ( border -- ) - "border: 1px solid #" % hex-color, "; " % ; - -: padding-css, ( padding -- ) "padding: " % # "px; " % ; - -: pre-css, ( margin -- ) - [ "white-space: pre; font-family: monospace; " % ] unless ; - -: div-css-style ( style -- str ) - [ - page-color [ bg-css, ] apply-style - border-color [ border-css, ] apply-style - border-width [ padding-css, ] apply-style - wrap-margin over at pre-css, - ] make-css ; - -: div-tag ( style quot -- ) - swap div-css-style dup empty? [ - drop call - ] [ -
call
- ] if ; inline - -: format-html-div ( string style stream -- ) - [ - [ [ delegate-write ] div-tag ] object-link-tag - ] with-stream* ; - -TUPLE: html-block-stream ; - -M: html-block-stream dispose ( quot style stream -- ) - end-sub-stream a-div format-html-div ; - -: border-spacing-css, - "padding: " % first2 max 2 /i # "px; " % ; - -: table-style ( style -- str ) - [ - table-border [ border-css, ] apply-style - table-gap [ border-spacing-css, ] apply-style - ] make-css ; - -: table-attrs ( style -- ) - table-style " border-collapse: collapse;" append =style ; - -: do-escaping ( string style -- string ) - html swap at [ escape-string ] unless ; - -PRIVATE> - -! Stream protocol -M: html-stream stream-write1 ( char stream -- ) - >r 1string r> stream-write ; - -M: html-stream stream-write ( str stream -- ) - not-a-div >r escape-string r> delegate stream-write ; - -M: html-stream make-span-stream ( style stream -- stream' ) - html-span-stream ; - -M: html-stream stream-format ( str style stream -- ) - >r html over at [ >r escape-string r> ] unless r> - format-html-span ; - -M: html-stream make-block-stream ( style stream -- stream' ) - html-block-stream ; - -M: html-stream stream-write-table ( grid style stream -- ) - a-div [ - swap [ - [ - - ] with each - ] with each
- >string write-html -
- ] with-stream* ; - -M: html-stream make-cell-stream ( style stream -- stream' ) - (html-sub-stream) ; - -M: html-stream stream-nl ( stream -- ) - dup test-last-div? [ drop ] [ [
] with-stream* ] if ; - -! Utilities -: with-html-stream ( quot -- ) - stdio get swap with-stream* ; inline - -: xhtml-preamble - "" write-html - "" write-html ; - -: html-document ( body-quot head-quot -- ) - #! head-quot is called to produce output to go - #! in the html head portion of the document. - #! body-quot is called to produce output to go - #! in the html body portion of the document. - xhtml-preamble - - call - call - ; - -: default-css ( -- ) - ; - -: simple-html-document ( title quot -- ) - swap [ - write - default-css - ] html-document ; - -: vertical-layout ( list -- ) - #! Given a list of HTML components, arrange them vertically. - - [ ] each -
call
; - -: horizontal-layout ( list -- ) - #! Given a list of HTML components, arrange them horizontally. - - [ ] each -
call
; - -: button ( label -- ) - #! Output an HTML submit button with the given label. - ; - -: paragraph ( str -- ) - #! Output the string as an html paragraph -

write

; - -: simple-page ( title quot -- ) - #! Call the quotation, with all output going to the - #! body of an html page with the given title. - - swap write - call - ; - -: styled-page ( title stylesheet-quot quot -- ) - #! Call the quotation, with all output going to the - #! body of an html page with the given title. stylesheet-quot - #! is called to generate the required stylesheet. - - - rot write - swap call - - call - ; diff --git a/extra/html/parser/analyzer/analyzer.factor b/extra/html/parser/analyzer/analyzer.factor index 1a60390f64..47d352b6b8 100755 --- a/extra/html/parser/analyzer/analyzer.factor +++ b/extra/html/parser/analyzer/analyzer.factor @@ -1,27 +1,32 @@ USING: assocs html.parser kernel math sequences strings ascii arrays shuffle unicode.case namespaces splitting http -sequences.lib ; +sequences.lib accessors io combinators http.client urls ; IN: html.parser.analyzer +TUPLE: link attributes clickable ; + +: scrape-html ( url -- vector ) + http-get parse-html ; + : (find-relative) - [ >r + dup r> ?nth* [ 2drop f f ] unless ] [ 2drop f ] if ; + [ >r + dup r> ?nth* [ 2drop f f ] unless ] [ 2drop f ] if ; inline : find-relative ( seq quot n -- i elt ) >r over [ find drop ] dip r> swap pick - (find-relative) ; + (find-relative) ; inline : (find-all) ( n seq quot -- ) - 2dup >r >r find* [ + 2dup >r >r find-from [ dupd 2array , 1+ r> r> (find-all) ] [ r> r> 3drop - ] if* ; + ] if* ; inline : find-all ( seq quot -- alist ) - [ 0 -rot (find-all) ] { } make ; + [ 0 -rot (find-all) ] { } make ; inline : (find-nth) ( offset seq quot n count -- obj ) - >r >r [ find* ] 2keep 4 npick [ + >r >r [ find-from ] 2keep 4 npick [ r> r> 1+ 2dup <= [ 4drop ] [ @@ -30,106 +35,144 @@ IN: html.parser.analyzer ] if ] [ 2drop r> r> 2drop - ] if ; + ] if ; inline : find-nth ( seq quot n -- i elt ) - 0 -roll 0 (find-nth) ; + 0 -roll 0 (find-nth) ; inline : find-nth-relative ( seq quot n offest -- i elt ) >r [ find-nth ] 3keep 2drop nip r> swap pick - (find-relative) ; + (find-relative) ; inline : remove-blank-text ( vector -- vector' ) [ - dup tag-name text = [ - tag-text [ blank? ] all? not + dup name>> text = [ + text>> [ blank? ] all? not ] [ drop t ] if - ] subset ; + ] filter ; : trim-text ( vector -- vector' ) [ - dup tag-name text = [ - [ tag-text [ blank? ] trim ] keep + dup name>> text = [ + [ text>> [ blank? ] trim ] keep [ set-tag-text ] keep ] when ] map ; : find-by-id ( id vector -- vector ) - [ tag-attributes "id" swap at = ] with subset ; + [ attributes>> "id" swap at = ] with filter ; : find-by-class ( id vector -- vector ) - [ tag-attributes "class" swap at = ] with subset ; + [ attributes>> "class" swap at = ] with filter ; : find-by-name ( str vector -- vector ) >r >lower r> - [ tag-name = ] with subset ; + [ name>> = ] with filter ; : find-first-name ( str vector -- i/f tag/f ) >r >lower r> - [ tag-name = ] with find ; + [ name>> = ] with find ; : find-matching-close ( str vector -- i/f tag/f ) >r >lower r> - [ [ tag-name = ] keep tag-closing? and ] with find ; + [ [ name>> = ] keep closing?>> and ] with find ; : find-by-attribute-key ( key vector -- vector ) >r >lower r> - [ tag-attributes at ] with subset - [ ] subset ; + [ attributes>> at ] with filter + sift ; : find-by-attribute-key-value ( value key vector -- vector ) >r >lower r> - [ tag-attributes at over = ] with subset nip - [ ] subset ; + [ attributes>> at over = ] with filter nip + sift ; : find-first-attribute-key-value ( value key vector -- i/f tag/f ) >r >lower r> - [ tag-attributes at over = ] with find rot drop ; + [ attributes>> at over = ] with find rot drop ; : find-between* ( i/f tag/f vector -- vector ) pick integer? [ rot tail-slice - >r tag-name r> - [ find-matching-close drop 1+ ] keep swap head + >r name>> r> + [ find-matching-close drop dup [ 1+ ] when ] keep + swap [ head ] [ first ] if* ] [ 3drop V{ } clone ] if ; : find-between ( i/f tag/f vector -- vector ) find-between* dup length 3 >= [ - [ 1 tail-slice 1 head-slice* ] keep like + [ rest-slice but-last-slice ] keep like ] when ; : find-between-first ( string vector -- vector' ) [ find-first-name ] keep find-between ; +: find-between-all ( vector quot -- seq ) + [ [ [ closing?>> not ] bi and ] curry find-all ] curry + [ [ >r first2 r> find-between* ] curry map ] bi ; + : tag-link ( tag -- link/f ) - tag-attributes [ "href" swap at ] [ f ] if* ; + attributes>> [ "href" swap at ] [ f ] if* ; -: find-links ( vector -- vector ) - [ tag-name "a" = ] subset - [ tag-link ] subset ; +: find-links ( vector -- vector' ) + [ [ name>> "a" = ] [ attributes>> "href" swap at ] bi and ] + find-between-all ; +: ( vector -- link ) + [ first attributes>> ] + [ [ name>> { text "img" } member? ] filter ] bi + link boa ; + +: link. ( vector -- ) + [ attributes>> "href" swap at write nl ] + [ clickable>> [ bl bl text>> print ] each nl ] bi ; : find-by-text ( seq quot -- tag ) - [ dup tag-name text = ] swap compose find drop ; + [ dup name>> text = ] prepose find drop ; : find-opening-tags-by-name ( name seq -- seq ) - [ [ tag-name = ] keep tag-closing? not and ] with find-all ; + [ [ name>> = ] keep closing?>> not and ] with find-all ; : href-contains? ( str tag -- ? ) - tag-attributes "href" swap at* [ subseq? ] [ 2drop f ] if ; + attributes>> "href" swap at* [ subseq? ] [ 2drop f ] if ; + + +: find-forms ( vector -- vector' ) + "form" over find-opening-tags-by-name + swap [ >r first2 r> find-between* ] curry map + [ [ name>> { "form" "input" } member? ] filter ] map ; + +: find-html-objects ( string vector -- vector' ) + [ find-opening-tags-by-name ] keep + [ >r first2 r> find-between* ] curry map ; + +: form-action ( vector -- string ) + [ name>> "form" = ] find nip + attributes>> "action" swap at ; + +: hidden-form-values ( vector -- strings ) + [ attributes>> "type" swap at "hidden" = ] filter ; + +: input. ( tag -- ) + dup name>> print + attributes>> + [ bl bl bl bl [ write "=" write ] [ write bl ] bi* nl ] assoc-each ; + +: form. ( vector -- ) + [ closing?>> not ] filter + [ + { + { [ dup name>> "form" = ] + [ "form action: " write attributes>> "action" swap at print + ] } + { [ dup name>> "input" = ] [ input. ] } + [ drop ] + } cond + ] each ; : query>assoc* ( str -- hash ) "?" split1 nip query>assoc ; - -! clear "http://fark.com" http-get parse-html find-links [ "go.pl" swap start ] subset [ "=" split peek ] map - -! clear "http://www.sailwx.info/shiptrack/cruiseships.phtml" http-get parse-html remove-blank-text -! "a" over find-opening-tags-by-name -! [ nip "shipposition.phtml?call=GBTT" swap href-contains? ] assoc-subset -! first first 8 + over nth -! tag-attributes "href" swap at query>assoc* -! "lat" over at "lon" rot at diff --git a/extra/html/parser/parser.factor b/extra/html/parser/parser.factor index bc4dc429fa..1ae5768f98 100644 --- a/extra/html/parser/parser.factor +++ b/extra/html/parser/parser.factor @@ -91,7 +91,7 @@ SYMBOL: tagstack read-dtd ] if ; -: read-tag ( -- ) +: read-tag ( -- string ) [ get-char CHAR: > = get-char CHAR: < = or ] take-until get-char CHAR: < = [ next* ] unless ; @@ -135,7 +135,7 @@ SYMBOL: tagstack (parse-tag) make-tag push-tag ] if ; -: (parse-html) ( tag -- ) +: (parse-html) ( -- ) get-next [ parse-text parse-tag diff --git a/extra/html/parser/utils/utils.factor b/extra/html/parser/utils/utils.factor index b574799b38..5083b1cec2 100644 --- a/extra/html/parser/utils/utils.factor +++ b/extra/html/parser/utils/utils.factor @@ -36,7 +36,7 @@ IN: html.parser.utils dup quoted? [ quote ] unless ; : unquote ( str -- newstr ) - dup quoted? [ 1 head-slice* 1 tail-slice >string ] when ; + dup quoted? [ but-last-slice rest-slice >string ] when ; : quote? ( ch -- ? ) "'\"" member? ; diff --git a/extra/html/authors.txt b/extra/html/streams/authors.txt similarity index 100% rename from extra/html/authors.txt rename to extra/html/streams/authors.txt diff --git a/extra/html/html-tests.factor b/extra/html/streams/streams-tests.factor similarity index 81% rename from extra/html/html-tests.factor rename to extra/html/streams/streams-tests.factor index ce320ca75b..14f1621346 100644 --- a/extra/html/html-tests.factor +++ b/extra/html/streams/streams-tests.factor @@ -1,6 +1,7 @@ -USING: html http io io.streams.string io.styles kernel -namespaces tools.test xml.writer sbufs sequences html.private ; -IN: html.tests +USING: html.streams html.streams.private +io io.streams.string io.styles kernel +namespaces tools.test xml.writer sbufs sequences inspector ; +IN: html.streams.tests : make-html-string [ with-html-stream ] with-string-writer ; inline @@ -24,7 +25,7 @@ IN: html.tests ] unit-test [ "<" ] [ - [ "<" H{ } stdio get format-html-span ] make-html-string + [ "<" H{ } output-stream get format-html-span ] make-html-string ] unit-test TUPLE: funky town ; @@ -69,3 +70,5 @@ M: funky browser-link-href ] [ [ H{ } [ ] with-nesting nl ] make-html-string ] unit-test + +[ ] [ [ { 1 2 3 } describe ] with-html-stream ] unit-test diff --git a/extra/html/streams/streams.factor b/extra/html/streams/streams.factor new file mode 100755 index 0000000000..eae13f53ad --- /dev/null +++ b/extra/html/streams/streams.factor @@ -0,0 +1,195 @@ +! Copyright (C) 2004, 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: generic assocs help http io io.styles io.files continuations +io.streams.string kernel math math.order math.parser namespaces +quotations assocs sequences strings words html.elements +xml.entities sbufs continuations destructors accessors ; +IN: html.streams + +GENERIC: browser-link-href ( presented -- href ) + +M: object browser-link-href drop f ; + +TUPLE: html-stream stream last-div ; + +! stream-nl after with-nesting or tabular-output is +! ignored, so that HTML stream output looks like +! UI pane output +: last-div? ( stream -- ? ) + [ f ] change-last-div drop ; + +: not-a-div ( stream -- stream ) + f >>last-div ; inline + +: a-div ( stream -- straem ) + t >>last-div ; inline + +: ( stream -- stream ) + f html-stream boa ; + + >>stream + swap >>parent + swap >>style ; inline + +: end-sub-stream ( substream -- string style stream ) + [ stream>> >string ] [ style>> ] [ parent>> ] tri ; + +: object-link-tag ( style quot -- ) + presented pick at [ + browser-link-href [ + call + ] [ call ] if* + ] [ call ] if* ; inline + +: hex-color, ( triplet -- ) + 3 head-slice + [ 255 * >fixnum >hex 2 CHAR: 0 pad-left % ] each ; + +: fg-css, ( color -- ) + "color: #" % hex-color, "; " % ; + +: bg-css, ( color -- ) + "background-color: #" % hex-color, "; " % ; + +: style-css, ( flag -- ) + dup + { italic bold-italic } member? + "font-style: " % "italic" "normal" ? % "; " % + { bold bold-italic } member? + "font-weight: " % "bold" "normal" ? % "; " % ; + +: size-css, ( size -- ) + "font-size: " % # "pt; " % ; + +: font-css, ( font -- ) + "font-family: " % % "; " % ; + +: apply-style ( style key quot -- style gadget ) + >r over at r> when* ; inline + +: make-css ( style quot -- str ) + "" make nip ; inline + +: span-css-style ( style -- str ) + [ + foreground [ fg-css, ] apply-style + background [ bg-css, ] apply-style + font [ font-css, ] apply-style + font-style [ style-css, ] apply-style + font-size [ size-css, ] apply-style + ] make-css ; + +: span-tag ( style quot -- ) + over span-css-style dup empty? [ + drop call + ] [ + call + ] if ; inline + +: format-html-span ( string style stream -- ) + stream>> [ + [ [ drop write ] span-tag ] object-link-tag + ] with-output-stream* ; + +TUPLE: html-span-stream < html-sub-stream ; + +M: html-span-stream dispose + end-sub-stream not-a-div format-html-span ; + +: border-css, ( border -- ) + "border: 1px solid #" % hex-color, "; " % ; + +: padding-css, ( padding -- ) "padding: " % # "px; " % ; + +: pre-css, ( margin -- ) + [ "white-space: pre; font-family: monospace; " % ] unless ; + +: div-css-style ( style -- str ) + [ + page-color [ bg-css, ] apply-style + border-color [ border-css, ] apply-style + border-width [ padding-css, ] apply-style + wrap-margin over at pre-css, + ] make-css ; + +: div-tag ( style quot -- ) + swap div-css-style dup empty? [ + drop call + ] [ +
call
+ ] if ; inline + +: format-html-div ( string style stream -- ) + stream>> [ + [ [ write ] div-tag ] object-link-tag + ] with-output-stream* ; + +TUPLE: html-block-stream < html-sub-stream ; + +M: html-block-stream dispose ( quot style stream -- ) + end-sub-stream a-div format-html-div ; + +: border-spacing-css, ( pair -- ) + "padding: " % first2 max 2 /i # "px; " % ; + +: table-style ( style -- str ) + [ + table-border [ border-css, ] apply-style + table-gap [ border-spacing-css, ] apply-style + ] make-css ; + +: table-attrs ( style -- ) + table-style " border-collapse: collapse;" append =style ; + +: do-escaping ( string style -- string ) + html swap at [ escape-string ] unless ; + +PRIVATE> + +! Stream protocol +M: html-stream stream-flush + stream>> stream-flush ; + +M: html-stream stream-write1 + >r 1string r> stream-write ; + +M: html-stream stream-write + not-a-div >r escape-string r> stream>> stream-write ; + +M: html-stream stream-format + >r html over at [ >r escape-string r> ] unless r> + format-html-span ; + +M: html-stream stream-nl + dup last-div? [ drop ] [ [
] with-output-stream* ] if ; + +M: html-stream make-span-stream + html-span-stream new-html-sub-stream ; + +M: html-stream make-block-stream + html-block-stream new-html-sub-stream ; + +M: html-stream make-cell-stream + html-sub-stream new-html-sub-stream ; + +M: html-stream stream-write-table + a-div stream>> [ + swap [ + [ + + ] with each + ] with each
+ stream>> >string write +
+ ] with-output-stream* ; + +M: html-stream dispose stream>> dispose ; + +: with-html-stream ( quot -- ) + output-stream get swap with-output-stream* ; inline diff --git a/extra/html/summary.txt b/extra/html/streams/summary.txt similarity index 100% rename from extra/html/summary.txt rename to extra/html/streams/summary.txt diff --git a/extra/html/tags.txt b/extra/html/streams/tags.txt similarity index 100% rename from extra/html/tags.txt rename to extra/html/streams/tags.txt diff --git a/extra/html/stylesheet.css b/extra/html/stylesheet.css deleted file mode 100644 index a1afce7c9f..0000000000 --- a/extra/html/stylesheet.css +++ /dev/null @@ -1,4 +0,0 @@ -a:link { text-decoration: none; color: black; } -a:visited { text-decoration: none; color: black; } -a:active { text-decoration: none; color: black; } -a:hover { text-decoration: underline; color: black; } diff --git a/extra/html/templates/chloe/chloe-tests.factor b/extra/html/templates/chloe/chloe-tests.factor new file mode 100644 index 0000000000..6ca596f503 --- /dev/null +++ b/extra/html/templates/chloe/chloe-tests.factor @@ -0,0 +1,182 @@ +USING: html.templates html.templates.chloe +tools.test io.streams.string kernel sequences ascii boxes +namespaces xml html.components +splitting unicode.categories furnace ; +IN: html.templates.chloe.tests + +[ f ] [ f parse-query-attr ] unit-test + +[ f ] [ "" parse-query-attr ] unit-test + +[ H{ { "a" "b" } } ] [ + blank-values + "b" "a" set-value + "a" parse-query-attr +] unit-test + +[ H{ { "a" "b" } { "c" "d" } } ] [ + blank-values + "b" "a" set-value + "d" "c" set-value + "a,c" parse-query-attr +] unit-test + +: run-template + with-string-writer [ "\r\n\t" member? not ] filter + "?>" split1 nip ; inline + +: test-template ( name -- template ) + "resource:extra/html/templates/chloe/test/" + prepend ; + +[ "Hello world" ] [ + [ + "test1" test-template call-template + ] run-template +] unit-test + +[ "Blah blah" "Hello world" ] [ + [ + title set + [ + "test2" test-template call-template + ] run-template + title get box> + ] with-scope +] unit-test + +[ "Hello worldBlah blah" ] [ + [ + [ + "test2" test-template call-template + ] "test3" test-template with-boilerplate + ] run-template +] unit-test + +: test4-aux? t ; + +[ "True" ] [ + [ + "test4" test-template call-template + ] run-template +] unit-test + +: test5-aux? f ; + +[ "" ] [ + [ + "test5" test-template call-template + ] run-template +] unit-test + +[ ] [ blank-values ] unit-test + +[ ] [ "A label" "label" set-value ] unit-test + +SINGLETON: link-test + +M: link-test link-title drop "" ; + +M: link-test link-href drop "http://www.apple.com/foo&bar" ; + +[ ] [ link-test "link" set-value ] unit-test + +[ ] [ "int x = 5;" "code" set-value ] unit-test + +[ ] [ "c" "mode" set-value ] unit-test + +[ ] [ { 1 2 3 } "inspector" set-value ] unit-test + +[ ] [ "

a paragraph

" "html" set-value ] unit-test + +[ ] [ "sheeple" "field" set-value ] unit-test + +[ ] [ "a password" "password" set-value ] unit-test + +[ ] [ "a\nb\nc" "textarea" set-value ] unit-test + +[ ] [ "new york" "choice" set-value ] unit-test + +[ ] [ { "new york" "detroit" "minneapolis" } "choices" set-value ] unit-test + +[ ] [ + [ + "test8" test-template call-template + ] run-template drop +] unit-test + +[ ] [ { 1 2 3 } "numbers" set-value ] unit-test + +[ "
  • 1
  • 2
  • 3
" ] [ + [ + "test7" test-template call-template + ] run-template [ blank? not ] filter +] unit-test + +TUPLE: person first-name last-name ; + +[ ] [ + { + T{ person f "RBaxter" "Unknown" } + T{ person f "Doug" "Coleman" } + } "people" set-value +] unit-test + +[ "
RBaxterUnknown
DougColeman
" ] [ + [ + "test8" test-template call-template + ] run-template [ blank? not ] filter +] unit-test + +[ ] [ + { + H{ { "first-name" "RBaxter" } { "last-name" "Unknown" } } + H{ { "first-name" "Doug" } { "last-name" "Coleman" } } + } "people" set-value +] unit-test + +[ "
RBaxterUnknown
DougColeman
" ] [ + [ + "test8" test-template call-template + ] run-template [ blank? not ] filter +] unit-test + +[ ] [ 1 "id" set-value ] unit-test + +[ "Hello" ] [ + [ + "test9" test-template call-template + ] run-template +] unit-test + +[ ] [ H{ { "a" H{ { "b" "c" } } } } values set ] unit-test + +[ "
" ] [ + [ + "test10" test-template call-template + ] run-template +] unit-test + +[ ] [ blank-values ] unit-test + +[ ] [ + H{ { "first-name" "RBaxter" } { "last-name" "Unknown" } } "person" set-value +] unit-test + +[ "
RBaxterUnknown
" ] [ + [ + "test11" test-template call-template + ] run-template [ blank? not ] filter +] unit-test + +[ ] [ + blank-values + { "a" "b" } "choices" set-value + "true" "b" set-value +] unit-test + +[ "ab" ] [ + [ + "test12" test-template call-template + ] run-template +] unit-test diff --git a/extra/html/templates/chloe/chloe.factor b/extra/html/templates/chloe/chloe.factor new file mode 100644 index 0000000000..08d6b873fc --- /dev/null +++ b/extra/html/templates/chloe/chloe.factor @@ -0,0 +1,161 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors kernel sequences combinators kernel namespaces +classes.tuple assocs splitting words arrays memoize +io io.files io.encodings.utf8 io.streams.string +unicode.case tuple-syntax mirrors fry math urls present +multiline xml xml.data xml.writer xml.utilities +html.elements +html.components +html.templates +html.templates.chloe.syntax ; +IN: html.templates.chloe + +! Chloe is Ed's favorite web designer +SYMBOL: tag-stack + +TUPLE: chloe path ; + +C: chloe + +DEFER: process-template + +: chloe-attrs-only ( assoc -- assoc' ) + [ drop name-url chloe-ns = ] assoc-filter ; + +: non-chloe-attrs-only ( assoc -- assoc' ) + [ drop name-url chloe-ns = not ] assoc-filter ; + +: chloe-tag? ( tag -- ? ) + { + { [ dup tag? not ] [ f ] } + { [ dup url>> chloe-ns = not ] [ f ] } + [ t ] + } cond nip ; + +: process-tag-children ( tag -- ) + [ process-template ] each ; + +CHLOE: chloe process-tag-children ; + +: children>string ( tag -- string ) + [ process-tag-children ] with-string-writer ; + +CHLOE: title children>string set-title ; + +CHLOE: write-title + drop + "head" tag-stack get member? + "title" tag-stack get member? not and + [ write-title ] [ write-title ] if ; + +CHLOE: style + dup "include" optional-attr dup [ + swap children>string empty? [ + "style tag cannot have both an include attribute and a body" throw + ] unless + utf8 file-contents + ] [ + drop children>string + ] if add-style ; + +CHLOE: write-style + drop ; + +CHLOE: even "index" value even? [ process-tag-children ] [ drop ] if ; + +CHLOE: odd "index" value odd? [ process-tag-children ] [ drop ] if ; + +: (bind-tag) ( tag quot -- ) + [ + [ "name" required-attr ] keep + '[ , process-tag-children ] + ] dip call ; inline + +CHLOE: each [ with-each-value ] (bind-tag) ; + +CHLOE: bind-each [ with-each-object ] (bind-tag) ; + +CHLOE: bind [ with-values ] (bind-tag) ; + +: error-message-tag ( tag -- ) + children>string render-error ; + +CHLOE: comment drop ; + +CHLOE: call-next-template drop call-next-template ; + +: attr>word ( value -- word/f ) + dup ":" split1 swap lookup + [ ] [ "No such word: " swap append throw ] ?if ; + +: if-satisfied? ( tag -- ? ) + [ "code" optional-attr [ attr>word execute ] [ t ] if* ] + [ "value" optional-attr [ value ] [ t ] if* ] + bi and ; + +CHLOE: if dup if-satisfied? [ process-tag-children ] [ drop ] if ; + +CHLOE-SINGLETON: label +CHLOE-SINGLETON: link +CHLOE-SINGLETON: farkup +CHLOE-SINGLETON: inspector +CHLOE-SINGLETON: comparison +CHLOE-SINGLETON: html +CHLOE-SINGLETON: hidden + +CHLOE-TUPLE: field +CHLOE-TUPLE: textarea +CHLOE-TUPLE: password +CHLOE-TUPLE: choice +CHLOE-TUPLE: checkbox +CHLOE-TUPLE: code + +: process-chloe-tag ( tag -- ) + dup name-tag dup tags get at + [ call ] [ "Unknown chloe tag: " prepend throw ] ?if ; + +: process-tag ( tag -- ) + { + [ name-tag >lower tag-stack get push ] + [ write-start-tag ] + [ process-tag-children ] + [ write-end-tag ] + [ drop tag-stack get pop* ] + } cleave ; + +: expand-attrs ( tag -- tag ) + dup [ tag? ] is? [ + clone [ + [ "@" ?head [ value present ] when ] assoc-map + ] change-attrs + ] when ; + +: process-template ( xml -- ) + expand-attrs + { + { [ dup [ chloe-tag? ] is? ] [ process-chloe-tag ] } + { [ dup [ tag? ] is? ] [ process-tag ] } + { [ t ] [ write-item ] } + } cond ; + +: process-chloe ( xml -- ) + [ + V{ } clone tag-stack set + + nested-template? get [ + process-template + ] [ + { + [ xml-prolog write-prolog ] + [ xml-before write-chunk ] + [ process-template ] + [ xml-after write-chunk ] + } cleave + ] if + ] with-scope ; + +M: chloe call-template* + path>> ".xml" append utf8 read-xml process-chloe ; + +INSTANCE: chloe template diff --git a/extra/html/templates/chloe/syntax/syntax.factor b/extra/html/templates/chloe/syntax/syntax.factor new file mode 100644 index 0000000000..7eeb756a39 --- /dev/null +++ b/extra/html/templates/chloe/syntax/syntax.factor @@ -0,0 +1,61 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +IN: html.templates.chloe.syntax +USING: accessors kernel sequences combinators kernel namespaces +classes.tuple assocs splitting words arrays memoize parser +io io.files io.encodings.utf8 io.streams.string +unicode.case tuple-syntax mirrors fry math urls +multiline xml xml.data xml.writer xml.utilities +html.elements +html.components +html.templates ; + +SYMBOL: tags + +tags global [ H{ } clone or ] change-at + +: define-chloe-tag ( name quot -- ) swap tags get set-at ; + +: CHLOE: + scan parse-definition define-chloe-tag ; parsing + +: chloe-ns "http://factorcode.org/chloe/1.0" ; inline + +MEMO: chloe-name ( string -- name ) + name new + swap >>tag + chloe-ns >>url ; + +: required-attr ( tag name -- value ) + dup chloe-name rot at* + [ nip ] [ drop " attribute is required" append throw ] if ; + +: optional-attr ( tag name -- value ) + chloe-name swap at ; + +: singleton-component-tag ( tag class -- ) + [ "name" required-attr ] dip render ; + +: CHLOE-SINGLETON: + scan-word + [ word-name ] [ '[ , singleton-component-tag ] ] bi + define-chloe-tag ; + parsing + +: attrs>slots ( tag tuple -- ) + [ attrs>> ] [ ] bi* + '[ + swap tag>> dup "name" = + [ 2drop ] [ , set-at ] if + ] assoc-each ; + +: tuple-component-tag ( tag class -- ) + [ drop "name" required-attr ] + [ new [ attrs>slots ] keep ] + 2bi render ; + +: CHLOE-TUPLE: + scan-word + [ word-name ] [ '[ , tuple-component-tag ] ] bi + define-chloe-tag ; + parsing diff --git a/extra/http/server/templating/chloe/test/test1.xml b/extra/html/templates/chloe/test/test1.xml similarity index 100% rename from extra/http/server/templating/chloe/test/test1.xml rename to extra/html/templates/chloe/test/test1.xml diff --git a/extra/html/templates/chloe/test/test10.xml b/extra/html/templates/chloe/test/test10.xml new file mode 100644 index 0000000000..33fe2008a5 --- /dev/null +++ b/extra/html/templates/chloe/test/test10.xml @@ -0,0 +1,3 @@ + + + diff --git a/extra/html/templates/chloe/test/test11.xml b/extra/html/templates/chloe/test/test11.xml new file mode 100644 index 0000000000..f74256bd84 --- /dev/null +++ b/extra/html/templates/chloe/test/test11.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + +
+ +
diff --git a/extra/html/templates/chloe/test/test12.xml b/extra/html/templates/chloe/test/test12.xml new file mode 100644 index 0000000000..b26778c96e --- /dev/null +++ b/extra/html/templates/chloe/test/test12.xml @@ -0,0 +1,3 @@ + + + diff --git a/extra/http/server/templating/chloe/test/test2.xml b/extra/html/templates/chloe/test/test2.xml similarity index 100% rename from extra/http/server/templating/chloe/test/test2.xml rename to extra/html/templates/chloe/test/test2.xml diff --git a/extra/http/server/templating/chloe/test/test3-aux.xml b/extra/html/templates/chloe/test/test3-aux.xml similarity index 100% rename from extra/http/server/templating/chloe/test/test3-aux.xml rename to extra/html/templates/chloe/test/test3-aux.xml diff --git a/extra/http/server/templating/chloe/test/test3.xml b/extra/html/templates/chloe/test/test3.xml similarity index 100% rename from extra/http/server/templating/chloe/test/test3.xml rename to extra/html/templates/chloe/test/test3.xml diff --git a/extra/http/server/templating/chloe/test/test6.xml b/extra/html/templates/chloe/test/test4.xml similarity index 63% rename from extra/http/server/templating/chloe/test/test6.xml rename to extra/html/templates/chloe/test/test4.xml index 5b6a71cf6b..55612360a5 100644 --- a/extra/http/server/templating/chloe/test/test6.xml +++ b/extra/html/templates/chloe/test/test4.xml @@ -2,7 +2,7 @@ - + True diff --git a/extra/http/server/templating/chloe/test/test7.xml b/extra/html/templates/chloe/test/test5.xml similarity index 63% rename from extra/http/server/templating/chloe/test/test7.xml rename to extra/html/templates/chloe/test/test5.xml index 4381b5cec4..edcbe8f3b1 100644 --- a/extra/http/server/templating/chloe/test/test7.xml +++ b/extra/html/templates/chloe/test/test5.xml @@ -2,7 +2,7 @@ - + True diff --git a/extra/html/templates/chloe/test/test6.xml b/extra/html/templates/chloe/test/test6.xml new file mode 100644 index 0000000000..8e2ff2e8ad --- /dev/null +++ b/extra/html/templates/chloe/test/test6.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + Checkbox + + diff --git a/extra/html/templates/chloe/test/test7.xml b/extra/html/templates/chloe/test/test7.xml new file mode 100644 index 0000000000..6166c800ed --- /dev/null +++ b/extra/html/templates/chloe/test/test7.xml @@ -0,0 +1,11 @@ + + + + +
    + +
  • +
    +
+ +
diff --git a/extra/html/templates/chloe/test/test8.xml b/extra/html/templates/chloe/test/test8.xml new file mode 100644 index 0000000000..fd4a64ad0a --- /dev/null +++ b/extra/html/templates/chloe/test/test8.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + +
+ +
diff --git a/extra/html/templates/chloe/test/test9.xml b/extra/html/templates/chloe/test/test9.xml new file mode 100644 index 0000000000..a9b2769445 --- /dev/null +++ b/extra/html/templates/chloe/test/test9.xml @@ -0,0 +1,3 @@ + + +Hello diff --git a/extra/http/server/templating/fhtml/authors.txt b/extra/html/templates/fhtml/authors.txt similarity index 100% rename from extra/http/server/templating/fhtml/authors.txt rename to extra/html/templates/fhtml/authors.txt diff --git a/extra/http/server/templating/fhtml/fhtml-tests.factor b/extra/html/templates/fhtml/fhtml-tests.factor similarity index 74% rename from extra/http/server/templating/fhtml/fhtml-tests.factor rename to extra/html/templates/fhtml/fhtml-tests.factor index 42bec43570..43ea28fa55 100755 --- a/extra/http/server/templating/fhtml/fhtml-tests.factor +++ b/extra/html/templates/fhtml/fhtml-tests.factor @@ -1,10 +1,10 @@ USING: io io.files io.streams.string io.encodings.utf8 -http.server.templating http.server.templating.fhtml kernel +html.templates html.templates.fhtml kernel tools.test sequences parser ; -IN: http.server.templating.fhtml.tests +IN: html.templates.fhtml.tests : test-template ( path -- ? ) - "resource:extra/http/server/templating/fhtml/test/" + "resource:extra/html/templates/fhtml/test/" prepend [ ".fhtml" append [ call-template ] with-string-writer diff --git a/extra/http/server/templating/fhtml/fhtml.factor b/extra/html/templates/fhtml/fhtml.factor similarity index 62% rename from extra/http/server/templating/fhtml/fhtml.factor rename to extra/html/templates/fhtml/fhtml.factor index 2cc053a0ca..74e5c37ef1 100755 --- a/extra/http/server/templating/fhtml/fhtml.factor +++ b/extra/html/templates/fhtml/fhtml.factor @@ -4,12 +4,10 @@ USING: continuations sequences kernel namespaces debugger combinators math quotations generic strings splitting accessors assocs fry -parser io io.files io.streams.string io.encodings.utf8 source-files -html html.elements -http.server.static http.server http.server.templating ; -IN: http.server.templating.fhtml - -: templating-vocab ( -- vocab-name ) "http.server.templating.fhtml" ; +parser io io.files io.streams.string io.encodings.utf8 +html.elements +html.templates ; +IN: html.templates.fhtml ! We use a custom lexer so that %> ends a token even if not ! followed by whitespace @@ -35,7 +33,7 @@ DEFER: <% delimiter : found-<% ( accum lexer col -- accum ) [ over line-text>> - >r >r column>> r> r> subseq parsed + [ column>> ] 2dip subseq parsed \ write-html parsed ] 2keep 2 + >>column drop ; @@ -62,37 +60,20 @@ DEFER: <% delimiter : parse-template ( string -- quot ) [ - use [ clone ] change - templating-vocab use+ + "quiet" on + parser-notes off + "html.templates.fhtml" use+ string-lines parse-template-lines - ] with-scope ; + ] with-file-vocabs ; -: eval-template ( string -- ) parse-template call ; - -: html-error. ( error -- ) -
 error. 
; +: eval-template ( string -- ) + parse-template call ; TUPLE: fhtml path ; C: fhtml M: fhtml call-template* ( filename -- ) - '[ - , path>> [ - "quiet" on - parser-notes off - templating-vocab use+ - ! so that reload works properly - dup source-file file set - utf8 file-contents - [ eval-template ] [ html-error. drop ] recover - ] with-file-vocabs - ] assert-depth ; - -! file responder integration -: enable-fhtml ( responder -- responder ) - [ serve-template ] - "application/x-factor-server-page" - pick special>> set-at ; + '[ , path>> utf8 file-contents eval-template ] assert-depth ; INSTANCE: fhtml template diff --git a/extra/http/server/templating/fhtml/test/bug.fhtml b/extra/html/templates/fhtml/test/bug.fhtml similarity index 100% rename from extra/http/server/templating/fhtml/test/bug.fhtml rename to extra/html/templates/fhtml/test/bug.fhtml diff --git a/extra/http/server/templating/fhtml/test/bug.html b/extra/html/templates/fhtml/test/bug.html similarity index 100% rename from extra/http/server/templating/fhtml/test/bug.html rename to extra/html/templates/fhtml/test/bug.html diff --git a/extra/http/server/templating/fhtml/test/example.fhtml b/extra/html/templates/fhtml/test/example.fhtml similarity index 100% rename from extra/http/server/templating/fhtml/test/example.fhtml rename to extra/html/templates/fhtml/test/example.fhtml diff --git a/extra/http/server/templating/fhtml/test/example.html b/extra/html/templates/fhtml/test/example.html similarity index 100% rename from extra/http/server/templating/fhtml/test/example.html rename to extra/html/templates/fhtml/test/example.html diff --git a/extra/http/server/templating/fhtml/test/stack.fhtml b/extra/html/templates/fhtml/test/stack.fhtml similarity index 100% rename from extra/http/server/templating/fhtml/test/stack.fhtml rename to extra/html/templates/fhtml/test/stack.fhtml diff --git a/extra/http/server/templating/fhtml/test/stack.html b/extra/html/templates/fhtml/test/stack.html similarity index 100% rename from extra/http/server/templating/fhtml/test/stack.html rename to extra/html/templates/fhtml/test/stack.html diff --git a/extra/html/templates/templates.factor b/extra/html/templates/templates.factor new file mode 100644 index 0000000000..de774f0864 --- /dev/null +++ b/extra/html/templates/templates.factor @@ -0,0 +1,88 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors kernel fry io io.encodings.utf8 io.files +debugger prettyprint continuations namespaces boxes sequences +arrays strings html.elements io.streams.string +quotations xml.data xml.writer ; +IN: html.templates + +MIXIN: template + +GENERIC: call-template* ( template -- ) + +M: string call-template* write ; + +M: callable call-template* call ; + +M: xml call-template* write-xml ; + +M: object call-template* output-stream get stream-copy ; + +ERROR: template-error template error ; + +M: template-error error. + "Error while processing template " write + [ template>> short. ":" print nl ] + [ error>> error. ] + bi ; + +: call-template ( template -- ) + [ call-template* ] [ \ template-error boa rethrow ] recover ; + +SYMBOL: title + +: set-title ( string -- ) + title get >box ; + +: write-title ( -- ) + title get value>> write ; + +SYMBOL: style + +: add-style ( string -- ) + "\n" style get push-all + style get push-all ; + +: write-style ( -- ) + style get >string write ; + +SYMBOL: atom-feeds + +: add-atom-feed ( title url -- ) + 2array atom-feeds get push ; + +: write-atom-feeds ( -- ) + atom-feeds get [ + + ] each ; + +SYMBOL: nested-template? + +SYMBOL: next-template + +: call-next-template ( -- ) + next-template get write-html ; + +M: f call-template* drop call-next-template ; + +: with-boilerplate ( body template -- ) + [ + title [ or ] change + style [ SBUF" " clone or ] change + atom-feeds [ V{ } like ] change + + [ + [ + nested-template? on + call-template + ] with-string-writer + next-template set + ] + [ call-template ] + bi* + ] with-scope ; inline + +: template-convert ( template output -- ) + utf8 [ call-template ] with-file-writer ; diff --git a/extra/http/client/client-tests.factor b/extra/http/client/client-tests.factor index 1d947b99e5..daf4ad88d3 100755 --- a/extra/http/client/client-tests.factor +++ b/extra/http/client/client-tests.factor @@ -1,9 +1,7 @@ USING: http.client http.client.private http tools.test -tuple-syntax namespaces ; -[ "localhost" 80 ] [ "localhost" parse-host ] unit-test +tuple-syntax namespaces urls ; +[ "localhost" f ] [ "localhost" parse-host ] unit-test [ "localhost" 8888 ] [ "localhost:8888" parse-host ] unit-test -[ "/foo" "localhost" 8888 ] [ "http://localhost:8888/foo" parse-url ] unit-test -[ "/" "localhost" 8888 ] [ "http://localhost:8888" parse-url ] unit-test [ "foo.txt" ] [ "http://www.paulgraham.com/foo.txt" download-name ] unit-test [ "foo.txt" ] [ "http://www.arc.com/foo.txt?xxx" download-name ] unit-test @@ -12,17 +10,26 @@ tuple-syntax namespaces ; [ TUPLE{ request + url: TUPLE{ url protocol: "http" host: "www.apple.com" port: 80 path: "/index.html" } method: "GET" - host: "www.apple.com" - path: "/index.html" - port: 80 version: "1.1" cookies: V{ } - header: H{ { "connection" "close" } } + header: H{ { "connection" "close" } { "user-agent" "Factor http.client vocabulary" } } } ] [ - [ - "http://www.apple.com/index.html" - - ] with-scope + "http://www.apple.com/index.html" + +] unit-test + +[ + TUPLE{ request + url: TUPLE{ url protocol: "https" host: "www.amazon.com" port: 443 path: "/index.html" } + method: "GET" + version: "1.1" + cookies: V{ } + header: H{ { "connection" "close" } { "user-agent" "Factor http.client vocabulary" } } + } +] [ + "https://www.amazon.com/index.html" + ] unit-test diff --git a/extra/http/client/client.factor b/extra/http/client/client.factor index cc356ca8e3..7b48bf93af 100755 --- a/extra/http/client/client.factor +++ b/extra/http/client/client.factor @@ -2,8 +2,9 @@ ! See http://factorcode.org/license.txt for BSD license. USING: assocs http kernel math math.parser namespaces sequences io io.sockets io.streams.string io.files io.timeouts strings -splitting calendar continuations accessors vectors -io.encodings.8-bit io.encodings.binary fry debugger inspector ; +splitting calendar continuations accessors vectors math.order +io.encodings.8-bit io.encodings.binary io.streams.duplex +fry debugger inspector ascii urls ; IN: http.client : max-redirects 10 ; @@ -18,81 +19,56 @@ DEFER: http-request r >>path r> dup [ query>assoc ] when >>query ; - -: request-with-url ( url request -- request ) - swap parse-url >r >r store-path r> >>host r> >>port ; - -! This is all pretty complex because it needs to handle -! HTTP redirects, which might be absolute or relative -: absolute-redirect ( url -- request ) - request get request-with-url ; - -: relative-redirect ( path -- request ) - request get swap store-path ; - SYMBOL: redirects -: absolute-url? ( url -- ? ) - [ "http://" head? ] [ "https://" head? ] bi or ; +: redirect-url ( request url -- request ) + '[ , >url ensure-port derive-url ensure-port ] change-url ; -: do-redirect ( response -- response stream ) - dup response-code 300 399 between? [ - stdio get dispose +: do-redirect ( response data -- response data ) + over code>> 300 399 between? [ + drop redirects inc redirects get max-redirects < [ - header>> "location" swap at - dup absolute-url? [ - absolute-redirect - ] [ - relative-redirect - ] if "GET" >>method http-request + request get + swap "location" header redirect-url + "GET" >>method http-request ] [ too-many-redirects ] if - ] [ - stdio get - ] if ; - -: close-on-error ( stream quot -- ) - '[ , with-stream* ] [ ] pick '[ , dispose ] cleanup ; inline + ] when ; PRIVATE> -: http-request ( request -- response stream ) - dup request [ - dup request-addr latin1 - 1 minutes over set-timeout - [ - write-request flush - read-response - do-redirect - ] close-on-error - ] with-variable ; +: read-chunk-size ( -- n ) + read-crlf ";" split1 drop [ blank? ] right-trim + hex> [ "Bad chunk size" throw ] unless* ; : read-chunks ( -- ) - read-crlf ";" split1 drop hex> dup { f 0 } member? + read-chunk-size dup zero? [ drop ] [ read % read-crlf "" assert= read-chunks ] if ; -: do-chunked-encoding ( response stream -- response stream/string ) - over "transfer-encoding" header "chunked" = [ - [ [ read-chunks ] "" make ] with-stream - ] when ; +: read-response-body ( response -- response data ) + dup "transfer-encoding" header "chunked" = + [ [ read-chunks ] "" make ] [ input-stream get contents ] if ; + +: http-request ( request -- response data ) + dup request [ + dup url>> url-addr latin1 [ + 1 minutes timeouts + write-request + read-response + read-response-body + ] with-client + do-redirect + ] with-variable ; : ( url -- request ) - request-with-url "GET" >>method ; + + "GET" >>method + swap >url ensure-port >>url ; -: string-or-contents ( stream/string -- string ) - dup string? [ contents ] unless ; - -: http-get-stream ( url -- response stream/string ) - http-request do-chunked-encoding ; +: http-get* ( url -- response data ) + http-request ; : success? ( code -- ? ) 200 = ; @@ -112,29 +88,23 @@ M: download-failed error. over code>> success? [ nip ] [ download-failed ] if ; : http-get ( url -- string ) - http-get-stream string-or-contents check-response ; + http-get* check-response ; : download-name ( url -- name ) file-name "?" split1 drop "/" ?tail drop ; : download-to ( url file -- ) #! Downloads the contents of a URL to a file. - swap http-get-stream check-response - dup string? [ - latin1 [ write ] with-file-writer - ] [ - [ swap latin1 stream-copy ] with-disposal - ] if ; + [ http-get ] dip latin1 [ write ] with-file-writer ; : download ( url -- ) dup download-name download-to ; -: ( content-type content url -- request ) +: ( post-data url -- request ) - request-with-url - "POST" >>method - swap >>post-data - swap >>post-data-type ; + "POST" >>method + swap >url ensure-port >>url + swap >>post-data ; -: http-post ( content-type content url -- response string ) - http-request do-chunked-encoding string-or-contents ; +: http-post ( post-data url -- response data ) + http-request ; diff --git a/extra/http/http-tests.factor b/extra/http/http-tests.factor index 3a50630335..c1d5b46aa4 100755 --- a/extra/http/http-tests.factor +++ b/extra/http/http-tests.factor @@ -1,49 +1,27 @@ USING: http tools.test multiline tuple-syntax io.streams.string kernel arrays splitting sequences -assocs io.sockets ; +assocs io.sockets db db.sqlite continuations urls hashtables ; IN: http.tests -[ "hello%20world" ] [ "hello world" url-encode ] unit-test -[ "hello world" ] [ "hello%20world" url-decode ] unit-test -[ "~hello world" ] [ "%7ehello+world" url-decode ] unit-test -[ f ] [ "%XX%XX%XX" url-decode ] unit-test -[ f ] [ "%XX%XX%X" url-decode ] unit-test - -[ "hello world" ] [ "hello+world" url-decode ] unit-test -[ "hello world" ] [ "hello%20world" url-decode ] unit-test -[ " ! " ] [ "%20%21%20" url-decode ] unit-test -[ "hello world" ] [ "hello world%" url-decode ] unit-test -[ "hello world" ] [ "hello world%x" url-decode ] unit-test -[ "hello%20world" ] [ "hello world" url-encode ] unit-test -[ "%20%21%20" ] [ " ! " url-encode ] unit-test - -[ "\u001234hi\u002045" ] [ "\u001234hi\u002045" url-encode url-decode ] unit-test - -[ "/" ] [ "http://foo.com" url>path ] unit-test -[ "/" ] [ "http://foo.com/" url>path ] unit-test -[ "/bar" ] [ "http://foo.com/bar" url>path ] unit-test -[ "/bar" ] [ "/bar" url>path ] unit-test - : lf>crlf "\n" split "\r\n" join ; STRING: read-request-test-1 -GET http://foo/bar HTTP/1.1 +POST http://foo/bar HTTP/1.1 Some-Header: 1 Some-Header: 2 Content-Length: 4 +Content-type: application/octet-stream blah ; [ TUPLE{ request - port: 80 - method: "GET" - path: "/bar" - query: H{ } + url: TUPLE{ url protocol: "http" port: 80 path: "/bar" } + method: "POST" version: "1.1" - header: H{ { "some-header" "1; 2" } { "content-length" "4" } } - post-data: "blah" + header: H{ { "some-header" "1; 2" } { "content-length" "4" } { "content-type" "application/octet-stream" } } + post-data: TUPLE{ post-data content: "blah" raw: "blah" content-type: "application/octet-stream" } cookies: V{ } } ] [ @@ -53,8 +31,9 @@ blah ] unit-test STRING: read-request-test-1' -GET /bar HTTP/1.1 +POST /bar HTTP/1.1 content-length: 4 +content-type: application/octet-stream some-header: 1; 2 blah @@ -76,13 +55,10 @@ Host: www.sex.com [ TUPLE{ request - port: 80 + url: TUPLE{ url protocol: "http" port: 80 host: "www.sex.com" path: "/bar" } method: "HEAD" - path: "/bar" - query: H{ } version: "1.1" header: H{ { "host" "www.sex.com" } } - host: "www.sex.com" cookies: V{ } } ] [ @@ -91,9 +67,18 @@ Host: www.sex.com ] with-string-reader ] unit-test +STRING: read-request-test-3 +GET nested HTTP/1.0 + +; + +[ read-request-test-3 [ read-request ] with-string-reader ] +[ "Bad request: URL" = ] +must-fail-with + STRING: read-response-test-1 HTTP/1.1 404 not found -Content-Type: text/html +Content-Type: text/html; charset=UTF8 blah ; @@ -103,8 +88,10 @@ blah version: "1.1" code: 404 message: "not found" - header: H{ { "content-type" "text/html" } } - cookies: V{ } + header: H{ { "content-type" "text/html; charset=UTF8" } } + cookies: { } + content-type: "text/html" + content-charset: "UTF8" } ] [ read-response-test-1 lf>crlf @@ -114,7 +101,7 @@ blah STRING: read-response-test-1' HTTP/1.1 404 not found -content-type: text/html +content-type: text/html; charset=UTF8 ; @@ -133,21 +120,35 @@ read-response-test-1' 1array [ ] unit-test ! Live-fire exercise -USING: http.server http.server.static http.server.actions -http.client io.server io.files io accessors namespaces threads -io.encodings.ascii ; +USING: http.server http.server.static furnace.sessions +furnace.actions furnace.auth.login furnace.db http.client +io.server io.files io io.encodings.ascii +accessors namespaces threads +http.server.responses http.server.redirection +http.server.dispatchers ; + +: add-quit-action + + [ stop-server "Goodbye" "text/html" ] >>display + "quit" add-responder ; + +: test-db "test.db" temp-file sqlite-db ; + +[ test-db drop delete-file ] ignore-errors + +test-db [ + init-sessions-table +] with-db [ ] [ [ - - [ stop-server "text/html" [ "Goodbye" write ] >>body ] >>display - "quit" add-responder + add-quit-action - "extra/http/test" resource-path >>default + "resource:extra/http/test" >>default "nested" add-responder - [ "redirect-loop" f ] >>display + [ URL" redirect-loop" ] >>display "redirect-loop" add-responder main-responder set @@ -155,19 +156,11 @@ io.encodings.ascii ; ] with-scope ] unit-test -[ t ] [ - "extra/http/test/foo.html" resource-path ascii file-contents - "http://localhost:1237/nested/foo.html" http-get = -] unit-test +[ ] [ 100 sleep ] unit-test -! Try with a slightly malformed request [ t ] [ - "localhost" 1237 ascii [ - "GET nested HTTP/1.0\r\n" write flush - "\r\n" write flush - read-crlf drop - read-header - ] with-stream "location" swap at "/" head? + "resource:extra/http/test/foo.html" ascii file-contents + "http://localhost:1237/nested/foo.html" http-get = ] unit-test [ "http://localhost:1237/redirect-loop" http-get ] @@ -176,3 +169,108 @@ io.encodings.ascii ; [ "Goodbye" ] [ "http://localhost:1237/quit" http-get ] unit-test + +! Dispatcher bugs +[ ] [ + [ + + + + + "" add-responder + add-quit-action + + "a" add-main-responder + "d" add-responder + test-db + main-responder set + + [ 1237 httpd ] "HTTPD test" spawn drop + ] with-scope +] unit-test + +[ ] [ 100 sleep ] unit-test + +: 404? [ download-failed? ] [ response>> code>> 404 = ] bi and ; + +! This should give a 404 not an infinite redirect loop +[ "http://localhost:1237/d/blah" http-get ] [ 404? ] must-fail-with + +! This should give a 404 not an infinite redirect loop +[ "http://localhost:1237/blah/" http-get ] [ 404? ] must-fail-with + +[ "Goodbye" ] [ "http://localhost:1237/quit" http-get ] unit-test + +[ ] [ + [ + + [ [ "Hi" write ] "text/plain" ] >>display + + + "" add-responder + add-quit-action + test-db + main-responder set + + [ 1237 httpd ] "HTTPD test" spawn drop + ] with-scope +] unit-test + +[ ] [ 100 sleep ] unit-test + +[ "Hi" ] [ "http://localhost:1237/" http-get ] unit-test + +[ "Goodbye" ] [ "http://localhost:1237/quit" http-get ] unit-test + +USING: html.components html.elements xml xml.utilities validators +furnace furnace.flash ; + +SYMBOL: a + +[ ] [ + [ + + + [ a get-global "a" set-value ] >>init + [ [ "a" render ] "text/html" ] >>display + [ { { "a" [ v-integer ] } } validate-params ] >>validate + [ "a" value a set-global URL" " ] >>submit + + + >>default + add-quit-action + test-db + main-responder set + + [ 1237 httpd ] "HTTPD test" spawn drop + ] with-scope +] unit-test + +[ ] [ 100 sleep ] unit-test + +3 a set-global + +: test-a string>xml "input" tag-named "value" swap at ; + +[ "3" ] [ + "http://localhost:1237/" http-get* + swap dup cookies>> "cookies" set session-id-key get-cookie + value>> "session-id" set test-a +] unit-test + +[ "4" ] [ + H{ { "a" "4" } { "__u" "http://localhost:1237/" } } "session-id" get session-id-key associate assoc-union + "http://localhost:1237/" "cookies" get >>cookies http-request nip test-a +] unit-test + +[ 4 ] [ a get-global ] unit-test + +! Test flash scope +[ "xyz" ] [ + H{ { "a" "xyz" } { "__u" "http://localhost:1237/" } } "session-id" get session-id-key associate assoc-union + "http://localhost:1237/" "cookies" get >>cookies http-request nip test-a +] unit-test + +[ 4 ] [ a get-global ] unit-test + +[ "Goodbye" ] [ "http://localhost:1237/quit" http-get ] unit-test diff --git a/extra/http/http.factor b/extra/http/http.factor index 3e81fccd24..04bebce926 100755 --- a/extra/http/http.factor +++ b/extra/http/http.factor @@ -4,67 +4,19 @@ USING: accessors kernel combinators math namespaces assocs sequences splitting sorting sets debugger strings vectors hashtables quotations arrays byte-arrays -math.parser calendar calendar.format +math.parser calendar calendar.format present -io io.streams.string io.encodings.utf8 io.encodings.string -io.sockets +io io.server io.sockets.secure -unicode.case unicode.categories qualified ; +unicode.case unicode.categories qualified + +urls html.templates xml xml.data xml.writer ; EXCLUDE: fry => , ; IN: http -: http-port 80 ; inline - -: url-quotable? ( ch -- ? ) - #! In a URL, can this character be used without - #! URL-encoding? - { - { [ dup letter? ] [ t ] } - { [ dup LETTER? ] [ t ] } - { [ dup digit? ] [ t ] } - { [ dup "/_-.:" member? ] [ t ] } - [ f ] - } cond nip ; foldable - -: push-utf8 ( ch -- ) - 1string utf8 encode - [ CHAR: % , >hex 2 CHAR: 0 pad-left % ] each ; - -: url-encode ( str -- str ) - [ - [ dup url-quotable? [ , ] [ push-utf8 ] if ] each - ] "" make ; - -: url-decode-hex ( index str -- ) - 2dup length 2 - >= [ - 2drop - ] [ - >r 1+ dup 2 + r> subseq hex> [ , ] when* - ] if ; - -: url-decode-% ( index str -- index str ) - 2dup url-decode-hex >r 3 + r> ; - -: url-decode-+-or-other ( index str ch -- index str ) - dup CHAR: + = [ drop CHAR: \s ] when , >r 1+ r> ; - -: url-decode-iter ( index str -- ) - 2dup length >= [ - 2drop - ] [ - 2dup nth dup CHAR: % = [ - drop url-decode-% - ] [ - url-decode-+-or-other - ] if url-decode-iter - ] if ; - -: url-decode ( str -- str ) - [ 0 swap url-decode-iter ] "" make utf8 decode ; - -: crlf "\r\n" write ; +: crlf ( -- ) "\r\n" write ; : add-header ( value key assoc -- ) [ at dup [ "; " rot 3append ] [ drop ] if ] 2keep set-at ; @@ -102,10 +54,9 @@ IN: http : header-value>string ( value -- string ) { - { [ dup number? ] [ number>string ] } { [ dup timestamp? ] [ timestamp>http-string ] } - { [ dup string? ] [ ] } - { [ dup sequence? ] [ [ header-value>string ] map "; " join ] } + { [ dup array? ] [ [ header-value>string ] map "; " join ] } + [ present ] } cond ; : check-header-string ( str -- str ) @@ -119,27 +70,12 @@ IN: http header-value>string check-header-string write crlf ] assoc-each crlf ; -: query>assoc ( query -- assoc ) - dup [ - "&" split [ - "=" split1 [ dup [ url-decode ] when ] bi@ - ] H{ } map>assoc - ] when ; - -: assoc>query ( hash -- str ) - [ - [ url-encode ] - [ dup number? [ number>string ] when url-encode ] - bi* - "=" swap 3append - ] { } assoc>map - "&" join ; - -TUPLE: cookie name value path domain expires http-only ; +TUPLE: cookie name value path domain expires max-age http-only ; : ( value name -- cookie ) cookie new - swap >>name swap >>value ; + swap >>name + swap >>value ; : parse-cookies ( string -- seq ) [ @@ -147,7 +83,8 @@ TUPLE: cookie name value path domain expires http-only ; ";" split [ [ blank? ] trim "=" split1 swap >lower { - { "expires" [ >>expires ] } + { "expires" [ cookie-string>timestamp >>expires ] } + { "max-age" [ string>number seconds >>max-age ] } { "domain" [ >>domain ] } { "path" [ >>path ] } { "httponly" [ drop t >>http-only ] } @@ -163,7 +100,14 @@ TUPLE: cookie name value path domain expires http-only ; { { f [ drop ] } { t [ , ] } - [ "=" swap 3append , ] + [ + { + { [ dup timestamp? ] [ timestamp>cookie-string ] } + { [ dup duration? ] [ dt>seconds number>string ] } + [ ] + } cond + "=" swap 3append , + ] } case ; : unparse-cookie ( cookie -- strings ) @@ -172,6 +116,7 @@ TUPLE: cookie name value path domain expires http-only ; "path" over path>> (unparse-cookie) "domain" over domain>> (unparse-cookie) "expires" over expires>> (unparse-cookie) + "max-age" over max-age>> (unparse-cookie) "httponly" over http-only>> (unparse-cookie) drop ] { } make ; @@ -180,64 +125,43 @@ TUPLE: cookie name value path domain expires http-only ; [ unparse-cookie ] map concat "; " join ; TUPLE: request -host -port method -path -query +url version header post-data -post-data-type cookies ; : set-header ( request/response value key -- request/response ) pick header>> set-at ; -: +: ( -- request ) request new "1.1" >>version - http-port >>port + + "http" >>protocol + H{ } clone >>query + >>url H{ } clone >>header - H{ } clone >>query V{ } clone >>cookies - "close" "connection" set-header ; - -: query-param ( request key -- value ) - swap query>> at ; - -: set-query-param ( request value key -- request ) - pick query>> set-at ; - -: chop-hostname ( str -- str' ) - CHAR: / over index over length or tail - dup empty? [ drop "/" ] when ; - -: url>path ( url -- path ) - #! Technically, only proxies are meant to support hostnames - #! in HTTP requests, but IE sends these sometimes so we - #! just chop the hostname part. - url-decode "http://" ?head [ chop-hostname ] when ; + "close" "connection" set-header + "Factor http.client vocabulary" "user-agent" set-header ; : read-method ( request -- request ) " " read-until [ "Bad request: method" throw ] unless >>method ; -: read-query ( request -- request ) - " " read-until - [ "Bad request: query params" throw ] unless - query>assoc >>query ; +: check-absolute ( url -- url ) + dup path>> "/" head? [ "Bad request: URL" throw ] unless ; inline : read-url ( request -- request ) - " ?" read-until { - { CHAR: \s [ dup empty? [ drop read-url ] [ url>path >>path ] if ] } - { CHAR: ? [ url>path >>path read-query ] } - [ "Bad request: URL" throw ] - } case ; + " " read-until [ + dup empty? [ drop read-url ] [ >url check-absolute >>url ] if + ] [ "Bad request: URL" throw ] if ; : parse-version ( string -- version ) - "HTTP/" ?head [ "Bad version" throw ] unless - dup { "1.0" "1.1" } member? [ "Bad version" throw ] unless ; + "HTTP/" ?head [ "Bad request: version" throw ] unless + dup { "1.0" "1.1" } member? [ "Bad request: version" throw ] unless ; : read-request-version ( request -- request ) read-crlf [ CHAR: \s = ] left-trim @@ -250,37 +174,46 @@ cookies ; : header ( request/response key -- value ) swap header>> at ; -SYMBOL: max-post-request +TUPLE: post-data raw content content-type ; -1024 256 * max-post-request set-global +: ( raw content-type -- post-data ) + post-data new + swap >>content-type + swap >>raw ; -: content-length ( header -- n ) - "content-length" swap at string>number dup [ - dup max-post-request get > [ - "content-length > max-post-request" throw - ] when - ] when ; +: parse-post-data ( post-data -- post-data ) + [ ] [ raw>> ] [ content-type>> ] tri { + { "application/x-www-form-urlencoded" [ query>assoc ] } + { "text/xml" [ string>xml ] } + [ drop ] + } case >>content ; : read-post-data ( request -- request ) - dup header>> content-length [ read >>post-data ] when* ; - -: parse-host ( string -- host port ) - "." ?tail drop ":" split1 - [ string>number ] [ http-port ] if* ; + dup method>> "POST" = [ + [ ] + [ "content-length" header string>number read ] + [ "content-type" header ] tri + parse-post-data >>post-data + ] when ; : extract-host ( request -- request ) - dup "host" header parse-host >r >>host r> >>port ; - -: extract-post-data-type ( request -- request ) - dup "content-type" header >>post-data-type ; - -: parse-post-data ( request -- request ) - dup post-data-type>> "application/x-www-form-urlencoded" = - [ dup post-data>> query>assoc >>post-data ] when ; + [ ] [ url>> ] [ "host" header parse-host ] tri + [ >>host ] [ >>port ] bi* + ensure-port + drop ; : extract-cookies ( request -- request ) dup "cookie" header [ parse-cookies >>cookies ] when* ; +: parse-content-type-attributes ( string -- attributes ) + " " split harvest [ "=" split1 [ >lower ] dip ] { } map>assoc ; + +: parse-content-type ( content-type -- type encoding ) + ";" split1 parse-content-type-attributes "charset" swap at ; + +: detect-protocol ( request -- request ) + dup url>> remote-address get secure? "https" "http" ? >>protocol drop ; + : read-request ( -- request ) read-method @@ -288,49 +221,53 @@ SYMBOL: max-post-request read-request-version read-request-header read-post-data + detect-protocol extract-host - extract-post-data-type - parse-post-data extract-cookies ; : write-method ( request -- request ) dup method>> write bl ; -: (link>string) ( url query -- url' ) - [ url-encode ] [ assoc>query ] bi* - dup empty? [ drop ] [ "?" swap 3append ] if ; - -: write-url ( request -- ) - [ path>> ] [ query>> ] bi (link>string) write ; - : write-request-url ( request -- request ) - dup write-url bl ; + dup url>> relative-url present write bl ; : write-version ( request -- request ) "HTTP/" write dup request-version write crlf ; -: unparse-post-data ( request -- request ) - dup post-data>> dup sequence? [ drop ] [ - assoc>query >>post-data - "application/x-www-form-urlencoded" >>post-data-type - ] if ; - -: request-addr ( request -- addr ) - [ host>> ] [ port>> ] bi ; - -: request-host ( request -- string ) - [ host>> ] [ drop ":" ] [ port>> number>string ] tri 3append ; +: url-host ( url -- string ) + [ host>> ] [ port>> ] bi dup "http" protocol-port = + [ drop ] [ ":" swap number>string 3append ] if ; : write-request-header ( request -- request ) dup header>> >hashtable - over host>> [ over request-host "host" pick set-at ] when - over post-data>> [ length "content-length" pick set-at ] when* - over post-data-type>> [ "content-type" pick set-at ] when* + over url>> host>> [ over url>> url-host "host" pick set-at ] when + over post-data>> [ + [ raw>> length "content-length" pick set-at ] + [ content-type>> "content-type" pick set-at ] + bi + ] when* over cookies>> f like [ unparse-cookies "cookie" pick set-at ] when* write-header ; +GENERIC: >post-data ( object -- post-data ) + +M: post-data >post-data ; + +M: string >post-data "application/octet-stream" ; + +M: byte-array >post-data "application/octet-stream" ; + +M: xml >post-data xml>string "text/xml" ; + +M: assoc >post-data assoc>query "application/x-www-form-urlencoded" ; + +M: f >post-data ; + +: unparse-post-data ( request -- request ) + [ >post-data ] change-post-data ; + : write-post-data ( request -- request ) - dup post-data>> [ write ] when* ; + dup method>> "POST" = [ dup post-data>> raw>> write ] when ; : write-request ( request -- ) unparse-post-data @@ -342,20 +279,6 @@ SYMBOL: max-post-request flush drop ; -: request-url ( request -- url ) - [ - [ - dup host>> [ - [ "http://" write host>> url-encode write ] - [ ":" write port>> number>string write ] - bi - ] [ drop ] if - ] - [ path>> "/" head? [ "/" write ] unless ] - [ write-url ] - tri - ] with-string-writer ; - GENERIC: write-response ( response -- ) GENERIC: write-full-response ( request response -- ) @@ -366,9 +289,11 @@ code message header cookies +content-type +content-charset body ; -: +: ( -- response ) response new "1.1" >>version H{ } clone >>header @@ -376,23 +301,26 @@ body ; now timestamp>http-string "date" set-header V{ } clone >>cookies ; -: read-response-version +: read-response-version ( response -- response ) " \t" read-until [ "Bad response: version" throw ] unless parse-version >>version ; -: read-response-code +: read-response-code ( response -- response ) " \t" read-until [ "Bad response: code" throw ] unless string>number [ "Bad response: code" throw ] unless* >>code ; -: read-response-message +: read-response-message ( response -- response ) read-crlf >>message ; -: read-response-header +: read-response-header ( response -- response ) read-header >>header - dup "set-cookie" header [ parse-cookies >>cookies ] when* ; + dup "set-cookie" header parse-cookies >>cookies + dup "content-type" header [ + parse-content-type [ >>content-type ] [ >>content-charset ] bi* + ] when* ; : read-response ( -- response ) @@ -411,24 +339,19 @@ body ; : write-response-message ( response -- response ) dup message>> write crlf ; +: unparse-content-type ( request -- content-type ) + [ content-type>> "application/octet-stream" or ] + [ content-charset>> ] bi + [ "; charset=" swap 3append ] when* ; + : write-response-header ( response -- response ) dup header>> clone - over cookies>> f like - [ unparse-cookies "set-cookie" pick set-at ] when* + over cookies>> f like [ unparse-cookies "set-cookie" pick set-at ] when* + over unparse-content-type "content-type" pick set-at write-header ; -GENERIC: write-response-body* ( body -- ) - -M: f write-response-body* drop ; - -M: string write-response-body* write ; - -M: callable write-response-body* call ; - -M: object write-response-body* stdio get stream-copy ; - : write-response-body ( response -- response ) - dup body>> write-response-body* ; + dup body>> call-template ; M: response write-response ( respose -- ) write-response-version @@ -442,20 +365,17 @@ M: response write-full-response ( request response -- ) dup write-response swap method>> "HEAD" = [ write-response-body ] unless ; -: set-content-type ( request/response content-type -- request/response ) - "content-type" set-header ; - : get-cookie ( request/response name -- cookie/f ) - >r cookies>> r> '[ , _ name>> = ] find nip ; + [ cookies>> ] dip '[ , _ name>> = ] find nip ; : delete-cookie ( request/response name -- ) - over cookies>> >r get-cookie r> delete ; + over cookies>> [ get-cookie ] dip delete ; : put-cookie ( request/response cookie -- request/response ) [ name>> dupd get-cookie [ dupd delete-cookie ] when* ] keep over cookies>> push ; -TUPLE: raw-response +TUPLE: raw-response version code message @@ -463,7 +383,7 @@ body ; : ( -- response ) raw-response new - "1.1" >>version ; + "1.1" >>version ; M: raw-response write-response ( respose -- ) write-response-version diff --git a/extra/http/mime/mime.factor b/extra/http/mime/mime.factor deleted file mode 100755 index f9097ecce3..0000000000 --- a/extra/http/mime/mime.factor +++ /dev/null @@ -1,35 +0,0 @@ -! Copyright (C) 2004, 2005 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: io assocs kernel sequences math namespaces splitting ; - -IN: http.mime - -: file-extension ( filename -- extension ) - "." split dup length 1 <= [ drop f ] [ peek ] if ; - -: mime-type ( filename -- mime-type ) - file-extension "mime-types" get at "application/octet-stream" or ; - -H{ - { "html" "text/html" } - { "txt" "text/plain" } - { "xml" "text/xml" } - { "css" "text/css" } - - { "gif" "image/gif" } - { "png" "image/png" } - { "jpg" "image/jpeg" } - { "jpeg" "image/jpeg" } - - { "jar" "application/octet-stream" } - { "zip" "application/octet-stream" } - { "tgz" "application/octet-stream" } - { "tar.gz" "application/octet-stream" } - { "gz" "application/octet-stream" } - - { "pdf" "application/pdf" } - - { "factor" "text/plain" } - { "cgi" "application/x-cgi-script" } - { "fhtml" "application/x-factor-server-page" } -} "mime-types" set-global diff --git a/extra/http/server/actions/actions-tests.factor b/extra/http/server/actions/actions-tests.factor deleted file mode 100755 index 90e632d7f5..0000000000 --- a/extra/http/server/actions/actions-tests.factor +++ /dev/null @@ -1,51 +0,0 @@ -IN: http.server.actions.tests -USING: http.server.actions http.server.validators -tools.test math math.parser multiline namespaces http -io.streams.string http.server sequences splitting accessors ; - -[ - "a" [ v-number ] { { "a" "123" } } validate-param - [ 123 ] [ "a" get ] unit-test -] with-scope - - - [ "a" get "b" get + ] >>display - { { "a" [ v-number ] } { "b" [ v-number ] } } >>get-params -"action-1" set - -: lf>crlf "\n" split "\r\n" join ; - -STRING: action-request-test-1 -GET http://foo/bar?a=12&b=13 HTTP/1.1 - -blah -; - -[ 25 ] [ - action-request-test-1 lf>crlf - [ read-request ] with-string-reader - request set - "/blah" - "action-1" get call-responder -] unit-test - - - [ +append-path get "xxx" get "X" concat append ] >>submit - { { +append-path [ ] } { "xxx" [ v-number ] } } >>post-params -"action-2" set - -STRING: action-request-test-2 -POST http://foo/bar/baz HTTP/1.1 -content-length: 5 -content-type: application/x-www-form-urlencoded - -xxx=4 -; - -[ "/blahXXXX" ] [ - action-request-test-2 lf>crlf - [ read-request ] with-string-reader - request set - "/blah" - "action-2" get call-responder -] unit-test diff --git a/extra/http/server/actions/actions.factor b/extra/http/server/actions/actions.factor deleted file mode 100755 index 2b2aaea6a8..0000000000 --- a/extra/http/server/actions/actions.factor +++ /dev/null @@ -1,50 +0,0 @@ -! Copyright (C) 2008 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: accessors sequences kernel assocs combinators -http.server http.server.validators http hashtables namespaces -fry continuations locals ; -IN: http.server.actions - -SYMBOL: +append-path - -SYMBOL: params - -TUPLE: action init display submit get-params post-params ; - -: - action new - [ ] >>init - [ <400> ] >>display - [ <400> ] >>submit ; - -:: validate-param ( name validator assoc -- ) - name assoc at validator with-validator name set ; inline - -: action-params ( validators -- error? ) - validation-failed? off - params get '[ , validate-param ] assoc-each - validation-failed? get ; - -: handle-get ( -- response ) - action get get-params>> action-params [ <400> ] [ - action get [ init>> call ] [ display>> call ] bi - ] if ; - -: handle-post ( -- response ) - action get post-params>> action-params - [ <400> ] [ action get submit>> call ] if ; - -: validation-failed ( -- * ) - action get display>> call exit-with ; - -M: action call-responder ( path action -- response ) - '[ - , , - [ +append-path associate request-params assoc-union params set ] - [ action set ] bi* - request get method>> { - { "GET" [ handle-get ] } - { "HEAD" [ handle-get ] } - { "POST" [ handle-post ] } - } case - ] with-exit-continuation ; diff --git a/extra/http/server/auth/auth.factor b/extra/http/server/auth/auth.factor deleted file mode 100755 index 69a3c76c2b..0000000000 --- a/extra/http/server/auth/auth.factor +++ /dev/null @@ -1,26 +0,0 @@ -! Copyright (c) 2008 Slava Pestov -! See http://factorcode.org/license.txt for BSD license. -USING: http.server.sessions accessors -http.server.auth.providers assocs namespaces kernel ; -IN: http.server.auth - -SYMBOL: logged-in-user -SYMBOL: user-profile-changed? - -GENERIC: init-user-profile ( responder -- ) - -M: object init-user-profile drop ; - -: uid ( -- string ) logged-in-user sget username>> ; - -: profile ( -- assoc ) logged-in-user sget profile>> ; - -: uget ( key -- value ) - profile at ; - -: uset ( value key -- ) - profile set-at user-profile-changed? on ; - -: uchange ( quot key -- ) - profile swap change-at - user-profile-changed? on ; inline diff --git a/extra/http/server/auth/login/login.factor b/extra/http/server/auth/login/login.factor deleted file mode 100755 index 7593f217f7..0000000000 --- a/extra/http/server/auth/login/login.factor +++ /dev/null @@ -1,394 +0,0 @@ -! Copyright (c) 2008 Slava Pestov -! See http://factorcode.org/license.txt for BSD license. -USING: accessors quotations assocs kernel splitting -base64 io combinators sequences io.files namespaces hashtables -fry io.sockets arrays threads locals qualified continuations -destructors - -html.elements -http -http.server -http.server.auth -http.server.auth.providers -http.server.auth.providers.null -http.server.actions -http.server.components -http.server.forms -http.server.sessions -http.server.boilerplate -http.server.templating -http.server.templating.chloe -http.server.validators ; -IN: http.server.auth.login -QUALIFIED: smtp - -SYMBOL: post-login-url -SYMBOL: login-failed? - -TUPLE: login < dispatcher users ; - -: users login get users>> ; - -! Destructor -TUPLE: user-saver user ; - -C: user-saver - -M: user-saver dispose - user-profile-changed? get [ - user>> users update-user - ] [ drop ] if ; - -: save-user-after ( user -- ) - add-always-destructor ; - -: login-template ( name -- template ) - "resource:extra/http/server/auth/login/" swap ".xml" - 3append ; - -! ! ! Login - -: - "login"
- "login" login-template >>edit-template - "username" - t >>required - add-field - "password" - t >>required - add-field ; - -: successful-login ( user -- response ) - logged-in-user sset - post-login-url sget "" or f - f post-login-url sset ; - -:: ( -- action ) - [let | form [ ] | - - [ blank-values ] >>init - - [ form edit-form ] >>display - - [ - blank-values - - form validate-form - - "password" value "username" value - users check-login [ - successful-login - ] [ - login-failed? on - validation-failed - ] if* - ] >>submit - ] ; - -! ! ! New user registration - -: ( -- form ) - "register" - "register" login-template >>edit-template - "username" - t >>required - add-field - "realname" add-field - "new-password" - t >>required - add-field - "verify-password" - t >>required - add-field - "email" add-field - "captcha" add-field ; - -SYMBOL: password-mismatch? -SYMBOL: user-exists? - -: same-password-twice ( -- ) - "new-password" value "verify-password" value = [ - password-mismatch? on - validation-failed - ] unless ; - -:: ( -- action ) - [let | form [ ] | - - [ blank-values ] >>init - - [ form edit-form ] >>display - - [ - blank-values - - form validate-form - - same-password-twice - - - "username" value >>username - "realname" value >>realname - "new-password" value >>password - "email" value >>email - - users new-user [ - user-exists? on - validation-failed - ] unless* - - successful-login - - login get default>> responder>> init-user-profile - ] >>submit - ] ; - -! ! ! Editing user profile - -: ( -- form ) - "edit-profile" - "edit-profile" login-template >>edit-template - "username" add-field - "realname" add-field - "password" add-field - "new-password" add-field - "verify-password" add-field - "email" add-field ; - -SYMBOL: previous-page - -:: ( -- action ) - [let | form [ ] | - - [ - blank-values - logged-in-user sget - dup username>> "username" set-value - dup realname>> "realname" set-value - dup email>> "email" set-value - ] >>init - - [ form edit-form ] >>display - - [ - blank-values - uid "username" set-value - - form validate-form - - logged-in-user sget - - "password" value empty? [ - same-password-twice - - "password" value uid users check-login - [ login-failed? on validation-failed ] unless - - "new-password" value >>password - ] unless - - "realname" value >>realname - "email" value >>email - - user-profile-changed? on - - previous-page sget f - ] >>submit - ] ; - -! ! ! Password recovery - -SYMBOL: lost-password-from - -: current-host ( -- string ) - request get host>> host-name or ; - -: new-password-url ( user -- url ) - "new-password" - swap [ - [ username>> "username" set ] - [ ticket>> "ticket" set ] - bi - ] H{ } make-assoc - derive-url ; - -: password-email ( user -- email ) - smtp: - [ "[ " % current-host % " ] password recovery" % ] "" make >>subject - lost-password-from get >>from - over email>> 1array >>to - [ - "This e-mail was sent by the application server on " % current-host % "\n" % - "because somebody, maybe you, clicked on a ``recover password'' link in the\n" % - "login form, and requested a new password for the user named ``" % - over username>> % "''.\n" % - "\n" % - "If you believe that this request was legitimate, you may click the below link in\n" % - "your browser to set a new password for your account:\n" % - "\n" % - swap new-password-url % - "\n\n" % - "Love,\n" % - "\n" % - " FactorBot\n" % - ] "" make >>body ; - -: send-password-email ( user -- ) - '[ , password-email smtp:send-email ] - "E-mail send thread" spawn drop ; - -: ( -- form ) - "register" - "recover-1" login-template >>edit-template - "username" - t >>required - add-field - "email" - t >>required - add-field - "captcha" add-field ; - -:: ( -- action ) - [let | form [ ] | - - [ blank-values ] >>init - - [ form edit-form ] >>display - - [ - blank-values - - form validate-form - - "email" value "username" value - users issue-ticket [ - send-password-email - ] when* - - "recover-2" login-template serve-template - ] >>submit - ] ; - -: - "new-password" - "recover-3" login-template >>edit-template - "username" - hidden >>renderer - t >>required - add-field - "new-password" - t >>required - add-field - "verify-password" - t >>required - add-field - "ticket" - hidden >>renderer - t >>required - add-field ; - -:: ( -- action ) - [let | form [ ] | - - [ - { "username" [ v-required ] } - { "ticket" [ v-required ] } - ] >>get-params - - [ - [ - "username" [ get ] keep set - "ticket" [ get ] keep set - ] H{ } make-assoc values set - ] >>init - - [ edit-form ] >>display - - [ - blank-values - - form validate-form - - same-password-twice - - "ticket" value - "username" value - users claim-ticket [ - "new-password" value >>password - users update-user - - "recover-4" login-template serve-template - ] [ - <400> - ] if* - ] >>submit - ] ; - -! ! ! Logout -: ( -- action ) - - [ - f logged-in-user sset - "login" f - ] >>submit ; - -! ! ! Authentication logic - -TUPLE: protected responder ; - -C: protected - -: show-login-page ( -- response ) - request get request-url post-login-url sset - "login" f ; - -M: protected call-responder ( path responder -- response ) - logged-in-user sget dup [ - save-user-after - request get request-url previous-page sset - responder>> call-responder - ] [ - 3drop - request get method>> { "GET" "HEAD" } member? - [ show-login-page ] [ <400> ] if - ] if ; - -M: login call-responder ( path responder -- response ) - dup login set - call-next-method ; - -: ( responder -- responder' ) - - "boilerplate" login-template >>template ; - -: ( responder -- auth ) - login new-dispatcher - swap >>default - "login" add-responder - "logout" add-responder - no-users >>users ; - -! ! ! Configuration - -: allow-edit-profile ( login -- login ) - - "edit-profile" add-responder ; - -: allow-registration ( login -- login ) - - "register" add-responder ; - -: allow-password-recovery ( login -- login ) - - "recover-password" add-responder - - "new-password" add-responder ; - -: allow-edit-profile? ( -- ? ) - login get responders>> "edit-profile" swap key? ; - -: allow-registration? ( -- ? ) - login get responders>> "register" swap key? ; - -: allow-password-recovery? ( -- ? ) - login get responders>> "recover-password" swap key? ; diff --git a/extra/http/server/auth/login/login.xml b/extra/http/server/auth/login/login.xml deleted file mode 100644 index 2f16c09d8d..0000000000 --- a/extra/http/server/auth/login/login.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - Login - - - - - - - - - - - - - - - -
User name:
Password:
- -

- - - - - invalid username or password - -

- -
- -

- - Register - - | - - Recover Password - -

- -
diff --git a/extra/http/server/auth/login/recover-1.xml b/extra/http/server/auth/login/recover-1.xml deleted file mode 100644 index dd3a60f1d1..0000000000 --- a/extra/http/server/auth/login/recover-1.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - Recover lost password: step 1 of 4 - -

Enter the username and e-mail address you used to register for this site, and you will receive a link for activating a new password.

- - - - - - - - - - - - - - - - - - - - - - - - - -
User name:
E-mail:
Captcha:
Leave the captcha blank. Spam-bots will fill it indiscriminantly, so their attempts to e-mail you will be blocked.
- - - -
- -
diff --git a/extra/http/server/auth/login/recover-3.xml b/extra/http/server/auth/login/recover-3.xml deleted file mode 100644 index 115c2cea21..0000000000 --- a/extra/http/server/auth/login/recover-3.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - Recover lost password: step 3 of 4 - -

Choose a new password for your account.

- - - - - - - - - - - - - - - - - - - - - - - -
Password:
Verify password:
Enter your password twice to ensure it is correct.
- -

- - - - passwords do not match - -

- -
- -
diff --git a/extra/http/server/auth/login/register.xml b/extra/http/server/auth/login/register.xml deleted file mode 100644 index 1bacf71801..0000000000 --- a/extra/http/server/auth/login/register.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - New User Registration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
User name:
Real name:
Specifying a real name is optional.
Password:
Verify:
Enter your password twice to ensure it is correct.
E-mail:
Specifying an e-mail address is optional. It enables the "recover password" feature.
Captcha:
Leave the captcha blank. Spam-bots will fill it indiscriminantly, so their attempts to register will be blocked.
- -

- - - - - username taken - - - - passwords do not match - - -

- -
- -
diff --git a/extra/http/server/auth/providers/assoc/assoc-tests.factor b/extra/http/server/auth/providers/assoc/assoc-tests.factor deleted file mode 100755 index a8f17d6f5d..0000000000 --- a/extra/http/server/auth/providers/assoc/assoc-tests.factor +++ /dev/null @@ -1,33 +0,0 @@ -IN: http.server.auth.providers.assoc.tests -USING: http.server.auth.providers -http.server.auth.providers.assoc tools.test -namespaces accessors kernel ; - - "provider" set - -[ t ] [ - - "slava" >>username - "foobar" >>password - "slava@factorcode.org" >>email - "provider" get new-user - username>> "slava" = -] unit-test - -[ f ] [ - - "slava" >>username - "provider" get new-user -] unit-test - -[ f ] [ "fdasf" "slava" "provider" get check-login >boolean ] unit-test - -[ ] [ "foobar" "slava" "provider" get check-login "user" set ] unit-test - -[ t ] [ "user" get >boolean ] unit-test - -[ ] [ "user" get "fdasf" >>password drop ] unit-test - -[ t ] [ "fdasf" "slava" "provider" get check-login >boolean ] unit-test - -[ f ] [ "foobar" "slava" "provider" get check-login >boolean ] unit-test diff --git a/extra/http/server/auth/providers/db/db-tests.factor b/extra/http/server/auth/providers/db/db-tests.factor deleted file mode 100755 index 6daddac304..0000000000 --- a/extra/http/server/auth/providers/db/db-tests.factor +++ /dev/null @@ -1,41 +0,0 @@ -IN: http.server.auth.providers.db.tests -USING: http.server.auth.providers -http.server.auth.providers.db tools.test -namespaces db db.sqlite db.tuples continuations -io.files accessors kernel ; - -users-in-db "provider" set - -"auth-test.db" temp-file sqlite-db [ - - init-users-table - - [ t ] [ - - "slava" >>username - "foobar" >>password - "slava@factorcode.org" >>email - "provider" get new-user - username>> "slava" = - ] unit-test - - [ f ] [ - - "slava" >>username - "provider" get new-user - ] unit-test - - [ f ] [ "fdasf" "slava" "provider" get check-login >boolean ] unit-test - - [ ] [ "foobar" "slava" "provider" get check-login "user" set ] unit-test - - [ t ] [ "user" get >boolean ] unit-test - - [ ] [ "user" get "fdasf" >>password drop ] unit-test - - [ ] [ "user" get "provider" get update-user ] unit-test - - [ t ] [ "fdasf" "slava" "provider" get check-login >boolean ] unit-test - - [ f ] [ "foobar" "slava" "provider" get check-login >boolean ] unit-test -] with-db diff --git a/extra/http/server/boilerplate/boilerplate.factor b/extra/http/server/boilerplate/boilerplate.factor deleted file mode 100644 index eabcefeb7f..0000000000 --- a/extra/http/server/boilerplate/boilerplate.factor +++ /dev/null @@ -1,75 +0,0 @@ -! Copyright (c) 2008 Slava Pestov -! See http://factorcode.org/license.txt for BSD license. -USING: accessors kernel namespaces boxes sequences strings -io io.streams.string arrays -html.elements -http -http.server -http.server.templating ; -IN: http.server.boilerplate - -TUPLE: boilerplate responder template ; - -: f boilerplate boa ; - -SYMBOL: title - -: set-title ( string -- ) - title get >box ; - -: write-title ( -- ) - title get value>> write ; - -SYMBOL: style - -: add-style ( string -- ) - "\n" style get push-all - style get push-all ; - -: write-style ( -- ) - style get >string write ; - -SYMBOL: atom-feed - -: set-atom-feed ( title url -- ) - 2array atom-feed get >box ; - -: write-atom-feed ( -- ) - atom-feed get value>> [ - - ] when* ; - -SYMBOL: nested-template? - -SYMBOL: next-template - -: call-next-template ( -- ) - next-template get write ; - -M: f call-template* drop call-next-template ; - -: with-boilerplate ( body template -- ) - [ - title get [ title set ] unless - atom-feed get [ atom-feed set ] unless - style get [ SBUF" " clone style set ] unless - - [ - [ - nested-template? on - write-response-body* - ] with-string-writer - next-template set - ] - [ call-template ] - bi* - ] with-scope ; inline - -M: boilerplate call-responder - tuck responder>> call-responder - dup "content-type" header "text/html" = [ - clone swap template>> - [ [ with-boilerplate ] 2curry ] curry change-body - ] [ nip ] if ; diff --git a/extra/http/server/cgi/cgi.factor b/extra/http/server/cgi/cgi.factor index 509943faa8..626cd78e14 100755 --- a/extra/http/server/cgi/cgi.factor +++ b/extra/http/server/cgi/cgi.factor @@ -1,11 +1,11 @@ ! Copyright (C) 2007, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: namespaces kernel assocs io.files combinators -arrays io.launcher io http.server.static http.server -http accessors sequences strings math.parser fry ; +USING: namespaces kernel assocs io.files io.streams.duplex +combinators arrays io.launcher io http.server.static http.server +http accessors sequences strings math.parser fry urls ; IN: http.server.cgi -: post? request get method>> "POST" = ; +: post? ( -- ? ) request get method>> "POST" = ; : cgi-variables ( script-path -- assoc ) #! This needs some work. @@ -14,13 +14,12 @@ IN: http.server.cgi "HTTP/" request get version>> append "SERVER_PROTOCOL" set "Factor" "SERVER_SOFTWARE" set - dup "PATH_TRANSLATED" set - "SCRIPT_FILENAME" set + [ "PATH_TRANSLATED" set ] [ "SCRIPT_FILENAME" set ] bi - request get path>> "SCRIPT_NAME" set + request get url>> path>> "SCRIPT_NAME" set - request get host>> "SERVER_NAME" set - request get port>> number>string "SERVER_PORT" set + request get url>> host>> "SERVER_NAME" set + request get url>> port>> number>string "SERVER_PORT" set "" "PATH_INFO" set "" "REMOTE_HOST" set "" "REMOTE_ADDR" set @@ -29,15 +28,17 @@ IN: http.server.cgi "" "REMOTE_IDENT" set request get method>> "REQUEST_METHOD" set - request get query>> assoc>query "QUERY_STRING" set + request get url>> query>> assoc>query "QUERY_STRING" set request get "cookie" header "HTTP_COOKIE" set request get "user-agent" header "HTTP_USER_AGENT" set request get "accept" header "HTTP_ACCEPT" set post? [ - request get post-data-type>> "CONTENT_TYPE" set - request get post-data>> length number>string "CONTENT_LENGTH" set + request get post-data>> raw>> + [ "CONTENT_TYPE" set ] + [ length number>string "CONTENT_LENGTH" set ] + bi ] when ] H{ } make-assoc ; @@ -51,9 +52,9 @@ IN: http.server.cgi 200 >>code "CGI output follows" >>message swap '[ - , stdio get swap [ - post? [ request get post-data>> write flush ] when - stdio get swap (stream-copy) + , output-stream get swap [ + post? [ request get post-data>> raw>> write flush ] when + input-stream get swap (stream-copy) ] with-stream ] >>body ; diff --git a/extra/http/server/components/components-tests.factor b/extra/http/server/components/components-tests.factor deleted file mode 100755 index ff87bb71fb..0000000000 --- a/extra/http/server/components/components-tests.factor +++ /dev/null @@ -1,133 +0,0 @@ -IN: http.server.components.tests -USING: http.server.components http.server.forms -http.server.validators namespaces tools.test kernel accessors -tuple-syntax mirrors -http http.server.actions http.server.templating.fhtml -io.streams.string io.streams.null ; - -validation-failed? off - -[ 3 ] [ "3" "n" validate ] unit-test - -[ 123 ] [ - "" - "n" - 123 >>default - validate -] unit-test - -[ f ] [ validation-failed? get ] unit-test - -[ t ] [ "3x" "n" validate validation-error? ] unit-test - -[ t ] [ validation-failed? get ] unit-test - -[ "" ] [ "" "email" validate ] unit-test - -[ "slava@jedit.org" ] [ "slava@jedit.org" "email" validate ] unit-test - -[ "slava@jedit.org" ] [ - "slava@jedit.org" - "email" - t >>required - validate -] unit-test - -[ t ] [ - "a" - "email" - t >>required - validate validation-error? -] unit-test - -[ t ] [ "a" "email" validate validation-error? ] unit-test - -TUPLE: test-tuple text number more-text ; - -: test-tuple new ; - -: ( -- form ) - "test" - "resource:extra/http/server/components/test/form.fhtml" >>view-template - "resource:extra/http/server/components/test/form.fhtml" >>edit-template - "text" - t >>required - add-field - "number" - 123 >>default - t >>required - 0 >>min-value - 10 >>max-value - add-field - "more-text" - "hi" >>default - add-field ; - -[ ] [ values set view-form write-response-body drop ] unit-test - -[ ] [ values set edit-form write-response-body drop ] unit-test - -[ TUPLE{ test-tuple number: 123 more-text: "hi" } ] [ - from-tuple - set-defaults - values-tuple -] unit-test - -[ - H{ - { "text" "fdafsa" } - { "number" "xxx" } - { "more-text" "" } - } params set - - H{ } clone values set - - [ t ] [ (validate-form) ] unit-test - - [ "fdafsa" ] [ "text" value ] unit-test - - [ t ] [ "number" value validation-error? ] unit-test -] with-scope - -[ - [ ] [ - "n" - 0 >>min-value - 10 >>max-value - "n" set - ] unit-test - - [ "123" ] [ - "123" "n" get validate value>> - ] unit-test - - [ ] [ "i" "i" set ] unit-test - - [ 3 ] [ - "3" "i" get validate - ] unit-test - - [ t ] [ - "3.9" "i" get validate validation-error? - ] unit-test - - H{ } clone values set - - [ ] [ 3 "i" set-value ] unit-test - - [ "3" ] [ [ "i" get render-view ] with-string-writer ] unit-test - - [ ] [ [ "i" get render-edit ] with-null-stream ] unit-test - - [ ] [ "t" "t" set ] unit-test - - [ ] [ "hello world" "t" set-value ] unit-test - - [ ] [ [ "t" get render-edit ] with-null-stream ] unit-test -] with-scope - -[ t ] [ "wake up sheeple" dup "n" validate = ] unit-test - -[ ] [ "password" "p" set ] unit-test - -[ ] [ "pub-date" "d" set ] unit-test diff --git a/extra/http/server/components/components.factor b/extra/http/server/components/components.factor deleted file mode 100755 index 331231dfb3..0000000000 --- a/extra/http/server/components/components.factor +++ /dev/null @@ -1,338 +0,0 @@ -! Copyright (C) 2008 Slava Pestov -! See http://factorcode.org/license.txt for BSD license. -USING: accessors namespaces kernel io math.parser assocs classes -words classes.tuple arrays sequences splitting mirrors -hashtables fry combinators continuations math -calendar.format html.elements -http.server.validators ; -IN: http.server.components - -! Renderer protocol -GENERIC: render-summary* ( value renderer -- ) -GENERIC: render-view* ( value renderer -- ) -GENERIC: render-edit* ( value id renderer -- ) - -M: object render-summary* render-view* ; - -TUPLE: field type ; - -C: field - -M: field render-view* drop write ; - -M: field render-edit* - > =type [ =id ] [ =name ] bi =value input/> ; - -: render-error ( message -- ) - write ; - -TUPLE: hidden < field ; - -: hidden ( -- renderer ) T{ hidden f "hidden" } ; inline - -M: hidden render-view* 2drop ; - -! Component protocol -SYMBOL: components - -TUPLE: component id required default renderer ; - -: component ( name -- component ) - dup components get at - [ ] [ "No such component: " prepend throw ] ?if ; - -GENERIC: init ( component -- component ) - -M: component init ; - -GENERIC: validate* ( value component -- result ) -GENERIC: component-string ( value component -- string ) - -SYMBOL: values - -: value values get at ; - -: set-value values get set-at ; - -: blank-values H{ } clone values set ; - -: from-tuple values set ; - -: values-tuple values get mirror-object ; - -: render-view-or-summary ( component -- value renderer ) - [ id>> value ] [ component-string ] [ renderer>> ] tri ; - -: render-view ( component -- ) - render-view-or-summary render-view* ; - -: render-summary ( component -- ) - render-view-or-summary render-summary* ; - -> ] [ renderer>> ] bi render-edit* ; - -: render-edit-error ( component -- ) - [ id>> value ] keep - [ [ value>> ] dip render-edit-string ] - [ drop reason>> render-error ] 2bi ; - -: value-or-default ( component -- value ) - [ id>> value ] [ default>> ] bi or ; - -: render-edit-value ( component -- ) - [ value-or-default ] - [ component-string ] - [ render-edit-string ] - tri ; - -PRIVATE> - -: render-edit ( component -- ) - dup id>> value validation-error? - [ render-edit-error ] [ render-edit-value ] if ; - -: validate ( value component -- result ) - '[ - , - over empty? [ - [ default>> [ v-default ] when* ] - [ required>> [ v-required ] when ] - bi - ] [ validate* ] if - ] with-validator ; - -: new-component ( id class renderer -- component ) - swap new - swap >>renderer - swap >>id - init ; inline - -! String input fields -TUPLE: string < component one-line min-length max-length ; - -: new-string ( id class -- component ) - "text" new-component - t >>one-line ; inline - -: ( id -- component ) - string new-string ; - -M: string validate* - [ one-line>> [ v-one-line ] when ] - [ min-length>> [ v-min-length ] when* ] - [ max-length>> [ v-max-length ] when* ] - tri ; - -M: string component-string - drop ; - -! Username fields -TUPLE: username < string ; - -M: username init - 2 >>min-length - 20 >>max-length ; - -: ( id -- component ) - username new-string ; - -M: username validate* - call-next-method v-one-word ; - -! E-mail fields -TUPLE: email < string ; - -: ( id -- component ) - email new-string - 5 >>min-length - 60 >>max-length ; - -M: email validate* - call-next-method dup empty? [ v-email ] unless ; - -! URL fields -TUPLE: url < string ; - -: ( id -- component ) - url new-string - 5 >>min-length - 60 >>max-length ; - -M: url validate* - call-next-method dup empty? [ v-url ] unless ; - -! Don't send passwords back to the user -TUPLE: password-renderer < field ; - -: password-renderer T{ password-renderer f "password" } ; - -: blank-password >r >r drop "" r> r> ; - -M: password-renderer render-edit* - blank-password call-next-method ; - -! Password fields -TUPLE: password < string ; - -M: password init - 6 >>min-length - 60 >>max-length ; - -: ( id -- component ) - password new-string - password-renderer >>renderer ; - -M: password validate* - call-next-method v-one-word ; - -! Number fields -TUPLE: number < string min-value max-value ; - -: ( id -- component ) - number new-string ; - -M: number validate* - [ v-number ] [ - [ min-value>> [ v-min-value ] when* ] - [ max-value>> [ v-max-value ] when* ] - bi - ] bi* ; - -M: number component-string - drop dup [ number>string ] when ; - -! Integer fields -TUPLE: integer < number ; - -: ( id -- component ) - integer new-string ; - -M: integer validate* - call-next-method v-integer ; - -! Simple captchas -TUPLE: captcha < string ; - -: ( id -- component ) - captcha new-string ; - -M: captcha validate* - drop v-captcha ; - -! Text areas -TUPLE: text-renderer rows cols ; - -: new-text-renderer ( class -- renderer ) - new - 60 >>cols - 20 >>rows ; - -: ( -- renderer ) - text-renderer new-text-renderer ; - -M: text-renderer render-view* - drop write ; - -M: text-renderer render-edit* - ; - -TUPLE: text < string ; - -: new-text ( id class -- component ) - new-string - f >>one-line - >>renderer ; - -: ( id -- component ) - text new-text ; - -! HTML text component -TUPLE: html-text-renderer < text-renderer ; - -: ( -- renderer ) - html-text-renderer new-text-renderer ; - -M: html-text-renderer render-view* - drop write ; - -TUPLE: html-text < text ; - -: ( id -- component ) - html-text new-text - >>renderer ; - -! Date component -TUPLE: date < string ; - -: ( id -- component ) - date new-string ; - -M: date component-string - drop timestamp>string ; - -! Link components - -GENERIC: link-title ( obj -- string ) -GENERIC: link-href ( obj -- url ) - -SINGLETON: link-renderer - -M: link-renderer render-view* - drop link-title write ; - -TUPLE: link < string ; - -: ( id -- component ) - link new-string - link-renderer >>renderer ; - -! List components -SYMBOL: +plain+ -SYMBOL: +ordered+ -SYMBOL: +unordered+ - -TUPLE: list-renderer component type ; - -C: list-renderer - -: render-plain-list ( seq component quot -- ) - '[ , component>> renderer>> @ ] each ; inline - -: render-li-list ( seq component quot -- ) - '[
  • @
  • ] render-plain-list ; inline - -: render-ordered-list ( seq quot component -- ) -
      render-li-list
    ; inline - -: render-unordered-list ( seq quot component -- ) -
      render-li-list
    ; inline - -: render-list ( value renderer quot -- ) - over type>> { - { +plain+ [ render-plain-list ] } - { +ordered+ [ render-ordered-list ] } - { +unordered+ [ render-unordered-list ] } - } case ; inline - -M: list-renderer render-view* - [ render-view* ] render-list ; - -M: list-renderer render-summary* - [ render-summary* ] render-list ; - -TUPLE: list < component ; - -: ( id component type -- list ) - list swap new-component ; - -M: list component-string drop ; diff --git a/extra/http/server/components/farkup/farkup.factor b/extra/http/server/components/farkup/farkup.factor deleted file mode 100755 index a8d320f82f..0000000000 --- a/extra/http/server/components/farkup/farkup.factor +++ /dev/null @@ -1,17 +0,0 @@ -! Copyright (C) 2008 Slava Pestov -! See http://factorcode.org/license.txt for BSD license. -USING: splitting kernel io sequences farkup accessors -http.server.components ; -IN: http.server.components.farkup - -TUPLE: farkup-renderer < text-renderer ; - -: ( -- renderer ) - farkup-renderer new-text-renderer ; - -M: farkup-renderer render-view* - drop string-lines "\n" join convert-farkup write ; - -: ( id -- component ) - - >>renderer ; diff --git a/extra/http/server/components/test/form.fhtml b/extra/http/server/components/test/form.fhtml deleted file mode 100755 index d3f5a12faa..0000000000 --- a/extra/http/server/components/test/form.fhtml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/extra/http/server/crud/crud.factor b/extra/http/server/crud/crud.factor deleted file mode 100755 index 65de881adb..0000000000 --- a/extra/http/server/crud/crud.factor +++ /dev/null @@ -1,67 +0,0 @@ -! Copyright (C) 2008 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: kernel namespaces db.tuples math.parser -accessors fry locals hashtables -http.server -http.server.actions -http.server.components -http.server.forms -http.server.validators ; -IN: http.server.crud - -:: ( form ctor -- action ) - - { { "id" [ v-number ] } } >>get-params - - [ "id" get ctor call select-tuple from-tuple ] >>init - - [ form view-form ] >>display ; - -: ( id next -- response ) - swap number>string "id" associate ; - -:: ( form ctor next -- action ) - - { { "id" [ [ v-number ] v-optional ] } } >>get-params - - [ - "id" get ctor call - - "id" get - [ select-tuple from-tuple ] - [ from-tuple form set-defaults ] - if - ] >>init - - [ form edit-form ] >>display - - [ - f ctor call from-tuple - - form validate-form - - values-tuple - "id" value [ update-tuple ] [ insert-tuple ] if - - "id" value next - ] >>submit ; - -:: ( ctor next -- action ) - - { { "id" [ v-number ] } } >>post-params - - [ - "id" get ctor call delete-tuple - - next f - ] >>submit ; - -:: ( form ctor -- action ) - - [ - blank-values - - f ctor call select-tuples "list" set-value - - form view-form - ] >>display ; diff --git a/extra/http/server/db/db.factor b/extra/http/server/db/db.factor deleted file mode 100755 index a8b929bc98..0000000000 --- a/extra/http/server/db/db.factor +++ /dev/null @@ -1,16 +0,0 @@ -! Copyright (C) 2008 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: db http.server kernel accessors -continuations namespaces destructors ; -IN: http.server.db - -TUPLE: db-persistence responder db params ; - -C: db-persistence - -: connect-db ( db-persistence -- ) - [ db>> ] [ params>> ] bi make-db db-open - [ db set ] [ add-always-destructor ] bi ; - -M: db-persistence call-responder - [ connect-db ] [ responder>> call-responder ] bi ; diff --git a/extra/http/server/dispatchers/dispatchers-tests.factor b/extra/http/server/dispatchers/dispatchers-tests.factor new file mode 100644 index 0000000000..5b5b30adde --- /dev/null +++ b/extra/http/server/dispatchers/dispatchers-tests.factor @@ -0,0 +1,97 @@ +USING: http.server http.server.dispatchers http.server.responses +tools.test kernel namespaces accessors io http math sequences +assocs arrays classes words urls ; +IN: http.server.dispatchers.tests + +\ find-responder must-infer +\ http-error. must-infer + +TUPLE: mock-responder path ; + +C: mock-responder + +M: mock-responder call-responder* + nip + path>> on + [ ] "text/plain" ; + +: check-dispatch ( tag path -- ? ) + V{ } clone responder-nesting set + over off + split-path + main-responder get call-responder + write-response get ; + +[ + + "foo" "foo" add-responder + "bar" "bar" add-responder + + "123" "123" add-responder + "default" >>default + "baz" add-responder + main-responder set + + [ "foo" ] [ + { "foo" } main-responder get find-responder path>> nip + ] unit-test + + [ "bar" ] [ + { "bar" } main-responder get find-responder path>> nip + ] unit-test + + [ t ] [ "foo" "foo" check-dispatch ] unit-test + [ f ] [ "foo" "bar" check-dispatch ] unit-test + [ t ] [ "bar" "bar" check-dispatch ] unit-test + [ t ] [ "default" "baz/xxx" check-dispatch ] unit-test + [ t ] [ "default" "baz/xxx//" check-dispatch ] unit-test + [ t ] [ "default" "/baz/xxx//" check-dispatch ] unit-test + [ t ] [ "123" "baz/123" check-dispatch ] unit-test + [ t ] [ "123" "baz///123" check-dispatch ] unit-test + +] with-scope + +[ + + "default" >>default + main-responder set + + [ "/default" ] [ "/default" main-responder get find-responder drop ] unit-test +] with-scope + +! Make sure path for default responder isn't chopped +TUPLE: path-check-responder ; + +C: path-check-responder + +M: path-check-responder call-responder* + drop + >array "text/plain" ; + +[ { "c" } ] [ + V{ } clone responder-nesting set + + { "b" "c" } + + + >>default + "b" add-responder + call-responder + body>> +] unit-test + +! Test that "" dispatcher works with default>> +[ ] [ + + "" "" add-responder + "bar" "bar" add-responder + "baz" >>default + main-responder set + + [ t ] [ "" "" check-dispatch ] unit-test + [ f ] [ "" "quux" check-dispatch ] unit-test + [ t ] [ "baz" "quux" check-dispatch ] unit-test + [ f ] [ "foo" "bar" check-dispatch ] unit-test + [ t ] [ "bar" "bar" check-dispatch ] unit-test + [ t ] [ "baz" "xxx" check-dispatch ] unit-test +] unit-test diff --git a/extra/http/server/dispatchers/dispatchers.factor b/extra/http/server/dispatchers/dispatchers.factor new file mode 100644 index 0000000000..2da2695992 --- /dev/null +++ b/extra/http/server/dispatchers/dispatchers.factor @@ -0,0 +1,50 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: kernel namespaces sequences assocs accessors splitting +unicode.case http http.server http.server.responses ; +IN: http.server.dispatchers + +TUPLE: dispatcher default responders ; + +: new-dispatcher ( class -- dispatcher ) + new + <404> >>default + H{ } clone >>responders ; inline + +: ( -- dispatcher ) + dispatcher new-dispatcher ; + +: find-responder ( path dispatcher -- path responder ) + over empty? [ + "" over responders>> at* + [ nip ] [ drop default>> ] if + ] [ + over first over responders>> at* + [ [ drop rest-slice ] dip ] [ drop default>> ] if + ] if ; + +M: dispatcher call-responder* ( path dispatcher -- response ) + find-responder call-responder ; + +TUPLE: vhost-dispatcher default responders ; + +: ( -- dispatcher ) + vhost-dispatcher new-dispatcher ; + +: canonical-host ( host -- host' ) + >lower "www." ?head drop "." ?tail drop ; + +: find-vhost ( dispatcher -- responder ) + request get url>> host>> canonical-host over responders>> at* + [ nip ] [ drop default>> ] if ; + +M: vhost-dispatcher call-responder* ( path dispatcher -- response ) + find-vhost call-responder ; + +: add-responder ( dispatcher responder path -- dispatcher ) + pick responders>> set-at ; + +: add-main-responder ( dispatcher responder path -- dispatcher ) + [ add-responder drop ] + [ drop "" add-responder drop ] + [ 2drop ] 3tri ; diff --git a/extra/http/server/filters/filters.factor b/extra/http/server/filters/filters.factor new file mode 100644 index 0000000000..4f70113292 --- /dev/null +++ b/extra/http/server/filters/filters.factor @@ -0,0 +1,9 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: http.server accessors ; +IN: http.server.filters + +TUPLE: filter-responder responder ; + +M: filter-responder call-responder* + responder>> call-responder ; diff --git a/extra/http/server/forms/forms.factor b/extra/http/server/forms/forms.factor deleted file mode 100644 index 60f3da25b6..0000000000 --- a/extra/http/server/forms/forms.factor +++ /dev/null @@ -1,81 +0,0 @@ -! Copyright (C) 2008 Slava Pestov -! See http://factorcode.org/license.txt for BSD license. -USING: kernel accessors assocs namespaces io.files sequences fry -http.server -http.server.actions -http.server.components -http.server.validators -http.server.templating ; -IN: http.server.forms - -TUPLE: form < component -view-template edit-template summary-template -components ; - -M: form init V{ } clone >>components ; - -: ( id -- form ) - form f new-component - dup >>renderer ; - -: add-field ( form component -- form ) - dup id>> pick components>> set-at ; - -: set-components ( form -- ) - components>> components set ; - -: with-form ( form quot -- ) - [ [ set-components ] [ call ] bi* ] with-scope ; inline - -: set-defaults ( form -- ) - [ - components get [ - swap values get [ - swap default>> or - ] change-at - ] assoc-each - ] with-form ; - -: ( form template -- response ) - [ components>> components set ] - [ "text/html" swap >>body ] - bi* ; - -: view-form ( form -- response ) - dup view-template>> ; - -: edit-form ( form -- response ) - dup edit-template>> ; - -: validate-param ( id component -- ) - [ [ params get at ] [ validate ] bi* ] - [ drop set-value ] 2bi ; - -: (validate-form) ( form -- error? ) - [ - validation-failed? off - components get [ validate-param ] assoc-each - validation-failed? get - ] with-form ; - -: validate-form ( form -- ) - (validate-form) [ validation-failed ] when ; - -: render-form ( value form template -- ) - [ - [ from-tuple ] - [ set-components ] - [ call-template ] - tri* - ] with-scope ; - -M: form component-string drop ; - -M: form render-summary* - dup summary-template>> render-form ; - -M: form render-view* - dup view-template>> render-form ; - -M: form render-edit* - nip dup edit-template>> render-form ; diff --git a/extra/http/server/redirection/redirection-tests.factor b/extra/http/server/redirection/redirection-tests.factor new file mode 100644 index 0000000000..04af89ec98 --- /dev/null +++ b/extra/http/server/redirection/redirection-tests.factor @@ -0,0 +1,48 @@ +IN: http.server.redirection.tests +USING: http http.server.redirection urls accessors +namespaces tools.test present ; + +\ relative-to-request must-infer + +[ + + + "http" >>protocol + "www.apple.com" >>host + "/xxx/bar" >>path + { { "a" "b" } } >>query + >>url + request set + + [ "http://www.apple.com:80/xxx/bar" ] [ + relative-to-request present + ] unit-test + + [ "http://www.apple.com:80/xxx/baz" ] [ + "baz" >>path relative-to-request present + ] unit-test + + [ "http://www.apple.com:80/xxx/baz?c=d" ] [ + "baz" >>path { { "c" "d" } } >>query relative-to-request present + ] unit-test + + [ "http://www.apple.com:80/xxx/bar?c=d" ] [ + { { "c" "d" } } >>query relative-to-request present + ] unit-test + + [ "http://www.apple.com:80/flip" ] [ + "/flip" >>path relative-to-request present + ] unit-test + + [ "http://www.apple.com:80/flip?c=d" ] [ + "/flip" >>path { { "c" "d" } } >>query relative-to-request present + ] unit-test + + [ "http://www.jedit.org:80/" ] [ + "http://www.jedit.org" >url relative-to-request present + ] unit-test + + [ "http://www.jedit.org:80/?a=b" ] [ + "http://www.jedit.org" >url { { "a" "b" } } >>query relative-to-request present + ] unit-test +] with-scope diff --git a/extra/http/server/redirection/redirection.factor b/extra/http/server/redirection/redirection.factor new file mode 100644 index 0000000000..3cd01345aa --- /dev/null +++ b/extra/http/server/redirection/redirection.factor @@ -0,0 +1,24 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: kernel accessors combinators namespaces +logging urls http http.server http.server.responses ; +IN: http.server.redirection + +: relative-to-request ( url -- url' ) + request get url>> + clone + f >>query + swap derive-url ensure-port ; + +: ( url code message -- response ) + + swap dup url? [ relative-to-request ] when + "location" set-header ; + +\ DEBUG add-input-logging + +: ( url -- response ) + 301 "Moved Permanently" ; + +: ( url -- response ) + 307 "Temporary Redirect" ; diff --git a/extra/http/server/responses/responses.factor b/extra/http/server/responses/responses.factor new file mode 100644 index 0000000000..277ca392b7 --- /dev/null +++ b/extra/http/server/responses/responses.factor @@ -0,0 +1,37 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: html.elements math.parser http accessors kernel +io io.streams.string ; +IN: http.server.responses + +: ( body content-type -- response ) + + 200 >>code + "Document follows" >>message + swap >>content-type + swap >>body ; + +: trivial-response-body ( code message -- ) + + +

    [ number>string write bl ] [ write ] bi*

    + + ; + +: ( code message -- response ) + 2dup [ trivial-response-body ] with-string-writer + "text/html" + swap >>message + swap >>code ; + +: <304> ( -- response ) + 304 "Not modified" ; + +: <403> ( -- response ) + 403 "Forbidden" ; + +: <400> ( -- response ) + 400 "Bad request" ; + +: <404> ( -- response ) + 404 "Not found" ; diff --git a/extra/http/server/server-tests.factor b/extra/http/server/server-tests.factor old mode 100755 new mode 100644 index 346a31f30f..c29912b8c7 --- a/extra/http/server/server-tests.factor +++ b/extra/http/server/server-tests.factor @@ -1,79 +1,4 @@ -USING: http.server tools.test kernel namespaces accessors -io http math sequences assocs ; +USING: http http.server math sequences continuations tools.test ; IN: http.server.tests -[ - - "www.apple.com" >>host - "/xxx/bar" >>path - { { "a" "b" } } >>query - request set - - [ "http://www.apple.com:80/xxx/bar?a=b" ] [ f f derive-url ] unit-test - [ "http://www.apple.com:80/xxx/baz?a=b" ] [ "baz" f derive-url ] unit-test - [ "http://www.apple.com:80/xxx/baz?c=d" ] [ "baz" { { "c" "d" } } derive-url ] unit-test - [ "http://www.apple.com:80/xxx/bar?c=d" ] [ f { { "c" "d" } } derive-url ] unit-test - [ "http://www.apple.com:80/flip?a=b" ] [ "/flip" f derive-url ] unit-test - [ "http://www.apple.com:80/flip?c=d" ] [ "/flip" { { "c" "d" } } derive-url ] unit-test - [ "http://www.jedit.org" ] [ "http://www.jedit.org" f derive-url ] unit-test - [ "http://www.jedit.org?a=b" ] [ "http://www.jedit.org" { { "a" "b" } } derive-url ] unit-test -] with-scope - -TUPLE: mock-responder path ; - -C: mock-responder - -M: mock-responder call-responder - nip - path>> on - "text/plain" ; - -: check-dispatch ( tag path -- ? ) - over off - main-responder get call-responder - write-response get ; - -[ - - "foo" "foo" add-responder - "bar" "bar" add-responder - - "123" "123" add-responder - "default" >>default - "baz" add-responder - main-responder set - - [ "foo" ] [ - "foo" main-responder get find-responder path>> nip - ] unit-test - - [ "bar" ] [ - "bar" main-responder get find-responder path>> nip - ] unit-test - - [ t ] [ "foo" "foo" check-dispatch ] unit-test - [ f ] [ "foo" "bar" check-dispatch ] unit-test - [ t ] [ "bar" "bar" check-dispatch ] unit-test - [ t ] [ "default" "baz/xxx" check-dispatch ] unit-test - [ t ] [ "default" "baz/xxx//" check-dispatch ] unit-test - [ t ] [ "default" "/baz/xxx//" check-dispatch ] unit-test - [ t ] [ "123" "baz/123" check-dispatch ] unit-test - [ t ] [ "123" "baz///123" check-dispatch ] unit-test - - [ t ] [ - - "baz" >>path - request set - "baz" main-responder get call-responder - dup code>> 300 399 between? >r - header>> "location" swap at "baz/" tail? r> and - ] unit-test -] with-scope - -[ - - "default" >>default - main-responder set - - [ "/default" ] [ "/default" main-responder get find-responder drop ] unit-test -] with-scope +[ t ] [ [ \ + first ] [ <500> ] recover response? ] unit-test diff --git a/extra/http/server/server.factor b/extra/http/server/server.factor index d3bd6c6bbe..fc50432030 100755 --- a/extra/http/server/server.factor +++ b/extra/http/server/server.factor @@ -1,215 +1,79 @@ ! Copyright (C) 2003, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: assocs kernel namespaces io io.timeouts strings splitting -threads http sequences prettyprint io.server logging calendar -html.elements accessors math.parser combinators.lib -tools.vocabs debugger html continuations random combinators -destructors io.encodings.8-bit fry ; +USING: kernel accessors sequences arrays namespaces splitting +vocabs.loader http http.server.responses logging calendar +destructors html.elements html.streams io.server +io.encodings.8-bit io.timeouts io assocs debugger continuations +fry tools.vocabs math ; IN: http.server -GENERIC: call-responder ( path responder -- response ) +SYMBOL: responder-nesting -: request-params ( -- assoc ) - request get dup method>> { - { "GET" [ query>> ] } - { "HEAD" [ query>> ] } - { "POST" [ post-data>> ] } - } case ; +SYMBOL: main-responder -: ( content-type -- response ) - - 200 >>code - "Document follows" >>message - swap set-content-type ; +SYMBOL: development-mode + +! path is a sequence of path component strings +GENERIC: call-responder* ( path responder -- response ) TUPLE: trivial-responder response ; C: trivial-responder -M: trivial-responder call-responder nip response>> call ; +M: trivial-responder call-responder* nip response>> clone ; -: trivial-response-body ( code message -- ) - - -

    [ number>string write bl ] [ write ] bi*

    - - ; +main-responder global [ <404> or ] change-at -: ( code message -- response ) - 2dup '[ , , trivial-response-body ] - "text/html" - swap >>body - swap >>message - swap >>code ; +: invert-slice ( slice -- slice' ) + dup slice? [ [ seq>> ] [ from>> ] bi head-slice ] [ drop { } ] if ; -: <400> ( -- response ) - 400 "Bad request" ; +: add-responder-nesting ( path responder -- ) + [ invert-slice ] dip 2array responder-nesting get push ; -: <404> ( -- response ) - 404 "Not Found" ; - -SYMBOL: 404-responder - -[ <404> ] 404-responder set-global - -SYMBOL: link-hook - -: modify-query ( query -- query ) - link-hook get [ ] or call ; - -: link>string ( url query -- url' ) - modify-query (link>string) ; - -: write-link ( url query -- ) - link>string write ; - -SYMBOL: form-hook - -: hidden-form-field ( -- ) - form-hook get [ ] or call ; - -: absolute-redirect ( to query -- url ) - #! Same host. - request get clone - swap [ >>query ] when* - swap url-encode >>path - request-url ; - -: replace-last-component ( path with -- path' ) - >r "/" last-split1 drop "/" r> 3append ; - -: relative-redirect ( to query -- url ) - request get clone - swap [ >>query ] when* - swap [ '[ , replace-last-component ] change-path ] when* - dup query>> modify-query >>query - request-url ; - -: derive-url ( to query -- url ) - { - { [ over "http://" head? ] [ link>string ] } - { [ over "/" head? ] [ absolute-redirect ] } - [ relative-redirect ] - } cond ; - -: ( to query code message -- response ) - -rot derive-url "location" set-header ; - -\ DEBUG add-input-logging - -: ( to query -- response ) - 301 "Moved Permanently" ; - -: ( to query -- response ) - 307 "Temporary Redirect" ; - -TUPLE: dispatcher default responders ; - -: new-dispatcher ( class -- dispatcher ) - new - 404-responder get >>default - H{ } clone >>responders ; inline - -: ( -- dispatcher ) - dispatcher new-dispatcher ; - -: split-path ( path -- rest first ) - [ CHAR: / = ] left-trim "/" split1 swap ; - -: find-responder ( path dispatcher -- path responder ) - over split-path pick responders>> at* - [ >r >r 2drop r> r> ] [ 2drop default>> ] if ; - -: redirect-with-/ ( -- response ) - request get path>> "/" append f ; - -M: dispatcher call-responder ( path dispatcher -- response ) - over [ - find-responder call-responder - ] [ - 2drop redirect-with-/ - ] if ; - -TUPLE: vhost-dispatcher default responders ; - -: ( -- dispatcher ) - 404-responder get H{ } clone vhost-dispatcher boa ; - -: find-vhost ( dispatcher -- responder ) - request get host>> over responders>> at* - [ nip ] [ drop default>> ] if ; - -M: vhost-dispatcher call-responder ( path dispatcher -- response ) - find-vhost call-responder ; - -: set-main ( dispatcher name -- dispatcher ) - '[ , f ] - >>default ; - -: add-responder ( dispatcher responder path -- dispatcher ) - pick responders>> set-at ; - -: add-main-responder ( dispatcher responder path -- dispatcher ) - [ add-responder ] keep set-main ; - -SYMBOL: main-responder - -main-responder global -[ drop 404-responder get-global ] cache -drop - -SYMBOL: development-mode +: call-responder ( path responder -- response ) + [ add-responder-nesting ] [ call-responder* ] 2bi ; : http-error. ( error -- ) "Internal server error" [ - development-mode get [ - [ print-error nl :c ] with-html-stream - ] [ - 500 "Internal server error" - trivial-response-body - ] if + [ print-error nl :c ] with-html-stream ] simple-page ; : <500> ( error -- response ) 500 "Internal server error" - swap '[ , http-error. ] >>body ; + swap development-mode get [ '[ , http-error. ] >>body ] [ drop ] if ; : do-response ( response -- ) dup write-response - request get method>> "HEAD" = - [ drop ] [ - '[ - , write-response-body - ] [ - http-error. + request get method>> "HEAD" = [ drop ] [ + '[ , write-response-body ] + [ + development-mode get + [ http-error. ] [ drop "Response error" ] if ] recover ] if ; LOG: httpd-hit NOTICE : log-request ( request -- ) - { method>> host>> path>> } map-exec-with httpd-hit ; + [ method>> ] [ url>> [ host>> ] [ path>> ] bi ] bi 3array httpd-hit ; -SYMBOL: exit-continuation +: split-path ( string -- path ) + "/" split harvest ; -: exit-with exit-continuation get continue-with ; +: init-request ( request -- ) + request set + V{ } clone responder-nesting set ; -: with-exit-continuation ( quot -- ) - '[ exit-continuation set @ ] callcc1 exit-continuation off ; +: dispatch-request ( request -- response ) + url>> path>> split-path main-responder get call-responder ; : do-request ( request -- response ) - [ + '[ + , + [ init-request ] [ log-request ] - [ request set ] - [ path>> main-responder get call-responder ] tri - [ <404> ] unless* - ] [ - [ \ do-request log-error ] - [ <500> ] - bi - ] recover ; - -: default-timeout 1 minutes stdio get set-timeout ; + [ dispatch-request ] tri + ] [ [ \ do-request log-error ] [ <500> ] bi ] recover ; : ?refresh-all ( -- ) development-mode get-global @@ -217,7 +81,7 @@ SYMBOL: exit-continuation : handle-client ( -- ) [ - default-timeout + 1 minutes timeouts ?refresh-all read-request do-request @@ -225,9 +89,10 @@ SYMBOL: exit-continuation ] with-destructors ; : httpd ( port -- ) - internet-server "http.server" - latin1 [ handle-client ] with-server ; + dup integer? [ internet-server ] when + "http.server" latin1 [ handle-client ] with-server ; -: httpd-main ( -- ) 8888 httpd ; +: httpd-main ( -- ) + 8888 httpd ; MAIN: httpd-main diff --git a/extra/http/server/sessions/sessions-tests.factor b/extra/http/server/sessions/sessions-tests.factor deleted file mode 100755 index 26e6927d7c..0000000000 --- a/extra/http/server/sessions/sessions-tests.factor +++ /dev/null @@ -1,145 +0,0 @@ -IN: http.server.sessions.tests -USING: tools.test http http.server.sessions -http.server.sessions.storage http.server.sessions.storage.assoc -http.server.actions http.server math namespaces kernel accessors -prettyprint io.streams.string splitting destructors sequences ; - -[ H{ } ] [ H{ } add-session-id ] unit-test - -: with-session \ session swap with-variable ; inline - -TUPLE: foo ; - -C: foo - -M: foo init-session* drop 0 "x" sset ; - -M: foo call-responder - 2drop - "x" [ 1+ ] schange - "text/html" [ "x" sget pprint ] >>body ; - -[ - "123" session-id set - H{ } clone session set - session-changed? off - - [ H{ { "factorsessid" "123" } } ] [ H{ } add-session-id ] unit-test - - [ ] [ 3 "x" sset ] unit-test - - [ 9 ] [ "x" sget sq ] unit-test - - [ ] [ "x" [ 1- ] schange ] unit-test - - [ 4 ] [ "x" sget sq ] unit-test - - [ t ] [ session-changed? get ] unit-test -] with-scope - -[ t ] [ f url-sessions? ] unit-test -[ t ] [ f cookie-sessions? ] unit-test - -[ ] [ - - >>sessions - "manager" set -] unit-test - -[ { 5 0 } ] [ - [ - "manager" get begin-session drop - dup "manager" get sessions>> get-session [ 5 "a" sset ] with-session - dup "manager" get sessions>> get-session [ "a" sget , ] with-session - dup "manager" get sessions>> get-session [ "x" sget , ] with-session - "manager" get sessions>> get-session - "manager" get sessions>> delete-session - ] { } make -] unit-test - -[ ] [ - - "GET" >>method - request set - "/etc" "manager" get call-responder - response set -] unit-test - -[ 307 ] [ response get code>> ] unit-test - -[ ] [ response get "location" header "=" split1 nip "id" set ] unit-test - -: url-responder-mock-test - [ - - "GET" >>method - "id" get session-id-key set-query-param - "/" >>path - request set - "/" "manager" get call-responder - [ write-response-body drop ] with-string-writer - ] with-destructors ; - -[ "1" ] [ url-responder-mock-test ] unit-test -[ "2" ] [ url-responder-mock-test ] unit-test -[ "3" ] [ url-responder-mock-test ] unit-test -[ "4" ] [ url-responder-mock-test ] unit-test - -[ ] [ - - >>sessions - "manager" set -] unit-test - -[ - - "GET" >>method - "/" >>path - request set - "/etc" "manager" get call-responder response set - [ "1" ] [ [ response get write-response-body drop ] with-string-writer ] unit-test - response get -] with-destructors -response set - -[ ] [ response get cookies>> "cookies" set ] unit-test - -: cookie-responder-mock-test - [ - - "GET" >>method - "cookies" get >>cookies - "/" >>path - request set - "/" "manager" get call-responder - [ write-response-body drop ] with-string-writer - ] with-destructors ; - -[ "2" ] [ cookie-responder-mock-test ] unit-test -[ "3" ] [ cookie-responder-mock-test ] unit-test -[ "4" ] [ cookie-responder-mock-test ] unit-test - -: - - [ - "text/plain" exit-with - ] >>display ; - -[ - [ ] [ - - "GET" >>method - "id" get session-id-key set-query-param - "/" >>path - request set - - [ - "/" - call-responder - ] with-destructors response set - ] unit-test - - [ "text/plain" ] [ response get "content-type" header ] unit-test - - [ f ] [ response get cookies>> empty? ] unit-test -] with-scope diff --git a/extra/http/server/sessions/sessions.factor b/extra/http/server/sessions/sessions.factor deleted file mode 100755 index 9e4f538583..0000000000 --- a/extra/http/server/sessions/sessions.factor +++ /dev/null @@ -1,134 +0,0 @@ -! Copyright (C) 2008 Doug Coleman, Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: assocs calendar kernel math.parser namespaces random -accessors http http.server -http.server.sessions.storage http.server.sessions.storage.assoc -quotations hashtables sequences fry html.elements symbols -continuations destructors ; -IN: http.server.sessions - -! ! ! ! ! ! -! WARNING: this session manager is vulnerable to XSRF attacks -! ! ! ! ! ! - -GENERIC: init-session* ( responder -- ) - -M: object init-session* drop ; - -TUPLE: session-manager responder sessions ; - -: new-session-manager ( responder class -- responder' ) - new - >>sessions - swap >>responder ; inline - -SYMBOLS: session session-id session-changed? ; - -: sget ( key -- value ) - session get at ; - -: sset ( value key -- ) - session get set-at - session-changed? on ; - -: schange ( key quot -- ) - session get swap change-at - session-changed? on ; inline - -: sessions session-manager get sessions>> ; - -: managed-responder session-manager get responder>> ; - -: init-session ( managed -- session ) - H{ } clone [ session [ init-session* ] with-variable ] keep ; - -: begin-session ( responder -- id session ) - [ responder>> init-session ] [ sessions>> ] bi - [ new-session ] [ drop ] 2bi ; - -! Destructor -TUPLE: session-saver id session ; - -C: session-saver - -M: session-saver dispose - session-changed? get [ - [ session>> ] [ id>> ] bi - sessions update-session - ] [ drop ] if ; - -: save-session-after ( id session -- ) - add-always-destructor ; - -: call-responder/session ( path responder id session -- response ) - [ save-session-after ] - [ [ session-id set ] [ session set ] bi* ] 2bi - [ session-manager set ] [ responder>> call-responder ] bi ; - -TUPLE: null-sessions < session-manager ; - -: - null-sessions new-session-manager ; - -M: null-sessions call-responder ( path responder -- response ) - H{ } clone f call-responder/session ; - -TUPLE: url-sessions < session-manager ; - -: ( responder -- responder' ) - url-sessions new-session-manager ; - -: session-id-key "factorsessid" ; - -: current-url-session ( responder -- id/f session/f ) - [ request-params session-id-key swap at ] [ sessions>> ] bi* - [ drop ] [ get-session ] 2bi ; - -: add-session-id ( query -- query' ) - session-id get [ session-id-key associate assoc-union ] when* ; - -: session-form-field ( -- ) - ; - -: new-url-session ( responder -- response ) - [ f ] [ begin-session drop session-id-key associate ] bi* - ; - -M: url-sessions call-responder ( path responder -- response ) - [ add-session-id ] link-hook set - [ session-form-field ] form-hook set - dup current-url-session dup [ - call-responder/session - ] [ - 2drop nip new-url-session - ] if ; - -TUPLE: cookie-sessions < session-manager ; - -: ( responder -- responder' ) - cookie-sessions new-session-manager ; - -: current-cookie-session ( responder -- id namespace/f ) - request get session-id-key get-cookie dup - [ value>> dup rot sessions>> get-session ] [ 2drop f f ] if ; - -: ( id -- cookie ) - session-id-key ; - -: call-responder/new-session ( path responder -- response ) - dup begin-session - [ call-responder/session ] - [ drop ] 2bi - put-cookie ; - -M: cookie-sessions call-responder ( path responder -- response ) - dup current-cookie-session dup [ - call-responder/session - ] [ - 2drop call-responder/new-session - ] if ; diff --git a/extra/http/server/sessions/storage/assoc/assoc.factor b/extra/http/server/sessions/storage/assoc/assoc.factor deleted file mode 100755 index 6e4a84d646..0000000000 --- a/extra/http/server/sessions/storage/assoc/assoc.factor +++ /dev/null @@ -1,37 +0,0 @@ -! Copyright (C) 2008 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: assocs assocs.lib accessors http.server.sessions.storage -alarms kernel fry http.server ; -IN: http.server.sessions.storage.assoc - -TUPLE: sessions-in-memory sessions alarms ; - -: ( -- storage ) - H{ } clone H{ } clone sessions-in-memory boa ; - -: cancel-session-timeout ( id storage -- ) - alarms>> at [ cancel-alarm ] when* ; - -: touch-session ( id storage -- ) - [ cancel-session-timeout ] - [ '[ , , delete-session ] timeout later ] - [ alarms>> set-at ] - 2tri ; - -M: sessions-in-memory get-session ( id storage -- namespace ) - [ sessions>> at ] [ touch-session ] 2bi ; - -M: sessions-in-memory update-session ( namespace id storage -- ) - [ sessions>> set-at ] - [ touch-session ] - 2bi ; - -M: sessions-in-memory delete-session ( id storage -- ) - [ sessions>> delete-at ] - [ cancel-session-timeout ] - 2bi ; - -M: sessions-in-memory new-session ( namespace storage -- id ) - [ sessions>> set-at-unique ] - [ [ touch-session ] [ drop ] 2bi ] - bi ; diff --git a/extra/http/server/sessions/storage/db/db-tests.factor b/extra/http/server/sessions/storage/db/db-tests.factor deleted file mode 100755 index 4e6ae8a9b4..0000000000 --- a/extra/http/server/sessions/storage/db/db-tests.factor +++ /dev/null @@ -1,24 +0,0 @@ -IN: http.server.sessions.storage.db -USING: http.server.sessions.storage -http.server.sessions.storage.db namespaces io.files -db.sqlite db accessors math tools.test kernel assocs -sequences ; - -sessions-in-db "storage" set - -"auth-test.db" temp-file sqlite-db [ - [ ] [ init-sessions-table ] unit-test - - [ f ] [ H{ } "storage" get new-session empty? ] unit-test - - H{ } "storage" get new-session "id" set - - "id" get "storage" get get-session "session" set - "a" "b" "session" get set-at - - "session" get "id" get "storage" get update-session - - [ H{ { "b" "a" } } ] [ - "id" get "storage" get get-session - ] unit-test -] with-db diff --git a/extra/http/server/sessions/storage/db/db.factor b/extra/http/server/sessions/storage/db/db.factor deleted file mode 100755 index 0245db15b0..0000000000 --- a/extra/http/server/sessions/storage/db/db.factor +++ /dev/null @@ -1,46 +0,0 @@ -! Copyright (C) 2008 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: assocs accessors http.server.sessions.storage -alarms kernel http.server db.tuples db.types math.parser -classes.singleton ; -IN: http.server.sessions.storage.db - -SINGLETON: sessions-in-db - -TUPLE: session id namespace ; - -session "SESSIONS" -{ - { "id" "ID" INTEGER +native-id+ } - { "namespace" "NAMESPACE" FACTOR-BLOB } -} define-persistent - -: init-sessions-table session ensure-table ; - -: ( id -- session ) - session new - swap dup [ string>number ] when >>id ; - -M: sessions-in-db get-session ( id storage -- namespace/f ) - drop - dup [ - - select-tuple dup [ namespace>> ] when - ] when ; - -M: sessions-in-db update-session ( namespace id storage -- ) - drop - - swap >>namespace - update-tuple ; - -M: sessions-in-db delete-session ( id storage -- ) - drop - - delete-tuple ; - -M: sessions-in-db new-session ( namespace storage -- id ) - drop - f - swap >>namespace - [ insert-tuple ] [ id>> number>string ] bi ; diff --git a/extra/http/server/sessions/storage/storage.factor b/extra/http/server/sessions/storage/storage.factor deleted file mode 100755 index df96c815c7..0000000000 --- a/extra/http/server/sessions/storage/storage.factor +++ /dev/null @@ -1,14 +0,0 @@ -! Copyright (C) 2008 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: calendar ; -IN: http.server.sessions.storage - -: timeout 20 minutes ; - -GENERIC: get-session ( id storage -- namespace ) - -GENERIC: update-session ( namespace id storage -- ) - -GENERIC: delete-session ( id storage -- ) - -GENERIC: new-session ( namespace storage -- id ) diff --git a/extra/http/server/static/static.factor b/extra/http/server/static/static.factor index 2d4a97c3c0..1d86a73cfa 100755 --- a/extra/http/server/static/static.factor +++ b/extra/http/server/static/static.factor @@ -1,41 +1,45 @@ ! Copyright (C) 2004, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: calendar html io io.files kernel math math.parser http -http.server namespaces parser sequences strings assocs -hashtables debugger http.mime sorting html.elements logging -calendar.format accessors io.encodings.binary fry ; +USING: calendar io io.files kernel math math.order +math.parser namespaces parser sequences strings +assocs hashtables debugger mime-types sorting logging +calendar.format accessors +io.encodings.binary fry xml.entities destructors urls +html.elements html.templates.fhtml +http +http.server +http.server.responses +http.server.redirection ; IN: http.server.static ! special maps mime types to quots with effect ( path -- ) -TUPLE: file-responder root hook special ; +TUPLE: file-responder root hook special allow-listings ; -: file-http-date ( filename -- string ) - file-info modified>> timestamp>http-string ; - -: last-modified-matches? ( filename -- ? ) - file-http-date dup [ - request get "if-modified-since" header = - ] when ; - -: <304> ( -- response ) - 304 "Not modified" ; +: modified-since? ( filename -- ? ) + request get "if-modified-since" header dup [ + [ file-info modified>> ] [ rfc822>timestamp ] bi* after? + ] [ + 2drop t + ] if ; : ( root hook -- responder ) - H{ } clone file-responder boa ; + file-responder new + swap >>hook + swap >>root + H{ } clone >>special ; + +: (serve-static) ( path mime-type -- response ) + [ [ binary &dispose ] dip ] + [ drop file-info [ size>> ] [ modified>> ] bi ] 2bi + [ "content-length" set-header ] + [ "last-modified" set-header ] bi* ; : ( root -- responder ) - [ - - swap - [ file-info size>> "content-length" set-header ] - [ file-http-date "last-modified" set-header ] - [ '[ , binary stdio get stream-copy ] >>body ] - tri - ] ; + [ (serve-static) ] ; : serve-static ( filename mime-type -- response ) - over last-modified-matches? - [ 2drop <304> ] [ file-responder get hook>> call ] if ; + over modified-since? + [ file-responder get hook>> call ] [ 2drop <304> ] if ; : serving-path ( filename -- filename ) file-responder get root>> right-trim-separators @@ -51,50 +55,51 @@ TUPLE: file-responder root hook special ; : file. ( name dirp -- ) [ "/" append ] when - dup write ; + dup escape-string write ; : directory. ( path -- ) dup file-name [ - [

    file-name write

    ] + [

    file-name escape-string write

    ] [
      directory sort-keys [
    • file.
    • ] assoc-each
    ] bi - ] simple-html-document ; + ] simple-page ; : list-directory ( directory -- response ) - "text/html" - swap '[ , directory. ] >>body ; + file-responder get allow-listings>> [ + '[ , directory. ] "text/html" + ] [ + drop <403> + ] if ; : find-index ( filename -- path ) - { "index.html" "index.fhtml" } [ append-path ] with map - [ exists? ] find nip ; + "index.html" append-path dup exists? [ drop f ] unless ; : serve-directory ( filename -- response ) - dup "/" tail? [ - dup find-index - [ serve-file ] [ list-directory ] ?if + request get path>> "/" tail? [ + dup + find-index [ serve-file ] [ list-directory ] ?if ] [ - drop request get redirect-with-/ + drop + request get url>> clone [ "/" append ] change-path ] if ; : serve-object ( filename -- response ) - serving-path dup exists? [ - dup directory? [ serve-directory ] [ serve-file ] if - ] [ - drop <404> - ] if ; + serving-path dup exists? + [ dup file-info directory? [ serve-directory ] [ serve-file ] if ] + [ drop <404> ] + if ; -M: file-responder call-responder ( path responder -- response ) +M: file-responder call-responder* ( path responder -- response ) file-responder set - dup [ - ".." over subseq? [ - drop <400> - ] [ - serve-object - ] if - ] [ - drop redirect-with-/ - ] if ; + ".." over member? + [ drop <400> ] [ "/" join serve-object ] if ; + +! file responder integration +: enable-fhtml ( responder -- responder ) + [ "text/html" ] + "application/x-factor-server-page" + pick special>> set-at ; diff --git a/extra/http/server/templating/chloe/chloe-tests.factor b/extra/http/server/templating/chloe/chloe-tests.factor deleted file mode 100644 index f517af4a12..0000000000 --- a/extra/http/server/templating/chloe/chloe-tests.factor +++ /dev/null @@ -1,97 +0,0 @@ -USING: http.server.templating http.server.templating.chloe -http.server.components http.server.boilerplate tools.test -io.streams.string kernel sequences ascii boxes namespaces xml -splitting ; -IN: http.server.templating.chloe.tests - -[ "foo" ] -[ "blah" string>xml "href" required-attr ] -unit-test - -[ "blah" string>xml "href" required-attr ] -[ "href attribute is required" = ] -must-fail-with - -[ f ] [ f parse-query-attr ] unit-test - -[ f ] [ "" parse-query-attr ] unit-test - -[ H{ { "a" "b" } } ] [ - blank-values - "b" "a" set-value - "a" parse-query-attr -] unit-test - -[ H{ { "a" "b" } { "c" "d" } } ] [ - blank-values - "b" "a" set-value - "d" "c" set-value - "a,c" parse-query-attr -] unit-test - -: run-template - with-string-writer [ "\r\n\t" member? not ] subset - "?>" split1 nip ; inline - -: test-template ( name -- template ) - "resource:extra/http/server/templating/chloe/test/" - swap - ".xml" 3append ; - -[ "Hello world" ] [ - [ - "test1" test-template call-template - ] run-template -] unit-test - -[ "Blah blah" "Hello world" ] [ - [ - title set - [ - "test2" test-template call-template - ] run-template - title get box> - ] with-scope -] unit-test - -[ "Hello worldBlah blah" ] [ - [ - [ - "test2" test-template call-template - ] "test3" test-template with-boilerplate - ] run-template -] unit-test - -: test4-aux? t ; - -[ "True" ] [ - [ - "test4" test-template call-template - ] run-template -] unit-test - -: test5-aux? f ; - -[ "" ] [ - [ - "test5" test-template call-template - ] run-template -] unit-test - -SYMBOL: test6-aux? - -[ "True" ] [ - [ - test6-aux? on - "test6" test-template call-template - ] run-template -] unit-test - -SYMBOL: test7-aux? - -[ "" ] [ - [ - test7-aux? off - "test7" test-template call-template - ] run-template -] unit-test diff --git a/extra/http/server/templating/chloe/chloe.factor b/extra/http/server/templating/chloe/chloe.factor deleted file mode 100644 index 685988dfaf..0000000000 --- a/extra/http/server/templating/chloe/chloe.factor +++ /dev/null @@ -1,196 +0,0 @@ -USING: accessors kernel sequences combinators kernel namespaces -classes.tuple assocs splitting words arrays -io io.files io.encodings.utf8 html.elements unicode.case -tuple-syntax xml xml.data xml.writer xml.utilities -http.server -http.server.auth -http.server.components -http.server.sessions -http.server.templating -http.server.boilerplate ; -IN: http.server.templating.chloe - -! Chloe is Ed's favorite web designer - -TUPLE: chloe path ; - -C: chloe - -DEFER: process-template - -: chloe-ns TUPLE{ name url: "http://factorcode.org/chloe/1.0" } ; - -: chloe-tag? ( tag -- ? ) - { - { [ dup tag? not ] [ f ] } - { [ dup chloe-ns names-match? not ] [ f ] } - [ t ] - } cond nip ; - -SYMBOL: tags - -: required-attr ( tag name -- value ) - dup rot at* - [ nip ] [ drop " attribute is required" append throw ] if ; - -: optional-attr ( tag name -- value ) - swap at ; - -: write-title-tag ( tag -- ) - drop - "head" tags get member? "title" tags get member? not and - [ write-title ] [ write-title ] if ; - -: style-tag ( tag -- ) - dup "include" optional-attr dup [ - swap children>string empty? [ - "style tag cannot have both an include attribute and a body" throw - ] unless - utf8 file-contents - ] [ - drop children>string - ] if add-style ; - -: write-style-tag ( tag -- ) - drop ; - -: atom-tag ( tag -- ) - [ "title" required-attr ] - [ "href" required-attr ] - bi set-atom-feed ; - -: write-atom-tag ( tag -- ) - drop - "head" tags get member? [ - write-atom-feed - ] [ - atom-feed get value>> second write - ] if ; - -: component-attr ( tag -- name ) - "component" required-attr ; - -: view-tag ( tag -- ) - component-attr component render-view ; - -: edit-tag ( tag -- ) - component-attr component render-edit ; - -: summary-tag ( tag -- ) - component-attr component render-summary ; - -: parse-query-attr ( string -- assoc ) - dup empty? - [ drop f ] [ "," split [ dup value ] H{ } map>assoc ] if ; - -: a-start-tag ( tag -- ) - string =href - a> ; - -: process-tag-children ( tag -- ) - [ process-template ] each ; - -: a-tag ( tag -- ) - [ a-start-tag ] - [ process-tag-children ] - [ drop ] - tri ; - -: form-start-tag ( tag -- ) - - hidden-form-field ; - -: form-tag ( tag -- ) - [ form-start-tag ] - [ process-tag-children ] - [ drop ] - tri ; - -: attr>word ( value -- word/f ) - dup ":" split1 swap lookup - [ ] [ "No such word: " swap append throw ] ?if ; - -: attr>var ( value -- word/f ) - attr>word dup symbol? [ - "Must be a symbol: " swap append throw - ] unless ; - -: if-satisfied? ( tag -- ? ) - { - [ "code" optional-attr [ attr>word execute ] [ t ] if* ] - [ "var" optional-attr [ attr>var get ] [ t ] if* ] - [ "svar" optional-attr [ attr>var sget ] [ t ] if* ] - [ "uvar" optional-attr [ attr>var uget ] [ t ] if* ] - } cleave 4array [ ] all? ; - -: if-tag ( tag -- ) - dup if-satisfied? [ process-tag-children ] [ drop ] if ; - -: error-tag ( tag -- ) - children>string render-error ; - -: process-chloe-tag ( tag -- ) - dup name-tag { - { "chloe" [ [ process-template ] each ] } - { "title" [ children>string set-title ] } - { "write-title" [ write-title-tag ] } - { "style" [ style-tag ] } - { "write-style" [ write-style-tag ] } - { "atom" [ atom-tag ] } - { "write-atom" [ write-atom-tag ] } - { "view" [ view-tag ] } - { "edit" [ edit-tag ] } - { "summary" [ summary-tag ] } - { "a" [ a-tag ] } - { "form" [ form-tag ] } - { "error" [ error-tag ] } - { "if" [ if-tag ] } - { "comment" [ drop ] } - { "call-next-template" [ drop call-next-template ] } - [ "Unknown chloe tag: " swap append throw ] - } case ; - -: process-tag ( tag -- ) - { - [ name-tag >lower tags get push ] - [ write-start-tag ] - [ process-tag-children ] - [ write-end-tag ] - [ drop tags get pop* ] - } cleave ; - -: process-template ( xml -- ) - { - { [ dup [ chloe-tag? ] is? ] [ process-chloe-tag ] } - { [ dup [ tag? ] is? ] [ process-tag ] } - { [ t ] [ write-item ] } - } cond ; - -: process-chloe ( xml -- ) - [ - V{ } clone tags set - - nested-template? get [ - process-template - ] [ - { - [ xml-prolog write-prolog ] - [ xml-before write-chunk ] - [ process-template ] - [ xml-after write-chunk ] - } cleave - ] if - ] with-scope ; - -M: chloe call-template* - path>> utf8 read-xml process-chloe ; - -INSTANCE: chloe template diff --git a/extra/http/server/templating/chloe/test/test4.xml b/extra/http/server/templating/chloe/test/test4.xml deleted file mode 100644 index 0381bcc27a..0000000000 --- a/extra/http/server/templating/chloe/test/test4.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - True - - - diff --git a/extra/http/server/templating/chloe/test/test5.xml b/extra/http/server/templating/chloe/test/test5.xml deleted file mode 100644 index d74a5e5368..0000000000 --- a/extra/http/server/templating/chloe/test/test5.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - True - - - diff --git a/extra/http/server/templating/templating.factor b/extra/http/server/templating/templating.factor deleted file mode 100644 index 610ec78fed..0000000000 --- a/extra/http/server/templating/templating.factor +++ /dev/null @@ -1,28 +0,0 @@ -USING: accessors kernel fry io io.encodings.utf8 io.files -http http.server debugger prettyprint continuations ; -IN: http.server.templating - -MIXIN: template - -GENERIC: call-template* ( template -- ) - -ERROR: template-error template error ; - -M: template-error error. - "Error while processing template " write - [ template>> pprint ":" print nl ] - [ error>> error. ] - bi ; - -: call-template ( template -- ) - [ call-template* ] [ template-error ] recover ; - -M: template write-response-body* call-template ; - -: template-convert ( template output -- ) - utf8 [ call-template ] with-file-writer ; - -! responder integration -: serve-template ( template -- response ) - "text/html" - swap '[ , call-template ] >>body ; diff --git a/extra/http/server/validators/validators-tests.factor b/extra/http/server/validators/validators-tests.factor deleted file mode 100755 index 5e845705ab..0000000000 --- a/extra/http/server/validators/validators-tests.factor +++ /dev/null @@ -1,29 +0,0 @@ -IN: http.server.validators.tests -USING: kernel sequences tools.test http.server.validators -accessors ; - -[ "foo" v-number ] must-fail -[ 123 ] [ "123" v-number ] unit-test - -[ "slava@factorcode.org" ] [ - "slava@factorcode.org" v-email -] unit-test - -[ "slava+foo@factorcode.org" ] [ - "slava+foo@factorcode.org" v-email -] unit-test - -[ "slava@factorcode.o" v-email ] -[ "invalid e-mail" = ] must-fail-with - -[ "sla@@factorcode.o" v-email ] -[ "invalid e-mail" = ] must-fail-with - -[ "slava@factorcodeorg" v-email ] -[ "invalid e-mail" = ] must-fail-with - -[ "http://www.factorcode.org" ] -[ "http://www.factorcode.org" v-url ] unit-test - -[ "http:/www.factorcode.org" v-url ] -[ "invalid URL" = ] must-fail-with diff --git a/extra/http/server/validators/validators.factor b/extra/http/server/validators/validators.factor deleted file mode 100755 index 7415787c79..0000000000 --- a/extra/http/server/validators/validators.factor +++ /dev/null @@ -1,85 +0,0 @@ -! Copyright (C) 2006, 2008 Slava Pestov -! See http://factorcode.org/license.txt for BSD license. -USING: kernel continuations sequences math namespaces sets -math.parser assocs regexp fry unicode.categories sequences ; -IN: http.server.validators - -SYMBOL: validation-failed? - -TUPLE: validation-error value reason ; - -C: validation-error - -: with-validator ( value quot -- result ) - [ validation-failed? on ] recover ; inline - -: v-default ( str def -- str ) - over empty? spin ? ; - -: v-required ( str -- str ) - dup empty? [ "required" throw ] when ; - -: v-optional ( str quot -- str ) - over empty? [ 2drop f ] [ call ] if ; inline - -: v-min-length ( str n -- str ) - over length over < [ - [ "must be at least " % # " characters" % ] "" make - throw - ] [ - drop - ] if ; - -: v-max-length ( str n -- str ) - over length over > [ - [ "must be no more than " % # " characters" % ] "" make - throw - ] [ - drop - ] if ; - -: v-number ( str -- n ) - dup string>number [ ] [ "must be a number" throw ] ?if ; - -: v-integer ( n -- n ) - dup integer? [ "must be an integer" throw ] unless ; - -: v-min-value ( x n -- x ) - 2dup < [ - [ "must be at least " % # ] "" make throw - ] [ - drop - ] if ; - -: v-max-value ( x n -- x ) - 2dup > [ - [ "must be no more than " % # ] "" make throw - ] [ - drop - ] if ; - -: v-regexp ( str what regexp -- str ) - >r over r> matches? - [ drop ] [ "invalid " prepend throw ] if ; - -: v-email ( str -- str ) - #! From http://www.regular-expressions.info/email.html - "e-mail" - R' [A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}'i - v-regexp ; - -: v-url ( str -- str ) - "URL" - R' (ftp|http|https)://(\w+:?\w*@)?(\S+)(:[0-9]+)?(/|/([\w#!:.?+=&%@!\-/]))?' - v-regexp ; - -: v-captcha ( str -- str ) - dup empty? [ "must remain blank" throw ] unless ; - -: v-one-line ( str -- str ) - dup "\r\n" intersect empty? - [ "must be a single line" throw ] unless ; - -: v-one-word ( str -- str ) - dup [ alpha? ] all? - [ "must be a single word" throw ] unless ; diff --git a/extra/icfp/2006/2006.factor b/extra/icfp/2006/2006.factor index e88301c7f8..d12d35a6d2 100755 --- a/extra/icfp/2006/2006.factor +++ b/extra/icfp/2006/2006.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2007 Gavin Harrison ! See http://factorcode.org/license.txt for BSD license. USING: kernel math sequences kernel.private namespaces arrays io -io.files splitting io.binary math.functions vectors quotations -combinators io.encodings.binary ; +io.files splitting grouping io.binary math.functions vectors +quotations combinators io.encodings.binary ; IN: icfp.2006 SYMBOL: regs @@ -148,4 +148,4 @@ SYMBOL: open-arrays init f exec-loop ; : run-sand ( -- ) - "extra/icfp/2006/sandmark.umz" resource-path run-prog ; + "resource:extra/icfp/2006/sandmark.umz" run-prog ; diff --git a/extra/interval-maps/authors.txt b/extra/interval-maps/authors.txt new file mode 100755 index 0000000000..504363d316 --- /dev/null +++ b/extra/interval-maps/authors.txt @@ -0,0 +1 @@ +Daniel Ehrenberg diff --git a/extra/interval-maps/interval-maps-docs.factor b/extra/interval-maps/interval-maps-docs.factor new file mode 100755 index 0000000000..1a862fbe2d --- /dev/null +++ b/extra/interval-maps/interval-maps-docs.factor @@ -0,0 +1,29 @@ +USING: help.markup help.syntax ; +IN: interval-maps + +HELP: interval-at* +{ $values { "key" "an object" } { "map" "an interval map" } { "value" "the value for the key, or f" } { "?" "whether the key is present" } } +{ $description "Looks up a key in an interval map, returning the corresponding value if the item is in an interval in the map, and a boolean flag. The operation takes O(log n) time." } ; + +HELP: interval-at +{ $values { "key" "an object" } { "map" "an interval map" } { "value" "the value for the key, or f" } } +{ $description "Looks up a key in an interval map, returning the value of the corresponding interval, or f if the interval is not present in the map." } ; + +HELP: interval-key? +{ $values { "key" "an object" } { "map" "an interval map" } { "?" "a boolean" } } +{ $description "Tests whether an object is in an interval in the interval map, returning t if the object is present." } ; + +HELP: +{ $values { "specification" "an assoc" } { "map" "an interval map" } } +{ $description "From a specification, produce an interval tree. The specification is an assoc where the keys are intervals, or pairs of numbers to represent intervals, or individual numbers to represent singleton intervals. The values are the values int he interval map. Construction time is O(n log n)." } ; + +ARTICLE: "interval-maps" "Interval maps" +"Interval maps are a mechanism, similar to assocs, where a set of closed intervals of keys are associated with values. As such, interval maps do not conform to the assoc protocol, because intervals of floats, for example, can be used, and it is impossible to get a list of keys in between." +"The following operations are used to query interval maps:" +{ $subsection interval-at* } +{ $subsection interval-at } +{ $subsection interval-key? } +"Use the following to construct interval maps" +{ $subsection } ; + +ABOUT: "interval-maps" diff --git a/extra/interval-maps/interval-maps-tests.factor b/extra/interval-maps/interval-maps-tests.factor new file mode 100755 index 0000000000..5a4b508939 --- /dev/null +++ b/extra/interval-maps/interval-maps-tests.factor @@ -0,0 +1,18 @@ +USING: kernel namespaces interval-maps tools.test ; +IN: interval-maps.test + +SYMBOL: test + +[ ] [ { { { 4 8 } 3 } { 1 2 } } test set ] unit-test +[ 3 ] [ 5 test get interval-at ] unit-test +[ 3 ] [ 8 test get interval-at ] unit-test +[ 3 ] [ 4 test get interval-at ] unit-test +[ f ] [ 9 test get interval-at ] unit-test +[ 2 ] [ 1 test get interval-at ] unit-test +[ f ] [ 2 test get interval-at ] unit-test +[ f ] [ 0 test get interval-at ] unit-test + +[ { { { 1 4 } 3 } { { 4 8 } 6 } } ] must-fail + +[ { { { 1 3 } 2 } { { 4 5 } 4 } { { 7 8 } 4 } } ] +[ { { 1 2 } { 2 2 } { 3 2 } { 4 4 } { 5 4 } { 7 4 } { 8 4 } } coalesce ] unit-test diff --git a/extra/interval-maps/interval-maps.factor b/extra/interval-maps/interval-maps.factor new file mode 100755 index 0000000000..888665030d --- /dev/null +++ b/extra/interval-maps/interval-maps.factor @@ -0,0 +1,61 @@ +USING: kernel sequences arrays accessors tuple-arrays +math.order sorting math assocs locals namespaces ; +IN: interval-maps + +TUPLE: interval-map array ; + +> <=> ] binsearch ; + +: interval-contains? ( object interval-node -- ? ) + [ from>> ] [ to>> ] bi between? ; + +: all-intervals ( sequence -- intervals ) + [ >r dup number? [ dup 2array ] when r> ] assoc-map + { } assoc-like ; + +: disjoint? ( node1 node2 -- ? ) + [ to>> ] [ from>> ] bi* < ; + +: ensure-disjoint ( intervals -- intervals ) + dup [ disjoint? ] monotonic? + [ "Intervals are not disjoint" throw ] unless ; + +: >intervals ( specification -- intervals ) + [ >r first2 r> interval-node boa ] { } assoc>map ; +PRIVATE> + +: interval-at* ( key map -- value ? ) + array>> [ find-interval ] 2keep swapd nth + [ nip value>> ] [ interval-contains? ] 2bi + fixup-value ; + +: interval-at ( key map -- value ) interval-at* drop ; +: interval-key? ( key map -- ? ) interval-at* nip ; + +: ( specification -- map ) + all-intervals [ [ first second ] compare ] sort + >intervals ensure-disjoint >tuple-array + interval-map boa ; + +: ( specification -- map ) + [ dup 2array ] map ; + +:: coalesce ( alist -- specification ) + ! Only works with integer keys, because they're discrete + ! Makes 2array keys + [ + alist sort-keys unclip first2 dupd roll + [| oldkey oldval key val | ! Underneath is start + oldkey 1+ key = + oldval val = and + [ oldkey 2array oldval 2array , key ] unless + key val + ] assoc-each [ 2array ] bi@ , + ] { } make ; diff --git a/extra/interval-maps/summary.txt b/extra/interval-maps/summary.txt new file mode 100755 index 0000000000..d25263260e --- /dev/null +++ b/extra/interval-maps/summary.txt @@ -0,0 +1 @@ +Interval maps for disjoint closed ranges diff --git a/extra/interval-maps/tags.txt b/extra/interval-maps/tags.txt new file mode 100755 index 0000000000..5e9549f425 --- /dev/null +++ b/extra/interval-maps/tags.txt @@ -0,0 +1 @@ +collections diff --git a/extra/inverse/inverse.factor b/extra/inverse/inverse.factor index 7a2856e311..705c2d070b 100755 --- a/extra/inverse/inverse.factor +++ b/extra/inverse/inverse.factor @@ -197,14 +197,14 @@ DEFER: _ \ prefix [ unclip ] define-inverse \ unclip [ prefix ] define-inverse -\ suffix [ dup 1 head* swap peek ] define-inverse +\ suffix [ dup but-last swap peek ] define-inverse ! Constructor inverse : deconstruct-pred ( class -- quot ) "predicate" word-prop [ dupd call assure ] curry ; : slot-readers ( class -- quot ) - all-slots 1 tail ! tail gets rid of delegate + all-slots rest ! tail gets rid of delegate [ slot-spec-reader 1quotation [ keep ] curry ] map concat [ ] like [ drop ] compose ; @@ -218,7 +218,7 @@ DEFER: _ : empty-inverse ( class -- quot ) deconstruct-pred - [ tuple>array 1 tail [ ] contains? [ fail ] when ] + [ tuple>array rest [ ] contains? [ fail ] when ] compose ; \ new 1 [ ?wrapped empty-inverse ] define-pop-inverse diff --git a/extra/io/buffers/buffers.factor b/extra/io/buffers/buffers.factor index a901475544..d5b917246a 100755 --- a/extra/io/buffers/buffers.factor +++ b/extra/io/buffers/buffers.factor @@ -1,10 +1,10 @@ ! Copyright (C) 2004, 2005 Mackenzie Straight. ! Copyright (C) 2006, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -IN: io.buffers USING: alien alien.accessors alien.c-types alien.syntax kernel kernel.private libc math sequences byte-arrays strings hints -accessors ; +accessors math.order ; +IN: io.buffers TUPLE: buffer size ptr fill pos ; diff --git a/extra/io/encodings/8-bit/8-bit.factor b/extra/io/encodings/8-bit/8-bit.factor index dc6e52d67e..d4e6122321 100755 --- a/extra/io/encodings/8-bit/8-bit.factor +++ b/extra/io/encodings/8-bit/8-bit.factor @@ -30,16 +30,14 @@ IN: io.encodings.8-bit } ; : encoding-file ( file-name -- stream ) - "extra/io/encodings/8-bit/" ".TXT" - swapd 3append resource-path - ascii ; + "resource:extra/io/encodings/8-bit/" ".TXT" + swapd 3append ascii ; : tail-if ( seq n -- newseq ) 2dup swap length <= [ tail ] [ drop ] if ; : process-contents ( lines -- assoc ) - [ "#" split1 drop ] map - [ empty? not ] subset + [ "#" split1 drop ] map harvest [ "\t" split 2 head [ 2 tail-if hex> ] map ] map ; : byte>ch ( assoc -- array ) @@ -70,7 +68,7 @@ M: 8-bit decode-char decode>> decode-8-bit ; : make-8-bit ( word byte>ch ch>byte -- ) - [ 8-bit boa ] 2curry dupd curry define ; + [ 2drop ] [ 8-bit boa ] 3bi [ ] curry define ; : define-8-bit-encoding ( name stream -- ) >r in get create r> parse-file make-8-bit ; diff --git a/extra/io/encodings/ascii/ascii.factor b/extra/io/encodings/ascii/ascii.factor old mode 100644 new mode 100755 index d3fe51f28d..9ff120c5fa --- a/extra/io/encodings/ascii/ascii.factor +++ b/extra/io/encodings/ascii/ascii.factor @@ -13,7 +13,7 @@ IN: io.encodings.ascii [ drop f ] if* ; PRIVATE> -TUPLE: ascii ; +SINGLETON: ascii M: ascii encode-char 128 encode-if< ; diff --git a/extra/rss/authors.txt b/extra/io/encodings/iana/authors.txt old mode 100755 new mode 100644 similarity index 100% rename from extra/rss/authors.txt rename to extra/io/encodings/iana/authors.txt diff --git a/extra/io/encodings/iana/character-sets b/extra/io/encodings/iana/character-sets new file mode 100644 index 0000000000..253c471544 --- /dev/null +++ b/extra/io/encodings/iana/character-sets @@ -0,0 +1,1697 @@ +Name: ANSI_X3.4-1968 [RFC1345,KXS2] +MIBenum: 3 +Source: ECMA registry +Alias: iso-ir-6 +Alias: ANSI_X3.4-1986 +Alias: ISO_646.irv:1991 +Alias: ASCII +Alias: ISO646-US +Alias: US-ASCII (preferred MIME name) +Alias: us +Alias: IBM367 +Alias: cp367 +Alias: csASCII + +Name: ISO_8859-1:1987 [RFC1345,KXS2] +MIBenum: 4 +Source: ECMA registry +Alias: iso-ir-100 +Alias: ISO_8859-1 +Alias: ISO-8859-1 (preferred MIME name) +Alias: latin1 +Alias: l1 +Alias: IBM819 +Alias: CP819 +Alias: csISOLatin1 + +Name: ISO_8859-2:1987 [RFC1345,KXS2] +MIBenum: 5 +Source: ECMA registry +Alias: iso-ir-101 +Alias: ISO_8859-2 +Alias: ISO-8859-2 (preferred MIME name) +Alias: latin2 +Alias: l2 +Alias: csISOLatin2 + +Name: ISO_8859-3:1988 [RFC1345,KXS2] +MIBenum: 6 +Source: ECMA registry +Alias: iso-ir-109 +Alias: ISO_8859-3 +Alias: ISO-8859-3 (preferred MIME name) +Alias: latin3 +Alias: l3 +Alias: csISOLatin3 + +Name: ISO_8859-4:1988 [RFC1345,KXS2] +MIBenum: 7 +Source: ECMA registry +Alias: iso-ir-110 +Alias: ISO_8859-4 +Alias: ISO-8859-4 (preferred MIME name) +Alias: latin4 +Alias: l4 +Alias: csISOLatin4 + +Name: ISO_8859-5:1988 [RFC1345,KXS2] +MIBenum: 8 +Source: ECMA registry +Alias: iso-ir-144 +Alias: ISO_8859-5 +Alias: ISO-8859-5 (preferred MIME name) +Alias: cyrillic +Alias: csISOLatinCyrillic + +Name: ISO_8859-6:1987 [RFC1345,KXS2] +MIBenum: 9 +Source: ECMA registry +Alias: iso-ir-127 +Alias: ISO_8859-6 +Alias: ISO-8859-6 (preferred MIME name) +Alias: ECMA-114 +Alias: ASMO-708 +Alias: arabic +Alias: csISOLatinArabic + +Name: ISO_8859-7:1987 [RFC1947,RFC1345,KXS2] +MIBenum: 10 +Source: ECMA registry +Alias: iso-ir-126 +Alias: ISO_8859-7 +Alias: ISO-8859-7 (preferred MIME name) +Alias: ELOT_928 +Alias: ECMA-118 +Alias: greek +Alias: greek8 +Alias: csISOLatinGreek + +Name: ISO_8859-8:1988 [RFC1345,KXS2] +MIBenum: 11 +Source: ECMA registry +Alias: iso-ir-138 +Alias: ISO_8859-8 +Alias: ISO-8859-8 (preferred MIME name) +Alias: hebrew +Alias: csISOLatinHebrew + +Name: ISO_8859-9:1989 [RFC1345,KXS2] +MIBenum: 12 +Source: ECMA registry +Alias: iso-ir-148 +Alias: ISO_8859-9 +Alias: ISO-8859-9 (preferred MIME name) +Alias: latin5 +Alias: l5 +Alias: csISOLatin5 + +Name: ISO-8859-10 (preferred MIME name) [RFC1345,KXS2] +MIBenum: 13 +Source: ECMA registry +Alias: iso-ir-157 +Alias: l6 +Alias: ISO_8859-10:1992 +Alias: csISOLatin6 +Alias: latin6 + +Name: ISO_6937-2-add [RFC1345,KXS2] +MIBenum: 14 +Source: ECMA registry and ISO 6937-2:1983 +Alias: iso-ir-142 +Alias: csISOTextComm + +Name: JIS_X0201 [RFC1345,KXS2] +MIBenum: 15 +Source: JIS X 0201-1976. One byte only, this is equivalent to + JIS/Roman (similar to ASCII) plus eight-bit half-width + Katakana +Alias: X0201 +Alias: csHalfWidthKatakana + +Name: JIS_Encoding +MIBenum: 16 +Source: JIS X 0202-1991. Uses ISO 2022 escape sequences to + shift code sets as documented in JIS X 0202-1991. +Alias: csJISEncoding + +Name: Shift_JIS (preferred MIME name) +MIBenum: 17 +Source: This charset is an extension of csHalfWidthKatakana by + adding graphic characters in JIS X 0208. The CCS's are + JIS X0201:1997 and JIS X0208:1997. The + complete definition is shown in Appendix 1 of JIS + X0208:1997. + This charset can be used for the top-level media type "text". +Alias: MS_Kanji +Alias: csShiftJIS + +Name: Extended_UNIX_Code_Packed_Format_for_Japanese +MIBenum: 18 +Source: Standardized by OSF, UNIX International, and UNIX Systems + Laboratories Pacific. Uses ISO 2022 rules to select + code set 0: US-ASCII (a single 7-bit byte set) + code set 1: JIS X0208-1990 (a double 8-bit byte set) + restricted to A0-FF in both bytes + code set 2: Half Width Katakana (a single 7-bit byte set) + requiring SS2 as the character prefix + code set 3: JIS X0212-1990 (a double 7-bit byte set) + restricted to A0-FF in both bytes + requiring SS3 as the character prefix +Alias: csEUCPkdFmtJapanese +Alias: EUC-JP (preferred MIME name) + +Name: Extended_UNIX_Code_Fixed_Width_for_Japanese +MIBenum: 19 +Source: Used in Japan. Each character is 2 octets. + code set 0: US-ASCII (a single 7-bit byte set) + 1st byte = 00 + 2nd byte = 20-7E + code set 1: JIS X0208-1990 (a double 7-bit byte set) + restricted to A0-FF in both bytes + code set 2: Half Width Katakana (a single 7-bit byte set) + 1st byte = 00 + 2nd byte = A0-FF + code set 3: JIS X0212-1990 (a double 7-bit byte set) + restricted to A0-FF in + the first byte + and 21-7E in the second byte +Alias: csEUCFixWidJapanese + +Name: BS_4730 [RFC1345,KXS2] +MIBenum: 20 +Source: ECMA registry +Alias: iso-ir-4 +Alias: ISO646-GB +Alias: gb +Alias: uk +Alias: csISO4UnitedKingdom + +Name: SEN_850200_C [RFC1345,KXS2] +MIBenum: 21 +Source: ECMA registry +Alias: iso-ir-11 +Alias: ISO646-SE2 +Alias: se2 +Alias: csISO11SwedishForNames + +Name: IT [RFC1345,KXS2] +MIBenum: 22 +Source: ECMA registry +Alias: iso-ir-15 +Alias: ISO646-IT +Alias: csISO15Italian + +Name: ES [RFC1345,KXS2] +MIBenum: 23 +Source: ECMA registry +Alias: iso-ir-17 +Alias: ISO646-ES +Alias: csISO17Spanish + +Name: DIN_66003 [RFC1345,KXS2] +MIBenum: 24 +Source: ECMA registry +Alias: iso-ir-21 +Alias: de +Alias: ISO646-DE +Alias: csISO21German + +Name: NS_4551-1 [RFC1345,KXS2] +MIBenum: 25 +Source: ECMA registry +Alias: iso-ir-60 +Alias: ISO646-NO +Alias: no +Alias: csISO60DanishNorwegian +Alias: csISO60Norwegian1 + +Name: NF_Z_62-010 [RFC1345,KXS2] +MIBenum: 26 +Source: ECMA registry +Alias: iso-ir-69 +Alias: ISO646-FR +Alias: fr +Alias: csISO69French + +Name: ISO-10646-UTF-1 +MIBenum: 27 +Source: Universal Transfer Format (1), this is the multibyte + encoding, that subsets ASCII-7. It does not have byte + ordering issues. +Alias: csISO10646UTF1 + +Name: ISO_646.basic:1983 [RFC1345,KXS2] +MIBenum: 28 +Source: ECMA registry +Alias: ref +Alias: csISO646basic1983 + +Name: INVARIANT [RFC1345,KXS2] +MIBenum: 29 +Alias: csINVARIANT + +Name: ISO_646.irv:1983 [RFC1345,KXS2] +MIBenum: 30 +Source: ECMA registry +Alias: iso-ir-2 +Alias: irv +Alias: csISO2IntlRefVersion + +Name: NATS-SEFI [RFC1345,KXS2] +MIBenum: 31 +Source: ECMA registry +Alias: iso-ir-8-1 +Alias: csNATSSEFI + +Name: NATS-SEFI-ADD [RFC1345,KXS2] +MIBenum: 32 +Source: ECMA registry +Alias: iso-ir-8-2 +Alias: csNATSSEFIADD + +Name: NATS-DANO [RFC1345,KXS2] +MIBenum: 33 +Source: ECMA registry +Alias: iso-ir-9-1 +Alias: csNATSDANO + +Name: NATS-DANO-ADD [RFC1345,KXS2] +MIBenum: 34 +Source: ECMA registry +Alias: iso-ir-9-2 +Alias: csNATSDANOADD + +Name: SEN_850200_B [RFC1345,KXS2] +MIBenum: 35 +Source: ECMA registry +Alias: iso-ir-10 +Alias: FI +Alias: ISO646-FI +Alias: ISO646-SE +Alias: se +Alias: csISO10Swedish + +Name: KS_C_5601-1987 [RFC1345,KXS2] +MIBenum: 36 +Source: ECMA registry +Alias: iso-ir-149 +Alias: KS_C_5601-1989 +Alias: KSC_5601 +Alias: korean +Alias: csKSC56011987 + +Name: ISO-2022-KR (preferred MIME name) [RFC1557,Choi] +MIBenum: 37 +Source: RFC-1557 (see also KS_C_5601-1987) +Alias: csISO2022KR + +Name: EUC-KR (preferred MIME name) [RFC1557,Choi] +MIBenum: 38 +Source: RFC-1557 (see also KS_C_5861-1992) +Alias: csEUCKR + +Name: ISO-2022-JP (preferred MIME name) [RFC1468,Murai] +MIBenum: 39 +Source: RFC-1468 (see also RFC-2237) +Alias: csISO2022JP + +Name: ISO-2022-JP-2 (preferred MIME name) [RFC1554,Ohta] +MIBenum: 40 +Source: RFC-1554 +Alias: csISO2022JP2 + +Name: JIS_C6220-1969-jp [RFC1345,KXS2] +MIBenum: 41 +Source: ECMA registry +Alias: JIS_C6220-1969 +Alias: iso-ir-13 +Alias: katakana +Alias: x0201-7 +Alias: csISO13JISC6220jp + +Name: JIS_C6220-1969-ro [RFC1345,KXS2] +MIBenum: 42 +Source: ECMA registry +Alias: iso-ir-14 +Alias: jp +Alias: ISO646-JP +Alias: csISO14JISC6220ro + +Name: PT [RFC1345,KXS2] +MIBenum: 43 +Source: ECMA registry +Alias: iso-ir-16 +Alias: ISO646-PT +Alias: csISO16Portuguese + +Name: greek7-old [RFC1345,KXS2] +MIBenum: 44 +Source: ECMA registry +Alias: iso-ir-18 +Alias: csISO18Greek7Old + +Name: latin-greek [RFC1345,KXS2] +MIBenum: 45 +Source: ECMA registry +Alias: iso-ir-19 +Alias: csISO19LatinGreek + +Name: NF_Z_62-010_(1973) [RFC1345,KXS2] +MIBenum: 46 +Source: ECMA registry +Alias: iso-ir-25 +Alias: ISO646-FR1 +Alias: csISO25French + +Name: Latin-greek-1 [RFC1345,KXS2] +MIBenum: 47 +Source: ECMA registry +Alias: iso-ir-27 +Alias: csISO27LatinGreek1 + +Name: ISO_5427 [RFC1345,KXS2] +MIBenum: 48 +Source: ECMA registry +Alias: iso-ir-37 +Alias: csISO5427Cyrillic + +Name: JIS_C6226-1978 [RFC1345,KXS2] +MIBenum: 49 +Source: ECMA registry +Alias: iso-ir-42 +Alias: csISO42JISC62261978 + +Name: BS_viewdata [RFC1345,KXS2] +MIBenum: 50 +Source: ECMA registry +Alias: iso-ir-47 +Alias: csISO47BSViewdata + +Name: INIS [RFC1345,KXS2] +MIBenum: 51 +Source: ECMA registry +Alias: iso-ir-49 +Alias: csISO49INIS + +Name: INIS-8 [RFC1345,KXS2] +MIBenum: 52 +Source: ECMA registry +Alias: iso-ir-50 +Alias: csISO50INIS8 + +Name: INIS-cyrillic [RFC1345,KXS2] +MIBenum: 53 +Source: ECMA registry +Alias: iso-ir-51 +Alias: csISO51INISCyrillic + +Name: ISO_5427:1981 [RFC1345,KXS2] +MIBenum: 54 +Source: ECMA registry +Alias: iso-ir-54 +Alias: ISO5427Cyrillic1981 + +Name: ISO_5428:1980 [RFC1345,KXS2] +MIBenum: 55 +Source: ECMA registry +Alias: iso-ir-55 +Alias: csISO5428Greek + +Name: GB_1988-80 [RFC1345,KXS2] +MIBenum: 56 +Source: ECMA registry +Alias: iso-ir-57 +Alias: cn +Alias: ISO646-CN +Alias: csISO57GB1988 + +Name: GB_2312-80 [RFC1345,KXS2] +MIBenum: 57 +Source: ECMA registry +Alias: iso-ir-58 +Alias: chinese +Alias: csISO58GB231280 + +Name: NS_4551-2 [RFC1345,KXS2] +MIBenum: 58 +Source: ECMA registry +Alias: ISO646-NO2 +Alias: iso-ir-61 +Alias: no2 +Alias: csISO61Norwegian2 + +Name: videotex-suppl [RFC1345,KXS2] +MIBenum: 59 +Source: ECMA registry +Alias: iso-ir-70 +Alias: csISO70VideotexSupp1 + +Name: PT2 [RFC1345,KXS2] +MIBenum: 60 +Source: ECMA registry +Alias: iso-ir-84 +Alias: ISO646-PT2 +Alias: csISO84Portuguese2 + +Name: ES2 [RFC1345,KXS2] +MIBenum: 61 +Source: ECMA registry +Alias: iso-ir-85 +Alias: ISO646-ES2 +Alias: csISO85Spanish2 + +Name: MSZ_7795.3 [RFC1345,KXS2] +MIBenum: 62 +Source: ECMA registry +Alias: iso-ir-86 +Alias: ISO646-HU +Alias: hu +Alias: csISO86Hungarian + +Name: JIS_C6226-1983 [RFC1345,KXS2] +MIBenum: 63 +Source: ECMA registry +Alias: iso-ir-87 +Alias: x0208 +Alias: JIS_X0208-1983 +Alias: csISO87JISX0208 + +Name: greek7 [RFC1345,KXS2] +MIBenum: 64 +Source: ECMA registry +Alias: iso-ir-88 +Alias: csISO88Greek7 + +Name: ASMO_449 [RFC1345,KXS2] +MIBenum: 65 +Source: ECMA registry +Alias: ISO_9036 +Alias: arabic7 +Alias: iso-ir-89 +Alias: csISO89ASMO449 + +Name: iso-ir-90 [RFC1345,KXS2] +MIBenum: 66 +Source: ECMA registry +Alias: csISO90 + +Name: JIS_C6229-1984-a [RFC1345,KXS2] +MIBenum: 67 +Source: ECMA registry +Alias: iso-ir-91 +Alias: jp-ocr-a +Alias: csISO91JISC62291984a + +Name: JIS_C6229-1984-b [RFC1345,KXS2] +MIBenum: 68 +Source: ECMA registry +Alias: iso-ir-92 +Alias: ISO646-JP-OCR-B +Alias: jp-ocr-b +Alias: csISO92JISC62991984b + +Name: JIS_C6229-1984-b-add [RFC1345,KXS2] +MIBenum: 69 +Source: ECMA registry +Alias: iso-ir-93 +Alias: jp-ocr-b-add +Alias: csISO93JIS62291984badd + +Name: JIS_C6229-1984-hand [RFC1345,KXS2] +MIBenum: 70 +Source: ECMA registry +Alias: iso-ir-94 +Alias: jp-ocr-hand +Alias: csISO94JIS62291984hand + +Name: JIS_C6229-1984-hand-add [RFC1345,KXS2] +MIBenum: 71 +Source: ECMA registry +Alias: iso-ir-95 +Alias: jp-ocr-hand-add +Alias: csISO95JIS62291984handadd + +Name: JIS_C6229-1984-kana [RFC1345,KXS2] +MIBenum: 72 +Source: ECMA registry +Alias: iso-ir-96 +Alias: csISO96JISC62291984kana + +Name: ISO_2033-1983 [RFC1345,KXS2] +MIBenum: 73 +Source: ECMA registry +Alias: iso-ir-98 +Alias: e13b +Alias: csISO2033 + +Name: ANSI_X3.110-1983 [RFC1345,KXS2] +MIBenum: 74 +Source: ECMA registry +Alias: iso-ir-99 +Alias: CSA_T500-1983 +Alias: NAPLPS +Alias: csISO99NAPLPS + +Name: T.61-7bit [RFC1345,KXS2] +MIBenum: 75 +Source: ECMA registry +Alias: iso-ir-102 +Alias: csISO102T617bit + +Name: T.61-8bit [RFC1345,KXS2] +MIBenum: 76 +Alias: T.61 +Source: ECMA registry +Alias: iso-ir-103 +Alias: csISO103T618bit + +Name: ECMA-cyrillic +MIBenum: 77 +Source: ISO registry (formerly ECMA registry) + http://www.itscj.ipsj.jp/ISO-IR/111.pdf +Alias: iso-ir-111 +Alias: KOI8-E +Alias: csISO111ECMACyrillic + +Name: CSA_Z243.4-1985-1 [RFC1345,KXS2] +MIBenum: 78 +Source: ECMA registry +Alias: iso-ir-121 +Alias: ISO646-CA +Alias: csa7-1 +Alias: ca +Alias: csISO121Canadian1 + +Name: CSA_Z243.4-1985-2 [RFC1345,KXS2] +MIBenum: 79 +Source: ECMA registry +Alias: iso-ir-122 +Alias: ISO646-CA2 +Alias: csa7-2 +Alias: csISO122Canadian2 + +Name: CSA_Z243.4-1985-gr [RFC1345,KXS2] +MIBenum: 80 +Source: ECMA registry +Alias: iso-ir-123 +Alias: csISO123CSAZ24341985gr + +Name: ISO_8859-6-E [RFC1556,IANA] +MIBenum: 81 +Source: RFC1556 +Alias: csISO88596E +Alias: ISO-8859-6-E (preferred MIME name) + +Name: ISO_8859-6-I [RFC1556,IANA] +MIBenum: 82 +Source: RFC1556 +Alias: csISO88596I +Alias: ISO-8859-6-I (preferred MIME name) + +Name: T.101-G2 [RFC1345,KXS2] +MIBenum: 83 +Source: ECMA registry +Alias: iso-ir-128 +Alias: csISO128T101G2 + +Name: ISO_8859-8-E [RFC1556,Nussbacher] +MIBenum: 84 +Source: RFC1556 +Alias: csISO88598E +Alias: ISO-8859-8-E (preferred MIME name) + +Name: ISO_8859-8-I [RFC1556,Nussbacher] +MIBenum: 85 +Source: RFC1556 +Alias: csISO88598I +Alias: ISO-8859-8-I (preferred MIME name) + +Name: CSN_369103 [RFC1345,KXS2] +MIBenum: 86 +Source: ECMA registry +Alias: iso-ir-139 +Alias: csISO139CSN369103 + +Name: JUS_I.B1.002 [RFC1345,KXS2] +MIBenum: 87 +Source: ECMA registry +Alias: iso-ir-141 +Alias: ISO646-YU +Alias: js +Alias: yu +Alias: csISO141JUSIB1002 + +Name: IEC_P27-1 [RFC1345,KXS2] +MIBenum: 88 +Source: ECMA registry +Alias: iso-ir-143 +Alias: csISO143IECP271 + +Name: JUS_I.B1.003-serb [RFC1345,KXS2] +MIBenum: 89 +Source: ECMA registry +Alias: iso-ir-146 +Alias: serbian +Alias: csISO146Serbian + +Name: JUS_I.B1.003-mac [RFC1345,KXS2] +MIBenum: 90 +Source: ECMA registry +Alias: macedonian +Alias: iso-ir-147 +Alias: csISO147Macedonian + +Name: greek-ccitt [RFC1345,KXS2] +MIBenum: 91 +Source: ECMA registry +Alias: iso-ir-150 +Alias: csISO150 +Alias: csISO150GreekCCITT + +Name: NC_NC00-10:81 [RFC1345,KXS2] +MIBenum: 92 +Source: ECMA registry +Alias: cuba +Alias: iso-ir-151 +Alias: ISO646-CU +Alias: csISO151Cuba + +Name: ISO_6937-2-25 [RFC1345,KXS2] +MIBenum: 93 +Source: ECMA registry +Alias: iso-ir-152 +Alias: csISO6937Add + +Name: GOST_19768-74 [RFC1345,KXS2] +MIBenum: 94 +Source: ECMA registry +Alias: ST_SEV_358-88 +Alias: iso-ir-153 +Alias: csISO153GOST1976874 + +Name: ISO_8859-supp [RFC1345,KXS2] +MIBenum: 95 +Source: ECMA registry +Alias: iso-ir-154 +Alias: latin1-2-5 +Alias: csISO8859Supp + +Name: ISO_10367-box [RFC1345,KXS2] +MIBenum: 96 +Source: ECMA registry +Alias: iso-ir-155 +Alias: csISO10367Box + +Name: latin-lap [RFC1345,KXS2] +MIBenum: 97 +Source: ECMA registry +Alias: lap +Alias: iso-ir-158 +Alias: csISO158Lap + +Name: JIS_X0212-1990 [RFC1345,KXS2] +MIBenum: 98 +Source: ECMA registry +Alias: x0212 +Alias: iso-ir-159 +Alias: csISO159JISX02121990 + +Name: DS_2089 [RFC1345,KXS2] +MIBenum: 99 +Source: Danish Standard, DS 2089, February 1974 +Alias: DS2089 +Alias: ISO646-DK +Alias: dk +Alias: csISO646Danish + +Name: us-dk [RFC1345,KXS2] +MIBenum: 100 +Alias: csUSDK + +Name: dk-us [RFC1345,KXS2] +MIBenum: 101 +Alias: csDKUS + +Name: KSC5636 [RFC1345,KXS2] +MIBenum: 102 +Alias: ISO646-KR +Alias: csKSC5636 + +Name: UNICODE-1-1-UTF-7 [RFC1642] +MIBenum: 103 +Source: RFC 1642 +Alias: csUnicode11UTF7 + +Name: ISO-2022-CN [RFC1922] +MIBenum: 104 +Source: RFC-1922 + +Name: ISO-2022-CN-EXT [RFC1922] +MIBenum: 105 +Source: RFC-1922 + +Name: UTF-8 [RFC3629] +MIBenum: 106 +Source: RFC 3629 +Alias: None + +Name: ISO-8859-13 +MIBenum: 109 +Source: ISO See (http://www.iana.org/assignments/charset-reg/ISO-8859-13)[Tumasonis] +Alias: None + +Name: ISO-8859-14 +MIBenum: 110 +Source: ISO See (http://www.iana.org/assignments/charset-reg/ISO-8859-14) [Simonsen] +Alias: iso-ir-199 +Alias: ISO_8859-14:1998 +Alias: ISO_8859-14 +Alias: latin8 +Alias: iso-celtic +Alias: l8 + +Name: ISO-8859-15 +MIBenum: 111 +Source: ISO + Please see: +Alias: ISO_8859-15 +Alias: Latin-9 + +Name: ISO-8859-16 +MIBenum: 112 +Source: ISO +Alias: iso-ir-226 +Alias: ISO_8859-16:2001 +Alias: ISO_8859-16 +Alias: latin10 +Alias: l10 + +Name: GBK +MIBenum: 113 +Source: Chinese IT Standardization Technical Committee + Please see: +Alias: CP936 +Alias: MS936 +Alias: windows-936 + +Name: GB18030 +MIBenum: 114 +Source: Chinese IT Standardization Technical Committee + Please see: +Alias: None + +Name: OSD_EBCDIC_DF04_15 +MIBenum: 115 +Source: Fujitsu-Siemens standard mainframe EBCDIC encoding + Please see: +Alias: None + +Name: OSD_EBCDIC_DF03_IRV +MIBenum: 116 +Source: Fujitsu-Siemens standard mainframe EBCDIC encoding + Please see: +Alias: None + +Name: OSD_EBCDIC_DF04_1 +MIBenum: 117 +Source: Fujitsu-Siemens standard mainframe EBCDIC encoding + Please see: +Alias: None + +Name: ISO-11548-1 +MIBenum: 118 +Source: See [Thibault] +Alias: ISO_11548-1 +Alias: ISO_TR_11548-1 +Alias: csISO115481 + +Name: KZ-1048 +MIBenum: 119 +Source: See [Veremeev, Kikkarin] +Alias: STRK1048-2002 +Alias: RK1048 +Alias: csKZ1048 + +Name: ISO-10646-UCS-2 +MIBenum: 1000 +Source: the 2-octet Basic Multilingual Plane, aka Unicode + this needs to specify network byte order: the standard + does not specify (it is a 16-bit integer space) +Alias: csUnicode + +Name: ISO-10646-UCS-4 +MIBenum: 1001 +Source: the full code space. (same comment about byte order, + these are 31-bit numbers. +Alias: csUCS4 + +Name: ISO-10646-UCS-Basic +MIBenum: 1002 +Source: ASCII subset of Unicode. Basic Latin = collection 1 + See ISO 10646, Appendix A +Alias: csUnicodeASCII + +Name: ISO-10646-Unicode-Latin1 +MIBenum: 1003 +Source: ISO Latin-1 subset of Unicode. Basic Latin and Latin-1 + Supplement = collections 1 and 2. See ISO 10646, + Appendix A. See RFC 1815. +Alias: csUnicodeLatin1 +Alias: ISO-10646 + +Name: ISO-10646-J-1 +Source: ISO 10646 Japanese, see RFC 1815. + +Name: ISO-Unicode-IBM-1261 +MIBenum: 1005 +Source: IBM Latin-2, -3, -5, Extended Presentation Set, GCSGID: 1261 +Alias: csUnicodeIBM1261 + +Name: ISO-Unicode-IBM-1268 +MIBenum: 1006 +Source: IBM Latin-4 Extended Presentation Set, GCSGID: 1268 +Alias: csUnicodeIBM1268 + +Name: ISO-Unicode-IBM-1276 +MIBenum: 1007 +Source: IBM Cyrillic Greek Extended Presentation Set, GCSGID: 1276 +Alias: csUnicodeIBM1276 + +Name: ISO-Unicode-IBM-1264 +MIBenum: 1008 +Source: IBM Arabic Presentation Set, GCSGID: 1264 +Alias: csUnicodeIBM1264 + +Name: ISO-Unicode-IBM-1265 +MIBenum: 1009 +Source: IBM Hebrew Presentation Set, GCSGID: 1265 +Alias: csUnicodeIBM1265 + +Name: UNICODE-1-1 [RFC1641] +MIBenum: 1010 +Source: RFC 1641 +Alias: csUnicode11 + +Name: SCSU +MIBenum: 1011 +Source: SCSU See (http://www.iana.org/assignments/charset-reg/SCSU) [Scherer] +Alias: None + +Name: UTF-7 [RFC2152] +MIBenum: 1012 +Source: RFC 2152 +Alias: None + +Name: UTF-16BE [RFC2781] +MIBenum: 1013 +Source: RFC 2781 +Alias: None + +Name: UTF-16LE [RFC2781] +MIBenum: 1014 +Source: RFC 2781 +Alias: None + +Name: UTF-16 [RFC2781] +MIBenum: 1015 +Source: RFC 2781 +Alias: None + +Name: CESU-8 [Phipps] +MIBenum: 1016 +Source: +Alias: csCESU-8 + +Name: UTF-32 [Davis] +MIBenum: 1017 +Source: +Alias: None + +Name: UTF-32BE [Davis] +MIBenum: 1018 +Source: +Alias: None + +Name: UTF-32LE [Davis] +MIBenum: 1019 +Source: +Alias: None + +Name: BOCU-1 [Scherer] +MIBenum: 1020 +Source: http://www.unicode.org/notes/tn6/ +Alias: csBOCU-1 + +Name: ISO-8859-1-Windows-3.0-Latin-1 [HP-PCL5] +MIBenum: 2000 +Source: Extended ISO 8859-1 Latin-1 for Windows 3.0. + PCL Symbol Set id: 9U +Alias: csWindows30Latin1 + +Name: ISO-8859-1-Windows-3.1-Latin-1 [HP-PCL5] +MIBenum: 2001 +Source: Extended ISO 8859-1 Latin-1 for Windows 3.1. + PCL Symbol Set id: 19U +Alias: csWindows31Latin1 + +Name: ISO-8859-2-Windows-Latin-2 [HP-PCL5] +MIBenum: 2002 +Source: Extended ISO 8859-2. Latin-2 for Windows 3.1. + PCL Symbol Set id: 9E +Alias: csWindows31Latin2 + +Name: ISO-8859-9-Windows-Latin-5 [HP-PCL5] +MIBenum: 2003 +Source: Extended ISO 8859-9. Latin-5 for Windows 3.1 + PCL Symbol Set id: 5T +Alias: csWindows31Latin5 + +Name: hp-roman8 [HP-PCL5,RFC1345,KXS2] +MIBenum: 2004 +Source: LaserJet IIP Printer User's Manual, + HP part no 33471-90901, Hewlet-Packard, June 1989. +Alias: roman8 +Alias: r8 +Alias: csHPRoman8 + +Name: Adobe-Standard-Encoding [Adobe] +MIBenum: 2005 +Source: PostScript Language Reference Manual + PCL Symbol Set id: 10J +Alias: csAdobeStandardEncoding + +Name: Ventura-US [HP-PCL5] +MIBenum: 2006 +Source: Ventura US. ASCII plus characters typically used in + publishing, like pilcrow, copyright, registered, trade mark, + section, dagger, and double dagger in the range A0 (hex) + to FF (hex). + PCL Symbol Set id: 14J +Alias: csVenturaUS + +Name: Ventura-International [HP-PCL5] +MIBenum: 2007 +Source: Ventura International. ASCII plus coded characters similar + to Roman8. + PCL Symbol Set id: 13J +Alias: csVenturaInternational + +Name: DEC-MCS [RFC1345,KXS2] +MIBenum: 2008 +Source: VAX/VMS User's Manual, + Order Number: AI-Y517A-TE, April 1986. +Alias: dec +Alias: csDECMCS + +Name: IBM850 [RFC1345,KXS2] +MIBenum: 2009 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: cp850 +Alias: 850 +Alias: csPC850Multilingual + +Name: PC8-Danish-Norwegian [HP-PCL5] +MIBenum: 2012 +Source: PC Danish Norwegian + 8-bit PC set for Danish Norwegian + PCL Symbol Set id: 11U +Alias: csPC8DanishNorwegian + +Name: IBM862 [RFC1345,KXS2] +MIBenum: 2013 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: cp862 +Alias: 862 +Alias: csPC862LatinHebrew + +Name: PC8-Turkish [HP-PCL5] +MIBenum: 2014 +Source: PC Latin Turkish. PCL Symbol Set id: 9T +Alias: csPC8Turkish + +Name: IBM-Symbols [IBM-CIDT] +MIBenum: 2015 +Source: Presentation Set, CPGID: 259 +Alias: csIBMSymbols + +Name: IBM-Thai [IBM-CIDT] +MIBenum: 2016 +Source: Presentation Set, CPGID: 838 +Alias: csIBMThai + +Name: HP-Legal [HP-PCL5] +MIBenum: 2017 +Source: PCL 5 Comparison Guide, Hewlett-Packard, + HP part number 5961-0510, October 1992 + PCL Symbol Set id: 1U +Alias: csHPLegal + +Name: HP-Pi-font [HP-PCL5] +MIBenum: 2018 +Source: PCL 5 Comparison Guide, Hewlett-Packard, + HP part number 5961-0510, October 1992 + PCL Symbol Set id: 15U +Alias: csHPPiFont + +Name: HP-Math8 [HP-PCL5] +MIBenum: 2019 +Source: PCL 5 Comparison Guide, Hewlett-Packard, + HP part number 5961-0510, October 1992 + PCL Symbol Set id: 8M +Alias: csHPMath8 + +Name: Adobe-Symbol-Encoding [Adobe] +MIBenum: 2020 +Source: PostScript Language Reference Manual + PCL Symbol Set id: 5M +Alias: csHPPSMath + +Name: HP-DeskTop [HP-PCL5] +MIBenum: 2021 +Source: PCL 5 Comparison Guide, Hewlett-Packard, + HP part number 5961-0510, October 1992 + PCL Symbol Set id: 7J +Alias: csHPDesktop + +Name: Ventura-Math [HP-PCL5] +MIBenum: 2022 +Source: PCL 5 Comparison Guide, Hewlett-Packard, + HP part number 5961-0510, October 1992 + PCL Symbol Set id: 6M +Alias: csVenturaMath + +Name: Microsoft-Publishing [HP-PCL5] +MIBenum: 2023 +Source: PCL 5 Comparison Guide, Hewlett-Packard, + HP part number 5961-0510, October 1992 + PCL Symbol Set id: 6J +Alias: csMicrosoftPublishing + +Name: Windows-31J +MIBenum: 2024 +Source: Windows Japanese. A further extension of Shift_JIS + to include NEC special characters (Row 13), NEC + selection of IBM extensions (Rows 89 to 92), and IBM + extensions (Rows 115 to 119). The CCS's are + JIS X0201:1997, JIS X0208:1997, and these extensions. + This charset can be used for the top-level media type "text", + but it is of limited or specialized use (see RFC2278). + PCL Symbol Set id: 19K +Alias: csWindows31J + +Name: GB2312 (preferred MIME name) +MIBenum: 2025 +Source: Chinese for People's Republic of China (PRC) mixed one byte, + two byte set: + 20-7E = one byte ASCII + A1-FE = two byte PRC Kanji + See GB 2312-80 + PCL Symbol Set Id: 18C +Alias: csGB2312 + +Name: Big5 (preferred MIME name) +MIBenum: 2026 +Source: Chinese for Taiwan Multi-byte set. + PCL Symbol Set Id: 18T +Alias: csBig5 + +Name: macintosh [RFC1345,KXS2] +MIBenum: 2027 +Source: The Unicode Standard ver1.0, ISBN 0-201-56788-1, Oct 1991 +Alias: mac +Alias: csMacintosh + +Name: IBM037 [RFC1345,KXS2] +MIBenum: 2028 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: cp037 +Alias: ebcdic-cp-us +Alias: ebcdic-cp-ca +Alias: ebcdic-cp-wt +Alias: ebcdic-cp-nl +Alias: csIBM037 + +Name: IBM038 [RFC1345,KXS2] +MIBenum: 2029 +Source: IBM 3174 Character Set Ref, GA27-3831-02, March 1990 +Alias: EBCDIC-INT +Alias: cp038 +Alias: csIBM038 + +Name: IBM273 [RFC1345,KXS2] +MIBenum: 2030 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: CP273 +Alias: csIBM273 + +Name: IBM274 [RFC1345,KXS2] +MIBenum: 2031 +Source: IBM 3174 Character Set Ref, GA27-3831-02, March 1990 +Alias: EBCDIC-BE +Alias: CP274 +Alias: csIBM274 + +Name: IBM275 [RFC1345,KXS2] +MIBenum: 2032 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: EBCDIC-BR +Alias: cp275 +Alias: csIBM275 + +Name: IBM277 [RFC1345,KXS2] +MIBenum: 2033 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: EBCDIC-CP-DK +Alias: EBCDIC-CP-NO +Alias: csIBM277 + +Name: IBM278 [RFC1345,KXS2] +MIBenum: 2034 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: CP278 +Alias: ebcdic-cp-fi +Alias: ebcdic-cp-se +Alias: csIBM278 + +Name: IBM280 [RFC1345,KXS2] +MIBenum: 2035 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: CP280 +Alias: ebcdic-cp-it +Alias: csIBM280 + +Name: IBM281 [RFC1345,KXS2] +MIBenum: 2036 +Source: IBM 3174 Character Set Ref, GA27-3831-02, March 1990 +Alias: EBCDIC-JP-E +Alias: cp281 +Alias: csIBM281 + +Name: IBM284 [RFC1345,KXS2] +MIBenum: 2037 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: CP284 +Alias: ebcdic-cp-es +Alias: csIBM284 + +Name: IBM285 [RFC1345,KXS2] +MIBenum: 2038 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: CP285 +Alias: ebcdic-cp-gb +Alias: csIBM285 + +Name: IBM290 [RFC1345,KXS2] +MIBenum: 2039 +Source: IBM 3174 Character Set Ref, GA27-3831-02, March 1990 +Alias: cp290 +Alias: EBCDIC-JP-kana +Alias: csIBM290 + +Name: IBM297 [RFC1345,KXS2] +MIBenum: 2040 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: cp297 +Alias: ebcdic-cp-fr +Alias: csIBM297 + +Name: IBM420 [RFC1345,KXS2] +MIBenum: 2041 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990, + IBM NLS RM p 11-11 +Alias: cp420 +Alias: ebcdic-cp-ar1 +Alias: csIBM420 + +Name: IBM423 [RFC1345,KXS2] +MIBenum: 2042 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: cp423 +Alias: ebcdic-cp-gr +Alias: csIBM423 + +Name: IBM424 [RFC1345,KXS2] +MIBenum: 2043 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: cp424 +Alias: ebcdic-cp-he +Alias: csIBM424 + +Name: IBM437 [RFC1345,KXS2] +MIBenum: 2011 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: cp437 +Alias: 437 +Alias: csPC8CodePage437 + +Name: IBM500 [RFC1345,KXS2] +MIBenum: 2044 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: CP500 +Alias: ebcdic-cp-be +Alias: ebcdic-cp-ch +Alias: csIBM500 + +Name: IBM851 [RFC1345,KXS2] +MIBenum: 2045 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: cp851 +Alias: 851 +Alias: csIBM851 + +Name: IBM852 [RFC1345,KXS2] +MIBenum: 2010 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: cp852 +Alias: 852 +Alias: csPCp852 + +Name: IBM855 [RFC1345,KXS2] +MIBenum: 2046 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: cp855 +Alias: 855 +Alias: csIBM855 + +Name: IBM857 [RFC1345,KXS2] +MIBenum: 2047 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: cp857 +Alias: 857 +Alias: csIBM857 + +Name: IBM860 [RFC1345,KXS2] +MIBenum: 2048 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: cp860 +Alias: 860 +Alias: csIBM860 + +Name: IBM861 [RFC1345,KXS2] +MIBenum: 2049 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: cp861 +Alias: 861 +Alias: cp-is +Alias: csIBM861 + +Name: IBM863 [RFC1345,KXS2] +MIBenum: 2050 +Source: IBM Keyboard layouts and code pages, PN 07G4586 June 1991 +Alias: cp863 +Alias: 863 +Alias: csIBM863 + +Name: IBM864 [RFC1345,KXS2] +MIBenum: 2051 +Source: IBM Keyboard layouts and code pages, PN 07G4586 June 1991 +Alias: cp864 +Alias: csIBM864 + +Name: IBM865 [RFC1345,KXS2] +MIBenum: 2052 +Source: IBM DOS 3.3 Ref (Abridged), 94X9575 (Feb 1987) +Alias: cp865 +Alias: 865 +Alias: csIBM865 + +Name: IBM868 [RFC1345,KXS2] +MIBenum: 2053 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: CP868 +Alias: cp-ar +Alias: csIBM868 + +Name: IBM869 [RFC1345,KXS2] +MIBenum: 2054 +Source: IBM Keyboard layouts and code pages, PN 07G4586 June 1991 +Alias: cp869 +Alias: 869 +Alias: cp-gr +Alias: csIBM869 + +Name: IBM870 [RFC1345,KXS2] +MIBenum: 2055 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: CP870 +Alias: ebcdic-cp-roece +Alias: ebcdic-cp-yu +Alias: csIBM870 + +Name: IBM871 [RFC1345,KXS2] +MIBenum: 2056 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: CP871 +Alias: ebcdic-cp-is +Alias: csIBM871 + +Name: IBM880 [RFC1345,KXS2] +MIBenum: 2057 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: cp880 +Alias: EBCDIC-Cyrillic +Alias: csIBM880 + +Name: IBM891 [RFC1345,KXS2] +MIBenum: 2058 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: cp891 +Alias: csIBM891 + +Name: IBM903 [RFC1345,KXS2] +MIBenum: 2059 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: cp903 +Alias: csIBM903 + +Name: IBM904 [RFC1345,KXS2] +MIBenum: 2060 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: cp904 +Alias: 904 +Alias: csIBBM904 + +Name: IBM905 [RFC1345,KXS2] +MIBenum: 2061 +Source: IBM 3174 Character Set Ref, GA27-3831-02, March 1990 +Alias: CP905 +Alias: ebcdic-cp-tr +Alias: csIBM905 + +Name: IBM918 [RFC1345,KXS2] +MIBenum: 2062 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: CP918 +Alias: ebcdic-cp-ar2 +Alias: csIBM918 + +Name: IBM1026 [RFC1345,KXS2] +MIBenum: 2063 +Source: IBM NLS RM Vol2 SE09-8002-01, March 1990 +Alias: CP1026 +Alias: csIBM1026 + +Name: EBCDIC-AT-DE [RFC1345,KXS2] +MIBenum: 2064 +Source: IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 +Alias: csIBMEBCDICATDE + +Name: EBCDIC-AT-DE-A [RFC1345,KXS2] +MIBenum: 2065 +Source: IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 +Alias: csEBCDICATDEA + +Name: EBCDIC-CA-FR [RFC1345,KXS2] +MIBenum: 2066 +Source: IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 +Alias: csEBCDICCAFR + +Name: EBCDIC-DK-NO [RFC1345,KXS2] +MIBenum: 2067 +Source: IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 +Alias: csEBCDICDKNO + +Name: EBCDIC-DK-NO-A [RFC1345,KXS2] +MIBenum: 2068 +Source: IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 +Alias: csEBCDICDKNOA + +Name: EBCDIC-FI-SE [RFC1345,KXS2] +MIBenum: 2069 +Source: IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 +Alias: csEBCDICFISE + +Name: EBCDIC-FI-SE-A [RFC1345,KXS2] +MIBenum: 2070 +Source: IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 +Alias: csEBCDICFISEA + +Name: EBCDIC-FR [RFC1345,KXS2] +MIBenum: 2071 +Source: IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 +Alias: csEBCDICFR + +Name: EBCDIC-IT [RFC1345,KXS2] +MIBenum: 2072 +Source: IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 +Alias: csEBCDICIT + +Name: EBCDIC-PT [RFC1345,KXS2] +MIBenum: 2073 +Source: IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 +Alias: csEBCDICPT + +Name: EBCDIC-ES [RFC1345,KXS2] +MIBenum: 2074 +Source: IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 +Alias: csEBCDICES + +Name: EBCDIC-ES-A [RFC1345,KXS2] +MIBenum: 2075 +Source: IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 +Alias: csEBCDICESA + +Name: EBCDIC-ES-S [RFC1345,KXS2] +MIBenum: 2076 +Source: IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 +Alias: csEBCDICESS + +Name: EBCDIC-UK [RFC1345,KXS2] +MIBenum: 2077 +Source: IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 +Alias: csEBCDICUK + +Name: EBCDIC-US [RFC1345,KXS2] +MIBenum: 2078 +Source: IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 +Alias: csEBCDICUS + +Name: UNKNOWN-8BIT [RFC1428] +MIBenum: 2079 +Alias: csUnknown8BiT + +Name: MNEMONIC [RFC1345,KXS2] +MIBenum: 2080 +Source: RFC 1345, also known as "mnemonic+ascii+38" +Alias: csMnemonic + +Name: MNEM [RFC1345,KXS2] +MIBenum: 2081 +Source: RFC 1345, also known as "mnemonic+ascii+8200" +Alias: csMnem + +Name: VISCII [RFC1456] +MIBenum: 2082 +Source: RFC 1456 +Alias: csVISCII + +Name: VIQR [RFC1456] +MIBenum: 2083 +Source: RFC 1456 +Alias: csVIQR + +Name: KOI8-R (preferred MIME name) [RFC1489] +MIBenum: 2084 +Source: RFC 1489, based on GOST-19768-74, ISO-6937/8, + INIS-Cyrillic, ISO-5427. +Alias: csKOI8R + +Name: HZ-GB-2312 +MIBenum: 2085 +Source: RFC 1842, RFC 1843 [RFC1842, RFC1843] + +Name: IBM866 [Pond] +MIBenum: 2086 +Source: IBM NLDG Volume 2 (SE09-8002-03) August 1994 +Alias: cp866 +Alias: 866 +Alias: csIBM866 + +Name: IBM775 [HP-PCL5] +MIBenum: 2087 +Source: HP PCL 5 Comparison Guide (P/N 5021-0329) pp B-13, 1996 +Alias: cp775 +Alias: csPC775Baltic + +Name: KOI8-U [RFC2319] +MIBenum: 2088 +Source: RFC 2319 + +Name: IBM00858 +MIBenum: 2089 +Source: IBM See (http://www.iana.org/assignments/charset-reg/IBM00858) [Mahdi] +Alias: CCSID00858 +Alias: CP00858 +Alias: PC-Multilingual-850+euro + +Name: IBM00924 +MIBenum: 2090 +Source: IBM See (http://www.iana.org/assignments/charset-reg/IBM00924) [Mahdi] +Alias: CCSID00924 +Alias: CP00924 +Alias: ebcdic-Latin9--euro + +Name: IBM01140 +MIBenum: 2091 +Source: IBM See (http://www.iana.org/assignments/charset-reg/IBM01140) [Mahdi] +Alias: CCSID01140 +Alias: CP01140 +Alias: ebcdic-us-37+euro + +Name: IBM01141 +MIBenum: 2092 +Source: IBM See (http://www.iana.org/assignments/charset-reg/IBM01141) [Mahdi] +Alias: CCSID01141 +Alias: CP01141 +Alias: ebcdic-de-273+euro + +Name: IBM01142 +MIBenum: 2093 +Source: IBM See (http://www.iana.org/assignments/charset-reg/IBM01142) [Mahdi] +Alias: CCSID01142 +Alias: CP01142 +Alias: ebcdic-dk-277+euro +Alias: ebcdic-no-277+euro + +Name: IBM01143 +MIBenum: 2094 +Source: IBM See (http://www.iana.org/assignments/charset-reg/IBM01143) [Mahdi] +Alias: CCSID01143 +Alias: CP01143 +Alias: ebcdic-fi-278+euro +Alias: ebcdic-se-278+euro + +Name: IBM01144 +MIBenum: 2095 +Source: IBM See (http://www.iana.org/assignments/charset-reg/IBM01144) [Mahdi] +Alias: CCSID01144 +Alias: CP01144 +Alias: ebcdic-it-280+euro + +Name: IBM01145 +MIBenum: 2096 +Source: IBM See (http://www.iana.org/assignments/charset-reg/IBM01145) [Mahdi] +Alias: CCSID01145 +Alias: CP01145 +Alias: ebcdic-es-284+euro + +Name: IBM01146 +MIBenum: 2097 +Source: IBM See (http://www.iana.org/assignments/charset-reg/IBM01146) [Mahdi] +Alias: CCSID01146 +Alias: CP01146 +Alias: ebcdic-gb-285+euro + +Name: IBM01147 +MIBenum: 2098 +Source: IBM See (http://www.iana.org/assignments/charset-reg/IBM01147) [Mahdi] +Alias: CCSID01147 +Alias: CP01147 +Alias: ebcdic-fr-297+euro + +Name: IBM01148 +MIBenum: 2099 +Source: IBM See (http://www.iana.org/assignments/charset-reg/IBM01148) [Mahdi] +Alias: CCSID01148 +Alias: CP01148 +Alias: ebcdic-international-500+euro + +Name: IBM01149 +MIBenum: 2100 +Source: IBM See (http://www.iana.org/assignments/charset-reg/IBM01149) [Mahdi] +Alias: CCSID01149 +Alias: CP01149 +Alias: ebcdic-is-871+euro + +Name: Big5-HKSCS [Yick] +MIBenum: 2101 +Source: See (http://www.iana.org/assignments/charset-reg/Big5-HKSCS) +Alias: None + +Name: IBM1047 [Robrigado] +MIBenum: 2102 +Source: IBM1047 (EBCDIC Latin 1/Open Systems) +http://www-1.ibm.com/servers/eserver/iseries/software/globalization/pdf/cp01047z.pdf +Alias: IBM-1047 + +Name: PTCP154 [Uskov] +MIBenum: 2103 +Source: See (http://www.iana.org/assignments/charset-reg/PTCP154) +Alias: csPTCP154 +Alias: PT154 +Alias: CP154 +Alias: Cyrillic-Asian + +Name: Amiga-1251 +MIBenum: 2104 +Source: See (http://www.amiga.ultranet.ru/Amiga-1251.html) +Alias: Ami1251 +Alias: Amiga1251 +Alias: Ami-1251 +(Aliases are provided for historical reasons and should not be used) + [Malyshev] + +Name: KOI7-switched +MIBenum: 2105 +Source: See +Aliases: None + +Name: BRF +MIBenum: 2106 +Source: See [Thibault] +Alias: csBRF + +Name: TSCII +MIBenum: 2107 +Source: See [Kalyanasundaram] +Alias: csTSCII + +Name: windows-1250 +MIBenum: 2250 +Source: Microsoft (http://www.iana.org/assignments/charset-reg/windows-1250) [Lazhintseva] +Alias: None + +Name: windows-1251 +MIBenum: 2251 +Source: Microsoft (http://www.iana.org/assignments/charset-reg/windows-1251) [Lazhintseva] +Alias: None + +Name: windows-1252 +MIBenum: 2252 +Source: Microsoft (http://www.iana.org/assignments/charset-reg/windows-1252) [Wendt] +Alias: None + +Name: windows-1253 +MIBenum: 2253 +Source: Microsoft (http://www.iana.org/assignments/charset-reg/windows-1253) [Lazhintseva] +Alias: None + +Name: windows-1254 +MIBenum: 2254 +Source: Microsoft (http://www.iana.org/assignments/charset-reg/windows-1254) [Lazhintseva] +Alias: None + +Name: windows-1255 +MIBenum: 2255 +Source: Microsoft (http://www.iana.org/assignments/charset-reg/windows-1255) [Lazhintseva] +Alias: None + +Name: windows-1256 +MIBenum: 2256 +Source: Microsoft (http://www.iana.org/assignments/charset-reg/windows-1256) [Lazhintseva] +Alias: None + +Name: windows-1257 +MIBenum: 2257 +Source: Microsoft (http://www.iana.org/assignments/charset-reg/windows-1257) [Lazhintseva] +Alias: None + +Name: windows-1258 +MIBenum: 2258 +Source: Microsoft (http://www.iana.org/assignments/charset-reg/windows-1258) [Lazhintseva] +Alias: None + +Name: TIS-620 +MIBenum: 2259 +Source: Thai Industrial Standards Institute (TISI) [Tantsetthi] + diff --git a/extra/io/encodings/iana/iana-docs.factor b/extra/io/encodings/iana/iana-docs.factor new file mode 100644 index 0000000000..d4a7a65797 --- /dev/null +++ b/extra/io/encodings/iana/iana-docs.factor @@ -0,0 +1,12 @@ +USING: help.syntax help.markup ; +IN: io.encodings.iana + +HELP: name>encoding +{ $values { "name" "an encoding name" } { "encoding" "an encoding descriptor" } } +{ "Given an IANA-registered encoding name, find the encoding descriptor that represents it, or " { $code f } " if it is not found (either not implemented in Factor or not registered)." } ; + +HELP: encoding>name +{ $values { "encoding" "an encoding descriptor" } { "name" "an encoding name" } } +{ "Given an encoding descriptor, return the preferred IANA name." } ; + +{ name>encoding encoding>name } related-words diff --git a/extra/io/encodings/iana/iana-tests.factor b/extra/io/encodings/iana/iana-tests.factor new file mode 100644 index 0000000000..8cee07b984 --- /dev/null +++ b/extra/io/encodings/iana/iana-tests.factor @@ -0,0 +1,5 @@ +USING: io.encodings.iana io.encodings.ascii tools.test ; + +[ ascii ] [ "US-ASCII" name>encoding ] unit-test +[ ascii ] [ "ASCII" name>encoding ] unit-test +[ "US-ASCII" ] [ ascii encoding>name ] unit-test diff --git a/extra/io/encodings/iana/iana.factor b/extra/io/encodings/iana/iana.factor new file mode 100755 index 0000000000..dd429c1670 --- /dev/null +++ b/extra/io/encodings/iana/iana.factor @@ -0,0 +1,55 @@ +! Copyright (C) 2008 Daniel Ehrenberg +! See http://factorcode.org/license.txt for BSD license. +USING: kernel strings values io.files assocs +splitting sequences io namespaces sets io.encodings.8-bit +io.encodings.ascii io.encodings.utf8 io.encodings.utf16 ; +IN: io.encodings.iana + +e-table + +: e>n-table H{ + { ascii "US-ASCII" } + { utf8 "UTF-8" } + { utf16 "UTF-16" } + { utf16be "UTF-16BE" } + { utf16le "UTF-16LE" } + { latin1 "ISO-8859-1" } + { latin2 "ISO-8859-2" } + { latin3 "ISO-8859-3" } + { latin4 "ISO-8859-4" } + { latin/cyrillic "ISO-8859-5" } + { latin/arabic "ISO-8859-6" } + { latin/greek "ISO-8859-7" } + { latin/hebrew "ISO-8859-8" } + { latin5 "ISO-8859-9" } + { latin6 "ISO-8859-10" } +} ; +PRIVATE> + +: name>encoding ( name -- encoding ) + n>e-table at ; + +: encoding>name ( encoding -- name ) + e>n-table at ; + +e ( stream -- n>e ) + parse-iana [ [ + dup [ + e>n-table value-at + [ swap [ set ] with each ] + [ drop ] if* + ] with each + ] each ] H{ } make-assoc ; +PRIVATE> + +"resource:extra/io/encodings/iana/character-sets" +ascii make-n>e \ n>e-table set-value diff --git a/extra/io/encodings/iana/summary.txt b/extra/io/encodings/iana/summary.txt new file mode 100644 index 0000000000..c95d76344c --- /dev/null +++ b/extra/io/encodings/iana/summary.txt @@ -0,0 +1 @@ +Tables for IANA encoding names diff --git a/extra/io/files/unique/unique-docs.factor b/extra/io/files/unique/unique-docs.factor index 01b8e131cc..bb4e9ef01f 100644 --- a/extra/io/files/unique/unique-docs.factor +++ b/extra/io/files/unique/unique-docs.factor @@ -1,4 +1,4 @@ -USING: help.markup help.syntax io io.nonblocking kernel math +USING: help.markup help.syntax io io.ports kernel math io.files.unique.private math.parser io.files ; IN: io.files.unique diff --git a/extra/io/launcher/launcher-docs.factor b/extra/io/launcher/launcher-docs.factor index dadb627fc0..45bbec20e3 100755 --- a/extra/io/launcher/launcher-docs.factor +++ b/extra/io/launcher/launcher-docs.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: help.markup help.syntax quotations kernel io math -calendar ; +USING: help.markup help.syntax quotations kernel io io.files +math calendar ; IN: io.launcher ARTICLE: "io.launcher.command" "Specifying a command" @@ -26,10 +26,10 @@ $nl "To specify redirection, set the " { $snippet "stdin" } ", " { $snippet "stdout" } " and " { $snippet "stderr" } " slots of a " { $link process } " to one of the following values:" { $list { { $link f } " - default value; the stream is either inherited from the current process, or is a " { $link } " pipe" } - { { $link +inherit+ } " - the stream is inherited from the current process, overriding a " { $link } " pipe" } { { $link +closed+ } " - the stream is closed; reads will return end of file and writes will fails" } { { $link +stdout+ } " - a special value for the " { $snippet "stderr" } " slot only, indicating that the standard output and standard error streams should be merged" } { "a path name - the stream is sent to the given file, which must exist for input and is created automatically on output" } + { "an " { $link appender } " wrapping a path name - output is sent to the end given file, as with " { $link } } { "a file stream or a socket - the stream is connected to the given Factor stream, which cannot be used again from within Factor and must be closed after the process has been started" } } ; @@ -47,12 +47,16 @@ ARTICLE: "io.launcher.priority" "Setting process priority" HELP: +closed+ { $description "Possible value for the " { $snippet "stdin" } ", " { $snippet "stdout" } ", and " { $snippet "stderr" } " slots of a " { $link process } "." } ; -HELP: +inherit+ -{ $description "Possible value for the " { $snippet "stdin" } ", " { $snippet "stdout" } ", and " { $snippet "stderr" } " slots of a " { $link process } "." } ; - HELP: +stdout+ { $description "Possible value for the " { $snippet "stderr" } " slot of a " { $link process } "." } ; +HELP: appender +{ $class-description "An object representing a file to append to. Instances are created with " { $link } "." } ; + +HELP: +{ $values { "path" "a pathname string" } { "appender" appender } } +{ $description "Creates an object which may be stored in the " { $snippet "stdout" } " or " { $snippet "stderr" } " slot of a " { $link process } " instance." } ; + HELP: +prepend-environment+ { $description "Possible value of " { $snippet "environment-mode" } " slot of a " { $link process } "." $nl @@ -138,13 +142,6 @@ HELP: { "stream" "a bidirectional stream" } } { $description "Launches a process and redirects its input and output via a pair of pipes which may be read and written as a stream of the given encoding." } ; -HELP: with-process-stream -{ $values - { "desc" "a launch descriptor" } - { "quot" quotation } - { "status" "an exit code" } } -{ $description "Calls " { $snippet "quot" } " in a dynamic scope where " { $link stdio } " is rebound to a process stream. After the quotation returns, waits for the process to end and outputs the exit code." } ; - HELP: wait-for-process { $values { "process" process } { "status" integer } } { $description "If the process is still running, waits for it to exit, otherwise outputs the exit code immediately. Can be called multiple times on the same process." } ; @@ -175,8 +172,9 @@ ARTICLE: "io.launcher.launch" "Launching processes" { $subsection try-process } { $subsection run-detached } "Redirecting standard input and output to a pipe:" -{ $subsection } -{ $subsection with-process-stream } ; +{ $subsection } +{ $subsection } +{ $subsection } ; ARTICLE: "io.launcher.examples" "Launcher examples" "Starting a command and waiting for it to finish:" @@ -212,7 +210,7 @@ ARTICLE: "io.launcher.examples" "Launcher examples" " " " swap >>stderr" " \"report\" >>command" - " ascii lines sort reverse [ print ] each" + " ascii lines sort reverse [ print ] each" "] with-disposal" } ; diff --git a/extra/io/launcher/launcher-tests.factor b/extra/io/launcher/launcher-tests.factor index bacb8eb5a9..003f382020 100755 --- a/extra/io/launcher/launcher-tests.factor +++ b/extra/io/launcher/launcher-tests.factor @@ -2,3 +2,5 @@ IN: io.launcher.tests USING: tools.test io.launcher ; \ must-infer +\ must-infer +\ must-infer diff --git a/extra/io/launcher/launcher.factor b/extra/io/launcher/launcher.factor index 6ee8660528..131cadfaf0 100755 --- a/extra/io/launcher/launcher.factor +++ b/extra/io/launcher/launcher.factor @@ -1,9 +1,10 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: io io.backend io.timeouts system kernel namespaces -strings hashtables sequences assocs combinators vocabs.loader -init threads continuations math io.encodings io.streams.duplex -io.nonblocking accessors concurrency.flags ; +USING: system kernel namespaces strings hashtables sequences +assocs combinators vocabs.loader init threads continuations +math accessors concurrency.flags destructors +io io.backend io.timeouts io.pipes io.pipes.private io.encodings +io.streams.duplex io.ports ; IN: io.launcher TUPLE: process < identity-tuple @@ -26,9 +27,12 @@ handle status killed ; SYMBOL: +closed+ -SYMBOL: +inherit+ SYMBOL: +stdout+ +TUPLE: appender path ; + +: ( path -- appender ) appender boa ; + SYMBOL: +prepend-environment+ SYMBOL: +replace-environment+ SYMBOL: +append-environment+ @@ -143,22 +147,65 @@ M: process timeout timeout>> ; M: process set-timeout set-process-timeout ; -M: process timed-out kill-process ; +M: process cancel-operation kill-process ; -HOOK: (process-stream) io-backend ( process -- handle in out ) +M: object run-pipeline-element + [ >process swap >>stdout swap >>stdin run-detached ] + [ drop [ [ dispose ] when* ] bi@ ] + 3bi + wait-for-process ; -: ( desc encoding -- stream process ) - >r >process dup dup (process-stream) - r> -roll - process-started ; +: ( process encoding -- process stream ) + [ + >r (pipe) { + [ |dispose drop ] + [ + swap >process + [ swap out>> or ] change-stdout + run-detached + ] + [ out>> dispose ] + [ in>> ] + } cleave r> + ] with-destructors ; + +: ( desc encoding -- stream ) + nip ; inline + +: ( process encoding -- process stream ) + [ + >r (pipe) { + [ |dispose drop ] + [ + swap >process + [ swap in>> or ] change-stdout + run-detached + ] + [ in>> dispose ] + [ out>> ] + } cleave r> + ] with-destructors ; + +: ( desc encoding -- stream ) + nip ; inline + +: ( process encoding -- process stream ) + [ + >r (pipe) (pipe) { + [ [ |dispose drop ] bi@ ] + [ + rot >process + [ swap out>> or ] change-stdout + [ swap in>> or ] change-stdin + run-detached + ] + [ [ out>> dispose ] [ in>> dispose ] bi* ] + [ [ in>> ] [ out>> ] bi* ] + } 2cleave r> + ] with-destructors ; : ( desc encoding -- stream ) - drop ; inline - -: with-process-stream ( desc quot -- status ) - swap >r - [ swap with-stream ] keep - r> wait-for-process ; inline + nip ; inline : notify-exit ( process status -- ) >>status @@ -168,9 +215,15 @@ HOOK: (process-stream) io-backend ( process -- handle in out ) GENERIC: underlying-handle ( stream -- handle ) -M: port underlying-handle port-handle ; +M: port underlying-handle handle>> ; M: duplex-stream underlying-handle - dup duplex-stream-in underlying-handle - swap duplex-stream-out underlying-handle tuck = - [ "Invalid duplex stream" throw ] when ; + [ in>> underlying-handle ] + [ out>> underlying-handle ] bi + [ = [ "Invalid duplex stream" throw ] when ] keep ; + +M: encoder underlying-handle + stream>> underlying-handle ; + +M: decoder underlying-handle + stream>> underlying-handle ; diff --git a/extra/io/mmap/mmap-docs.factor b/extra/io/mmap/mmap-docs.factor index cb51088e58..4ac85232b8 100755 --- a/extra/io/mmap/mmap-docs.factor +++ b/extra/io/mmap/mmap-docs.factor @@ -1,4 +1,5 @@ -USING: help.markup help.syntax alien math continuations ; +USING: help.markup help.syntax alien math continuations +destructors ; IN: io.mmap HELP: mapped-file @@ -15,6 +16,11 @@ HELP: { $notes "You must call " { $link close-mapped-file } " when you are finished working with the returned object, to reclaim resources. The " { $link with-mapped-file } " provides an abstraction which can close the mapped file for you." } { $errors "Throws an error if a memory mapping could not be established." } ; +HELP: with-mapped-file +{ $values { "path" "a pathname string" } { "length" integer } { "quot" "a quotation with stack effect " { $snippet "( mmap -- )" } } } +{ $contract "Opens a file and maps its contents into memory, passing the " { $link mapped-file } " instance to the quotation. The mapped file is disposed of when the quotation returns, or if an error is thrown." } +{ $errors "Throws an error if a memory mapping could not be established." } ; + HELP: close-mapped-file { $values { "mmap" mapped-file } } { $contract "Releases system resources associated with the mapped file. This word should not be called by user code; use " { $link dispose } " instead." } diff --git a/extra/io/mmap/mmap-tests.factor b/extra/io/mmap/mmap-tests.factor index a00f7cd92b..57faca01c7 100755 --- a/extra/io/mmap/mmap-tests.factor +++ b/extra/io/mmap/mmap-tests.factor @@ -2,9 +2,9 @@ USING: io io.mmap io.files kernel tools.test continuations sequences io.encodings.ascii accessors ; IN: io.mmap.tests -[ "mmap-test-file.txt" resource-path delete-file ] ignore-errors -[ ] [ "12345" "mmap-test-file.txt" resource-path ascii set-file-contents ] unit-test -[ ] [ "mmap-test-file.txt" resource-path dup file-info size>> [ CHAR: 2 0 pick set-nth drop ] with-mapped-file ] unit-test -[ 5 ] [ "mmap-test-file.txt" resource-path dup file-info size>> [ length ] with-mapped-file ] unit-test -[ "22345" ] [ "mmap-test-file.txt" resource-path ascii file-contents ] unit-test -[ "mmap-test-file.txt" resource-path delete-file ] ignore-errors +[ "mmap-test-file.txt" temp-file delete-file ] ignore-errors +[ ] [ "12345" "mmap-test-file.txt" temp-file ascii set-file-contents ] unit-test +[ ] [ "mmap-test-file.txt" temp-file dup file-info size>> [ CHAR: 2 0 pick set-nth drop ] with-mapped-file ] unit-test +[ 5 ] [ "mmap-test-file.txt" temp-file dup file-info size>> [ length ] with-mapped-file ] unit-test +[ "22345" ] [ "mmap-test-file.txt" temp-file ascii file-contents ] unit-test +[ "mmap-test-file.txt" temp-file delete-file ] ignore-errors diff --git a/extra/io/mmap/mmap.factor b/extra/io/mmap/mmap.factor index 59246115cf..dde5210995 100755 --- a/extra/io/mmap/mmap.factor +++ b/extra/io/mmap/mmap.factor @@ -1,34 +1,31 @@ ! Copyright (C) 2007, 2008 Doug Coleman, Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: continuations io.backend kernel quotations sequences -system alien alien.accessors sequences.private ; +USING: continuations destructors io.backend kernel quotations +sequences system alien alien.accessors accessors +sequences.private ; IN: io.mmap -TUPLE: mapped-file length address handle closed? ; +TUPLE: mapped-file address handle length disposed ; -: check-closed ( mapped-file -- mapped-file ) - dup mapped-file-closed? [ - "Mapped file is closed" throw - ] when ; inline - -M: mapped-file length check-closed mapped-file-length ; +M: mapped-file length dup check-disposed length>> ; M: mapped-file nth-unsafe - check-closed mapped-file-address swap alien-unsigned-1 ; + dup check-disposed address>> swap alien-unsigned-1 ; M: mapped-file set-nth-unsafe - check-closed mapped-file-address swap set-alien-unsigned-1 ; + dup check-disposed address>> swap set-alien-unsigned-1 ; INSTANCE: mapped-file sequence -HOOK: io-backend ( path length -- mmap ) +HOOK: (mapped-file) io-backend ( path length -- address handle ) + +: ( path length -- mmap ) + [ >r normalize-path r> (mapped-file) ] keep + f mapped-file boa ; HOOK: close-mapped-file io-backend ( mmap -- ) -M: mapped-file dispose ( mmap -- ) - check-closed - t over set-mapped-file-closed? - close-mapped-file ; +M: mapped-file dispose* ( mmap -- ) close-mapped-file ; : with-mapped-file ( path length quot -- ) >r r> with-disposal ; inline diff --git a/extra/io/monitors/monitors-docs.factor b/extra/io/monitors/monitors-docs.factor index cd6a06a8e9..b81bd1d303 100755 --- a/extra/io/monitors/monitors-docs.factor +++ b/extra/io/monitors/monitors-docs.factor @@ -1,5 +1,5 @@ IN: io.monitors -USING: help.markup help.syntax continuations +USING: help.markup help.syntax continuations destructors concurrency.mailboxes quotations ; HELP: with-monitors diff --git a/extra/io/monitors/monitors-tests.factor b/extra/io/monitors/monitors-tests.factor old mode 100644 new mode 100755 index 77d539259e..bd33954436 --- a/extra/io/monitors/monitors-tests.factor +++ b/extra/io/monitors/monitors-tests.factor @@ -1,7 +1,7 @@ IN: io.monitors.tests USING: io.monitors tools.test io.files system sequences continuations namespaces concurrency.count-downs kernel io -threads calendar prettyprint ; +threads calendar prettyprint destructors io.timeouts ; os { winnt linux macosx } member? [ [ @@ -89,5 +89,23 @@ os { winnt linux macosx } member? [ ] with-monitors ! Out-of-scope disposal should not fail - [ "" resource-path t ] with-monitors dispose + [ ] [ [ "" resource-path f ] with-monitors dispose ] unit-test + [ ] [ [ "" resource-path t ] with-monitors dispose ] unit-test + + ! Timeouts + [ + [ ] [ "monitor-timeout-test" temp-file make-directories ] unit-test + + ! Non-recursive + [ ] [ "monitor-timeout-test" temp-file f "m" set ] unit-test + [ ] [ 3 seconds "m" get set-timeout ] unit-test + [ [ t ] [ "m" get next-change 2drop ] [ ] while ] must-fail + [ ] [ "m" get dispose ] unit-test + + ! Recursive + [ ] [ "monitor-timeout-test" temp-file t "m" set ] unit-test + [ ] [ 3 seconds "m" get set-timeout ] unit-test + [ [ t ] [ "m" get next-change 2drop ] [ ] while ] must-fail + [ ] [ "m" get dispose ] unit-test + ] with-monitors ] when diff --git a/extra/io/monitors/monitors.factor b/extra/io/monitors/monitors.factor index 863c8fc95c..65c1eb7e82 100755 --- a/extra/io/monitors/monitors.factor +++ b/extra/io/monitors/monitors.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: io.backend kernel continuations namespaces sequences -assocs hashtables sorting arrays threads boxes io.timeouts -accessors concurrency.mailboxes ; +USING: io.backend kernel continuations destructors namespaces +sequences assocs hashtables sorting arrays threads boxes +io.timeouts accessors concurrency.mailboxes ; IN: io.monitors HOOK: init-monitors io-backend ( -- ) diff --git a/extra/io/monitors/recursive/recursive-tests.factor b/extra/io/monitors/recursive/recursive-tests.factor index 44baadf39a..fba879a6d2 100644 --- a/extra/io/monitors/recursive/recursive-tests.factor +++ b/extra/io/monitors/recursive/recursive-tests.factor @@ -1,7 +1,6 @@ USING: accessors math kernel namespaces continuations io.files io.monitors io.monitors.recursive io.backend -concurrency.mailboxes -tools.test ; +concurrency.mailboxes tools.test destructors ; IN: io.monitors.recursive.tests \ pump-thread must-infer diff --git a/extra/io/monitors/recursive/recursive.factor b/extra/io/monitors/recursive/recursive.factor index 04d491edbe..383e166214 100644 --- a/extra/io/monitors/recursive/recursive.factor +++ b/extra/io/monitors/recursive/recursive.factor @@ -1,13 +1,14 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors sequences assocs arrays continuations combinators kernel -threads concurrency.messaging concurrency.mailboxes concurrency.promises -io.files io.monitors debugger ; +USING: accessors sequences assocs arrays continuations +destructors combinators kernel threads concurrency.messaging +concurrency.mailboxes concurrency.promises io.files io.monitors +debugger ; IN: io.monitors.recursive ! Simulate recursive monitors on platforms that don't have them -TUPLE: recursive-monitor < monitor children thread ready ; +TUPLE: recursive-monitor < monitor children thread ready disposed ; : notify? ( -- ? ) monitor tget ready>> promise-fulfilled? ; @@ -35,13 +36,10 @@ DEFER: add-child-monitor : remove-child-monitor ( monitor -- ) monitor tget children>> delete-at* [ dispose ] [ drop ] if ; -M: recursive-monitor dispose - dup queue>> closed>> [ - drop - ] [ - [ "stop" swap thread>> send-synchronous drop ] - [ queue>> dispose ] bi - ] if ; +M: recursive-monitor dispose* + [ "stop" swap thread>> send-synchronous drop ] + [ queue>> dispose ] + bi ; : stop-pump ( -- ) monitor tget children>> [ nip dispose ] assoc-each ; diff --git a/extra/io/nonblocking/nonblocking.factor b/extra/io/nonblocking/nonblocking.factor deleted file mode 100755 index 0bf7a6ccec..0000000000 --- a/extra/io/nonblocking/nonblocking.factor +++ /dev/null @@ -1,171 +0,0 @@ -! Copyright (C) 2005, 2008 Slava Pestov, Doug Coleman -! See http://factorcode.org/license.txt for BSD license. -USING: math kernel io sequences io.buffers io.timeouts generic -byte-vectors system io.streams.duplex io.encodings -io.backend continuations debugger classes byte-arrays namespaces -splitting dlists assocs io.encodings.binary inspector accessors ; -IN: io.nonblocking - -SYMBOL: default-buffer-size -64 1024 * default-buffer-size set-global - -TUPLE: port handle buffer error timeout closed eof ; - -M: port timeout timeout>> ; - -M: port set-timeout (>>timeout) ; - -GENERIC: init-handle ( handle -- ) - -GENERIC: close-handle ( handle -- ) - -: ( handle class -- port ) - new - swap dup init-handle >>handle ; inline - -: ( handle class -- port ) - - default-buffer-size get >>buffer ; inline - -TUPLE: input-port < port ; - -: ( handle -- input-port ) - input-port ; - -TUPLE: output-port < port ; - -: ( handle -- output-port ) - output-port ; - -: ( read-handle write-handle -- input-port output-port ) - swap [ swap ] [ ] [ dispose drop ] cleanup ; - -: pending-error ( port -- ) - [ f ] change-error drop [ throw ] when* ; - -ERROR: port-closed-error port ; - -M: port-closed-error summary - drop "Port has been closed" ; - -: check-closed ( port -- port ) - dup closed>> [ port-closed-error ] when ; - -HOOK: cancel-io io-backend ( port -- ) - -M: object cancel-io drop ; - -M: port timed-out cancel-io ; - -GENERIC: (wait-to-read) ( port -- ) - -: wait-to-read ( count port -- ) - tuck buffer>> buffer-length > [ (wait-to-read) ] [ drop ] if ; - -: wait-to-read1 ( port -- ) - 1 swap wait-to-read ; - -: unless-eof ( port quot -- value ) - >r dup buffer>> buffer-empty? over eof>> and - [ f >>eof drop f ] r> if ; inline - -M: input-port stream-read1 - check-closed - dup wait-to-read1 [ buffer>> buffer-pop ] unless-eof ; - -: read-step ( count port -- byte-array/f ) - [ wait-to-read ] 2keep - [ dupd buffer>> buffer-read ] unless-eof nip ; - -: read-loop ( count port accum -- ) - pick over length - dup 0 > [ - pick read-step dup [ - over push-all read-loop - ] [ - 2drop 2drop - ] if - ] [ - 2drop 2drop - ] if ; - -M: input-port stream-read - check-closed - >r 0 max >fixnum r> - 2dup read-step dup [ - pick over length > [ - pick - [ push-all ] keep - [ read-loop ] keep - B{ } like - ] [ 2nip ] if - ] [ 2nip ] if ; - -M: input-port stream-read-partial ( max stream -- byte-array/f ) - check-closed - >r 0 max >fixnum r> read-step ; - -: can-write? ( len buffer -- ? ) - [ buffer-fill + ] keep buffer-capacity <= ; - -: wait-to-write ( len port -- ) - tuck buffer>> can-write? [ drop ] [ stream-flush ] if ; - -M: output-port stream-write1 - check-closed - 1 over wait-to-write - buffer>> byte>buffer ; - -M: output-port stream-write - check-closed - over length over buffer>> buffer-size > [ - [ buffer>> buffer-size ] - [ [ stream-write ] curry ] bi - each - ] [ - [ >r length r> wait-to-write ] - [ buffer>> >buffer ] 2bi - ] if ; - -GENERIC: port-flush ( port -- ) - -M: output-port stream-flush ( port -- ) - check-closed - [ port-flush ] [ pending-error ] bi ; - -GENERIC: close-port ( port -- ) - -M: output-port close-port - [ port-flush ] [ call-next-method ] bi ; - -M: port close-port - dup cancel-io - dup handle>> close-handle - [ [ buffer-free ] when* f ] change-buffer drop ; - -M: port dispose - dup closed>> [ drop ] [ t >>closed close-port ] if ; - -TUPLE: server-port < port addr client client-addr encoding ; - -: ( handle addr encoding -- server ) - rot server-port - swap >>encoding - swap >>addr ; - -: check-server-port ( port -- port ) - dup server-port? [ "Not a server port" throw ] unless ; inline - -TUPLE: datagram-port < port addr packet packet-addr ; - -: ( handle addr -- datagram ) - swap datagram-port - swap >>addr ; - -: check-datagram-port ( port -- port ) - check-closed - dup datagram-port? [ "Not a datagram port" throw ] unless ; inline - -: check-datagram-send ( packet addrspec port -- packet addrspec port ) - check-datagram-port - 2dup addr>> [ class ] bi@ assert= - pick class byte-array assert= ; diff --git a/extra/io/pipes/pipes-docs.factor b/extra/io/pipes/pipes-docs.factor new file mode 100644 index 0000000000..221cce1dbe --- /dev/null +++ b/extra/io/pipes/pipes-docs.factor @@ -0,0 +1,47 @@ +USING: help.markup help.syntax continuations destructors io ; +IN: io.pipes + +HELP: pipe +{ $class-description "A low-level pipe. Instances are created by calling " { $link (pipe) } " and closed by calling " { $link dispose } "." } ; + +HELP: (pipe) +{ $values { "pipe" pipe } } +{ $description "Opens a new pipe. This is a low-level word; the " { $link } " and " { $link run-pipeline } " words can be used in most cases instead." } ; + +HELP: +{ $values { "encoding" "an encoding specifier" } { "stream" "a bidirectional stream" } } +{ $description "Opens a new pipe and wraps it in a stream. Data written from the stream can be read back from the same stream instance." } +{ $notes "Pipe streams must be disposed by calling " { $link dispose } " or " { $link with-disposal } " to avoid resource leaks." } ; + +HELP: run-pipeline +{ $values { "seq" "a sequence of pipeline components" } { "results" "a sequence of pipeline results" } } +{ $description + "Creates a pipe between each pipeline component, with the output of each component becoming the input of the next." + $nl + "The first component reads input from " { $link input-stream } " and the last component writes output to " { $link output-stream } "." + $nl + "Each component runs in its own thread, and the word returns when all components finish executing. Each component outputs a result value." + $nl + "Pipeline components must be one of the following:" + { $list + { "A quotation. The quotation is called with both " { $link input-stream } " and " { $link output-stream } " rebound, except for the first and last pipeline components, and it must output a single value." } + { "A process launch descriptor. See " { $link "io.launcher.descriptors" } "." } + } +} +{ $examples + "Print the lines of a log file which contain the string ``error'', sort them and filter out duplicates, using Unix shell commands only:" + { $code "{ \"cat log.txt\" \"grep error\" \"sort\" \"uniq\" } run-pipeline" } +} ; + +ARTICLE: "io.pipes" "Pipes" +"A " { $emphasis "pipe" } " is a unidirectional channel for transfer of bytes. Data written to one end of the pipe can be read from the other. Pipes can be used to pass data between processes; they can also be used within a single process to implement communication between coroutines." +$nl +"Low-level pipes:" +{ $subsection pipe } +{ $subsection (pipe) } +"High-level pipe streams:" +{ $subsection } +"Pipelines of coroutines and processes:" +{ $subsection run-pipeline } ; + +ABOUT: "io.pipes" diff --git a/extra/io/pipes/pipes-tests.factor b/extra/io/pipes/pipes-tests.factor new file mode 100755 index 0000000000..5ece6cfdf3 --- /dev/null +++ b/extra/io/pipes/pipes-tests.factor @@ -0,0 +1,44 @@ +USING: io io.pipes io.streams.string io.encodings.utf8 +io.streams.duplex io.encodings io.timeouts namespaces +continuations tools.test kernel calendar destructors +accessors debugger math ; +IN: io.pipes.tests + +[ "Hello" ] [ + utf8 [ + "Hello" print flush + readln + ] with-stream +] unit-test + +[ { } ] [ { } run-pipeline ] unit-test +[ { f } ] [ { [ f ] } run-pipeline ] unit-test +[ { "Hello" } ] [ + "Hello" [ + { [ input-stream [ utf8 ] change readln ] } run-pipeline + ] with-string-reader +] unit-test + +[ { f "Hello" } ] [ + { + [ output-stream [ utf8 ] change "Hello" print flush f ] + [ input-stream [ utf8 ] change readln ] + } run-pipeline +] unit-test + +[ + utf8 [ + 5 seconds over set-timeout + stream-readln + ] with-disposal +] must-fail + +[ ] [ + 1000 [ + utf8 [ + [ in>> dispose ] + [ out>> "hi" over stream-write dispose ] + bi + ] curry ignore-errors + ] times +] unit-test diff --git a/extra/io/pipes/pipes.factor b/extra/io/pipes/pipes.factor new file mode 100644 index 0000000000..b519752e79 --- /dev/null +++ b/extra/io/pipes/pipes.factor @@ -0,0 +1,53 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: io.encodings io.backend io.ports io.streams.duplex +io splitting grouping sequences sequences.lib namespaces kernel +destructors math concurrency.combinators accessors +arrays continuations quotations ; +IN: io.pipes + +TUPLE: pipe in out ; + +M: pipe dispose ( pipe -- ) + [ in>> dispose ] [ out>> dispose ] bi ; + +HOOK: (pipe) io-backend ( -- pipe ) + +: ( encoding -- stream ) + [ + >r (pipe) |dispose + [ in>> ] [ out>> ] bi + r> + ] with-destructors ; + + &dispose ] [ input-stream get ] if* ; + +: ?writer ( handle/f -- stream ) + [ &dispose ] [ output-stream get ] if* ; + +GENERIC: run-pipeline-element ( input-fd output-fd obj -- quot ) + +M: callable run-pipeline-element + [ + >r [ ?reader ] [ ?writer ] bi* + r> with-streams* + ] with-destructors ; + +: ( n -- pipes ) + [ + [ (pipe) |dispose ] replicate + T{ pipe } [ prefix ] [ suffix ] bi + 2 + ] with-destructors ; + +PRIVATE> + +: run-pipeline ( seq -- results ) + [ length dup zero? [ drop { } ] [ 1- ] if ] keep + [ + >r [ first in>> ] [ second out>> ] bi + r> run-pipeline-element + ] 2parallel-map ; diff --git a/extra/io/sockets/impl/authors.txt b/extra/io/pools/authors.txt old mode 100755 new mode 100644 similarity index 100% rename from extra/io/sockets/impl/authors.txt rename to extra/io/pools/authors.txt diff --git a/extra/io/pools/pools-docs.factor b/extra/io/pools/pools-docs.factor new file mode 100644 index 0000000000..aae1698349 --- /dev/null +++ b/extra/io/pools/pools-docs.factor @@ -0,0 +1,61 @@ +IN: io.pools +USING: help.markup help.syntax destructors quotations ; + +HELP: pool +{ $class-description "A connection pool. Instances of this class are not intended to be instantiated directly, only subclasses should be instantiated, for example " { $link datagram-pool } "." } ; + +HELP: +{ $values { "class" "a subclass of " { $link pool } } { "pool" pool } } +{ $description "Creates a new connection pool." } +{ $notes "To avoid resource leaks, pools must be disposed of by calling " { $link dispose } " when no longer in use." } ; + +HELP: with-pool +{ $values { "pool" pool } { "quot" quotation } } +{ $description "Calls a quotation in a new dynamic scope with the " { $link pool } " variable set to " { $snippet "pool" } ". The pool is disposed of after the quotation returns, or if an error is thrown." } ; + +HELP: acquire-connection +{ $values { "pool" pool } { "conn" "a connection" } } +{ $description "Outputs a connection from the pool, preferring to take an existing one, creating a new one with " { $link make-connection } " if the pool is empty." } ; + +HELP: return-connection +{ $values { "conn" "a connection" } { "pool" pool } } +{ $description "Returns a connection to the pool." } ; + +HELP: with-pooled-connection +{ $values { "pool" pool } { "quot" "a quotation with stack effect " { $snippet "( conn -- )" } } } +{ $description "Calls a quotation with a pooled connection on the stack. If the quotation returns successfully, the connection is returned to the pool; if the quotation throws an error, the connection is disposed of with " { $link dispose } "." } ; + +HELP: make-connection +{ $values { "pool" pool } { "conn" "a connection" } } +{ $contract "Makes a connection for the pool." } ; + +HELP: datagram-pool +{ $class-description "A pool of datagram sockets bound to the address stored in the " { $snippet "addrspec" } " slot." } ; + +HELP: +{ $values { "addrspec" "an address specifier" } { "pool" datagram-pool } } +{ $description "Creates a new " { $link datagram-pool } ". The port number of the " { $snippet "addrspec" } " should be 0, otherwise creation of more than one datagram socket will raise an error." } +{ $examples + { $code "f 0 " } +} ; + +ARTICLE: "io.pools" "Connection pools" +"Connection pools are implemented in the " { $snippet "io.pools" } " vocabulary. They are used to reuse sockets and connections which may be potentially expensive to create and destroy." +$nl +"The class of connection pools:" +{ $subsection pool } +"Creating connection pools:" +{ $subsection } +"A utility combinator:" +{ $subsection with-pool } +"Acquiring and returning connections, and a utility combinator:" +{ $subsection acquire-connection } +{ $subsection return-connection } +{ $subsection with-pooled-connection } +"Pools are not created directly, instead one uses subclasses which implement a generic word:" +{ $subsection make-connection } +"One example is a datagram socket pool:" +{ $subsection datagram-pool } +{ $subsection } ; + +ABOUT: "io.pools" diff --git a/extra/io/pools/pools.factor b/extra/io/pools/pools.factor new file mode 100644 index 0000000000..033ba3cbfb --- /dev/null +++ b/extra/io/pools/pools.factor @@ -0,0 +1,58 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors kernel arrays namespaces sequences continuations +destructors io.sockets alien alien.syntax ; +IN: io.pools + +TUPLE: pool connections disposed expired ; + +: check-pool ( pool -- ) + dup check-disposed + dup expired>> expired? [ + ALIEN: 31337 >>expired + connections>> [ delete-all ] [ dispose-each ] bi + ] [ drop ] if ; + +: ( class -- pool ) + new V{ } clone + >>connections + dup check-pool ; inline + +M: pool dispose* connections>> dispose-each ; + +: with-pool ( pool quot -- ) + [ pool swap with-variable ] curry with-disposal ; inline + +TUPLE: return-connection conn pool ; + +: return-connection ( conn pool -- ) + dup check-pool connections>> push ; + +GENERIC: make-connection ( pool -- conn ) + +: new-connection ( pool -- ) + dup check-pool [ make-connection ] keep return-connection ; + +: acquire-connection ( pool -- conn ) + [ dup connections>> empty? ] [ dup new-connection ] [ ] while + connections>> pop ; + +: (with-pooled-connection) ( conn pool quot -- ) + [ nip call ] [ drop return-connection ] 3bi ; inline + +: with-pooled-connection ( pool quot -- ) + >r [ acquire-connection ] keep r> + [ (with-pooled-connection) ] [ ] [ 2drop dispose ] cleanup ; inline + +M: return-connection dispose + [ conn>> ] [ pool>> ] bi return-connection ; + +: return-connection-later ( db pool -- ) + \ return-connection boa &dispose drop ; + +TUPLE: datagram-pool < pool addrspec ; + +: ( addrspec -- pool ) + datagram-pool swap >>addrspec ; + +M: datagram-pool make-connection addrspec>> ; diff --git a/extra/io/pools/summary.txt b/extra/io/pools/summary.txt new file mode 100644 index 0000000000..b1f528b6aa --- /dev/null +++ b/extra/io/pools/summary.txt @@ -0,0 +1 @@ +Abstract connection pooling diff --git a/extra/io/pools/tags.txt b/extra/io/pools/tags.txt new file mode 100644 index 0000000000..992ae12982 --- /dev/null +++ b/extra/io/pools/tags.txt @@ -0,0 +1 @@ +network diff --git a/extra/levenshtein/authors.txt b/extra/io/ports/authors.txt similarity index 100% rename from extra/levenshtein/authors.txt rename to extra/io/ports/authors.txt diff --git a/extra/io/nonblocking/nonblocking-docs.factor b/extra/io/ports/ports-docs.factor similarity index 57% rename from extra/io/nonblocking/nonblocking-docs.factor rename to extra/io/ports/ports-docs.factor index bd2be34c9d..7420cac115 100755 --- a/extra/io/nonblocking/nonblocking-docs.factor +++ b/extra/io/ports/ports-docs.factor @@ -1,9 +1,10 @@ USING: io io.buffers io.backend help.markup help.syntax kernel -byte-arrays sbufs words continuations byte-vectors classes ; -IN: io.nonblocking +byte-arrays sbufs words continuations destructors +byte-vectors classes ; +IN: io.ports -ARTICLE: "io.nonblocking" "Non-blocking I/O implementation" -"On Windows and Unix, Factor implements blocking file and network streams on top of a non-blocking I/O substrate, ensuring that Factor threads will yield when performing I/O. This substrate is implemented in the " { $vocab-link "io.nonblocking" } " vocabulary." +ARTICLE: "io.ports" "Non-blocking I/O implementation" +"On Windows and Unix, Factor implements blocking file and network streams on top of a non-blocking I/O substrate, ensuring that Factor threads will yield when performing I/O. This substrate is implemented in the " { $vocab-link "io.ports" } " vocabulary." $nl "A " { $emphasis "port" } " is a stream using non-blocking I/O substrate:" { $subsection port } @@ -11,36 +12,24 @@ $nl { $subsection } "Input ports:" { $subsection input-port } -{ $subsection } +{ $subsection } "Output ports:" { $subsection output-port } -{ $subsection } +{ $subsection } "Global native I/O protocol:" { $subsection io-backend } { $subsection init-io } { $subsection init-stdio } { $subsection io-multiplex } "Per-port native I/O protocol:" -{ $subsection init-handle } { $subsection (wait-to-read) } -"Additionally, the I/O backend must provide an implementation of the " { $link stream-flush } " and " { $link dispose } " generic words." -$nl -"Dummy ports which should be used to implement networking:" -{ $subsection server-port } -{ $subsection datagram-port } ; +{ $subsection (wait-to-write) } +"Additionally, the I/O backend must provide an implementation of the " { $link dispose } " generic word." ; -ABOUT: "io.nonblocking" +ABOUT: "io.ports" HELP: port -{ $class-description "Instances of this class present a blocking stream interface on top of an underlying non-blocking I/O system, giving the illusion of blocking by yielding the thread which is waiting for input or output." -$nl -"Ports have the following slots:" -{ $list - { { $snippet "handle" } " - a native handle identifying the underlying native resource used by the port" } - { { $snippet "error" } " - the most recent I/O error, if any. This error is thrown to the waiting thread when " { $link pending-error } " is called by stream operations" } - { { $snippet "type" } " - a symbol identifying the port's intended purpose" } - { { $snippet "eof" } " - a flag indicating if the port has reached the end of file while reading" } -} } ; +{ $class-description "Instances of this class present a blocking stream interface on top of an underlying non-blocking I/O system, giving the illusion of blocking by yielding the thread which is waiting for input or output." } ; HELP: input-port { $class-description "The class of ports implementing the input stream protocol." } ; @@ -48,10 +37,6 @@ HELP: input-port HELP: output-port { $class-description "The class of ports implementing the output stream protocol." } ; -HELP: init-handle -{ $values { "handle" "a native handle identifying an I/O resource" } } -{ $contract "Prepares a native handle for use by the port; called by " { $link } "." } ; - HELP: { $values { "handle" "a native handle identifying an I/O resource" } { "class" class } { "port" "a new " { $link port } } } { $description "Creates a new " { $link port } " with no buffer." } @@ -62,35 +47,23 @@ HELP: { $description "Creates a new " { $link port } " using the specified native handle and a default-sized I/O buffer." } $low-level-note ; -HELP: +HELP: { $values { "handle" "a native handle identifying an I/O resource" } { "input-port" "a new " { $link input-port } } } { $description "Creates a new " { $link input-port } " using the specified native handle and a default-sized input buffer." } $low-level-note ; -HELP: +HELP: { $values { "handle" "a native handle identifying an I/O resource" } { "output-port" "a new " { $link output-port } } } { $description "Creates a new " { $link output-port } " using the specified native handle and a default-sized input buffer." } $low-level-note ; -HELP: pending-error -{ $values { "port" port } } -{ $description "If an error occurred while the I/O thread was performing input or output on this port, this error will be thrown to the caller." } ; - HELP: (wait-to-read) { $values { "port" input-port } } { $contract "Suspends the current thread until the port's buffer has data available for reading." } ; HELP: wait-to-read -{ $values { "count" "a non-negative integer" } { "port" input-port } } -{ $description "If the port's buffer has at least " { $snippet "count" } " unread bytes, returns immediately, otherwise suspends the current thread until some data is available for reading." } ; - -HELP: wait-to-read1 -{ $values { "port" input-port } } -{ $description "If the port's buffer has unread data, returns immediately, otherwise suspends the current thread until some data is available for reading." } ; - -HELP: unless-eof -{ $values { "port" input-port } { "quot" "a quotation with stack effect " { $snippet "( port -- value )" } } { "value" object } } -{ $description "If the port has reached end of file, outputs " { $link f } ", otherwise applies the quotation to the port." } ; +{ $values { "port" input-port } { "eof?" "a boolean" } } +{ $description "If the port's buffer has unread data, returns immediately, otherwise suspends the current thread until some data is available for reading. If the buffer was empty and no more data could be read, outputs " { $link t } " to indicate end-of-file; otherwise outputs " { $link f } "." } ; HELP: can-write? { $values { "len" "a positive integer" } { "buffer" buffer } { "?" "a boolean" } } diff --git a/extra/io/ports/ports.factor b/extra/io/ports/ports.factor new file mode 100755 index 0000000000..1cbbac7f20 --- /dev/null +++ b/extra/io/ports/ports.factor @@ -0,0 +1,134 @@ +! Copyright (C) 2005, 2008 Slava Pestov, Doug Coleman +! See http://factorcode.org/license.txt for BSD license. +USING: math kernel io sequences io.buffers io.timeouts generic +byte-vectors system io.encodings math.order io.backend +continuations debugger classes byte-arrays namespaces splitting +grouping dlists assocs io.encodings.binary inspector accessors +destructors ; +IN: io.ports + +SYMBOL: default-buffer-size +64 1024 * default-buffer-size set-global + +TUPLE: port handle timeout disposed ; + +M: port timeout timeout>> ; + +M: port set-timeout (>>timeout) ; + +: ( handle class -- port ) + new swap >>handle ; inline + +TUPLE: buffered-port < port buffer ; + +: ( handle class -- port ) + + default-buffer-size get >>buffer ; inline + +TUPLE: input-port < buffered-port ; + +: ( handle -- input-port ) + input-port ; + +HOOK: (wait-to-read) io-backend ( port -- ) + +: wait-to-read ( port -- eof? ) + dup buffer>> buffer-empty? [ + dup (wait-to-read) buffer>> buffer-empty? + ] [ drop f ] if ; + +M: input-port stream-read1 + dup check-disposed + dup wait-to-read [ drop f ] [ buffer>> buffer-pop ] if ; + +: read-step ( count port -- byte-array/f ) + dup wait-to-read [ 2drop f ] [ buffer>> buffer-read ] if ; + +M: input-port stream-read-partial ( max stream -- byte-array/f ) + dup check-disposed + >r 0 max >integer r> read-step ; + +: read-loop ( count port accum -- ) + pick over length - dup 0 > [ + pick read-step dup [ + over push-all read-loop + ] [ + 2drop 2drop + ] if + ] [ + 2drop 2drop + ] if ; + +M: input-port stream-read + dup check-disposed + >r 0 max >fixnum r> + 2dup read-step dup [ + pick over length > [ + pick + [ push-all ] keep + [ read-loop ] keep + B{ } like + ] [ 2nip ] if + ] [ 2nip ] if ; + +TUPLE: output-port < buffered-port ; + +: ( handle -- output-port ) + output-port ; + +: can-write? ( len buffer -- ? ) + [ buffer-fill + ] keep buffer-capacity <= ; + +: wait-to-write ( len port -- ) + tuck buffer>> can-write? [ drop ] [ stream-flush ] if ; + +M: output-port stream-write1 + dup check-disposed + 1 over wait-to-write + buffer>> byte>buffer ; + +M: output-port stream-write + dup check-disposed + over length over buffer>> buffer-size > [ + [ buffer>> buffer-size ] + [ [ stream-write ] curry ] bi + each + ] [ + [ >r length r> wait-to-write ] + [ buffer>> >buffer ] 2bi + ] if ; + +HOOK: (wait-to-write) io-backend ( port -- ) + +GENERIC: shutdown ( handle -- ) + +M: object shutdown drop ; + +: port-flush ( port -- ) + dup buffer>> buffer-empty? + [ drop ] [ dup (wait-to-write) port-flush ] if ; + +M: output-port stream-flush ( port -- ) + [ check-disposed ] [ port-flush ] bi ; + +M: output-port dispose* + [ + [ handle>> &dispose drop ] + [ port-flush ] + [ handle>> shutdown ] + tri + ] with-destructors ; + +M: buffered-port dispose* + [ call-next-method ] + [ [ [ buffer-free ] when* f ] change-buffer drop ] + bi ; + +M: port cancel-operation handle>> cancel-operation ; + +M: port dispose* + [ + [ handle>> &dispose drop ] + [ handle>> shutdown ] + bi + ] with-destructors ; diff --git a/extra/io/nonblocking/summary.txt b/extra/io/ports/summary.txt similarity index 100% rename from extra/io/nonblocking/summary.txt rename to extra/io/ports/summary.txt diff --git a/extra/io/server/server-docs.factor b/extra/io/server/server-docs.factor index 7eda48f747..50f38cb146 100755 --- a/extra/io/server/server-docs.factor +++ b/extra/io/server/server-docs.factor @@ -3,8 +3,8 @@ IN: io.server HELP: with-server { $values { "seq" "a sequence of address specifiers" } { "service" "a string or " { $link f } } { "encoding" "an encoding to use for client connections" } { "quot" "a quotation" } } -{ $description "Starts a TCP/IP server. The quotation is called in a new thread for each client connection, with the client connection being the " { $link stdio } " stream. Client connections are logged to the " { $link stdio } " stream at the time the server was started." } ; +{ $description "Starts a TCP/IP server. The quotation is called in a new thread for each client connection, with the client connection being both the " { $link input-stream } " and " { $link output-stream } "." } ; HELP: with-datagrams { $values { "seq" "a sequence of address specifiers" } { "service" "a string or " { $link f } } { "quot" "a quotation" } } -{ $description "Starts a UDP/IP server. The quotation is called for each datagram packet received. Datagram packets are logged to the " { $link stdio } " stream at the time the server was started." } ; +{ $description "Starts a UDP/IP server. The quotation is called for each datagram packet received." } ; diff --git a/extra/io/server/server-tests.factor b/extra/io/server/server-tests.factor index e1297a9839..86cfe35bc1 100755 --- a/extra/io/server/server-tests.factor +++ b/extra/io/server/server-tests.factor @@ -1,4 +1,7 @@ IN: io.server.tests -USING: tools.test io.server io.server.private ; +USING: tools.test io.server io.server.private kernel ; { 2 0 } [ [ ] server-loop ] must-infer-as +{ 2 0 } [ [ ] with-connection ] must-infer-as +{ 1 0 } [ [ ] swap datagram-loop ] must-infer-as +{ 2 0 } [ [ ] with-datagrams ] must-infer-as diff --git a/extra/io/server/server.factor b/extra/io/server/server.factor index 1d5ed16dc5..359b9c6fb4 100755 --- a/extra/io/server/server.factor +++ b/extra/io/server/server.factor @@ -1,33 +1,36 @@ ! Copyright (C) 2003, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: io io.sockets io.files logging continuations kernel -math math.parser namespaces parser sequences strings -prettyprint debugger quotations calendar -threads concurrency.combinators assocs ; +USING: io io.sockets io.sockets.secure io.files +io.streams.duplex logging continuations destructors kernel math +math.parser namespaces parser sequences strings prettyprint +debugger quotations calendar threads concurrency.combinators +assocs fry ; IN: io.server SYMBOL: servers +SYMBOL: remote-address + r accept r> [ with-client ] 3curry "Client" spawn drop + >r accept r> '[ , , , with-connection ] "Client" spawn drop ] 2keep accept-loop ; inline : server-loop ( addrspec encoding quot -- ) >r dup servers get push r> - [ accept-loop ] curry with-disposal ; inline + '[ , accept-loop ] with-disposal ; inline \ server-loop NOTICE add-error-logging @@ -39,15 +42,16 @@ PRIVATE> : internet-server ( port -- seq ) f swap t resolve-host ; +: secure-server ( port -- seq ) + internet-server [ ] map ; + : with-server ( seq service encoding quot -- ) V{ } clone servers [ - [ - [ server-loop ] 2curry with-logging - ] 3curry parallel-each + '[ , [ , , server-loop ] with-logging ] parallel-each ] with-variable ; inline : stop-server ( -- ) - servers get [ dispose ] each ; + servers get dispose-each ; r swap call r> ] keep - pick [ send ] [ 3drop ] keep + pick [ send ] [ 3drop ] if ] 2keep datagram-loop ; inline : spawn-datagrams ( quot addrspec -- ) @@ -67,6 +71,4 @@ LOG: received-datagram NOTICE PRIVATE> : with-datagrams ( seq service quot -- ) - [ - [ swap spawn-datagrams ] curry parallel-each - ] curry with-logging ; inline + '[ [ , _ spawn-datagrams ] parallel-each ] with-logging ; inline diff --git a/extra/io/server/tags.txt b/extra/io/server/tags.txt new file mode 100644 index 0000000000..992ae12982 --- /dev/null +++ b/extra/io/server/tags.txt @@ -0,0 +1 @@ +network diff --git a/extra/io/sockets/headers/headers.factor b/extra/io/sockets/headers/headers.factor index 2547fee5ae..7ae9265220 100755 --- a/extra/io/sockets/headers/headers.factor +++ b/extra/io/sockets/headers/headers.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: alien alien.c-types alien.syntax byte-arrays io -io.sockets.impl kernel structs math math.parser +io.sockets kernel structs math math.parser prettyprint sequences ; IN: io.sockets.headers diff --git a/extra/io/sockets/impl/impl-tests.factor b/extra/io/sockets/impl/impl-tests.factor deleted file mode 100644 index 6b930a994e..0000000000 --- a/extra/io/sockets/impl/impl-tests.factor +++ /dev/null @@ -1,45 +0,0 @@ -USING: io.sockets.impl io.sockets kernel tools.test ; -IN: io.sockets.impl.tests - -[ B{ 1 2 3 4 } ] -[ "1.2.3.4" T{ inet4 } inet-pton ] unit-test - -[ "1.2.3.4" ] -[ B{ 1 2 3 4 } T{ inet4 } inet-ntop ] unit-test - -[ "255.255.255.255" ] -[ B{ 255 255 255 255 } T{ inet4 } inet-ntop ] unit-test - -[ B{ 255 255 255 255 } ] -[ "255.255.255.255" T{ inet4 } inet-pton ] unit-test - -[ B{ 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 } ] -[ "1:2:3:4:5:6:7:8" T{ inet6 } inet-pton ] unit-test - -[ "1:2:3:4:5:6:7:8" ] -[ B{ 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 } T{ inet6 } inet-ntop ] unit-test - -[ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } ] -[ "::" T{ inet6 } inet-pton ] unit-test - -[ "0:0:0:0:0:0:0:0" ] -[ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } T{ inet6 } inet-ntop ] unit-test - -[ B{ 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } ] -[ "1::" T{ inet6 } inet-pton ] unit-test - -[ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } ] -[ "::1" T{ inet6 } inet-pton ] unit-test - -[ B{ 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 } ] -[ "1::2" T{ inet6 } inet-pton ] unit-test - -[ B{ 0 1 0 0 0 0 0 0 0 0 0 0 0 2 0 3 } ] -[ "1::2:3" T{ inet6 } inet-pton ] unit-test - -[ B{ 0 1 0 2 0 0 0 0 0 0 0 0 0 3 0 4 } ] -[ "1:2::3:4" T{ inet6 } inet-pton ] unit-test - -[ "1:2:0:0:0:0:3:4" ] -[ B{ 0 1 0 2 0 0 0 0 0 0 0 0 0 3 0 4 } T{ inet6 } inet-ntop ] unit-test - diff --git a/extra/io/sockets/impl/impl.factor b/extra/io/sockets/impl/impl.factor deleted file mode 100755 index 2a376e18c2..0000000000 --- a/extra/io/sockets/impl/impl.factor +++ /dev/null @@ -1,134 +0,0 @@ -! Copyright (C) 2007, 2008 Doug Coleman, Slava Pestov -! See http://factorcode.org/license.txt for BSD license. -USING: arrays byte-arrays io.backend io.binary io.sockets -io.encodings.ascii kernel math math.parser sequences splitting -system alien.c-types alien.strings alien combinators namespaces -parser ; -IN: io.sockets.impl - -<< { - { [ os windows? ] [ "windows.winsock" ] } - { [ os unix? ] [ "unix" ] } -} cond use+ >> - -GENERIC: protocol-family ( addrspec -- af ) - -GENERIC: sockaddr-type ( addrspec -- type ) - -GENERIC: make-sockaddr ( addrspec -- sockaddr ) - -: make-sockaddr/size ( addrspec -- sockaddr size ) - dup make-sockaddr swap sockaddr-type heap-size ; - -GENERIC: parse-sockaddr ( sockaddr addrspec -- newaddrspec ) - -HOOK: addrinfo-error io-backend ( n -- ) - -! IPV4 and IPV6 -GENERIC: address-size ( addrspec -- n ) - -GENERIC: inet-ntop ( data addrspec -- str ) - -GENERIC: inet-pton ( str addrspec -- data ) - - -M: inet4 inet-ntop ( data addrspec -- str ) - drop 4 memory>byte-array [ number>string ] { } map-as "." join ; - -M: inet4 inet-pton ( str addrspec -- data ) - drop "." split [ string>number ] B{ } map-as ; - -M: inet4 address-size drop 4 ; - -M: inet4 protocol-family drop PF_INET ; - -M: inet4 sockaddr-type drop "sockaddr-in" c-type ; - -M: inet4 make-sockaddr ( inet -- sockaddr ) - "sockaddr-in" - AF_INET over set-sockaddr-in-family - over inet4-port htons over set-sockaddr-in-port - over inet4-host - "0.0.0.0" or - rot inet-pton *uint over set-sockaddr-in-addr ; - -SYMBOL: port-override - -: (port) port-override get swap or ; - -M: inet4 parse-sockaddr - >r dup sockaddr-in-addr r> inet-ntop - swap sockaddr-in-port ntohs (port) ; - -M: inet6 inet-ntop ( data addrspec -- str ) - drop 16 memory>byte-array 2 [ be> >hex ] map ":" join ; - -M: inet6 inet-pton ( str addrspec -- data ) - drop "::" split1 - [ [ ":" split [ hex> dup 0 ? ] map ] [ f ] if* ] bi@ - 2dup [ length ] bi@ + 8 swap - 0 swap 3append - [ 2 >be ] map concat >byte-array ; - -M: inet6 address-size drop 16 ; - -M: inet6 protocol-family drop PF_INET6 ; - -M: inet6 sockaddr-type drop "sockaddr-in6" c-type ; - -M: inet6 make-sockaddr ( inet -- sockaddr ) - "sockaddr-in6" - AF_INET6 over set-sockaddr-in6-family - over inet6-port htons over set-sockaddr-in6-port - over inet6-host "::" or - rot inet-pton over set-sockaddr-in6-addr ; - -M: inet6 parse-sockaddr - >r dup sockaddr-in6-addr r> inet-ntop - swap sockaddr-in6-port ntohs (port) ; - -: addrspec-of-family ( af -- addrspec ) - { - { [ dup AF_INET = ] [ T{ inet4 } ] } - { [ dup AF_INET6 = ] [ T{ inet6 } ] } - { [ dup AF_UNIX = ] [ T{ local } ] } - [ f ] - } cond nip ; - -M: f parse-sockaddr nip ; - -: addrinfo>addrspec ( addrinfo -- addrspec ) - [ addrinfo-addr ] [ addrinfo-family addrspec-of-family ] bi - parse-sockaddr ; - -: parse-addrinfo-list ( addrinfo -- seq ) - [ addrinfo-next ] follow - [ addrinfo>addrspec ] map - [ ] subset ; - -: prepare-resolve-host ( host serv passive? -- host' serv' flags ) - #! If the port is a number, we resolve for 'http' then - #! change it later. This is a workaround for a FreeBSD - #! getaddrinfo() limitation -- on Windows, Linux and Mac, - #! we can convert a number to a string and pass that as the - #! service name, but on FreeBSD this gives us an unknown - #! service error. - >r - dup integer? [ port-override set "http" ] when - r> AI_PASSIVE 0 ? ; - -M: object resolve-host ( host serv passive? -- seq ) - [ - prepare-resolve-host - "addrinfo" - [ set-addrinfo-flags ] keep - PF_UNSPEC over set-addrinfo-family - IPPROTO_TCP over set-addrinfo-protocol - f [ getaddrinfo addrinfo-error ] keep *void* - [ parse-addrinfo-list ] keep - freeaddrinfo - ] with-scope ; - -M: object host-name ( -- name ) - 256 dup dup length gethostname - zero? [ "gethostname failed" throw ] unless - ascii alien>string ; diff --git a/extra/io/sockets/secure/authors.txt b/extra/io/sockets/secure/authors.txt new file mode 100644 index 0000000000..1901f27a24 --- /dev/null +++ b/extra/io/sockets/secure/authors.txt @@ -0,0 +1 @@ +Slava Pestov diff --git a/extra/io/sockets/secure/secure-docs.factor b/extra/io/sockets/secure/secure-docs.factor new file mode 100644 index 0000000000..632af969ca --- /dev/null +++ b/extra/io/sockets/secure/secure-docs.factor @@ -0,0 +1,125 @@ +IN: io.sockets.secure +USING: help.markup help.syntax calendar quotations io.sockets ; + +HELP: secure-socket-timeout +{ $var-description "Timeout for operations not associated with a constructed port instance, such as SSL handshake and shutdown. Represented as a " { $link duration } "." } ; + +HELP: SSLv2 +{ $description "Possible value for the " { $snippet "method" } " slot of a " { $link secure-config } "." +$nl +"Note that the SSLv2 protocol is vulnerable to truncation attacks and its use is discouraged (" { $url "http://www.gnu.org/software/gnutls/manual/html_node/On-SSL-2-and-older-protocols.html" } ")." } ; + +HELP: SSLv3 +{ $description "Possible value for the " { $snippet "method" } " slot of a " { $link secure-config } "." +$nl +"SSLv3 is widely used, however it is being supersceded by TLSv1." } ; + +HELP: SSLv23 +{ $description "Possible value for the " { $snippet "method" } " slot of a " { $link secure-config } "." +$nl +"This value indicates that either SSLv2 or SSLv3 is acceptable." } ; + +HELP: TLSv1 +{ $description "Possible value for the " { $snippet "method" } " slot of a " { $link secure-config } "." +$nl +"TLSv1 is the newest protocol for secure socket communications." } ; + +ARTICLE: "ssl-methods" "SSL/TLS methods" +"The " { $snippet "method" } " slot of a " { $link secure-config } " can be set to one of the following values:" +{ $subsection SSLv2 } +{ $subsection SSLv23 } +{ $subsection SSLv3 } +{ $subsection TLSv1 } +"The default value is " { $link SSLv23 } "." ; + +HELP: secure-config +{ $class-description "Instances represent secure socket configurations." } ; + +HELP: +{ $values { "config" secure-config } } +{ $description "Creates a new secure socket configration with default values." } ; + +ARTICLE: "ssl-key-file" "The key file and password" +"The " { $snippet "key-file" } " and " { $snippet "password" } " slots of a " { $link secure-config } " can be set to a private key file in PEM format. These slots are required for secure servers, and also for clients when client-side authentication is used." ; + +ARTICLE: "ssl-ca-file" "The CA file and path" +"The " { $snippet "ca-file" } " slot of a " { $link secure-config } " can contain the path of a file with a list of trusted certificates in PEM format. The " { $snippet "ca-path" } " slot can contain the path of a directory of trusted certifications." +$nl +"One of these slots are required to be specified so that secure client sockets can verify server certificates." +$nl +"See " { $url "http://www.openssl.org/docs/ssl/SSL_CTX_load_verify_locations.html" } " for details." ; + +ARTICLE: "ssl-dh-file" "Diffie-Hellman parameter file" +"The " { $snippet "dh-file" } " slot of a " { $link secure-config } " can contain the path of a file with Diffie-Hellman key exchange parameters." +$nl +"This slot is required for secure server sockets." ; + +ARTICLE: "ssl-ephemeral-rsa" "Ephemeral RSA key bits" +"The " { $snippet "ephemeral-key-bits" } " slot of a " { $link secure-config } " contains the length of the empheral RSA key, in bits." +$nl +"The default value is 1024, and anything less than that is considered insecure. This slot is required for secure server sockets." ; + +ARTICLE: "ssl-config" "Secure socket configuration" +"Secure sockets require some configuration, particularly for server sockets. A class represents secure socket configuration parameters:" +{ $subsection secure-config } +"Creating new instances:" +{ $subsection } +"Configuration parameters:" +{ $subsection "ssl-methods" } +{ $subsection "ssl-key-file" } +{ $subsection "ssl-ca-file" } +{ $subsection "ssl-dh-file" } +{ $subsection "ssl-ephemeral-rsa" } ; + +HELP: +{ $values { "config" secure-config } { "context" secure-context } } +{ $description "Creates a new " { $link secure-context } ". This word should not usually be called directly, use " { $link with-secure-context } " instead." } ; + +HELP: with-secure-context +{ $values { "config" secure-config } { "quot" quotation } } +{ $description "Calls the quotation in a new dynamic scope where a " { $link secure-context } " constructed from the specified configuration is available." } ; + +ARTICLE: "ssl-contexts" "Secure socket contexts" +"All secure socket operations must be performed in a secure socket context. A context is created from a secure socket configuration. An implicit context with the default configuration is always available, however server sockets require a certificate to be set together with other parameters, and the default configuration is insufficient, so a context must be explicitly created in that case." +{ $subsection with-secure-context } ; + +HELP: secure +{ $class-description "The class of secure socket addresses." } ; + +HELP: ( addrspec -- secure ) +{ $values { "addrspec" "an address specifier" } { "secure" secure } } +{ $description "Creates a new secure socket address, which can then be passed to " { $link } " or " { $link } "." } ; + +ARTICLE: "ssl-addresses" "Secure socket addresses" +"Secure socket connections are established by passing a secure socket address to " { $link } " or " { $link } "." +$nl +"Secure socket addresses form a class:" +{ $subsection secure } +"Constructing secure socket addresses:" +{ $subsection } +"Instances of this class can wrap an " { $link inet } ", " { $link inet4 } " or an " { $link inet6 } ", although note that certificate validation is only performed for instances of " { $link inet } " since otherwise the host name is not available." ; + +HELP: premature-close +{ $error-description "Thrown if an SSL connection is closed without the proper " { $snippet "close_notify" } " sequence. This error is never reported for " { $link SSLv2 } " connections because there is no distinction between expected and unexpected connection closure in that case." } ; + +HELP: certificate-verify-error +{ $error-description "Thrown if certificate verification failed. The " { $snippet "result" } " slot contains an object identifying the low-level error that occurred." } ; + +HELP: common-name-verify-error +{ $error-description "Thrown during certificate verification if the host name on the certificate does not match the host name the socket was connected to. This indicates a potential man-in-the-middle attack. The " { $snippet "expected" } " and " { $snippet "got" } " slots contain the mismatched host names." } ; + +ARTICLE: "ssl-errors" "Secure socket errors" +"Secure sockets can throw one of several errors in addition to the usual I/O errors:" +{ $subsection premature-close } +{ $subsection certificate-verify-error } +{ $subsection common-name-verify-error } ; + +ARTICLE: "io.sockets.secure" "Secure sockets (SSL, TLS)" +"The " { $vocab-link "io.sockets.secure" } " vocabulary implements secure, encrypted sockets using the OpenSSL library." +{ $subsection "ssl-config" } +{ $subsection "ssl-contexts" } +{ $subsection "ssl-addresses" } +{ $subsection "ssl-errors" } +"This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (" { $url "http://www.openssl.org/" } "), cryptographic software written by Eric Young (eay@cryptsoft.com) and software written by Tim Hudson (tjh@cryptsoft.com)." ; + +ABOUT: "io.sockets.secure" diff --git a/extra/io/sockets/secure/secure-tests.factor b/extra/io/sockets/secure/secure-tests.factor new file mode 100644 index 0000000000..9b9436a8db --- /dev/null +++ b/extra/io/sockets/secure/secure-tests.factor @@ -0,0 +1 @@ +! No unit tests here, until Windows SSL is implemented diff --git a/extra/io/sockets/secure/secure.factor b/extra/io/sockets/secure/secure.factor new file mode 100644 index 0000000000..448a5cdda0 --- /dev/null +++ b/extra/io/sockets/secure/secure.factor @@ -0,0 +1,76 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors kernel symbols namespaces continuations +destructors io.sockets sequences inspector calendar ; +IN: io.sockets.secure + +SYMBOL: secure-socket-timeout + +1 minutes secure-socket-timeout set-global + +SYMBOL: secure-socket-backend + +SINGLETONS: SSLv2 SSLv23 SSLv3 TLSv1 ; + +TUPLE: secure-config +method +key-file password +verify +verify-depth +ca-file ca-path +dh-file +ephemeral-key-bits ; + +: ( -- config ) + secure-config new + SSLv23 >>method + 1024 >>ephemeral-key-bits + "resource:extra/openssl/cacert.pem" >>ca-file + t >>verify ; + +TUPLE: secure-context config handle disposed ; + +HOOK: secure-socket-backend ( config -- context ) + +: with-secure-context ( config quot -- ) + [ + [ ] [ [ secure-context set ] prepose ] bi* + with-disposal + ] with-scope ; inline + +TUPLE: secure addrspec ; + +C: secure + +: resolve-secure-host ( host port passive? -- seq ) + resolve-host [ ] map ; + +HOOK: check-certificate secure-socket-backend ( host handle -- ) + +> inet? ; + +M: secure-inet (client) + [ + addrspec>> + [ [ host>> ] [ port>> ] bi f resolve-secure-host (client) >r |dispose r> ] keep + host>> pick handle>> check-certificate + ] with-destructors ; + +PRIVATE> + +ERROR: premature-close ; + +M: premature-close summary + drop "Connection closed prematurely - potential truncation attack" ; + +ERROR: certificate-verify-error result ; + +M: certificate-verify-error summary + drop "Certificate verification failed" ; + +ERROR: common-name-verify-error expected got ; + +M: common-name-verify-error summary + drop "Common name verification failed" ; diff --git a/extra/io/sockets/secure/summary.txt b/extra/io/sockets/secure/summary.txt new file mode 100644 index 0000000000..a9ef1ef6d7 --- /dev/null +++ b/extra/io/sockets/secure/summary.txt @@ -0,0 +1 @@ +Secure sockets (SSL, TLS) diff --git a/extra/io/sockets/secure/tags.txt b/extra/io/sockets/secure/tags.txt new file mode 100644 index 0000000000..992ae12982 --- /dev/null +++ b/extra/io/sockets/secure/tags.txt @@ -0,0 +1 @@ +network diff --git a/extra/io/sockets/sockets-docs.factor b/extra/io/sockets/sockets-docs.factor index ad78b4631c..78cddd5d3b 100755 --- a/extra/io/sockets/sockets-docs.factor +++ b/extra/io/sockets/sockets-docs.factor @@ -1,5 +1,5 @@ USING: help.markup help.syntax io io.backend threads -strings byte-arrays continuations ; +strings byte-arrays continuations destructors quotations ; IN: io.sockets ARTICLE: "network-addressing" "Address specifiers" @@ -14,6 +14,7 @@ ARTICLE: "network-addressing" "Address specifiers" ARTICLE: "network-connection" "Connection-oriented networking" "Network connections can be established with this word:" { $subsection } +{ $subsection with-client } "Connection-oriented network servers are implemented by first opening a server socket, then waiting for connections:" { $subsection } { $subsection accept } @@ -26,7 +27,8 @@ $nl { { $link inet4 } " - a TCP/IP connection to an IPv4 address and port number; no name lookup is performed" } { { $link inet6 } " - a TCP/IP connection to an IPv6 address and port number; no name lookup is performed" } } -"The " { $vocab-link "io.server" } " library defines a nice high-level wrapper around " { $link } " which makes it easy to listen for IPv4 and IPv6 connections simultaneously, perform logging, and optionally only allow connections from the loopback interface." ; +"The " { $vocab-link "io.server" } " library defines a nice high-level wrapper around " { $link } " which makes it easy to listen for IPv4 and IPv6 connections simultaneously, perform logging, and optionally only allow connections from the loopback interface." +{ $see-also "io.sockets.secure" } ; ARTICLE: "network-packet" "Packet-oriented networking" "A packet-oriented socket can be opened with this word:" @@ -36,7 +38,7 @@ ARTICLE: "network-packet" "Packet-oriented networking" { $subsection receive } "Packet-oriented sockets are closed by calling " { $link dispose } "." $nl -"Address specifiers have the following interpretation with connection-oriented networking words:" +"Address specifiers have the following interpretation with packet-oriented networking words:" { $list { { $link local } " - Unix domain datagram sockets on Unix systems" } { { $link inet4 } " - a TCP/IP connection to an IPv4 address and port number; no name lookup is performed" } @@ -48,11 +50,13 @@ ARTICLE: "network-streams" "Networking" "Factor supports connection-oriented and packet-oriented communication over a variety of protocols:" { $list "TCP/IP and UDP/IP, over IPv4 and IPv6" - "Unix domain sockets" + "Unix domain sockets (Unix only)" } { $subsection "network-addressing" } { $subsection "network-connection" } -{ $subsection "network-packet" } ; +{ $subsection "network-packet" } +{ $subsection "io.sockets.secure" } +{ $see-also "io.pipes" } ; ABOUT: "network-streams" @@ -63,7 +67,7 @@ HELP: local } ; HELP: inet -{ $class-description "Host name/port number specifier for TCP/IP and UDP/IP connections. The " { $link inet-host } " and " { $link inet-port } " slots hold the host name and port name or number, respectively. New instances are created by calling " { $link } "." } +{ $class-description "Host name/port number specifier for TCP/IP and UDP/IP connections. The " { $snippet "host" } " and " { $snippet "port" } " slots hold the host name and port name or number, respectively. New instances are created by calling " { $link } "." } { $notes "This address specifier is only supported by " { $link } ", which calls " { $link resolve-host } " to obtain a list of IP addresses associated with the host name, and attempts a connection to each one in turn until one succeeds. Other network words do not accept this address specifier, and " { $link resolve-host } " must be called directly; it is then up to the application to pick the correct address from the (possibly several) addresses associated to the host name." } @@ -73,7 +77,7 @@ HELP: inet } ; HELP: inet4 -{ $class-description "IPv4 address/port number specifier for TCP/IP and UDP/IP connections. The " { $link inet4-host } " and " { $link inet4-port } " slots hold the IPv4 address and port number, respectively. New instances are created by calling " { $link } "." } +{ $class-description "IPv4 address/port number specifier for TCP/IP and UDP/IP connections. The " { $snippet "host" } " and " { $snippet "port" } " slots hold the IPv4 address and port number, respectively. New instances are created by calling " { $link } "." } { $notes "New instances should not be created directly; instead, use " { $link resolve-host } " to look up the address associated to a host name. Also, try to support IPv6 where possible." } @@ -82,7 +86,7 @@ HELP: inet4 } ; HELP: inet6 -{ $class-description "IPv6 address/port number specifier for TCP/IP and UDP/IP connections. The " { $link inet6-host } " and " { $link inet6-port } " slots hold the IPv6 address and port number, respectively. New instances are created by calling " { $link } "." } +{ $class-description "IPv6 address/port number specifier for TCP/IP and UDP/IP connections. The " { $snippet "host" } " and " { $snippet "port" } " slots hold the IPv6 address and port number, respectively. New instances are created by calling " { $link } "." } { $notes "New instances should not be created directly; instead, use " { $link resolve-host } " to look up the address associated to a host name." } { $examples @@ -90,13 +94,19 @@ HELP: inet6 } ; HELP: -{ $values { "addrspec" "an address specifier" } { "encoding" "an encding descriptor" } { "stream" "a bidirectional stream" } } -{ $description "Opens a network connection and outputs a bidirectional stream using the given encoding." } +{ $values { "remote" "an address specifier" } { "encoding" "an encding descriptor" } { "stream" "a bidirectional stream" } { "local" "an address specifier" } } +{ $description "Opens a network connection and outputs a bidirectional stream using the given encoding, together with the local address the socket was bound to." } { $errors "Throws an error if the connection cannot be established." } +{ $notes "The " { $link with-client } " word is easier to use in most situations." } { $examples { $code "\"www.apple.com\" \"http\" utf8 " } } ; +HELP: with-client +{ $values { "remote" "an address specifier" } { "encoding" "an encding descriptor" } { "quot" quotation } } +{ $description "Opens a network connection and calls the quotation in a new dynamic scope with " { $link input-stream } " and " { $link output-stream } " rebound to the network streams. The local address the socket is bound to is stored in the " { $link local-address } " variable." } +{ $errors "Throws an error if the connection cannot be established." } ; + HELP: { $values { "addrspec" "an address specifier" } { "encoding" "an encoding descriptor" } { "server" "a handle" } } { $description @@ -112,11 +122,18 @@ HELP: "To start a server which listens for connections from the loopback interface only, use an address specifier returned by the following code, where 1234 is the desired port number:" { $code "\"localhost\" 1234 t resolve-host" } "Since " { $link resolve-host } " can return multiple address specifiers, your server code must listen on them all to work properly. The " { $vocab-link "io.server" } " vocabulary can be used to help with this." + $nl + "To start a TCP/IP server which listens for connections on a randomly-assigned port, set the port number in the address specifier to 0, and then read the " { $snippet "addr" } " slot of the server instance to obtain the actual port number it is listening on:" + { $unchecked-example + "f 0 ascii " + "[ addr>> . ] [ dispose ] bi" + "T{ inet4 f \"0.0.0.0\" 58901 }" + } } { $errors "Throws an error if the address is already in use, or if it if the system forbids access." } ; HELP: accept -{ $values { "server" "a handle" } { "client" "a bidirectional stream" } { "addrspec" "an address specifier" } } +{ $values { "server" "a handle" } { "client" "a bidirectional stream" } { "remote" "an address specifier" } } { $description "Waits for a connection to a server socket created by " { $link } ", and outputs a bidirectional stream when the connection has been established. The encoding of this stream is the one that was passed to the server constructor." } { $errors "Throws an error if the server socket is closed or otherwise is unavailable." } ; diff --git a/extra/io/sockets/sockets-tests.factor b/extra/io/sockets/sockets-tests.factor old mode 100644 new mode 100755 index 1810b8587b..8264bec032 --- a/extra/io/sockets/sockets-tests.factor +++ b/extra/io/sockets/sockets-tests.factor @@ -1,4 +1,92 @@ IN: io.sockets.tests -USING: io.sockets sequences math tools.test ; +USING: io.sockets sequences math tools.test namespaces accessors +kernel destructors calendar io.timeouts io.encodings.utf8 io +concurrency.promises threads io.streams.string ; + +[ B{ 1 2 3 4 } ] +[ "1.2.3.4" T{ inet4 } inet-pton ] unit-test + +[ "1.2.3.4" ] +[ B{ 1 2 3 4 } T{ inet4 } inet-ntop ] unit-test + +[ "255.255.255.255" ] +[ B{ 255 255 255 255 } T{ inet4 } inet-ntop ] unit-test + +[ B{ 255 255 255 255 } ] +[ "255.255.255.255" T{ inet4 } inet-pton ] unit-test + +[ B{ 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 } ] +[ "1:2:3:4:5:6:7:8" T{ inet6 } inet-pton ] unit-test + +[ "1:2:3:4:5:6:7:8" ] +[ B{ 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 } T{ inet6 } inet-ntop ] unit-test + +[ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } ] +[ "::" T{ inet6 } inet-pton ] unit-test + +[ "0:0:0:0:0:0:0:0" ] +[ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } T{ inet6 } inet-ntop ] unit-test + +[ B{ 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } ] +[ "1::" T{ inet6 } inet-pton ] unit-test + +[ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } ] +[ "::1" T{ inet6 } inet-pton ] unit-test + +[ B{ 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 } ] +[ "1::2" T{ inet6 } inet-pton ] unit-test + +[ B{ 0 1 0 0 0 0 0 0 0 0 0 0 0 2 0 3 } ] +[ "1::2:3" T{ inet6 } inet-pton ] unit-test + +[ B{ 0 1 0 2 0 0 0 0 0 0 0 0 0 3 0 4 } ] +[ "1:2::3:4" T{ inet6 } inet-pton ] unit-test + +[ "1:2:0:0:0:0:3:4" ] +[ B{ 0 1 0 2 0 0 0 0 0 0 0 0 0 3 0 4 } T{ inet6 } inet-ntop ] unit-test [ t ] [ "localhost" 80 f resolve-host length 1 >= ] unit-test + +! Smoke-test UDP +[ ] [ "127.0.0.1" 0 "datagram1" set ] unit-test +[ ] [ "datagram1" get addr>> "addr1" set ] unit-test +[ f ] [ "addr1" get port>> 0 = ] unit-test + +[ ] [ "127.0.0.1" 0 "datagram2" set ] unit-test +[ ] [ "datagram2" get addr>> "addr2" set ] unit-test +[ f ] [ "addr2" get port>> 0 = ] unit-test + +[ ] [ B{ 1 2 3 4 } "addr2" get "datagram1" get send ] unit-test +[ B{ 1 2 3 4 } ] [ "datagram2" get receive "from" set ] unit-test +[ ] [ B{ 4 3 2 1 } "from" get "datagram2" get send ] unit-test +[ B{ 4 3 2 1 } t ] [ "datagram1" get receive "addr2" get = ] unit-test + +[ ] [ "datagram1" get dispose ] unit-test +[ ] [ "datagram2" get dispose ] unit-test + +! Test timeouts +[ ] [ "127.0.0.1" 0 "datagram3" set ] unit-test + +[ ] [ 1 seconds "datagram3" get set-timeout ] unit-test +[ "datagram3" get receive ] must-fail + +! See what happens if other end is closed +[ ] [ "port" set ] unit-test + +[ ] [ + [ + "127.0.0.1" 0 utf8 + dup addr>> "port" get fulfill + [ + accept drop + dup stream-readln drop + "hello" swap stream-copy + ] with-disposal + ] "Socket close test" spawn drop +] unit-test + +[ "hello" f ] [ + "port" get ?promise utf8 [ + "hi\n" write flush readln readln + ] with-client +] unit-test diff --git a/extra/io/sockets/sockets.factor b/extra/io/sockets/sockets.factor index 859dcb4cdc..4efd30c65e 100755 --- a/extra/io/sockets/sockets.factor +++ b/extra/io/sockets/sockets.factor @@ -1,9 +1,40 @@ -! Copyright (C) 2007, 2008 Slava Pestov, Daniel Ehrenberg. +! Copyright (C) 2007, 2008 Slava Pestov, Doug Coleman, +! Daniel Ehrenberg. ! See http://factorcode.org/license.txt for BSD license. USING: generic kernel io.backend namespaces continuations -sequences arrays io.encodings io.nonblocking accessors ; +sequences arrays io.encodings io.ports io.streams.duplex +io.encodings.ascii alien.strings io.binary accessors destructors +classes debugger byte-arrays system combinators parser +alien.c-types math.parser splitting grouping +math assocs inspector ; IN: io.sockets +<< { + { [ os windows? ] [ "windows.winsock" ] } + { [ os unix? ] [ "unix" ] } +} cond use+ >> + +! Addressing +GENERIC: protocol-family ( addrspec -- af ) + +GENERIC: sockaddr-type ( addrspec -- type ) + +GENERIC: make-sockaddr ( addrspec -- sockaddr ) + +GENERIC: address-size ( addrspec -- n ) + +GENERIC: inet-ntop ( data addrspec -- str ) + +GENERIC: inet-pton ( str addrspec -- data ) + +: make-sockaddr/size ( addrspec -- sockaddr size ) + [ make-sockaddr ] [ sockaddr-type heap-size ] bi ; + +: empty-sockaddr/size ( addrspec -- sockaddr size ) + sockaddr-type [ ] [ heap-size ] bi ; + +GENERIC: parse-sockaddr ( sockaddr addrspec -- newaddrspec ) + TUPLE: local path ; : ( path -- addrspec ) @@ -13,46 +44,262 @@ TUPLE: inet4 host port ; C: inet4 +M: inet4 inet-ntop ( data addrspec -- str ) + drop 4 memory>byte-array [ number>string ] { } map-as "." join ; + +ERROR: invalid-inet4 string reason ; + +M: invalid-inet4 summary drop "Invalid IPv4 address" ; + +M: inet4 inet-pton ( str addrspec -- data ) + drop + [ + "." split dup length 4 = [ + "Must have four components" throw + ] unless + [ + string>number + [ "Dotted component not a number" throw ] unless* + ] B{ } map-as + ] [ invalid-inet4 ] recover ; + +M: inet4 address-size drop 4 ; + +M: inet4 protocol-family drop PF_INET ; + +M: inet4 sockaddr-type drop "sockaddr-in" c-type ; + +M: inet4 make-sockaddr ( inet -- sockaddr ) + "sockaddr-in" + AF_INET over set-sockaddr-in-family + over inet4-port htons over set-sockaddr-in-port + over inet4-host + "0.0.0.0" or + rot inet-pton *uint over set-sockaddr-in-addr ; + + + +M: inet4 parse-sockaddr + >r dup sockaddr-in-addr r> inet-ntop + swap sockaddr-in-port ntohs (port) ; + TUPLE: inet6 host port ; C: inet6 +M: inet6 inet-ntop ( data addrspec -- str ) + drop 16 memory>byte-array 2 [ be> >hex ] map ":" join ; + +ERROR: invalid-inet6 string reason ; + +M: invalid-inet6 summary drop "Invalid IPv6 address" ; + + [ "Component not a number" throw ] unless* + ] B{ } map-as + ] if ; + +: pad-inet6 ( string1 string2 -- seq ) + 2dup [ length ] bi@ + 8 swap - + dup 0 < [ "More than 8 components" throw ] when + swap 3append ; + +: inet6-bytes ( seq -- bytes ) + [ 2 >be ] { } map-as concat >byte-array ; + +PRIVATE> + +M: inet6 inet-pton ( str addrspec -- data ) + drop + [ + "::" split1 [ parse-inet6 ] bi@ pad-inet6 inet6-bytes + ] [ invalid-inet6 ] recover ; + +M: inet6 address-size drop 16 ; + +M: inet6 protocol-family drop PF_INET6 ; + +M: inet6 sockaddr-type drop "sockaddr-in6" c-type ; + +M: inet6 make-sockaddr ( inet -- sockaddr ) + "sockaddr-in6" + AF_INET6 over set-sockaddr-in6-family + over inet6-port htons over set-sockaddr-in6-port + over inet6-host "::" or + rot inet-pton over set-sockaddr-in6-addr ; + +M: inet6 parse-sockaddr + >r dup sockaddr-in6-addr r> inet-ntop + swap sockaddr-in6-port ntohs (port) ; + +: addrspec-of-family ( af -- addrspec ) + { + { AF_INET [ T{ inet4 } ] } + { AF_INET6 [ T{ inet6 } ] } + { AF_UNIX [ T{ local } ] } + [ drop f ] + } case ; + +M: f parse-sockaddr nip ; + +GENERIC: (get-local-address) ( handle remote -- sockaddr ) + +: get-local-address ( handle remote -- local ) + [ (get-local-address) ] keep parse-sockaddr ; + +GENERIC: (get-remote-address) ( handle remote -- sockaddr ) + +: get-remote-address ( handle local -- remote ) + [ (get-remote-address) ] keep parse-sockaddr ; + +: ( handle -- input-port output-port ) + [ + [ |dispose ] [ |dispose ] bi + ] with-destructors ; + +GENERIC: establish-connection ( client-out remote -- ) + +GENERIC: ((client)) ( remote -- handle ) + +GENERIC: (client) ( remote -- client-in client-out local ) + +M: array (client) [ (client) 3array ] attempt-all first3 ; + +M: object (client) ( remote -- client-in client-out local ) + [ + [ ((client)) ] keep + [ + >r [ |dispose ] bi@ dup r> + establish-connection + ] + [ get-local-address ] + 2bi + ] with-destructors ; + +: ( remote encoding -- stream local ) + >r (client) -rot r> swap ; + +SYMBOL: local-address + +: with-client ( remote encoding quot -- ) + >r [ local-address set ] curry + r> compose with-stream ; inline + +TUPLE: server-port < port addr encoding ; + +: check-server-port ( port -- port ) + dup check-disposed + dup server-port? [ "Not a server port" throw ] unless ; inline + +GENERIC: (server) ( addrspec -- handle ) + +: ( addrspec encoding -- server ) + >r + [ (server) ] keep + [ drop server-port ] [ get-local-address ] 2bi + >>addr r> >>encoding ; + +GENERIC: (accept) ( server addrspec -- handle sockaddr ) + +: accept ( server -- client remote ) + [ + dup addr>> + [ (accept) ] keep + parse-sockaddr swap + + ] keep encoding>> swap ; + +TUPLE: datagram-port < port addr ; + +HOOK: (datagram) io-backend ( addr -- datagram ) + +: ( addrspec -- datagram ) + [ + [ (datagram) |dispose ] keep + [ drop datagram-port ] [ get-local-address ] 2bi + >>addr + ] with-destructors ; + +: check-datagram-port ( port -- port ) + dup check-disposed + dup datagram-port? [ "Not a datagram port" throw ] unless ; inline + +HOOK: (receive) io-backend ( datagram -- packet addrspec ) + +: receive ( datagram -- packet addrspec ) + check-datagram-port + [ (receive) ] [ addr>> ] bi parse-sockaddr ; + +: check-datagram-send ( packet addrspec port -- packet addrspec port ) + check-datagram-port + 2dup addr>> [ class ] bi@ assert= + pick class byte-array assert= ; + +HOOK: (send) io-backend ( packet addrspec datagram -- ) + +: send ( packet addrspec datagram -- ) + check-datagram-send (send) ; + +: addrinfo>addrspec ( addrinfo -- addrspec ) + [ addrinfo-addr ] [ addrinfo-family addrspec-of-family ] bi + parse-sockaddr ; + +: parse-addrinfo-list ( addrinfo -- seq ) + [ addrinfo-next ] follow + [ addrinfo>addrspec ] map + sift ; + +: prepare-resolve-host ( host serv passive? -- host' serv' flags ) + #! If the port is a number, we resolve for 'http' then + #! change it later. This is a workaround for a FreeBSD + #! getaddrinfo() limitation -- on Windows, Linux and Mac, + #! we can convert a number to a string and pass that as the + #! service name, but on FreeBSD this gives us an unknown + #! service error. + >r + dup integer? [ port-override set "http" ] when + r> AI_PASSIVE 0 ? ; + +HOOK: addrinfo-error io-backend ( n -- ) + +: resolve-host ( host serv passive? -- seq ) + [ + prepare-resolve-host + "addrinfo" + [ set-addrinfo-flags ] keep + PF_UNSPEC over set-addrinfo-family + IPPROTO_TCP over set-addrinfo-protocol + f [ getaddrinfo addrinfo-error ] keep *void* + [ parse-addrinfo-list ] keep + freeaddrinfo + ] with-scope ; + +: host-name ( -- string ) + 256 dup dup length gethostname + zero? [ "gethostname failed" throw ] unless + ascii alien>string ; + TUPLE: inet host port ; C: inet -HOOK: ((client)) io-backend ( addrspec -- client-in client-out ) - -GENERIC: (client) ( addrspec -- client-in client-out ) -M: array (client) [ ((client)) 2array ] attempt-all first2 ; -M: object (client) ((client)) ; - -: ( addrspec encoding -- stream ) - >r (client) r> ; - -HOOK: (server) io-backend ( addrspec -- handle ) - -: ( addrspec encoding -- server ) - >r [ (server) ] keep r> ; - -HOOK: (accept) io-backend ( server -- addrspec handle ) - -: accept ( server -- client addrspec ) - [ (accept) dup ] [ encoding>> ] bi - swap ; - -HOOK: io-backend ( addrspec -- datagram ) - -HOOK: receive io-backend ( datagram -- packet addrspec ) - -HOOK: send io-backend ( packet addrspec datagram -- ) - -HOOK: resolve-host io-backend ( host serv passive? -- seq ) - -HOOK: host-name io-backend ( -- string ) - M: inet (client) - [ host>> ] [ port>> ] bi f resolve-host - [ empty? [ "Host name lookup failed" throw ] when ] - [ (client) ] - bi ; + [ host>> ] [ port>> ] bi f resolve-host (client) ; + +ERROR: invalid-inet-server addrspec ; + +M: invalid-inet-server summary + drop "Cannot use with ; use or instead" ; + +M: inet (server) + invalid-inet-server ; diff --git a/extra/io/streams/duplex/authors.txt b/extra/io/streams/duplex/authors.txt new file mode 100644 index 0000000000..1901f27a24 --- /dev/null +++ b/extra/io/streams/duplex/authors.txt @@ -0,0 +1 @@ +Slava Pestov diff --git a/extra/io/streams/duplex/duplex-docs.factor b/extra/io/streams/duplex/duplex-docs.factor new file mode 100755 index 0000000000..ca4f424fb6 --- /dev/null +++ b/extra/io/streams/duplex/duplex-docs.factor @@ -0,0 +1,36 @@ +USING: help.markup help.syntax io continuations quotations ; +IN: io.streams.duplex + +ARTICLE: "io.streams.duplex" "Duplex streams" +"Duplex streams combine an input stream and an output stream into a bidirectional stream." +{ $subsection duplex-stream } +{ $subsection } +"A pair of combinators for rebinding both default streams at once:" +{ $subsection with-stream } +{ $subsection with-stream* } ; + +ABOUT: "io.streams.duplex" + +HELP: duplex-stream +{ $class-description "A bidirectional stream wrapping an input and output stream." } ; + +HELP: +{ $values { "in" "an input stream" } { "out" "an output stream" } { "stream" " a duplex stream" } } +{ $description "Creates a duplex stream. Writing to a duplex stream will write to " { $snippet "out" } ", and reading from a duplex stream will read from " { $snippet "in" } ". Closing a duplex stream closes both the input and output streams." } ; + +HELP: with-stream +{ $values { "stream" duplex-stream } { "quot" quotation } } +{ $description "Calls the quotation in a new dynamic scope, with both " { $link input-stream } " and " { $link output-stream } " rebound to " { $snippet "stream" } ". The stream is closed if the quotation returns or throws an error." } ; + +HELP: with-stream* +{ $values { "stream" duplex-stream } { "quot" quotation } } +{ $description "Calls the quotation in a new dynamic scope, with both " { $link input-stream } " and " { $link output-stream } " rebound to " { $snippet "stream" } "." } +{ $notes "This word does not close the stream. Compare with " { $link with-stream } "." } ; + +HELP: +{ $values { "stream-in" "an input stream" } + { "stream-out" "an output stream" } + { "encoding" "an encoding descriptor" } + { "duplex" "an encoded duplex stream" } } +{ $description "Wraps the given streams in an encoder or decoder stream, and puts them together in a duplex stream for input and output. If either input stream is already encoded, that encoding is stripped off before it is reencoded. The encoding descriptor must conform to the " { $link "encodings-protocol" } "." } +$low-level-note ; diff --git a/core/io/streams/duplex/duplex-tests.factor b/extra/io/streams/duplex/duplex-tests.factor similarity index 64% rename from core/io/streams/duplex/duplex-tests.factor rename to extra/io/streams/duplex/duplex-tests.factor index ebc6b3be1f..860702c563 100755 --- a/core/io/streams/duplex/duplex-tests.factor +++ b/extra/io/streams/duplex/duplex-tests.factor @@ -1,17 +1,13 @@ -USING: io.streams.duplex io kernel continuations tools.test ; +USING: io.streams.duplex io io.streams.string +kernel continuations tools.test destructors accessors ; IN: io.streams.duplex.tests ! Test duplex stream close behavior -TUPLE: closing-stream closed? ; +TUPLE: closing-stream < disposable ; : closing-stream new ; -M: closing-stream dispose - dup closing-stream-closed? [ - "Closing twice!" throw - ] [ - t swap set-closing-stream-closed? - ] if ; +M: closing-stream dispose* drop ; TUPLE: unclosable-stream ; @@ -29,12 +25,17 @@ M: unclosable-stream dispose [ [ dup dispose ] [ 2drop ] recover - ] keep closing-stream-closed? + ] keep disposed>> ] unit-test [ t ] [ [ [ dup dispose ] [ 2drop ] recover - ] keep closing-stream-closed? + ] keep disposed>> +] unit-test + +[ "Hey" ] [ + "Hey\nThere" + stream-readln ] unit-test diff --git a/extra/io/streams/duplex/duplex.factor b/extra/io/streams/duplex/duplex.factor new file mode 100755 index 0000000000..02d7ab61be --- /dev/null +++ b/extra/io/streams/duplex/duplex.factor @@ -0,0 +1,39 @@ +! Copyright (C) 2005, 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: kernel continuations destructors io io.encodings +io.encodings.private io.timeouts debugger inspector listener +accessors delegate delegate.protocols ; +IN: io.streams.duplex + +! We ensure that the stream can only be closed once, to preserve +! integrity of duplex I/O ports. + +TUPLE: duplex-stream in out ; + +C: duplex-stream + +CONSULT: input-stream-protocol duplex-stream in>> ; + +CONSULT: output-stream-protocol duplex-stream out>> ; + +M: duplex-stream set-timeout + [ in>> set-timeout ] [ out>> set-timeout ] 2bi ; + +M: duplex-stream dispose + #! The output stream is closed first, in case both streams + #! are attached to the same file descriptor, the output + #! buffer needs to be flushed before we close the fd. + [ + [ in>> &dispose drop ] + [ out>> &dispose drop ] + bi + ] with-destructors ; + +: ( stream-in stream-out encoding -- duplex ) + tuck re-encode >r re-decode r> ; + +: with-stream* ( stream quot -- ) + >r [ in>> ] [ out>> ] bi r> with-streams* ; inline + +: with-stream ( stream quot -- ) + >r [ in>> ] [ out>> ] bi r> with-streams ; inline diff --git a/core/io/streams/duplex/summary.txt b/extra/io/streams/duplex/summary.txt similarity index 100% rename from core/io/streams/duplex/summary.txt rename to extra/io/streams/duplex/summary.txt diff --git a/extra/io/streams/null/null.factor b/extra/io/streams/null/null.factor index eee66239be..191c8dce91 100755 --- a/extra/io/streams/null/null.factor +++ b/extra/io/streams/null/null.factor @@ -1,25 +1,38 @@ ! Copyright (C) 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. IN: io.streams.null -USING: kernel io io.timeouts continuations ; +USING: kernel io io.timeouts io.streams.duplex destructors ; TUPLE: null-stream ; M: null-stream dispose drop ; M: null-stream set-timeout 2drop ; -M: null-stream stream-readln drop f ; -M: null-stream stream-read1 drop f ; -M: null-stream stream-read-until 2drop f f ; -M: null-stream stream-read 2drop f ; -M: null-stream stream-write1 2drop ; -M: null-stream stream-write 2drop ; -M: null-stream stream-nl drop ; -M: null-stream stream-flush drop ; -M: null-stream stream-format 3drop ; -M: null-stream make-span-stream nip ; -M: null-stream make-block-stream nip ; -M: null-stream make-cell-stream nip ; -M: null-stream stream-write-table 3drop ; + +TUPLE: null-reader < null-stream ; + +M: null-reader stream-readln drop f ; +M: null-reader stream-read1 drop f ; +M: null-reader stream-read-until 2drop f f ; +M: null-reader stream-read 2drop f ; + +TUPLE: null-writer < null-stream ; + +M: null-writer stream-write1 2drop ; +M: null-writer stream-write 2drop ; +M: null-writer stream-nl drop ; +M: null-writer stream-flush drop ; +M: null-writer stream-format 3drop ; +M: null-writer make-span-stream nip ; +M: null-writer make-block-stream nip ; +M: null-writer make-cell-stream nip ; +M: null-writer stream-write-table 3drop ; + +: with-null-reader ( quot -- ) + T{ null-reader } swap with-input-stream* ; inline + +: with-null-writer ( quot -- ) + T{ null-writer } swap with-output-stream* ; inline : with-null-stream ( quot -- ) - T{ null-stream } swap with-stream* ; inline + T{ duplex-stream f T{ null-reader } T{ null-writer } } + swap with-stream* ; inline diff --git a/extra/io/timeouts/timeouts-docs.factor b/extra/io/timeouts/timeouts-docs.factor index 64104083be..b2927af362 100755 --- a/extra/io/timeouts/timeouts-docs.factor +++ b/extra/io/timeouts/timeouts-docs.factor @@ -9,20 +9,20 @@ HELP: set-timeout { $values { "dt/f" "a " { $link duration } " or " { $link f } } { "obj" object } } { $contract "Sets an object's timeout." } ; -HELP: timed-out +HELP: cancel-operation { $values { "obj" object } } { $contract "Handles a timeout, usually by waking up all threads waiting on the object." } ; HELP: with-timeout { $values { "obj" object } { "quot" "a quotation with stack effect " { $snippet "( obj -- )" } } } -{ $description "Applies the quotation to the object. If the object's timeout expires before the quotation returns, " { $link timed-out } " is called on the object." } ; +{ $description "Applies the quotation to the object. If the object's timeout expires before the quotation returns, " { $link cancel-operation } " is called on the object." } ; ARTICLE: "io.timeouts" "I/O timeout protocol" "Streams, processes and monitors support optional timeouts, which impose an upper bound on the length of time for which an operation on these objects can block. Timeouts are used in network servers to prevent malicious clients from holding onto connections forever, and to ensure that runaway processes get killed." { $subsection timeout } { $subsection set-timeout } "The I/O timeout protocol can be implemented by any class wishing to support timeouts on blocking operations." -{ $subsection timed-out } +{ $subsection cancel-operation } "A combinator to be used in operations which can time out:" { $subsection with-timeout } { $see-also "stream-protocol" "io.launcher" "io.monitors" } ; diff --git a/extra/io/timeouts/timeouts.factor b/extra/io/timeouts/timeouts.factor index f1031e98e2..029cf6cac0 100755 --- a/extra/io/timeouts/timeouts.factor +++ b/extra/io/timeouts/timeouts.factor @@ -1,31 +1,29 @@ ! Copyright (C) 2008 Slava Pestov, Doug Coleman ! See http://factorcode.org/license.txt for BSD license. -USING: kernel calendar alarms io.streams.duplex io.encodings ; +USING: kernel calendar alarms io io.encodings accessors +namespaces ; IN: io.timeouts -! Won't need this with new slot accessors GENERIC: timeout ( obj -- dt/f ) GENERIC: set-timeout ( dt/f obj -- ) -M: duplex-stream set-timeout - 2dup - duplex-stream-in set-timeout - duplex-stream-out set-timeout ; +M: decoder set-timeout stream>> set-timeout ; -M: decoder set-timeout decoder-stream set-timeout ; +M: encoder set-timeout stream>> set-timeout ; -M: encoder set-timeout encoder-stream set-timeout ; - -GENERIC: timed-out ( obj -- ) - -M: object timed-out drop ; +GENERIC: cancel-operation ( obj -- ) : queue-timeout ( obj timeout -- alarm ) - >r [ timed-out ] curry r> later ; + >r [ cancel-operation ] curry r> later ; + +: with-timeout* ( obj timeout quot -- ) + 3dup drop queue-timeout >r nip call r> cancel-alarm ; + inline : with-timeout ( obj quot -- ) - over dup timeout dup [ - queue-timeout slip cancel-alarm - ] [ - 2drop call - ] if ; inline + over timeout [ >r dup timeout r> with-timeout* ] [ call ] if ; + inline + +: timeouts ( dt -- ) + [ input-stream get set-timeout ] + [ output-stream get set-timeout ] bi ; diff --git a/extra/io/unix/backend/backend.factor b/extra/io/unix/backend/backend.factor old mode 100644 new mode 100755 index ba4e587d13..67856a0570 --- a/extra/io/unix/backend/backend.factor +++ b/extra/io/unix/backend/backend.factor @@ -1,193 +1,158 @@ ! Copyright (C) 2004, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: alien generic assocs kernel kernel.private math -io.nonblocking sequences strings structs sbufs -threads unix vectors io.buffers io.backend io.encodings -io.streams.duplex math.parser continuations system libc -qualified namespaces io.timeouts io.encodings.utf8 accessors ; +io.ports sequences strings structs sbufs threads unix +vectors io.buffers io.backend io.encodings math.parser +continuations system libc qualified namespaces io.timeouts +io.encodings.utf8 destructors accessors inspector combinators ; QUALIFIED: io IN: io.unix.backend -! I/O tasks -TUPLE: io-task port callbacks ; +GENERIC: handle-fd ( handle -- fd ) -: io-task-fd port>> handle>> ; +TUPLE: fd fd disposed ; -: ( port continuation/f class -- task ) - new - swap [ 1vector ] [ V{ } clone ] if* >>callbacks - swap >>port ; inline +: ( n -- fd ) + #! We drop the error code rather than calling io-error, + #! since on OS X 10.3, this operation fails from init-io + #! when running the Factor.app (presumably because fd 0 and + #! 1 are closed). + fd new + swap + [ F_SETFL O_NONBLOCK fcntl drop ] + [ F_SETFD FD_CLOEXEC fcntl drop ] + [ >>fd ] + tri ; -TUPLE: input-task < io-task ; +M: fd dispose + dup disposed>> [ drop ] [ + [ cancel-operation ] + [ t >>disposed drop ] + [ fd>> close-file ] + tri + ] if ; -TUPLE: output-task < io-task ; - -GENERIC: do-io-task ( task -- ? ) -GENERIC: io-task-container ( mx task -- hashtable ) +M: fd handle-fd dup check-disposed fd>> ; ! I/O multiplexers TUPLE: mx fd reads writes ; -M: input-task io-task-container drop reads>> ; - -M: output-task io-task-container drop writes>> ; - : new-mx ( class -- obj ) new H{ } clone >>reads H{ } clone >>writes ; inline -GENERIC: register-io-task ( task mx -- ) -GENERIC: unregister-io-task ( task mx -- ) +GENERIC: add-input-callback ( thread fd mx -- ) + +: add-callback ( thread fd assoc -- ) + [ ?push ] change-at ; + +M: mx add-input-callback reads>> add-callback ; + +GENERIC: add-output-callback ( thread fd mx -- ) + +M: mx add-output-callback writes>> add-callback ; + +GENERIC: remove-input-callbacks ( fd mx -- callbacks ) + +M: mx remove-input-callbacks reads>> delete-at* drop ; + +GENERIC: remove-output-callbacks ( fd mx -- callbacks ) + +M: mx remove-output-callbacks writes>> delete-at* drop ; + GENERIC: wait-for-events ( ms mx -- ) -: fd/container ( task mx -- task fd container ) - over io-task-container >r dup io-task-fd r> ; inline +: input-available ( fd mx -- ) + remove-input-callbacks [ resume ] each ; -: check-io-task ( task mx -- ) - fd/container key? nip [ - "Cannot perform multiple reads from the same port" throw - ] when ; +: output-available ( fd mx -- ) + remove-output-callbacks [ resume ] each ; -M: mx register-io-task ( task mx -- ) - 2dup check-io-task fd/container set-at ; +M: fd cancel-operation ( fd -- ) + dup disposed>> [ drop ] [ + fd>> + mx get-global + [ remove-input-callbacks [ t swap resume-with ] each ] + [ remove-output-callbacks [ t swap resume-with ] each ] + 2bi + ] if ; -: add-io-task ( task -- ) - mx get-global register-io-task ; +SYMBOL: +retry+ ! just try the operation again without blocking +SYMBOL: +input+ +SYMBOL: +output+ -: with-port-continuation ( port quot -- port ) - [ "I/O" suspend drop ] curry with-timeout ; inline +ERROR: io-timeout ; -M: mx unregister-io-task ( task mx -- ) - fd/container delete-at drop ; +M: io-timeout summary drop "I/O operation timed out" ; + +: wait-for-fd ( handle event -- ) + dup +retry+ eq? [ 2drop ] [ + [ + >r + swap handle-fd + mx get-global + r> { + { +input+ [ add-input-callback ] } + { +output+ [ add-output-callback ] } + } case + ] curry "I/O" suspend nip [ io-timeout ] when + ] if ; + +: wait-for-port ( port event -- ) + [ >r handle>> r> wait-for-fd ] curry with-timeout ; ! Some general stuff : file-mode OCT: 0666 ; - -: (io-error) ( -- * ) err_no strerror throw ; - -: check-errno ( -- ) - err_no dup zero? [ drop ] [ strerror throw ] if ; - -: check-null ( n -- ) zero? [ (io-error) ] when ; - -: io-error ( n -- ) 0 < [ (io-error) ] when ; -M: integer init-handle ( fd -- ) - #! We drop the error code rather than calling io-error, - #! since on OS X 10.3, this operation fails from init-io - #! when running the Factor.app (presumably because fd 0 and - #! 1 are closed). - F_SETFL O_NONBLOCK fcntl drop ; - -M: integer close-handle ( fd -- ) - close ; - -: report-error ( error port -- ) - [ "Error on fd " % dup handle>> # ": " % swap % ] "" make - >>error drop ; - -: ignorable-error? ( n -- ? ) - [ EAGAIN number= ] [ EINTR number= ] bi or ; - -: defer-error ( port -- ? ) - #! Return t if it is an unrecoverable error. - err_no dup ignorable-error? - [ 2drop f ] [ strerror swap report-error t ] if ; - -: pop-callbacks ( mx task -- ) - dup rot unregister-io-task - io-task-callbacks [ resume ] each ; - -: handle-io-task ( mx task -- ) - dup do-io-task [ pop-callbacks ] [ 2drop ] if ; - -: handle-timeout ( port mx assoc -- ) - >r swap port-handle r> delete-at* [ - "I/O operation cancelled" over port>> report-error - pop-callbacks - ] [ - 2drop - ] if ; - -: cancel-io-tasks ( port mx -- ) - [ dup reads>> handle-timeout ] - [ dup writes>> handle-timeout ] 2bi ; - -M: unix cancel-io ( port -- ) - mx get-global cancel-io-tasks ; - ! Readers -: reader-eof ( reader -- ) - dup buffer>> buffer-empty? [ t >>eof ] when drop ; - : (refill) ( port -- n ) [ handle>> ] [ buffer>> buffer-end ] [ buffer>> buffer-capacity ] tri read ; -: refill ( port -- ? ) - #! Return f if there is a recoverable error - dup buffer>> buffer-empty? [ - dup (refill) dup 0 >= [ - swap buffer>> n>buffer t - ] [ - drop defer-error - ] if - ] [ - drop t - ] if ; +! Returns an event to wait for which will ensure completion of +! this request +GENERIC: refill ( port handle -- event/f ) -TUPLE: read-task < input-task ; +M: fd refill + fd>> over buffer>> [ buffer-end ] [ buffer-capacity ] bi read + { + { [ dup 0 >= ] [ swap buffer>> n>buffer f ] } + { [ err_no EINTR = ] [ 2drop +retry+ ] } + { [ err_no EAGAIN = ] [ 2drop +input+ ] } + [ (io-error) ] + } cond ; -: ( port continuation -- task ) - read-task ; - -M: read-task do-io-task - io-task-port dup refill - [ [ reader-eof ] [ drop ] if ] keep ; - -M: input-port (wait-to-read) - [ add-io-task ] with-port-continuation - pending-error ; +M: unix (wait-to-read) ( port -- ) + dup dup handle>> refill dup + [ dupd wait-for-port (wait-to-read) ] [ 2drop ] if ; ! Writers -: write-step ( port -- ? ) - dup - [ handle>> ] - [ buffer>> buffer@ ] - [ buffer>> buffer-length ] tri - write dup 0 >= - [ swap buffer>> buffer-consume f ] - [ drop defer-error ] if ; +GENERIC: drain ( port handle -- event/f ) -TUPLE: write-task < output-task ; +M: fd drain + fd>> over buffer>> [ buffer@ ] [ buffer-length ] bi write + { + { [ dup 0 >= ] [ + over buffer>> buffer-consume + buffer>> buffer-empty? f +output+ ? + ] } + { [ err_no EINTR = ] [ 2drop +retry+ ] } + { [ err_no EAGAIN = ] [ 2drop +output+ ] } + [ (io-error) ] + } cond ; -: ( port continuation -- task ) - write-task ; - -M: write-task do-io-task - io-task-port dup [ buffer>> buffer-empty? ] [ port-error ] bi or - [ 0 swap buffer>> buffer-reset t ] [ write-step ] if ; - -: add-write-io-task ( port continuation -- ) - over handle>> mx get-global writes>> at* - [ io-task-callbacks push drop ] - [ drop add-io-task ] if ; - -: (wait-to-write) ( port -- ) - [ add-write-io-task ] with-port-continuation drop ; - -M: output-port port-flush ( port -- ) - dup buffer>> buffer-empty? [ drop ] [ (wait-to-write) ] if ; +M: unix (wait-to-write) ( port -- ) + dup dup handle>> drain dup [ wait-for-port ] [ 2drop ] if ; M: unix io-multiplex ( ms/f -- ) mx get-global wait-for-events ; M: unix (init-stdio) ( -- ) - 0 - 1 - 2 ; + 0 + 1 + 2 ; ! mx io-task for embedding an fd-based mx inside another mx TUPLE: mx-port < port mx ; @@ -195,16 +160,11 @@ TUPLE: mx-port < port mx ; : ( mx -- port ) dup fd>> mx-port swap >>mx ; -TUPLE: mx-task < io-task ; - -: ( port -- task ) - f mx-task ; - -M: mx-task do-io-task - port>> mx>> 0 swap wait-for-events f ; - : multiplexer-error ( n -- ) - 0 < [ err_no ignorable-error? [ (io-error) ] unless ] when ; + 0 < [ + err_no [ EAGAIN = ] [ EINTR = ] bi or + [ (io-error) ] unless + ] when ; : ?flag ( n mask symbol -- n ) pick rot bitand 0 > [ , ] [ drop ] if ; diff --git a/extra/io/unix/bsd/bsd.factor b/extra/io/unix/bsd/bsd.factor index d74c355642..c8219a9f63 100755 --- a/extra/io/unix/bsd/bsd.factor +++ b/extra/io/unix/bsd/bsd.factor @@ -3,16 +3,16 @@ IN: io.unix.bsd USING: namespaces system kernel accessors assocs continuations unix -io.backend io.unix.backend io.unix.select io.unix.kqueue io.monitors ; +io.backend io.unix.backend io.unix.select io.monitors ; M: bsd init-io ( -- ) - mx set-global - kqueue-mx set-global - kqueue-mx get-global - dup io-task-fd - [ mx get-global reads>> set-at ] - [ mx get-global writes>> set-at ] 2bi ; + mx set-global ; +! kqueue-mx set-global +! kqueue-mx get-global +! dup io-task-fd +! [ mx get-global reads>> set-at ] +! [ mx get-global writes>> set-at ] 2bi ; -M: bsd (monitor) ( path recursive? mailbox -- ) - swap [ "Recursive kqueue monitors not supported" throw ] when - ; +! M: bsd (monitor) ( path recursive? mailbox -- ) +! swap [ "Recursive kqueue monitors not supported" throw ] when +! ; diff --git a/extra/io/unix/epoll/epoll.factor b/extra/io/unix/epoll/epoll.factor index db1e7086e0..406a7fcb50 100644 --- a/extra/io/unix/epoll/epoll.factor +++ b/extra/io/unix/epoll/epoll.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: alien.c-types kernel io.nonblocking io.unix.backend +USING: alien.c-types kernel io.ports io.unix.backend bit-arrays sequences assocs unix unix.linux.epoll math namespaces structs ; IN: io.unix.epoll @@ -43,10 +43,10 @@ M: epoll-mx unregister-io-task ( task mx -- ) r> epoll_wait dup multiplexer-error ; : epoll-read-task ( mx fd -- ) - over mx-reads at* [ handle-io-task ] [ 2drop ] if ; + over mx-reads at* [ perform-io-task ] [ 2drop ] if ; : epoll-write-task ( mx fd -- ) - over mx-writes at* [ handle-io-task ] [ 2drop ] if ; + over mx-writes at* [ perform-io-task ] [ 2drop ] if ; : handle-event ( mx kevent -- ) epoll-event-fd 2dup epoll-read-task epoll-write-task ; diff --git a/extra/io/unix/files/files.factor b/extra/io/unix/files/files.factor index a09ebb46c9..9f554a044b 100755 --- a/extra/io/unix/files/files.factor +++ b/extra/io/unix/files/files.factor @@ -1,59 +1,58 @@ ! Copyright (C) 2005, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: io.backend io.nonblocking io.unix.backend io.files io +USING: io.backend io.ports io.unix.backend io.files io unix unix.stat unix.time kernel math continuations math.bitfields byte-arrays alien combinators calendar io.encodings.binary accessors sequences strings system -io.files.private ; +io.files.private destructors ; IN: io.unix.files M: unix cwd ( -- path ) - MAXPATHLEN [ ] [ ] bi getcwd + MAXPATHLEN [ ] keep getcwd [ (io-error) ] unless* ; -M: unix cd ( path -- ) - chdir io-error ; +M: unix cd ( path -- ) [ chdir ] unix-system-call drop ; : read-flags O_RDONLY ; inline -: open-read ( path -- fd ) - O_RDONLY file-mode open dup io-error ; +: open-read ( path -- fd ) O_RDONLY file-mode open-file ; M: unix (file-reader) ( path -- stream ) - open-read ; + open-read ; : write-flags { O_WRONLY O_CREAT O_TRUNC } flags ; inline : open-write ( path -- fd ) - write-flags file-mode open dup io-error ; + write-flags file-mode open-file ; M: unix (file-writer) ( path -- stream ) - open-write ; + open-write ; : append-flags { O_WRONLY O_APPEND O_CREAT } flags ; inline : open-append ( path -- fd ) - append-flags file-mode open dup io-error - [ dup 0 SEEK_END lseek io-error ] [ ] [ close ] cleanup ; + [ + append-flags file-mode open-file |dispose + dup 0 SEEK_END lseek io-error + ] with-destructors ; M: unix (file-appender) ( path -- stream ) - open-append ; + open-append ; : touch-mode ( -- n ) { O_WRONLY O_APPEND O_CREAT O_EXCL } flags ; foldable M: unix touch-file ( path -- ) normalize-path - touch-mode file-mode open - dup 0 < [ err_no EEXIST = [ err_no io-error ] unless ] when - close ; + dup exists? [ touch ] [ + touch-mode file-mode open-file close-file + ] if ; M: unix move-file ( from to -- ) [ normalize-path ] bi@ rename io-error ; -M: unix delete-file ( path -- ) - normalize-path unlink io-error ; +M: unix delete-file ( path -- ) normalize-path unlink-file ; M: unix make-directory ( path -- ) normalize-path OCT: 777 mkdir io-error ; @@ -97,15 +96,13 @@ M: unix copy-file ( from to -- ) \ file-info boa ; M: unix file-info ( path -- info ) - normalize-path stat* stat>file-info ; + normalize-path file-status stat>file-info ; M: unix link-info ( path -- info ) - normalize-path lstat* stat>file-info ; + normalize-path link-status stat>file-info ; M: unix make-link ( path1 path2 -- ) normalize-path symlink io-error ; M: unix read-link ( path -- path' ) - normalize-path - PATH_MAX [ tuck ] [ ] bi readlink - dup io-error head-slice >string ; + normalize-path read-symbolic-link ; \ No newline at end of file diff --git a/extra/io/unix/files/unique/unique.factor b/extra/io/unix/files/unique/unique.factor index 035e6398ee..dca2f51958 100644 --- a/extra/io/unix/files/unique/unique.factor +++ b/extra/io/unix/files/unique/unique.factor @@ -1,4 +1,4 @@ -USING: kernel io.nonblocking io.unix.backend math.bitfields +USING: kernel io.ports io.unix.backend math.bitfields unix io.files.unique.backend system ; IN: io.unix.files.unique @@ -6,6 +6,6 @@ IN: io.unix.files.unique { O_RDWR O_CREAT O_EXCL } flags ; M: unix (make-unique-file) ( path -- ) - open-unique-flags file-mode open dup io-error close ; + open-unique-flags file-mode open-file close-file ; M: unix temporary-path ( -- path ) "/tmp" ; diff --git a/extra/io/unix/kqueue/kqueue.factor b/extra/io/unix/kqueue/kqueue.factor old mode 100644 new mode 100755 index 8e8fb0ec74..8888d0182f --- a/extra/io/unix/kqueue/kqueue.factor +++ b/extra/io/unix/kqueue/kqueue.factor @@ -4,7 +4,7 @@ USING: alien.c-types kernel math math.bitfields namespaces locals accessors combinators threads vectors hashtables sequences assocs continuations sets unix unix.time unix.kqueue unix.process -io.nonblocking io.unix.backend io.launcher io.unix.launcher +io.ports io.unix.backend io.launcher io.unix.launcher io.monitors ; IN: io.unix.kqueue @@ -57,10 +57,10 @@ M: kqueue-mx unregister-io-task ( task mx -- ) dup multiplexer-error ; :: kevent-read-task ( mx fd kevent -- ) - mx fd mx reads>> at handle-io-task ; + mx fd mx reads>> at perform-io-task ; :: kevent-write-task ( mx fd kevent -- ) - mx fd mx writes>> at handle-io-task ; + mx fd mx writes>> at perform-io-task ; :: kevent-proc-task ( mx pid kevent -- ) pid wait-for-pid diff --git a/extra/io/unix/launcher/launcher-tests.factor b/extra/io/unix/launcher/launcher-tests.factor index 7e527196be..6d1f7f1796 100755 --- a/extra/io/unix/launcher/launcher-tests.factor +++ b/extra/io/unix/launcher/launcher-tests.factor @@ -1,7 +1,7 @@ IN: io.unix.launcher.tests USING: io.files tools.test io.launcher arrays io namespaces continuations math io.encodings.binary io.encodings.ascii -accessors kernel sequences io.encodings.utf8 ; +accessors kernel sequences io.encodings.utf8 destructors ; [ ] [ [ "launcher-test-1" temp-file delete-file ] ignore-errors @@ -31,16 +31,7 @@ accessors kernel sequences io.encodings.utf8 ; "cat" "launcher-test-1" temp-file 2array - ascii contents -] unit-test - -[ f ] [ - - "cat" - "launcher-test-1" temp-file - 2array >>command - +inherit+ >>stdout - ascii contents + ascii contents ] unit-test [ ] [ @@ -59,7 +50,7 @@ accessors kernel sequences io.encodings.utf8 ; "cat" "launcher-test-1" temp-file 2array - ascii contents + ascii contents ] unit-test [ ] [ @@ -77,14 +68,14 @@ accessors kernel sequences io.encodings.utf8 ; "cat" "launcher-test-1" temp-file 2array - ascii contents + ascii contents ] unit-test [ t ] [ "env" >>command { { "A" "B" } } >>environment - ascii lines + ascii lines "A=B" swap member? ] unit-test @@ -93,7 +84,7 @@ accessors kernel sequences io.encodings.utf8 ; "env" >>command { { "A" "B" } } >>environment +replace-environment+ >>environment-mode - ascii lines + ascii lines ] unit-test [ "hi\n" ] [ @@ -107,3 +98,17 @@ accessors kernel sequences io.encodings.utf8 ; temp-directory "aloha" append-path utf8 file-contents ] unit-test + +[ "append-test" temp-file delete-file ] ignore-errors + +[ "hi\nhi\n" ] [ + 2 [ + + "echo hi" >>command + "append-test" temp-file >>stdout + try-process + ] times + "append-test" temp-file utf8 file-contents +] unit-test + +[ ] [ "ls" utf8 contents drop ] unit-test diff --git a/extra/io/unix/launcher/launcher.factor b/extra/io/unix/launcher/launcher.factor index 2c1e6261c0..7f6b3396a1 100755 --- a/extra/io/unix/launcher/launcher.factor +++ b/extra/io/unix/launcher/launcher.factor @@ -1,10 +1,12 @@ ! Copyright (C) 2007, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: io io.backend io.launcher io.nonblocking io.unix.backend -io.unix.files io.nonblocking sequences kernel namespaces math -system alien.c-types debugger continuations arrays assocs -combinators unix.process strings threads unix -io.unix.launcher.parser accessors io.files io.files.private ; +USING: kernel namespaces math system sequences debugger +continuations arrays assocs combinators alien.c-types strings +threads accessors +io io.backend io.launcher io.ports io.files +io.files.private io.unix.files io.unix.backend +io.unix.launcher.parser +unix unix.process ; IN: io.unix.launcher ! Search unix first @@ -29,36 +31,39 @@ USE: unix ] when* ; : redirect-fd ( oldfd fd -- ) - 2dup = [ 2drop ] [ dupd dup2 io-error close ] if ; + 2dup = [ 2drop ] [ dupd dup2 io-error close-file ] if ; : reset-fd ( fd -- ) #! We drop the error code because on *BSD, fcntl of #! /dev/null fails. - F_SETFL 0 fcntl drop ; + [ F_SETFL 0 fcntl drop ] + [ F_SETFD 0 fcntl drop ] bi ; : redirect-inherit ( obj mode fd -- ) 2nip reset-fd ; : redirect-file ( obj mode fd -- ) >r >r normalize-path r> file-mode - open dup io-error r> redirect-fd ; + open-file r> redirect-fd ; + +: redirect-file-append ( obj mode fd -- ) + >r drop path>> normalize-path open-append r> redirect-fd ; : redirect-closed ( obj mode fd -- ) >r >r drop "/dev/null" r> r> redirect-file ; -: redirect-stream ( obj mode fd -- ) - >r drop underlying-handle dup reset-fd r> redirect-fd ; - : redirect ( obj mode fd -- ) { { [ pick not ] [ redirect-inherit ] } { [ pick string? ] [ redirect-file ] } + { [ pick appender? ] [ redirect-file-append ] } { [ pick +closed+ eq? ] [ redirect-closed ] } - { [ pick +inherit+ eq? ] [ redirect-closed ] } - [ redirect-stream ] + { [ pick fd? ] [ >r drop fd>> dup reset-fd r> redirect-fd ] } + [ >r >r underlying-handle r> r> redirect ] } cond ; -: ?closed dup +closed+ eq? [ drop "/dev/null" ] when ; +: ?closed ( obj -- obj' ) + dup +closed+ eq? [ drop "/dev/null" ] when ; : setup-redirection ( process -- process ) dup stdin>> ?closed read-flags 0 redirect @@ -90,27 +95,10 @@ M: unix run-process* ( process -- pid ) M: unix kill-process* ( pid -- ) SIGTERM kill io-error ; -: open-pipe ( -- pair ) - 2 "int" dup pipe zero? - [ 2 c-int-array> ] [ drop f ] if ; - -: setup-stdio-pipe ( stdin stdout -- ) - 2dup first close second close - >r first 0 dup2 drop r> second 1 dup2 drop ; - -M: unix (process-stream) - >r open-pipe open-pipe r> - [ >r setup-stdio-pipe r> spawn-process ] curry - [ -rot 2dup second close first close ] - with-fork - first swap second ; - : find-process ( handle -- process ) processes get swap [ nip swap handle>> = ] curry assoc-find 2drop ; -! Inefficient process wait polling, used on Linux and Solaris. -! On BSD and Mac OS X, we use kqueue() which scales better. M: unix wait-for-processes ( -- ? ) -1 0 tuck WNOHANG waitpid dup 0 <= [ diff --git a/extra/io/unix/launcher/parser/parser.factor b/extra/io/unix/launcher/parser/parser.factor index f3bb82343a..e5e83ab4e9 100755 --- a/extra/io/unix/launcher/parser/parser.factor +++ b/extra/io/unix/launcher/parser/parser.factor @@ -1,7 +1,6 @@ ! Copyright (C) 2008 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. -USING: peg peg.parsers kernel sequences strings words -memoize ; +USING: peg peg.parsers kernel sequences strings words ; IN: io.unix.launcher.parser ! Our command line parser. Supported syntax: @@ -9,20 +8,20 @@ IN: io.unix.launcher.parser ! foo\ bar -- escaping the space ! 'foo bar' -- quotation ! "foo bar" -- quotation -MEMO: 'escaped-char' ( -- parser ) - "\\" token [ drop t ] satisfy 2seq [ second ] action ; +: 'escaped-char' ( -- parser ) + "\\" token any-char 2seq [ second ] action ; -MEMO: 'quoted-char' ( delimiter -- parser' ) +: 'quoted-char' ( delimiter -- parser' ) 'escaped-char' swap [ member? not ] curry satisfy 2choice ; inline -MEMO: 'quoted' ( delimiter -- parser ) +: 'quoted' ( delimiter -- parser ) dup 'quoted-char' repeat0 swap dup surrounded-by ; -MEMO: 'unquoted' ( -- parser ) " '\"" 'quoted-char' repeat1 ; +: 'unquoted' ( -- parser ) " '\"" 'quoted-char' repeat1 ; -MEMO: 'argument' ( -- parser ) +: 'argument' ( -- parser ) "\"" 'quoted' "'" 'quoted' 'unquoted' 3choice diff --git a/extra/io/unix/linux/monitors/monitors.factor b/extra/io/unix/linux/monitors/monitors.factor index cd17dfbbce..a59d5dfb4d 100644 --- a/extra/io/unix/linux/monitors/monitors.factor +++ b/extra/io/unix/linux/monitors/monitors.factor @@ -1,18 +1,18 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel io.backend io.monitors io.monitors.recursive -io.files io.buffers io.monitors io.nonblocking io.timeouts +io.files io.buffers io.monitors io.ports io.timeouts io.unix.backend io.unix.select io.encodings.utf8 unix.linux.inotify assocs namespaces threads continuations init math math.bitfields sets alien alien.strings alien.c-types -vocabs.loader accessors system hashtables ; +vocabs.loader accessors system hashtables destructors unix ; IN: io.unix.linux.monitors SYMBOL: watches SYMBOL: inotify -TUPLE: linux-monitor < monitor wd inotify watches ; +TUPLE: linux-monitor < monitor wd inotify watches disposed ; : ( wd path mailbox -- monitor ) linux-monitor new-monitor @@ -23,9 +23,9 @@ TUPLE: linux-monitor < monitor wd inotify watches ; : wd>monitor ( wd -- monitor ) watches get at ; : ( -- port/f ) - inotify_init dup 0 < [ drop f ] [ ] if ; + inotify_init dup 0 < [ drop f ] [ ] if ; -: inotify-fd inotify get handle>> ; +: inotify-fd ( -- fd ) inotify get handle>> handle-fd ; : check-existing ( wd -- ) watches get key? [ @@ -41,7 +41,7 @@ TUPLE: linux-monitor < monitor wd inotify watches ; [ (add-watch) ] [ drop ] 2bi r> [ ] [ ] [ wd>> ] tri watches get set-at ; -: check-inotify +: check-inotify ( -- ) inotify get [ "Calling outside with-monitors" throw ] unless ; @@ -54,14 +54,14 @@ M: linux (monitor) ( path recursive? mailbox -- monitor ) IN_CHANGE_EVENTS swap add-watch ] if ; -M: linux-monitor dispose ( monitor -- ) - dup inotify>> closed>> [ drop ] [ - [ [ wd>> ] [ watches>> ] bi delete-at ] - [ - [ inotify>> handle>> ] [ wd>> ] bi +M: linux-monitor dispose* ( monitor -- ) + [ [ wd>> ] [ watches>> ] bi delete-at ] + [ + dup inotify>> disposed>> [ drop ] [ + [ inotify>> handle>> handle-fd ] [ wd>> ] bi inotify_rm_watch io-error - ] bi - ] if ; + ] if + ] bi ; : ignore-flags? ( mask -- ? ) { @@ -110,7 +110,8 @@ M: linux-monitor dispose ( monitor -- ) ] if ; : inotify-read-loop ( port -- ) - dup wait-to-read1 + dup check-disposed + dup wait-to-read drop 0 over buffer>> parse-file-notifications 0 over buffer>> buffer-reset inotify-read-loop ; diff --git a/extra/io/unix/macosx/macosx.factor b/extra/io/unix/macosx/macosx.factor index 0a0aec6ab6..3471dc856a 100644 --- a/extra/io/unix/macosx/macosx.factor +++ b/extra/io/unix/macosx/macosx.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: io.unix.bsd io.backend io.monitors core-foundation.fsevents continuations kernel sequences namespaces arrays system locals -accessors ; +accessors destructors ; IN: io.unix.macosx TUPLE: macosx-monitor < monitor handle ; @@ -13,9 +13,11 @@ TUPLE: macosx-monitor < monitor handle ; ] curry each ; M:: macosx (monitor) ( path recursive? mailbox -- monitor ) - path mailbox macosx-monitor new-monitor - dup [ enqueue-notifications ] curry - path 1array 0 0 >>handle ; + [let | path [ path normalize-path ] | + path mailbox macosx-monitor new-monitor + dup [ enqueue-notifications ] curry + path 1array 0 0 >>handle + ] ; M: macosx-monitor dispose handle>> dispose ; diff --git a/extra/io/unix/mmap/mmap.factor b/extra/io/unix/mmap/mmap.factor index 2815a49cd3..c31e23849e 100755 --- a/extra/io/unix/mmap/mmap.factor +++ b/extra/io/unix/mmap/mmap.factor @@ -1,22 +1,24 @@ ! Copyright (C) 2007 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: alien io io.files kernel math system unix io.unix.backend -io.mmap ; +USING: alien io io.files kernel math math.bitfields system unix +io.unix.backend io.ports io.mmap destructors locals accessors ; IN: io.unix.mmap -: open-r/w ( path -- fd ) O_RDWR file-mode open dup io-error ; +: open-r/w ( path -- fd ) O_RDWR file-mode open-file ; -: mmap-open ( length prot flags path -- alien fd ) - >r f -roll r> open-r/w [ 0 mmap ] keep - over MAP_FAILED = [ close (io-error) ] when ; +:: mmap-open ( path length prot flags -- alien fd ) + [ + f length prot flags + path open-r/w |dispose + [ 0 mmap dup MAP_FAILED = [ (io-error) ] when ] keep + ] with-destructors ; -M: unix ( path length -- obj ) - swap >r - dup PROT_READ PROT_WRITE bitor MAP_FILE MAP_SHARED bitor - r> mmap-open f mapped-file boa ; +M: unix (mapped-file) + { PROT_READ PROT_WRITE } flags + { MAP_FILE MAP_SHARED } flags + mmap-open ; M: unix close-mapped-file ( mmap -- ) - [ mapped-file-address ] keep - [ mapped-file-length munmap ] keep - mapped-file-handle close - io-error ; + [ [ address>> ] [ length>> ] bi munmap io-error ] + [ handle>> close-file ] + bi ; diff --git a/extra/io/unix/pipes/pipes-tests.factor b/extra/io/unix/pipes/pipes-tests.factor new file mode 100644 index 0000000000..27a490d801 --- /dev/null +++ b/extra/io/unix/pipes/pipes-tests.factor @@ -0,0 +1,17 @@ +USING: tools.test io.pipes io.unix.pipes io.encodings.utf8 +io.encodings io namespaces sequences ; +IN: io.unix.pipes.tests + +[ { 0 0 } ] [ { "ls" "grep x" } run-pipeline ] unit-test + +[ { 0 f 0 } ] [ + { + "ls" + [ + input-stream [ utf8 ] change + output-stream [ utf8 ] change + input-stream get lines reverse [ print ] each f + ] + "grep x" + } run-pipeline +] unit-test diff --git a/extra/io/unix/pipes/pipes.factor b/extra/io/unix/pipes/pipes.factor new file mode 100644 index 0000000000..71366bfa4a --- /dev/null +++ b/extra/io/unix/pipes/pipes.factor @@ -0,0 +1,11 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: system alien.c-types kernel unix math sequences +qualified io.unix.backend io.ports ; +IN: io.unix.pipes +QUALIFIED: io.pipes + +M: unix io.pipes:(pipe) ( -- pair ) + 2 "int" + dup pipe io-error + 2 c-int-array> first2 [ ] bi@ io.pipes:pipe boa ; diff --git a/extra/io/unix/select/select.factor b/extra/io/unix/select/select.factor index 9413556d4f..5f127995c5 100755 --- a/extra/io/unix/select/select.factor +++ b/extra/io/unix/select/select.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2004, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: alien.c-types kernel io.nonblocking io.unix.backend +USING: alien.c-types kernel io.ports io.unix.backend bit-arrays sequences assocs unix math namespaces structs -accessors ; +accessors math.order locals ; IN: io.unix.select TUPLE: select-mx < mx read-fdset write-fdset ; @@ -21,21 +21,20 @@ TUPLE: select-mx < mx read-fdset write-fdset ; : clear-nth ( n seq -- ? ) [ nth ] [ f -rot set-nth ] 2bi ; -: handle-fd ( fd task fdset mx -- ) - roll munge rot clear-nth - [ swap handle-io-task ] [ 2drop ] if ; +:: check-fd ( fd fdset mx quot -- ) + fd munge fdset clear-nth [ fd mx quot call ] when ; inline -: handle-fdset ( tasks fdset mx -- ) - [ handle-fd ] 2curry assoc-each ; +: check-fdset ( fds fdset mx quot -- ) + [ check-fd ] 3curry each ; inline -: init-fdset ( tasks fdset -- ) - [ >r drop t swap munge r> set-nth ] curry assoc-each ; +: init-fdset ( fds fdset -- ) + [ >r t swap munge r> set-nth ] curry each ; -: read-fdset/tasks - [ reads>> ] [ read-fdset>> ] bi ; +: read-fdset/tasks ( mx -- seq fdset ) + [ reads>> keys ] [ read-fdset>> ] bi ; -: write-fdset/tasks - [ writes>> ] [ write-fdset>> ] bi ; +: write-fdset/tasks ( mx -- seq fdset ) + [ writes>> keys ] [ write-fdset>> ] bi ; : max-fd ( assoc -- n ) dup assoc-empty? [ drop 0 ] [ keys supremum ] if ; @@ -45,12 +44,13 @@ TUPLE: select-mx < mx read-fdset write-fdset ; : init-fdsets ( mx -- nfds read write except ) [ num-fds ] - [ read-fdset/tasks tuck init-fdset ] - [ write-fdset/tasks tuck init-fdset ] tri + [ read-fdset/tasks [ init-fdset ] keep ] + [ write-fdset/tasks [ init-fdset ] keep ] tri f ; -M: select-mx wait-for-events ( ms mx -- ) - swap >r dup init-fdsets r> dup [ make-timeval ] when - select multiplexer-error - dup read-fdset/tasks pick handle-fdset - dup write-fdset/tasks rot handle-fdset ; +M:: select-mx wait-for-events ( ms mx -- ) + mx + [ init-fdsets ms dup [ make-timeval ] when select multiplexer-error ] + [ [ read-fdset/tasks ] keep [ input-available ] check-fdset ] + [ [ write-fdset/tasks ] keep [ output-available ] check-fdset ] + tri ; diff --git a/extra/io/unix/sockets/secure/secure-tests.factor b/extra/io/unix/sockets/secure/secure-tests.factor new file mode 100644 index 0000000000..cbda002354 --- /dev/null +++ b/extra/io/unix/sockets/secure/secure-tests.factor @@ -0,0 +1,153 @@ +IN: io.sockets.secure.tests +USING: accessors kernel namespaces io io.sockets +io.sockets.secure io.encodings.ascii io.streams.duplex +io.unix.backend classes words destructors threads tools.test +concurrency.promises byte-arrays locals calendar io.timeouts ; + +\ must-infer +{ 1 0 } [ [ ] with-secure-context ] must-infer-as + +[ ] [ "port" set ] unit-test + +: with-test-context + + "resource:extra/openssl/test/server.pem" >>key-file + "resource:extra/openssl/test/dh1024.pem" >>dh-file + "password" >>password + swap with-secure-context ; + +:: server-test ( quot -- ) + [ + [ + "127.0.0.1" 0 ascii [ + dup addr>> addrspec>> port>> "port" get fulfill + accept [ + quot call + ] curry with-stream + ] with-disposal + ] with-test-context + ] "SSL server test" spawn drop ; + +: client-test + [ + "127.0.0.1" "port" get ?promise ascii drop contents + ] with-secure-context ; + +[ ] [ [ class word-name write ] server-test ] unit-test + +[ "secure" ] [ client-test ] unit-test + +! Now, see what happens if the server closes the connection prematurely +[ ] [ "port" set ] unit-test + +[ ] [ + [ + drop + "hello" write flush + input-stream get stream>> handle>> f >>connected drop + ] server-test +] unit-test + +[ client-test ] [ premature-close? ] must-fail-with + +! Now, try validating the certificate. This should fail because its +! actually an invalid certificate +[ ] [ "port" set ] unit-test + +[ ] [ [ drop "hi" write ] server-test ] unit-test + +[ + [ + "localhost" "port" get ?promise ascii + drop dispose + ] with-secure-context +] [ certificate-verify-error? ] must-fail-with + +! Client-side handshake timeout +[ ] [ "port" set ] unit-test + +[ ] [ + [ + "127.0.0.1" 0 ascii [ + dup addr>> port>> "port" get fulfill + accept drop 1 minutes sleep dispose + ] with-disposal + ] "Silly server" spawn drop +] unit-test + +[ + 1 seconds secure-socket-timeout [ + client-test + ] with-variable +] [ io-timeout? ] must-fail-with + +! Server-side handshake timeout +[ ] [ "port" set ] unit-test + +[ ] [ + [ + "127.0.0.1" "port" get ?promise + ascii drop 1 minutes sleep dispose + ] "Silly client" spawn drop +] unit-test + +[ + 1 seconds secure-socket-timeout [ + [ + "127.0.0.1" 0 ascii [ + dup addr>> addrspec>> port>> "port" get fulfill + accept drop dup stream-read1 drop dispose + ] with-disposal + ] with-test-context + ] with-variable +] [ io-timeout? ] must-fail-with + +! Client socket shutdown timeout + +! Until I sort out two-stage handshaking, I can't do much here +[ + [ ] [ "port" set ] unit-test + + [ ] [ + [ + [ + "127.0.0.1" 0 ascii [ + dup addr>> addrspec>> port>> "port" get fulfill + accept drop 1 minutes sleep dispose + ] with-disposal + ] with-test-context + ] "Silly server" spawn drop + ] unit-test + + [ + 1 seconds secure-socket-timeout [ + [ + "127.0.0.1" "port" get ?promise + ascii drop dispose + ] with-secure-context + ] with-variable + ] [ io-timeout? ] must-fail-with + + ! Server socket shutdown timeout + [ ] [ "port" set ] unit-test + + [ ] [ + [ + [ + "127.0.0.1" "port" get ?promise + ascii drop 1 minutes sleep dispose + ] with-test-context + ] "Silly client" spawn drop + ] unit-test + + [ + 1 seconds secure-socket-timeout [ + [ + "127.0.0.1" 0 ascii [ + dup addr>> addrspec>> port>> "port" get fulfill + accept drop dispose + ] with-disposal + ] with-test-context + ] with-variable + ] [ io-timeout? ] must-fail-with +] drop diff --git a/extra/io/unix/sockets/secure/secure.factor b/extra/io/unix/sockets/secure/secure.factor new file mode 100755 index 0000000000..946e0e7be5 --- /dev/null +++ b/extra/io/unix/sockets/secure/secure.factor @@ -0,0 +1,158 @@ +! Copyright (C) 2007, 2008, Slava Pestov, Elie CHAFTARI. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors unix byte-arrays kernel debugger sequences namespaces math +math.order combinators init alien alien.c-types alien.strings libc +continuations destructors +openssl openssl.libcrypto openssl.libssl +io.files io.ports io.unix.backend io.unix.sockets +io.encodings.ascii io.buffers io.sockets io.sockets.secure +io.timeouts system inspector ; +IN: io.unix.sockets.secure + +M: ssl-handle handle-fd file>> handle-fd ; + +: syscall-error ( r -- * ) + ERR_get_error dup zero? [ + drop + { + { -1 [ err_no ECONNRESET = [ premature-close ] [ (io-error) ] if ] } + { 0 [ premature-close ] } + } case + ] [ + nip (ssl-error) + ] if ; + +: check-accept-response ( handle r -- event ) + over handle>> over SSL_get_error + { + { SSL_ERROR_NONE [ 2drop f ] } + { SSL_ERROR_WANT_READ [ 2drop +input+ ] } + { SSL_ERROR_WANT_WRITE [ 2drop +output+ ] } + { SSL_ERROR_SYSCALL [ syscall-error ] } + { SSL_ERROR_SSL [ (ssl-error) ] } + } case ; + +: do-ssl-accept ( ssl-handle -- ) + dup dup handle>> SSL_accept check-accept-response dup + [ >r dup file>> r> wait-for-fd do-ssl-accept ] [ 2drop ] if ; + +: maybe-handshake ( ssl-handle -- ) + dup connected>> [ drop ] [ + t >>connected + [ do-ssl-accept ] with-timeout + ] if ; + +: check-response ( port r -- port r n ) + over handle>> handle>> over SSL_get_error ; inline + +! Input ports +: check-read-response ( port r -- event ) + check-response + { + { SSL_ERROR_NONE [ swap buffer>> n>buffer f ] } + { SSL_ERROR_ZERO_RETURN [ 2drop f ] } + { SSL_ERROR_WANT_READ [ 2drop +input+ ] } + { SSL_ERROR_WANT_WRITE [ 2drop +output+ ] } + { SSL_ERROR_SYSCALL [ syscall-error ] } + { SSL_ERROR_SSL [ (ssl-error) ] } + } case ; + +M: ssl-handle refill + dup maybe-handshake + handle>> ! ssl + over buffer>> + [ buffer-end ] ! buf + [ buffer-capacity ] bi ! len + SSL_read + check-read-response ; + +! Output ports +: check-write-response ( port r -- event ) + check-response + { + { SSL_ERROR_NONE [ swap buffer>> buffer-consume f ] } + { SSL_ERROR_WANT_READ [ 2drop +input+ ] } + { SSL_ERROR_WANT_WRITE [ 2drop +output+ ] } + { SSL_ERROR_SYSCALL [ syscall-error ] } + { SSL_ERROR_SSL [ (ssl-error) ] } + } case ; + +M: ssl-handle drain + dup maybe-handshake + handle>> ! ssl + over buffer>> + [ buffer@ ] ! buf + [ buffer-length ] bi ! len + SSL_write + check-write-response ; + +M: ssl-handle cancel-operation + file>> cancel-operation ; + +M: ssl-handle timeout + drop secure-socket-timeout get ; + +! Client sockets +: ( fd -- ssl ) + [ fd>> BIO_NOCLOSE BIO_new_socket dup ssl-error ] keep + [ handle>> swap dup SSL_set_bio ] keep ; + +M: secure ((client)) ( addrspec -- handle ) + addrspec>> ((client)) ; + +M: secure parse-sockaddr addrspec>> parse-sockaddr ; + +M: secure (get-local-address) addrspec>> (get-local-address) ; + +: check-connect-response ( ssl-handle r -- event ) + over handle>> over SSL_get_error + { + { SSL_ERROR_NONE [ 2drop f ] } + { SSL_ERROR_WANT_READ [ 2drop +input+ ] } + { SSL_ERROR_WANT_WRITE [ 2drop +output+ ] } + { SSL_ERROR_SYSCALL [ syscall-error ] } + { SSL_ERROR_SSL [ (ssl-error) ] } + } case ; + +: do-ssl-connect ( ssl-handle -- ) + dup dup handle>> SSL_connect check-connect-response dup + [ dupd wait-for-fd do-ssl-connect ] [ 2drop ] if ; + +M: secure establish-connection ( client-out remote -- ) + [ addrspec>> establish-connection ] + [ + drop handle>> + [ [ do-ssl-connect ] with-timeout ] + [ t >>connected drop ] + bi + ] 2bi ; + +M: secure (server) addrspec>> (server) ; + +M: secure (accept) + [ + addrspec>> (accept) >r |dispose r> + ] with-destructors ; + +: check-shutdown-response ( handle r -- event ) + #! We don't do two-step shutdown here because I couldn't + #! figure out how to do it with non-blocking BIOs. Also, it + #! seems that SSL_shutdown always returns 0 -- this sounds + #! like a bug + over handle>> over SSL_get_error + { + { SSL_ERROR_NONE [ 2drop f ] } + { SSL_ERROR_WANT_READ [ 2drop +input+ ] } + { SSL_ERROR_WANT_WRITE [ 2drop +output+ ] } + { SSL_ERROR_SYSCALL [ dup zero? [ 2drop f ] [ syscall-error ] if ] } + { SSL_ERROR_SSL [ (ssl-error) ] } + } case ; + +: (shutdown) ( handle -- ) + dup dup handle>> SSL_shutdown check-shutdown-response + dup [ dupd wait-for-fd (shutdown) ] [ 2drop ] if ; + +M: ssl-handle shutdown + dup connected>> [ + f >>connected [ (shutdown) ] with-timeout + ] [ drop ] if ; diff --git a/extra/io/unix/sockets/sockets.factor b/extra/io/unix/sockets/sockets.factor index b60cb5760e..d4059c102a 100755 --- a/extra/io/unix/sockets/sockets.factor +++ b/extra/io/unix/sockets/sockets.factor @@ -1,108 +1,96 @@ ! Copyright (C) 2004, 2008 Slava Pestov, Ivan Tikhonov. ! See http://factorcode.org/license.txt for BSD license. USING: alien alien.c-types alien.strings generic kernel math -namespaces threads sequences byte-arrays io.nonblocking -io.binary io.unix.backend io.streams.duplex io.sockets.impl -io.backend io.files io.files.private io.encodings.utf8 -math.parser continuations libc combinators system accessors -qualified unix ; +namespaces threads sequences byte-arrays io.ports +io.binary io.unix.backend io.streams.duplex +io.backend io.ports io.files io.files.private +io.encodings.utf8 math.parser continuations libc combinators +system accessors qualified destructors unix locals ; EXCLUDE: io => read write close ; EXCLUDE: io.sockets => accept ; IN: io.unix.sockets -: pending-init-error ( port -- ) - #! We close it here to avoid a resource leak; callers of - #! don't set up error handlers until after - #! returns (and if they did before, they wouldn't have - #! anything to close!) - dup port-error dup [ swap dispose throw ] [ 2drop ] if ; +: socket-fd ( domain type -- fd ) + 0 socket dup io-error |dispose ; -: socket-fd ( domain type -- socket ) - 0 socket dup io-error dup init-handle ; - -: sockopt ( fd level opt -- ) - 1 "int" heap-size setsockopt io-error ; +: set-socket-option ( fd level opt -- ) + >r >r handle-fd r> r> 1 "int" heap-size setsockopt io-error ; M: unix addrinfo-error ( n -- ) dup zero? [ drop ] [ gai_strerror throw ] if ; ! Client sockets - TCP and Unix domain +M: object (get-local-address) ( handle remote -- sockaddr ) + >r handle-fd r> empty-sockaddr/size + [ getsockname io-error ] 2keep drop ; + +M: object (get-remote-address) ( handle local -- sockaddr ) + >r handle-fd r> empty-sockaddr/size + [ getpeername io-error ] 2keep drop ; + : init-client-socket ( fd -- ) - SOL_SOCKET SO_OOBINLINE sockopt ; - -TUPLE: connect-task < output-task ; - -: ( port continuation -- task ) - connect-task ; - -M: connect-task do-io-task - port>> dup handle>> f 0 write - 0 < [ defer-error ] [ drop t ] if ; + SOL_SOCKET SO_OOBINLINE set-socket-option ; : wait-to-connect ( port -- ) - [ add-io-task ] with-port-continuation drop ; + dup handle>> handle-fd f 0 write + { + { [ 0 = ] [ drop ] } + { [ err_no EAGAIN = ] [ dup +output+ wait-for-port wait-to-connect ] } + { [ err_no EINTR = ] [ wait-to-connect ] } + [ (io-error) ] + } cond ; -M: unix ((client)) ( addrspec -- client-in client-out ) - dup make-sockaddr/size >r >r - protocol-family SOCK_STREAM socket-fd - dup r> r> connect - zero? err_no EINPROGRESS = or [ - dup init-client-socket - dup - dup wait-to-connect - dup pending-init-error - ] [ - dup close (io-error) - ] if ; +M: object establish-connection ( client-out remote -- ) + [ drop ] [ [ handle>> handle-fd ] [ make-sockaddr/size ] bi* connect ] 2bi + { + { [ 0 = ] [ drop ] } + { [ err_no EINPROGRESS = ] [ + [ +output+ wait-for-port ] [ wait-to-connect ] bi + ] } + [ (io-error) ] + } cond ; + +M: object ((client)) ( addrspec -- fd ) + protocol-family SOCK_STREAM socket-fd dup init-client-socket ; ! Server sockets - TCP and Unix domain : init-server-socket ( fd -- ) - SOL_SOCKET SO_REUSEADDR sockopt ; + SOL_SOCKET SO_REUSEADDR set-socket-option ; -TUPLE: accept-task < input-task ; - -: ( port continuation -- task ) - accept-task ; - -: accept-sockaddr ( port -- fd sockaddr ) - dup port-handle swap server-port-addr sockaddr-type - dup [ swap heap-size accept ] keep ; inline - -: do-accept ( port fd sockaddr -- ) - rot - [ server-port-addr parse-sockaddr ] keep - [ set-server-port-client-addr ] keep - set-server-port-client ; - -M: accept-task do-io-task - io-task-port dup accept-sockaddr - over 0 >= [ do-accept t ] [ 2drop defer-error ] if ; - -: wait-to-accept ( server -- ) - [ add-io-task ] with-port-continuation drop ; - -: server-fd ( addrspec type -- fd ) - >r dup protocol-family r> socket-fd +: server-socket-fd ( addrspec type -- fd ) + >r dup protocol-family r> socket-fd dup init-server-socket - dup rot make-sockaddr/size bind - zero? [ dup close (io-error) ] unless ; + dup handle-fd rot make-sockaddr/size bind io-error ; -M: unix (server) ( addrspec -- handle ) - SOCK_STREAM server-fd - dup 10 listen zero? [ dup close (io-error) ] unless ; +M: object (server) ( addrspec -- handle ) + [ + SOCK_STREAM server-socket-fd + dup handle-fd 10 listen io-error + ] with-destructors ; -M: unix (accept) ( server -- addrspec handle ) - #! Wait for a client connection. - check-server-port - [ wait-to-accept ] - [ pending-error ] - [ [ client-addr>> ] [ client>> ] bi ] tri ; +: do-accept ( server addrspec -- fd sockaddr ) + [ handle>> handle-fd ] [ empty-sockaddr/size ] bi* + [ accept ] 2keep drop ; inline + +M: object (accept) ( server addrspec -- fd sockaddr ) + 2dup do-accept + { + { [ over 0 >= ] [ >r 2nip r> ] } + { [ err_no EINTR = ] [ 2drop (accept) ] } + { [ err_no EAGAIN = ] [ + 2drop + [ drop +input+ wait-for-port ] + [ (accept) ] + 2bi + ] } + [ (io-error) ] + } cond ; ! Datagram sockets - UDP and Unix domain -M: unix - [ SOCK_DGRAM server-fd ] keep ; +M: unix (datagram) + [ SOCK_DGRAM server-socket-fd ] with-destructors ; SYMBOL: receive-buffer @@ -110,76 +98,45 @@ SYMBOL: receive-buffer packet-size receive-buffer set-global -: setup-receive ( port -- s buffer len flags from fromlen ) - dup port-handle - swap datagram-port-addr sockaddr-type - dup swap heap-size - >r >r receive-buffer get-global packet-size 0 r> r> ; +:: do-receive ( port -- packet sockaddr ) + port addr>> empty-sockaddr/size [| sockaddr len | + port handle>> handle-fd ! s + receive-buffer get-global ! buf + packet-size ! nbytes + 0 ! flags + sockaddr ! from + len ! fromlen + recvfrom dup 0 >= [ + receive-buffer get-global swap head sockaddr + ] [ + drop f f + ] if + ] call ; -: do-receive ( s buffer len flags from fromlen -- sockaddr data ) - over >r recvfrom r> - over -1 = [ - 2drop f f - ] [ - receive-buffer get-global - rot head +M: unix (receive) ( datagram -- packet sockaddr ) + dup do-receive dup [ rot drop ] [ + 2drop [ +input+ wait-for-port ] [ (receive) ] bi ] if ; -TUPLE: receive-task < input-task ; +:: do-send ( packet sockaddr len socket datagram -- ) + socket handle-fd packet dup length 0 sockaddr len sendto + 0 < [ + err_no EINTR = [ + packet sockaddr len socket datagram do-send + ] [ + err_no EAGAIN = [ + datagram +output+ wait-for-port + packet sockaddr len socket datagram do-send + ] [ + (io-error) + ] if + ] if + ] when ; -: ( stream continuation -- task ) - receive-task ; - -M: receive-task do-io-task - io-task-port - dup setup-receive do-receive dup [ - pick set-datagram-port-packet - over datagram-port-addr parse-sockaddr - swap set-datagram-port-packet-addr - t - ] [ - 2drop defer-error - ] if ; - -: wait-receive ( stream -- ) - [ add-io-task ] with-port-continuation drop ; - -M: unix receive ( datagram -- packet addrspec ) - check-datagram-port - [ wait-receive ] - [ pending-error ] - [ [ packet>> ] [ packet-addr>> ] bi ] tri ; - -: do-send ( socket data sockaddr len -- n ) - >r >r dup length 0 r> r> sendto ; - -TUPLE: send-task < output-task packet sockaddr len ; - -: ( packet sockaddr len stream continuation -- task ) - send-task [ - { - set-send-task-packet - set-send-task-sockaddr - set-send-task-len - } set-slots - ] keep ; - -M: send-task do-io-task - [ io-task-port port-handle ] keep - [ send-task-packet ] keep - [ send-task-sockaddr ] keep - [ send-task-len do-send ] keep - swap 0 < [ io-task-port defer-error ] [ drop t ] if ; - -: wait-send ( packet sockaddr len stream -- ) - [ add-io-task ] with-port-continuation - 2drop 2drop ; - -M: unix send ( packet addrspec datagram -- ) - check-datagram-send - [ >r make-sockaddr/size r> wait-send ] keep - pending-error ; +M: unix (send) ( packet addrspec datagram -- ) + [ make-sockaddr/size ] [ [ handle>> ] keep ] bi* do-send ; +! Unix domain sockets M: local protocol-family drop PF_UNIX ; M: local sockaddr-type drop "sockaddr-un" c-type ; diff --git a/extra/io/unix/unix-tests.factor b/extra/io/unix/unix-tests.factor index ff315bc529..3147d7144b 100755 --- a/extra/io/unix/unix-tests.factor +++ b/extra/io/unix/unix-tests.factor @@ -1,6 +1,7 @@ USING: io.files io.sockets io kernel threads namespaces tools.test continuations strings byte-arrays -sequences prettyprint system io.encodings.binary io.encodings.ascii ; +sequences prettyprint system io.encodings.binary io.encodings.ascii +io.streams.duplex destructors ; IN: io.unix.tests ! Unix domain stream sockets @@ -24,12 +25,11 @@ yield [ { "Hello world" "FOO" } ] [ [ - socket-server ascii - [ + socket-server ascii [ readln , "XYZ" print flush readln , - ] with-stream + ] with-client ] { } make ] unit-test @@ -125,16 +125,16 @@ datagram-client delete-file ! Invalid parameter tests [ - image binary [ stdio get accept ] with-file-reader + image binary [ input-stream get accept ] with-file-reader ] must-fail [ - image binary [ stdio get receive ] with-file-reader + image binary [ input-stream get receive ] with-file-reader ] must-fail [ image binary [ B{ 1 2 } datagram-server - stdio get send + input-stream get send ] with-file-reader ] must-fail diff --git a/extra/io/unix/unix.factor b/extra/io/unix/unix.factor index 1e5638fb4a..3a379de78f 100755 --- a/extra/io/unix/unix.factor +++ b/extra/io/unix/unix.factor @@ -1,5 +1,13 @@ -USING: io.unix.backend io.unix.files io.unix.sockets io.timeouts -io.unix.launcher io.unix.mmap io.backend combinators namespaces -system vocabs.loader sequences words init ; +USING: system words sequences vocabs.loader ; + +{ + "io.unix.backend" + "io.unix.files" + "io.unix.sockets" + "io.unix.sockets.secure" + "io.unix.launcher" + "io.unix.mmap" + "io.unix.pipes" +} [ require ] each "io.unix." os word-name append require diff --git a/extra/io/windows/ce/backend/backend.factor b/extra/io/windows/ce/backend/backend.factor index a8ff4c14e3..7209a68ebf 100755 --- a/extra/io/windows/ce/backend/backend.factor +++ b/extra/io/windows/ce/backend/backend.factor @@ -1,4 +1,4 @@ -USING: io.nonblocking io.windows threads.private kernel +USING: io.ports io.windows threads.private kernel io.backend windows.winsock windows.kernel32 windows io.streams.duplex io namespaces alien.syntax system combinators io.buffers io.encodings io.encodings.utf8 combinators.lib ; @@ -46,5 +46,5 @@ M: wince (init-stdio) ( -- ) 1 _getstdfilex _fileno 2 _getstdfilex _fileno ] if [ f ] 3apply - rot -rot [ ] bi@ + [ ] [ ] [ ] tri* ] with-variable ; diff --git a/extra/io/windows/ce/files/files.factor b/extra/io/windows/ce/files/files.factor index 8f7390aa7c..83d456832b 100755 --- a/extra/io/windows/ce/files/files.factor +++ b/extra/io/windows/ce/files/files.factor @@ -1,5 +1,5 @@ USING: alien alien.c-types combinators io io.backend io.buffers -io.files io.nonblocking io.windows kernel libc math namespaces +io.files io.ports io.windows kernel libc math namespaces prettyprint sequences strings threads threads.private windows windows.kernel32 io.windows.ce.backend system ; IN: windows.ce.files diff --git a/extra/io/windows/ce/privileges/privileges.factor b/extra/io/windows/ce/privileges/privileges.factor new file mode 100755 index 0000000000..e0aa186b3d --- /dev/null +++ b/extra/io/windows/ce/privileges/privileges.factor @@ -0,0 +1,4 @@ +IN: io.windows.ce.privileges +USING: io.windows.privileges system ; + +M: wince set-privilege 2drop ; diff --git a/extra/io/windows/ce/sockets/sockets.factor b/extra/io/windows/ce/sockets/sockets.factor index 0001bb5142..b3117dcde1 100755 --- a/extra/io/windows/ce/sockets/sockets.factor +++ b/extra/io/windows/ce/sockets/sockets.factor @@ -1,5 +1,5 @@ USING: alien alien.c-types combinators io io.backend io.buffers -io.nonblocking io.sockets io.sockets.impl io.windows kernel libc +io.ports io.sockets io.windows kernel libc math namespaces prettyprint qualified sequences strings threads threads.private windows windows.kernel32 io.windows.ce.backend byte-arrays system ; @@ -32,7 +32,7 @@ M: win32-socket wince-write ( port port-handle -- ) windows.winsock:winsock-error!=0/f ; M: wince (client) ( addrspec -- reader writer ) - do-connect dup ; + do-connect dup ; M: wince (server) ( addrspec -- handle ) windows.winsock:SOCK_STREAM server-fd @@ -41,7 +41,6 @@ M: wince (server) ( addrspec -- handle ) M: wince (accept) ( server -- client ) [ - dup check-server-port [ dup port-handle win32-file-handle swap server-port-addr sockaddr-type heap-size @@ -52,7 +51,7 @@ M: wince (accept) ( server -- client ) [ windows.winsock:winsock-error ] when ] keep ] keep server-port-addr parse-sockaddr swap - + ] with-timeout ; M: wince ( addrspec -- datagram ) diff --git a/extra/io/windows/files/files.factor b/extra/io/windows/files/files.factor index 8a15a57f83..6787936f96 100755 --- a/extra/io/windows/files/files.factor +++ b/extra/io/windows/files/files.factor @@ -1,11 +1,121 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: alien.c-types io.backend io.files io.windows kernel math +USING: alien.c-types io.binary io.backend io.files io.buffers +io.windows kernel math splitting windows windows.kernel32 windows.time calendar combinators math.functions sequences namespaces words symbols system -combinators.lib io.nonblocking destructors math.bitfields.lib ; +combinators.lib io.ports destructors accessors +math.bitfields math.bitfields.lib ; IN: io.windows.files +: open-file ( path access-mode create-mode flags -- handle ) + [ + >r >r share-mode security-attributes-inherit r> r> + CreateFile-flags f CreateFile opened-file + ] with-destructors ; + +: open-pipe-r/w ( path -- win32-file ) + { GENERIC_READ GENERIC_WRITE } flags + OPEN_EXISTING 0 open-file ; + +: open-read ( path -- win32-file ) + GENERIC_READ OPEN_EXISTING 0 open-file 0 >>ptr ; + +: open-write ( path -- win32-file ) + GENERIC_WRITE CREATE_ALWAYS 0 open-file 0 >>ptr ; + +: (open-append) ( path -- win32-file ) + GENERIC_WRITE OPEN_ALWAYS 0 open-file ; + +: open-existing ( path -- win32-file ) + { GENERIC_READ GENERIC_WRITE } flags + share-mode + f + OPEN_EXISTING + FILE_FLAG_BACKUP_SEMANTICS + f CreateFileW dup win32-error=0/f ; + +: maybe-create-file ( path -- win32-file ? ) + #! return true if file was just created + { GENERIC_READ GENERIC_WRITE } flags + share-mode + f + OPEN_ALWAYS + 0 CreateFile-flags + f CreateFileW dup win32-error=0/f + GetLastError ERROR_ALREADY_EXISTS = not ; + +: set-file-pointer ( handle length method -- ) + >r dupd d>w/w r> SetFilePointer + INVALID_SET_FILE_POINTER = [ + CloseHandle "SetFilePointer failed" throw + ] when drop ; + +HOOK: open-append os ( path -- win32-file ) + +TUPLE: FileArgs + hFile lpBuffer nNumberOfBytesToRead + lpNumberOfBytesRet lpOverlapped ; + +C: FileArgs + +: make-FileArgs ( port -- ) + { + [ handle>> handle>> ] + [ buffer>> ] + [ buffer>> buffer-length ] + [ drop "DWORD" ] + [ FileArgs-overlapped ] + } cleave ; + +: setup-read ( -- hFile lpBuffer nNumberOfBytesToRead lpNumberOfBytesRead lpOverlapped ) + { + [ hFile>> ] + [ lpBuffer>> buffer-end ] + [ lpBuffer>> buffer-capacity ] + [ lpNumberOfBytesRet>> ] + [ lpOverlapped>> ] + } cleave ; + +: setup-write ( -- hFile lpBuffer nNumberOfBytesToWrite lpNumberOfBytesWritten lpOverlapped ) + { + [ hFile>> ] + [ lpBuffer>> buffer@ ] + [ lpBuffer>> buffer-length ] + [ lpNumberOfBytesRet>> ] + [ lpOverlapped>> ] + } cleave ; + +M: windows (file-reader) ( path -- stream ) + open-read ; + +M: windows (file-writer) ( path -- stream ) + open-write ; + +M: windows (file-appender) ( path -- stream ) + open-append ; + +M: windows move-file ( from to -- ) + [ normalize-path ] bi@ MoveFile win32-error=0/f ; + +M: windows delete-file ( path -- ) + normalize-path DeleteFile win32-error=0/f ; + +M: windows copy-file ( from to -- ) + dup parent-directory make-directories + [ normalize-path ] bi@ 0 CopyFile win32-error=0/f ; + +M: windows make-directory ( path -- ) + normalize-path + f CreateDirectory win32-error=0/f ; + +M: windows delete-directory ( path -- ) + normalize-path + RemoveDirectory win32-error=0/f ; + +M: windows normalize-directory ( string -- string ) + normalize-path "\\" ?tail drop "\\*" append ; + SYMBOLS: +read-only+ +hidden+ +system+ +archive+ +device+ +normal+ +temporary+ +sparse-file+ +reparse-point+ +compressed+ +offline+ @@ -36,7 +146,7 @@ SYMBOLS: +read-only+ +hidden+ +system+ : win32-file-type ( n -- symbol ) FILE_ATTRIBUTE_DIRECTORY mask? +directory+ +regular-file+ ? ; -: WIN32_FIND_DATA>file-info +: WIN32_FIND_DATA>file-info ( WIN32_FIND_DATA -- file-info ) { [ WIN32_FIND_DATA-dwFileAttributes win32-file-type ] [ @@ -57,7 +167,7 @@ SYMBOLS: +read-only+ +hidden+ +system+ FindClose win32-error=0/f ] keep ; -: BY_HANDLE_FILE_INFORMATION>file-info +: BY_HANDLE_FILE_INFORMATION>file-info ( HANDLE_FILE_INFORMATION -- file-info ) { [ BY_HANDLE_FILE_INFORMATION-dwFileAttributes win32-file-type ] [ @@ -68,6 +178,11 @@ SYMBOLS: +read-only+ +hidden+ +system+ ! [ BY_HANDLE_FILE_INFORMATION-ftCreationTime FILETIME>timestamp ] [ BY_HANDLE_FILE_INFORMATION-ftLastWriteTime FILETIME>timestamp ] ! [ BY_HANDLE_FILE_INFORMATION-ftLastAccessTime FILETIME>timestamp ] + ! [ BY_HANDLE_FILE_INFORMATION-nNumberOfLinks ] + ! [ + ! [ BY_HANDLE_FILE_INFORMATION-nFileIndexLow ] + ! [ BY_HANDLE_FILE_INFORMATION-nFileIndexHigh ] bi >64bit + ! ] } cleave \ file-info boa ; @@ -96,7 +211,7 @@ M: winnt link-info ( path -- info ) : file-times ( path -- timestamp timestamp timestamp ) [ - normalize-path open-existing dup close-always + normalize-path open-existing &dispose handle>> "FILETIME" "FILETIME" "FILETIME" @@ -112,7 +227,7 @@ M: winnt link-info ( path -- info ) #! timestamp order: creation access write [ >r >r >r - normalize-path open-existing dup close-always + normalize-path open-existing &dispose handle>> r> r> r> (set-file-times) ] with-destructors ; @@ -128,6 +243,6 @@ M: winnt link-info ( path -- info ) M: winnt touch-file ( path -- ) [ normalize-path - maybe-create-file over close-always - [ drop ] [ f now dup (set-file-times) ] if + maybe-create-file >r &dispose r> + [ drop ] [ handle>> f now dup (set-file-times) ] if ] with-destructors ; diff --git a/extra/io/windows/files/unique/unique.factor b/extra/io/windows/files/unique/unique.factor old mode 100644 new mode 100755 index 0449980286..dcb713df7f --- a/extra/io/windows/files/unique/unique.factor +++ b/extra/io/windows/files/unique/unique.factor @@ -1,10 +1,10 @@ USING: kernel system io.files.unique.backend -windows.kernel32 io.windows io.nonblocking windows ; +windows.kernel32 io.windows io.windows.files io.ports windows +destructors ; IN: io.windows.files.unique M: windows (make-unique-file) ( path -- ) - GENERIC_WRITE CREATE_NEW 0 open-file - CloseHandle win32-error=0/f ; + GENERIC_WRITE CREATE_NEW 0 open-file dispose ; M: windows temporary-path ( -- path ) "TEMP" os-env ; diff --git a/extra/io/windows/launcher/launcher.factor b/extra/io/windows/launcher/launcher.factor index 670ea18f5e..1cfb91d716 100755 --- a/extra/io/windows/launcher/launcher.factor +++ b/extra/io/windows/launcher/launcher.factor @@ -1,12 +1,12 @@ ! Copyright (C) 2007, 2008 Doug Coleman, Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: alien alien.c-types arrays continuations io -io.windows io.windows.nt.pipes libc io.nonblocking -io.streams.duplex windows.types math windows.kernel32 +io.windows io.windows.nt.pipes libc io.ports +windows.types math windows.kernel32 namespaces io.launcher kernel sequences windows.errors splitting system threads init strings combinators io.backend accessors concurrency.flags io.files assocs -io.files.private windows destructors ; +io.files.private windows destructors classes.tuple.lib ; IN: io.windows.launcher TUPLE: CreateProcess-args @@ -19,8 +19,7 @@ TUPLE: CreateProcess-args lpEnvironment lpCurrentDirectory lpStartupInfo - lpProcessInformation - stdout-pipe stdin-pipe ; + lpProcessInformation ; : default-CreateProcess-args ( -- obj ) CreateProcess-args new @@ -31,18 +30,7 @@ TUPLE: CreateProcess-args 0 >>dwCreateFlags ; : call-CreateProcess ( CreateProcess-args -- ) - { - lpApplicationName>> - lpCommandLine>> - lpProcessAttributes>> - lpThreadAttributes>> - bInheritHandles>> - dwCreateFlags>> - lpEnvironment>> - lpCurrentDirectory>> - lpStartupInfo>> - lpProcessInformation>> - } get-slots CreateProcess win32-error=0/f ; + CreateProcess-args >tuple< CreateProcess win32-error=0/f ; : count-trailing-backslashes ( str n -- str n ) >r "\\" ?tail [ diff --git a/extra/io/windows/mmap/mmap-tests.factor b/extra/io/windows/mmap/mmap-tests.factor new file mode 100644 index 0000000000..a8430108e8 --- /dev/null +++ b/extra/io/windows/mmap/mmap-tests.factor @@ -0,0 +1,8 @@ +USING: io io.mmap io.files kernel tools.test continuations +sequences io.encodings.ascii accessors ; +IN: io.windows.mmap.tests + +[ ] [ "a" "mmap-grow-test.txt" temp-file ascii set-file-contents ] unit-test +[ 1 ] [ "mmap-grow-test.txt" temp-file file-info size>> ] unit-test +[ ] [ "mmap-grow-test.txt" temp-file 100 [ [ ] change-each ] with-mapped-file ] unit-test +[ 100 ] [ "mmap-grow-test.txt" temp-file file-info size>> ] unit-test diff --git a/extra/io/windows/mmap/mmap.factor b/extra/io/windows/mmap/mmap.factor index 0164ed1697..660a4017be 100755 --- a/extra/io/windows/mmap/mmap.factor +++ b/extra/io/windows/mmap/mmap.factor @@ -1,88 +1,44 @@ -USING: alien alien.c-types alien.syntax arrays continuations -destructors generic io.mmap io.nonblocking io.windows -kernel libc math namespaces quotations sequences windows -windows.advapi32 windows.kernel32 io.backend system ; +USING: alien alien.c-types arrays destructors generic io.mmap +io.ports io.windows io.windows.files io.windows.privileges +kernel libc math math.bitfields namespaces quotations sequences +windows windows.advapi32 windows.kernel32 io.backend system +accessors locals ; IN: io.windows.mmap -TYPEDEF: TOKEN_PRIVILEGES* PTOKEN_PRIVILEGES +: create-file-mapping ( hFile lpAttributes flProtect dwMaximumSizeHigh dwMaximumSizeLow lpName -- HANDLE ) + CreateFileMapping [ win32-error=0/f ] keep ; -! Security tokens -! http://msdn.microsoft.com/msdnmag/issues/05/03/TokenPrivileges/ +: map-view-of-file ( hFileMappingObject dwDesiredAccess dwFileOffsetHigh dwFileOffsetLow dwNumberOfBytesToMap -- HANDLE ) + MapViewOfFile [ win32-error=0/f ] keep ; -: (open-process-token) ( handle -- handle ) - TOKEN_ADJUST_PRIVILEGES TOKEN_QUERY bitor "PHANDLE" - [ OpenProcessToken win32-error=0/f ] keep *void* ; +:: mmap-open ( path length access-mode create-mode protect access -- handle handle address ) + [let | lo [ length HEX: ffffffff bitand ] + hi [ length -32 shift HEX: ffffffff bitand ] | + { "SeCreateGlobalPrivilege" "SeLockMemoryPrivilege" } [ + path access-mode create-mode 0 open-file |dispose + dup handle>> f protect hi lo f create-file-mapping |dispose + dup handle>> access 0 0 0 map-view-of-file + ] with-privileges + ] ; -: open-process-token ( -- handle ) - #! remember to handle-close this - GetCurrentProcess (open-process-token) ; +TUPLE: win32-mapped-file file mapping ; -: with-process-token ( quot -- ) - #! quot: ( token-handle -- token-handle ) - >r open-process-token r> - [ keep ] curry - [ CloseHandle drop ] [ ] cleanup ; inline +M: win32-mapped-file dispose + [ file>> dispose ] [ mapping>> dispose ] bi ; -: lookup-privilege ( string -- luid ) - >r f r> "LUID" - [ LookupPrivilegeValue win32-error=0/f ] keep ; +C: win32-mapped-file -: make-token-privileges ( name ? -- obj ) - "TOKEN_PRIVILEGES" - 1 [ over set-TOKEN_PRIVILEGES-PrivilegeCount ] keep - "LUID_AND_ATTRIBUTES" malloc-array - dup free-always over set-TOKEN_PRIVILEGES-Privileges - - swap [ - SE_PRIVILEGE_ENABLED over TOKEN_PRIVILEGES-Privileges - set-LUID_AND_ATTRIBUTES-Attributes - ] when - - >r lookup-privilege r> +M: windows (mapped-file) [ - TOKEN_PRIVILEGES-Privileges - >r 0 r> LUID_AND_ATTRIBUTES-nth - set-LUID_AND_ATTRIBUTES-Luid - ] keep ; - -: set-privilege ( name ? -- ) - [ - -rot 0 -rot make-token-privileges - dup length f f AdjustTokenPrivileges win32-error=0/f - ] with-process-token ; - -HOOK: with-privileges io-backend ( seq quot -- ) inline - -M: winnt with-privileges - over [ [ t set-privilege ] each ] curry compose - swap [ [ f set-privilege ] each ] curry [ ] cleanup ; - -M: wince with-privileges - nip call ; - -: mmap-open ( path access-mode create-mode flProtect access -- handle handle address ) - { "SeCreateGlobalPrivilege" "SeLockMemoryPrivilege" } [ - >r >r 0 open-file dup f r> 0 0 f - CreateFileMapping [ win32-error=0/f ] keep - dup close-later - dup - r> 0 0 0 MapViewOfFile [ win32-error=0/f ] keep - dup close-later - ] with-privileges ; - -M: windows ( path length -- mmap ) - [ - swap - GENERIC_WRITE GENERIC_READ bitor + { GENERIC_WRITE GENERIC_READ } flags OPEN_ALWAYS - PAGE_READWRITE SEC_COMMIT bitor + { PAGE_READWRITE SEC_COMMIT } flags FILE_MAP_ALL_ACCESS mmap-open - -rot 2array - f \ mapped-file boa + -rot ] with-destructors ; M: windows close-mapped-file ( mapped-file -- ) [ - dup mapped-file-handle [ close-always ] each - mapped-file-address UnmapViewOfFile win32-error=0/f + [ handle>> &dispose drop ] + [ address>> UnmapViewOfFile win32-error=0/f ] bi ] with-destructors ; diff --git a/extra/io/windows/nt/backend/backend.factor b/extra/io/windows/nt/backend/backend.factor index fe7f1ecc61..1a7462f304 100755 --- a/extra/io/windows/nt/backend/backend.factor +++ b/extra/io/windows/nt/backend/backend.factor @@ -1,24 +1,26 @@ USING: alien alien.c-types arrays assocs combinators -continuations destructors io io.backend io.nonblocking -io.windows libc kernel math namespaces sequences -threads classes.tuple.lib windows windows.errors -windows.kernel32 strings splitting io.files qualified ascii -combinators.lib system accessors ; +continuations destructors io io.backend io.ports io.timeouts +io.windows io.windows.files libc kernel math namespaces +sequences threads classes.tuple.lib windows windows.errors +windows.kernel32 strings splitting io.files +io.buffers qualified ascii combinators.lib system +accessors locals ; QUALIFIED: windows.winsock IN: io.windows.nt.backend -SYMBOL: io-hash +! Global variable with assoc mapping overlapped to threads +SYMBOL: pending-overlapped TUPLE: io-callback port thread ; C: io-callback : (make-overlapped) ( -- overlapped-ext ) - "OVERLAPPED" malloc-object dup free-always ; + "OVERLAPPED" malloc-object &free ; : make-overlapped ( port -- overlapped-ext ) - >r (make-overlapped) r> port-handle win32-file-ptr - [ over set-OVERLAPPED-offset ] when* ; + >r (make-overlapped) + r> handle>> ptr>> [ over set-OVERLAPPED-offset ] when* ; : ( handle existing -- handle ) f 1 CreateIoCompletionPort dup win32-error=0/f ; @@ -28,74 +30,94 @@ SYMBOL: master-completion-port : ( -- handle ) INVALID_HANDLE_VALUE f ; -M: winnt add-completion ( handle -- ) - master-completion-port get-global drop ; +M: winnt add-completion ( win32-handle -- ) + handle>> master-completion-port get-global drop ; : eof? ( error -- ? ) - dup ERROR_HANDLE_EOF = swap ERROR_BROKEN_PIPE = or ; + [ ERROR_HANDLE_EOF = ] [ ERROR_BROKEN_PIPE = ] bi or ; -: overlapped-error? ( port n -- ? ) - zero? [ - GetLastError { - { [ dup expected-io-error? ] [ 2drop t ] } - { [ dup eof? ] [ drop t >>eof drop f ] } - [ (win32-error-string) throw ] - } cond - ] [ - drop t - ] if ; - -: get-overlapped-result ( overlapped port -- bytes-transferred ) - dup handle>> handle>> rot 0 - [ 0 GetOverlappedResult overlapped-error? drop ] keep *uint ; - -: save-callback ( overlapped port -- ) +: twiddle-thumbs ( overlapped port -- bytes-transferred ) [ - swap - dup alien? [ "bad overlapped in save-callback" throw ] unless - io-hash get-global set-at - ] "I/O" suspend 3drop ; + drop + [ pending-overlapped get-global set-at ] curry "I/O" suspend + { + { [ dup integer? ] [ ] } + { [ dup array? ] [ + first dup eof? + [ drop 0 ] [ (win32-error-string) throw ] if + ] } + } cond + ] with-timeout ; -: wait-for-overlapped ( ms -- overlapped ? ) - >r master-completion-port get-global - r> INFINITE or ! timeout - 0 ! bytes - f ! key - f ! overlapped - [ roll GetQueuedCompletionStatus ] keep *void* swap zero? ; +:: wait-for-overlapped ( ms -- bytes-transferred overlapped error? ) + master-completion-port get-global + 0 [ ! bytes + f ! key + f [ ! overlapped + ms INFINITE or ! timeout + GetQueuedCompletionStatus zero? + ] keep *void* + ] keep *int spin ; -: lookup-callback ( overlapped -- callback ) - io-hash get-global delete-at* drop - dup io-callback? [ "no callback in io-hash" throw ] unless ; +: resume-callback ( result overlapped -- ) + pending-overlapped get-global delete-at* drop resume-with ; : handle-overlapped ( timeout -- ? ) wait-for-overlapped [ - GetLastError dup expected-io-error? [ - 2drop t + dup [ + >r drop GetLastError 1array r> resume-callback t ] [ - dup eof? [ - drop lookup-callback - dup port>> t >>eof drop - ] [ - (win32-error-string) swap lookup-callback - [ port>> set-port-error ] keep - ] if thread>> resume f + 2drop f ] if ] [ - lookup-callback - io-callback-thread resume f + resume-callback t ] if ; -: drain-overlapped ( timeout -- ) - handle-overlapped [ 0 drain-overlapped ] unless ; - -M: winnt cancel-io - handle>> handle>> CancelIo drop ; +M: win32-handle cancel-operation + handle>> CancelIo drop ; M: winnt io-multiplex ( ms -- ) - drain-overlapped ; + handle-overlapped [ 0 io-multiplex ] when ; M: winnt init-io ( -- ) master-completion-port set-global - H{ } clone io-hash set-global + H{ } clone pending-overlapped set-global windows.winsock:init-winsock ; + +: file-error? ( n -- eof? ) + zero? [ + GetLastError { + { [ dup expected-io-error? ] [ drop f ] } + { [ dup eof? ] [ drop t ] } + [ (win32-error-string) throw ] + } cond + ] [ f ] if ; + +: wait-for-file ( FileArgs n port -- n ) + swap file-error? + [ 2drop 0 ] [ >r lpOverlapped>> r> twiddle-thumbs ] if ; + +: update-file-ptr ( n port -- ) + handle>> dup ptr>> [ rot + >>ptr drop ] [ 2drop ] if* ; + +: finish-write ( n port -- ) + [ update-file-ptr ] [ buffer>> buffer-consume ] 2bi ; + +M: winnt (wait-to-write) + [ + [ make-FileArgs dup setup-write WriteFile ] + [ wait-for-file ] + [ finish-write ] + tri + ] with-destructors ; + +: finish-read ( n port -- ) + [ update-file-ptr ] [ buffer>> n>buffer ] 2bi ; + +M: winnt (wait-to-read) ( port -- ) + [ + [ make-FileArgs dup setup-read ReadFile ] + [ wait-for-file ] + [ finish-read ] + tri + ] with-destructors ; diff --git a/extra/io/windows/nt/files/files.factor b/extra/io/windows/nt/files/files.factor index c9f17147d3..e8bdd8e4ec 100755 --- a/extra/io/windows/nt/files/files.factor +++ b/extra/io/windows/nt/files/files.factor @@ -1,6 +1,7 @@ USING: continuations destructors io.buffers io.files io.backend -io.timeouts io.nonblocking io.windows io.windows.nt.backend -kernel libc math threads windows windows.kernel32 system +io.timeouts io.ports io.windows io.windows.files +io.windows.nt.backend windows windows.kernel32 +kernel libc math threads system alien.c-types alien.arrays alien.strings sequences combinators combinators.lib sequences.lib ascii splitting alien strings assocs namespaces io.files.private accessors ; @@ -22,19 +23,20 @@ M: winnt root-directory? ( path -- ? ) { [ dup empty? ] [ f ] } { [ dup [ path-separator? ] all? ] [ t ] } { [ dup right-trim-separators - { [ dup length 2 = ] [ dup second CHAR: : = ] } && nip ] [ + { [ dup length 2 = ] [ dup second CHAR: : = ] } 0&& nip ] [ t ] } [ f ] } cond nip ; ERROR: not-absolute-path ; + : root-directory ( string -- string' ) { [ dup length 2 >= ] [ dup second CHAR: : = ] [ dup first Letter? ] - } && [ 2 head ] [ not-absolute-path ] if ; + } 0&& [ 2 head ] [ not-absolute-path ] if ; : prepend-prefix ( string -- string' ) dup unicode-prefix head? [ @@ -52,55 +54,6 @@ M: winnt CreateFile-flags ( DWORD -- DWORD ) M: winnt FileArgs-overlapped ( port -- overlapped ) make-overlapped ; -: update-file-ptr ( n port -- ) - port-handle - dup win32-file-ptr [ - rot + swap set-win32-file-ptr - ] [ - 2drop - ] if* ; - -: finish-flush ( overlapped port -- ) - dup pending-error - tuck get-overlapped-result - dup pick update-file-ptr - swap buffer>> buffer-consume ; - -: (flush-output) ( port -- ) - dup make-FileArgs - tuck setup-write WriteFile - dupd overlapped-error? [ - >r FileArgs-lpOverlapped r> - [ save-callback ] 2keep - [ finish-flush ] keep - dup buffer>> buffer-empty? [ drop ] [ (flush-output) ] if - ] [ - 2drop - ] if ; - -: flush-output ( port -- ) - [ [ (flush-output) ] with-timeout ] with-destructors ; - -M: port port-flush - dup buffer>> buffer-empty? [ dup flush-output ] unless drop ; - -: finish-read ( overlapped port -- ) - dup pending-error - tuck get-overlapped-result dup zero? [ - drop t >>eof drop - ] [ - dup pick buffer>> n>buffer - swap update-file-ptr - ] if ; - -: ((wait-to-read)) ( port -- ) - dup make-FileArgs - tuck setup-read ReadFile - dupd overlapped-error? [ - >r FileArgs-lpOverlapped r> - [ save-callback ] 2keep - finish-read - ] [ 2drop ] if ; - -M: input-port (wait-to-read) ( port -- ) - [ [ ((wait-to-read)) ] with-timeout ] with-destructors ; +M: winnt open-append + [ dup file-info size>> ] [ drop 0 ] recover + >r (open-append) r> >>ptr ; diff --git a/extra/io/windows/nt/launcher/launcher-tests.factor b/extra/io/windows/nt/launcher/launcher-tests.factor index 8b13b9b3b9..254f845c48 100755 --- a/extra/io/windows/nt/launcher/launcher-tests.factor +++ b/extra/io/windows/nt/launcher/launcher-tests.factor @@ -1,7 +1,7 @@ IN: io.windows.launcher.nt.tests USING: io.launcher tools.test calendar accessors namespaces kernel system arrays io io.files io.encodings.ascii -sequences parser assocs hashtables math ; +sequences parser assocs hashtables math continuations ; [ ] [ @@ -41,7 +41,7 @@ sequences parser assocs hashtables math ; ] unit-test [ ] [ - "extra/io/windows/nt/launcher/test" resource-path [ + "resource:extra/io/windows/nt/launcher/test" [ vm "-script" "stderr.factor" 3array >>command "out.txt" temp-file >>stdout @@ -59,7 +59,7 @@ sequences parser assocs hashtables math ; ] unit-test [ ] [ - "extra/io/windows/nt/launcher/test" resource-path [ + "resource:extra/io/windows/nt/launcher/test" [ vm "-script" "stderr.factor" 3array >>command "out.txt" temp-file >>stdout @@ -73,11 +73,11 @@ sequences parser assocs hashtables math ; ] unit-test [ "output" ] [ - "extra/io/windows/nt/launcher/test" resource-path [ + "resource:extra/io/windows/nt/launcher/test" [ vm "-script" "stderr.factor" 3array >>command "err2.txt" temp-file >>stderr - ascii lines first + ascii lines first ] with-directory ] unit-test @@ -86,45 +86,45 @@ sequences parser assocs hashtables math ; ] unit-test [ t ] [ - "extra/io/windows/nt/launcher/test" resource-path [ + "resource:extra/io/windows/nt/launcher/test" [ vm "-script" "env.factor" 3array >>command - ascii contents + ascii contents ] with-directory eval os-envs = ] unit-test [ t ] [ - "extra/io/windows/nt/launcher/test" resource-path [ + "resource:extra/io/windows/nt/launcher/test" [ vm "-script" "env.factor" 3array >>command +replace-environment+ >>environment-mode os-envs >>environment - ascii contents + ascii contents ] with-directory eval os-envs = ] unit-test [ "B" ] [ - "extra/io/windows/nt/launcher/test" resource-path [ + "resource:extra/io/windows/nt/launcher/test" [ vm "-script" "env.factor" 3array >>command { { "A" "B" } } >>environment - ascii contents + ascii contents ] with-directory eval "A" swap at ] unit-test [ f ] [ - "extra/io/windows/nt/launcher/test" resource-path [ + "resource:extra/io/windows/nt/launcher/test" [ vm "-script" "env.factor" 3array >>command { { "HOME" "XXX" } } >>environment +prepend-environment+ >>environment-mode - ascii contents + ascii contents ] with-directory eval "HOME" swap at "XXX" = @@ -140,3 +140,18 @@ sequences parser assocs hashtables math ; [ ] [ "dir.txt" temp-file delete-file ] unit-test ] times + +[ "append-test" temp-file delete-file ] ignore-errors + +[ "Hello appender\r\nHello appender\r\n" ] [ + 2 [ + "resource:extra/io/windows/nt/launcher/test" [ + + vm "-script" "append.factor" 3array >>command + "append-test" temp-file >>stdout + try-process + ] with-directory + ] times + + "append-test" temp-file ascii file-contents +] unit-test diff --git a/extra/io/windows/nt/launcher/launcher.factor b/extra/io/windows/nt/launcher/launcher.factor index f57902608f..6c86b53049 100755 --- a/extra/io/windows/nt/launcher/launcher.factor +++ b/extra/io/windows/nt/launcher/launcher.factor @@ -1,11 +1,12 @@ ! Copyright (C) 2007, 2008 Doug Coleman, Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: alien alien.c-types arrays continuations destructors io -io.windows libc io.nonblocking io.streams.duplex windows.types +io.windows libc io.ports io.pipes windows.types math windows.kernel32 windows namespaces io.launcher kernel sequences windows.errors assocs splitting system strings -io.windows.launcher io.windows.nt.pipes io.backend io.files -io.files.private combinators shuffle accessors locals ; +io.windows.launcher io.windows.files +io.backend io.files io.files.private combinators shuffle +accessors locals ; IN: io.windows.nt.launcher : duplicate-handle ( handle -- handle' ) @@ -19,19 +20,29 @@ IN: io.windows.nt.launcher DuplicateHandle win32-error=0/f ] keep *void* ; +! /dev/null simulation +: null-input ( -- pipe ) + (pipe) [ in>> handle>> ] [ out>> dispose ] bi ; + +: null-output ( -- pipe ) + (pipe) [ in>> dispose ] [ out>> handle>> ] bi ; + +: null-pipe ( mode -- pipe ) + { + { GENERIC_READ [ null-input ] } + { GENERIC_WRITE [ null-output ] } + } case ; + ! The below code is based on the example given in ! http://msdn2.microsoft.com/en-us/library/ms682499.aspx -: redirect-default ( default obj access-mode create-mode -- handle ) - 3drop ; +: redirect-default ( obj access-mode create-mode -- handle ) + 3drop f ; -: redirect-inherit ( default obj access-mode create-mode -- handle ) - 4drop f ; +: redirect-closed ( obj access-mode create-mode -- handle ) + drop nip null-pipe ; -: redirect-closed ( default obj access-mode create-mode -- handle ) - drop 2nip null-pipe ; - -:: redirect-file ( default path access-mode create-mode -- handle ) +:: redirect-file ( path access-mode create-mode -- handle ) path normalize-path access-mode share-mode @@ -39,31 +50,36 @@ IN: io.windows.nt.launcher create-mode FILE_ATTRIBUTE_NORMAL ! flags and attributes f ! template file - CreateFile dup invalid-handle? dup close-always ; + CreateFile dup invalid-handle? &dispose handle>> ; + +: redirect-append ( path access-mode create-mode -- handle ) + >r >r path>> r> r> + drop OPEN_ALWAYS + redirect-file + dup 0 FILE_END set-file-pointer ; : set-inherit ( handle ? -- ) >r HANDLE_FLAG_INHERIT r> >BOOLEAN SetHandleInformation win32-error=0/f ; -: redirect-stream ( default stream access-mode create-mode -- handle ) - 2drop nip - underlying-handle win32-file-handle - duplicate-handle dup t set-inherit ; +: redirect-handle ( handle access-mode create-mode -- handle ) + 2drop handle>> duplicate-handle dup t set-inherit ; -: redirect ( default obj access-mode create-mode -- handle ) +: redirect-stream ( stream access-mode create-mode -- handle ) + >r >r underlying-handle handle>> r> r> redirect-handle ; + +: redirect ( obj access-mode create-mode -- handle ) { { [ pick not ] [ redirect-default ] } - { [ pick +inherit+ eq? ] [ redirect-inherit ] } { [ pick +closed+ eq? ] [ redirect-closed ] } { [ pick string? ] [ redirect-file ] } + { [ pick appender? ] [ redirect-append ] } + { [ pick win32-file? ] [ redirect-handle ] } [ redirect-stream ] } cond ; -: default-stdout ( args -- handle ) - stdout-pipe>> dup [ pipe-out ] when ; - : redirect-stdout ( process args -- handle ) - default-stdout - swap stdout>> + drop + stdout>> GENERIC_WRITE CREATE_ALWAYS redirect @@ -71,70 +87,27 @@ IN: io.windows.nt.launcher : redirect-stderr ( process args -- handle ) over stderr>> +stdout+ eq? [ - lpStartupInfo>> - STARTUPINFO-hStdOutput nip + lpStartupInfo>> STARTUPINFO-hStdOutput ] [ drop - f - swap stderr>> + stderr>> GENERIC_WRITE CREATE_ALWAYS redirect STD_ERROR_HANDLE GetStdHandle or ] if ; -: default-stdin ( args -- handle ) - stdin-pipe>> dup [ pipe-in ] when ; - : redirect-stdin ( process args -- handle ) - default-stdin - swap stdin>> + drop + stdin>> GENERIC_READ OPEN_EXISTING redirect STD_INPUT_HANDLE GetStdHandle or ; -: add-pipe-dtors ( pipe -- ) - dup - in>> close-later - out>> close-later ; - -: fill-stdout-pipe ( args -- args ) - - dup add-pipe-dtors - dup pipe-in f set-inherit - >>stdout-pipe ; - -: fill-stdin-pipe ( args -- args ) - - dup add-pipe-dtors - dup pipe-out f set-inherit - >>stdin-pipe ; - M: winnt fill-redirection ( process args -- ) [ 2dup redirect-stdout ] keep lpStartupInfo>> set-STARTUPINFO-hStdOutput [ 2dup redirect-stderr ] keep lpStartupInfo>> set-STARTUPINFO-hStdError [ 2dup redirect-stdin ] keep lpStartupInfo>> set-STARTUPINFO-hStdInput 2drop ; - -M: winnt (process-stream) - [ - current-directory get (normalize-path) cd - - dup make-CreateProcess-args - - fill-stdout-pipe - fill-stdin-pipe - - tuck fill-redirection - - dup call-CreateProcess - - dup stdin-pipe>> pipe-in CloseHandle drop - dup stdout-pipe>> pipe-out CloseHandle drop - - dup lpProcessInformation>> - over stdout-pipe>> in>> f - rot stdin-pipe>> out>> f - ] with-destructors ; diff --git a/extra/io/windows/nt/launcher/test/append.factor b/extra/io/windows/nt/launcher/test/append.factor new file mode 100755 index 0000000000..4c1de0c5f9 --- /dev/null +++ b/extra/io/windows/nt/launcher/test/append.factor @@ -0,0 +1,2 @@ +USE: io +"Hello appender" print diff --git a/extra/io/windows/nt/launcher/test/stderr.factor b/extra/io/windows/nt/launcher/test/stderr.factor index 0b97387cf7..f22f50e406 100755 --- a/extra/io/windows/nt/launcher/test/stderr.factor +++ b/extra/io/windows/nt/launcher/test/stderr.factor @@ -2,4 +2,4 @@ USE: io USE: namespaces "output" write flush -"error" stderr get stream-write stderr get stream-flush +"error" error-stream get stream-write error-stream get stream-flush diff --git a/extra/io/windows/nt/monitors/monitors.factor b/extra/io/windows/nt/monitors/monitors.factor index 4c2277acb9..fa4d19a46e 100755 --- a/extra/io/windows/nt/monitors/monitors.factor +++ b/extra/io/windows/nt/monitors/monitors.factor @@ -3,9 +3,9 @@ USING: alien alien.c-types libc destructors locals kernel math assocs namespaces continuations sequences hashtables sorting arrays combinators math.bitfields strings system -accessors threads -io.backend io.windows io.windows.nt.backend io.monitors -io.nonblocking io.buffers io.files io.timeouts io +accessors threads splitting +io.backend io.windows io.windows.nt.backend io.windows.nt.files +io.monitors io.ports io.buffers io.files io.timeouts io windows windows.kernel32 windows.types ; IN: io.windows.nt.monitors @@ -17,11 +17,7 @@ IN: io.windows.nt.monitors OPEN_EXISTING { FILE_FLAG_BACKUP_SEMANTICS FILE_FLAG_OVERLAPPED } flags f - CreateFile - dup invalid-handle? - dup close-later - dup add-completion - f ; + CreateFile opened-file ; TUPLE: win32-monitor-port < input-port recursive ; @@ -39,13 +35,9 @@ TUPLE: win32-monitor < monitor port ; (make-overlapped) [ f ReadDirectoryChangesW win32-error=0/f ] keep ; -: read-changes ( port -- bytes ) +: read-changes ( port -- bytes-transferred ) [ - dup begin-reading-changes - swap [ save-callback ] 2keep - check-closed ! we may have closed it... - dup eof>> [ "EOF??" throw ] when - get-overlapped-result + [ begin-reading-changes ] [ twiddle-thumbs ] bi ] with-destructors ; : parse-action ( action -- changed ) @@ -79,12 +71,15 @@ TUPLE: win32-monitor < monitor port ; : file-notify-records ( buffer -- seq ) [ (file-notify-records) drop ] { } make ; -: parse-notify-records ( monitor buffer -- ) - file-notify-records - [ parse-notify-record rot queue-change ] with each ; +:: parse-notify-records ( monitor buffer -- ) + buffer file-notify-records [ + parse-notify-record + [ monitor path>> prepend-path normalize-path ] dip + monitor queue-change + ] each ; : fill-queue ( monitor -- ) - dup port>> check-closed + dup port>> dup check-disposed [ buffer>> ptr>> ] [ read-changes zero? ] bi [ 2dup parse-notify-records ] unless 2drop ; @@ -94,11 +89,11 @@ TUPLE: win32-monitor < monitor port ; : fill-queue-thread ( monitor -- ) [ dup fill-queue (fill-queue-thread) ] - [ dup port-closed-error? [ 2drop ] [ rethrow ] if ] recover ; + [ dup already-disposed? [ 2drop ] [ rethrow ] if ] recover ; M:: winnt (monitor) ( path recursive? mailbox -- monitor ) [ - path mailbox win32-monitor new-monitor + path normalize-path mailbox win32-monitor new-monitor path open-directory \ win32-monitor-port recursive? >>recursive >>port diff --git a/extra/io/windows/nt/nt.factor b/extra/io/windows/nt/nt.factor index 33bb3a88b9..8e59a4d555 100755 --- a/extra/io/windows/nt/nt.factor +++ b/extra/io/windows/nt/nt.factor @@ -7,6 +7,7 @@ USE: io.windows.nt.backend USE: io.windows.nt.files USE: io.windows.nt.launcher USE: io.windows.nt.monitors +USE: io.windows.nt.privileges USE: io.windows.nt.sockets USE: io.windows.mmap USE: io.windows.files diff --git a/extra/io/windows/nt/pipes/pipes.factor b/extra/io/windows/nt/pipes/pipes.factor index b164d5872b..97c2e49627 100755 --- a/extra/io/windows/nt/pipes/pipes.factor +++ b/extra/io/windows/nt/pipes/pipes.factor @@ -1,55 +1,32 @@ ! Copyright (C) 2007, 2008 Doug Coleman, Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: alien alien.c-types arrays destructors io io.windows libc -windows.types math windows.kernel32 windows namespaces kernel -sequences windows.errors assocs math.parser system random -combinators accessors ; +windows.types math.bitfields windows.kernel32 windows namespaces +kernel sequences windows.errors assocs math.parser system random +combinators accessors io.pipes io.ports ; IN: io.windows.nt.pipes ! This code is based on ! http://twistedmatrix.com/trac/browser/trunk/twisted/internet/iocpreactor/process.py -: create-named-pipe ( name mode -- handle ) - FILE_FLAG_OVERLAPPED bitor +: create-named-pipe ( name -- handle ) + { PIPE_ACCESS_INBOUND FILE_FLAG_OVERLAPPED } flags PIPE_TYPE_BYTE 1 4096 4096 0 security-attributes-inherit - CreateNamedPipe - dup win32-error=0/f - dup add-completion ; + CreateNamedPipe opened-file ; -: open-other-end ( name mode -- handle ) - FILE_SHARE_READ FILE_SHARE_WRITE bitor +: open-other-end ( name -- handle ) + GENERIC_WRITE + { FILE_SHARE_READ FILE_SHARE_WRITE } flags security-attributes-inherit OPEN_EXISTING FILE_FLAG_OVERLAPPED f - CreateFile - dup win32-error=0/f - dup add-completion ; - -TUPLE: pipe in out ; - -: ( name in-mode out-mode -- pipe ) - [ - >r over >r create-named-pipe dup close-later - r> r> open-other-end dup close-later - pipe boa - ] with-destructors ; - -: close-pipe ( pipe -- ) - dup - in>> CloseHandle drop - out>> CloseHandle drop ; - -: ( name -- pipe ) - PIPE_ACCESS_INBOUND GENERIC_WRITE ; - -: ( name -- pipe ) - PIPE_ACCESS_DUPLEX GENERIC_READ ; + CreateFile opened-file ; : unique-pipe-name ( -- string ) [ @@ -61,25 +38,9 @@ TUPLE: pipe in out ; millis # ] "" make ; -: ( -- pipe ) - unique-pipe-name ; - -: ( -- pipe ) - unique-pipe-name ; - -! /dev/null simulation -: null-input ( -- pipe ) - - dup out>> CloseHandle drop - in>> ; - -: null-output ( -- pipe ) - - dup in>> CloseHandle drop - out>> ; - -: null-pipe ( mode -- pipe ) - { - { [ dup GENERIC_READ = ] [ drop null-input ] } - { [ dup GENERIC_WRITE = ] [ drop null-output ] } - } cond ; +M: winnt (pipe) ( -- pipe ) + [ + unique-pipe-name + [ create-named-pipe ] [ open-other-end ] bi + pipe boa + ] with-destructors ; diff --git a/extra/io/windows/nt/privileges/privileges.factor b/extra/io/windows/nt/privileges/privileges.factor new file mode 100755 index 0000000000..007d05f9af --- /dev/null +++ b/extra/io/windows/nt/privileges/privileges.factor @@ -0,0 +1,53 @@ +USING: alien alien.c-types alien.syntax arrays continuations +destructors generic io.mmap io.ports io.windows io.windows.files +kernel libc math math.bitfields namespaces quotations sequences windows +windows.advapi32 windows.kernel32 io.backend system accessors +io.windows.privileges ; +IN: io.windows.nt.privileges + +TYPEDEF: TOKEN_PRIVILEGES* PTOKEN_PRIVILEGES + +! Security tokens +! http://msdn.microsoft.com/msdnmag/issues/05/03/TokenPrivileges/ + +: (open-process-token) ( handle -- handle ) + { TOKEN_ADJUST_PRIVILEGES TOKEN_QUERY } flags "PHANDLE" + [ OpenProcessToken win32-error=0/f ] keep *void* ; + +: open-process-token ( -- handle ) + #! remember to CloseHandle + GetCurrentProcess (open-process-token) ; + +: with-process-token ( quot -- ) + #! quot: ( token-handle -- token-handle ) + >r open-process-token r> + [ keep ] curry + [ CloseHandle drop ] [ ] cleanup ; inline + +: lookup-privilege ( string -- luid ) + >r f r> "LUID" + [ LookupPrivilegeValue win32-error=0/f ] keep ; + +: make-token-privileges ( name ? -- obj ) + "TOKEN_PRIVILEGES" + 1 [ over set-TOKEN_PRIVILEGES-PrivilegeCount ] keep + "LUID_AND_ATTRIBUTES" malloc-array &free + over set-TOKEN_PRIVILEGES-Privileges + + swap [ + SE_PRIVILEGE_ENABLED over TOKEN_PRIVILEGES-Privileges + set-LUID_AND_ATTRIBUTES-Attributes + ] when + + >r lookup-privilege r> + [ + TOKEN_PRIVILEGES-Privileges + >r 0 r> LUID_AND_ATTRIBUTES-nth + set-LUID_AND_ATTRIBUTES-Luid + ] keep ; + +M: winnt set-privilege ( name ? -- ) + [ + -rot 0 -rot make-token-privileges + dup length f f AdjustTokenPrivileges win32-error=0/f + ] with-process-token ; diff --git a/extra/io/windows/nt/sockets/sockets.factor b/extra/io/windows/nt/sockets/sockets.factor index 79e767177d..a31c41942f 100755 --- a/extra/io/windows/nt/sockets/sockets.factor +++ b/extra/io/windows/nt/sockets/sockets.factor @@ -1,8 +1,9 @@ USING: alien alien.accessors alien.c-types byte-arrays -continuations destructors io.nonblocking io.timeouts io.sockets -io.sockets.impl io namespaces io.streams.duplex io.windows +continuations destructors io.ports io.timeouts io.sockets +io.sockets io namespaces io.streams.duplex io.windows +io.windows.sockets io.windows.nt.backend windows.winsock kernel libc math sequences -threads classes.tuple.lib system accessors ; +threads classes.tuple.lib system combinators accessors ; IN: io.windows.nt.sockets : malloc-int ( object -- object ) @@ -30,121 +31,78 @@ TUPLE: ConnectEx-args port s* name* namelen* lpSendBuffer* dwSendDataLength* lpdwBytesSent* lpOverlapped* ptr* ; -: init-connect ( sockaddr size ConnectEx -- ) - [ set-ConnectEx-args-namelen* ] keep - [ set-ConnectEx-args-name* ] keep - f over set-ConnectEx-args-lpSendBuffer* - 0 over set-ConnectEx-args-dwSendDataLength* - f over set-ConnectEx-args-lpdwBytesSent* - (make-overlapped) swap set-ConnectEx-args-lpOverlapped* ; +: wait-for-socket ( args -- n ) + [ lpOverlapped*>> ] [ port>> ] bi twiddle-thumbs ; -: (ConnectEx) ( ConnectEx -- ) - \ ConnectEx-args >tuple*< +: ( sockaddr size -- ConnectEx ) + ConnectEx-args new + swap >>namelen* + swap >>name* + f >>lpSendBuffer* + 0 >>dwSendDataLength* + f >>lpdwBytesSent* + (make-overlapped) >>lpOverlapped* ; + +: call-ConnectEx ( ConnectEx -- ) + ConnectEx-args >tuple*< "int" { "SOCKET" "sockaddr_in*" "int" "PVOID" "DWORD" "LPDWORD" "void*" } "stdcall" alien-indirect drop winsock-error-string [ throw ] when* ; -: connect-continuation ( ConnectEx port -- ) - >r ConnectEx-args-lpOverlapped* r> - 2dup save-callback - get-overlapped-result drop ; - -M: winnt ((client)) ( addrspec -- client-in client-out ) - [ - \ ConnectEx-args new - over make-sockaddr/size pick init-connect - over tcp-socket over set-ConnectEx-args-s* - dup ConnectEx-args-s* add-completion - dup ConnectEx-args-s* get-ConnectEx-ptr over set-ConnectEx-args-ptr* - dup ConnectEx-args-s* INADDR_ANY roll bind-socket - dup (ConnectEx) - - dup ConnectEx-args-s* dup - >r [ connect-continuation ] keep [ pending-error ] keep r> - ] with-destructors ; +M: object establish-connection ( client-out remote -- ) + make-sockaddr/size + swap >>port + dup port>> handle>> handle>> >>s* + dup s*>> get-ConnectEx-ptr >>ptr* + dup call-ConnectEx + wait-for-socket drop ; TUPLE: AcceptEx-args port sListenSocket* sAcceptSocket* lpOutputBuffer* dwReceiveDataLength* dwLocalAddressLength* dwRemoteAddressLength* lpdwBytesReceived* lpOverlapped* ; -: init-accept-buffer ( server-port AcceptEx -- ) - >r server-port-addr sockaddr-type heap-size 16 + - dup dup 2 * malloc dup free-always r> - [ set-AcceptEx-args-lpOutputBuffer* ] keep - [ set-AcceptEx-args-dwLocalAddressLength* ] keep - set-AcceptEx-args-dwRemoteAddressLength* ; +: init-accept-buffer ( addr AcceptEx -- ) + swap sockaddr-type heap-size 16 + + [ >>dwLocalAddressLength* ] [ >>dwRemoteAddressLength* ] bi + dup dwLocalAddressLength*>> 2 * malloc &free >>lpOutputBuffer* + drop ; -: init-accept ( server-port AcceptEx -- ) - [ init-accept-buffer ] 2keep - [ set-AcceptEx-args-port ] 2keep - >r port-handle win32-file-handle r> [ set-AcceptEx-args-sListenSocket* ] keep - dup AcceptEx-args-port server-port-addr tcp-socket - over set-AcceptEx-args-sAcceptSocket* - 0 over set-AcceptEx-args-dwReceiveDataLength* - f over set-AcceptEx-args-lpdwBytesReceived* - (make-overlapped) swap set-AcceptEx-args-lpOverlapped* ; +: ( server addr -- AcceptEx ) + AcceptEx-args new + 2dup init-accept-buffer + swap SOCK_STREAM open-socket |dispose handle>> >>sAcceptSocket* + over handle>> handle>> >>sListenSocket* + swap >>port + 0 >>dwReceiveDataLength* + f >>lpdwBytesReceived* + (make-overlapped) >>lpOverlapped* ; -: ((accept)) ( AcceptEx -- ) - \ AcceptEx-args >tuple*< - AcceptEx drop +: call-AcceptEx ( AcceptEx -- ) + AcceptEx-args >tuple*< AcceptEx drop winsock-error-string [ throw ] when* ; -: make-accept-continuation ( AcceptEx -- ) - dup AcceptEx-args-lpOverlapped* - swap AcceptEx-args-port save-callback ; +: extract-remote-address ( AcceptEx -- sockaddr ) + { + [ lpOutputBuffer*>> ] + [ dwReceiveDataLength*>> ] + [ dwLocalAddressLength*>> ] + [ dwRemoteAddressLength*>> ] + } cleave + f + 0 + f + [ 0 GetAcceptExSockaddrs ] keep *void* ; -: check-accept-error ( AcceptEx -- ) - dup AcceptEx-args-lpOverlapped* - swap AcceptEx-args-port get-overlapped-result drop ; - -: extract-remote-host ( AcceptEx -- addrspec ) +M: object (accept) ( server addr -- handle sockaddr ) [ - [ AcceptEx-args-lpOutputBuffer* ] keep - [ AcceptEx-args-dwReceiveDataLength* ] keep - [ AcceptEx-args-dwLocalAddressLength* ] keep - AcceptEx-args-dwRemoteAddressLength* - f - 0 - f [ - 0 GetAcceptExSockaddrs - ] keep *void* - ] keep AcceptEx-args-port server-port-addr parse-sockaddr ; - -: accept-continuation ( AcceptEx -- addrspec client ) - [ make-accept-continuation ] keep - [ check-accept-error ] keep - [ extract-remote-host ] keep - ! addrspec AcceptEx - [ AcceptEx-args-sAcceptSocket* add-completion ] keep - AcceptEx-args-sAcceptSocket* ; - -M: winnt (accept) ( server -- addrspec handle ) - [ - [ - check-server-port - \ AcceptEx-args new - [ init-accept ] keep - [ ((accept)) ] keep - [ accept-continuation ] keep - AcceptEx-args-port pending-error - ] with-timeout - ] with-destructors ; - -M: winnt (server) ( addrspec -- handle ) - [ - SOCK_STREAM server-fd dup listen-on-socket - dup add-completion - - ] with-destructors ; - -M: winnt ( addrspec -- datagram ) - [ - [ - SOCK_DGRAM server-fd - dup add-completion - - ] keep + + { + [ call-AcceptEx ] + [ wait-for-socket drop ] + [ sAcceptSocket*>> ] + [ extract-remote-address ] + } cleave ] with-destructors ; TUPLE: WSARecvFrom-args port @@ -152,53 +110,37 @@ TUPLE: WSARecvFrom-args port lpFlags* lpFrom* lpFromLen* lpOverlapped* lpCompletionRoutine* ; : make-receive-buffer ( -- WSABUF ) - "WSABUF" malloc-object dup free-always + "WSABUF" malloc-object &free default-buffer-size get over set-WSABUF-len - default-buffer-size get malloc dup free-always over set-WSABUF-buf ; + default-buffer-size get malloc &free over set-WSABUF-buf ; -: init-WSARecvFrom ( datagram WSARecvFrom -- ) - [ set-WSARecvFrom-args-port ] 2keep - [ - >r handle>> handle>> r> - set-WSARecvFrom-args-s* - ] 2keep [ - >r datagram-port-addr sockaddr-type heap-size r> - 2dup >r malloc dup free-always r> set-WSARecvFrom-args-lpFrom* - >r malloc-int dup free-always r> set-WSARecvFrom-args-lpFromLen* - ] keep - make-receive-buffer over set-WSARecvFrom-args-lpBuffers* - 1 over set-WSARecvFrom-args-dwBufferCount* - 0 malloc-int dup free-always over set-WSARecvFrom-args-lpFlags* - 0 malloc-int dup free-always over set-WSARecvFrom-args-lpNumberOfBytesRecvd* - (make-overlapped) swap set-WSARecvFrom-args-lpOverlapped* ; - -: WSARecvFrom-continuation ( WSARecvFrom -- n ) - dup WSARecvFrom-args-lpOverlapped* - swap WSARecvFrom-args-port [ save-callback ] 2keep - get-overlapped-result ; +: ( datagram -- WSARecvFrom ) + WSARecvFrom-args new + swap >>port + dup port>> handle>> handle>> >>s* + dup port>> addr>> sockaddr-type heap-size + [ malloc &free >>lpFrom* ] + [ malloc-int &free >>lpFromLen* ] bi + make-receive-buffer >>lpBuffers* + 1 >>dwBufferCount* + 0 malloc-int &free >>lpFlags* + 0 malloc-int &free >>lpNumberOfBytesRecvd* + (make-overlapped) >>lpOverlapped* ; : call-WSARecvFrom ( WSARecvFrom -- ) - \ WSARecvFrom-args >tuple*< - WSARecvFrom - socket-error* ; + WSARecvFrom-args >tuple*< WSARecvFrom socket-error* ; -: parse-WSARecvFrom ( n WSARecvFrom -- packet addrspec ) - [ - WSARecvFrom-args-lpBuffers* WSABUF-buf - swap memory>byte-array - ] keep - [ WSARecvFrom-args-lpFrom* ] keep - WSARecvFrom-args-port datagram-port-addr parse-sockaddr ; +: parse-WSARecvFrom ( n WSARecvFrom -- packet sockaddr ) + [ lpBuffers*>> WSABUF-buf swap memory>byte-array ] + [ [ lpFrom*>> ] [ lpFromLen*>> *int ] bi memory>byte-array ] bi ; -M: winnt receive ( datagram -- packet addrspec ) +M: winnt (receive) ( datagram -- packet addrspec ) [ - check-datagram-port - \ WSARecvFrom-args new - [ init-WSARecvFrom ] keep - [ call-WSARecvFrom ] keep - [ WSARecvFrom-continuation ] keep - [ WSARecvFrom-args-port pending-error ] keep - parse-WSARecvFrom + + [ call-WSARecvFrom ] + [ wait-for-socket ] + [ parse-WSARecvFrom ] + tri ] with-destructors ; TUPLE: WSASendTo-args port @@ -206,49 +148,32 @@ TUPLE: WSASendTo-args port dwFlags* lpTo* iToLen* lpOverlapped* lpCompletionRoutine* ; : make-send-buffer ( packet -- WSABUF ) - "WSABUF" malloc-object dup free-always - over malloc-byte-array dup free-always over set-WSABUF-buf - swap length over set-WSABUF-len ; + "WSABUF" malloc-object &free + [ >r malloc-byte-array &free r> set-WSABUF-buf ] + [ >r length r> set-WSABUF-len ] + [ nip ] + 2tri ; -: init-WSASendTo ( packet addrspec datagram WSASendTo -- ) - [ set-WSASendTo-args-port ] 2keep - [ - >r port-handle win32-file-handle r> set-WSASendTo-args-s* - ] keep - [ - >r make-sockaddr/size >r - malloc-byte-array dup free-always - r> r> - [ set-WSASendTo-args-iToLen* ] keep - set-WSASendTo-args-lpTo* - ] keep - [ - >r make-send-buffer r> set-WSASendTo-args-lpBuffers* - ] keep - 1 over set-WSASendTo-args-dwBufferCount* - 0 over set-WSASendTo-args-dwFlags* - 0 over set-WSASendTo-args-lpNumberOfBytesSent* - (make-overlapped) swap set-WSASendTo-args-lpOverlapped* ; - -: WSASendTo-continuation ( WSASendTo -- ) - dup WSASendTo-args-lpOverlapped* - swap WSASendTo-args-port - [ save-callback ] 2keep - get-overlapped-result drop ; +: ( packet addrspec datagram -- WSASendTo ) + WSASendTo-args new + swap >>port + dup port>> handle>> handle>> >>s* + swap make-sockaddr/size + >r malloc-byte-array &free + r> [ >>lpTo* ] [ >>iToLen* ] bi* + swap make-send-buffer >>lpBuffers* + 1 >>dwBufferCount* + 0 >>dwFlags* + 0 >>lpNumberOfBytesSent* + (make-overlapped) >>lpOverlapped* ; : call-WSASendTo ( WSASendTo -- ) - \ WSASendTo-args >tuple*< - WSASendTo socket-error* ; + WSASendTo-args >tuple*< WSASendTo socket-error* ; -USE: io.sockets - -M: winnt send ( packet addrspec datagram -- ) +M: winnt (send) ( packet addrspec datagram -- ) [ - check-datagram-send - \ WSASendTo-args new - [ init-WSASendTo ] keep - [ call-WSASendTo ] keep - [ WSASendTo-continuation ] keep - WSASendTo-args-port pending-error + + [ call-WSASendTo ] + [ wait-for-socket drop ] + bi ] with-destructors ; - diff --git a/extra/io/windows/privileges/privileges.factor b/extra/io/windows/privileges/privileges.factor new file mode 100755 index 0000000000..144c799912 --- /dev/null +++ b/extra/io/windows/privileges/privileges.factor @@ -0,0 +1,8 @@ +USING: io.backend kernel continuations sequences ; +IN: io.windows.privileges + +HOOK: set-privilege io-backend ( name ? -- ) inline + +: with-privileges ( seq quot -- ) + over [ [ t set-privilege ] each ] curry compose + swap [ [ f set-privilege ] each ] curry [ ] cleanup ; inline diff --git a/extra/io/windows/sockets/sockets.factor b/extra/io/windows/sockets/sockets.factor new file mode 100755 index 0000000000..359776d639 --- /dev/null +++ b/extra/io/windows/sockets/sockets.factor @@ -0,0 +1,62 @@ +USING: kernel accessors io.sockets io.windows io.backend +windows.winsock system destructors alien.c-types ; +IN: io.windows.sockets + +HOOK: WSASocket-flags io-backend ( -- DWORD ) + +TUPLE: win32-socket < win32-file ; + +: ( handle -- win32-socket ) + win32-socket new + swap >>handle ; + +M: win32-socket dispose ( stream -- ) + handle>> closesocket drop ; + +: unspecific-sockaddr/size ( addrspec -- sockaddr len ) + [ empty-sockaddr/size ] [ protocol-family ] bi + pick set-sockaddr-in-family ; + +: opened-socket ( handle -- win32-socket ) + |dispose dup add-completion ; + +: open-socket ( addrspec type -- win32-socket ) + >r protocol-family r> + 0 f 0 WSASocket-flags WSASocket + dup socket-error + opened-socket ; + +M: object (get-local-address) ( socket addrspec -- sockaddr ) + >r handle>> r> empty-sockaddr/size + [ getsockname socket-error ] 2keep drop ; + +M: object (get-remote-address) ( socket addrspec -- sockaddr ) + >r handle>> r> empty-sockaddr/size + [ getpeername socket-error ] 2keep drop ; + +: bind-socket ( win32-socket sockaddr len -- ) + >r >r handle>> r> r> bind socket-error ; + +M: object ((client)) ( addrspec -- handle ) + [ SOCK_STREAM open-socket ] keep + [ unspecific-sockaddr/size bind-socket ] [ drop ] 2bi ; + +: server-socket ( addrspec type -- fd ) + [ open-socket ] [ drop ] 2bi + [ make-sockaddr/size bind-socket ] [ drop ] 2bi ; + +! http://support.microsoft.com/kb/127144 +! NOTE: Possibly tweak this because of SYN flood attacks +: listen-backlog ( -- n ) HEX: 7fffffff ; inline + +M: object (server) ( addrspec -- handle ) + [ + SOCK_STREAM server-socket + dup handle>> listen-backlog listen winsock-return-check + ] with-destructors ; + +M: windows (datagram) ( addrspec -- handle ) + [ SOCK_DGRAM server-socket ] with-destructors ; + +M: windows addrinfo-error ( n -- ) + winsock-return-check ; diff --git a/extra/io/windows/windows.factor b/extra/io/windows/windows.factor index 772ad9124f..5e10389c44 100755 --- a/extra/io/windows/windows.factor +++ b/extra/io/windows/windows.factor @@ -1,27 +1,42 @@ ! Copyright (C) 2004, 2008 Mackenzie Straight, Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: alien alien.c-types arrays destructors io io.backend -io.buffers io.files io.nonblocking io.sockets io.binary -io.sockets.impl windows.errors strings io.streams.duplex +io.buffers io.files io.ports io.sockets io.binary +io.sockets io.timeouts windows.errors strings kernel math namespaces sequences windows windows.kernel32 windows.shell32 windows.types windows.winsock splitting continuations math.bitfields system accessors ; IN: io.windows -M: windows destruct-handle CloseHandle drop ; +TUPLE: win32-handle handle disposed ; -M: windows destruct-socket closesocket drop ; +: new-win32-handle ( handle class -- win32-handle ) + new swap >>handle ; -TUPLE: win32-file handle ptr ; +: ( handle -- win32-handle ) + win32-handle new-win32-handle ; -C: win32-file +M: win32-handle dispose* ( handle -- ) + handle>> CloseHandle drop ; + +TUPLE: win32-file < win32-handle ptr ; + +: ( handle -- win32-file ) + win32-file new-win32-handle ; + +M: win32-file dispose + dup disposed>> [ drop ] [ + [ cancel-operation ] [ call-next-method ] bi + ] if ; HOOK: CreateFile-flags io-backend ( DWORD -- DWORD ) HOOK: FileArgs-overlapped io-backend ( port -- overlapped/f ) HOOK: add-completion io-backend ( port -- ) -M: windows normalize-directory ( string -- string ) - normalize-path "\\" ?tail drop "\\*" append ; +: opened-file ( handle -- win32-file ) + dup invalid-handle? + |dispose + dup add-completion ; : share-mode ( -- fixnum ) { @@ -38,161 +53,3 @@ M: windows normalize-directory ( string -- string ) : security-attributes-inherit ( -- obj ) default-security-attributes TRUE over set-SECURITY_ATTRIBUTES-bInheritHandle ; foldable - -M: win32-file init-handle ( handle -- ) - drop ; - -M: win32-file close-handle ( handle -- ) - win32-file-handle CloseHandle drop ; - -! Clean up resources (open handle) if add-completion fails -: open-file ( path access-mode create-mode flags -- handle ) - [ - >r >r share-mode security-attributes-inherit r> r> - CreateFile-flags f CreateFile - dup invalid-handle? dup close-later - dup add-completion - ] with-destructors ; - -: open-pipe-r/w ( path -- handle ) - { GENERIC_READ GENERIC_WRITE } flags - OPEN_EXISTING 0 open-file ; - -: open-read ( path -- handle length ) - GENERIC_READ OPEN_EXISTING 0 open-file 0 ; - -: open-write ( path -- handle length ) - GENERIC_WRITE CREATE_ALWAYS 0 open-file 0 ; - -: (open-append) ( path -- handle ) - GENERIC_WRITE OPEN_ALWAYS 0 open-file ; - -: open-existing ( path -- handle ) - { GENERIC_READ GENERIC_WRITE } flags - share-mode - f - OPEN_EXISTING - FILE_FLAG_BACKUP_SEMANTICS - f CreateFileW dup win32-error=0/f ; - -: maybe-create-file ( path -- handle ? ) - #! return true if file was just created - { GENERIC_READ GENERIC_WRITE } flags - share-mode - f - OPEN_ALWAYS - 0 CreateFile-flags - f CreateFileW dup win32-error=0/f - GetLastError ERROR_ALREADY_EXISTS = not ; - -: set-file-pointer ( handle length -- ) - dupd d>w/w FILE_BEGIN SetFilePointer - INVALID_SET_FILE_POINTER = [ - CloseHandle "SetFilePointer failed" throw - ] when drop ; - -: open-append ( path -- handle length ) - [ dup file-info size>> ] [ drop 0 ] recover - >r (open-append) r> 2dup set-file-pointer ; - -TUPLE: FileArgs - hFile lpBuffer nNumberOfBytesToRead - lpNumberOfBytesRet lpOverlapped ; - -C: FileArgs - -: make-FileArgs ( port -- ) - [ port-handle win32-file-handle ] keep - [ buffer>> ] keep - [ - buffer>> buffer-length - "DWORD" - ] keep FileArgs-overlapped ; - -: setup-read ( -- hFile lpBuffer nNumberOfBytesToRead lpNumberOfBytesRead lpOverlapped ) - [ FileArgs-hFile ] keep - [ FileArgs-lpBuffer buffer-end ] keep - [ FileArgs-lpBuffer buffer-capacity ] keep - [ FileArgs-lpNumberOfBytesRet ] keep - FileArgs-lpOverlapped ; - -: setup-write ( -- hFile lpBuffer nNumberOfBytesToWrite lpNumberOfBytesWritten lpOverlapped ) - [ FileArgs-hFile ] keep - [ FileArgs-lpBuffer buffer@ ] keep - [ FileArgs-lpBuffer buffer-length ] keep - [ FileArgs-lpNumberOfBytesRet ] keep - FileArgs-lpOverlapped ; - -M: windows (file-reader) ( path -- stream ) - open-read ; - -M: windows (file-writer) ( path -- stream ) - open-write ; - -M: windows (file-appender) ( path -- stream ) - open-append ; - -M: windows move-file ( from to -- ) - [ normalize-path ] bi@ MoveFile win32-error=0/f ; - -M: windows delete-file ( path -- ) - normalize-path DeleteFile win32-error=0/f ; - -M: windows copy-file ( from to -- ) - dup parent-directory make-directories - [ normalize-path ] bi@ 0 CopyFile win32-error=0/f ; - -M: windows make-directory ( path -- ) - normalize-path - f CreateDirectory win32-error=0/f ; - -M: windows delete-directory ( path -- ) - normalize-path - RemoveDirectory win32-error=0/f ; - -HOOK: WSASocket-flags io-backend ( -- DWORD ) - -TUPLE: win32-socket < win32-file ; - -: ( handle -- win32-socket ) - f win32-file boa ; - -: open-socket ( family type -- socket ) - 0 f 0 WSASocket-flags WSASocket dup socket-error ; - -USE: windows.winsock -: init-sockaddr ( port# addrspec -- sockaddr ) - dup sockaddr-type - [ swap protocol-family swap set-sockaddr-in-family ] keep - [ >r htons r> set-sockaddr-in-port ] keep ; - -: server-sockaddr ( port# addrspec -- sockaddr ) - init-sockaddr - [ INADDR_ANY swap set-sockaddr-in-addr ] keep ; - -: bind-socket ( socket sockaddr addrspec -- ) - [ server-sockaddr ] keep - sockaddr-type heap-size bind socket-error ; - -: server-fd ( addrspec type -- fd ) - >r dup protocol-family r> open-socket - dup close-socket-later - dup rot make-sockaddr/size bind socket-error ; - -USE: namespaces - -! http://support.microsoft.com/kb/127144 -! NOTE: Possibly tweak this because of SYN flood attacks -: listen-backlog ( -- n ) HEX: 7fffffff ; inline - -: listen-on-socket ( socket -- ) - listen-backlog listen winsock-return-check ; - -M: win32-socket dispose ( stream -- ) - win32-file-handle closesocket drop ; - -M: windows addrinfo-error ( n -- ) - winsock-return-check ; - -: tcp-socket ( addrspec -- socket ) - protocol-family SOCK_STREAM open-socket ; diff --git a/extra/irc/authors.txt b/extra/irc/client/authors.txt similarity index 100% rename from extra/irc/authors.txt rename to extra/irc/client/authors.txt diff --git a/extra/irc/client/client.factor b/extra/irc/client/client.factor new file mode 100644 index 0000000000..19dca48e1d --- /dev/null +++ b/extra/irc/client/client.factor @@ -0,0 +1,275 @@ +! Copyright (C) 2007 Doug Coleman, Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: arrays combinators concurrency.mailboxes concurrency.futures io + io.encodings.8-bit io.sockets kernel namespaces sequences + sequences.lib splitting threads calendar classes.tuple + ascii assocs accessors destructors ; +IN: irc.client + +! ====================================== +! Setup and running objects +! ====================================== + +SYMBOL: current-irc-client + +: irc-port 6667 ; ! Default irc port + +! "setup" objects +TUPLE: irc-profile server port nickname password ; +C: irc-profile + +TUPLE: irc-channel-profile name password ; +: ( -- irc-channel-profile ) irc-channel-profile new ; + +! "live" objects +TUPLE: nick name channels log ; +C: nick + +TUPLE: irc-client profile nick stream in-messages out-messages join-messages + listeners is-running ; +: ( profile -- irc-client ) + f V{ } clone V{ } clone + f H{ } clone f irc-client boa ; + +TUPLE: irc-listener in-messages out-messages ; +: ( -- irc-listener ) + irc-listener boa ; + +! ====================================== +! Message objects +! ====================================== + +SINGLETON: irc-end ! Message used when the client isn't running anymore + +TUPLE: irc-message line prefix command parameters trailing timestamp ; +TUPLE: logged-in < irc-message name ; +TUPLE: ping < irc-message ; +TUPLE: join < irc-message ; +TUPLE: part < irc-message name channel ; +TUPLE: quit < irc-message ; +TUPLE: privmsg < irc-message name ; +TUPLE: kick < irc-message channel who ; +TUPLE: roomlist < irc-message channel names ; +TUPLE: nick-in-use < irc-message asterisk name ; +TUPLE: notice < irc-message type ; +TUPLE: mode < irc-message name channel mode ; +TUPLE: unhandled < irc-message ; + + ( -- irc-client ) current-irc-client get ; +: irc-stream> ( -- stream ) irc-client> stream>> ; +: irc-write ( s -- ) irc-stream> stream-write ; +: irc-print ( s -- ) irc-stream> [ stream-print ] keep stream-flush ; + +! ====================================== +! IRC client messages +! ====================================== + +: /NICK ( nick -- ) + "NICK " irc-write irc-print ; + +: /LOGIN ( nick -- ) + dup /NICK + "USER " irc-write irc-write + " hostname servername :irc.factor" irc-print ; + +: /CONNECT ( server port -- stream ) + latin1 drop ; + +: /JOIN ( channel password -- ) + "JOIN " irc-write + [ " :" swap 3append ] when* irc-print ; + +: /PART ( channel text -- ) + [ "PART " irc-write irc-write ] dip + " :" irc-write irc-print ; + +: /KICK ( channel who -- ) + [ "KICK " irc-write irc-write ] dip + " " irc-write irc-print ; + +: /PRIVMSG ( nick line -- ) + [ "PRIVMSG " irc-write irc-write ] dip + " :" irc-write irc-print ; + +: /ACTION ( nick line -- ) + [ 1 , "ACTION " % % 1 , ] "" make /PRIVMSG ; + +: /QUIT ( text -- ) + "QUIT :" irc-write irc-print ; + +: /PONG ( text -- ) + "PONG " irc-write irc-print ; + +! ====================================== +! Server message handling +! ====================================== + +USE: prettyprint + +GENERIC: handle-incoming-irc ( irc-message -- ) + +M: irc-message handle-incoming-irc ( irc-message -- ) + . ; + +M: logged-in handle-incoming-irc ( logged-in -- ) + name>> irc-client> nick>> (>>name) ; + +M: ping handle-incoming-irc ( ping -- ) + trailing>> /PONG ; + +M: nick-in-use handle-incoming-irc ( nick-in-use -- ) + name>> "_" append /NICK ; + +M: privmsg handle-incoming-irc ( privmsg -- ) + dup name>> irc-client> listeners>> at + [ in-messages>> mailbox-put ] [ drop ] if* ; + +M: join handle-incoming-irc ( join -- ) + irc-client> join-messages>> mailbox-put ; + +! ====================================== +! Client message handling +! ====================================== + +GENERIC: handle-outgoing-irc ( obj -- ) + +M: privmsg handle-outgoing-irc ( privmsg -- ) + [ name>> ] [ trailing>> ] bi /PRIVMSG ; + +! ====================================== +! Message parsing +! ====================================== + +: split-at-first ( seq separators -- before after ) + dupd [ member? ] curry find + [ cut 1 tail ] + [ swap ] + if ; + +: remove-heading-: ( seq -- seq ) dup ":" head? [ 1 tail ] when ; + +: parse-name ( string -- string ) + remove-heading-: "!" split-at-first drop ; + +: split-prefix ( string -- string/f string ) + dup ":" head? + [ remove-heading-: " " split1 ] + [ f swap ] + if ; + +: split-trailing ( string -- string string/f ) + ":" split1 ; + +: string>irc-message ( string -- object ) + dup split-prefix split-trailing + [ [ blank? ] trim " " split unclip swap ] dip + now irc-message boa ; + +: parse-irc-line ( string -- message ) + string>irc-message + dup command>> { + { "PING" [ \ ping ] } + { "NOTICE" [ \ notice ] } + { "001" [ \ logged-in ] } + { "433" [ \ nick-in-use ] } + { "JOIN" [ \ join ] } + { "PART" [ \ part ] } + { "PRIVMSG" [ \ privmsg ] } + { "QUIT" [ \ quit ] } + { "MODE" [ \ mode ] } + { "KICK" [ \ kick ] } + [ drop \ unhandled ] + } case + [ [ tuple-slots ] [ parameters>> ] bi append ] dip prefix >tuple ; + +! ====================================== +! Reader/Writer +! ====================================== + +: stream-readln-or-close ( stream -- str/f ) + dup stream-readln [ nip ] [ dispose f ] if* ; + +: handle-reader-message ( irc-message -- ) + irc-client> in-messages>> mailbox-put ; + +: handle-stream-close ( -- ) + irc-client> f >>is-running in-messages>> irc-end swap mailbox-put ; + +: reader-loop ( -- ) + irc-client> stream>> stream-readln-or-close [ + parse-irc-line handle-reader-message + ] [ + handle-stream-close + ] if* ; + +: writer-loop ( -- ) + irc-client> out-messages>> mailbox-get handle-outgoing-irc ; + +! ====================================== +! Processing loops +! ====================================== + +: in-multiplexer-loop ( -- ) + irc-client> in-messages>> mailbox-get handle-incoming-irc ; + +! FIXME: Hack, this should be handled better +GENERIC: add-name ( name obj -- obj ) +M: object add-name nip ; +M: privmsg add-name swap >>name ; + +: listener-loop ( name -- ) ! FIXME: take different values from the stack? + dup irc-client> listeners>> at [ + out-messages>> mailbox-get add-name + irc-client> out-messages>> + mailbox-put + ] [ drop ] if* ; + +: spawn-irc-loop ( quot name -- ) + [ [ irc-client> is-running>> ] compose ] dip + spawn-server drop ; + +: spawn-irc ( -- ) + [ reader-loop ] "irc-reader-loop" spawn-irc-loop + [ writer-loop ] "irc-writer-loop" spawn-irc-loop + [ in-multiplexer-loop ] "in-multiplexer-loop" spawn-irc-loop ; + +! ====================================== +! Listener join request handling +! ====================================== + +: make-registered-listener ( join -- listener ) + swap trailing>> + dup [ listener-loop ] curry "listener" spawn-irc-loop + [ irc-client> listeners>> set-at ] curry keep ; + +: make-join-future ( name -- future ) + [ [ swap trailing>> = ] curry ! compare name with channel name + irc-client> join-messages>> 60 seconds rot mailbox-get-timeout? + make-registered-listener ] + curry future ; + +PRIVATE> + +: (connect-irc) ( irc-client -- ) + [ profile>> [ server>> ] keep port>> /CONNECT ] keep + swap >>stream + t >>is-running drop ; + +: connect-irc ( irc-client -- ) + dup current-irc-client [ + [ (connect-irc) ] [ profile>> nickname>> /LOGIN ] bi + spawn-irc + ] with-variable ; + +: listen-to ( irc-client name -- future ) + swap current-irc-client [ [ f /JOIN ] keep make-join-future ] with-variable ; + +! shorcut for privmsgs, etc +: sender>> ( obj -- string ) + prefix>> parse-name ; diff --git a/extra/irc/summary.txt b/extra/irc/client/summary.txt similarity index 100% rename from extra/irc/summary.txt rename to extra/irc/client/summary.txt diff --git a/extra/irc/irc.factor b/extra/irc/irc.factor deleted file mode 100755 index 4dda206c7b..0000000000 --- a/extra/irc/irc.factor +++ /dev/null @@ -1,286 +0,0 @@ -! Copyright (C) 2007 Doug Coleman, Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: arrays calendar combinators channels concurrency.messaging fry io - io.encodings.8-bit io.sockets kernel math namespaces sequences - sequences.lib splitting strings threads - continuations classes.tuple ascii accessors ; -IN: irc - -! utils -: split-at-first ( seq separators -- before after ) - dupd '[ , member? ] find - [ cut 1 tail ] - [ swap ] - if ; - -: spawn-server-linked ( quot name -- thread ) - >r '[ , [ ] [ ] while ] r> - spawn-linked ; -! --- - -! Default irc port -: irc-port 6667 ; - -! Message used when the client isn't running anymore -SINGLETON: irc-end - -! "setup" objects -TUPLE: irc-profile server port nickname password default-channels ; -C: irc-profile - -TUPLE: irc-channel-profile name password auto-rejoin ; -C: irc-channel-profile - -! "live" objects -TUPLE: nick name channels log ; -C: nick - -TUPLE: irc-client profile nick stream stream-channel controller-channel - listeners is-running ; -: ( profile -- irc-client ) - f V{ } clone V{ } clone - f V{ } clone f irc-client boa ; - -USE: prettyprint -TUPLE: irc-listener channel ; -! FIXME: spawn-server-linked con manejo de excepciones, mandar un mensaje final (ya se maneja esto al recibir mensajes del channel? ) -! tener la opción de dejar de correr un client?? -: ( quot -- irc-listener ) - irc-listener boa swap - [ - [ channel>> '[ , from ] ] - [ '[ , curry f spawn drop ] ] - bi* compose "irc-listener" spawn-server-linked drop - ] [ drop ] 2bi ; - -! TUPLE: irc-channel name topic members log attributes ; -! C: irc-channel - -! the delegate of all irc messages -TUPLE: irc-message line prefix command parameters trailing timestamp ; -C: irc-message - -! "irc message" objects -TUPLE: logged-in < irc-message name ; -C: logged-in - -TUPLE: ping < irc-message ; -C: ping - -TUPLE: join_ < irc-message ; -C: join_ - -TUPLE: part < irc-message name channel ; -C: part - -TUPLE: quit ; -C: quit - -TUPLE: privmsg < irc-message name ; -C: privmsg - -TUPLE: kick < irc-message channel who ; -C: kick - -TUPLE: roomlist < irc-message channel names ; -C: roomlist - -TUPLE: nick-in-use < irc-message name ; -C: nick-in-use - -TUPLE: notice < irc-message type ; -C: notice - -TUPLE: mode < irc-message name channel mode ; -C: mode - -TUPLE: unhandled < irc-message ; -C: unhandled - -SYMBOL: irc-client -: irc-client> ( -- irc-client ) irc-client get ; -: irc-stream> ( -- stream ) irc-client> stream>> ; - -: remove-heading-: ( seq -- seq ) dup ":" head? [ 1 tail ] when ; - -: parse-name ( string -- string ) - remove-heading-: "!" split-at-first drop ; - -: sender>> ( obj -- string ) - prefix>> parse-name ; - -: split-prefix ( string -- string/f string ) - dup ":" head? - [ remove-heading-: " " split1 ] - [ f swap ] - if ; - -: split-trailing ( string -- string string/f ) - ":" split1 ; - -: string>irc-message ( string -- object ) - dup split-prefix split-trailing - [ [ blank? ] trim " " split unclip swap ] dip - now ; - -: me? ( name -- ? ) - irc-client> nick>> name>> = ; - -: irc-write ( s -- ) - irc-stream> stream-write ; - -: irc-print ( s -- ) - irc-stream> [ stream-print ] keep stream-flush ; - -! Irc commands - -: NICK ( nick -- ) - "NICK " irc-write irc-print ; - -: LOGIN ( nick -- ) - dup NICK - "USER " irc-write irc-write - " hostname servername :irc.factor" irc-print ; - -: CONNECT ( server port -- stream ) - latin1 ; - -: JOIN ( channel password -- ) - "JOIN " irc-write - [ " :" swap 3append ] when* irc-print ; - -: PART ( channel text -- ) - [ "PART " irc-write irc-write ] dip - " :" irc-write irc-print ; - -: KICK ( channel who -- ) - [ "KICK " irc-write irc-write ] dip - " " irc-write irc-print ; - -: PRIVMSG ( nick line -- ) - [ "PRIVMSG " irc-write irc-write ] dip - " :" irc-write irc-print ; - -: SAY ( nick line -- ) - PRIVMSG ; - -: ACTION ( nick line -- ) - [ 1 , "ACTION " % % 1 , ] "" make PRIVMSG ; - -: QUIT ( text -- ) - "QUIT :" irc-write irc-print ; - -: join-channel ( channel-profile -- ) - [ name>> ] keep password>> JOIN ; - -: irc-connect ( irc-client -- ) - [ profile>> [ server>> ] keep port>> CONNECT ] keep - swap >>stream t >>is-running drop ; - -GENERIC: handle-irc ( obj -- ) - -M: object handle-irc ( obj -- ) - drop ; - -M: logged-in handle-irc ( obj -- ) - name>> - irc-client> [ nick>> swap >>name drop ] keep - profile>> default-channels>> [ join-channel ] each ; - -M: ping handle-irc ( obj -- ) - "PONG " irc-write - trailing>> irc-print ; - -M: nick-in-use handle-irc ( obj -- ) - name>> "_" append NICK ; - -: parse-irc-line ( string -- message ) - string>irc-message - dup command>> { - { "PING" [ \ ping ] } - { "NOTICE" [ \ notice ] } - { "001" [ \ logged-in ] } - { "433" [ \ nick-in-use ] } - { "JOIN" [ \ join_ ] } - { "PART" [ \ part ] } - { "PRIVMSG" [ \ privmsg ] } - { "QUIT" [ \ quit ] } - { "MODE" [ \ mode ] } - { "KICK" [ \ kick ] } - [ drop \ unhandled ] - } case - [ [ tuple-slots ] [ parameters>> ] bi append ] dip prefix >tuple ; - -! Reader -: handle-reader-message ( irc-client irc-message -- ) - dup handle-irc swap stream-channel>> to ; - -: reader-loop ( irc-client -- ) - dup stream>> stream-readln [ - dup print parse-irc-line handle-reader-message - ] [ - f >>is-running - dup stream>> dispose - irc-end over controller-channel>> to - stream-channel>> irc-end swap to - ] if* ; - -! Controller commands -GENERIC: handle-command ( obj -- ) - -M: object handle-command ( obj -- ) - . ; - -TUPLE: send-message to text ; -C: send-message -M: send-message handle-command ( obj -- ) - dup to>> swap text>> SAY ; - -TUPLE: send-action to text ; -C: send-action -M: send-action handle-command ( obj -- ) - dup to>> swap text>> ACTION ; - -TUPLE: send-quit text ; -C: send-quit -M: send-quit handle-command ( obj -- ) - text>> QUIT ; - -: irc-listen ( irc-client quot -- ) - [ listeners>> ] [ ] bi* swap push ; - -! Controller loop -: controller-loop ( irc-client -- ) - controller-channel>> from handle-command ; - -! Multiplexer -: multiplex-message ( irc-client message -- ) - swap listeners>> [ channel>> ] map - [ '[ , , to ] "message" spawn drop ] each-with ; - -: multiplexer-loop ( irc-client -- ) - dup stream-channel>> from multiplex-message ; - -! process looping and starting -: (spawn-irc-loop) ( irc-client quot name -- ) - [ over >r curry r> '[ @ , is-running>> ] ] dip - spawn-server-linked drop ; - -: spawn-irc-loop ( irc-client quot name -- ) - '[ , , , [ (spawn-irc-loop) receive ] [ print ] recover ] - f spawn drop ; - -: spawn-irc ( irc-client -- ) - [ [ reader-loop ] "reader-loop" spawn-irc-loop ] - [ [ controller-loop ] "controller-loop" spawn-irc-loop ] - [ [ multiplexer-loop ] "multiplexer-loop" spawn-irc-loop ] - tri ; - -: do-irc ( irc-client -- ) - irc-client [ - irc-client> - [ irc-connect ] - [ profile>> nickname>> LOGIN ] - [ spawn-irc ] - tri - ] with-variable ; \ No newline at end of file diff --git a/extra/jamshred/deploy.factor b/extra/jamshred/deploy.factor new file mode 100644 index 0000000000..9a18cf1f9b --- /dev/null +++ b/extra/jamshred/deploy.factor @@ -0,0 +1,12 @@ +USING: tools.deploy.config ; +V{ + { deploy-ui? t } + { deploy-io 1 } + { deploy-reflection 1 } + { deploy-compiler? t } + { deploy-math? t } + { deploy-word-props? f } + { deploy-c-types? f } + { "stop-after-last-window?" t } + { deploy-name "Jamshred" } +} diff --git a/extra/jamshred/game/game.factor b/extra/jamshred/game/game.factor index 3842816f0e..938605ce9f 100644 --- a/extra/jamshred/game/game.factor +++ b/extra/jamshred/game/game.factor @@ -1,26 +1,40 @@ ! Copyright (C) 2007 Alex Chapman ! See http://factorcode.org/license.txt for BSD license. -USING: kernel opengl arrays sequences jamshred.tunnel -jamshred.player math.vectors ; +USING: accessors kernel opengl arrays sequences jamshred.log jamshred.player jamshred.sound jamshred.tunnel math math.constants math.vectors ; IN: jamshred.game -TUPLE: jamshred tunnel players running ; +TUPLE: jamshred sounds tunnel players running quit ; : ( -- jamshred ) - "Player 1" 2dup swap play-in-tunnel 1array f - jamshred boa ; + "Player 1" pick + 2dup swap play-in-tunnel 1array f f jamshred boa ; : jamshred-player ( jamshred -- player ) ! TODO: support more than one player - jamshred-players first ; + players>> first ; : jamshred-update ( jamshred -- ) - dup jamshred-running [ + dup running>> [ jamshred-player update-player ] [ drop ] if ; : toggle-running ( jamshred -- ) - dup jamshred-running not swap set-jamshred-running ; + dup running>> [ + f >>running drop + ] [ + [ jamshred-player moved ] + [ t >>running drop ] bi + ] if ; : mouse-moved ( x-radians y-radians jamshred -- ) jamshred-player -rot turn-player ; + +: units-per-full-roll ( -- n ) 50 ; + +: jamshred-roll ( jamshred n -- ) + [ jamshred-player ] dip 2 pi * * units-per-full-roll / roll-player ; + +: mouse-scroll-x ( jamshred x -- ) jamshred-roll ; + +: mouse-scroll-y ( jamshred y -- ) + neg swap jamshred-player change-player-speed ; diff --git a/extra/jamshred/gl/gl.factor b/extra/jamshred/gl/gl.factor index 85c5a8dbaf..4171c79a0a 100644 --- a/extra/jamshred/gl/gl.factor +++ b/extra/jamshred/gl/gl.factor @@ -1,8 +1,6 @@ ! Copyright (C) 2007 Alex Chapman ! See http://factorcode.org/license.txt for BSD license. -USING: alien.c-types colors jamshred.game jamshred.oint -jamshred.player jamshred.tunnel kernel math math.vectors opengl -opengl.gl opengl.glu sequences ; +USING: accessors alien.c-types colors jamshred.game jamshred.oint jamshred.player jamshred.tunnel kernel math math.constants math.functions math.vectors opengl opengl.gl opengl.glu sequences ; IN: jamshred.gl : min-vertices 6 ; inline @@ -14,6 +12,35 @@ IN: jamshred.gl : n-segments-ahead ( -- n ) 60 ; inline : n-segments-behind ( -- n ) 40 ; inline +: wall-drawing-offset ( -- n ) + #! so that we can't see through the wall, we draw it a bit further away + 0.15 ; + +: wall-drawing-radius ( segment -- r ) + radius>> wall-drawing-offset + ; + +: wall-up ( segment -- v ) + [ wall-drawing-radius ] [ up>> ] bi n*v ; + +: wall-left ( segment -- v ) + [ wall-drawing-radius ] [ left>> ] bi n*v ; + +: segment-vertex ( theta segment -- vertex ) + [ + [ wall-up swap sin v*n ] [ wall-left swap cos v*n ] 2bi v+ + ] [ + location>> v+ + ] bi ; + +: segment-vertex-normal ( vertex segment -- normal ) + location>> swap v- normalize ; + +: segment-vertex-and-normal ( segment theta -- vertex normal ) + swap [ segment-vertex ] keep dupd segment-vertex-normal ; + +: equally-spaced-radians ( n -- seq ) + #! return a sequence of n numbers between 0 and 2pi + dup [ / pi 2 * * ] curry map ; : draw-segment-vertex ( segment theta -- ) over segment-color gl-color segment-vertex-and-normal gl-normal gl-vertex ; @@ -37,10 +64,6 @@ IN: jamshred.gl : draw-tunnel ( player -- ) segments-to-render draw-segments ; -! : draw-tunnel ( player tunnel -- ) -! tuck swap player-nearest-segment segment-number dup n-segments-behind - -! swap n-segments-ahead + rot sub-tunnel draw-segments ; - : init-graphics ( width height -- ) GL_DEPTH_TEST glEnable GL_SCISSOR_TEST glDisable @@ -55,18 +78,18 @@ IN: jamshred.gl GL_LIGHT0 glEnable GL_FOG glEnable GL_FOG_DENSITY 0.09 glFogf + GL_FRONT GL_AMBIENT_AND_DIFFUSE glColorMaterial GL_COLOR_MATERIAL glEnable - GL_FRONT_AND_BACK GL_AMBIENT_AND_DIFFUSE glColorMaterial - GL_LIGHT0 GL_POSITION F{ 0.0 0.0 -3.0 1.0 } >c-float-array glLightfv + GL_LIGHT0 GL_POSITION F{ 0.0 0.0 0.0 1.0 } >c-float-array glLightfv GL_LIGHT0 GL_AMBIENT F{ 0.2 0.2 0.2 1.0 } >c-float-array glLightfv GL_LIGHT0 GL_DIFFUSE F{ 1.0 1.0 1.0 1.0 } >c-float-array glLightfv GL_LIGHT0 GL_SPECULAR F{ 1.0 1.0 1.0 1.0 } >c-float-array glLightfv ; : player-view ( player -- ) - [ oint-location first3 ] keep - [ dup oint-location swap oint-forward v+ first3 ] keep - oint-up first3 gluLookAt ; + [ location>> ] + [ [ location>> ] [ forward>> ] bi v+ ] + [ up>> ] tri gl-look-at ; : draw-jamshred ( jamshred width height -- ) - init-graphics jamshred-player dup player-view draw-tunnel ; + init-graphics jamshred-player [ player-view ] [ draw-tunnel ] bi ; diff --git a/extra/jamshred/jamshred.factor b/extra/jamshred/jamshred.factor index 42414b9893..b7764894d1 100755 --- a/extra/jamshred/jamshred.factor +++ b/extra/jamshred/jamshred.factor @@ -1,41 +1,51 @@ ! Copyright (C) 2007, 2008 Alex Chapman ! See http://factorcode.org/license.txt for BSD license. -USING: alarms arrays calendar jamshred.game jamshred.gl kernel math -math.constants namespaces sequences ui ui.gadgets ui.gestures ui.render -math.vectors ; +USING: accessors alarms arrays calendar jamshred.game jamshred.gl jamshred.player jamshred.log kernel math math.constants namespaces sequences threads ui ui.backend ui.gadgets ui.gadgets.worlds ui.gestures ui.render math.vectors ; IN: jamshred TUPLE: jamshred-gadget jamshred last-hand-loc alarm ; : ( jamshred -- gadget ) - jamshred-gadget construct-gadget tuck set-jamshred-gadget-jamshred ; + jamshred-gadget construct-gadget swap >>jamshred ; -: default-width ( -- x ) 1024 ; -: default-height ( -- y ) 768 ; +: default-width ( -- x ) 800 ; +: default-height ( -- y ) 600 ; M: jamshred-gadget pref-dim* drop default-width default-height 2array ; M: jamshred-gadget draw-gadget* ( gadget -- ) - dup jamshred-gadget-jamshred swap rect-dim first2 draw-jamshred ; + [ jamshred>> ] [ rect-dim first2 draw-jamshred ] bi ; -: tick ( gadget -- ) - dup jamshred-gadget-jamshred jamshred-update relayout-1 ; +: jamshred-loop ( gadget -- ) + dup jamshred>> quit>> [ + drop + ] [ + [ jamshred>> jamshred-update ] + [ relayout-1 ] + [ yield jamshred-loop ] tri + ] if ; + +: fullscreen ( gadget -- ) + find-world t swap set-fullscreen* ; + +: no-fullscreen ( gadget -- ) + find-world f swap set-fullscreen* ; + +: toggle-fullscreen ( world -- ) + [ fullscreen? not ] keep set-fullscreen* ; M: jamshred-gadget graft* ( gadget -- ) - [ - [ tick ] curry 10 milliseconds from-now 10 milliseconds add-alarm - ] keep set-jamshred-gadget-alarm ; + [ jamshred-loop ] in-thread drop ; M: jamshred-gadget ungraft* ( gadget -- ) - [ jamshred-gadget-alarm cancel-alarm f ] keep - set-jamshred-gadget-alarm ; + jamshred>> t swap (>>quit) ; : jamshred-restart ( jamshred-gadget -- ) - swap set-jamshred-gadget-jamshred ; + >>jamshred drop ; : pix>radians ( n m -- theta ) - 2 / / pi 2 * * ; + / pi 4 * * ; ! 2 / / pi 2 * * ; : x>radians ( x gadget -- theta ) #! translate motion of x pixels to an angle @@ -46,25 +56,39 @@ M: jamshred-gadget ungraft* ( gadget -- ) rect-dim second pix>radians ; : (handle-mouse-motion) ( jamshred-gadget mouse-motion -- ) - over jamshred-gadget-jamshred >r + over jamshred>> >r [ first swap x>radians ] 2keep second swap y>radians r> mouse-moved ; : handle-mouse-motion ( jamshred-gadget -- ) hand-loc get [ - over jamshred-gadget-last-hand-loc [ + over last-hand-loc>> [ v- (handle-mouse-motion) ] [ 2drop ] if* - ] 2keep swap set-jamshred-gadget-last-hand-loc ; + ] 2keep >>last-hand-loc drop ; + +: handle-mouse-scroll ( jamshred-gadget -- ) + jamshred>> scroll-direction get + [ first mouse-scroll-x ] + [ second mouse-scroll-y ] 2bi ; + +: quit ( gadget -- ) + [ no-fullscreen ] [ close-window ] bi ; -USE: vocabs.loader jamshred-gadget H{ { T{ key-down f f "r" } [ jamshred-restart ] } - { T{ key-down f f " " } [ jamshred-gadget-jamshred toggle-running ] } + { T{ key-down f f " " } [ jamshred>> toggle-running ] } + { T{ key-down f f "f" } [ find-world toggle-fullscreen ] } + { T{ key-down f f "UP" } [ jamshred>> jamshred-player 1 swap change-player-speed ] } + { T{ key-down f f "DOWN" } [ jamshred>> jamshred-player -1 swap change-player-speed ] } + { T{ key-down f f "LEFT" } [ jamshred>> 1 jamshred-roll ] } + { T{ key-down f f "RIGHT" } [ jamshred>> -1 jamshred-roll ] } + { T{ key-down f f "q" } [ quit ] } { T{ motion } [ handle-mouse-motion ] } + { T{ mouse-scroll } [ handle-mouse-scroll ] } } set-gestures -: jamshred-window ( -- ) - [ "Jamshred" open-window ] with-ui ; +: jamshred-window ( -- jamshred ) + [ dup "Jamshred" open-window ] with-ui ; MAIN: jamshred-window diff --git a/extra/jamshred/log/log.factor b/extra/jamshred/log/log.factor new file mode 100644 index 0000000000..33498d8a2e --- /dev/null +++ b/extra/jamshred/log/log.factor @@ -0,0 +1,10 @@ +USING: kernel logging ; +IN: jamshred.log + +LOG: (jamshred-log) DEBUG + +: with-jamshred-log ( quot -- ) + "jamshred" swap with-logging ; + +: jamshred-log ( message -- ) + [ (jamshred-log) ] with-jamshred-log ; ! ugly... diff --git a/extra/jamshred/oint/oint-tests.factor b/extra/jamshred/oint/oint-tests.factor new file mode 100644 index 0000000000..401935fd01 --- /dev/null +++ b/extra/jamshred/oint/oint-tests.factor @@ -0,0 +1,8 @@ +USING: jamshred.oint tools.test ; +IN: jamshred.oint-tests + +[ { 0 -1 -1 } ] [ { 0 1 -1 } { 0 -1 0 } reflect ] unit-test +[ { 0 1 0 } ] [ { 1 1 0 } { 1 0 0 } proj-perp ] unit-test +[ { 1 0 0 } ] [ { 1 1 0 } { 0 1 0 } proj-perp ] unit-test +[ { 1/2 -1/2 0 } ] [ { 1 0 0 } { 1 1 0 } proj-perp ] unit-test +[ { -1/2 1/2 0 } ] [ { 0 1 0 } { 1 1 0 } proj-perp ] unit-test diff --git a/extra/jamshred/oint/oint.factor b/extra/jamshred/oint/oint.factor index 11a89b314f..7a37646a6d 100644 --- a/extra/jamshred/oint/oint.factor +++ b/extra/jamshred/oint/oint.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2007 Alex Chapman ! See http://factorcode.org/license.txt for BSD license. -USING: arrays float-arrays kernel math math.constants math.functions math.matrices math.vectors math.quaternions random sequences ; +USING: accessors arrays float-arrays kernel locals math math.constants math.functions math.matrices math.vectors math.quaternions random sequences ; IN: jamshred.oint ! An oint is a point with three linearly independent unit vectors @@ -9,47 +9,28 @@ IN: jamshred.oint ! segment's location and orientation are given by an oint. TUPLE: oint location forward up left ; - -: ( location forward up left -- oint ) - oint boa ; - -! : x-rotation ( theta -- matrix ) -! #! construct this matrix: -! #! { { 1 0 0 } -! #! { 0 cos(theta) sin(theta) } -! #! { 0 -sin(theta) cos(theta) } } -! dup sin neg swap cos 2dup 0 -rot 3float-array >r -! swap neg 0 -rot 3float-array >r -! { 1 0 0 } r> r> 3float-array ; -! -! : y-rotation ( theta -- matrix ) -! #! costruct this matrix: -! #! { { cos(theta) 0 -sin(theta) } -! #! { 0 1 0 } -! #! { sin(theta) 0 cos(theta) } } -! dup sin swap cos 2dup -! 0 swap 3float-array >r -! { 0 1 0 } >r -! 0 rot neg 3float-array r> r> 3float-array ; - -: apply-to-oint ( oint quot -- ) - #! apply quot to each of forward, up, and left, storing the results - over oint-forward over call pick set-oint-forward - over oint-up over call pick set-oint-up - over oint-left swap call swap set-oint-left ; +C: oint : rotation-quaternion ( theta axis -- quaternion ) swap 2 / dup cos swap sin rot n*v first3 rect> >r rect> r> 2array ; +: rotate-vector ( q qrecip v -- v ) + v>q swap q* q* q>v ; + : rotate-oint ( oint theta axis -- ) - rotation-quaternion dup qrecip - [ rot v>q swap q* q* q>v ] curry curry apply-to-oint ; + rotation-quaternion dup qrecip pick + [ forward>> rotate-vector >>forward ] + [ up>> rotate-vector >>up ] + [ left>> rotate-vector >>left ] 3tri drop ; : left-pivot ( oint theta -- ) - over oint-left rotate-oint ; + over left>> rotate-oint ; : up-pivot ( oint theta -- ) - over oint-up rotate-oint ; + over up>> rotate-oint ; + +: forward-pivot ( oint theta -- ) + over forward>> rotate-oint ; : random-float+- ( n -- m ) #! find a random float between -n/2 and n/2 @@ -58,11 +39,14 @@ TUPLE: oint location forward up left ; : random-turn ( oint theta -- ) 2 / 2dup random-float+- left-pivot random-float+- up-pivot ; +: location+ ( v oint -- ) + [ location>> v+ ] [ (>>location) ] bi ; + : go-forward ( distance oint -- ) - tuck oint-forward n*v over oint-location v+ swap set-oint-location ; + [ forward>> n*v ] [ location+ ] bi ; : distance-vector ( oint oint -- vector ) - oint-location swap oint-location v- ; + [ location>> ] bi@ swap v- ; : distance ( oint oint -- distance ) distance-vector norm ; @@ -71,6 +55,19 @@ TUPLE: oint location forward up left ; #! the scalar projection of v1 onto v2 tuck v. swap norm / ; +: proj-perp ( u v -- w ) + dupd proj v- ; + : perpendicular-distance ( oint oint -- distance ) - tuck distance-vector swap 2dup oint-left scalar-projection abs - -rot oint-up scalar-projection abs + ; + tuck distance-vector swap 2dup left>> scalar-projection abs + -rot up>> scalar-projection abs + ; + +:: reflect ( v n -- v' ) + #! bounce v on a surface with normal n + v v n v. n n v. / 2 * n n*v v- ; + +: half-way ( p1 p2 -- p3 ) + over v- 2 v/n v+ ; + +: half-way-between-oints ( o1 o2 -- p ) + [ location>> ] bi@ half-way ; diff --git a/extra/jamshred/player/player.factor b/extra/jamshred/player/player.factor index 17843ef9c2..c40729e35b 100644 --- a/extra/jamshred/player/player.factor +++ b/extra/jamshred/player/player.factor @@ -1,38 +1,126 @@ -! Copyright (C) 2007 Alex Chapman +! Copyright (C) 2007, 2008 Alex Chapman ! See http://factorcode.org/license.txt for BSD license. -USING: colors jamshred.oint jamshred.tunnel kernel -math math.constants sequences ; +USING: accessors colors combinators jamshred.log jamshred.oint jamshred.sound jamshred.tunnel kernel locals math math.constants math.order math.ranges math.vectors math.matrices shuffle sequences system ; +USE: tools.walker IN: jamshred.player -TUPLE: player name tunnel nearest-segment ; +TUPLE: player < oint name sounds tunnel nearest-segment last-move speed ; -: ( name -- player ) - f f player boa - F{ 0 0 5 } F{ 0 0 -1 } F{ 0 1 0 } F{ -1 0 0 } over set-delegate ; +! speeds are in GL units / second +: default-speed ( -- speed ) 1.0 ; +: max-speed ( -- speed ) 30.0 ; + +: ( name sounds -- player ) + [ F{ 0 0 5 } F{ 0 0 -1 } F{ 0 1 0 } F{ -1 0 0 } ] 2dip + f f f default-speed player boa ; : turn-player ( player x-radians y-radians -- ) >r over r> left-pivot up-pivot ; +: roll-player ( player z-radians -- ) + forward-pivot ; + : to-tunnel-start ( player -- ) - dup player-tunnel first dup oint-location pick set-oint-location - swap set-player-nearest-segment ; + [ tunnel>> first dup location>> ] + [ tuck (>>location) (>>nearest-segment) ] bi ; : play-in-tunnel ( player segments -- ) - over set-player-tunnel to-tunnel-start ; + >>tunnel to-tunnel-start ; : update-nearest-segment ( player -- ) - dup player-tunnel over dup player-nearest-segment nearest-segment - swap set-player-nearest-segment ; + [ tunnel>> ] [ dup nearest-segment>> nearest-segment ] + [ (>>nearest-segment) ] tri ; -: max-speed ( -- speed ) - 0.3 ; +: update-time ( player -- seconds-passed ) + millis swap [ last-move>> - 1000 / ] [ (>>last-move) ] 2bi ; -: player-speed ( player -- speed ) - dup player-nearest-segment fraction-from-wall sq max-speed * ; +: moved ( player -- ) millis swap (>>last-move) ; + +: speed-range ( -- range ) + max-speed [0,b] ; + +: change-player-speed ( inc player -- ) + [ + speed-range clamp-to-range ] change-speed drop ; + +: multiply-player-speed ( n player -- ) + [ * speed-range clamp-to-range ] change-speed drop ; + +: distance-to-move ( seconds-passed player -- distance ) + speed>> * ; + +: bounce ( d-left player -- d-left' player ) + { + [ dup nearest-segment>> bounce-off-wall ] + [ sounds>> bang ] + [ 3/4 swap multiply-player-speed ] + [ ] + } cleave ; + +:: (distance) ( heading player -- current next location heading ) + player nearest-segment>> + player [ tunnel>> ] [ nearest-segment>> ] bi heading heading-segment + player location>> heading ; + +: distance-to-heading-segment ( heading player -- distance ) + (distance) distance-to-next-segment ; + +: distance-to-heading-segment-area ( heading player -- distance ) + (distance) distance-to-next-segment-area ; + +: distance-to-collision ( player -- distance ) + dup nearest-segment>> (distance-to-collision) ; + +: from ( player -- radius distance-from-centre ) + [ nearest-segment>> dup radius>> swap ] [ location>> ] bi + distance-from-centre ; + +: distance-from-wall ( player -- distance ) from - ; +: fraction-from-centre ( player -- fraction ) from swap / ; +: fraction-from-wall ( player -- fraction ) + fraction-from-centre 1 swap - ; + +: update-nearest-segment2 ( heading player -- ) + 2dup distance-to-heading-segment-area 0 <= [ + [ tunnel>> ] [ nearest-segment>> rot heading-segment ] + [ (>>nearest-segment) ] tri + ] [ + 2drop + ] if ; + +:: move-player-on-heading ( d-left player distance heading -- d-left' player ) + [let* | d-to-move [ d-left distance min ] + move-v [ d-to-move heading n*v ] | + move-v player location+ + heading player update-nearest-segment2 + d-left d-to-move - player ] ; + +: move-toward-wall ( d-left player d-to-wall -- d-left' player ) + over [ forward>> ] keep distance-to-heading-segment-area min + over forward>> move-player-on-heading ; + +: ?move-player-freely ( d-left player -- d-left' player ) + over 0 > [ + dup distance-to-collision dup 0.2 > [ ! bug! should be 0, not 0.2 + move-toward-wall ?move-player-freely + ] [ drop ] if + ] when ; + +: drag-heading ( player -- heading ) + [ forward>> ] [ nearest-segment>> forward>> proj ] bi ; + +: drag-player ( d-left player -- d-left' player ) + dup [ [ drag-heading ] keep distance-to-heading-segment-area ] + [ drag-heading move-player-on-heading ] bi ; + +: (move-player) ( d-left player -- d-left' player ) + ?move-player-freely over 0 > [ + ! bounce + drag-player + (move-player) + ] when ; : move-player ( player -- ) - dup player-speed over go-forward update-nearest-segment ; + [ update-time ] [ distance-to-move ] [ (move-player) 2drop ] tri ; : update-player ( player -- ) - dup move-player player-nearest-segment - white swap set-segment-color ; + [ move-player ] [ nearest-segment>> white swap (>>color) ] bi ; diff --git a/extra/jamshred/sound/bang.wav b/extra/jamshred/sound/bang.wav new file mode 100644 index 0000000000..b15af141ec Binary files /dev/null and b/extra/jamshred/sound/bang.wav differ diff --git a/extra/jamshred/sound/sound.factor b/extra/jamshred/sound/sound.factor new file mode 100644 index 0000000000..fd1b1127bd --- /dev/null +++ b/extra/jamshred/sound/sound.factor @@ -0,0 +1,13 @@ +USING: accessors io.files kernel openal sequences ; +IN: jamshred.sound + +TUPLE: sounds bang ; + +: assign-sound ( source wav-path -- ) + resource-path create-buffer-from-wav AL_BUFFER swap set-source-param ; + +: ( -- sounds ) + init-openal 1 gen-sources first sounds boa + dup bang>> "extra/jamshred/sound/bang.wav" assign-sound ; + +: bang ( sounds -- ) bang>> source-play check-error ; diff --git a/extra/jamshred/tunnel/tunnel-tests.factor b/extra/jamshred/tunnel/tunnel-tests.factor index 8031678896..722609851a 100644 --- a/extra/jamshred/tunnel/tunnel-tests.factor +++ b/extra/jamshred/tunnel/tunnel-tests.factor @@ -1,10 +1,10 @@ ! Copyright (C) 2007 Alex Chapman ! See http://factorcode.org/license.txt for BSD license. -USING: jamshred.oint jamshred.tunnel kernel sequences tools.test ; +USING: arrays jamshred.oint jamshred.tunnel kernel math.vectors sequences tools.test ; IN: jamshred.tunnel.tests -[ 0 ] [ T{ segment T{ oint f { 0 0 0 } } 0 } - T{ segment T{ oint f { 1 1 1 } } 1 } +[ 0 ] [ T{ segment f { 0 0 0 } f f f 0 } + T{ segment f { 1 1 1 } f f f 1 } T{ oint f { 0 0 0.25 } } nearer-segment segment-number ] unit-test @@ -15,3 +15,31 @@ IN: jamshred.tunnel.tests [ 3 ] [ T{ oint f { 0 0 -3.25 } } 0 nearest-segment-forward segment-number ] unit-test [ F{ 0 0 0 } ] [ T{ oint f { 0 0 -0.25 } } over first nearest-segment oint-location ] unit-test + +: test-segment-oint ( -- oint ) + { 0 0 0 } { 0 0 -1 } { 0 1 0 } { -1 0 0 } ; + +[ { -1 0 0 } ] [ test-segment-oint { 1 0 0 } vector-to-centre ] unit-test +[ { 1 0 0 } ] [ test-segment-oint { -1 0 0 } vector-to-centre ] unit-test +[ { 0 -1 0 } ] [ test-segment-oint { 0 1 0 } vector-to-centre ] unit-test +[ { 0 1 0 } ] [ test-segment-oint { 0 -1 0 } vector-to-centre ] unit-test +[ { -1 0 0 } ] [ test-segment-oint { 1 0 -1 } vector-to-centre ] unit-test +[ { 1 0 0 } ] [ test-segment-oint { -1 0 -1 } vector-to-centre ] unit-test +[ { 0 -1 0 } ] [ test-segment-oint { 0 1 -1 } vector-to-centre ] unit-test +[ { 0 1 0 } ] [ test-segment-oint { 0 -1 -1 } vector-to-centre ] unit-test + +: simplest-straight-ahead ( -- oint segment ) + { 0 0 0 } { 0 0 -1 } { 0 1 0 } { -1 0 0 } + initial-segment ; + +[ { 0 0 0 } ] [ simplest-straight-ahead sideways-heading ] unit-test +[ { 0 0 0 } ] [ simplest-straight-ahead sideways-relative-location ] unit-test + +: simple-collision-up ( -- oint segment ) + { 0 0 0 } { 0 1 0 } { 0 0 1 } { -1 0 0 } + initial-segment ; + +[ { 0 1 0 } ] [ simple-collision-up sideways-heading ] unit-test +[ { 0 0 0 } ] [ simple-collision-up sideways-relative-location ] unit-test +[ { 0 1 0 } ] +[ simple-collision-up collision-vector 0 0 0 3array v+ ] unit-test diff --git a/extra/jamshred/tunnel/tunnel.factor b/extra/jamshred/tunnel/tunnel.factor index d5ee7f3ebc..99c396bebd 100755 --- a/extra/jamshred/tunnel/tunnel.factor +++ b/extra/jamshred/tunnel/tunnel.factor @@ -1,33 +1,16 @@ -! Copyright (C) 2007 Alex Chapman +! Copyright (C) 2007, 2008 Alex Chapman ! See http://factorcode.org/license.txt for BSD license. -USING: arrays float-arrays kernel jamshred.oint math math.functions -math.ranges math.vectors math.constants random sequences vectors ; +USING: accessors arrays combinators float-arrays kernel jamshred.oint locals math math.constants math.matrices math.order math.ranges math.vectors math.quadratic random sequences vectors ; +USE: tools.walker IN: jamshred.tunnel : n-segments ( -- n ) 5000 ; inline -TUPLE: segment number color radius ; - -: ( number color radius location forward up left -- segment ) - >r segment boa r> over set-delegate ; - -: segment-vertex ( theta segment -- vertex ) - tuck 2dup oint-up swap sin v*n - >r oint-left swap cos v*n r> v+ - swap oint-location v+ ; - -: segment-vertex-normal ( vertex segment -- normal ) - oint-location swap v- normalize ; - -: segment-vertex-and-normal ( segment theta -- vertex normal ) - swap [ segment-vertex ] keep dupd segment-vertex-normal ; - -: equally-spaced-radians ( n -- seq ) - #! return a sequence of n numbers between 0 and 2pi - dup [ / pi 2 * * ] curry map ; +TUPLE: segment < oint number color radius ; +C: segment : segment-number++ ( segment -- ) - dup segment-number 1+ swap set-segment-number ; + [ number>> 1+ ] keep (>>number) ; : random-color ( -- color ) { 100 100 100 } [ random 100 / >float ] map { 1.0 } append ; @@ -43,22 +26,20 @@ TUPLE: segment number color radius ; : (random-segments) ( segments n -- segments ) dup 0 > [ >r dup peek random-segment over push r> 1- (random-segments) - ] [ - drop - ] if ; + ] [ drop ] if ; : default-segment-radius ( -- r ) 1 ; : initial-segment ( -- segment ) - 0 random-color default-segment-radius - F{ 0 0 0 } F{ 0 0 -1 } F{ 0 1 0 } F{ -1 0 0 } ; + F{ 0 0 0 } F{ 0 0 -1 } F{ 0 1 0 } F{ -1 0 0 } + 0 random-color default-segment-radius ; : random-segments ( n -- segments ) initial-segment 1vector swap (random-segments) ; : simple-segment ( n -- segment ) - random-color default-segment-radius pick F{ 0 0 -1 } n*v - F{ 0 0 -1 } F{ 0 1 0 } F{ -1 0 0 } ; + [ F{ 0 0 -1 } n*v F{ 0 0 -1 } F{ 0 1 0 } F{ -1 0 0 } ] keep + random-color default-segment-radius ; : simple-segments ( n -- segments ) [ simple-segment ] map ; @@ -69,7 +50,7 @@ TUPLE: segment number color radius ; : ( -- segments ) n-segments simple-segments ; -: sub-tunnel ( from to sements -- segments ) +: sub-tunnel ( from to segments -- segments ) #! return segments between from and to, after clamping from and to to #! valid values [ sequence-index-range [ clamp-to-range ] curry bi@ ] keep ; @@ -84,7 +65,7 @@ TUPLE: segment number color radius ; pick >r nearer-segment dup r> = ; : find-nearest-segment ( oint segments -- segment ) - dup first swap 1 tail-slice rot [ (find-nearest-segment) ] curry + dup first swap rest-slice rot [ (find-nearest-segment) ] curry find 2drop ; : nearest-segment-forward ( segments oint start -- segment ) @@ -100,14 +81,86 @@ TUPLE: segment number color radius ; [ nearest-segment-forward ] 3keep nearest-segment-backward r> nearer-segment ; -: distance-from-centre ( oint segment -- distance ) - perpendicular-distance ; +: get-segment ( segments n -- segment ) + over sequence-index-range clamp-to-range swap nth ; -: distance-from-wall ( oint segment -- distance ) - tuck distance-from-centre swap segment-radius swap - ; +: next-segment ( segments current-segment -- segment ) + number>> 1+ get-segment ; -: fraction-from-centre ( oint segment -- fraction ) - tuck distance-from-centre swap segment-radius / ; +: previous-segment ( segments current-segment -- segment ) + number>> 1- get-segment ; + +: heading-segment ( segments current-segment heading -- segment ) + #! the next segment on the given heading + over forward>> v. 0 <=> { + { +gt+ [ next-segment ] } + { +lt+ [ previous-segment ] } + { +eq+ [ nip ] } ! current segment + } case ; + +:: distance-to-next-segment ( current next location heading -- distance ) + [let | cf [ current forward>> ] | + cf next location>> v. cf location v. - cf heading v. / ] ; + +:: distance-to-next-segment-area ( current next location heading -- distance ) + [let | cf [ current forward>> ] + h [ next current half-way-between-oints ] | + cf h v. cf location v. - cf heading v. / ] ; + +: vector-to-centre ( seg loc -- v ) + over location>> swap v- swap forward>> proj-perp ; + +: distance-from-centre ( seg loc -- distance ) + vector-to-centre norm ; + +: wall-normal ( seg oint -- n ) + location>> vector-to-centre normalize ; + +: distant ( -- n ) 1000 ; + +: max-real ( a b -- c ) + #! sometimes collision-coefficient yields complex roots, so we ignore these (hack) + dup real? [ + over real? [ max ] [ nip ] if + ] [ + drop dup real? [ drop distant ] unless + ] if ; + +:: collision-coefficient ( v w r -- c ) + v norm 0 = [ + distant + ] [ + [let* | a [ v dup v. ] + b [ v w v. 2 * ] + c [ w dup v. r sq - ] | + c b a quadratic max-real ] + ] if ; + +: sideways-heading ( oint segment -- v ) + [ forward>> ] bi@ proj-perp ; + +: sideways-relative-location ( oint segment -- loc ) + [ [ location>> ] bi@ v- ] keep forward>> proj-perp ; + +: (distance-to-collision) ( oint segment -- distance ) + [ sideways-heading ] [ sideways-relative-location ] + [ nip radius>> ] 2tri collision-coefficient ; + +: collision-vector ( oint segment -- v ) + dupd (distance-to-collision) swap forward>> n*v ; + +: bounce-forward ( segment oint -- ) + [ wall-normal ] [ forward>> swap reflect ] [ (>>forward) ] tri ; + +: bounce-left ( segment oint -- ) + #! must be done after forward + [ forward>> vneg ] dip [ left>> swap reflect ] + [ forward>> proj-perp normalize ] [ (>>left) ] tri ; + +: bounce-up ( segment oint -- ) + #! must be done after forward and left! + nip [ forward>> ] [ left>> cross ] [ (>>up) ] tri ; + +: bounce-off-wall ( oint segment -- ) + swap [ bounce-forward ] [ bounce-left ] [ bounce-up ] 2tri ; -: fraction-from-wall ( oint segment -- fraction ) - fraction-from-centre 1 swap - ; diff --git a/extra/json/reader/reader-tests.factor b/extra/json/reader/reader-tests.factor new file mode 100644 index 0000000000..4b7bd56f01 --- /dev/null +++ b/extra/json/reader/reader-tests.factor @@ -0,0 +1,43 @@ +USING: arrays json.reader kernel multiline strings tools.test ; +IN: json.reader.tests + +{ f } [ "false" json> ] unit-test +{ t } [ "true" json> ] unit-test +{ json-null } [ "null" json> ] unit-test +{ 0 } [ "0" json> ] unit-test +{ 102 } [ "102" json> ] unit-test +{ -102 } [ "-102" json> ] unit-test +{ 102 } [ "+102" json> ] unit-test +{ 102.0 } [ "102.0" json> ] unit-test +{ 102.5 } [ "102.5" json> ] unit-test +{ 102.5 } [ "102.50" json> ] unit-test +{ -10250 } [ "-102.5e2" json> ] unit-test +{ -10250 } [ "-102.5E+2" json> ] unit-test +{ 10.25 } [ "1025e-2" json> ] unit-test +{ 0.125 } [ "0.125" json> ] unit-test +{ -0.125 } [ "-0.125" json> ] unit-test + +{ " fuzzy pickles " } [ <" " fuzzy pickles " "> json> ] unit-test +{ "while 1:\n\tpass" } [ <" "while 1:\n\tpass" "> json> ] unit-test +{ 8 9 10 12 13 34 47 92 } >string 1array [ <" "\b\t\n\f\r\"\/\\" "> json> ] unit-test +{ HEX: abcd } >string 1array [ <" "\uaBCd" "> json> ] unit-test + +{ { 1 "two" 3.0 } } [ <" [1, "two", 3.0] "> json> ] unit-test +{ H{ { "US$" 1.0 } { "EU€" 1.5 } } } [ <" { "US$":1.00, "EU\u20AC":1.50 } "> json> ] unit-test +{ H{ + { "fib" { 1 1 2 3 5 8 H{ { "etc" "etc" } } } } + { "prime" { 2 3 5 7 11 13 } } +} } [ <" { + "fib": [1, 1, 2, 3, 5, 8, + { "etc":"etc" } ], + "prime": + [ 2,3, 5,7, +11, +13 +] } +"> json> ] unit-test + +{ 0 } [ " 0" json> ] unit-test +{ 0 } [ "0 " json> ] unit-test +{ 0 } [ " 0 " json> ] unit-test + diff --git a/extra/json/reader/reader.factor b/extra/json/reader/reader.factor index b136012433..6bd6905804 100755 --- a/extra/json/reader/reader.factor +++ b/extra/json/reader/reader.factor @@ -1,12 +1,14 @@ ! Copyright (C) 2006 Chris Double. ! See http://factorcode.org/license.txt for BSD license. USING: kernel parser-combinators namespaces sequences promises strings - assocs math math.parser math.vectors math.functions - lazy-lists hashtables ascii ; + assocs math math.parser math.vectors math.functions math.order + lists hashtables ascii ; IN: json.reader ! Grammar for JSON from RFC 4627 +SYMBOL: json-null + : [<&>] ( quot -- quot ) { } make unclip [ <&> ] reduce ; @@ -17,8 +19,7 @@ LAZY: 'ws' ( -- parser ) " " token "\n" token <|> "\r" token <|> - "\t" token <|> - "" token <|> ; + "\t" token <|> <*> ; LAZY: spaced ( parser -- parser ) 'ws' swap &> 'ws' <& ; @@ -42,24 +43,39 @@ LAZY: 'value-separator' ( -- parser ) "," token spaced ; LAZY: 'false' ( -- parser ) - "false" token ; + "false" token [ drop f ] <@ ; LAZY: 'null' ( -- parser ) - "null" token ; + "null" token [ drop json-null ] <@ ; LAZY: 'true' ( -- parser ) - "true" token ; + "true" token [ drop t ] <@ ; LAZY: 'quot' ( -- parser ) "\"" token ; +LAZY: 'hex-digit' ( -- parser ) + [ digit> ] satisfy [ digit> ] <@ ; + +: hex-digits>ch ( digits -- ch ) + 0 [ swap 16 * + ] reduce ; + +LAZY: 'string-char' ( -- parser ) + [ quotable? ] satisfy + "\\b" token [ drop 8 ] <@ <|> + "\\t" token [ drop CHAR: \t ] <@ <|> + "\\n" token [ drop CHAR: \n ] <@ <|> + "\\f" token [ drop 12 ] <@ <|> + "\\r" token [ drop CHAR: \r ] <@ <|> + "\\\"" token [ drop CHAR: " ] <@ <|> + "\\/" token [ drop CHAR: / ] <@ <|> + "\\\\" token [ drop CHAR: \\ ] <@ <|> + "\\u" token 'hex-digit' 4 exactly-n &> + [ hex-digits>ch ] <@ <|> ; + LAZY: 'string' ( -- parser ) 'quot' - [ - [ quotable? ] keep - [ CHAR: \\ = or ] keep - CHAR: " = not and - ] satisfy <*> &> + 'string-char' <*> &> 'quot' <& [ >string ] <@ ; DEFER: 'value' @@ -86,6 +102,9 @@ LAZY: 'minus' ( -- parser ) LAZY: 'plus' ( -- parser ) "+" token ; +LAZY: 'sign' ( -- parser ) + 'minus' 'plus' <|> ; + LAZY: 'zero' ( -- parser ) "0" token [ drop 0 ] <@ ; @@ -116,11 +135,11 @@ LAZY: 'e' ( -- parser ) : sign-number ( pair -- number ) #! Pair is { minus? num } #! Convert the json number value to a factor number - dup second swap first [ -1 * ] when ; + dup second swap first [ first "-" = [ -1 * ] when ] when* ; LAZY: 'exp' ( -- parser ) 'e' - 'minus' 'plus' <|> &> + 'sign' &> 'digit0-9' <+> [ decimal>integer ] <@ <&> [ sign-number ] <@ ; : sequence>frac ( seq -- num ) @@ -136,7 +155,7 @@ LAZY: 'frac' ( -- parser ) dup second dup [ 10 swap first ^ swap first * ] [ drop first ] if ; LAZY: 'number' ( -- parser ) - 'minus' + 'sign' [ 'int' , 'frac' 0 succeed <|> , ] [<&>] [ sum ] <@ 'exp' <&> [ raise-to-power ] <@ <&> [ sign-number ] <@ ; @@ -149,7 +168,7 @@ LAZY: 'value' ( -- parser ) 'object' , 'array' , 'number' , - ] [<|>] ; + ] [<|>] spaced ; : json> ( string -- object ) #! Parse a json formatted string to a factor object diff --git a/extra/json/writer/writer.factor b/extra/json/writer/writer.factor index 6ad0774e38..a68c65087e 100644 --- a/extra/json/writer/writer.factor +++ b/extra/json/writer/writer.factor @@ -21,11 +21,6 @@ M: string json-print ( obj -- ) M: number json-print ( num -- ) number>string write ; -! sequence and number overlap, we provide an explicit -! disambiguation method -M: integer json-print ( num -- ) - number>string write ; - M: sequence json-print ( array -- ) CHAR: [ write1 [ >json ] map "," join write CHAR: ] write1 ; diff --git a/extra/koszul/koszul.factor b/extra/koszul/koszul.factor index b079cec42c..7b636609b0 100755 --- a/extra/koszul/koszul.factor +++ b/extra/koszul/koszul.factor @@ -3,11 +3,11 @@ USING: arrays assocs hashtables assocs io kernel math math.vectors math.matrices math.matrices.elimination namespaces parser prettyprint sequences words combinators math.parser -splitting sorting shuffle symbols sets ; +splitting sorting shuffle symbols sets math.order ; IN: koszul ! Utilities -: -1^ odd? -1 1 ? ; +: -1^ ( m -- n ) odd? -1 1 ? ; : >alt ( obj -- vec ) { @@ -18,8 +18,8 @@ IN: koszul [ 1array >alt ] } cond ; -: canonicalize - [ nip zero? not ] assoc-subset ; +: canonicalize ( assoc -- assoc' ) + [ nip zero? not ] assoc-filter ; SYMBOL: terms @@ -71,7 +71,7 @@ SYMBOL: terms [ natural-sort ] keep [ index ] curry map ; : (inversions) ( n seq -- n ) - [ > ] with subset length ; + [ > ] with filter length ; : inversions ( seq -- n ) 0 swap [ length ] keep [ @@ -148,7 +148,7 @@ DEFER: (d) : nth-basis-elt ( generators n -- elt ) over length [ 3dup bit? [ nth ] [ 2drop f ] if - ] map [ ] subset 2nip ; + ] map sift 2nip ; : basis ( generators -- seq ) natural-sort dup length 2^ [ nth-basis-elt ] with map ; @@ -184,7 +184,7 @@ DEFER: (d) [ length ] keep [ (graded-ker/im-d) ] curry map ; : graded-betti ( generators -- seq ) - basis graded graded-ker/im-d flip first2 1 head* 0 prefix v- ; + basis graded graded-ker/im-d flip first2 but-last 0 prefix v- ; ! Bi-graded for two-step complexes : (bigraded-ker/im-d) ( u-deg z-deg bigraded-basis -- null/rank ) @@ -203,12 +203,12 @@ DEFER: (d) [ basis graded ] bi@ tensor bigraded-ker/im-d [ [ [ first ] map ] map ] keep [ [ second ] map 2 head* { 0 0 } prepend ] map - 1 tail dup first length 0 suffix + rest dup first length 0 suffix [ v- ] 2map ; ! Laplacian -: m.m' dup flip m. ; -: m'.m dup flip swap m. ; +: m.m' ( matrix -- matrix' ) dup flip m. ; +: m'.m ( matrix -- matrix' ) dup flip swap m. ; : empty-matrix? ( matrix -- ? ) dup empty? [ drop t ] [ first empty? ] if ; @@ -279,7 +279,7 @@ DEFER: (d) : bigraded-laplacian ( u-generators z-generators quot -- seq ) >r [ basis graded ] bi@ tensor bigraded-triples r> - [ [ first3 ] swap compose map ] curry map ; inline + [ [ first3 ] prepose map ] curry map ; inline : bigraded-laplacian-betti ( u-generators z-generators -- seq ) [ laplacian-betti ] bigraded-laplacian ; diff --git a/extra/lazy-lists/examples/examples.factor b/extra/lazy-lists/examples/examples.factor deleted file mode 100644 index 2f7646aab1..0000000000 --- a/extra/lazy-lists/examples/examples.factor +++ /dev/null @@ -1,15 +0,0 @@ -! Rewritten by Matthew Willis, July 2006 -! Copyright (C) 2004 Chris Double. -! See http://factorcode.org/license.txt for BSD license. - -USING: lazy-lists math kernel sequences quotations ; -IN: lazy-lists.examples - -: naturals 0 lfrom ; -: positives 1 lfrom ; -: evens 0 [ 2 + ] lfrom-by ; -: odds 1 lfrom [ 2 mod 1 = ] lsubset ; -: powers-of-2 1 [ 2 * ] lfrom-by ; -: ones 1 [ ] lfrom-by ; -: squares naturals [ dup * ] lmap ; -: first-five-squares 5 squares ltake list>array ; diff --git a/extra/lazy-lists/lazy-lists.factor b/extra/lazy-lists/lazy-lists.factor deleted file mode 100644 index b87a1e5f2e..0000000000 --- a/extra/lazy-lists/lazy-lists.factor +++ /dev/null @@ -1,445 +0,0 @@ -! Copyright (C) 2004 Chris Double. -! See http://factorcode.org/license.txt for BSD license. -! -! Updated by Matthew Willis, July 2006 -! Updated by Chris Double, September 2006 -! -USING: kernel sequences math vectors arrays namespaces -quotations promises combinators io ; -IN: lazy-lists - -! Lazy List Protocol -MIXIN: list -GENERIC: car ( cons -- car ) -GENERIC: cdr ( cons -- cdr ) -GENERIC: nil? ( cons -- ? ) - -M: promise car ( promise -- car ) - force car ; - -M: promise cdr ( promise -- cdr ) - force cdr ; - -M: promise nil? ( cons -- bool ) - force nil? ; - -TUPLE: cons car cdr ; - -C: cons cons - -M: cons car ( cons -- car ) - cons-car ; - -M: cons cdr ( cons -- cdr ) - cons-cdr ; - -: nil ( -- cons ) - T{ cons f f f } ; - -M: cons nil? ( cons -- bool ) - nil eq? ; - -: 1list ( obj -- cons ) - nil cons ; - -: 2list ( a b -- cons ) - nil cons cons ; - -: 3list ( a b c -- cons ) - nil cons cons cons ; - -! Both 'car' and 'cdr' are promises -TUPLE: lazy-cons car cdr ; - -: lazy-cons ( car cdr -- promise ) - [ promise ] bi@ \ lazy-cons boa - T{ promise f f t f } clone - [ set-promise-value ] keep ; - -M: lazy-cons car ( lazy-cons -- car ) - lazy-cons-car force ; - -M: lazy-cons cdr ( lazy-cons -- cdr ) - lazy-cons-cdr force ; - -M: lazy-cons nil? ( lazy-cons -- bool ) - nil eq? ; - -: 1lazy-list ( a -- lazy-cons ) - [ nil ] lazy-cons ; - -: 2lazy-list ( a b -- lazy-cons ) - 1lazy-list 1quotation lazy-cons ; - -: 3lazy-list ( a b c -- lazy-cons ) - 2lazy-list 1quotation lazy-cons ; - -: lnth ( n list -- elt ) - swap [ cdr ] times car ; - -: (llength) ( list acc -- n ) - over nil? [ nip ] [ [ cdr ] dip 1+ (llength) ] if ; - -: llength ( list -- n ) - 0 (llength) ; - -: uncons ( cons -- car cdr ) - #! Return the car and cdr of the lazy list - dup car swap cdr ; - -: leach ( list quot -- ) - swap dup nil? [ 2drop ] [ uncons swapd over 2slip leach ] if ; inline - -: lreduce ( list identity quot -- result ) - swapd leach ; inline - -TUPLE: memoized-cons original car cdr nil? ; - -: not-memoized ( -- obj ) - { } ; - -: not-memoized? ( obj -- bool ) - not-memoized eq? ; - -: ( cons -- memoized-cons ) - not-memoized not-memoized not-memoized - memoized-cons boa ; - -M: memoized-cons car ( memoized-cons -- car ) - dup memoized-cons-car not-memoized? [ - dup memoized-cons-original car [ swap set-memoized-cons-car ] keep - ] [ - memoized-cons-car - ] if ; - -M: memoized-cons cdr ( memoized-cons -- cdr ) - dup memoized-cons-cdr not-memoized? [ - dup memoized-cons-original cdr [ swap set-memoized-cons-cdr ] keep - ] [ - memoized-cons-cdr - ] if ; - -M: memoized-cons nil? ( memoized-cons -- bool ) - dup memoized-cons-nil? not-memoized? [ - dup memoized-cons-original nil? [ swap set-memoized-cons-nil? ] keep - ] [ - memoized-cons-nil? - ] if ; - -TUPLE: lazy-map cons quot ; - -C: lazy-map - -: lmap ( list quot -- result ) - over nil? [ 2drop nil ] [ ] if ; - -M: lazy-map car ( lazy-map -- car ) - [ lazy-map-cons car ] keep - lazy-map-quot call ; - -M: lazy-map cdr ( lazy-map -- cdr ) - [ lazy-map-cons cdr ] keep - lazy-map-quot lmap ; - -M: lazy-map nil? ( lazy-map -- bool ) - lazy-map-cons nil? ; - -: lmap-with ( value list quot -- result ) - with lmap ; - -TUPLE: lazy-take n cons ; - -C: lazy-take - -: ltake ( n list -- result ) - over zero? [ 2drop nil ] [ ] if ; - -M: lazy-take car ( lazy-take -- car ) - lazy-take-cons car ; - -M: lazy-take cdr ( lazy-take -- cdr ) - [ lazy-take-n 1- ] keep - lazy-take-cons cdr ltake ; - -M: lazy-take nil? ( lazy-take -- bool ) - dup lazy-take-n zero? [ - drop t - ] [ - lazy-take-cons nil? - ] if ; - -TUPLE: lazy-until cons quot ; - -C: lazy-until - -: luntil ( list quot -- result ) - over nil? [ drop ] [ ] if ; - -M: lazy-until car ( lazy-until -- car ) - lazy-until-cons car ; - -M: lazy-until cdr ( lazy-until -- cdr ) - [ lazy-until-cons uncons swap ] keep lazy-until-quot tuck call - [ 2drop nil ] [ luntil ] if ; - -M: lazy-until nil? ( lazy-until -- bool ) - drop f ; - -TUPLE: lazy-while cons quot ; - -C: lazy-while - -: lwhile ( list quot -- result ) - over nil? [ drop ] [ ] if ; - -M: lazy-while car ( lazy-while -- car ) - lazy-while-cons car ; - -M: lazy-while cdr ( lazy-while -- cdr ) - [ lazy-while-cons cdr ] keep lazy-while-quot lwhile ; - -M: lazy-while nil? ( lazy-while -- bool ) - [ car ] keep lazy-while-quot call not ; - -TUPLE: lazy-subset cons quot ; - -C: lazy-subset - -: lsubset ( list quot -- result ) - over nil? [ 2drop nil ] [ ] if ; - -: car-subset? ( lazy-subset -- ? ) - [ lazy-subset-cons car ] keep - lazy-subset-quot call ; - -: skip ( lazy-subset -- ) - [ lazy-subset-cons cdr ] keep - set-lazy-subset-cons ; - -M: lazy-subset car ( lazy-subset -- car ) - dup car-subset? [ lazy-subset-cons ] [ dup skip ] if car ; - -M: lazy-subset cdr ( lazy-subset -- cdr ) - dup car-subset? [ - [ lazy-subset-cons cdr ] keep - lazy-subset-quot lsubset - ] [ - dup skip cdr - ] if ; - -M: lazy-subset nil? ( lazy-subset -- bool ) - dup lazy-subset-cons nil? [ - drop t - ] [ - dup car-subset? [ - drop f - ] [ - dup skip nil? - ] if - ] if ; - -: list>vector ( list -- vector ) - [ [ , ] leach ] V{ } make ; - -: list>array ( list -- array ) - [ [ , ] leach ] { } make ; - -TUPLE: lazy-append list1 list2 ; - -C: lazy-append - -: lappend ( list1 list2 -- result ) - over nil? [ nip ] [ ] if ; - -M: lazy-append car ( lazy-append -- car ) - lazy-append-list1 car ; - -M: lazy-append cdr ( lazy-append -- cdr ) - [ lazy-append-list1 cdr ] keep - lazy-append-list2 lappend ; - -M: lazy-append nil? ( lazy-append -- bool ) - drop f ; - -TUPLE: lazy-from-by n quot ; - -C: lfrom-by lazy-from-by ( n quot -- list ) - -: lfrom ( n -- list ) - [ 1+ ] lfrom-by ; - -M: lazy-from-by car ( lazy-from-by -- car ) - lazy-from-by-n ; - -M: lazy-from-by cdr ( lazy-from-by -- cdr ) - [ lazy-from-by-n ] keep - lazy-from-by-quot dup slip lfrom-by ; - -M: lazy-from-by nil? ( lazy-from-by -- bool ) - drop f ; - -TUPLE: lazy-zip list1 list2 ; - -C: lazy-zip - -: lzip ( list1 list2 -- lazy-zip ) - over nil? over nil? or - [ 2drop nil ] [ ] if ; - -M: lazy-zip car ( lazy-zip -- car ) - [ lazy-zip-list1 car ] keep lazy-zip-list2 car 2array ; - -M: lazy-zip cdr ( lazy-zip -- cdr ) - [ lazy-zip-list1 cdr ] keep lazy-zip-list2 cdr lzip ; - -M: lazy-zip nil? ( lazy-zip -- bool ) - drop f ; - -TUPLE: sequence-cons index seq ; - -C: sequence-cons - -: seq>list ( index seq -- list ) - 2dup length >= [ - 2drop nil - ] [ - - ] if ; - -M: sequence-cons car ( sequence-cons -- car ) - [ sequence-cons-index ] keep - sequence-cons-seq nth ; - -M: sequence-cons cdr ( sequence-cons -- cdr ) - [ sequence-cons-index 1+ ] keep - sequence-cons-seq seq>list ; - -M: sequence-cons nil? ( sequence-cons -- bool ) - drop f ; - -: >list ( object -- list ) - { - { [ dup sequence? ] [ 0 swap seq>list ] } - { [ dup list? ] [ ] } - [ "Could not convert object to a list" throw ] - } cond ; - -TUPLE: lazy-concat car cdr ; - -C: lazy-concat - -DEFER: lconcat - -: (lconcat) ( car cdr -- list ) - over nil? [ - nip lconcat - ] [ - - ] if ; - -: lconcat ( list -- result ) - dup nil? [ - drop nil - ] [ - uncons (lconcat) - ] if ; - -M: lazy-concat car ( lazy-concat -- car ) - lazy-concat-car car ; - -M: lazy-concat cdr ( lazy-concat -- cdr ) - [ lazy-concat-car cdr ] keep lazy-concat-cdr (lconcat) ; - -M: lazy-concat nil? ( lazy-concat -- bool ) - dup lazy-concat-car nil? [ - lazy-concat-cdr nil? - ] [ - drop f - ] if ; - -: lcartesian-product ( list1 list2 -- result ) - swap [ swap [ 2array ] lmap-with ] lmap-with lconcat ; - -: lcartesian-product* ( lists -- result ) - dup nil? [ - drop nil - ] [ - [ car ] keep cdr [ car lcartesian-product ] keep cdr list>array swap [ - swap [ swap [ suffix ] lmap-with ] lmap-with lconcat - ] reduce - ] if ; - -: lcomp ( list quot -- result ) - [ lcartesian-product* ] dip lmap ; - -: lcomp* ( list guards quot -- result ) - [ [ lcartesian-product* ] dip [ lsubset ] each ] dip lmap ; - -DEFER: lmerge - -: (lmerge) ( list1 list2 -- result ) - over [ car ] curry -rot - [ - dup [ car ] curry -rot - [ - [ cdr ] bi@ lmerge - ] 2curry lazy-cons - ] 2curry lazy-cons ; - -: lmerge ( list1 list2 -- result ) - { - { [ over nil? ] [ nip ] } - { [ dup nil? ] [ drop ] } - { [ t ] [ (lmerge) ] } - } cond ; - -TUPLE: lazy-io stream car cdr quot ; - -C: lazy-io - -: lcontents ( stream -- result ) - f f [ stream-read1 ] ; - -: llines ( stream -- result ) - f f [ stream-readln ] ; - -M: lazy-io car ( lazy-io -- car ) - dup lazy-io-car dup [ - nip - ] [ - drop dup lazy-io-stream over lazy-io-quot call - swap dupd set-lazy-io-car - ] if ; - -M: lazy-io cdr ( lazy-io -- cdr ) - dup lazy-io-cdr dup [ - nip - ] [ - drop dup - [ lazy-io-stream ] keep - [ lazy-io-quot ] keep - car [ - [ f f ] dip [ swap set-lazy-io-cdr ] keep - ] [ - 3drop nil - ] if - ] if ; - -M: lazy-io nil? ( lazy-io -- bool ) - car not ; - -INSTANCE: cons list -INSTANCE: sequence-cons list -INSTANCE: memoized-cons list -INSTANCE: promise list -INSTANCE: lazy-io list -INSTANCE: lazy-concat list -INSTANCE: lazy-cons list -INSTANCE: lazy-map list -INSTANCE: lazy-take list -INSTANCE: lazy-append list -INSTANCE: lazy-from-by list -INSTANCE: lazy-zip list -INSTANCE: lazy-while list -INSTANCE: lazy-until list -INSTANCE: lazy-subset list diff --git a/extra/lcs/authors.txt b/extra/lcs/authors.txt new file mode 100755 index 0000000000..504363d316 --- /dev/null +++ b/extra/lcs/authors.txt @@ -0,0 +1 @@ +Daniel Ehrenberg diff --git a/extra/lcs/diff2html/diff2html.factor b/extra/lcs/diff2html/diff2html.factor new file mode 100644 index 0000000000..754e69a476 --- /dev/null +++ b/extra/lcs/diff2html/diff2html.factor @@ -0,0 +1,44 @@ +! Copyright (C) 2008 Slava Pestov +! See http://factorcode.org/license.txt for BSD license. +USING: lcs html.elements kernel qualified ; +FROM: accessors => item>> ; +FROM: io => write ; +FROM: sequences => each empty? ; +FROM: xml.entities => escape-string ; +IN: lcs.diff2html + +GENERIC: diff-line ( obj -- ) + +: write-item ( item -- ) + item>> dup empty? [ drop " " ] [ escape-string ] if write ; + +M: retain diff-line + + dup [ + + write-item + + ] bi@ + ; + +M: insert diff-line + + + + write-item + + ; + +M: delete diff-line + + + write-item + + + ; + +: htmlize-diff ( diff -- ) + + + [ diff-line ] each +
    "Old" write "New" write
    ; diff --git a/extra/lcs/lcs-docs.factor b/extra/lcs/lcs-docs.factor new file mode 100755 index 0000000000..49e46c7641 --- /dev/null +++ b/extra/lcs/lcs-docs.factor @@ -0,0 +1,35 @@ +USING: help.syntax help.markup ; +IN: lcs + +HELP: levenshtein +{ $values { "old" "a sequence" } { "new" "a sequence" } { "n" "the Levenshtein distance" } } +{ $description "Calculates the Levenshtein distance between old and new, that is, the minimal number of changes from the old sequence to the new one, in terms of deleting, inserting and replacing characters." } ; + +HELP: lcs +{ $values { "seq1" "a sequence" } { "seq2" "a sequence" } { "lcs" "a longest common subsequence" } } +{ $description "Given two sequences, calculates a longest common subsequence between them. Note two things: this is only one of the many possible LCSs, and the LCS may not be contiguous." } ; + +HELP: diff +{ $values { "old" "a sequence" } { "new" "a sequence" } { "diff" "an edit script" } } +{ $description "Given two sequences, find a minimal edit script from the old to the new. There may be more than one minimal edit script, and this chooses one arbitrarily. This script is in the form of an array of the tuples of the classes " { $link retain } ", " { $link delete } " and " { $link insert } " which have their information stored in the 'item' slot." } ; + +HELP: retain +{ $class-description "Represents an action in an edit script where an item is kept, going from the initial sequence to the final sequence. This has one slot, called item, containing the thing which is retained" } ; + +HELP: delete +{ $class-description "Represents an action in an edit script where an item is deleted, going from the initial sequence to the final sequence. This has one slot, called item, containing the thing which is deleted" } ; + +HELP: insert +{ $class-description "Represents an action in an edit script where an item is added, going from the initial sequence to the final sequence. This has one slot, called item, containing the thing which is inserted" } ; + +ARTICLE: "lcs" "LCS, Diffing and Distance" +"This vocabulary provides words for three apparently unrelated but in fact very similar problems: finding a longest common subsequence between two sequences, getting a minimal edit script (diff) between two sequences, and calculating the Levenshtein distance between two sequences. The implementations of these algorithms are very closely related, and all running times are O(nm), where n and m are the lengths of the input sequences." +{ $subsection lcs } +{ $subsection diff } +{ $subsection levenshtein } +"The " { $link diff } " word returns a sequence of tuples of the following classes. They all hold their contents in the 'item' slot." +{ $subsection insert } +{ $subsection delete } +{ $subsection retain } ; + +ABOUT: "lcs" diff --git a/extra/lcs/lcs-tests.factor b/extra/lcs/lcs-tests.factor new file mode 100755 index 0000000000..3aa10a0687 --- /dev/null +++ b/extra/lcs/lcs-tests.factor @@ -0,0 +1,25 @@ +! Copyright (C) 2006 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: tools.test lcs ; + +[ 3 ] [ "sitting" "kitten" levenshtein ] unit-test +[ 3 ] [ "kitten" "sitting" levenshtein ] unit-test +[ 1 ] [ "freshpak" "freshpack" levenshtein ] unit-test +[ 1 ] [ "freshpack" "freshpak" levenshtein ] unit-test + +[ "hell" ] [ "hello" "hell" lcs ] unit-test +[ "hell" ] [ "hell" "hello" lcs ] unit-test +[ "ell" ] [ "ell" "hell" lcs ] unit-test +[ "ell" ] [ "hell" "ell" lcs ] unit-test +[ "abd" ] [ "faxbcd" "abdef" lcs ] unit-test + +[ { + T{ delete f CHAR: f } + T{ retain f CHAR: a } + T{ delete f CHAR: x } + T{ retain f CHAR: b } + T{ delete f CHAR: c } + T{ retain f CHAR: d } + T{ insert f CHAR: e } + T{ insert f CHAR: f } +} ] [ "faxbcd" "abdef" diff ] unit-test diff --git a/extra/lcs/lcs.factor b/extra/lcs/lcs.factor new file mode 100755 index 0000000000..e5155a786e --- /dev/null +++ b/extra/lcs/lcs.factor @@ -0,0 +1,96 @@ +USING: sequences kernel math locals math.order math.ranges +accessors combinators.lib arrays namespaces combinators ; +IN: lcs + +r [ 1+ ] bi@ r> min min ; + +: lcs-step ( insert delete change same? -- next ) + 1 -1./0. ? + max max ; ! -1./0. is -inf (float) + +:: loop-step ( i j matrix old new step -- ) + i j 1+ matrix nth nth ! insertion + i 1+ j matrix nth nth ! deletion + i j matrix nth nth ! replace/retain + i old nth j new nth = ! same? + step call + i 1+ j 1+ matrix nth set-nth ; inline + +: lcs-initialize ( |str1| |str2| -- matrix ) + [ drop 0 ] with map ; + +: levenshtein-initialize ( |str1| |str2| -- matrix ) + [ [ + ] curry map ] with map ; + +:: run-lcs ( old new init step -- matrix ) + [let | matrix [ old length 1+ new length 1+ init call ] | + old length [| i | + new length + [| j | i j matrix old new step loop-step ] each + ] each matrix ] ; inline +PRIVATE> + +: levenshtein ( old new -- n ) + [ levenshtein-initialize ] [ levenshtein-step ] + run-lcs peek peek ; + +TUPLE: retain item ; +TUPLE: delete item ; +TUPLE: insert item ; + +> 1- ] [ old>> ] bi nth ; + +: new-nth ( state -- elt ) + [ j>> 1- ] [ new>> ] bi nth ; + +: top-beats-side? ( state -- ? ) + [ [ i>> ] [ j>> 1- ] [ table>> ] tri nth nth ] + [ [ i>> 1- ] [ j>> ] [ table>> ] tri nth nth ] bi > ; + +: retained? ( state -- ? ) + { + [ i>> 0 > ] [ j>> 0 > ] + [ [ old-nth ] [ new-nth ] bi = ] + } <-&& ; + +: do-retain ( state -- state ) + dup old-nth retain boa , + [ 1- ] change-i [ 1- ] change-j ; + +: inserted? ( state -- ? ) + [ j>> 0 > ] + [ [ i>> zero? ] [ top-beats-side? ] or? ] and? ; + +: do-insert ( state -- state ) + dup new-nth insert boa , [ 1- ] change-j ; + +: deleted? ( state -- ? ) + [ i>> 0 > ] + [ [ j>> zero? ] [ top-beats-side? not ] or? ] and? ; + +: do-delete ( state -- state ) + dup old-nth delete boa , [ 1- ] change-i ; + +: (trace-diff) ( state -- ) + { + { [ dup retained? ] [ do-retain (trace-diff) ] } + { [ dup inserted? ] [ do-insert (trace-diff) ] } + { [ dup deleted? ] [ do-delete (trace-diff) ] } + [ drop ] ! i=j=0 + } cond ; + +: trace-diff ( old new table -- diff ) + [ ] [ first length 1- ] [ length 1- ] tri trace-state boa + [ (trace-diff) ] { } make reverse ; +PRIVATE> + +: diff ( old new -- diff ) + 2dup [ lcs-initialize ] [ lcs-step ] run-lcs trace-diff ; + +: lcs ( seq1 seq2 -- lcs ) + [ diff [ retain? ] filter ] keep [ item>> ] swap map-as ; diff --git a/extra/lcs/summary.txt b/extra/lcs/summary.txt new file mode 100755 index 0000000000..9e70fd7e63 --- /dev/null +++ b/extra/lcs/summary.txt @@ -0,0 +1 @@ +Levenshtein distance and diff between sequences diff --git a/extra/lcs/tags.txt b/extra/lcs/tags.txt new file mode 100755 index 0000000000..4d914f4c46 --- /dev/null +++ b/extra/lcs/tags.txt @@ -0,0 +1 @@ +algorithms diff --git a/extra/levenshtein/levenshtein-tests.factor b/extra/levenshtein/levenshtein-tests.factor deleted file mode 100644 index 722ccb86ca..0000000000 --- a/extra/levenshtein/levenshtein-tests.factor +++ /dev/null @@ -1,9 +0,0 @@ -! Copyright (C) 2006 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -IN: levenshtein.tests -USING: tools.test levenshtein ; - -[ 3 ] [ "sitting" "kitten" levenshtein ] unit-test -[ 3 ] [ "kitten" "sitting" levenshtein ] unit-test -[ 1 ] [ "freshpak" "freshpack" levenshtein ] unit-test -[ 1 ] [ "freshpack" "freshpak" levenshtein ] unit-test diff --git a/extra/levenshtein/levenshtein.factor b/extra/levenshtein/levenshtein.factor deleted file mode 100644 index 98b376593c..0000000000 --- a/extra/levenshtein/levenshtein.factor +++ /dev/null @@ -1,46 +0,0 @@ -! Copyright (C) 2006 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: arrays help io kernel math namespaces sequences ; -IN: levenshtein - -: ( m n -- matrix ) - [ drop 0 ] with map ; inline - -: matrix-> nth nth ; inline -: ->matrix nth set-nth ; inline - -SYMBOL: d - -: ->d ( n i j -- ) d get ->matrix ; inline -: d-> ( i j -- n ) d get matrix-> ; inline - -SYMBOL: costs - -: init-d ( str1 str2 -- ) - [ length 1+ ] bi@ 2dup d set - [ 0 over ->d ] each - [ dup 0 ->d ] each ; inline - -: compute-costs ( str1 str2 -- ) - swap [ - [ = 0 1 ? ] with { } map-as - ] curry { } map-as costs set ; inline - -: levenshtein-step ( i j -- ) - [ 1+ d-> 1+ ] 2keep - [ >r 1+ r> d-> 1+ ] 2keep - [ d-> ] 2keep - [ costs get matrix-> + min min ] 2keep - >r 1+ r> 1+ ->d ; inline - -: levenshtein-result ( -- n ) d get peek peek ; inline - -: levenshtein ( str1 str2 -- n ) - [ - 2dup init-d - 2dup compute-costs - [ length ] bi@ [ - [ levenshtein-step ] curry each - ] with each - levenshtein-result - ] with-scope ; diff --git a/extra/levenshtein/summary.txt b/extra/levenshtein/summary.txt deleted file mode 100644 index 583669a8b0..0000000000 --- a/extra/levenshtein/summary.txt +++ /dev/null @@ -1 +0,0 @@ -Levenshtein edit distance algorithm diff --git a/extra/lisp/authors.txt b/extra/lisp/authors.txt new file mode 100644 index 0000000000..4b7af4aac0 --- /dev/null +++ b/extra/lisp/authors.txt @@ -0,0 +1 @@ +James Cash diff --git a/extra/lisp/lisp-docs.factor b/extra/lisp/lisp-docs.factor new file mode 100644 index 0000000000..149f22864e --- /dev/null +++ b/extra/lisp/lisp-docs.factor @@ -0,0 +1,15 @@ +IN: lisp +USING: help.markup help.syntax ; + +ARTICLE: "lisp" "Lisp in Factor" +"This is a simple implementation of a Lisp dialect, which somewhat resembles Scheme." $nl +"It works in two main stages: " +{ $list + { "Parse (via " { $vocab-link "lisp.parser" } " the Lisp code into a " + { $snippet "s-exp" } " tuple." } + { "Transform the " { $snippet "s-exp" } " into a Factor quotation, via " { $link convert-form } } +} + +{ $subsection "lisp.parser" } ; + +ABOUT: "lisp" \ No newline at end of file diff --git a/extra/lisp/lisp-tests.factor b/extra/lisp/lisp-tests.factor new file mode 100644 index 0000000000..14b91aa58b --- /dev/null +++ b/extra/lisp/lisp-tests.factor @@ -0,0 +1,56 @@ +! Copyright (C) 2008 James Cash +! See http://factorcode.org/license.txt for BSD license. +USING: lisp lisp.parser tools.test sequences math kernel parser arrays ; + +IN: lisp.test + +[ + init-env + + [ f ] "#f" lisp-define + [ t ] "#t" lisp-define + + "+" "math" "+" define-primitive + "-" "math" "-" define-primitive + + { 5 } [ + [ 2 3 ] "+" funcall + ] unit-test + + { 8.3 } [ + [ 10.4 2.1 ] "-" funcall + ] unit-test + + { 3 } [ + "((lambda (x y) (+ x y)) 1 2)" lisp-eval + ] unit-test + + { 42 } [ + "((lambda (x y z) (+ x (- y z))) 40 3 1)" lisp-eval + ] unit-test + + { T{ lisp-symbol f "if" } } [ + "(defmacro if (pred tr fl) (quasiquote (cond ((unquote pred) (unquote tr)) (#t (unquote fl)))))" lisp-eval + ] unit-test + + { t } [ + T{ lisp-symbol f "if" } lisp-macro? + ] unit-test + + { 1 } [ + "(if #t 1 2)" lisp-eval + ] unit-test + + { "b" } [ + "(cond (#f \"a\") (#t \"b\"))" lisp-eval + ] unit-test + + { 5 } [ + "(begin (+ 1 4))" lisp-eval + ] unit-test + + { 3 } [ + "((lambda (x) (if x (begin (+ 1 2)) (- 3 5))) #t)" lisp-eval + ] unit-test + +] with-interactive-vocabs diff --git a/extra/lisp/lisp.factor b/extra/lisp/lisp.factor new file mode 100644 index 0000000000..425ee27bb7 --- /dev/null +++ b/extra/lisp/lisp.factor @@ -0,0 +1,158 @@ +! Copyright (C) 2008 James Cash +! See http://factorcode.org/license.txt for BSD license. +USING: kernel peg sequences arrays strings combinators.lib +namespaces combinators math locals locals.private accessors +vectors syntax lisp.parser assocs parser sequences.lib words +quotations fry lists inspector ; +IN: lisp + +DEFER: convert-form +DEFER: funcall +DEFER: lookup-var +DEFER: lookup-macro +DEFER: lisp-macro? +DEFER: macro-expand +DEFER: define-lisp-macro + +! Functions to convert s-exps to quotations +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +: convert-body ( cons -- quot ) + [ ] [ convert-form compose ] foldl ; inline + +: convert-begin ( cons -- quot ) + cdr [ convert-form ] [ ] lmap-as '[ , [ funcall ] each ] ; + +: convert-cond ( cons -- quot ) + cdr [ 2car [ convert-form ] bi@ [ '[ @ funcall ] ] dip 2array ] + { } lmap-as '[ , cond ] ; + +: convert-general-form ( cons -- quot ) + uncons [ convert-body ] [ convert-form ] bi* '[ , @ funcall ] ; + +! words for convert-lambda +> , at ] [ ] bi or ] traverse ; + +: localize-lambda ( body vars -- newbody newvars ) + make-locals dup push-locals swap + [ swap localize-body convert-form swap pop-locals ] dip swap ; + +: split-lambda ( cons -- body-cons vars-seq ) + 3car -rot nip [ name>> ] lmap>array ; inline + +: rest-lambda ( body vars -- quot ) + "&rest" swap [ index ] [ remove ] 2bi + localize-lambda + '[ , cut '[ @ , ] , compose ] ; + +: normal-lambda ( body vars -- quot ) + localize-lambda '[ , compose ] ; +PRIVATE> + +: convert-lambda ( cons -- quot ) + split-lambda "&rest" over member? [ rest-lambda ] [ normal-lambda ] if ; + +: convert-quoted ( cons -- quot ) + cdr 1quotation ; + +: convert-unquoted ( cons -- quot ) + "unquote not valid outside of quasiquote!" throw ; + +: convert-unquoted-splicing ( cons -- quot ) + "unquote-splicing not valid outside of quasiquote!" throw ; + +> "unquote" equal? dup ] } && nip ] + [ cadr ] traverse ; + +: quasiquote-unquote-splicing ( cons -- newcons ) + [ { [ dup list? ] [ dup cdr [ cons? ] [ car cons? ] bi and ] + [ dup cadr car lisp-symbol? ] [ cadr car name>> "unquote-splicing" equal? dup ] } && nip ] + [ dup cadr cdr >>cdr ] traverse ; +PRIVATE> + +: convert-quasiquoted ( cons -- newcons ) + quasiquote-unquote quasiquote-unquote-splicing ; + +: convert-defmacro ( cons -- quot ) + cdr [ car ] keep [ convert-lambda ] [ car name>> ] bi define-lisp-macro 1quotation ; + +: form-dispatch ( cons lisp-symbol -- quot ) + name>> + { { "lambda" [ convert-lambda ] } + { "defmacro" [ convert-defmacro ] } + { "quote" [ convert-quoted ] } + { "unquote" [ convert-unquoted ] } + { "unquote-splicing" [ convert-unquoted-splicing ] } + { "quasiquote" [ convert-quasiquoted ] } + { "begin" [ convert-begin ] } + { "cond" [ convert-cond ] } + [ drop convert-general-form ] + } case ; + +: convert-list-form ( cons -- quot ) + dup car + { { [ dup lisp-macro? ] [ drop macro-expand ] } + { [ dup lisp-symbol? ] [ form-dispatch ] } + [ drop convert-general-form ] + } cond ; + +: convert-form ( lisp-form -- quot ) + { + { [ dup cons? ] [ convert-list-form ] } + { [ dup lisp-symbol? ] [ '[ , lookup-var ] ] } + [ 1quotation ] + } cond ; + +: compile-form ( lisp-ast -- quot ) + convert-form lambda-rewrite call ; inline + +: macro-call ( lambda -- cons ) + call ; inline + +: macro-expand ( cons -- quot ) + uncons [ list>seq [ ] like ] [ lookup-macro macro-call compile-form ] bi* ; + +: lisp-string>factor ( str -- quot ) + lisp-expr parse-result-ast compile-form ; + +: lisp-eval ( str -- * ) + lisp-string>factor call ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +SYMBOL: lisp-env +SYMBOL: macro-env + +ERROR: no-such-var variable-name ; +M: no-such-var summary drop "No such variable" ; + +: init-env ( -- ) + H{ } clone lisp-env set + H{ } clone macro-env set ; + +: lisp-define ( quot name -- ) + lisp-env get set-at ; + +: lisp-get ( name -- word ) + dup lisp-env get at [ ] [ no-such-var ] ?if ; + +: lookup-var ( lisp-symbol -- quot ) + name>> lisp-get ; + +: funcall ( quot sym -- * ) + dup lisp-symbol? [ lookup-var ] when call ; inline + +: define-primitive ( name vocab word -- ) + swap lookup 1quotation '[ , compose call ] swap lisp-define ; + +: lookup-macro ( lisp-symbol -- lambda ) + name>> macro-env get at ; + +: define-lisp-macro ( quot name -- ) + macro-env get set-at ; + +: lisp-macro? ( car -- ? ) + dup lisp-symbol? [ name>> macro-env get key? ] [ drop f ] if ; diff --git a/extra/lisp/parser/authors.txt b/extra/lisp/parser/authors.txt new file mode 100644 index 0000000000..4b7af4aac0 --- /dev/null +++ b/extra/lisp/parser/authors.txt @@ -0,0 +1 @@ +James Cash diff --git a/extra/lisp/parser/parser-docs.factor b/extra/lisp/parser/parser-docs.factor new file mode 100644 index 0000000000..fc16a0a310 --- /dev/null +++ b/extra/lisp/parser/parser-docs.factor @@ -0,0 +1,6 @@ +IN: lisp.parser +USING: help.markup help.syntax ; + +ARTICLE: "lisp.parser" "Parsing strings of Lisp" +"This vocab uses " { $vocab-link "peg.ebnf" } " to turn strings of Lisp into " { $snippet "s-exp" } "s, which are then used by" +{ $vocab-link "lisp" } " to produce Factor quotations." ; \ No newline at end of file diff --git a/extra/lisp/parser/parser-tests.factor b/extra/lisp/parser/parser-tests.factor new file mode 100644 index 0000000000..4aa8154690 --- /dev/null +++ b/extra/lisp/parser/parser-tests.factor @@ -0,0 +1,68 @@ +! Copyright (C) 2008 James Cash +! See http://factorcode.org/license.txt for BSD license. +USING: lisp.parser tools.test peg peg.ebnf lists ; + +IN: lisp.parser.tests + +{ 1234 } [ + "1234" "atom" \ lisp-expr rule parse parse-result-ast +] unit-test + +{ -42 } [ + "-42" "atom" \ lisp-expr rule parse parse-result-ast +] unit-test + +{ 37/52 } [ + "37/52" "atom" \ lisp-expr rule parse parse-result-ast +] unit-test + +{ 123.98 } [ + "123.98" "atom" \ lisp-expr rule parse parse-result-ast +] unit-test + +{ "" } [ + "\"\"" "atom" \ lisp-expr rule parse parse-result-ast +] unit-test + +{ "aoeu" } [ + "\"aoeu\"" "atom" \ lisp-expr rule parse parse-result-ast +] unit-test + +{ "aoeu\"de" } [ + "\"aoeu\\\"de\"" "atom" \ lisp-expr rule parse parse-result-ast +] unit-test + +{ T{ lisp-symbol f "foobar" } } [ + "foobar" "atom" \ lisp-expr rule parse parse-result-ast +] unit-test + +{ T{ lisp-symbol f "+" } } [ + "+" "atom" \ lisp-expr rule parse parse-result-ast +] unit-test + +{ +nil+ } [ + "()" lisp-expr parse-result-ast +] unit-test + +{ T{ + cons + f + T{ lisp-symbol f "foo" } + T{ + cons + f + 1 + T{ cons f 2 T{ cons f "aoeu" +nil+ } } + } } } [ + "(foo 1 2 \"aoeu\")" lisp-expr parse-result-ast +] unit-test + +{ T{ cons f + 1 + T{ cons f + T{ cons f 3 T{ cons f 4 +nil+ } } + T{ cons f 2 +nil+ } } + } +} [ + "(1 (3 4) 2)" lisp-expr parse-result-ast +] unit-test \ No newline at end of file diff --git a/extra/lisp/parser/parser.factor b/extra/lisp/parser/parser.factor new file mode 100644 index 0000000000..1e37193d3a --- /dev/null +++ b/extra/lisp/parser/parser.factor @@ -0,0 +1,39 @@ +! Copyright (C) 2008 James Cash +! See http://factorcode.org/license.txt for BSD license. +USING: kernel peg peg.ebnf peg.expr math.parser sequences arrays strings +combinators.lib math fry accessors lists ; + +IN: lisp.parser + +TUPLE: lisp-symbol name ; +C: lisp-symbol + +EBNF: lisp-expr +_ = (" " | "\t" | "\n")* +LPAREN = "(" +RPAREN = ")" +dquote = '"' +squote = "'" +digit = [0-9] +integer = ("-")? (digit)+ => [[ first2 append string>number ]] +float = integer "." (digit)* => [[ first3 >string [ number>string ] 2dip 3append string>number ]] +rational = integer "/" (digit)+ => [[ first3 nip string>number / ]] +number = float + | rational + | integer +id-specials = "!" | "$" | "%" | "&" | "*" | "/" | ":" + | "<" | "#" | " =" | ">" | "?" | "^" | "_" + | "~" | "+" | "-" | "." | "@" +letters = [a-zA-Z] => [[ 1array >string ]] +initials = letters | id-specials +numbers = [0-9] => [[ 1array >string ]] +subsequents = initials | numbers +identifier = initials (subsequents)* => [[ first2 concat append ]] +escaped = "\" . => [[ second ]] +string = dquote ( escaped | !(dquote) . )* dquote => [[ second >string ]] +atom = number + | identifier + | string +list-item = _ ( atom | s-expression ) _ => [[ second ]] +s-expression = LPAREN (list-item)* RPAREN => [[ second seq>cons ]] +;EBNF \ No newline at end of file diff --git a/extra/lisp/parser/summary.txt b/extra/lisp/parser/summary.txt new file mode 100644 index 0000000000..aa407b3dfb --- /dev/null +++ b/extra/lisp/parser/summary.txt @@ -0,0 +1 @@ +EBNF grammar for parsing Lisp diff --git a/extra/lisp/parser/tags.txt b/extra/lisp/parser/tags.txt new file mode 100644 index 0000000000..d1f6fa1ef3 --- /dev/null +++ b/extra/lisp/parser/tags.txt @@ -0,0 +1,2 @@ +lisp +parsing diff --git a/extra/lisp/summary.txt b/extra/lisp/summary.txt new file mode 100644 index 0000000000..7277c2a5b5 --- /dev/null +++ b/extra/lisp/summary.txt @@ -0,0 +1 @@ +A Lisp interpreter/compiler in Factor diff --git a/extra/lisp/tags.txt b/extra/lisp/tags.txt new file mode 100644 index 0000000000..c369ccae57 --- /dev/null +++ b/extra/lisp/tags.txt @@ -0,0 +1,2 @@ +lisp +languages diff --git a/extra/lists/authors.txt b/extra/lists/authors.txt new file mode 100644 index 0000000000..4b7af4aac0 --- /dev/null +++ b/extra/lists/authors.txt @@ -0,0 +1 @@ +James Cash diff --git a/extra/lazy-lists/authors.txt b/extra/lists/lazy/authors.txt similarity index 100% rename from extra/lazy-lists/authors.txt rename to extra/lists/lazy/authors.txt diff --git a/extra/lazy-lists/examples/authors.txt b/extra/lists/lazy/examples/authors.txt similarity index 100% rename from extra/lazy-lists/examples/authors.txt rename to extra/lists/lazy/examples/authors.txt diff --git a/extra/lazy-lists/examples/examples-tests.factor b/extra/lists/lazy/examples/examples-tests.factor similarity index 56% rename from extra/lazy-lists/examples/examples-tests.factor rename to extra/lists/lazy/examples/examples-tests.factor index d4e3ed79b8..c088f1d9a7 100644 --- a/extra/lazy-lists/examples/examples-tests.factor +++ b/extra/lists/lazy/examples/examples-tests.factor @@ -1,5 +1,5 @@ -USING: lazy-lists.examples lazy-lists tools.test ; -IN: lazy-lists.examples.tests +USING: lists.lazy.examples lazy-lists tools.test ; +IN: lists.lazy.examples.tests [ { 1 3 5 7 } ] [ 4 odds ltake list>array ] unit-test [ { 0 1 4 9 16 } ] [ first-five-squares ] unit-test diff --git a/extra/lists/lazy/examples/examples.factor b/extra/lists/lazy/examples/examples.factor new file mode 100644 index 0000000000..1d5bb49f35 --- /dev/null +++ b/extra/lists/lazy/examples/examples.factor @@ -0,0 +1,15 @@ +! Rewritten by Matthew Willis, July 2006 +! Copyright (C) 2004 Chris Double. +! See http://factorcode.org/license.txt for BSD license. + +USING: lists.lazy math kernel sequences quotations ; +IN: lists.lazy.examples + +: naturals ( -- list ) 0 lfrom ; +: positives ( -- list ) 1 lfrom ; +: evens ( -- list ) 0 [ 2 + ] lfrom-by ; +: odds ( -- list ) 1 lfrom [ 2 mod 1 = ] lfilter ; +: powers-of-2 ( -- list ) 1 [ 2 * ] lfrom-by ; +: ones ( -- list ) 1 [ ] lfrom-by ; +: squares ( -- list ) naturals [ dup * ] lazy-map ; +: first-five-squares ( -- list ) 5 squares ltake list>array ; diff --git a/extra/lazy-lists/lazy-lists-docs.factor b/extra/lists/lazy/lazy-docs.factor similarity index 75% rename from extra/lazy-lists/lazy-lists-docs.factor rename to extra/lists/lazy/lazy-docs.factor index ebacea03d8..6a9359027d 100644 --- a/extra/lazy-lists/lazy-lists-docs.factor +++ b/extra/lists/lazy/lazy-docs.factor @@ -1,48 +1,8 @@ ! Copyright (C) 2006 Chris Double. ! See http://factorcode.org/license.txt for BSD license. -USING: help.markup help.syntax sequences strings ; -IN: lazy-lists - -{ car cons cdr nil nil? list? uncons } related-words - -HELP: cons -{ $values { "car" "the head of the lazy list" } { "cdr" "the tail of the lazy list" } { "cons" "a cons object" } } -{ $description "Constructs a cons cell." } ; - -HELP: car -{ $values { "cons" "a cons object" } { "car" "the first item in the list" } } -{ $description "Returns the first item in the list." } ; - -HELP: cdr -{ $values { "cons" "a cons object" } { "cdr" "a cons object" } } -{ $description "Returns the tail of the list." } ; - -HELP: nil -{ $values { "cons" "An empty cons" } } -{ $description "Returns a representation of an empty list" } ; - -HELP: nil? -{ $values { "cons" "a cons object" } { "?" "a boolean" } } -{ $description "Return true if the cons object is the nil cons." } ; - -HELP: list? ( object -- ? ) -{ $values { "object" "an object" } { "?" "a boolean" } } -{ $description "Returns true if the object conforms to the list protocol." } ; - -{ 1list 2list 3list } related-words - -HELP: 1list -{ $values { "obj" "an object" } { "cons" "a cons object" } } -{ $description "Create a list with 1 element." } ; - -HELP: 2list -{ $values { "a" "an object" } { "b" "an object" } { "cons" "a cons object" } } -{ $description "Create a list with 2 elements." } ; - -HELP: 3list -{ $values { "a" "an object" } { "b" "an object" } { "c" "an object" } { "cons" "a cons object" } } -{ $description "Create a list with 3 elements." } ; +USING: help.markup help.syntax sequences strings lists ; +IN: lists.lazy HELP: lazy-cons { $values { "car" "a quotation with stack effect ( -- X )" } { "cdr" "a quotation with stack effect ( -- cons )" } { "promise" "the resulting cons object" } } @@ -68,45 +28,23 @@ HELP: { $description "Constructs a cons object that wraps an existing cons object. Requests for the car, cdr and nil? will be remembered after the first call, and the previous result returned on subsequent calls." } { $see-also cons car cdr nil nil? } ; -HELP: lnth -{ $values { "n" "an integer index" } { "list" "a cons object" } { "elt" "the element at the nth index" } } -{ $description "Outputs the nth element of the list." } -{ $see-also llength cons car cdr } ; +{ lazy-map lazy-map-with ltake lfilter lappend lfrom lfrom-by lconcat lcartesian-product lcartesian-product* lcomp lcomp* lmerge lwhile luntil } related-words -HELP: llength -{ $values { "list" "a cons object" } { "n" "a non-negative integer" } } -{ $description "Outputs the length of the list. This should not be called on an infinite list." } -{ $see-also lnth cons car cdr } ; - -HELP: uncons -{ $values { "cons" "a cons object" } { "car" "the head of the list" } { "cdr" "the tail of the list" } } -{ $description "Put the head and tail of the list on the stack." } ; - -{ leach lreduce lmap lmap-with ltake lsubset lappend lfrom lfrom-by lconcat lcartesian-product lcartesian-product* lcomp lcomp* lmerge lreduce lwhile luntil } related-words - -HELP: leach -{ $values { "list" "a cons object" } { "quot" "a quotation with stack effect ( obj -- )" } } -{ $description "Call the quotation for each item in the list." } ; - -HELP: lreduce -{ $values { "list" "a cons object" } { "identity" "an object" } { "quot" "a quotation with stack effect ( prev elt -- next )" } { "result" "the final result" } } -{ $description "Combines successive elements of the list using a binary operation, and outputs the final result." } ; - -HELP: lmap +HELP: lazy-map { $values { "list" "a cons object" } { "quot" "a quotation with stack effect ( obj -- X )" } { "result" "resulting cons object" } } { $description "Perform a similar functionality to that of the " { $link map } " word, but in a lazy manner. No evaluation of the list elements occurs initially but a " { $link } " object is returned which conforms to the list protocol. Calling " { $link car } ", " { $link cdr } " or " { $link nil? } " on this will evaluate elements as required." } ; -HELP: lmap-with +HELP: lazy-map-with { $values { "value" "an object" } { "list" "a cons object" } { "quot" "a quotation with stack effect ( obj elt -- X )" } { "result" "resulting cons object" } } -{ $description "Variant of " { $link lmap } " which pushes a retained object on each invocation of the quotation." } ; +{ $description "Variant of " { $link lazy-map } " which pushes a retained object on each invocation of the quotation." } ; HELP: ltake { $values { "n" "a non negative integer" } { "list" "a cons object" } { "result" "resulting cons object" } } { $description "Outputs a lazy list containing the first n items in the list. This is done a lazy manner. No evaluation of the list elements occurs initially but a " { $link } " object is returned which conforms to the list protocol. Calling " { $link car } ", " { $link cdr } " or " { $link nil? } " on this will evaluate elements as required." } ; -HELP: lsubset +HELP: lfilter { $values { "list" "a cons object" } { "quot" "a quotation with stack effect ( -- X )" } { "result" "resulting cons object" } } -{ $description "Perform a similar functionality to that of the " { $link subset } " word, but in a lazy manner. No evaluation of the list elements occurs initially but a " { $link } " object is returned which conforms to the list protocol. Calling " { $link car } ", " { $link cdr } " or " { $link nil? } " on this will evaluate elements as required." } ; +{ $description "Perform a similar functionality to that of the " { $link filter } " word, but in a lazy manner. No evaluation of the list elements occurs initially but a " { $link } " object is returned which conforms to the list protocol. Calling " { $link car } ", " { $link cdr } " or " { $link nil? } " on this will evaluate elements as required." } ; HELP: lwhile { $values { "list" "a cons object" } { "quot" "a quotation with stack effect ( X -- bool )" } { "result" "resulting cons object" } } @@ -147,6 +85,8 @@ HELP: >list { $values { "object" "an object" } { "list" "a list" } } { $description "Convert the object into a list. Existing lists are passed through intact, sequences are converted using " { $link seq>list } " and other objects cause an error to be thrown." } { $see-also seq>list } ; + +{ leach foldl lazy-map lazy-map-with ltake lfilter lappend lfrom lfrom-by lconcat lcartesian-product lcartesian-product* lcomp lcomp* lmerge lwhile luntil } related-words HELP: lconcat { $values { "list" "a list of lists" } { "result" "a list" } } @@ -175,7 +115,7 @@ HELP: lmerge { $values { "list1" "a list" } { "list2" "a list" } { "result" "lazy list merging list1 and list2" } } { $description "Return the result of merging the two lists in a lazy manner." } { $examples - { $example "USING: lazy-lists prettyprint ;" "{ 1 2 3 } >list { 4 5 6 } >list lmerge list>array ." "{ 1 4 2 5 3 6 }" } + { $example "USING: lists.lazy prettyprint ;" "{ 1 2 3 } >list { 4 5 6 } >list lmerge list>array ." "{ 1 4 2 5 3 6 }" } } ; HELP: lcontents @@ -187,4 +127,3 @@ HELP: llines { $values { "stream" "a stream" } { "result" "a list" } } { $description "Returns a lazy list of all lines in the file. " { $link car } " returns the next lines in the file, " { $link cdr } " returns the remaining lines as a lazy list. " { $link nil? } " indicates end of file." } { $see-also lcontents } ; - diff --git a/extra/lazy-lists/lazy-lists-tests.factor b/extra/lists/lazy/lazy-tests.factor similarity index 83% rename from extra/lazy-lists/lazy-lists-tests.factor rename to extra/lists/lazy/lazy-tests.factor index 302299b452..5749f94364 100644 --- a/extra/lazy-lists/lazy-lists-tests.factor +++ b/extra/lists/lazy/lazy-tests.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2006 Matthew Willis and Chris Double. ! See http://factorcode.org/license.txt for BSD license. ! -USING: lazy-lists tools.test kernel math io sequences ; -IN: lazy-lists.tests +USING: lists lists.lazy tools.test kernel math io sequences ; +IN: lists.lazy.tests [ { 1 2 3 4 } ] [ { 1 2 3 4 } >list list>array @@ -25,5 +25,5 @@ IN: lazy-lists.tests ] unit-test [ { 4 5 6 } ] [ - 3 { 1 2 3 } >list [ + ] lmap-with list>array + 3 { 1 2 3 } >list [ + ] lazy-map-with list>array ] unit-test diff --git a/extra/lists/lazy/lazy.factor b/extra/lists/lazy/lazy.factor new file mode 100644 index 0000000000..6beb6e402d --- /dev/null +++ b/extra/lists/lazy/lazy.factor @@ -0,0 +1,392 @@ +! Copyright (C) 2004 Chris Double. +! See http://factorcode.org/license.txt for BSD license. +! +! Updated by Matthew Willis, July 2006 +! Updated by Chris Double, September 2006 +! Updated by James Cash, June 2008 +! +USING: kernel sequences math vectors arrays namespaces +quotations promises combinators io lists accessors ; +IN: lists.lazy + +M: promise car ( promise -- car ) + force car ; + +M: promise cdr ( promise -- cdr ) + force cdr ; + +M: promise nil? ( cons -- bool ) + force nil? ; + +! Both 'car' and 'cdr' are promises +TUPLE: lazy-cons car cdr ; + +: lazy-cons ( car cdr -- promise ) + [ promise ] bi@ \ lazy-cons boa + T{ promise f f t f } clone + [ set-promise-value ] keep ; + +M: lazy-cons car ( lazy-cons -- car ) + car>> force ; + +M: lazy-cons cdr ( lazy-cons -- cdr ) + cdr>> force ; + +M: lazy-cons nil? ( lazy-cons -- bool ) + nil eq? ; + +: 1lazy-list ( a -- lazy-cons ) + [ nil ] lazy-cons ; + +: 2lazy-list ( a b -- lazy-cons ) + 1lazy-list 1quotation lazy-cons ; + +: 3lazy-list ( a b c -- lazy-cons ) + 2lazy-list 1quotation lazy-cons ; + +TUPLE: memoized-cons original car cdr nil? ; + +: not-memoized ( -- obj ) + { } ; + +: not-memoized? ( obj -- bool ) + not-memoized eq? ; + +: ( cons -- memoized-cons ) + not-memoized not-memoized not-memoized + memoized-cons boa ; + +M: memoized-cons car ( memoized-cons -- car ) + dup car>> not-memoized? [ + dup original>> car [ >>car drop ] keep + ] [ + car>> + ] if ; + +M: memoized-cons cdr ( memoized-cons -- cdr ) + dup cdr>> not-memoized? [ + dup original>> cdr [ >>cdr drop ] keep + ] [ + cdr>> + ] if ; + +M: memoized-cons nil? ( memoized-cons -- bool ) + dup nil?>> not-memoized? [ + dup original>> nil? [ >>nil? drop ] keep + ] [ + nil?>> + ] if ; + +TUPLE: lazy-map cons quot ; + +C: lazy-map + +: lazy-map ( list quot -- result ) + over nil? [ 2drop nil ] [ ] if ; + +M: lazy-map car ( lazy-map -- car ) + [ cons>> car ] keep + quot>> call ; + +M: lazy-map cdr ( lazy-map -- cdr ) + [ cons>> cdr ] keep + quot>> lazy-map ; + +M: lazy-map nil? ( lazy-map -- bool ) + cons>> nil? ; + +: lazy-map-with ( value list quot -- result ) + with lazy-map ; + +TUPLE: lazy-take n cons ; + +C: lazy-take + +: ltake ( n list -- result ) + over zero? [ 2drop nil ] [ ] if ; + +M: lazy-take car ( lazy-take -- car ) + cons>> car ; + +M: lazy-take cdr ( lazy-take -- cdr ) + [ n>> 1- ] keep + cons>> cdr ltake ; + +M: lazy-take nil? ( lazy-take -- bool ) + dup n>> zero? [ + drop t + ] [ + cons>> nil? + ] if ; + +TUPLE: lazy-until cons quot ; + +C: lazy-until + +: luntil ( list quot -- result ) + over nil? [ drop ] [ ] if ; + +M: lazy-until car ( lazy-until -- car ) + cons>> car ; + +M: lazy-until cdr ( lazy-until -- cdr ) + [ cons>> uncons ] keep quot>> tuck call + [ 2drop nil ] [ luntil ] if ; + +M: lazy-until nil? ( lazy-until -- bool ) + drop f ; + +TUPLE: lazy-while cons quot ; + +C: lazy-while + +: lwhile ( list quot -- result ) + over nil? [ drop ] [ ] if ; + +M: lazy-while car ( lazy-while -- car ) + cons>> car ; + +M: lazy-while cdr ( lazy-while -- cdr ) + [ cons>> cdr ] keep quot>> lwhile ; + +M: lazy-while nil? ( lazy-while -- bool ) + [ car ] keep quot>> call not ; + +TUPLE: lazy-filter cons quot ; + +C: lazy-filter + +: lfilter ( list quot -- result ) + over nil? [ 2drop nil ] [ ] if ; + +: car-filter? ( lazy-filter -- ? ) + [ cons>> car ] [ quot>> ] bi call ; + +: skip ( lazy-filter -- ) + dup cons>> cdr >>cons drop ; + +M: lazy-filter car ( lazy-filter -- car ) + dup car-filter? [ cons>> ] [ dup skip ] if car ; + +M: lazy-filter cdr ( lazy-filter -- cdr ) + dup car-filter? [ + [ cons>> cdr ] [ quot>> ] bi lfilter + ] [ + dup skip cdr + ] if ; + +M: lazy-filter nil? ( lazy-filter -- bool ) + dup cons>> nil? [ + drop t + ] [ + dup car-filter? [ + drop f + ] [ + dup skip nil? + ] if + ] if ; + +: list>vector ( list -- vector ) + [ [ , ] leach ] V{ } make ; + +: list>array ( list -- array ) + [ [ , ] leach ] { } make ; + +TUPLE: lazy-append list1 list2 ; + +C: lazy-append + +: lappend ( list1 list2 -- result ) + over nil? [ nip ] [ ] if ; + +M: lazy-append car ( lazy-append -- car ) + list1>> car ; + +M: lazy-append cdr ( lazy-append -- cdr ) + [ list1>> cdr ] keep + list2>> lappend ; + +M: lazy-append nil? ( lazy-append -- bool ) + drop f ; + +TUPLE: lazy-from-by n quot ; + +C: lfrom-by lazy-from-by ( n quot -- list ) + +: lfrom ( n -- list ) + [ 1+ ] lfrom-by ; + +M: lazy-from-by car ( lazy-from-by -- car ) + n>> ; + +M: lazy-from-by cdr ( lazy-from-by -- cdr ) + [ n>> ] keep + quot>> dup slip lfrom-by ; + +M: lazy-from-by nil? ( lazy-from-by -- bool ) + drop f ; + +TUPLE: lazy-zip list1 list2 ; + +C: lazy-zip + +: lzip ( list1 list2 -- lazy-zip ) + over nil? over nil? or + [ 2drop nil ] [ ] if ; + +M: lazy-zip car ( lazy-zip -- car ) + [ list1>> car ] keep list2>> car 2array ; + +M: lazy-zip cdr ( lazy-zip -- cdr ) + [ list1>> cdr ] keep list2>> cdr lzip ; + +M: lazy-zip nil? ( lazy-zip -- bool ) + drop f ; + +TUPLE: sequence-cons index seq ; + +C: sequence-cons + +: seq>list ( index seq -- list ) + 2dup length >= [ + 2drop nil + ] [ + + ] if ; + +M: sequence-cons car ( sequence-cons -- car ) + [ index>> ] keep + seq>> nth ; + +M: sequence-cons cdr ( sequence-cons -- cdr ) + [ index>> 1+ ] keep + seq>> seq>list ; + +M: sequence-cons nil? ( sequence-cons -- bool ) + drop f ; + +: >list ( object -- list ) + { + { [ dup sequence? ] [ 0 swap seq>list ] } + { [ dup list? ] [ ] } + [ "Could not convert object to a list" throw ] + } cond ; + +TUPLE: lazy-concat car cdr ; + +C: lazy-concat + +DEFER: lconcat + +: (lconcat) ( car cdr -- list ) + over nil? [ + nip lconcat + ] [ + + ] if ; + +: lconcat ( list -- result ) + dup nil? [ + drop nil + ] [ + uncons swap (lconcat) + ] if ; + +M: lazy-concat car ( lazy-concat -- car ) + car>> car ; + +M: lazy-concat cdr ( lazy-concat -- cdr ) + [ car>> cdr ] keep cdr>> (lconcat) ; + +M: lazy-concat nil? ( lazy-concat -- bool ) + dup car>> nil? [ + cdr>> nil? + ] [ + drop f + ] if ; + +: lcartesian-product ( list1 list2 -- result ) + swap [ swap [ 2array ] lazy-map-with ] lazy-map-with lconcat ; + +: lcartesian-product* ( lists -- result ) + dup nil? [ + drop nil + ] [ + [ car ] keep cdr [ car lcartesian-product ] keep cdr list>array swap [ + swap [ swap [ suffix ] lazy-map-with ] lazy-map-with lconcat + ] reduce + ] if ; + +: lcomp ( list quot -- result ) + [ lcartesian-product* ] dip lazy-map ; + +: lcomp* ( list guards quot -- result ) + [ [ lcartesian-product* ] dip [ lfilter ] each ] dip lazy-map ; + +DEFER: lmerge + +: (lmerge) ( list1 list2 -- result ) + over [ car ] curry -rot + [ + dup [ car ] curry -rot + [ + [ cdr ] bi@ lmerge + ] 2curry lazy-cons + ] 2curry lazy-cons ; + +: lmerge ( list1 list2 -- result ) + { + { [ over nil? ] [ nip ] } + { [ dup nil? ] [ drop ] } + { [ t ] [ (lmerge) ] } + } cond ; + +TUPLE: lazy-io stream car cdr quot ; + +C: lazy-io + +: lcontents ( stream -- result ) + f f [ stream-read1 ] ; + +: llines ( stream -- result ) + f f [ stream-readln ] ; + +M: lazy-io car ( lazy-io -- car ) + dup car>> dup [ + nip + ] [ + drop dup stream>> over quot>> call + swap dupd set-lazy-io-car + ] if ; + +M: lazy-io cdr ( lazy-io -- cdr ) + dup cdr>> dup [ + nip + ] [ + drop dup + [ stream>> ] keep + [ quot>> ] keep + car [ + [ f f ] dip [ >>cdr drop ] keep + ] [ + 3drop nil + ] if + ] if ; + +M: lazy-io nil? ( lazy-io -- bool ) + car not ; + +INSTANCE: sequence-cons list +INSTANCE: memoized-cons list +INSTANCE: promise list +INSTANCE: lazy-io list +INSTANCE: lazy-concat list +INSTANCE: lazy-cons list +INSTANCE: lazy-map list +INSTANCE: lazy-take list +INSTANCE: lazy-append list +INSTANCE: lazy-from-by list +INSTANCE: lazy-zip list +INSTANCE: lazy-while list +INSTANCE: lazy-until list +INSTANCE: lazy-filter list diff --git a/extra/lazy-lists/old-doc.html b/extra/lists/lazy/old-doc.html similarity index 100% rename from extra/lazy-lists/old-doc.html rename to extra/lists/lazy/old-doc.html diff --git a/extra/lazy-lists/summary.txt b/extra/lists/lazy/summary.txt similarity index 100% rename from extra/lazy-lists/summary.txt rename to extra/lists/lazy/summary.txt diff --git a/extra/lazy-lists/tags.txt b/extra/lists/lazy/tags.txt similarity index 100% rename from extra/lazy-lists/tags.txt rename to extra/lists/lazy/tags.txt diff --git a/extra/lists/lists-docs.factor b/extra/lists/lists-docs.factor new file mode 100644 index 0000000000..15faf8d002 --- /dev/null +++ b/extra/lists/lists-docs.factor @@ -0,0 +1,104 @@ +! Copyright (C) 2006 Chris Double. +! See http://factorcode.org/license.txt for BSD license. +USING: help.markup help.syntax ; + +IN: lists + +{ car cons cdr nil nil? list? uncons } related-words + +HELP: cons +{ $values { "car" "the head of the lazy list" } { "cdr" "the tail of the lazy list" } { "cons" "a cons object" } } +{ $description "Constructs a cons cell." } ; + +HELP: car +{ $values { "cons" "a cons object" } { "car" "the first item in the list" } } +{ $description "Returns the first item in the list." } ; + +HELP: cdr +{ $values { "cons" "a cons object" } { "cdr" "a cons object" } } +{ $description "Returns the tail of the list." } ; + +HELP: nil +{ $values { "symbol" "The empty cons (+nil+)" } } +{ $description "Returns a symbol representing the empty list" } ; + +HELP: nil? +{ $values { "cons" "a cons object" } { "?" "a boolean" } } +{ $description "Return true if the cons object is the nil cons." } ; + +HELP: list? ( object -- ? ) +{ $values { "object" "an object" } { "?" "a boolean" } } +{ $description "Returns true if the object conforms to the list protocol." } ; + +{ 1list 2list 3list } related-words + +HELP: 1list +{ $values { "obj" "an object" } { "cons" "a cons object" } } +{ $description "Create a list with 1 element." } ; + +HELP: 2list +{ $values { "a" "an object" } { "b" "an object" } { "cons" "a cons object" } } +{ $description "Create a list with 2 elements." } ; + +HELP: 3list +{ $values { "a" "an object" } { "b" "an object" } { "c" "an object" } { "cons" "a cons object" } } +{ $description "Create a list with 3 elements." } ; + +HELP: lnth +{ $values { "n" "an integer index" } { "list" "a cons object" } { "elt" "the element at the nth index" } } +{ $description "Outputs the nth element of the list." } +{ $see-also llength cons car cdr } ; + +HELP: llength +{ $values { "list" "a cons object" } { "n" "a non-negative integer" } } +{ $description "Outputs the length of the list. This should not be called on an infinite list." } +{ $see-also lnth cons car cdr } ; + +HELP: uncons +{ $values { "cons" "a cons object" } { "cdr" "the tail of the list" } { "car" "the head of the list" } } +{ $description "Put the head and tail of the list on the stack." } ; + +{ leach foldl lmap>array } related-words + +HELP: leach +{ $values { "list" "a cons object" } { "quot" "a quotation with stack effect ( obj -- )" } } +{ $description "Call the quotation for each item in the list." } ; + +HELP: foldl +{ $values { "list" "a cons object" } { "identity" "an object" } { "quot" "a quotation with stack effect ( prev elt -- next )" } { "result" "the final result" } } +{ $description "Combines successive elements of the list (in a left-assocative order) using a binary operation and outputs the final result." } ; + +HELP: foldr +{ $values { "list" "a cons object" } { "identity" "an object" } { "quot" "a quotation with stack effect ( prev elt -- next )" } { "result" "the final result" } } +{ $description "Combines successive elements of the list (in a right-assocative order) using a binary operation, and outputs the final result." } ; + +HELP: lmap +{ $values { "list" "a cons object" } { "quot" "a quotation with stack effect ( old -- new )" } { "result" "the final result" } } +{ $description "Applies the quotation to each element of the list in order, collecting the new elements into a new list." } ; + +HELP: lreverse +{ $values { "list" "a cons object" } { "newlist" "a new cons object" } } +{ $description "Reverses the input list, outputing a new, reversed list" } ; + +HELP: list>seq +{ $values { "list" "a cons object" } { "array" "an array object" } } +{ $description "Turns the given cons object into an array, maintaing order." } ; + +HELP: seq>list +{ $values { "seq" "a sequence" } { "list" "a cons object" } } +{ $description "Turns the given array into a cons object, maintaing order." } ; + +HELP: cons>seq +{ $values { "cons" "a cons object" } { "array" "an array object" } } +{ $description "Recursively turns the given cons object into an array, maintaing order and also converting nested lists." } ; + +HELP: seq>cons +{ $values { "seq" "a sequence object" } { "cons" "a cons object" } } +{ $description "Recursively turns the given sequence into a cons object, maintaing order and also converting nested lists." } ; + +HELP: traverse +{ $values { "list" "a cons object" } { "pred" "a quotation with stack effect ( list/elt -- ? )" } + { "quot" "a quotation with stack effect ( list/elt -- result)" } { "result" "a new cons object" } } +{ $description "Recursively traverses the list object, replacing any elements (which can themselves be sublists) that pred" + " returns true for with the result of applying quot to." } ; + diff --git a/extra/lists/lists-tests.factor b/extra/lists/lists-tests.factor new file mode 100644 index 0000000000..cdc51b76e8 --- /dev/null +++ b/extra/lists/lists-tests.factor @@ -0,0 +1,66 @@ +! Copyright (C) 2008 James Cash +! See http://factorcode.org/license.txt for BSD license. +USING: tools.test lists math ; + +IN: lists.tests + +{ { 3 4 5 6 7 } } [ + { 1 2 3 4 5 } seq>list [ 2 + ] lmap list>seq +] unit-test + +{ { 3 4 5 6 } } [ + T{ cons f 1 + T{ cons f 2 + T{ cons f 3 + T{ cons f 4 + +nil+ } } } } [ 2 + ] lmap>array +] unit-test + +{ 10 } [ + T{ cons f 1 + T{ cons f 2 + T{ cons f 3 + T{ cons f 4 + +nil+ } } } } 0 [ + ] foldl +] unit-test + +{ T{ cons f + 1 + T{ cons f + 2 + T{ cons f + T{ cons f + 3 + T{ cons f + 4 + T{ cons f + T{ cons f 5 +nil+ } + +nil+ } } } + +nil+ } } } +} [ + { 1 2 { 3 4 { 5 } } } seq>cons +] unit-test + +{ { 1 2 { 3 4 { 5 } } } } [ + { 1 2 { 3 4 { 5 } } } seq>cons cons>seq +] unit-test + +{ T{ cons f 2 T{ cons f 3 T{ cons f 4 T{ cons f 5 +nil+ } } } } } [ + { 1 2 3 4 } seq>cons [ 1+ ] lmap +] unit-test + +{ 15 } [ + { 1 2 3 4 5 } seq>list 0 [ + ] foldr +] unit-test + +{ { 5 4 3 2 1 } } [ + { 1 2 3 4 5 } seq>list lreverse list>seq +] unit-test + +{ 5 } [ + { 1 2 3 4 5 } seq>list llength +] unit-test + +{ { 3 4 { 5 6 { 7 } } } } [ + { 1 2 { 3 4 { 5 } } } seq>cons [ atom? ] [ 2 + ] traverse cons>seq +] unit-test \ No newline at end of file diff --git a/extra/lists/lists.factor b/extra/lists/lists.factor new file mode 100644 index 0000000000..13d77f757a --- /dev/null +++ b/extra/lists/lists.factor @@ -0,0 +1,107 @@ +! Copyright (C) 2008 Chris Double & James Cash +! See http://factorcode.org/license.txt for BSD license. +USING: kernel sequences accessors math arrays vectors classes words locals ; + +IN: lists + +! List Protocol +MIXIN: list +GENERIC: car ( cons -- car ) +GENERIC: cdr ( cons -- cdr ) +GENERIC: nil? ( object -- ? ) + +TUPLE: cons car cdr ; + +C: cons cons + +M: cons car ( cons -- car ) + car>> ; + +M: cons cdr ( cons -- cdr ) + cdr>> ; + +SYMBOL: +nil+ +M: word nil? +nil+ eq? ; +M: object nil? drop f ; + +: atom? ( obj -- ? ) [ list? ] [ nil? ] bi or not ; + +: nil ( -- symbol ) +nil+ ; + +: uncons ( cons -- cdr car ) + [ cdr ] [ car ] bi ; + +: 1list ( obj -- cons ) + nil cons ; + +: 2list ( a b -- cons ) + nil cons cons ; + +: 3list ( a b c -- cons ) + nil cons cons cons ; + +: cadr ( cons -- elt ) + cdr car ; + +: 2car ( cons -- car caar ) + [ car ] [ cdr car ] bi ; + +: 3car ( cons -- car caar caaar ) + [ car ] [ cdr car ] [ cdr cdr car ] tri ; + +: lnth ( n list -- elt ) + swap [ cdr ] times car ; + +: (leach) ( list quot -- cdr quot ) + [ [ car ] dip call ] [ [ cdr ] dip ] 2bi ; inline + +: leach ( list quot -- ) + over nil? [ 2drop ] [ (leach) leach ] if ; inline + +: lmap ( list quot -- result ) + over nil? [ drop ] [ (leach) lmap cons ] if ; inline + +: foldl ( list identity quot -- result ) swapd leach ; inline + +: foldr ( list identity quot -- result ) + pick nil? [ [ drop ] [ ] [ drop ] tri* ] [ + [ [ cdr ] 2dip foldr ] [ nip [ car ] dip ] 3bi + call + ] if ; inline + +: llength ( list -- n ) + 0 [ drop 1+ ] foldl ; + +: lreverse ( list -- newlist ) + nil [ swap cons ] foldl ; + +: seq>list ( seq -- list ) + nil [ swap cons ] reduce ; + +: same? ( obj1 obj2 -- ? ) + [ class ] bi@ = ; + +: seq>cons ( seq -- cons ) + [ ] keep nil [ tuck same? [ seq>cons ] when f cons swap >>cdr ] with reduce ; + +: (lmap>array) ( acc cons quot -- newcons ) + over nil? [ 2drop ] + [ [ uncons ] dip [ call ] keep swapd [ suffix ] 2dip (lmap>array) ] if ; inline + +: lmap>array ( cons quot -- newcons ) + { } -rot (lmap>array) ; inline + +: lmap-as ( cons quot exemplar -- seq ) + [ lmap>array ] dip like ; + +: cons>seq ( cons -- array ) + [ dup cons? [ cons>seq ] when ] lmap>array ; + +: list>seq ( list -- array ) + [ ] lmap>array ; + +: traverse ( list pred quot -- result ) + [ 2over call [ tuck [ call ] 2dip ] when + pick list? [ traverse ] [ 2drop ] if ] 2curry lmap ; + +INSTANCE: cons list \ No newline at end of file diff --git a/extra/lists/summary.txt b/extra/lists/summary.txt new file mode 100644 index 0000000000..60a18867ab --- /dev/null +++ b/extra/lists/summary.txt @@ -0,0 +1 @@ +Implementation of lisp-style linked lists diff --git a/extra/lists/tags.txt b/extra/lists/tags.txt new file mode 100644 index 0000000000..e44334b2b5 --- /dev/null +++ b/extra/lists/tags.txt @@ -0,0 +1,3 @@ +cons +lists +sequences diff --git a/extra/locals/backend/backend-tests.factor b/extra/locals/backend/backend-tests.factor index 41caa87fae..9352714509 100644 --- a/extra/locals/backend/backend-tests.factor +++ b/extra/locals/backend/backend-tests.factor @@ -5,34 +5,35 @@ USING: tools.test locals.backend kernel arrays ; [ 4 ] [ 3 4 >r >r 2 get-local 2 drop-locals ] unit-test -: get-local-test-1 3 >r 1 get-local r> drop ; +: get-local-test-1 ( -- x ) 3 >r 1 get-local r> drop ; -{ 0 1 } [ get-local-test-1 ] must-infer-as +\ get-local-test-1 must-infer [ 3 ] [ get-local-test-1 ] unit-test -: get-local-test-2 3 4 >r >r 2 get-local 2 drop-locals ; +: get-local-test-2 ( -- x ) 3 4 >r >r 2 get-local 2 drop-locals ; -{ 0 1 } [ get-local-test-2 ] must-infer-as +\ get-local-test-2 must-infer [ 4 ] [ get-local-test-2 ] unit-test -: get-local-test-3 3 4 >r >r 2 get-local r> r> 2array ; +: get-local-test-3 ( -- a b ) 3 4 >r >r 2 get-local r> r> 2array ; -{ 0 2 } [ get-local-test-3 ] must-infer-as +\ get-local-test-3 must-infer [ 4 { 3 4 } ] [ get-local-test-3 ] unit-test -: get-local-test-4 3 4 >r >r r> r> dup swap >r swap >r r> r> 2array ; +: get-local-test-4 ( -- a b ) + 3 4 >r >r r> r> dup swap >r swap >r r> r> 2array ; -{ 0 2 } [ get-local-test-4 ] must-infer-as +\ get-local-test-4 must-infer [ 4 { 3 4 } ] [ get-local-test-4 ] unit-test [ 1 2 ] [ 1 2 2 load-locals r> r> ] unit-test -: load-locals-test-1 1 2 2 load-locals r> r> ; +: load-locals-test-1 ( -- a b ) 1 2 2 load-locals r> r> ; -{ 0 2 } [ load-locals-test-1 ] must-infer-as +\ load-locals-test-1 must-infer [ 1 2 ] [ load-locals-test-1 ] unit-test diff --git a/extra/locals/locals-docs.factor b/extra/locals/locals-docs.factor index 372a567550..961017f39e 100644 --- a/extra/locals/locals-docs.factor +++ b/extra/locals/locals-docs.factor @@ -1,27 +1,19 @@ -USING: help.syntax help.markup kernel macros prettyprint ; +USING: help.syntax help.markup kernel macros prettyprint +memoize ; IN: locals - - HELP: [| { $syntax "[| bindings... | body... ]" } { $description "A lambda abstraction. When called, reads stack values into the bindings from left to right; the body may then refer to these bindings." } { $examples { $example "USING: kernel locals math prettyprint ;" + "IN: scratchpad" ":: adder ( n -- quot ) [| m | m n + ] ;" "3 5 adder call ." "8" } -} -$with-locals-note ; +} ; HELP: [let { $syntax "[let | binding1 [ value1... ]\n binding2 [ value2... ]\n ... |\n body... ]" } @@ -29,14 +21,14 @@ HELP: [let { $examples { $example "USING: kernel locals math math.functions prettyprint sequences ;" + "IN: scratchpad" ":: frobnicate ( n seq -- newseq )" " [let | n' [ n 6 * ] |" " seq [ n' gcd nip ] map ] ;" "6 { 36 14 } frobnicate ." "{ 36 2 }" } -} -$with-locals-note ; +} ; HELP: [let* { $syntax "[let* | binding1 [ value1... ]\n binding2 [ value2... ]\n ... |\n body... ]" } @@ -44,6 +36,7 @@ HELP: [let* { $examples { $example "USING: kernel locals math math.functions prettyprint sequences ;" + "IN: scratchpad" ":: frobnicate ( n seq -- newseq )" " [let* | a [ n 3 + ]" " b [ a 4 * ] |" @@ -51,8 +44,7 @@ HELP: [let* "1 { 32 48 } frobnicate ." "{ 2 3 }" } -} -$with-locals-note ; +} ; { POSTPONE: [let POSTPONE: [let* } related-words @@ -62,6 +54,7 @@ HELP: [wlet { $examples { $example "USING: locals math prettyprint sequences ;" + "IN: scratchpad" ":: quuxify ( n seq -- newseq )" " [wlet | add-n [| m | m n + ] |" " seq [ add-n ] map ] ;" @@ -70,23 +63,27 @@ HELP: [wlet } } ; -HELP: with-locals -{ $values { "form" "a quotation, lambda, let or wlet form" } { "quot" "a quotation" } } -{ $description "Performs closure conversion of a lexically-scoped form. All nested sub-forms are converted. This word must be applied to a " { $link POSTPONE: [| } ", " { $link POSTPONE: [let } " or " { $link POSTPONE: [wlet } " used in an ordinary definition, however forms in " { $link POSTPONE: :: } " and " { $link POSTPONE: MACRO:: } " definitions are automatically closure-converted and there is no need to use this word." } ; - HELP: :: { $syntax ":: word ( bindings... -- outputs... ) body... ;" } { $description "Defines a word with named inputs; it reads stack values into bindings from left to right, then executes the body with those bindings in lexical scope. Any " { $link POSTPONE: [| } ", " { $link POSTPONE: [let } " or " { $link POSTPONE: [wlet } " forms used in the body of the word definition are automatically closure-converted." } { $notes "The output names do not affect the word's behavior, however the compiler attempts to check the stack effect as with other definitions." } { $examples "See " { $link POSTPONE: [| } ", " { $link POSTPONE: [let } " and " { $link POSTPONE: [wlet } "." } ; +{ POSTPONE: : POSTPONE: :: } related-words + HELP: MACRO:: { $syntax "MACRO:: word ( bindings... -- outputs... ) body... ;" } -{ $description "Defines a macro with named inputs; it reads stack values into bindings from left to right, then executes the body with those bindings in lexical scope. Any " { $link POSTPONE: [| } ", " { $link POSTPONE: [let } " or " { $link POSTPONE: [wlet } " forms used in the body of the word definition are automatically closure-converted." } +{ $description "Defines a macro with named inputs; it reads stack values into bindings from left to right, then executes the body with those bindings in lexical scope." } { $notes "The output names do not affect the word's behavior, however the compiler attempts to check the stack effect as with other definitions." } ; { POSTPONE: MACRO: POSTPONE: MACRO:: } related-words +HELP: MEMO:: +{ $syntax "MEMO:: word ( bindings... -- outputs... ) body... ;" } +{ $description "Defines a memoized word with named inputs; it reads stack values into bindings from left to right, then executes the body with those bindings in lexical scope." } ; + +{ POSTPONE: MEMO: POSTPONE: MEMO:: } related-words + ARTICLE: "locals-mutable" "Mutable locals" "In the list of bindings supplied to " { $link POSTPONE: :: } ", " { $link POSTPONE: [let } " or " { $link POSTPONE: [| } ", a mutable binding may be introduced by suffixing its named with " { $snippet "!" } ". Mutable bindings are read by giving their name as usual; the suffix is not part of the binding's name. To write to a mutable binding, use the binding's with the " { $snippet "!" } " suffix." $nl @@ -107,9 +104,11 @@ $nl "Another limitation is that closure conversion does not descend into arrays, hashtables or other types of literals. For example, the following does not work:" { $code ":: bad-cond-usage ( a -- ... )" - " { [ a 0 < ] [ ... ] }" - " { [ a 0 > ] [ ... ] }" - " { [ a 0 = ] [ ... ] } ;" + " {" + " { [ a 0 < ] [ ... ] }" + " { [ a 0 > ] [ ... ] }" + " { [ a 0 = ] [ ... ] }" + " } cond ;" } ; ARTICLE: "locals" "Local variables and lexical closures" @@ -119,9 +118,8 @@ $nl $nl "Applicative word definitions where the inputs are named local variables:" { $subsection POSTPONE: :: } +{ $subsection POSTPONE: MEMO:: } { $subsection POSTPONE: MACRO:: } -"Explicit closure conversion outside of applicative word definitions:" -{ $subsection with-locals } "Lexical binding forms:" { $subsection POSTPONE: [let } { $subsection POSTPONE: [let* } diff --git a/extra/locals/locals-tests.factor b/extra/locals/locals-tests.factor index c13be40c8f..4e670cdac0 100755 --- a/extra/locals/locals-tests.factor +++ b/extra/locals/locals-tests.factor @@ -1,6 +1,6 @@ USING: locals math sequences tools.test hashtables words kernel namespaces arrays strings prettyprint io.streams.string parser -; +accessors ; IN: locals.tests :: foo ( a b -- a a ) a a ; @@ -55,7 +55,6 @@ IN: locals.tests [ 5 ] [ [let | a [ 3 ] | [wlet | func [ a + ] | 2 func ] ] - with-locals ] unit-test :: wlet-test-2 ( a b -- seq ) @@ -108,7 +107,7 @@ write-test-2 "q" set [ 10 20 ] [ - 20 10 [| a! | [| b! | a b ] ] with-locals call call + 20 10 [| a! | [| b! | a b ] ] call call ] unit-test :: write-test-3 ( a! -- q ) [| b | b a! ] ; @@ -170,16 +169,22 @@ M:: string lambda-generic ( a b -- c ) a b lambda-generic-2 ; [ ] [ \ lambda-generic see ] unit-test +:: unparse-test-1 ( a -- ) [let | a! [ ] | ] ; + [ "[let | a! [ ] | ]" ] [ - [let | a! [ ] | ] unparse + \ unparse-test-1 "lambda" word-prop body>> first unparse ] unit-test +:: unparse-test-2 ( -- ) [wlet | a! [ ] | ] ; + [ "[wlet | a! [ ] | ]" ] [ - [wlet | a! [ ] | ] unparse + \ unparse-test-2 "lambda" word-prop body>> first unparse ] unit-test +:: unparse-test-3 ( -- b ) [| a! | ] ; + [ "[| a! | ]" ] [ - [| a! | ] unparse + \ unparse-test-3 "lambda" word-prop body>> first unparse ] unit-test DEFER: xyzzy @@ -230,3 +235,33 @@ DEFER: xyzzy [ "xxx" "yyy" ] [ "yyy" "xxx" let*-test-4 ] unit-test +GENERIC: next-method-test ( a -- b ) + +M: integer next-method-test 3 + ; + +M:: fixnum next-method-test ( a -- b ) a call-next-method 1 + ; + +[ 5 ] [ 1 next-method-test ] unit-test + +: no-with-locals-test { 1 2 3 } [| x | x 3 + ] map ; + +[ { 4 5 6 } ] [ no-with-locals-test ] unit-test + +{ 3 0 } [| a b c | ] must-infer-as + +[ ] [ 1 [let | a [ ] | ] ] unit-test + +[ 3 ] [ 1 [let | a [ ] | 3 ] ] unit-test + +[ ] [ 1 2 [let | a [ ] b [ ] | ] ] unit-test + +:: a-word-with-locals ( a b -- ) ; + +: new-definition "USING: math ;\nIN: locals.tests\n: a-word-with-locals ( -- x ) 2 3 + ;\n" ; + +[ ] [ new-definition eval ] unit-test + +[ t ] [ + [ \ a-word-with-locals see ] with-string-writer + new-definition = +] unit-test diff --git a/extra/locals/locals.factor b/extra/locals/locals.factor index be73f1db88..028502560f 100755 --- a/extra/locals/locals.factor +++ b/extra/locals/locals.factor @@ -5,7 +5,7 @@ inference.transforms parser words quotations debugger macros arrays macros splitting combinators prettyprint.backend definitions prettyprint hashtables prettyprint.sections sets sequences.private effects generic compiler.units accessors -locals.backend ; +locals.backend memoize ; IN: locals ! Inspired by @@ -81,19 +81,27 @@ C: quote UNION: special local quote local-word local-reader local-writer ; : load-locals-quot ( args -- quot ) - dup [ local-reader? ] contains? [ - [ - local-reader? [ 1array >r ] [ >r ] ? - ] map concat + dup empty? [ + drop [ ] ] [ - length [ load-locals ] curry >quotation + dup [ local-reader? ] contains? [ + [ + local-reader? [ 1array >r ] [ >r ] ? + ] map concat + ] [ + length [ load-locals ] curry >quotation + ] if ] if ; : drop-locals-quot ( args -- quot ) - length [ drop-locals ] curry ; + dup empty? [ + drop [ ] + ] [ + length [ drop-locals ] curry + ] if ; : point-free-body ( quot args -- newquot ) - >r 1 head-slice* r> [ localize ] curry map concat ; + >r but-last-slice r> [ localize ] curry map concat ; : point-free-end ( quot args -- newquot ) over peek special? @@ -108,7 +116,9 @@ UNION: special local quote local-word local-reader local-writer ; 2tri 3append >quotation ; : point-free ( quot args -- newquot ) - over empty? [ drop ] [ (point-free) ] if ; + over empty? + [ nip length \ drop >quotation ] + [ (point-free) ] if ; UNION: lexical local local-reader local-writer local-word ; @@ -130,13 +140,13 @@ M: object free-vars* drop ; M: quotation free-vars* [ add-if-free ] each ; M: lambda free-vars* - [ vars>> ] [ body>> ] bi free-vars diff % ; + [ vars>> ] [ body>> ] bi free-vars swap diff % ; GENERIC: lambda-rewrite* ( obj -- ) GENERIC: local-rewrite* ( obj -- ) -: lambda-rewrite +: lambda-rewrite ( quot -- quot' ) [ local-rewrite* ] [ ] make [ [ lambda-rewrite* ] each ] [ ] make ; @@ -193,8 +203,11 @@ M: object local-rewrite* , ; : pop-locals ( assoc -- ) use get delete ; +SYMBOL: in-lambda? + : (parse-lambda) ( assoc end -- quot ) - parse-until >quotation swap pop-locals ; + t in-lambda? [ parse-until ] with-variable + >quotation swap pop-locals ; : parse-lambda ( -- lambda ) "|" parse-tokens make-locals dup push-locals @@ -260,7 +273,7 @@ M: wlet local-rewrite* let-rewrite ; : parse-locals ( -- vars assoc ) - parse-effect + ")" parse-effect word [ over "declared-effect" set-word-prop ] when* effect-in make-locals dup push-locals ; @@ -269,28 +282,30 @@ M: wlet local-rewrite* 2dup "lambda" set-word-prop lambda-rewrite first ; -: (::) CREATE-WORD parse-locals-definition ; +: (::) ( -- word def ) CREATE-WORD parse-locals-definition ; -: (M::) CREATE-METHOD parse-locals-definition ; +: (M::) ( -- word def ) + CREATE-METHOD + [ parse-locals-definition ] with-method-definition ; + +: parsed-lambda ( form -- ) + in-lambda? get [ parsed ] [ lambda-rewrite over push-all ] if ; PRIVATE> -: [| parse-lambda parsed ; parsing +: [| parse-lambda parsed-lambda ; parsing : [let scan "|" assert= parse-bindings -\ ] (parse-lambda) parsed ; parsing + \ ] (parse-lambda) parsed-lambda ; parsing : [let* scan "|" assert= parse-bindings* - >r \ ] parse-until >quotation parsed r> pop-locals ; - parsing + \ ] (parse-lambda) parsed-lambda ; parsing : [wlet scan "|" assert= parse-wbindings - \ ] (parse-lambda) parsed ; parsing - -MACRO: with-locals ( form -- quot ) lambda-rewrite ; + \ ] (parse-lambda) parsed-lambda ; parsing : :: (::) define ; parsing @@ -298,6 +313,8 @@ MACRO: with-locals ( form -- quot ) lambda-rewrite ; : MACRO:: (::) define-macro ; parsing +: MEMO:: (::) define-memoized ; parsing + boolean ; +PREDICATE: lambda-word < word "lambda" word-prop >boolean ; M: lambda-word definer drop \ :: \ ; ; M: lambda-word definition "lambda" word-prop body>> ; -: lambda-word-synopsis ( word -- ) - dup definer. - dup seeing-word - dup pprint-word - stack-effect. ; +M: lambda-word reset-word + [ f "lambda" set-word-prop ] [ call-next-method ] bi ; -M: lambda-word synopsis* lambda-word-synopsis ; - -PREDICATE: lambda-macro < macro - "lambda" word-prop >boolean ; +INTERSECTION: lambda-macro macro lambda-word ; M: lambda-macro definer drop \ MACRO:: \ ; ; M: lambda-macro definition "lambda" word-prop body>> ; -M: lambda-macro synopsis* lambda-word-synopsis ; +M: lambda-macro reset-word + [ f "lambda" set-word-prop ] [ call-next-method ] bi ; -PREDICATE: lambda-method < method-body - "lambda" word-prop >boolean ; +INTERSECTION: lambda-method method-body lambda-word ; M: lambda-method definer drop \ M:: \ ; ; M: lambda-method definition "lambda" word-prop body>> ; +M: lambda-method reset-word + [ f "lambda" set-word-prop ] [ call-next-method ] bi ; + +INTERSECTION: lambda-memoized memoized lambda-word ; + +M: lambda-memoized definer drop \ MEMO:: \ ; ; + +M: lambda-memoized definition + "lambda" word-prop body>> ; + +M: lambda-memoized reset-word + [ f "lambda" set-word-prop ] [ call-next-method ] bi ; + : method-stack-effect ( method -- effect ) dup "lambda" word-prop vars>> swap "method-generic" word-prop stack-effect diff --git a/extra/logging/analysis/analysis.factor b/extra/logging/analysis/analysis.factor index e2c77377ac..a074ccd1b9 100755 --- a/extra/logging/analysis/analysis.factor +++ b/extra/logging/analysis/analysis.factor @@ -1,7 +1,8 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel sequences namespaces words assocs logging sorting -prettyprint io io.styles strings logging.parser calendar.format ; +prettyprint io io.styles strings logging.parser calendar.format +combinators ; IN: logging.analysis SYMBOL: word-names @@ -14,7 +15,7 @@ SYMBOL: message-histogram dup second CRITICAL eq? [ dup errors get push ] when 1 over third word-histogram get at+ dup third word-names get member? [ - 1 over 1 tail message-histogram get at+ + 1 over rest message-histogram get at+ ] when drop ; @@ -41,12 +42,14 @@ SYMBOL: message-histogram ] curry assoc-each ] tabular-output ; -: log-entry. +: log-entry. ( entry -- ) "====== " write - dup first (timestamp>string) bl - dup second pprint bl - dup third write nl - fourth "\n" join print ; + { + [ first (timestamp>string) bl ] + [ second pprint bl ] + [ third write nl ] + [ fourth "\n" join print ] + } cleave ; : errors. ( errors -- ) [ log-entry. ] each ; diff --git a/extra/logging/logging-tests.factor b/extra/logging/logging-tests.factor new file mode 100644 index 0000000000..796c8769fc --- /dev/null +++ b/extra/logging/logging-tests.factor @@ -0,0 +1,24 @@ +IN: logging.tests +USING: tools.test logging math ; + +: input-logging-test ( a b -- c ) + ; + +\ input-logging-test NOTICE add-input-logging + +: output-logging-test ( a b -- c ) + ; + +\ output-logging-test DEBUG add-output-logging + +: error-logging-test ( a b -- c ) / ; + +\ error-logging-test ERROR add-error-logging + +"logging-test" [ + [ 4 ] [ 1 3 input-logging-test ] unit-test + + [ 4 ] [ 1 3 output-logging-test ] unit-test + + [ 4/3 ] [ 4 3 error-logging-test ] unit-test + + [ f ] [ 1 0 error-logging-test ] unit-test +] with-logging diff --git a/extra/logging/logging.factor b/extra/logging/logging.factor index 664337c3d3..3cedacc2ae 100755 --- a/extra/logging/logging.factor +++ b/extra/logging/logging.factor @@ -4,33 +4,26 @@ USING: logging.server sequences namespaces concurrency.messaging words kernel arrays shuffle tools.annotations prettyprint.config prettyprint debugger io.streams.string splitting continuations effects arrays.lib parser strings -combinators.lib quotations ; +combinators.lib quotations fry symbols accessors ; IN: logging -SYMBOL: DEBUG -SYMBOL: NOTICE -SYMBOL: WARNING -SYMBOL: ERROR -SYMBOL: CRITICAL +SYMBOLS: DEBUG NOTICE WARNING ERROR CRITICAL ; -: log-levels - { DEBUG NOTICE NOTICE WARNING ERROR CRITICAL } ; +: log-levels { DEBUG NOTICE NOTICE WARNING ERROR CRITICAL } ; : send-to-log-server ( array string -- ) prefix "log-server" get send ; SYMBOL: log-service -: check-log-message - pick string? - pick word? - pick word? and and - [ "Bad parameters to log-message" throw ] unless ; +: check-log-message ( msg word level -- msg word level ) + 3dup [ string? ] [ word? ] [ word? ] tri* and and + [ "Bad parameters to log-message" throw ] unless ; inline : log-message ( msg word level -- ) check-log-message log-service get dup [ - >r >r >r string-lines r> word-name r> word-name r> + [ [ string-lines ] [ word-name ] [ word-name ] tri* ] dip 4array "log-message" send-to-log-server ] [ 4drop @@ -49,12 +42,12 @@ SYMBOL: log-service message ( obj -- inputs>message ) dup one-string? [ first ] [ @@ -69,41 +62,40 @@ SYMBOL: log-service PRIVATE> : (define-logging) ( word level quot -- ) - >r >r dup r> r> 2curry annotate ; + [ dup ] 2dip 2curry annotate ; : call-logging-quot ( quot word level -- quot' ) - "called" -rot [ log-message ] 3curry swap compose ; + "called" -rot [ log-message ] 3curry prepose ; : add-logging ( word level -- ) [ call-logging-quot ] (define-logging) ; : log-stack ( n word level -- ) log-service get [ - >r >r [ ndup ] keep narray stack>message - r> r> log-message + [ [ ndup ] keep narray stack>message ] 2dip log-message ] [ 3drop ] if ; inline -: input# stack-effect effect-in length ; +: input# ( word -- n ) stack-effect in>> length ; : input-logging-quot ( quot word level -- quot' ) - over input# -rot [ log-stack ] 3curry swap compose ; + rot [ [ input# ] keep ] 2dip '[ , , , log-stack @ ] ; : add-input-logging ( word level -- ) [ input-logging-quot ] (define-logging) ; -: output# stack-effect effect-out length ; +: output# ( word -- n ) stack-effect out>> length ; : output-logging-quot ( quot word level -- quot' ) - over output# -rot [ log-stack ] 3curry compose ; + [ [ output# ] keep ] dip '[ @ , , , log-stack ] ; : add-output-logging ( word level -- ) [ output-logging-quot ] (define-logging) ; : (log-error) ( object word level -- ) log-service get [ - >r >r [ print-error ] with-string-writer r> r> log-message + [ [ print-error ] with-string-writer ] 2dip log-message ] [ 2drop rethrow ] if ; @@ -112,22 +104,21 @@ PRIVATE> : log-critical ( error word -- ) CRITICAL (log-error) ; -: stack-balancer ( effect word -- quot ) - >r dup effect-in length r> [ over >r ERROR log-stack r> ndrop ] 2curry - swap effect-out length f append >quotation ; +: stack-balancer ( effect -- quot ) + [ in>> length [ ndrop ] curry ] + [ out>> length f >quotation ] + bi append ; : error-logging-quot ( quot word -- quot' ) - [ [ log-error ] curry ] keep - [ stack-effect ] keep stack-balancer compose - [ recover ] 2curry ; + dup stack-effect stack-balancer + '[ , [ , log-error @ ] recover ] ; : add-error-logging ( word level -- ) - [ over >r input-logging-quot r> error-logging-quot ] + [ [ input-logging-quot ] 2keep drop error-logging-quot ] (define-logging) ; : LOG: #! Syntax: name level - CREATE-WORD - dup scan-word - [ >r >r 1array stack>message r> r> log-message ] 2curry - define ; parsing + CREATE-WORD dup scan-word + '[ 1array stack>message , , log-message ] + (( message -- )) define-declared ; parsing diff --git a/extra/logging/parser/parser.factor b/extra/logging/parser/parser.factor index c6b073e501..326661fee5 100755 --- a/extra/logging/parser/parser.factor +++ b/extra/logging/parser/parser.factor @@ -6,31 +6,31 @@ namespaces combinators combinators.lib logging.server calendar calendar.format ; IN: logging.parser -: string-of satisfy [ >string ] <@ ; +: string-of ( quot -- parser ) satisfy [ >string ] <@ ; SYMBOL: multiline -: 'date' +: 'date' ( -- parser ) [ "]" member? not ] string-of [ dup multiline-header = [ drop multiline ] [ rfc3339>timestamp ] if ] <@ "[" "]" surrounded-by ; -: 'log-level' +: 'log-level' ( -- parser ) log-levels [ [ word-name token ] keep [ nip ] curry <@ ] map ; -: 'word-name' +: 'word-name' ( -- parser ) [ " :" member? not ] string-of ; SYMBOL: malformed -: 'malformed-line' +: 'malformed-line' ( -- parser ) [ drop t ] string-of [ malformed swap 2array ] <@ ; -: 'log-message' +: 'log-message' ( -- parser ) [ drop t ] string-of [ 1vector ] <@ ; MEMO: 'log-line' ( -- parser ) @@ -49,7 +49,7 @@ MEMO: 'log-line' ( -- parser ) : multiline? ( line -- ? ) first multiline eq? ; -: malformed-line +: malformed-line ( line -- ) "Warning: malformed log line:" print second print ; diff --git a/extra/logging/server/server.factor b/extra/logging/server/server.factor index c6aee034cc..f4ad8144be 100755 --- a/extra/logging/server/server.factor +++ b/extra/logging/server/server.factor @@ -1,10 +1,10 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: namespaces kernel io calendar sequences io.files -io.sockets continuations prettyprint assocs math.parser -words debugger math combinators concurrency.messaging -threads arrays init math.ranges strings calendar.format -io.encodings.utf8 ; +io.sockets continuations destructors prettyprint assocs +math.parser words debugger math combinators +concurrency.messaging threads arrays init math.ranges strings +calendar.format io.encodings.utf8 ; IN: logging.server : log-root ( -- string ) @@ -37,18 +37,18 @@ SYMBOL: log-files write bl write ": " write print ; : write-message ( msg word-name level -- ) - rot [ empty? not ] subset { + rot harvest { { [ dup empty? ] [ 3drop ] } { [ dup length 1 = ] [ first -rot f (write-message) ] } [ [ first -rot f (write-message) ] 3keep - 1 tail -rot [ t (write-message) ] 2curry each + rest -rot [ t (write-message) ] 2curry each ] } cond ; : (log-message) ( msg -- ) #! msg: { msg word-name level service } - first4 log-stream [ write-message flush ] with-stream* ; + first4 log-stream [ write-message flush ] with-output-stream* ; : try-dispose ( stream -- ) [ dispose ] curry [ error. ] recover ; @@ -67,7 +67,7 @@ SYMBOL: log-files : ?delete-file ( path -- ) dup exists? [ delete-file ] [ drop ] if ; -: delete-oldest keep-logs log# ?delete-file ; +: delete-oldest ( service -- ) keep-logs log# ?delete-file ; : ?move-file ( old new -- ) over exists? [ move-file ] [ 2drop ] if ; diff --git a/extra/lsys/strings/strings.factor b/extra/lsys/strings/strings.factor index 3c9dfcab6c..f184ca5dfc 100644 --- a/extra/lsys/strings/strings.factor +++ b/extra/lsys/strings/strings.factor @@ -5,7 +5,7 @@ IN: lsys.strings ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -: has-param? ( slice -- ? ) { [ length 1 > ] [ second CHAR: ( = ] } <-&& ; +: has-param? ( slice -- ? ) { [ length 1 > ] [ second CHAR: ( = ] } 1&& ; : next+rest ( slice -- next rest ) [ 1 head ] [ 1 tail-slice ] bi ; diff --git a/extra/lsys/tortoise/graphics/graphics.factor b/extra/lsys/tortoise/graphics/graphics.factor index 87536476ee..d75915ae8e 100644 --- a/extra/lsys/tortoise/graphics/graphics.factor +++ b/extra/lsys/tortoise/graphics/graphics.factor @@ -1,5 +1,5 @@ -USING: kernel math vectors sequences opengl.gl math.vectors +USING: kernel math vectors sequences opengl.gl math.vectors math.order math.matrices vars opengl self pos ori turtle lsys.tortoise lsys.strings.interpret ; diff --git a/extra/lsys/ui/ui.factor b/extra/lsys/ui/ui.factor index c8d103a084..c3b9190c3c 100644 --- a/extra/lsys/ui/ui.factor +++ b/extra/lsys/ui/ui.factor @@ -1,5 +1,6 @@ -USING: kernel namespaces threads math math.vectors quotations sequences +USING: kernel namespaces threads math math.order math.vectors + quotations sequences opengl opengl.gl colors @@ -495,4 +496,4 @@ make-pile 1 over set-pack-fill "L-system scenes" open-window ; : lsys-window* ( -- ) [ lsys-controller lsys-viewer ] with-ui ; -MAIN: lsys-window* \ No newline at end of file +MAIN: lsys-window* diff --git a/extra/macros/macros-tests.factor b/extra/macros/macros-tests.factor index 59a53afb70..d5011b0ecb 100644 --- a/extra/macros/macros-tests.factor +++ b/extra/macros/macros-tests.factor @@ -1,4 +1,14 @@ IN: macros.tests USING: tools.test macros math kernel arrays -vectors ; +vectors io.streams.string prettyprint parser ; +MACRO: see-test ( a b -- c ) + ; + +[ "USING: macros math ;\nIN: macros.tests\nMACRO: see-test ( a b -- c ) + ;\n" ] +[ [ \ see-test see ] with-string-writer ] +unit-test + +[ t ] [ + "USING: math ;\nIN: macros.tests\n: see-test ( a b -- c ) - ;\n" dup eval + [ \ see-test see ] with-string-writer = +] unit-test diff --git a/extra/macros/macros.factor b/extra/macros/macros.factor index b242f91d3b..ccfc932406 100755 --- a/extra/macros/macros.factor +++ b/extra/macros/macros.factor @@ -23,10 +23,13 @@ M: macro definer drop \ MACRO: \ ; ; M: macro definition "macro" word-prop ; +M: macro reset-word + [ f "macro" set-word-prop ] [ call-next-method ] bi ; + : macro-expand ( ... word -- quot ) "macro" word-prop call ; : n*quot ( n seq -- seq' ) concat >quotation ; -: saver \ >r >quotation ; +: saver ( n -- quot ) \ >r >quotation ; -: restorer \ r> >quotation ; +: restorer ( n -- quot ) \ r> >quotation ; diff --git a/extra/match/match-docs.factor b/extra/match/match-docs.factor index 4ac59bb0cc..2e23721e93 100644 --- a/extra/match/match-docs.factor +++ b/extra/match/match-docs.factor @@ -42,6 +42,7 @@ HELP: match-replace { $examples { $example "USING: match prettyprint ;" + "IN: scratchpad" "MATCH-VARS: ?a ?b ;" "{ 1 2 } { ?a ?b } { ?b ?a } match-replace ." "{ 2 1 }" diff --git a/extra/match/match.factor b/extra/match/match.factor index e559ebc60d..8a174034ba 100755 --- a/extra/match/match.factor +++ b/extra/match/match.factor @@ -3,7 +3,7 @@ ! ! Based on pattern matching code from Paul Graham's book 'On Lisp'. USING: parser kernel words namespaces sequences classes.tuple -combinators macros assocs math ; +combinators macros assocs math effects ; IN: match SYMBOL: _ @@ -11,7 +11,7 @@ SYMBOL: _ : define-match-var ( name -- ) create-in dup t "match-var" set-word-prop - dup [ get ] curry define ; + dup [ get ] curry (( -- value )) define-declared ; : define-match-vars ( seq -- ) [ define-match-var ] each ; @@ -67,13 +67,13 @@ MACRO: match-cond ( assoc -- ) [ replace-patterns ] bind ; : ?1-tail ( seq -- tail/f ) - dup length zero? not [ 1 tail ] [ drop f ] if ; + dup length zero? not [ rest ] [ drop f ] if ; : (match-first) ( seq pattern-seq -- bindings leftover/f ) 2dup [ length ] bi@ < [ 2drop f f ] [ 2dup length head over match - [ nip swap ?1-tail ] [ >r 1 tail r> (match-first) ] if* + [ nip swap ?1-tail ] [ >r rest r> (match-first) ] if* ] if ; : match-first ( seq pattern-seq -- bindings ) diff --git a/extra/math/combinatorics/combinatorics-docs.factor b/extra/math/combinatorics/combinatorics-docs.factor index 355898a8bd..514c808ee0 100644 --- a/extra/math/combinatorics/combinatorics-docs.factor +++ b/extra/math/combinatorics/combinatorics-docs.factor @@ -1,4 +1,4 @@ -USING: help.markup help.syntax kernel math sequences ; +USING: help.markup help.syntax kernel math math.order sequences ; IN: math.combinatorics HELP: factorial diff --git a/extra/math/combinatorics/combinatorics.factor b/extra/math/combinatorics/combinatorics.factor index 487d9828ea..3376ea640b 100644 --- a/extra/math/combinatorics/combinatorics.factor +++ b/extra/math/combinatorics/combinatorics.factor @@ -1,6 +1,7 @@ ! Copyright (c) 2007, 2008 Slava Pestov, Doug Coleman, Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. -USING: assocs kernel math math.ranges mirrors namespaces sequences sorting ; +USING: assocs kernel math math.order math.ranges mirrors +namespaces sequences sorting ; IN: math.combinatorics ] must-fail diff --git a/extra/math/erato/erato-tests.factor b/extra/math/erato/erato-tests.factor index 9244fa62e2..041cb8dc3a 100644 --- a/extra/math/erato/erato-tests.factor +++ b/extra/math/erato/erato-tests.factor @@ -1,6 +1,6 @@ ! Copyright (c) 2007 Samuel Tardieu. ! See http://factorcode.org/license.txt for BSD license. -USING: lazy-lists math.erato tools.test ; +USING: lists.lazy math.erato tools.test ; IN: math.erato.tests [ { 2 3 5 7 11 13 17 19 } ] [ 20 lerato list>array ] unit-test diff --git a/extra/math/erato/erato.factor b/extra/math/erato/erato.factor index 40de92e3b1..b9d997c038 100644 --- a/extra/math/erato/erato.factor +++ b/extra/math/erato/erato.factor @@ -1,6 +1,6 @@ ! Copyright (c) 2007 Samuel Tardieu. ! See http://factorcode.org/license.txt for BSD license. -USING: bit-arrays kernel lazy-lists math math.functions math.primes.list +USING: bit-arrays kernel lists.lazy math math.functions math.primes.list math.ranges sequences ; IN: math.erato diff --git a/extra/math/fft/fft.factor b/extra/math/fft/fft.factor index 4d4068158e..682d2a49db 100644 --- a/extra/math/fft/fft.factor +++ b/extra/math/fft/fft.factor @@ -1,7 +1,7 @@ ! Fast Fourier Transform, copyright (C) 2007 Hans Schmid ! http://dressguardmeister.blogspot.com/2007/01/fft.html USING: arrays sequences math math.vectors math.constants -math.functions kernel splitting columns ; +math.functions kernel splitting grouping columns ; IN: math.fft : n^v ( n v -- w ) [ ^ ] with map ; diff --git a/extra/math/functions/functions-docs.factor b/extra/math/functions/functions-docs.factor index 35471653dc..c023258105 100755 --- a/extra/math/functions/functions-docs.factor +++ b/extra/math/functions/functions-docs.factor @@ -1,4 +1,4 @@ -USING: help.markup help.syntax kernel math +USING: help.markup help.syntax kernel math math.order sequences quotations math.functions.private ; IN: math.functions diff --git a/extra/math/functions/functions-tests.factor b/extra/math/functions/functions-tests.factor index 8c71eb545b..f2d26e330d 100755 --- a/extra/math/functions/functions-tests.factor +++ b/extra/math/functions/functions-tests.factor @@ -1,5 +1,5 @@ -USING: kernel math math.constants math.functions math.private -math.libm tools.test ; +USING: kernel math math.constants math.functions math.order +math.private math.libm tools.test ; IN: math.functions.tests [ t ] [ 4 4 .00000001 ~ ] unit-test @@ -39,6 +39,16 @@ IN: math.functions.tests [ 0.0 ] [ 0 sin ] unit-test [ 0.0 ] [ 0 asin ] unit-test +[ t ] [ 10 atan real? ] unit-test +[ f ] [ 10 atanh real? ] unit-test + +[ t ] [ 10 asin sin 10 1.e-10 ~ ] unit-test +[ t ] [ -1 sqrt neg dup acos cos 1.e-10 ~ ] unit-test +[ t ] [ -100 atan tan -100 1.e-10 ~ ] unit-test +[ t ] [ 10 asinh sinh 10 1.e-10 ~ ] unit-test +[ t ] [ 10 atanh tanh 10 1.e-10 ~ ] unit-test +[ t ] [ 0.5 atanh tanh 0.5 1.e-10 ~ ] unit-test + [ 100 ] [ 100 100 gcd nip ] unit-test [ 100 ] [ 1000 100 gcd nip ] unit-test [ 100 ] [ 100 1000 gcd nip ] unit-test @@ -63,7 +73,7 @@ IN: math.functions.tests gcd nip ] unit-test -: verify-gcd +: verify-gcd ( a b -- ? ) 2dup gcd >r rot * swap rem r> = ; diff --git a/extra/math/functions/functions.factor b/extra/math/functions/functions.factor index 632939ff71..4dcb215138 100755 --- a/extra/math/functions/functions.factor +++ b/extra/math/functions/functions.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2004, 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: math kernel math.constants math.private -math.libm combinators ; +math.libm combinators math.order ; IN: math.functions polar 3dup ^theta >r ^mag r> polar> ; +: [-1,1]? ( x -- ? ) + dup complex? [ drop f ] [ abs 1 <= ] if ; inline + +: >=1? ( x -- ? ) + dup complex? [ drop f ] [ 1 >= ] if ; inline + : exp ( x -- y ) >rect swap fexp swap polar> ; inline : log ( x -- y ) >polar swap flog swap rect> ; inline : cos ( x -- y ) - >float-rect 2dup - fcosh swap fcos * -rot - fsinh swap fsin neg * rect> ; foldable + dup complex? [ + >float-rect 2dup + fcosh swap fcos * -rot + fsinh swap fsin neg * rect> + ] [ fcos ] if ; foldable : sec ( x -- y ) cos recip ; inline : cosh ( x -- y ) - >float-rect 2dup - fcos swap fcosh * -rot - fsin swap fsinh * rect> ; foldable + dup complex? [ + >float-rect 2dup + fcos swap fcosh * -rot + fsin swap fsinh * rect> + ] [ fcosh ] if ; foldable : sech ( x -- y ) cosh recip ; inline : sin ( x -- y ) - >float-rect 2dup - fcosh swap fsin * -rot - fsinh swap fcos * rect> ; foldable + dup complex? [ + >float-rect 2dup + fcosh swap fsin * -rot + fsinh swap fcos * rect> + ] [ fsin ] if ; foldable : cosec ( x -- y ) sin recip ; inline : sinh ( x -- y ) - >float-rect 2dup - fcos swap fsinh * -rot - fsin swap fcosh * rect> ; foldable + dup complex? [ + >float-rect 2dup + fcos swap fsinh * -rot + fsin swap fcosh * rect> + ] [ fsinh ] if ; foldable : cosech ( x -- y ) sinh recip ; inline -: tan ( x -- y ) dup sin swap cos / ; inline +: tan ( x -- y ) + dup complex? [ dup sin swap cos / ] [ ftan ] if ; inline -: tanh ( x -- y ) dup sinh swap cosh / ; inline +: tanh ( x -- y ) + dup complex? [ dup sinh swap cosh / ] [ ftanh ] if ; inline -: cot ( x -- y ) dup cos swap sin / ; inline +: cot ( x -- y ) tan recip ; inline -: coth ( x -- y ) dup cosh swap sinh / ; inline +: coth ( x -- y ) tanh recip ; inline -: acosh ( x -- y ) dup sq 1- sqrt + log ; inline +: acosh ( x -- y ) + dup sq 1- sqrt + log ; inline : asech ( x -- y ) recip acosh ; inline -: asinh ( x -- y ) dup sq 1+ sqrt + log ; inline +: asinh ( x -- y ) + dup sq 1+ sqrt + log ; inline : acosech ( x -- y ) recip asinh ; inline -: atanh ( x -- y ) dup 1+ swap 1- neg / log 2 / ; inline +: atanh ( x -- y ) + dup 1+ swap 1- neg / log 2 / ; inline : acoth ( x -- y ) recip atanh ; inline -: [-1,1]? ( x -- ? ) - dup complex? [ drop f ] [ abs 1 <= ] if ; inline - : i* ( x -- y ) >rect neg swap rect> ; : -i* ( x -- y ) >rect swap neg rect> ; : asin ( x -- y ) - dup [-1,1]? [ >float fasin ] [ i* asinh -i* ] if ; inline + dup [-1,1]? [ fasin ] [ i* asinh -i* ] if ; inline : acos ( x -- y ) - dup [-1,1]? [ >float facos ] [ asin pi 2 / swap - ] if ; + dup [-1,1]? [ facos ] [ asin pi 2 / swap - ] if ; inline : atan ( x -- y ) - dup [-1,1]? [ >float fatan ] [ i* atanh i* ] if ; inline + dup complex? [ i* atanh i* ] [ fatan ] if ; inline : asec ( x -- y ) recip acos ; inline diff --git a/extra/math/haar/haar.factor b/extra/math/haar/haar.factor index 9254fd0ce7..f1bf87161c 100644 --- a/extra/math/haar/haar.factor +++ b/extra/math/haar/haar.factor @@ -1,5 +1,5 @@ ! Haar wavelet transform -- http://dmr.ath.cx/gfx/haar/ -USING: sequences math kernel splitting columns ; +USING: sequences math kernel splitting grouping columns ; IN: math.haar : averages ( seq -- seq ) diff --git a/extra/math/libm/libm.factor b/extra/math/libm/libm.factor old mode 100644 new mode 100755 index 0cc402e6e5..8bda6a6dd0 --- a/extra/math/libm/libm.factor +++ b/extra/math/libm/libm.factor @@ -27,6 +27,10 @@ IN: math.libm "double" "libm" "sin" { "double" } alien-invoke ; foldable +: ftan ( x -- y ) + "double" "libm" "tan" { "double" } alien-invoke ; + foldable + : fcosh ( x -- y ) "double" "libm" "cosh" { "double" } alien-invoke ; foldable @@ -35,6 +39,10 @@ IN: math.libm "double" "libm" "sinh" { "double" } alien-invoke ; foldable +: ftanh ( x -- y ) + "double" "libm" "tanh" { "double" } alien-invoke ; + foldable + : fexp ( x -- y ) "double" "libm" "exp" { "double" } alien-invoke ; foldable @@ -50,3 +58,16 @@ IN: math.libm : fsqrt ( x -- y ) "double" "libm" "sqrt" { "double" } alien-invoke ; foldable + +! Windows doesn't have these... +: facosh ( x -- y ) + "double" "libm" "acosh" { "double" } alien-invoke ; + foldable + +: fasinh ( x -- y ) + "double" "libm" "asinh" { "double" } alien-invoke ; + foldable + +: fatanh ( x -- y ) + "double" "libm" "atanh" { "double" } alien-invoke ; + foldable diff --git a/extra/math/matrices/elimination/elimination.factor b/extra/math/matrices/elimination/elimination.factor index 8ac9771767..a902eda6f7 100755 --- a/extra/math/matrices/elimination/elimination.factor +++ b/extra/math/matrices/elimination/elimination.factor @@ -21,7 +21,7 @@ SYMBOL: matrix : cols ( -- n ) 0 nth-row length ; : skip ( i seq quot -- n ) - over >r find* drop r> length or ; inline + over >r find-from drop r> length or ; inline : first-col ( row# -- n ) #! First non-zero column @@ -69,7 +69,8 @@ SYMBOL: matrix : echelon ( matrix -- matrix' ) [ 0 0 (echelon) ] with-matrix ; -: nonzero-rows [ [ zero? ] all? not ] subset ; +: nonzero-rows ( matrix -- matrix' ) + [ [ zero? ] all? not ] filter ; : null/rank ( matrix -- null rank ) echelon dup length swap nonzero-rows length [ - ] keep ; diff --git a/extra/math/matrices/matrices.factor b/extra/math/matrices/matrices.factor index 327bf76552..529ddb083a 100755 --- a/extra/math/matrices/matrices.factor +++ b/extra/math/matrices/matrices.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2005, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: arrays kernel sequences math math.functions -math.vectors ; +math.vectors math.order ; IN: math.matrices ! Matrices @@ -35,13 +35,13 @@ IN: math.matrices diff --git a/extra/math/miller-rabin/miller-rabin.factor b/extra/math/miller-rabin/miller-rabin.factor index 7835277b9b..f1953340db 100755 --- a/extra/math/miller-rabin/miller-rabin.factor +++ b/extra/math/miller-rabin/miller-rabin.factor @@ -3,21 +3,9 @@ math.functions math.ranges namespaces random sequences hashtables sets ; IN: math.miller-rabin -SYMBOL: a -SYMBOL: n -SYMBOL: r -SYMBOL: s -SYMBOL: count -SYMBOL: trials - -: >even ( n -- int ) - dup even? [ 1- ] unless ; foldable - -: >odd ( n -- int ) - dup even? [ 1+ ] when ; foldable - -: next-odd ( m -- n ) - dup even? [ 1+ ] [ 2 + ] if ; +: >even ( n -- int ) dup even? [ 1- ] unless ; foldable +: >odd ( n -- int ) dup even? [ 1+ ] when ; foldable +: next-odd ( m -- n ) dup even? [ 1+ ] [ 2 + ] if ; TUPLE: positive-even-expected n ; @@ -28,34 +16,30 @@ TUPLE: positive-even-expected n ; #! factor an integer into s * 2^r 0 swap (factor-2s) ; -:: (miller-rabin) ( n prime?! -- ? ) - n 1- factor-2s s set r set - trials get [ - n 1- [1,b] random a set - a get s get n ^mod 1 = [ - 0 count set - r get [ - 2^ s get * a get swap n ^mod n - -1 = [ - count [ 1+ ] change - r get + - ] when - ] each - count get zero? [ - f prime?! - trials get + - ] when - ] unless - drop - ] each prime? ; - -TUPLE: miller-rabin-bounds ; +:: (miller-rabin) ( n trials -- ? ) + [let | r [ n 1- factor-2s drop ] + s [ n 1- factor-2s nip ] + prime?! [ t ] + a! [ 0 ] + count! [ 0 ] | + trials [ + n 1- [1,b] random a! + a s n ^mod 1 = [ + 0 count! + r [ + 2^ s * a swap n ^mod n - -1 = + [ count 1+ count! r + ] when + ] each + count zero? [ f prime?! trials + ] when + ] unless drop + ] each prime? ] ; : miller-rabin* ( n numtrials -- ? ) over { { [ dup 1 <= ] [ 3drop f ] } { [ dup 2 = ] [ 3drop t ] } { [ dup even? ] [ 3drop f ] } - [ [ drop trials set t (miller-rabin) ] with-scope ] + [ [ drop (miller-rabin) ] with-scope ] } cond ; : miller-rabin ( n -- ? ) 10 miller-rabin* ; @@ -66,7 +50,11 @@ TUPLE: miller-rabin-bounds ; : random-prime ( numbits -- p ) random-bits next-prime ; +ERROR: no-relative-prime n ; + : (find-relative-prime) ( n guess -- p ) + over 1 <= [ over no-relative-prime ] when + dup 1 <= [ drop 3 ] when 2dup gcd nip 1 > [ 2 + (find-relative-prime) ] [ nip ] if ; : find-relative-prime* ( n guess -- p ) @@ -76,7 +64,9 @@ TUPLE: miller-rabin-bounds ; : find-relative-prime ( n -- p ) dup random find-relative-prime* ; +ERROR: too-few-primes ; + : unique-primes ( numbits n -- seq ) #! generate two primes - over 5 < [ "not enough primes below 5 bits" throw ] when + over 5 < [ too-few-primes ] when [ [ drop random-prime ] with map ] [ all-unique? ] generate ; diff --git a/extra/math/polynomials/polynomials.factor b/extra/math/polynomials/polynomials.factor index 0b0d3520ef..e3adf2277d 100644 --- a/extra/math/polynomials/polynomials.factor +++ b/extra/math/polynomials/polynomials.factor @@ -1,5 +1,5 @@ USING: arrays kernel sequences vectors math math.vectors namespaces -shuffle splitting sequences.lib ; +shuffle splitting sequences.lib math.order ; IN: math.polynomials ! Polynomials are vectors with the highest powers on the right: @@ -54,11 +54,11 @@ PRIVATE> #! divide the last two numbers in the sequences [ peek ] bi@ / ; -: (p/mod) +: (p/mod) ( p p -- p p ) 2dup /-last 2dup , n*p swapd p- >vector - dup pop* swap 1 tail-slice ; + dup pop* swap rest-slice ; PRIVATE> diff --git a/extra/math/primes/factors/factors.factor b/extra/math/primes/factors/factors.factor index 2f70ab24b4..aba7e90bc9 100644 --- a/extra/math/primes/factors/factors.factor +++ b/extra/math/primes/factors/factors.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2007 Samuel Tardieu. ! See http://factorcode.org/license.txt for BSD license. -USING: arrays kernel lazy-lists math math.primes namespaces sequences ; +USING: arrays kernel lists math math.primes namespaces sequences ; IN: math.primes.factors [ swap uncons >r pick call r> swap (factors) ] [ 3drop ] if ; + dup 1 > [ swap uncons swap >r pick call r> swap (factors) ] [ 3drop ] if ; : (decompose) ( n quot -- seq ) [ lprimes rot (factors) ] { } make ; diff --git a/extra/math/primes/primes-tests.factor b/extra/math/primes/primes-tests.factor index b1bcf79a49..186acc9b11 100644 --- a/extra/math/primes/primes-tests.factor +++ b/extra/math/primes/primes-tests.factor @@ -1,4 +1,4 @@ -USING: arrays math.primes tools.test lazy-lists ; +USING: arrays math.primes tools.test lists.lazy ; { 1237 } [ 1234 next-prime ] unit-test { f t } [ 1234 prime? 1237 prime? ] unit-test diff --git a/extra/math/primes/primes.factor b/extra/math/primes/primes.factor index edad69fffc..59aebbf0dd 100644 --- a/extra/math/primes/primes.factor +++ b/extra/math/primes/primes.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007 Samuel Tardieu. ! See http://factorcode.org/license.txt for BSD license. -USING: combinators kernel lazy-lists math math.functions math.miller-rabin - math.primes.list math.ranges sequences sorting ; +USING: combinators kernel lists.lazy math math.functions math.miller-rabin + math.order math.primes.list math.ranges sequences sorting ; IN: math.primes fraction ] unit-test diff --git a/extra/math/ratios/ratios.factor b/extra/math/ratios/ratios.factor index 3c430111ff..43cbc3fc10 100755 --- a/extra/math/ratios/ratios.factor +++ b/extra/math/ratios/ratios.factor @@ -47,5 +47,6 @@ M: ratio - 2dup scale - -rot ratio+d / ; M: ratio * 2>fraction * >r * r> / ; M: ratio / scale / ; M: ratio /i scale /i ; +M: ratio /f scale /f ; M: ratio mod 2dup >r >r /i r> r> rot * - ; M: ratio /mod [ /i ] 2keep mod ; diff --git a/extra/math/text/english/english.factor b/extra/math/text/english/english.factor index cba8c28310..3030f28d04 100755 --- a/extra/math/text/english/english.factor +++ b/extra/math/text/english/english.factor @@ -1,7 +1,7 @@ ! Copyright (c) 2007 Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. USING: combinators.lib kernel math math.functions math.parser namespaces - sequences splitting sequences.lib ; + sequences splitting grouping sequences.lib ; IN: math.text.english r >r >r >r 1+ r> r> r> r> ;" eval ] must-fail +[ "USING: kernel math memoize ; IN: memoize.tests MEMO: x ( a b c d e -- f g h i j ) >r >r >r >r 1+ r> r> r> r> ;" eval ] must-fail + +MEMO: see-test ( a -- b ) reverse ; + +[ "USING: memoize sequences ;\nIN: memoize.tests\nMEMO: see-test ( a -- b ) reverse ;\n" ] +[ [ \ see-test see ] with-string-writer ] +unit-test + +[ ] [ "IN: memoize.tests : fib ;" eval ] unit-test + +[ "IN: memoize.tests\n: fib ( -- ) ;\n" ] [ [ \ fib see ] with-string-writer ] unit-test diff --git a/extra/memoize/memoize.factor b/extra/memoize/memoize.factor index 45ae2cc959..aa6ebb532c 100755 --- a/extra/memoize/memoize.factor +++ b/extra/memoize/memoize.factor @@ -39,17 +39,25 @@ IN: memoize over H{ } clone "memoize" set-word-prop over make-memoizer define ; -: MEMO: - CREATE-WORD parse-definition define-memoized ; parsing +: MEMO: (:) define-memoized ; parsing PREDICATE: memoized < word "memoize" word-prop ; M: memoized definer drop \ MEMO: \ ; ; + M: memoized definition "memo-quot" word-prop ; +M: memoized reset-word + [ { "memoize" "memo-quot" } reset-props ] + [ call-next-method ] + bi ; + : memoize-quot ( quot effect -- memo-quot ) gensym swap dupd "declared-effect" set-word-prop dup rot define-memoized 1quotation ; : reset-memoized ( word -- ) "memoize" word-prop clear-assoc ; + +: invalidate-memoized ( inputs... word -- ) + [ #in packer call ] [ "memoize" word-prop delete-at ] bi ; diff --git a/extra/mime-types/authors.txt b/extra/mime-types/authors.txt new file mode 100755 index 0000000000..1901f27a24 --- /dev/null +++ b/extra/mime-types/authors.txt @@ -0,0 +1 @@ +Slava Pestov diff --git a/extra/mime-types/mime-types-tests.factor b/extra/mime-types/mime-types-tests.factor new file mode 100644 index 0000000000..925eca2e9d --- /dev/null +++ b/extra/mime-types/mime-types-tests.factor @@ -0,0 +1,6 @@ +IN: mime-types.tests +USING: mime-types tools.test ; + +[ "application/postscript" ] [ "foo.ps" mime-type ] unit-test +[ "application/octet-stream" ] [ "foo.ps.gz" mime-type ] unit-test +[ "text/plain" ] [ "foo.factor" mime-type ] unit-test diff --git a/extra/mime-types/mime-types.factor b/extra/mime-types/mime-types.factor new file mode 100755 index 0000000000..a228a8904c --- /dev/null +++ b/extra/mime-types/mime-types.factor @@ -0,0 +1,23 @@ +! Copyright (C) 2004, 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: io.files io.encodings.ascii assocs sequences splitting +kernel namespaces fry memoize ; +IN: mime-types + +MEMO: mime-db ( -- seq ) + "resource:extra/mime-types/mime.types" ascii file-lines + [ "#" head? not ] filter [ " \t" split harvest ] map harvest ; + +: nonstandard-mime-types ( -- assoc ) + H{ + { "factor" "text/plain" } + { "cgi" "application/x-cgi-script" } + { "fhtml" "application/x-factor-server-page" } + } ; + +MEMO: mime-types ( -- assoc ) + [ mime-db [ unclip '[ , _ set ] each ] each ] H{ } make-assoc + nonstandard-mime-types assoc-union ; + +: mime-type ( filename -- mime-type ) + file-extension mime-types at "application/octet-stream" or ; diff --git a/extra/mime-types/mime.types b/extra/mime-types/mime.types new file mode 100644 index 0000000000..b602e9dc68 --- /dev/null +++ b/extra/mime-types/mime.types @@ -0,0 +1,988 @@ +# This is a comment. I love comments. + +# This file controls what Internet media types are sent to the client for +# given file extension(s). Sending the correct media type to the client +# is important so they know how to handle the content of the file. +# Extra types can either be added here or by using an AddType directive +# in your config files. For more information about Internet media types, +# please read RFC 2045, 2046, 2047, 2048, and 2077. The Internet media type +# registry is at . + +# MIME type Extensions +application/activemessage +application/andrew-inset ez +application/applefile +application/atom+xml atom +application/atomcat+xml atomcat +application/atomicmail +application/atomsvc+xml atomsvc +application/auth-policy+xml +application/batch-smtp +application/beep+xml +application/cals-1840 +application/ccxml+xml ccxml +application/cellml+xml +application/cnrp+xml +application/commonground +application/conference-info+xml +application/cpl+xml +application/csta+xml +application/cstadata+xml +application/cybercash +application/davmount+xml davmount +application/dca-rft +application/dec-dx +application/dialog-info+xml +application/dicom +application/dns +application/dvcs +application/ecmascript ecma +application/edi-consent +application/edi-x12 +application/edifact +application/epp+xml +application/eshop +application/fastinfoset +application/fastsoap +application/fits +application/font-tdpfr pfr +application/h224 +application/http +application/hyperstudio stk +application/iges +application/im-iscomposing+xml +application/index +application/index.cmd +application/index.obj +application/index.response +application/index.vnd +application/iotp +application/ipp +application/isup +application/javascript js +application/json json +application/kpml-request+xml +application/kpml-response+xml +application/mac-binhex40 hqx +application/mac-compactpro cpt +application/macwriteii +application/marc mrc +application/mathematica ma nb mb +application/mathml+xml mathml +application/mbms-associated-procedure-description+xml +application/mbms-deregister+xml +application/mbms-envelope+xml +application/mbms-msk+xml +application/mbms-msk-response+xml +application/mbms-protection-description+xml +application/mbms-reception-report+xml +application/mbms-register+xml +application/mbms-register-response+xml +application/mbms-user-service-description+xml +application/mbox mbox +application/mediaservercontrol+xml mscml +application/mikey +application/mp4 mp4s +application/mpeg4-generic +application/mpeg4-iod +application/mpeg4-iod-xmt +application/msword doc dot +application/mxf mxf +application/nasdata +application/news-message-id +application/news-transmission +application/nss +application/ocsp-request +application/ocsp-response +application/octet-stream bin dms lha lzh class so iso dmg dist distz pkg bpk dump elc scpt +application/oda oda +application/oebps-package+xml +application/ogg ogg +application/parityfec +application/pdf pdf +application/pgp-encrypted pgp +application/pgp-keys +application/pgp-signature asc sig +application/pics-rules prf +application/pidf+xml +application/pkcs10 p10 +application/pkcs7-mime p7m p7c +application/pkcs7-signature p7s +application/pkix-cert cer +application/pkix-crl crl +application/pkix-pkipath pkipath +application/pkixcmp pki +application/pls+xml pls +application/poc-settings+xml +application/postscript ai eps ps +application/prs.alvestrand.titrax-sheet +application/prs.cww cww +application/prs.nprend +application/prs.plucker +application/qsig +application/rdf+xml rdf +application/reginfo+xml rif +application/relax-ng-compact-syntax rnc +application/remote-printing +application/resource-lists+xml rl +application/riscos +application/rlmi+xml +application/rls-services+xml rs +application/rsd+xml rsd +application/rss+xml rss +application/rtf rtf +application/rtx +application/samlassertion+xml +application/samlmetadata+xml +application/sbml+xml sbml +application/sdp sdp +application/set-payment +application/set-payment-initiation setpay +application/set-registration +application/set-registration-initiation setreg +application/sgml +application/sgml-open-catalog +application/shf+xml shf +application/sieve +application/simple-filter+xml +application/simple-message-summary +application/simplesymbolcontainer +application/slate +application/smil +application/smil+xml smi smil +application/soap+fastinfoset +application/soap+xml +application/spirits-event+xml +application/srgs gram +application/srgs+xml grxml +application/ssml+xml ssml +application/timestamp-query +application/timestamp-reply +application/tve-trigger +application/vemmi +application/vividence.scriptfile +application/vnd.3gpp.bsf+xml +application/vnd.3gpp.pic-bw-large plb +application/vnd.3gpp.pic-bw-small psb +application/vnd.3gpp.pic-bw-var pvb +application/vnd.3gpp.sms +application/vnd.3gpp2.bcmcsinfo+xml +application/vnd.3gpp2.sms +application/vnd.3m.post-it-notes pwn +application/vnd.accpac.simply.aso aso +application/vnd.accpac.simply.imp imp +application/vnd.acucobol acu +application/vnd.acucorp atc acutc +application/vnd.adobe.xdp+xml xdp +application/vnd.adobe.xfdf xfdf +application/vnd.aether.imp +application/vnd.amiga.ami ami +application/vnd.anser-web-certificate-issue-initiation cii +application/vnd.anser-web-funds-transfer-initiation fti +application/vnd.antix.game-component atx +application/vnd.apple.installer+xml mpkg +application/vnd.audiograph aep +application/vnd.autopackage +application/vnd.avistar+xml +application/vnd.blueice.multipass mpm +application/vnd.bmi bmi +application/vnd.businessobjects rep +application/vnd.cab-jscript +application/vnd.canon-cpdl +application/vnd.canon-lips +application/vnd.cendio.thinlinc.clientconf +application/vnd.chemdraw+xml cdxml +application/vnd.chipnuts.karaoke-mmd mmd +application/vnd.cinderella cdy +application/vnd.cirpack.isdn-ext +application/vnd.claymore cla +application/vnd.clonk.c4group c4g c4d c4f c4p c4u +application/vnd.commerce-battelle +application/vnd.commonspace csp cst +application/vnd.contact.cmsg cdbcmsg +application/vnd.cosmocaller cmc +application/vnd.crick.clicker clkx +application/vnd.crick.clicker.keyboard clkk +application/vnd.crick.clicker.palette clkp +application/vnd.crick.clicker.template clkt +application/vnd.crick.clicker.wordbank clkw +application/vnd.criticaltools.wbs+xml wbs +application/vnd.ctc-posml pml +application/vnd.cups-pdf +application/vnd.cups-postscript +application/vnd.cups-ppd ppd +application/vnd.cups-raster +application/vnd.cups-raw +application/vnd.curl curl +application/vnd.cybank +application/vnd.data-vision.rdz rdz +application/vnd.denovo.fcselayout-link fe_launch +application/vnd.dna dna +application/vnd.dolby.mlp mlp +application/vnd.dpgraph dpg +application/vnd.dreamfactory dfac +application/vnd.dvb.esgcontainer +application/vnd.dvb.ipdcesgaccess +application/vnd.dxr +application/vnd.ecdis-update +application/vnd.ecowin.chart mag +application/vnd.ecowin.filerequest +application/vnd.ecowin.fileupdate +application/vnd.ecowin.series +application/vnd.ecowin.seriesrequest +application/vnd.ecowin.seriesupdate +application/vnd.enliven nml +application/vnd.epson.esf esf +application/vnd.epson.msf msf +application/vnd.epson.quickanime qam +application/vnd.epson.salt slt +application/vnd.epson.ssf ssf +application/vnd.ericsson.quickcall +application/vnd.eszigno3+xml es3 et3 +application/vnd.eudora.data +application/vnd.ezpix-album ez2 +application/vnd.ezpix-package ez3 +application/vnd.fdf fdf +application/vnd.ffsns +application/vnd.fints +application/vnd.flographit gph +application/vnd.fluxtime.clip ftc +application/vnd.framemaker fm frame maker +application/vnd.frogans.fnc fnc +application/vnd.frogans.ltf ltf +application/vnd.fsc.weblaunch fsc +application/vnd.fujitsu.oasys oas +application/vnd.fujitsu.oasys2 oa2 +application/vnd.fujitsu.oasys3 oa3 +application/vnd.fujitsu.oasysgp fg5 +application/vnd.fujitsu.oasysprs bh2 +application/vnd.fujixerox.art-ex +application/vnd.fujixerox.art4 +application/vnd.fujixerox.hbpl +application/vnd.fujixerox.ddd ddd +application/vnd.fujixerox.docuworks xdw +application/vnd.fujixerox.docuworks.binder xbd +application/vnd.fut-misnet +application/vnd.fuzzysheet fzs +application/vnd.genomatix.tuxedo txd +application/vnd.google-earth.kml+xml kml +application/vnd.google-earth.kmz kmz +application/vnd.grafeq gqf gqs +application/vnd.gridmp +application/vnd.groove-account gac +application/vnd.groove-help ghf +application/vnd.groove-identity-message gim +application/vnd.groove-injector grv +application/vnd.groove-tool-message gtm +application/vnd.groove-tool-template tpl +application/vnd.groove-vcard vcg +application/vnd.handheld-entertainment+xml zmm +application/vnd.hbci hbci +application/vnd.hcl-bireports +application/vnd.hhe.lesson-player les +application/vnd.hp-hpgl hpgl +application/vnd.hp-hpid hpid +application/vnd.hp-hps hps +application/vnd.hp-jlyt jlt +application/vnd.hp-pcl pcl +application/vnd.hp-pclxl pclxl +application/vnd.httphone +application/vnd.hzn-3d-crossword x3d +application/vnd.ibm.afplinedata +application/vnd.ibm.electronic-media +application/vnd.ibm.minipay mpy +application/vnd.ibm.modcap afp listafp list3820 +application/vnd.ibm.rights-management irm +application/vnd.ibm.secure-container sc +application/vnd.igloader igl +application/vnd.immervision-ivp ivp +application/vnd.immervision-ivu ivu +application/vnd.informedcontrol.rms+xml +application/vnd.intercon.formnet xpw xpx +application/vnd.intertrust.digibox +application/vnd.intertrust.nncp +application/vnd.intu.qbo qbo +application/vnd.intu.qfx qfx +application/vnd.ipunplugged.rcprofile rcprofile +application/vnd.irepository.package+xml irp +application/vnd.is-xpr xpr +application/vnd.jam jam +application/vnd.japannet-directory-service +application/vnd.japannet-jpnstore-wakeup +application/vnd.japannet-payment-wakeup +application/vnd.japannet-registration +application/vnd.japannet-registration-wakeup +application/vnd.japannet-setstore-wakeup +application/vnd.japannet-verification +application/vnd.japannet-verification-wakeup +application/vnd.jcp.javame.midlet-rms rms +application/vnd.jisp jisp +application/vnd.kahootz ktz ktr +application/vnd.kde.karbon karbon +application/vnd.kde.kchart chrt +application/vnd.kde.kformula kfo +application/vnd.kde.kivio flw +application/vnd.kde.kontour kon +application/vnd.kde.kpresenter kpr kpt +application/vnd.kde.kspread ksp +application/vnd.kde.kword kwd kwt +application/vnd.kenameaapp htke +application/vnd.kidspiration kia +application/vnd.kinar kne knp +application/vnd.koan skp skd skt skm +application/vnd.liberty-request+xml +application/vnd.llamagraphics.life-balance.desktop lbd +application/vnd.llamagraphics.life-balance.exchange+xml lbe +application/vnd.lotus-1-2-3 123 +application/vnd.lotus-approach apr +application/vnd.lotus-freelance pre +application/vnd.lotus-notes nsf +application/vnd.lotus-organizer org +application/vnd.lotus-screencam scm +application/vnd.lotus-wordpro lwp +application/vnd.macports.portpkg portpkg +application/vnd.marlin.drm.actiontoken+xml +application/vnd.marlin.drm.conftoken+xml +application/vnd.marlin.drm.mdcf +application/vnd.mcd mcd +application/vnd.medcalcdata mc1 +application/vnd.mediastation.cdkey cdkey +application/vnd.meridian-slingshot +application/vnd.mfer mwf +application/vnd.mfmp mfm +application/vnd.micrografx.flo flo +application/vnd.micrografx.igx igx +application/vnd.mif mif +application/vnd.minisoft-hp3000-save +application/vnd.mitsubishi.misty-guard.trustweb +application/vnd.mobius.daf daf +application/vnd.mobius.dis dis +application/vnd.mobius.mbk mbk +application/vnd.mobius.mqy mqy +application/vnd.mobius.msl msl +application/vnd.mobius.plc plc +application/vnd.mobius.txf txf +application/vnd.mophun.application mpn +application/vnd.mophun.certificate mpc +application/vnd.motorola.flexsuite +application/vnd.motorola.flexsuite.adsi +application/vnd.motorola.flexsuite.fis +application/vnd.motorola.flexsuite.gotap +application/vnd.motorola.flexsuite.kmr +application/vnd.motorola.flexsuite.ttc +application/vnd.motorola.flexsuite.wem +application/vnd.mozilla.xul+xml xul +application/vnd.ms-artgalry cil +application/vnd.ms-asf asf +application/vnd.ms-cab-compressed cab +application/vnd.ms-excel xls xlm xla xlc xlt xlw +application/vnd.ms-fontobject eot +application/vnd.ms-htmlhelp chm +application/vnd.ms-ims ims +application/vnd.ms-lrm lrm +application/vnd.ms-playready.initiator+xml +application/vnd.ms-powerpoint ppt pps pot +application/vnd.ms-project mpp mpt +application/vnd.ms-tnef +application/vnd.ms-wmdrm.lic-chlg-req +application/vnd.ms-wmdrm.lic-resp +application/vnd.ms-wmdrm.meter-chlg-req +application/vnd.ms-wmdrm.meter-resp +application/vnd.ms-works wps wks wcm wdb +application/vnd.ms-wpl wpl +application/vnd.ms-xpsdocument xps +application/vnd.mseq mseq +application/vnd.msign +application/vnd.music-niff +application/vnd.musician mus +application/vnd.ncd.control +application/vnd.nervana +application/vnd.netfpx +application/vnd.neurolanguage.nlu nlu +application/vnd.noblenet-directory nnd +application/vnd.noblenet-sealer nns +application/vnd.noblenet-web nnw +application/vnd.nokia.catalogs +application/vnd.nokia.conml+wbxml +application/vnd.nokia.conml+xml +application/vnd.nokia.isds-radio-presets +application/vnd.nokia.iptv.config+xml +application/vnd.nokia.landmark+wbxml +application/vnd.nokia.landmark+xml +application/vnd.nokia.landmarkcollection+xml +application/vnd.nokia.n-gage.ac+xml +application/vnd.nokia.n-gage.data ngdat +application/vnd.nokia.n-gage.symbian.install n-gage +application/vnd.nokia.ncd +application/vnd.nokia.pcd+wbxml +application/vnd.nokia.pcd+xml +application/vnd.nokia.radio-preset rpst +application/vnd.nokia.radio-presets rpss +application/vnd.novadigm.edm edm +application/vnd.novadigm.edx edx +application/vnd.novadigm.ext ext +application/vnd.oasis.opendocument.chart odc +application/vnd.oasis.opendocument.chart-template otc +application/vnd.oasis.opendocument.formula odf +application/vnd.oasis.opendocument.formula-template otf +application/vnd.oasis.opendocument.graphics odg +application/vnd.oasis.opendocument.graphics-template otg +application/vnd.oasis.opendocument.image odi +application/vnd.oasis.opendocument.image-template oti +application/vnd.oasis.opendocument.presentation odp +application/vnd.oasis.opendocument.presentation-template otp +application/vnd.oasis.opendocument.spreadsheet ods +application/vnd.oasis.opendocument.spreadsheet-template ots +application/vnd.oasis.opendocument.text odt +application/vnd.oasis.opendocument.text-master otm +application/vnd.oasis.opendocument.text-template ott +application/vnd.oasis.opendocument.text-web oth +application/vnd.obn +application/vnd.olpc-sugar xo +application/vnd.oma-scws-config +application/vnd.oma-scws-http-request +application/vnd.oma-scws-http-response +application/vnd.oma.bcast.associated-procedure-parameter+xml +application/vnd.oma.bcast.drm-trigger+xml +application/vnd.oma.bcast.imd+xml +application/vnd.oma.bcast.notification+xml +application/vnd.oma.bcast.sgboot +application/vnd.oma.bcast.sgdd+xml +application/vnd.oma.bcast.sgdu +application/vnd.oma.bcast.simple-symbol-container +application/vnd.oma.bcast.smartcard-trigger+xml +application/vnd.oma.bcast.sprov+xml +application/vnd.oma.dd2+xml dd2 +application/vnd.oma.drm.risd+xml +application/vnd.oma.group-usage-list+xml +application/vnd.oma.poc.groups+xml +application/vnd.oma.xcap-directory+xml +application/vnd.omads-email+xml +application/vnd.omads-file+xml +application/vnd.omads-folder+xml +application/vnd.omaloc-supl-init +application/vnd.openofficeorg.extension oxt +application/vnd.osa.netdeploy +application/vnd.osgi.dp dp +application/vnd.otps.ct-kip+xml +application/vnd.palm prc pdb pqa oprc +application/vnd.paos.xml +application/vnd.pg.format str +application/vnd.pg.osasli ei6 +application/vnd.piaccess.application-licence +application/vnd.picsel efif +application/vnd.poc.group-advertisement+xml +application/vnd.pocketlearn plf +application/vnd.powerbuilder6 pbd +application/vnd.powerbuilder6-s +application/vnd.powerbuilder7 +application/vnd.powerbuilder7-s +application/vnd.powerbuilder75 +application/vnd.powerbuilder75-s +application/vnd.preminet +application/vnd.previewsystems.box box +application/vnd.proteus.magazine mgz +application/vnd.publishare-delta-tree qps +application/vnd.pvi.ptid1 ptid +application/vnd.pwg-multiplexed +application/vnd.pwg-xhtml-print+xml +application/vnd.qualcomm.brew-app-res +application/vnd.quark.quarkxpress qxd qxt qwd qwt qxl qxb +application/vnd.rapid +application/vnd.recordare.musicxml mxl +application/vnd.recordare.musicxml+xml +application/vnd.renlearn.rlprint +application/vnd.rn-realmedia rm +application/vnd.ruckus.download +application/vnd.s3sms +application/vnd.scribus +application/vnd.sealed.3df +application/vnd.sealed.csf +application/vnd.sealed.doc +application/vnd.sealed.eml +application/vnd.sealed.mht +application/vnd.sealed.net +application/vnd.sealed.ppt +application/vnd.sealed.tiff +application/vnd.sealed.xls +application/vnd.sealedmedia.softseal.html +application/vnd.sealedmedia.softseal.pdf +application/vnd.seemail see +application/vnd.sema sema +application/vnd.semd semd +application/vnd.semf semf +application/vnd.shana.informed.formdata ifm +application/vnd.shana.informed.formtemplate itp +application/vnd.shana.informed.interchange iif +application/vnd.shana.informed.package ipk +application/vnd.simtech-mindmapper twd twds +application/vnd.smaf mmf +application/vnd.solent.sdkm+xml sdkm sdkd +application/vnd.spotfire.dxp dxp +application/vnd.spotfire.sfs sfs +application/vnd.sss-cod +application/vnd.sss-dtf +application/vnd.sss-ntf +application/vnd.street-stream +application/vnd.sun.wadl+xml +application/vnd.sus-calendar sus susp +application/vnd.svd svd +application/vnd.swiftview-ics +application/vnd.syncml+xml xsm +application/vnd.syncml.dm+wbxml bdm +application/vnd.syncml.dm+xml xdm +application/vnd.syncml.ds.notification +application/vnd.tao.intent-module-archive tao +application/vnd.tmobile-livetv tmo +application/vnd.trid.tpt tpt +application/vnd.triscape.mxs mxs +application/vnd.trueapp tra +application/vnd.truedoc +application/vnd.ufdl ufd ufdl +application/vnd.uiq.theme utz +application/vnd.umajin umj +application/vnd.unity unityweb +application/vnd.uoml+xml uoml +application/vnd.uplanet.alert +application/vnd.uplanet.alert-wbxml +application/vnd.uplanet.bearer-choice +application/vnd.uplanet.bearer-choice-wbxml +application/vnd.uplanet.cacheop +application/vnd.uplanet.cacheop-wbxml +application/vnd.uplanet.channel +application/vnd.uplanet.channel-wbxml +application/vnd.uplanet.list +application/vnd.uplanet.list-wbxml +application/vnd.uplanet.listcmd +application/vnd.uplanet.listcmd-wbxml +application/vnd.uplanet.signal +application/vnd.vcx vcx +application/vnd.vd-study +application/vnd.vectorworks +application/vnd.vidsoft.vidconference +application/vnd.visio vsd vst vss vsw +application/vnd.visionary vis +application/vnd.vividence.scriptfile +application/vnd.vsf vsf +application/vnd.wap.sic +application/vnd.wap.slc +application/vnd.wap.wbxml wbxml +application/vnd.wap.wmlc wmlc +application/vnd.wap.wmlscriptc wmlsc +application/vnd.webturbo wtb +application/vnd.wfa.wsc +application/vnd.wordperfect wpd +application/vnd.wqd wqd +application/vnd.wrq-hp3000-labelled +application/vnd.wt.stf stf +application/vnd.wv.csp+wbxml +application/vnd.wv.csp+xml +application/vnd.wv.ssp+xml +application/vnd.xara xar +application/vnd.xfdl xfdl +application/vnd.xmpie.cpkg +application/vnd.xmpie.dpkg +application/vnd.xmpie.plan +application/vnd.xmpie.ppkg +application/vnd.xmpie.xlim +application/vnd.yamaha.hv-dic hvd +application/vnd.yamaha.hv-script hvs +application/vnd.yamaha.hv-voice hvp +application/vnd.yamaha.smaf-audio saf +application/vnd.yamaha.smaf-phrase spf +application/vnd.yellowriver-custom-menu cmp +application/vnd.zzazz.deck+xml zaz +application/voicexml+xml vxml +application/watcherinfo+xml +application/whoispp-query +application/whoispp-response +application/winhlp hlp +application/wita +application/wordperfect5.1 +application/wsdl+xml wsdl +application/wspolicy+xml wspolicy +application/x-ace-compressed ace +application/x-bcpio bcpio +application/x-bittorrent torrent +application/x-bzip bz +application/x-bzip2 bz2 boz +application/x-cdlink vcd +application/x-chat chat +application/x-chess-pgn pgn +application/x-compress +application/x-cpio cpio +application/x-csh csh +application/x-director dcr dir dxr fgd +application/x-dvi dvi +application/x-futuresplash spl +application/x-gtar gtar +application/x-gzip +application/x-hdf hdf +application/x-java-jnlp-file jnlp +application/x-latex latex +application/x-ms-wmd wmd +application/x-ms-wmz wmz +application/x-msaccess mdb +application/x-msbinder obd +application/x-mscardfile crd +application/x-msclip clp +application/x-msdownload exe dll com bat msi +application/x-msmediaview mvb m13 m14 +application/x-msmetafile wmf +application/x-msmoney mny +application/x-mspublisher pub +application/x-msschedule scd +application/x-msterminal trm +application/x-mswrite wri +application/x-netcdf nc cdf +application/x-pkcs12 p12 pfx +application/x-pkcs7-certificates p7b spc +application/x-pkcs7-certreqresp p7r +application/x-rar-compressed rar +application/x-sh sh +application/x-shar shar +application/x-shockwave-flash swf +application/x-stuffit sit +application/x-stuffitx sitx +application/x-sv4cpio sv4cpio +application/x-sv4crc sv4crc +application/x-tar tar +application/x-tcl tcl +application/x-tex tex +application/x-texinfo texinfo texi +application/x-ustar ustar +application/x-wais-source src +application/x-x509-ca-cert der crt +application/x400-bp +application/xcap-att+xml +application/xcap-caps+xml +application/xcap-el+xml +application/xcap-error+xml +application/xcap-ns+xml +application/xenc+xml xenc +application/xhtml+xml xhtml xht +application/xml xml xsl +application/xml-dtd dtd +application/xml-external-parsed-entity +application/xmpp+xml +application/xop+xml xop +application/xslt+xml xslt +application/xspf+xml xspf +application/xv+xml mxml xhvml xvml xvm +application/zip zip +audio/32kadpcm +audio/3gpp +audio/3gpp2 +audio/ac3 +audio/amr +audio/amr-wb +audio/amr-wb+ +audio/asc +audio/basic au snd +audio/bv16 +audio/bv32 +audio/clearmode +audio/cn +audio/dat12 +audio/dls +audio/dsr-es201108 +audio/dsr-es202050 +audio/dsr-es202211 +audio/dsr-es202212 +audio/dvi4 +audio/eac3 +audio/evrc +audio/evrc-qcp +audio/evrc0 +audio/evrc1 +audio/evrcb +audio/evrcb0 +audio/evrcb1 +audio/g722 +audio/g7221 +audio/g723 +audio/g726-16 +audio/g726-24 +audio/g726-32 +audio/g726-40 +audio/g728 +audio/g729 +audio/g7291 +audio/g729d +audio/g729e +audio/gsm +audio/gsm-efr +audio/ilbc +audio/l16 +audio/l20 +audio/l24 +audio/l8 +audio/lpc +audio/midi mid midi kar rmi +audio/mobile-xmf +audio/mp4 mp4a +audio/mp4a-latm m4a m4p +audio/mpa +audio/mpa-robust +audio/mpeg mpga mp2 mp2a mp3 m2a m3a +audio/mpeg4-generic +audio/parityfec +audio/pcma +audio/pcmu +audio/prs.sid +audio/qcelp +audio/red +audio/rtp-enc-aescm128 +audio/rtp-midi +audio/rtx +audio/smv +audio/smv0 +audio/smv-qcp +audio/sp-midi +audio/t140c +audio/t38 +audio/telephone-event +audio/tone +audio/vdvi +audio/vmr-wb +audio/vnd.3gpp.iufp +audio/vnd.4sb +audio/vnd.audiokoz +audio/vnd.celp +audio/vnd.cisco.nse +audio/vnd.cmles.radio-events +audio/vnd.cns.anp1 +audio/vnd.cns.inf1 +audio/vnd.digital-winds eol +audio/vnd.dlna.adts +audio/vnd.dolby.mlp +audio/vnd.everad.plj +audio/vnd.hns.audio +audio/vnd.lucent.voice lvp +audio/vnd.nokia.mobile-xmf +audio/vnd.nortel.vbk +audio/vnd.nuera.ecelp4800 ecelp4800 +audio/vnd.nuera.ecelp7470 ecelp7470 +audio/vnd.nuera.ecelp9600 ecelp9600 +audio/vnd.octel.sbc +audio/vnd.qcelp +audio/vnd.rhetorex.32kadpcm +audio/vnd.sealedmedia.softseal.mpeg +audio/vnd.vmx.cvsd +audio/wav wav +audio/x-aiff aif aiff aifc +audio/x-mpegurl m3u +audio/x-ms-wax wax +audio/x-ms-wma wma +audio/x-pn-realaudio ram ra +audio/x-pn-realaudio-plugin rmp +audio/x-wav wav +chemical/x-cdx cdx +chemical/x-cif cif +chemical/x-cmdf cmdf +chemical/x-cml cml +chemical/x-csml csml +chemical/x-pdb pdb +chemical/x-xyz xyz +image/bmp bmp +image/cgm cgm +image/fits +image/g3fax g3 +image/gif gif +image/ief ief +image/jp2 jp2 +image/jpeg jpeg jpg jpe +image/jpm +image/jpx +image/naplps +image/pict pict pic pct +image/png png +image/prs.btif btif +image/prs.pti +image/svg+xml svg svgz +image/t38 +image/tiff tiff tif +image/tiff-fx +image/vnd.adobe.photoshop psd +image/vnd.cns.inf2 +image/vnd.djvu djvu djv +image/vnd.dwg dwg +image/vnd.dxf dxf +image/vnd.fastbidsheet fbs +image/vnd.fpx fpx +image/vnd.fst fst +image/vnd.fujixerox.edmics-mmr mmr +image/vnd.fujixerox.edmics-rlc rlc +image/vnd.globalgraphics.pgb +image/vnd.microsoft.icon ico +image/vnd.mix +image/vnd.ms-modi mdi +image/vnd.net-fpx npx +image/vnd.sealed.png +image/vnd.sealedmedia.softseal.gif +image/vnd.sealedmedia.softseal.jpg +image/vnd.svf +image/vnd.wap.wbmp wbmp +image/vnd.xiff xif +image/x-cmu-raster ras +image/x-cmx cmx +image/x-icon +image/x-macpaint pntg pnt mac +image/x-pcx pcx +image/x-pict pic pct +image/x-portable-anymap pnm +image/x-portable-bitmap pbm +image/x-portable-graymap pgm +image/x-portable-pixmap ppm +image/x-quicktime qtif qti +image/x-rgb rgb +image/x-xbitmap xbm +image/x-xpixmap xpm +image/x-xwindowdump xwd +message/cpim +message/delivery-status +message/disposition-notification +message/external-body +message/http +message/news +message/partial +message/rfc822 eml mime +message/s-http +message/sip +message/sipfrag +message/tracking-status +model/iges igs iges +model/mesh msh mesh silo +model/vnd.dwf dwf +model/vnd.flatland.3dml +model/vnd.gdl gdl +model/vnd.gs.gdl +model/vnd.gtw gtw +model/vnd.moml+xml +model/vnd.mts mts +model/vnd.parasolid.transmit.binary +model/vnd.parasolid.transmit.text +model/vnd.vtu vtu +model/vrml wrl vrml +multipart/alternative +multipart/appledouble +multipart/byteranges +multipart/digest +multipart/encrypted +multipart/form-data +multipart/header-set +multipart/mixed +multipart/parallel +multipart/related +multipart/report +multipart/signed +multipart/voice-message +text/calendar ics ifb +text/css css +text/csv csv +text/directory +text/dns +text/enriched +text/html html htm +text/parityfec +text/plain txt text conf def list log in +text/prs.fallenstein.rst +text/prs.lines.tag dsc +text/red +text/rfc822-headers +text/richtext rtx +text/rtf +text/rtp-enc-aescm128 +text/rtx +text/sgml sgml sgm +text/t140 +text/tab-separated-values tsv +text/troff t tr roff man me ms +text/uri-list uri uris urls +text/vnd.abc +text/vnd.curl +text/vnd.dmclientscript +text/vnd.esmertec.theme-descriptor +text/vnd.fly fly +text/vnd.fmi.flexstor flx +text/vnd.in3d.3dml 3dml +text/vnd.in3d.spot spot +text/vnd.iptc.newsml +text/vnd.iptc.nitf +text/vnd.latex-z +text/vnd.motorola.reflex +text/vnd.ms-mediapackage +text/vnd.net2phone.commcenter.command +text/vnd.sun.j2me.app-descriptor jad +text/vnd.trolltech.linguist +text/vnd.wap.si +text/vnd.wap.sl +text/vnd.wap.wml wml +text/vnd.wap.wmlscript wmls +text/x-asm s asm +text/x-c c cc cxx cpp h hh dic +text/x-fortran f for f77 f90 +text/x-pascal p pas +text/x-java-source java +text/x-setext etx +text/x-uuencode uu +text/x-vcalendar vcs +text/x-vcard vcf +text/xml +text/xml-external-parsed-entity +video/3gpp 3gp +video/3gpp-tt +video/3gpp2 3g2 +video/bmpeg +video/bt656 +video/celb +video/dv +video/h261 h261 +video/h263 h263 +video/h263-1998 +video/h263-2000 +video/h264 h264 +video/jpeg jpgv +video/jpm jpm jpgm +video/mj2 mj2 mjp2 +video/mp1s +video/mp2p +video/mp2t +video/mp4 mp4 mp4v mpg4 m4v +video/mp4v-es +video/mpeg mpeg mpg mpe m1v m2v +video/mpeg4-generic +video/mpv +video/nv +video/parityfec +video/pointer +video/quicktime qt mov +video/raw +video/rtp-enc-aescm128 +video/rtx +video/smpte292m +video/vc1 +video/vnd.dlna.mpeg-tts +video/vnd.fvt fvt +video/vnd.hns.video +video/vnd.motorola.video +video/vnd.motorola.videop +video/vnd.mpegurl mxu m4u +video/vnd.nokia.interleaved-multimedia +video/vnd.nokia.videovoip +video/vnd.objectvideo +video/vnd.sealed.mpeg1 +video/vnd.sealed.mpeg4 +video/vnd.sealed.swf +video/vnd.sealedmedia.softseal.mov +video/vnd.vivo viv +video/x-dv dv dif +video/x-fli fli +video/x-ms-asf asf asx +video/x-ms-wm wm +video/x-ms-wmv wmv +video/x-ms-wmx wmx +video/x-ms-wvx wvx +video/x-msvideo avi +video/x-sgi-movie movie +x-conference/x-cooltalk ice diff --git a/extra/minneapolis-talk/minneapolis-talk.factor b/extra/minneapolis-talk/minneapolis-talk.factor index 19cdcab2fb..25bad4061a 100755 --- a/extra/minneapolis-talk/minneapolis-talk.factor +++ b/extra/minneapolis-talk/minneapolis-talk.factor @@ -177,6 +177,6 @@ IN: minneapolis-talk { $slide "Questions?" } } ; -: minneapolis-talk minneapolis-slides slides-window ; +: minneapolis-talk ( -- ) minneapolis-slides slides-window ; MAIN: minneapolis-talk diff --git a/extra/models/models.factor b/extra/models/models.factor index 58335de3d1..2caf6e9940 100755 --- a/extra/models/models.factor +++ b/extra/models/models.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2006, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: generic kernel math sequences arrays assocs alarms -calendar ; +calendar math.order ; IN: models TUPLE: model < identity-tuple @@ -156,7 +156,7 @@ TUPLE: history back forward ; : ( value -- history ) history construct-model dup reset-history ; -: (add-history) +: (add-history) ( history to -- ) swap model-value dup [ swap push ] [ 2drop ] if ; : go-back/forward ( history to from -- ) diff --git a/extra/monads/authors.txt b/extra/monads/authors.txt new file mode 100644 index 0000000000..1901f27a24 --- /dev/null +++ b/extra/monads/authors.txt @@ -0,0 +1 @@ +Slava Pestov diff --git a/extra/monads/monads-tests.factor b/extra/monads/monads-tests.factor new file mode 100644 index 0000000000..d0014b5abe --- /dev/null +++ b/extra/monads/monads-tests.factor @@ -0,0 +1,128 @@ +USING: tools.test monads math kernel sequences lists promises ; +IN: monads.tests + +[ 5 ] [ 1 identity-monad return [ 4 + ] fmap run-identity ] unit-test +[ "OH HAI" identity-monad fail ] must-fail + +[ 666 ] [ + 111 just [ 6 * ] fmap [ ] [ "OOPS" throw ] if-maybe +] unit-test + +[ nothing ] [ + 111 just [ maybe-monad fail ] bind +] unit-test + +[ 100 ] [ + 5 either-monad return [ 10 * ] [ 20 * ] if-either +] unit-test + +[ T{ left f "OOPS" } ] [ + 5 either-monad return >>= [ drop "OOPS" either-monad fail ] swap call +] unit-test + +[ { 10 20 30 } ] [ + { 1 2 3 } [ 10 * ] fmap +] unit-test + +[ { } ] [ + { 1 2 3 } [ drop "OOPS" array-monad fail ] bind +] unit-test + +[ 5 ] [ + 5 state-monad return "initial state" run-st +] unit-test + +[ 8 ] [ + 5 state-monad return [ 3 + state-monad return ] bind + "initial state" run-st +] unit-test + +[ 8 ] [ + 5 state-monad return >>= + [ 3 + state-monad return ] swap call + "initial state" run-st +] unit-test + +[ 11 ] [ + f state-monad return >>= + [ drop get-st ] swap call + 11 run-st +] unit-test + +[ 15 ] [ + f state-monad return + [ drop get-st ] bind + [ 4 + put-st ] bind + [ drop get-st ] bind + 11 run-st +] unit-test + +[ 15 ] [ + { + [ f return-st ] + [ drop get-st ] + [ 4 + put-st ] + [ drop get-st ] + } do + 11 run-st +] unit-test + +[ nothing ] [ + { + [ "hi" just ] + [ " bye" append just ] + [ drop nothing ] + [ reverse just ] + } do +] unit-test + +LAZY: nats-from ( n -- list ) + dup 1+ nats-from cons ; + +: nats 0 nats-from ; + +[ 3 ] [ + { + [ nats ] + [ dup 3 = [ list-monad return ] [ list-monad fail ] if ] + } do car +] unit-test + +[ 9/11 ] [ + { + [ ask ] + } do 9/11 run-reader +] unit-test + +[ 8 ] [ + { + [ ask ] + [ 3 + reader-monad return ] + } do + 5 run-reader +] unit-test + +[ 6 ] [ + f reader-monad return [ drop ask ] bind [ 1 + ] local 5 run-reader +] unit-test + +[ f { 1 2 3 } ] [ + 5 writer-monad return + [ drop { 1 2 3 } tell ] bind + run-writer +] unit-test + +[ T{ identity f 7 } ] +[ + 4 identity-monad return + [ 3 + ] identity-monad return + identity-monad apply +] unit-test + +[ nothing ] [ + 5 just nothing maybe-monad apply +] unit-test + +[ T{ just f 15 } ] [ + 5 just [ 10 + ] just maybe-monad apply +] unit-test diff --git a/extra/monads/monads.factor b/extra/monads/monads.factor new file mode 100644 index 0000000000..e110cb38d3 --- /dev/null +++ b/extra/monads/monads.factor @@ -0,0 +1,192 @@ +! Copyright (C) 2008 Slava Pestov +! See http://factorcode.org/license.txt for BSD license. +USING: arrays kernel sequences sequences.deep splitting +accessors fry locals combinators namespaces lists lists.lazy +shuffle ; +IN: monads + +! Functors +GENERIC# fmap 1 ( functor quot -- functor' ) inline + +! Monads + +! Mixin type for monad singleton classes, used for return/fail only +MIXIN: monad + +GENERIC: monad-of ( mvalue -- singleton ) +GENERIC: return ( value singleton -- mvalue ) +GENERIC: fail ( value singleton -- mvalue ) +GENERIC: >>= ( mvalue -- quot ) + +M: monad return monad-of return ; +M: monad fail monad-of fail ; + +: bind ( mvalue quot -- mvalue' ) swap >>= call ; +: >> ( mvalue k -- mvalue' ) '[ drop , ] bind ; + +:: lift-m2 ( m1 m2 f monad -- m3 ) + m1 [| x1 | m2 [| x2 | x1 x2 f monad return ] bind ] bind ; + +:: apply ( mvalue mquot monad -- result ) + mvalue [| value | + mquot [| quot | + value quot call monad return + ] bind + ] bind ; + +M: monad fmap over '[ @ , return ] bind ; + +! 'do' notation +: do ( quots -- result ) unclip dip [ bind ] each ; + +! Identity +SINGLETON: identity-monad +INSTANCE: identity-monad monad + +TUPLE: identity value ; +INSTANCE: identity monad + +M: identity monad-of drop identity-monad ; + +M: identity-monad return drop identity boa ; +M: identity-monad fail "Fail" throw ; + +M: identity >>= value>> '[ , _ call ] ; + +: run-identity ( identity -- value ) value>> ; + +! Maybe +SINGLETON: maybe-monad +INSTANCE: maybe-monad monad + +SINGLETON: nothing + +TUPLE: just value ; +: just ( value -- just ) \ just boa ; + +UNION: maybe just nothing ; +INSTANCE: maybe monad + +M: maybe monad-of drop maybe-monad ; + +M: maybe-monad return drop just ; +M: maybe-monad fail 2drop nothing ; + +M: nothing >>= '[ drop , ] ; +M: just >>= value>> '[ , _ call ] ; + +: if-maybe ( maybe just-quot nothing-quot -- ) + pick nothing? [ 2nip call ] [ drop [ value>> ] dip call ] if ; inline + +! Either +SINGLETON: either-monad +INSTANCE: either-monad monad + +TUPLE: left value ; +: left ( value -- left ) \ left boa ; + +TUPLE: right value ; +: right ( value -- right ) \ right boa ; + +UNION: either left right ; +INSTANCE: either monad + +M: either monad-of drop either-monad ; + +M: either-monad return drop right ; +M: either-monad fail drop left ; + +M: left >>= '[ drop , ] ; +M: right >>= value>> '[ , _ call ] ; + +: if-either ( value left-quot right-quot -- ) + [ [ value>> ] [ left? ] bi ] 2dip if ; inline + +! Arrays +SINGLETON: array-monad +INSTANCE: array-monad monad +INSTANCE: array monad + +M: array-monad return drop 1array ; +M: array-monad fail 2drop { } ; + +M: array monad-of drop array-monad ; + +M: array >>= '[ , _ map concat ] ; + +! List +SINGLETON: list-monad +INSTANCE: list-monad monad +INSTANCE: list monad + +M: list-monad return drop 1list ; +M: list-monad fail 2drop nil ; + +M: list monad-of drop list-monad ; + +M: list >>= '[ , _ lazy-map lconcat ] ; + +! State +SINGLETON: state-monad +INSTANCE: state-monad monad + +TUPLE: state quot ; +: state ( quot -- state ) \ state boa ; + +INSTANCE: state monad + +M: state monad-of drop state-monad ; + +M: state-monad return drop '[ , 2array ] state ; +M: state-monad fail "Fail" throw ; + +: mcall ( state -- ) quot>> call ; + +M: state >>= '[ , _ '[ , mcall first2 @ mcall ] state ] ; + +: get-st ( -- state ) [ dup 2array ] state ; +: put-st ( value -- state ) '[ drop , f 2array ] state ; + +: run-st ( state initial -- ) swap mcall second ; + +: return-st ( value -- mvalue ) state-monad return ; + +! Reader +SINGLETON: reader-monad +INSTANCE: reader-monad monad + +TUPLE: reader quot ; +: reader ( quot -- reader ) \ reader boa ; +INSTANCE: reader monad + +M: reader monad-of drop reader-monad ; + +M: reader-monad return drop '[ drop , ] reader ; +M: reader-monad fail "Fail" throw ; + +M: reader >>= '[ , _ '[ dup , mcall @ mcall ] reader ] ; + +: run-reader ( reader env -- ) swap mcall ; + +: ask ( -- reader ) [ ] reader ; +: local ( reader quot -- reader' ) swap '[ @ , mcall ] reader ; + +! Writer +SINGLETON: writer-monad +INSTANCE: writer-monad monad + +TUPLE: writer value log ; +: writer ( value log -- writer ) \ writer boa ; + +M: writer monad-of drop writer-monad ; + +M: writer-monad return drop { } writer ; +M: writer-monad fail "Fail" throw ; + +: run-writer ( writer -- value log ) [ value>> ] [ log>> ] bi ; + +M: writer >>= '[ , run-writer _ '[ @ run-writer ] dip append writer ] ; + +: pass ( writer -- writer' ) run-writer [ first2 ] dip swap call writer ; +: listen ( writer -- writer' ) run-writer [ 2array ] keep writer ; +: tell ( seq -- writer ) f swap writer ; diff --git a/extra/monads/summary.txt b/extra/monads/summary.txt new file mode 100644 index 0000000000..359722ce04 --- /dev/null +++ b/extra/monads/summary.txt @@ -0,0 +1 @@ +Haskell-style monads diff --git a/extra/shufflers/tags.txt b/extra/monads/tags.txt similarity index 100% rename from extra/shufflers/tags.txt rename to extra/monads/tags.txt diff --git a/extra/money/money.factor b/extra/money/money.factor index 4584daf592..54c53e9bec 100644 --- a/extra/money/money.factor +++ b/extra/money/money.factor @@ -1,6 +1,6 @@ USING: io kernel math math.functions math.parser parser -namespaces sequences splitting combinators continuations -sequences.lib ; +namespaces sequences splitting grouping combinators +continuations sequences.lib ; IN: money : dollars/cents ( dollars -- dollars cents ) @@ -15,17 +15,14 @@ IN: money "." % number>string 2 CHAR: 0 pad-left % ] "" make print ; -TUPLE: not-a-decimal ; - -: not-a-decimal ( -- * ) - T{ not-a-decimal } throw ; +ERROR: not-a-decimal x ; : parse-decimal ( str -- ratio ) "." split1 >r dup "-" head? [ drop t "0" ] [ f swap ] if r> [ dup empty? [ drop "0" ] when ] bi@ dup length - >r [ string>number dup [ not-a-decimal ] unless ] bi@ r> + >r [ dup string>number [ nip ] [ not-a-decimal ] if* ] bi@ r> 10 swap ^ / + swap [ neg ] when ; : DECIMAL: diff --git a/extra/morse/authors.txt b/extra/morse/authors.txt new file mode 100644 index 0000000000..e9c193bac7 --- /dev/null +++ b/extra/morse/authors.txt @@ -0,0 +1 @@ +Alex Chapman diff --git a/extra/morse/morse-docs.factor b/extra/morse/morse-docs.factor index c11ba23db7..e35967d3e9 100644 --- a/extra/morse/morse-docs.factor +++ b/extra/morse/morse-docs.factor @@ -23,3 +23,11 @@ HELP: morse> { $values { "str" "A string of morse code, in which the character '.' represents dots, '-' dashes, ' ' spaces between letters, and ' / ' spaces between words." } { "str" "The ASCII translation of the given string" } } { $description "Translates morse code into ASCII text" } { $see-also >morse morse>ch } ; + +HELP: play-as-morse* +{ $values { "str" "A string of ascii characters which can be translated into morse code" } { "unit-length" "The length of a dot" } } +{ $description "Plays a string as morse code" } ; + +HELP: play-as-morse +{ $values { "str" "A string of ascii characters which can be translated into morse code" } } +{ $description "Plays a string as morse code" } ; diff --git a/extra/morse/morse-tests.factor b/extra/morse/morse-tests.factor index 97efe1afb4..144448917f 100644 --- a/extra/morse/morse-tests.factor +++ b/extra/morse/morse-tests.factor @@ -9,3 +9,5 @@ USING: arrays morse strings tools.test ; [ "-- --- .-. ... . / -.-. --- -.. ." ] [ "morse code" >morse ] unit-test [ "morse code" ] [ "-- --- .-. ... . / -.-. --- -.. ." morse> ] unit-test [ "hello, world!" ] [ "Hello, World!" >morse morse> ] unit-test +! [ ] [ "sos" 0.075 play-as-morse* ] unit-test +! [ ] [ "Factor rocks!" play-as-morse ] unit-test diff --git a/extra/morse/morse.factor b/extra/morse/morse.factor index f493951ed5..591915b317 100644 --- a/extra/morse/morse.factor +++ b/extra/morse/morse.factor @@ -1,7 +1,6 @@ -! Copyright (C) 2007 Alex Chapman +! Copyright (C) 2007, 2008 Alex Chapman ! See http://factorcode.org/license.txt for BSD license. -USING: assocs hashtables kernel lazy-lists namespaces openal -parser-combinators promises sequences strings unicode.case ; +USING: accessors assocs combinators hashtables kernel lists math namespaces openal parser-combinators promises sequences strings symbols synth synth.buffers unicode.case ; IN: morse <+> ; @@ -123,3 +122,59 @@ PRIVATE> ] map >string ] map [ [ CHAR: \s , ] [ % ] interleave ] "" make ; + ( -- buffer ) + half-sample-freq <8bit-mono-buffer> ; + +: sine-buffer ( seconds -- id ) + beep-freq swap >sine-wave-buffer + send-buffer id>> ; + +: silent-buffer ( seconds -- id ) + >silent-buffer send-buffer id>> ; + +: make-buffers ( unit-length -- ) + { + [ sine-buffer dot-buffer set ] + [ 3 * sine-buffer dash-buffer set ] + [ silent-buffer intra-char-gap-buffer set ] + [ 3 * silent-buffer letter-gap-buffer set ] + } cleave ; + +: playing-morse ( quot unit-length -- ) + [ + init-openal 1 gen-sources first source set make-buffers + call + source get source-play + ] with-scope ; + +: play-char ( ch -- ) + [ intra-char-gap ] [ + { + { dot-char [ dot ] } + { dash-char [ dash ] } + { word-gap-char [ intra-char-gap ] } + } case + ] interleave ; + +PRIVATE> + +: play-as-morse* ( str unit-length -- ) + [ + [ letter-gap ] [ ch>morse play-char ] interleave + ] swap playing-morse ; + +: play-as-morse ( str -- ) + 0.05 play-as-morse* ; diff --git a/extra/morse/summary.txt b/extra/morse/summary.txt new file mode 100644 index 0000000000..2c1f091a9a --- /dev/null +++ b/extra/morse/summary.txt @@ -0,0 +1 @@ +Converts between text and morse code, and plays morse code. diff --git a/extra/mortar/mortar.factor b/extra/mortar/mortar.factor index b7862af7ac..3a4dc6fefb 100644 --- a/extra/mortar/mortar.factor +++ b/extra/mortar/mortar.factor @@ -1,6 +1,6 @@ USING: kernel io parser words namespaces quotations arrays assocs sequences - splitting math shuffle ; + splitting grouping math shuffle ; IN: mortar @@ -122,7 +122,7 @@ over class-class-methods assoc-stack call ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! : send-message-next ( object message -- ) -over object-class class-methods 1 head* assoc-stack call ; +over object-class class-methods but-last assoc-stack call ; : <-~ scan parsed \ send-message-next parsed ; parsing diff --git a/extra/multi-methods/multi-methods.factor b/extra/multi-methods/multi-methods.factor index dd6fc7dfff..e2a18e2f78 100755 --- a/extra/multi-methods/multi-methods.factor +++ b/extra/multi-methods/multi-methods.factor @@ -4,7 +4,7 @@ USING: kernel math sequences vectors classes classes.algebra combinators arrays words assocs parser namespaces definitions prettyprint prettyprint.backend quotations arrays.lib debugger io compiler.units kernel.private effects accessors -hashtables sorting shuffle ; +hashtables sorting shuffle math.order sets ; IN: multi-methods ! PART I: Converting hook specializers @@ -19,13 +19,13 @@ SYMBOL: total : canonicalize-specializer-1 ( specializer -- specializer' ) [ - [ class? ] subset + [ class? ] filter [ length [ 1+ neg ] map ] keep zip [ length args [ max ] change ] keep ] [ - [ pair? ] subset - [ keys [ hooks get push-new ] each ] keep + [ pair? ] filter + [ keys [ hooks get adjoin ] each ] keep ] bi append ; : canonicalize-specializer-2 ( specializer -- specializer' ) @@ -73,7 +73,7 @@ SYMBOL: total ! Part II: Topologically sorting specializers : maximal-element ( seq quot -- n elt ) dupd [ - swapd [ call 0 < ] 2curry subset empty? + swapd [ call +lt+ = ] 2curry filter empty? ] 2curry find [ "Topological sort failed" throw ] unless* ; inline @@ -82,16 +82,16 @@ SYMBOL: total [ dupd maximal-element >r over delete-nth r> ] curry [ ] unfold nip ; inline -: classes< ( seq1 seq2 -- -1/0/1 ) +: classes< ( seq1 seq2 -- lt/eq/gt ) [ { - { [ 2dup eq? ] [ 0 ] } - { [ 2dup [ class< ] 2keep swap class< and ] [ 0 ] } - { [ 2dup class< ] [ -1 ] } - { [ 2dup swap class< ] [ 1 ] } - [ 0 ] + { [ 2dup eq? ] [ +eq+ ] } + { [ 2dup [ class<= ] [ swap class<= ] 2bi and ] [ +eq+ ] } + { [ 2dup class<= ] [ +lt+ ] } + { [ 2dup swap class<= ] [ +gt+ ] } + [ +eq+ ] } cond 2nip - ] 2map [ zero? not ] find nip 0 or ; + ] 2map [ +eq+ eq? not ] find nip +eq+ or ; : sort-methods ( alist -- alist' ) [ [ first ] bi@ classes< ] topological-sort ; @@ -111,7 +111,7 @@ SYMBOL: total : multi-predicate ( classes -- quot ) dup length [ picker 2array ] 2map - [ drop object eq? not ] assoc-subset + [ drop object eq? not ] assoc-filter dup empty? [ drop [ t ] ] [ [ (multi-predicate) ] { } assoc>map unclip [ swap [ f ] \ if 3array append [ ] like ] reduce @@ -187,7 +187,8 @@ M: method-body crossref? drop [ dup ] 2keep reveal-method ] if ; -: niceify-method [ dup \ f eq? [ drop f ] when ] map ; +: niceify-method ( seq -- seq ) + [ dup \ f eq? [ drop f ] when ] map ; M: no-method error. "Type check error" print @@ -229,10 +230,10 @@ M: no-method error. : create-method-in ( specializer generic -- method ) create-method dup save-location f set-word ; -: CREATE-METHOD +: CREATE-METHOD ( -- method ) scan-word scan-object swap create-method-in ; -: (METHOD:) CREATE-METHOD parse-definition ; +: (METHOD:) ( -- method def ) CREATE-METHOD parse-definition ; : METHOD: (METHOD:) define ; parsing diff --git a/extra/multi-methods/tests/topological-sort.factor b/extra/multi-methods/tests/topological-sort.factor index ed8bece4ba..f1618374ef 100644 --- a/extra/multi-methods/tests/topological-sort.factor +++ b/extra/multi-methods/tests/topological-sort.factor @@ -1,18 +1,19 @@ +USING: kernel multi-methods tools.test math arrays sequences +math.order ; IN: multi-methods.tests -USING: kernel multi-methods tools.test math arrays sequences ; [ { 1 2 3 4 5 6 } ] [ { 6 4 5 1 3 2 } [ <=> ] topological-sort ] unit-test -[ -1 ] [ +[ +lt+ ] [ { fixnum array } { number sequence } classes< ] unit-test -[ 0 ] [ +[ +eq+ ] [ { number sequence } { number sequence } classes< ] unit-test -[ 1 ] [ +[ +gt+ ] [ { object object } { number sequence } classes< ] unit-test diff --git a/extra/multiline/multiline.factor b/extra/multiline/multiline.factor index 079f484274..ce79bdaf5f 100755 --- a/extra/multiline/multiline.factor +++ b/extra/multiline/multiline.factor @@ -14,7 +14,7 @@ IN: multiline ] [ ";" unexpected-eof ] if* ; : parse-here ( -- str ) - [ (parse-here) ] "" make 1 head* + [ (parse-here) ] "" make but-last lexer get next-line ; : STRING: @@ -34,7 +34,7 @@ IN: multiline [ lexer get lexer-column swap (parse-multiline-string) lexer get set-lexer-column - ] "" make 1 tail 1 head* ; + ] "" make rest but-last ; : <" "\">" parse-multiline-string parsed ; parsing diff --git a/extra/namespaces/lib/lib.factor b/extra/namespaces/lib/lib.factor index 47b6b33a9a..9ad8978bf3 100755 --- a/extra/namespaces/lib/lib.factor +++ b/extra/namespaces/lib/lib.factor @@ -2,7 +2,7 @@ ! USING: kernel quotations namespaces sequences assocs.lib ; USING: kernel namespaces namespaces.private quotations sequences - assocs.lib math.parser math sequences.lib locals ; + assocs.lib math.parser math sequences.lib locals mirrors ; IN: namespaces.lib @@ -22,25 +22,25 @@ SYMBOL: building-seq : get-building-seq ( n -- seq ) building-seq get nth ; -: n, get-building-seq push ; -: n% get-building-seq push-all ; -: n# >r number>string r> n% ; +: n, ( obj n -- ) get-building-seq push ; +: n% ( seq n -- ) get-building-seq push-all ; +: n# ( num n -- ) >r number>string r> n% ; -: 0, 0 n, ; -: 0% 0 n% ; -: 0# 0 n# ; -: 1, 1 n, ; -: 1% 1 n% ; -: 1# 1 n# ; -: 2, 2 n, ; -: 2% 2 n% ; -: 2# 2 n# ; -: 3, 3 n, ; -: 3% 3 n% ; -: 3# 3 n# ; -: 4, 4 n, ; -: 4% 4 n% ; -: 4# 4 n# ; +: 0, ( obj -- ) 0 n, ; +: 0% ( seq -- ) 0 n% ; +: 0# ( num -- ) 0 n# ; +: 1, ( obj -- ) 1 n, ; +: 1% ( seq -- ) 1 n% ; +: 1# ( num -- ) 1 n# ; +: 2, ( obj -- ) 2 n, ; +: 2% ( seq -- ) 2 n% ; +: 2# ( num -- ) 2 n# ; +: 3, ( obj -- ) 3 n, ; +: 3% ( seq -- ) 3 n% ; +: 3# ( num -- ) 3 n# ; +: 4, ( obj -- ) 4 n, ; +: 4% ( seq -- ) 4 n% ; +: 4# ( num -- ) 4 n# ; MACRO:: nmake ( quot exemplars -- ) [let | n [ exemplars length ] | @@ -58,3 +58,9 @@ MACRO:: nmake ( quot exemplars -- ) ] with-scope ] ] ; + +: make-object ( quot class -- object ) + new [ swap bind ] keep ; inline + +: with-object ( object quot -- ) + [ ] dip bind ; inline diff --git a/extra/nehe/nehe.factor b/extra/nehe/nehe.factor index 51eb129b34..b074e85f3b 100644 --- a/extra/nehe/nehe.factor +++ b/extra/nehe/nehe.factor @@ -2,7 +2,7 @@ USING: ui.gadgets.buttons ui.gadgets.packs ui.gadgets ui nehe.2 nehe.3 nehe.4 nehe.5 kernel ; IN: nehe -: nehe-window +: nehe-window ( -- ) [ [ "Nehe 2" [ drop run2 ] gadget, diff --git a/extra/newfx/newfx.factor b/extra/newfx/newfx.factor index 3e5f66eb6f..be30dfe370 100644 --- a/extra/newfx/newfx.factor +++ b/extra/newfx/newfx.factor @@ -143,7 +143,7 @@ METHOD: as-mutate { object object assoc } set-at ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -: subset-of ( quot seq -- seq ) swap subset ; +: filter-of ( quot seq -- seq ) swap filter ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -160,15 +160,30 @@ METHOD: as-mutate { object object assoc } set-at ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -: 1st 0 at ; -: 2nd 1 at ; -: 3rd 2 at ; -: 4th 3 at ; -: 5th 4 at ; -: 6th 5 at ; -: 7th 6 at ; -: 8th 7 at ; -: 9th 8 at ; +: subseq ( seq from to -- subseq ) rot sequences:subseq ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: key ( table val -- key ) swap assocs:value-at ; + +: key-of ( val table -- key ) assocs:value-at ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: index ( seq obj -- i ) swap sequences:index ; +: index-of ( obj seq -- i ) sequences:index ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: 1st ( seq -- obj ) 0 at ; +: 2nd ( seq -- obj ) 1 at ; +: 3rd ( seq -- obj ) 2 at ; +: 4th ( seq -- obj ) 3 at ; +: 5th ( seq -- obj ) 4 at ; +: 6th ( seq -- obj ) 5 at ; +: 7th ( seq -- obj ) 6 at ; +: 8th ( seq -- obj ) 7 at ; +: 9th ( seq -- obj ) 8 at ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/extra/numbers-game/numbers-game.factor b/extra/numbers-game/numbers-game.factor index 9336aa6b5b..ccfe958fe0 100644 --- a/extra/numbers-game/numbers-game.factor +++ b/extra/numbers-game/numbers-game.factor @@ -3,12 +3,12 @@ IN: numbers-game : read-number ( -- n ) readln string>number ; -: guess-banner +: guess-banner ( -- ) "I'm thinking of a number between 0 and 100." print ; -: guess-prompt "Enter your guess: " write ; -: too-high "Too high" print ; -: too-low "Too low" print ; -: correct "Correct - you win!" print ; +: guess-prompt ( -- ) "Enter your guess: " write ; +: too-high ( -- ) "Too high" print ; +: too-low ( -- ) "Too low" print ; +: correct ( -- ) "Correct - you win!" print ; : inexact-guess ( actual guess -- ) < [ too-high ] [ too-low ] if ; @@ -22,6 +22,6 @@ IN: numbers-game dup guess-prompt read-number judge-guess [ numbers-game-loop ] [ drop ] if ; -: numbers-game number-to-guess numbers-game-loop ; +: numbers-game ( -- ) number-to-guess numbers-game-loop ; MAIN: numbers-game diff --git a/extra/ogg/player/player.factor b/extra/ogg/player/player.factor index d4ad11311f..251206f1d1 100755 --- a/extra/ogg/player/player.factor +++ b/extra/ogg/player/player.factor @@ -15,7 +15,7 @@ USING: kernel alien ogg ogg.vorbis ogg.theora io byte-arrays namespaces threads shuffle opengl arrays ui.gadgets.worlds combinators math.parser ui.gadgets ui.render opengl.gl ui continuations io.files hints combinators.lib sequences.lib - io.encodings.binary debugger ; + io.encodings.binary debugger math.order ; IN: ogg.player diff --git a/extra/openal/openal.factor b/extra/openal/openal.factor index ff67a30ea3..2a8959b4a0 100644 --- a/extra/openal/openal.factor +++ b/extra/openal/openal.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2007 Chris Double. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel alien system combinators alien.syntax namespaces +USING: kernel arrays alien system combinators alien.syntax namespaces alien.c-types sequences vocabs.loader shuffle combinators.lib openal.backend ; IN: openal @@ -235,17 +235,17 @@ SYMBOL: init : init-openal ( -- ) init get-global expired? [ - f f alutInit drop + f f alutInit 0 = [ "Could not initialize OpenAL" throw ] when 1337 init set-global ] when ; : exit-openal ( -- ) init get-global expired? [ - alutExit drop + alutExit 0 = [ "Could not close OpenAL" throw ] when f init set-global ] unless ; -: "ALuint" ; +: ( n -- byte-array ) "ALuint" ; : gen-sources ( size -- seq ) dup 2dup alGenSources swap c-uint-array> ; @@ -266,6 +266,12 @@ os macosx? "openal.macosx" "openal.other" ? require gen-buffer dup rot load-wav-file [ alBufferData ] 4keep alutUnloadWAV ; +: queue-buffers ( source buffers -- ) + [ length ] [ >c-uint-array ] bi alSourceQueueBuffers ; + +: queue-buffer ( source buffer -- ) + 1array queue-buffers ; + : set-source-param ( source param value -- ) alSourcei ; diff --git a/extra/opengl/capabilities/capabilities.factor b/extra/opengl/capabilities/capabilities.factor index 6802d15378..d658235cf6 100755 --- a/extra/opengl/capabilities/capabilities.factor +++ b/extra/opengl/capabilities/capabilities.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2008 Joe Groff. ! See http://factorcode.org/license.txt for BSD license. USING: kernel namespaces sequences splitting opengl.gl -continuations math.parser math arrays sets ; +continuations math.parser math arrays sets math.order ; IN: opengl.capabilities : (require-gl) ( thing require-quot make-error-quot -- ) @@ -15,7 +15,7 @@ IN: opengl.capabilities : has-gl-extensions? ( extensions -- ? ) gl-extensions swap [ over member? ] all? nip ; : (make-gl-extensions-error) ( required-extensions -- ) - gl-extensions swap diff + gl-extensions diff "Required OpenGL extensions not supported:\n" % [ " " % % "\n" % ] each ; : require-gl-extensions ( extensions -- ) diff --git a/extra/opengl/demo-support/demo-support.factor b/extra/opengl/demo-support/demo-support.factor index 84515305c8..88531a70bc 100755 --- a/extra/opengl/demo-support/demo-support.factor +++ b/extra/opengl/demo-support/demo-support.factor @@ -1,17 +1,11 @@ -USING: arrays combinators.lib kernel math math.functions math.vectors namespaces - opengl opengl.gl sequences ui ui.gadgets ui.gestures ui.render ; +USING: arrays combinators.lib kernel math math.functions +math.order math.vectors namespaces opengl opengl.gl sequences ui +ui.gadgets ui.gestures ui.render accessors ; IN: opengl.demo-support -: NEAR-PLANE 1.0 64.0 / ; inline -: FAR-PLANE 4.0 ; inline : FOV 2.0 sqrt 1+ ; inline : MOUSE-MOTION-SCALE 0.5 ; inline -: MOUSE-DISTANCE-SCALE 1.0 64.0 / ; inline : KEY-ROTATE-STEP 1.0 ; inline -: KEY-DISTANCE-STEP 1.0 64.0 / ; inline -: DIMS { 640 480 } ; inline - -: FOV-RATIO ( -- fov ) DIMS dup first2 min v/n ; SYMBOL: last-drag-loc @@ -19,7 +13,20 @@ TUPLE: demo-gadget yaw pitch distance ; : ( yaw pitch distance -- gadget ) demo-gadget construct-gadget - [ { set-demo-gadget-yaw set-demo-gadget-pitch set-demo-gadget-distance } set-slots ] keep ; + [ { (>>yaw) (>>pitch) (>>distance) } set-slots ] keep ; + +GENERIC: far-plane ( gadget -- z ) +GENERIC: near-plane ( gadget -- z ) +GENERIC: distance-step ( gadget -- dz ) + +M: demo-gadget far-plane ( gadget -- z ) + drop 4.0 ; +M: demo-gadget near-plane ( gadget -- z ) + drop 1.0 64.0 / ; +M: demo-gadget distance-step ( gadget -- dz ) + drop 1.0 64.0 / ; + +: fov-ratio ( gadget -- fov ) dim>> dup first2 min v/n ; : yaw-demo-gadget ( yaw gadget -- ) [ [ demo-gadget-yaw + ] keep set-demo-gadget-yaw ] keep relayout-1 ; @@ -31,26 +38,31 @@ TUPLE: demo-gadget yaw pitch distance ; [ [ demo-gadget-distance + ] keep set-demo-gadget-distance ] keep relayout-1 ; M: demo-gadget pref-dim* ( gadget -- dim ) - drop DIMS ; + drop { 640 480 } ; : -+ ( x -- -x x ) dup neg swap ; -: demo-gadget-frustum ( -- -x x -y y near far ) - FOV-RATIO NEAR-PLANE FOV / v*n - first2 [ -+ ] bi@ NEAR-PLANE FAR-PLANE ; +: demo-gadget-frustum ( gadget -- -x x -y y near far ) + [ near-plane ] [ far-plane ] [ fov-ratio ] tri [ + nip swap FOV / v*n + first2 [ -+ ] bi@ + ] 3keep drop ; : demo-gadget-set-matrices ( gadget -- ) - GL_PROJECTION glMatrixMode - glLoadIdentity - demo-gadget-frustum glFrustum GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT bitor glClear - GL_MODELVIEW glMatrixMode - glLoadIdentity - [ >r 0.0 0.0 r> demo-gadget-distance neg glTranslatef ] - [ demo-gadget-pitch 1.0 0.0 0.0 glRotatef ] - [ demo-gadget-yaw 0.0 1.0 0.0 glRotatef ] - tri ; + [ + GL_PROJECTION glMatrixMode + glLoadIdentity + demo-gadget-frustum glFrustum + ] [ + GL_MODELVIEW glMatrixMode + glLoadIdentity + [ >r 0.0 0.0 r> distance>> neg glTranslatef ] + [ pitch>> 1.0 0.0 0.0 glRotatef ] + [ yaw>> 0.0 1.0 0.0 glRotatef ] + tri + ] bi ; : reset-last-drag-rel ( -- ) { 0 0 } last-drag-loc set-global ; @@ -65,11 +77,11 @@ demo-gadget H{ { T{ key-down f f "RIGHT" } [ KEY-ROTATE-STEP swap yaw-demo-gadget ] } { T{ key-down f f "DOWN" } [ KEY-ROTATE-STEP neg swap pitch-demo-gadget ] } { T{ key-down f f "UP" } [ KEY-ROTATE-STEP swap pitch-demo-gadget ] } - { T{ key-down f f "=" } [ KEY-DISTANCE-STEP neg swap zoom-demo-gadget ] } - { T{ key-down f f "-" } [ KEY-DISTANCE-STEP swap zoom-demo-gadget ] } + { T{ key-down f f "=" } [ dup distance-step neg swap zoom-demo-gadget ] } + { T{ key-down f f "-" } [ dup distance-step swap zoom-demo-gadget ] } { T{ button-down f f 1 } [ drop reset-last-drag-rel ] } { T{ drag f 1 } [ drag-yaw-pitch rot [ pitch-demo-gadget ] keep yaw-demo-gadget ] } - { T{ mouse-scroll } [ scroll-direction get second MOUSE-DISTANCE-SCALE * swap zoom-demo-gadget ] } + { T{ mouse-scroll } [ scroll-direction get second over distance-step * swap zoom-demo-gadget ] } } set-gestures diff --git a/extra/opengl/gadgets/gadgets-tests.factor b/extra/opengl/gadgets/gadgets-tests.factor new file mode 100644 index 0000000000..499ec9730a --- /dev/null +++ b/extra/opengl/gadgets/gadgets-tests.factor @@ -0,0 +1,4 @@ +IN: opengl.gadgets.tests +USING: tools.test opengl.gadgets ; + +\ render* must-infer diff --git a/extra/opengl/gadgets/gadgets.factor b/extra/opengl/gadgets/gadgets.factor new file mode 100644 index 0000000000..9e670c04ab --- /dev/null +++ b/extra/opengl/gadgets/gadgets.factor @@ -0,0 +1,112 @@ +! Copyright (C) 2008 Matthew Willis. +! See http://factorcode.org/license.txt for BSD license. +USING: locals math.functions math namespaces +opengl.gl accessors kernel opengl ui.gadgets +fry assocs +destructors sequences ui.render colors ; +IN: opengl.gadgets + +TUPLE: texture-gadget ; + +GENERIC: render* ( gadget -- texture dims ) +GENERIC: cache-key* ( gadget -- key ) + +M: texture-gadget cache-key* ; + +SYMBOL: textures +SYMBOL: refcounts + +: init-cache ( symbol -- ) + dup get [ drop ] [ H{ } clone swap set-global ] if ; + +textures init-cache +refcounts init-cache + +: refcount-change ( gadget quot -- ) + >r cache-key* refcounts get + [ [ 0 ] unless* ] r> compose change-at ; + +TUPLE: cache-entry tex dims ; +C: cache-entry + +: make-entry ( gadget -- entry ) + dup render* + [ swap cache-key* textures get set-at ] keep ; + +: get-entry ( gadget -- {texture,dims} ) + dup cache-key* textures get at + [ nip ] [ make-entry ] if* ; + +: get-dims ( gadget -- dims ) + get-entry dims>> ; + +: get-texture ( gadget -- texture ) + get-entry tex>> ; + +: release-texture ( gadget -- ) + cache-key* textures get delete-at* + [ tex>> delete-texture ] [ drop ] if ; + +M: texture-gadget graft* ( gadget -- ) [ 1+ ] refcount-change ; + +M: texture-gadget ungraft* ( gadget -- ) + dup [ 1- ] refcount-change + dup cache-key* refcounts get at + zero? [ release-texture ] [ drop ] if ; + +: 2^-ceil ( x -- y ) + dup 2 < [ 2 * ] [ 1- log2 1+ 2^ ] if ; foldable flushable + +: 2^-bounds ( dim -- dim' ) + [ 2^-ceil ] map ; foldable flushable + +:: (render-bytes) ( dims bytes format texture -- ) + GL_ENABLE_BIT [ + GL_TEXTURE_2D glEnable + GL_TEXTURE_2D texture glBindTexture + GL_TEXTURE_2D + 0 + GL_RGBA + dims 2^-bounds first2 + 0 + format + GL_UNSIGNED_BYTE + bytes + glTexImage2D + init-texture + GL_TEXTURE_2D 0 glBindTexture + ] do-attribs ; + +: render-bytes ( dims bytes format -- texture ) + gen-texture [ (render-bytes) ] keep ; + +: render-bytes* ( dims bytes format -- texture dims ) + pick >r render-bytes r> ; + +:: four-corners ( dim -- ) + [let* | w [ dim first ] + h [ dim second ] + dim' [ dim dup 2^-bounds [ /f ] 2map ] + w' [ dim' first ] + h' [ dim' second ] | + 0 0 glTexCoord2d 0 0 glVertex2d + 0 h' glTexCoord2d 0 h glVertex2d + w' h' glTexCoord2d w h glVertex2d + w' 0 glTexCoord2d w 0 glVertex2d + ] ; + +M: texture-gadget draw-gadget* ( gadget -- ) + origin get [ + GL_ENABLE_BIT [ + white gl-color + 1.0 -1.0 glPixelZoom + GL_TEXTURE_2D glEnable + GL_TEXTURE_2D over get-texture glBindTexture + GL_QUADS [ + get-dims four-corners + ] do-state + GL_TEXTURE_2D 0 glBindTexture + ] do-attribs + ] with-translation ; + +M: texture-gadget pref-dim* ( gadget -- dim ) get-dims ; diff --git a/extra/opengl/gl/extensions/extensions.factor b/extra/opengl/gl/extensions/extensions.factor index 739ad203a1..8f2eee9459 100644 --- a/extra/opengl/gl/extensions/extensions.factor +++ b/extra/opengl/gl/extensions/extensions.factor @@ -43,6 +43,6 @@ reset-gl-function-number-counter scan drop "}" parse-tokens swap prefix gl-function-number [ gl-function-pointer ] 2curry swap - ";" parse-tokens [ "()" subseq? not ] subset + ";" parse-tokens [ "()" subseq? not ] filter define-indirect ; parsing diff --git a/extra/opengl/opengl-docs.factor b/extra/opengl/opengl-docs.factor index 2788ebdfc2..b168f4cad1 100644 --- a/extra/opengl/opengl-docs.factor +++ b/extra/opengl/opengl-docs.factor @@ -7,7 +7,7 @@ HELP: gl-color { $description "Wrapper for " { $link glColor4d } " taking a color specifier." } ; HELP: gl-error -{ $description "If the most recent OpenGL call resulted in an error, print the error to the " { $link stdio } " stream." } ; +{ $description "If the most recent OpenGL call resulted in an error, print the error to " { $link output-stream } "." } ; HELP: do-state { diff --git a/extra/opengl/opengl.factor b/extra/opengl/opengl.factor index ab9ae38ac1..5fed709253 100755 --- a/extra/opengl/opengl.factor +++ b/extra/opengl/opengl.factor @@ -8,9 +8,11 @@ math.parser opengl.gl opengl.glu combinators arrays sequences splitting words byte-arrays assocs combinators.lib ; IN: opengl -: coordinates [ first2 ] bi@ ; +: coordinates ( point1 point2 -- x1 y2 x2 y2 ) + [ first2 ] bi@ ; -: fix-coordinates [ first2 [ >fixnum ] bi@ ] bi@ ; +: fix-coordinates ( point1 point2 -- x1 y2 x2 y2 ) + [ first2 [ >fixnum ] bi@ ] bi@ ; : gl-color ( color -- ) first4 glColor4d ; inline @@ -73,7 +75,8 @@ MACRO: all-enabled-client-state ( seq quot -- ) >r { 0.5 0.5 } v+ r> { 0.5 0.5 } v- gl-fill-rect GL_FRONT_AND_BACK GL_FILL glPolygonMode ; -: (gl-poly) [ [ gl-vertex ] each ] do-state ; +: (gl-poly) ( points state -- ) + [ [ gl-vertex ] each ] do-state ; : gl-fill-poly ( points -- ) dup length 2 > GL_POLYGON GL_LINES ? (gl-poly) ; @@ -81,13 +84,17 @@ MACRO: all-enabled-client-state ( seq quot -- ) : gl-poly ( points -- ) GL_LINE_LOOP (gl-poly) ; -: circle-steps dup length v/n 2 pi * v*n ; +: circle-steps ( steps -- angles ) + dup length v/n 2 pi * v*n ; -: unit-circle dup [ sin ] map swap [ cos ] map ; +: unit-circle ( angles -- points1 points2 ) + [ [ sin ] map ] [ [ cos ] map ] bi ; -: adjust-points [ [ 1 + 0.5 * ] map ] bi@ ; +: adjust-points ( points1 points2 -- points1' points2' ) + [ [ 1 + 0.5 * ] map ] bi@ ; -: scale-points 2array flip [ v* ] with map [ v+ ] with map ; +: scale-points ( loc dim points1 points2 -- points ) + zip [ v* ] with map [ v+ ] with map ; : circle-points ( loc dim steps -- points ) circle-steps unit-circle adjust-points scale-points ; @@ -154,16 +161,16 @@ MACRO: set-draw-buffers ( buffers -- ) swap glPushAttrib call glPopAttrib ; inline : gl-look-at ( eye focus up -- ) - >r >r first3 r> first3 r> first3 gluLookAt ; + [ first3 ] tri@ gluLookAt ; TUPLE: sprite loc dim dim2 dlist texture ; : ( loc dim dim2 -- sprite ) f f sprite boa ; -: sprite-size2 sprite-dim2 first2 ; +: sprite-size2 ( sprite -- w h ) sprite-dim2 first2 ; -: sprite-width sprite-dim first ; +: sprite-width ( sprite -- w ) sprite-dim first ; : gray-texture ( sprite pixmap -- id ) gen-texture [ @@ -203,9 +210,7 @@ TUPLE: sprite loc dim dim2 dlist texture ; dup sprite-loc gl-translate GL_TEXTURE_2D over sprite-texture glBindTexture init-texture - GL_QUADS [ dup sprite-dim2 four-sides ] do-state - dup sprite-dim { 1 0 } v* - swap sprite-loc v- gl-translate + GL_QUADS [ sprite-dim2 four-sides ] do-state GL_TEXTURE_2D 0 glBindTexture ; : rect-vertices ( lower-left upper-right -- ) diff --git a/extra/openssl/cacert.pem b/extra/openssl/cacert.pem new file mode 100644 index 0000000000..ac4ef14f1d --- /dev/null +++ b/extra/openssl/cacert.pem @@ -0,0 +1,10908 @@ +## +## ca-bundle.crt -- Bundle of CA Root Certificates +## Converted by the service run by Daniel Stenberg +## URL: http://curl.haxx.se/docs/caextract.html +## Converted at: Wed May 21 03:12:09 UTC 2008 +CVS_ID "@(#) $RCSfile: certdata.txt,v $ $Revision: 1.47.2.1 $ $Date: 2008/05/03 03:13:22 $" +## +## This is a bundle of X.509 certificates of public Certificate Authorities +## (CA). These were automatically extracted from Mozilla's root certificates +## file (certdata.txt). This file can be found in the mozilla source tree: +## '/mozilla/security/nss/lib/ckfw/builtins/certdata.txt' +## +## This file was automatically converted and downloaded through the services +## provided by http://curl.haxx.se/docs/caextract.html +## +## +## The contents of this file are subject to the Mozilla Public License Version +## 1.1 (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## http://www.mozilla.org/MPL/ +## +## Software distributed under the License is distributed on an "AS IS" basis, +## WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +## for the specific language governing rights and limitations under the +## License. +## +## The Original Code is the Netscape security libraries. +## +## The Initial Developer of the Original Code is Netscape Communications +## Corporation. Portions created by Netscape are Copyright (C) 1994-2000 +## Netscape Communications Corporation. All Rights Reserved. +## +## Contributor(s): +## +## Alternatively, the contents of this file may be used under the terms of the +## GNU General Public License Version 2 or later (the "GPL"), in which case +## the provisions of the GPL are applicable instead of those above. If you +## wish to allow use of your version of this file only under the terms of the +## GPL and not to allow others to use your version of this file under the MPL, +## indicate your decision by deleting the provisions above and replace them +## with the notice and other provisions required by the GPL. If you do not +## delete the provisions above, a recipient may use your version of this file +## under either the MPL or the GPL. +## + +Verisign/RSA Secure Server CA +============================= + +MD5 Fingerprint=74:7B:82:03:43:F0:00:9E:6B:B3:EC:47:BF:85:A5:93 +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + 02:ad:66:7e:4e:45:fe:5e:57:6f:3c:98:19:5e:dd:c0 + Signature Algorithm: md2WithRSAEncryption + Issuer: C=US, O=RSA Data Security, Inc., OU=Secure Server Certification Authority + Validity + Not Before: Nov 9 00:00:00 1994 GMT + Not After : Jan 7 23:59:59 2010 GMT + Subject: C=US, O=RSA Data Security, Inc., OU=Secure Server Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1000 bit) + Modulus (1000 bit): + 00:92:ce:7a:c1:ae:83:3e:5a:aa:89:83:57:ac:25: + 01:76:0c:ad:ae:8e:2c:37:ce:eb:35:78:64:54:03: + e5:84:40:51:c9:bf:8f:08:e2:8a:82:08:d2:16:86: + 37:55:e9:b1:21:02:ad:76:68:81:9a:05:a2:4b:c9: + 4b:25:66:22:56:6c:88:07:8f:f7:81:59:6d:84:07: + 65:70:13:71:76:3e:9b:77:4c:e3:50:89:56:98:48: + b9:1d:a7:29:1a:13:2e:4a:11:59:9c:1e:15:d5:49: + 54:2c:73:3a:69:82:b1:97:39:9c:6d:70:67:48:e5: + dd:2d:d6:c8:1e:7b + Exponent: 65537 (0x10001) + Signature Algorithm: md2WithRSAEncryption + 65:dd:7e:e1:b2:ec:b0:e2:3a:e0:ec:71:46:9a:19:11:b8:d3: + c7:a0:b4:03:40:26:02:3e:09:9c:e1:12:b3:d1:5a:f6:37:a5: + b7:61:03:b6:5b:16:69:3b:c6:44:08:0c:88:53:0c:6b:97:49: + c7:3e:35:dc:6c:b9:bb:aa:df:5c:bb:3a:2f:93:60:b6:a9:4b: + 4d:f2:20:f7:cd:5f:7f:64:7b:8e:dc:00:5c:d7:fa:77:ca:39: + 16:59:6f:0e:ea:d3:b5:83:7f:4d:4d:42:56:76:b4:c9:5f:04: + f8:38:f8:eb:d2:5f:75:5f:cd:7b:fc:e5:8e:80:7c:fc:50 +-----BEGIN CERTIFICATE----- +MIICNDCCAaECEAKtZn5ORf5eV288mBle3cAwDQYJKoZIhvcNAQECBQAwXzELMAkG +A1UEBhMCVVMxIDAeBgNVBAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMS4wLAYD +VQQLEyVTZWN1cmUgU2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk0 +MTEwOTAwMDAwMFoXDTEwMDEwNzIzNTk1OVowXzELMAkGA1UEBhMCVVMxIDAeBgNV +BAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMS4wLAYDVQQLEyVTZWN1cmUgU2Vy +dmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGbMA0GCSqGSIb3DQEBAQUAA4GJ +ADCBhQJ+AJLOesGugz5aqomDV6wlAXYMra6OLDfO6zV4ZFQD5YRAUcm/jwjiioII +0haGN1XpsSECrXZogZoFokvJSyVmIlZsiAeP94FZbYQHZXATcXY+m3dM41CJVphI +uR2nKRoTLkoRWZweFdVJVCxzOmmCsZc5nG1wZ0jl3S3WyB57AgMBAAEwDQYJKoZI +hvcNAQECBQADfgBl3X7hsuyw4jrg7HFGmhkRuNPHoLQDQCYCPgmc4RKz0Vr2N6W3 +YQO2WxZpO8ZECAyIUwxrl0nHPjXcbLm7qt9cuzovk2C2qUtN8iD3zV9/ZHuO3ABc +1/p3yjkWWW8O6tO1g39NTUJWdrTJXwT4OPjr0l91X817/OWOgHz8UA== +-----END CERTIFICATE----- + +ABAecom (sub., Am. Bankers Assn.) Root CA +========================================= + +MD5 Fingerprint=41:B8:07:F7:A8:D1:09:EE:B4:9A:8E:70:4D:FC:1B:78 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + d0:1e:40:90:00:00:46:52:00:00:00:01:00:00:00:04 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=DC, L=Washington, O=ABA.ECOM, INC., CN=ABA.ECOM Root CA/emailAddress=admin@digsigtrust.com + Validity + Not Before: Jul 12 17:33:53 1999 GMT + Not After : Jul 9 17:33:53 2009 GMT + Subject: C=US, ST=DC, L=Washington, O=ABA.ECOM, INC., CN=ABA.ECOM Root CA/emailAddress=admin@digsigtrust.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b1:d3:11:e0:79:55:43:07:08:4c:cb:05:42:00: + e2:0d:83:46:3d:e4:93:ba:b6:06:d3:0d:59:bd:3e: + c1:ce:43:67:01:8a:21:a8:ef:bc:cc:d0:a2:cc:b0: + 55:96:53:84:66:05:00:da:44:49:80:d8:54:0a:a5: + 25:86:94:ed:63:56:ff:70:6c:a3:a1:19:d2:78:be: + 68:2a:44:5e:2f:cf:cc:18:5e:47:bc:3a:b1:46:3d: + 1e:f0:b9:2c:34:5f:8c:7c:4c:08:29:9d:40:55:eb: + 3c:7d:83:de:b5:f0:f7:8a:83:0e:a1:4c:b4:3a:a5: + b3:5f:5a:22:97:ec:19:9b:c1:05:68:fd:e6:b7:a9: + 91:94:2c:e4:78:48:24:1a:25:19:3a:eb:95:9c:39: + 0a:8a:cf:42:b2:f0:1c:d5:5f:fb:6b:ed:68:56:7b: + 39:2c:72:38:b0:ee:93:a9:d3:7b:77:3c:eb:71:03: + a9:38:4a:16:6c:89:2a:ca:da:33:13:79:c2:55:8c: + ed:9c:bb:f2:cb:5b:10:f8:2e:61:35:c6:29:4c:2a: + d0:2a:63:d1:65:59:b4:f8:cd:f9:f4:00:84:b6:57: + 42:85:9d:32:a8:f9:2a:54:fb:ff:78:41:bc:bd:71: + 28:f4:bb:90:bc:ff:96:34:04:e3:45:9e:a1:46:28: + 40:81 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE, pathlen:8 + Signature Algorithm: sha1WithRSAEncryption + 04:6f:25:86:e4:e6:96:27:b4:d9:42:c0:d0:c9:00:b1:7f:54: + 3e:87:b2:6d:24:a9:2f:0a:7e:fd:a4:44:b0:f8:54:07:bd:1b: + 9d:9d:ca:7b:50:24:7b:11:5b:49:a3:a6:bf:12:74:d5:89:b7: + b7:2f:98:64:25:14:b7:61:e9:7f:60:80:6b:d3:64:e8:ab:bd: + 1a:d6:51:fa:c0:b4:5d:77:1a:7f:64:08:5e:79:c6:05:4c:f1: + 7a:dd:4d:7d:ce:e6:48:7b:54:d2:61:92:81:d6:1b:d6:00:f0: + 0e:9e:28:77:a0:4d:88:c7:22:76:19:c3:c7:9e:1b:a6:77:78: + f8:5f:9b:56:d1:f0:f2:17:ac:8e:9d:59:e6:1f:fe:57:b6:d9: + 5e:e1:5d:9f:45:ec:61:68:19:41:e1:b2:20:26:fe:5a:30:76: + 24:ff:40:72:3c:79:9f:7c:22:48:ab:46:cd:db:b3:86:2c:8f: + bf:05:41:d3:c1:e3:14:e3:41:17:26:d0:7c:a7:71:4c:19:e8: + 4a:0f:72:58:31:7d:ec:60:7a:a3:22:28:bd:19:24:60:3f:3b: + 87:73:c0:6b:e4:cb:ae:b7:ab:25:43:b2:55:2d:7b:ab:06:0e: + 75:5d:34:e5:5d:73:6d:9e:b2:75:40:a5:59:c9:4f:31:71:88: + d9:88:7f:54 +-----BEGIN CERTIFICATE----- +MIIDtTCCAp2gAwIBAgIRANAeQJAAAEZSAAAAAQAAAAQwDQYJKoZIhvcNAQEFBQAw +gYkxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJEQzETMBEGA1UEBxMKV2FzaGluZ3Rv +bjEXMBUGA1UEChMOQUJBLkVDT00sIElOQy4xGTAXBgNVBAMTEEFCQS5FQ09NIFJv +b3QgQ0ExJDAiBgkqhkiG9w0BCQEWFWFkbWluQGRpZ3NpZ3RydXN0LmNvbTAeFw05 +OTA3MTIxNzMzNTNaFw0wOTA3MDkxNzMzNTNaMIGJMQswCQYDVQQGEwJVUzELMAkG +A1UECBMCREMxEzARBgNVBAcTCldhc2hpbmd0b24xFzAVBgNVBAoTDkFCQS5FQ09N +LCBJTkMuMRkwFwYDVQQDExBBQkEuRUNPTSBSb290IENBMSQwIgYJKoZIhvcNAQkB +FhVhZG1pbkBkaWdzaWd0cnVzdC5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw +ggEKAoIBAQCx0xHgeVVDBwhMywVCAOINg0Y95JO6tgbTDVm9PsHOQ2cBiiGo77zM +0KLMsFWWU4RmBQDaREmA2FQKpSWGlO1jVv9wbKOhGdJ4vmgqRF4vz8wYXke8OrFG +PR7wuSw0X4x8TAgpnUBV6zx9g9618PeKgw6hTLQ6pbNfWiKX7BmbwQVo/ea3qZGU +LOR4SCQaJRk665WcOQqKz0Ky8BzVX/tr7WhWezkscjiw7pOp03t3POtxA6k4ShZs +iSrK2jMTecJVjO2cu/LLWxD4LmE1xilMKtAqY9FlWbT4zfn0AIS2V0KFnTKo+SpU ++/94Qby9cSj0u5C8/5Y0BONFnqFGKECBAgMBAAGjFjAUMBIGA1UdEwEB/wQIMAYB +Af8CAQgwDQYJKoZIhvcNAQEFBQADggEBAARvJYbk5pYntNlCwNDJALF/VD6Hsm0k +qS8Kfv2kRLD4VAe9G52dyntQJHsRW0mjpr8SdNWJt7cvmGQlFLdh6X9ggGvTZOir +vRrWUfrAtF13Gn9kCF55xgVM8XrdTX3O5kh7VNJhkoHWG9YA8A6eKHegTYjHInYZ +w8eeG6Z3ePhfm1bR8PIXrI6dWeYf/le22V7hXZ9F7GFoGUHhsiAm/lowdiT/QHI8 +eZ98IkirRs3bs4Ysj78FQdPB4xTjQRcm0HyncUwZ6EoPclgxfexgeqMiKL0ZJGA/ +O4dzwGvky663qyVDslUte6sGDnVdNOVdc22esnVApVnJTzFxiNmIf1Q= +-----END CERTIFICATE----- + +StartCom Certification Authority +================================ + +MD5 Fingerprint=22:4D:8F:8A:FC:F7:35:C2:BB:57:34:90:7B:8B:22:16 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=IL, O=StartCom Ltd., OU=Secure Digital Certificate Signing, CN=StartCom Certification Authority + Validity + Not Before: Sep 17 19:46:36 2006 GMT + Not After : Sep 17 19:46:36 2036 GMT + Subject: C=IL, O=StartCom Ltd., OU=Secure Digital Certificate Signing, CN=StartCom Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (4096 bit) + Modulus (4096 bit): + 00:c1:88:db:09:bc:6c:46:7c:78:9f:95:7b:b5:33: + 90:f2:72:62:d6:c1:36:20:22:24:5e:ce:e9:77:f2: + 43:0a:a2:06:64:a4:cc:8e:36:f8:38:e6:23:f0:6e: + 6d:b1:3c:dd:72:a3:85:1c:a1:d3:3d:b4:33:2b:d3: + 2f:af:fe:ea:b0:41:59:67:b6:c4:06:7d:0a:9e:74: + 85:d6:79:4c:80:37:7a:df:39:05:52:59:f7:f4:1b: + 46:43:a4:d2:85:85:d2:c3:71:f3:75:62:34:ba:2c: + 8a:7f:1e:8f:ee:ed:34:d0:11:c7:96:cd:52:3d:ba: + 33:d6:dd:4d:de:0b:3b:4a:4b:9f:c2:26:2f:fa:b5: + 16:1c:72:35:77:ca:3c:5d:e6:ca:e1:26:8b:1a:36: + 76:5c:01:db:74:14:25:fe:ed:b5:a0:88:0f:dd:78: + ca:2d:1f:07:97:30:01:2d:72:79:fa:46:d6:13:2a: + a8:b9:a6:ab:83:49:1d:e5:f2:ef:dd:e4:01:8e:18: + 0a:8f:63:53:16:85:62:a9:0e:19:3a:cc:b5:66:a6: + c2:6b:74:07:e4:2b:e1:76:3e:b4:6d:d8:f6:44:e1: + 73:62:1f:3b:c4:be:a0:53:56:25:6c:51:09:f7:aa: + ab:ca:bf:76:fd:6d:9b:f3:9d:db:bf:3d:66:bc:0c: + 56:aa:af:98:48:95:3a:4b:df:a7:58:50:d9:38:75: + a9:5b:ea:43:0c:02:ff:99:eb:e8:6c:4d:70:5b:29: + 65:9c:dd:aa:5d:cc:af:01:31:ec:0c:eb:d2:8d:e8: + ea:9c:7b:e6:6e:f7:27:66:0c:1a:48:d7:6e:42:e3: + 3f:de:21:3e:7b:e1:0d:70:fb:63:aa:a8:6c:1a:54: + b4:5c:25:7a:c9:a2:c9:8b:16:a6:bb:2c:7e:17:5e: + 05:4d:58:6e:12:1d:01:ee:12:10:0d:c6:32:7f:18: + ff:fc:f4:fa:cd:6e:91:e8:36:49:be:1a:48:69:8b: + c2:96:4d:1a:12:b2:69:17:c1:0a:90:d6:fa:79:22: + 48:bf:ba:7b:69:f8:70:c7:fa:7a:37:d8:d8:0d:d2: + 76:4f:57:ff:90:b7:e3:91:d2:dd:ef:c2:60:b7:67: + 3a:dd:fe:aa:9c:f0:d4:8b:7f:72:22:ce:c6:9f:97: + b6:f8:af:8a:a0:10:a8:d9:fb:18:c6:b6:b5:5c:52: + 3c:89:b6:19:2a:73:01:0a:0f:03:b3:12:60:f2:7a: + 2f:81:db:a3:6e:ff:26:30:97:f5:8b:dd:89:57:b6: + ad:3d:b3:af:2b:c5:b7:76:02:f0:a5:d6:2b:9a:86: + 14:2a:72:f6:e3:33:8c:5d:09:4b:13:df:bb:8c:74: + 13:52:4b + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:TRUE + X509v3 Key Usage: + Digital Signature, Key Encipherment, Key Agreement, Certificate Sign, CRL Sign + X509v3 Subject Key Identifier: + 4E:0B:EF:1A:A4:40:5B:A5:17:69:87:30:CA:34:68:43:D0:41:AE:F2 + X509v3 CRL Distribution Points: + URI:http://cert.startcom.org/sfsca-crl.crl + URI:http://crl.startcom.org/sfsca-crl.crl + + X509v3 Certificate Policies: + Policy: 1.3.6.1.4.1.23223.1.1.1 + CPS: http://cert.startcom.org/policy.pdf + CPS: http://cert.startcom.org/intermediate.pdf + User Notice: + Organization: Start Commercial (StartCom) Ltd. + Number: 1 + Explicit Text: Limited Liability, read the section *Legal Limitations* of the StartCom Certification Authority Policy available at http://cert.startcom.org/policy.pdf + + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + Netscape Comment: + StartCom Free SSL Certification Authority + Signature Algorithm: sha1WithRSAEncryption + 16:6c:99:f4:66:0c:34:f5:d0:85:5e:7d:0a:ec:da:10:4e:38: + 1c:5e:df:a6:25:05:4b:91:32:c1:e8:3b:f1:3d:dd:44:09:5b: + 07:49:8a:29:cb:66:02:b7:b1:9a:f7:25:98:09:3c:8e:1b:e1: + dd:36:87:2b:4b:bb:68:d3:39:66:3d:a0:26:c7:f2:39:91:1d: + 51:ab:82:7b:7e:d5:ce:5a:e4:e2:03:57:70:69:97:08:f9:5e: + 58:a6:0a:df:8c:06:9a:45:16:16:38:0a:5e:57:f6:62:c7:7a: + 02:05:e6:bc:1e:b5:f2:9e:f4:a9:29:83:f8:b2:14:e3:6e:28: + 87:44:c3:90:1a:de:38:a9:3c:ac:43:4d:64:45:ce:dd:28:a9: + 5c:f2:73:7b:04:f8:17:e8:ab:b1:f3:2e:5c:64:6e:73:31:3a: + 12:b8:bc:b3:11:e4:7d:8f:81:51:9a:3b:8d:89:f4:4d:93:66: + 7b:3c:03:ed:d3:9a:1d:9a:f3:65:50:f5:a0:d0:75:9f:2f:af: + f0:ea:82:43:98:f8:69:9c:89:79:c4:43:8e:46:72:e3:64:36: + 12:af:f7:25:1e:38:89:90:77:7e:c3:6b:6a:b9:c3:cb:44:4b: + ac:78:90:8b:e7:c7:2c:1e:4b:11:44:c8:34:52:27:cd:0a:5d: + 9f:85:c1:89:d5:1a:78:f2:95:10:53:32:dd:80:84:66:75:d9: + b5:68:28:fb:61:2e:be:84:a8:38:c0:99:12:86:a5:1e:67:64: + ad:06:2e:2f:a9:70:85:c7:96:0f:7c:89:65:f5:8e:43:54:0e: + ab:dd:a5:80:39:94:60:c0:34:c9:96:70:2c:a3:12:f5:1f:48: + 7b:bd:1c:7e:6b:b7:9d:90:f4:22:3b:ae:f8:fc:2a:ca:fa:82: + 52:a0:ef:af:4b:55:93:eb:c1:b5:f0:22:8b:ac:34:4e:26:22: + 04:a1:87:2c:75:4a:b7:e5:7d:13:d7:b8:0c:64:c0:36:d2:c9: + 2f:86:12:8c:23:09:c1:1b:82:3b:73:49:a3:6a:57:87:94:e5: + d6:78:c5:99:43:63:e3:4d:e0:77:2d:e1:65:99:72:69:04:1a: + 47:09:e6:0f:01:56:24:fb:1f:bf:0e:79:a9:58:2e:b9:c4:09: + 01:7e:95:ba:6d:00:06:3e:b2:ea:4a:10:39:d8:d0:2b:f5:bf: + ec:75:bf:97:02:c5:09:1b:08:dc:55:37:e2:81:fb:37:84:43: + 62:20:ca:e7:56:4b:65:ea:fe:6c:c1:24:93:24:a1:34:eb:05: + ff:9a:22:ae:9b:7d:3f:f1:65:51:0a:a6:30:6a:b3:f4:88:1c: + 80:0d:fc:72:8a:e8:83:5e +-----BEGIN CERTIFICATE----- +MIIHyTCCBbGgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEW +MBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwg +Q2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0NjM2WhcNMzYwOTE3MTk0NjM2WjB9 +MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMi +U2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3Rh +cnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUA +A4ICDwAwggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZk +pMyONvg45iPwbm2xPN1yo4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rf +OQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/C +Ji/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/deMotHweXMAEtcnn6RtYT +Kqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt2PZE4XNi +HzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMM +Av+Z6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w ++2OqqGwaVLRcJXrJosmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+ +Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3 +Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVcUjyJthkqcwEKDwOzEmDyei+B +26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT37uMdBNSSwID +AQABo4ICUjCCAk4wDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAa4wHQYDVR0OBBYE +FE4L7xqkQFulF2mHMMo0aEPQQa7yMGQGA1UdHwRdMFswLKAqoCiGJmh0dHA6Ly9j +ZXJ0LnN0YXJ0Y29tLm9yZy9zZnNjYS1jcmwuY3JsMCugKaAnhiVodHRwOi8vY3Js +LnN0YXJ0Y29tLm9yZy9zZnNjYS1jcmwuY3JsMIIBXQYDVR0gBIIBVDCCAVAwggFM +BgsrBgEEAYG1NwEBATCCATswLwYIKwYBBQUHAgEWI2h0dHA6Ly9jZXJ0LnN0YXJ0 +Y29tLm9yZy9wb2xpY3kucGRmMDUGCCsGAQUFBwIBFilodHRwOi8vY2VydC5zdGFy +dGNvbS5vcmcvaW50ZXJtZWRpYXRlLnBkZjCB0AYIKwYBBQUHAgIwgcMwJxYgU3Rh +cnQgQ29tbWVyY2lhbCAoU3RhcnRDb20pIEx0ZC4wAwIBARqBl0xpbWl0ZWQgTGlh +YmlsaXR5LCByZWFkIHRoZSBzZWN0aW9uICpMZWdhbCBMaW1pdGF0aW9ucyogb2Yg +dGhlIFN0YXJ0Q29tIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFBvbGljeSBhdmFp +bGFibGUgYXQgaHR0cDovL2NlcnQuc3RhcnRjb20ub3JnL3BvbGljeS5wZGYwEQYJ +YIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilTdGFydENvbSBGcmVlIFNT +TCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQUFAAOCAgEAFmyZ +9GYMNPXQhV59CuzaEE44HF7fpiUFS5Eyweg78T3dRAlbB0mKKctmArexmvclmAk8 +jhvh3TaHK0u7aNM5Zj2gJsfyOZEdUauCe37Vzlrk4gNXcGmXCPleWKYK34wGmkUW +FjgKXlf2Ysd6AgXmvB618p70qSmD+LIU424oh0TDkBreOKk8rENNZEXO3SipXPJz +ewT4F+irsfMuXGRuczE6Eri8sxHkfY+BUZo7jYn0TZNmezwD7dOaHZrzZVD1oNB1 +ny+v8OqCQ5j4aZyJecRDjkZy42Q2Eq/3JR44iZB3fsNrarnDy0RLrHiQi+fHLB5L +EUTINFInzQpdn4XBidUaePKVEFMy3YCEZnXZtWgo+2EuvoSoOMCZEoalHmdkrQYu +L6lwhceWD3yJZfWOQ1QOq92lgDmUYMA0yZZwLKMS9R9Ie70cfmu3nZD0Ijuu+Pwq +yvqCUqDvr0tVk+vBtfAii6w0TiYiBKGHLHVKt+V9E9e4DGTANtLJL4YSjCMJwRuC +O3NJo2pXh5Tl1njFmUNj403gdy3hZZlyaQQaRwnmDwFWJPsfvw55qVguucQJAX6V +um0ABj6y6koQOdjQK/W/7HW/lwLFCRsI3FU34oH7N4RDYiDK51ZLZer+bMEkkySh +NOsF/5oirpt9P/FlUQqmMGqz9IgcgA38corog14= +-----END CERTIFICATE----- + +Taiwan GRCA +=========== + +MD5 Fingerprint=37:85:44:53:32:45:1F:20:F0:F3:95:E1:25:C4:43:4E +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 1f:9d:59:5a:d7:2f:c2:06:44:a5:80:08:69:e3:5e:f6 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=TW, O=Government Root Certification Authority + Validity + Not Before: Dec 5 13:23:33 2002 GMT + Not After : Dec 5 13:23:33 2032 GMT + Subject: C=TW, O=Government Root Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (4096 bit) + Modulus (4096 bit): + 00:9a:25:b8:ec:cc:a2:75:a8:7b:f7:ce:5b:59:8a: + c9:d1:86:12:08:54:ec:9c:f2:e7:46:f6:88:f3:7c: + e9:a5:df:4c:47:36:a4:1b:01:1c:7f:1e:57:8a:8d: + c3:c5:d1:21:e3:da:24:3f:48:2b:fb:9f:2e:a1:94: + e7:2c:1c:93:d1:bf:1b:01:87:53:99:ce:a7:f5:0a: + 21:76:77:ff:a9:b7:c6:73:94:4f:46:f7:10:49:37: + fa:a8:59:49:5d:6a:81:07:56:f2:8a:f9:06:d0:f7: + 70:22:4d:b4:b7:41:b9:32:b8:b1:f0:b1:c3:9c:3f: + 70:fd:53:dd:81:aa:d8:63:78:f6:d8:53:6e:a1:ac: + 6a:84:24:72:54:86:c6:d2:b2:ca:1c:0e:79:81:d6: + b5:70:62:08:01:2e:4e:4f:0e:d5:11:af:a9:af:e5: + 9a:bf:dc:cc:87:6d:26:e4:c9:57:a2:fb:96:f9:cc: + e1:3f:53:8c:6c:4c:7e:9b:53:08:0b:6c:17:fb:67: + c8:c2:ad:b1:cd:80:b4:97:dc:76:01:16:15:e9:6a: + d7:a4:e1:78:47:ce:86:d5:fb:31:f3:fa:31:be:34: + aa:28:fb:70:4c:1d:49:c7:af:2c:9d:6d:66:a6:b6: + 8d:64:7e:b5:20:6a:9d:3b:81:b6:8f:40:00:67:4b: + 89:86:b8:cc:65:fe:15:53:e9:04:c1:d6:5f:1d:44: + d7:0a:2f:27:9a:46:7d:a1:0d:75:ad:54:86:15:dc: + 49:3b:f1:96:ce:0f:9b:a0:ec:a3:7a:5d:be:d5:2a: + 75:42:e5:7b:de:a5:b6:aa:af:28:ac:ac:90:ac:38: + b7:d5:68:35:26:7a:dc:f7:3b:f3:fd:45:9b:d1:bb: + 43:78:6e:6f:f1:42:54:6a:98:f0:0d:ad:97:e9:52: + 5e:e9:d5:6a:72:de:6a:f7:1b:60:14:f4:a5:e4:b6: + 71:67:aa:1f:ea:e2:4d:c1:42:40:fe:67:46:17:38: + 2f:47:3f:71:9c:ae:e5:21:ca:61:2d:6d:07:a8:84: + 7c:2d:ee:51:25:f1:63:90:9e:fd:e1:57:88:6b:ef: + 8a:23:6d:b1:e6:bd:3f:ad:d1:3d:96:0b:85:8d:cd: + 6b:27:bb:b7:05:9b:ec:bb:91:a9:0a:07:12:02:97: + 4e:20:90:f0:ff:0d:1e:e2:41:3b:d3:40:3a:e7:8d: + 5d:da:66:e4:02:b0:07:52:98:5c:0e:8e:33:9c:c2: + a6:95:fb:55:19:6e:4c:8e:ae:4b:0f:bd:c1:38:4d: + 5e:8f:84:1d:66:cd:c5:60:96:b4:52:5a:05:89:8e: + 95:7a:98:c1:91:3c:95:23:b2:0e:f4:79:b4:c9:7c: + c1:4a:21 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + CC:CC:EF:CC:29:60:A4:3B:B1:92:B6:3C:FA:32:62:8F:AC:25:15:3B + X509v3 Basic Constraints: + CA:TRUE + setCext-hashedRoot: + 0/0-...0...+......0...g*........"...(6....2.1:.Qe + Signature Algorithm: sha1WithRSAEncryption + 40:80:4a:fa:26:c9:ce:5e:30:dd:4f:86:74:76:58:f5:ae:b3: + 83:33:78:a4:7a:74:17:19:4e:e9:52:b5:b9:e0:0a:74:62:aa: + 68:ca:78:a0:4c:9a:8e:2c:23:2e:d5:6a:12:24:bf:d4:68:d3: + 8a:d0:d8:9c:9f:b4:1f:0c:de:38:7e:57:38:fc:8d:e2:4f:5e: + 0c:9f:ab:3b:d2:ff:75:97:cb:a4:e3:67:08:ff:e5:c0:16:b5: + 48:01:7d:e9:f9:0a:ff:1b:e5:6a:69:bf:78:21:a8:c2:a7:23: + a9:86:ab:76:56:e8:0e:0c:f6:13:dd:2a:66:8a:64:49:3d:1a: + 18:87:90:04:9f:42:52:b7:4f:cb:fe:47:41:76:35:ef:ff:00: + 76:36:45:32:9b:c6:46:85:5d:e2:24:b0:1e:e3:48:96:98:57: + 47:94:55:7a:0f:41:b1:44:24:f3:c1:fe:1a:6b:bf:88:fd:c1: + a6:da:93:60:5e:81:4a:99:20:9c:48:66:19:b5:00:79:54:0f: + b8:2c:2f:4b:bc:a9:5d:5b:60:7f:8c:87:a5:e0:52:63:2a:be: + d8:3b:85:40:15:fe:1e:b6:65:3f:c5:4b:da:7e:b5:7a:35:29: + a3:2e:7a:98:60:22:a3:f4:7d:27:4e:2d:ea:b4:74:3c:e9:0f: + a4:33:0f:10:11:bc:13:01:d6:e5:0e:d3:bf:b5:12:a2:e1:45: + 23:c0:cc:08:6e:61:b7:89:ab:83:e3:24:1e:e6:5d:07:e7:1f: + 20:3e:cf:67:c8:e7:ac:30:6d:27:4b:68:6e:4b:2a:5c:02:08: + 34:db:f8:76:e4:67:a3:26:9c:3f:a2:32:c2:4a:c5:81:18:31: + 10:56:aa:84:ef:2d:0a:ff:b8:1f:77:d2:bf:a5:58:a0:62:e4: + d7:4b:91:75:8d:89:80:98:7e:6d:cb:53:4e:5e:af:f6:b2:97: + 85:97:b9:da:55:06:b9:24:ee:d7:c6:38:1e:63:1b:12:3b:95: + e1:58:ac:f2:df:84:d5:5f:99:2f:0d:55:5b:e6:38:db:2e:3f: + 72:e9:48:85:cb:bb:29:13:8f:1e:38:55:b9:f3:b2:c4:30:99: + 23:4e:5d:f2:48:a1:12:0c:dc:12:90:09:90:54:91:03:3c:47: + e5:d5:c9:65:e0:b7:4b:7d:ec:47:d3:b3:0b:3e:ad:9e:d0:74: + 00:0e:eb:bd:51:ad:c0:de:2c:c0:c3:6a:fe:ef:dc:0b:a7:fa: + 46:df:60:db:9c:a6:59:50:75:23:69:73:93:b2:f9:fc:02:d3: + 47:e6:71:ce:10:02:ee:27:8c:84:ff:ac:45:0d:13:5c:83:32: + e0:25:a5:86:2c:7c:f4:12 +-----BEGIN CERTIFICATE----- +MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/ +MQswCQYDVQQGEwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5MB4XDTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1ow +PzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dvdmVybm1lbnQgUm9vdCBDZXJ0aWZp +Y2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIB +AJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qNw8XR +IePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1q +gQdW8or5BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKy +yhwOeYHWtXBiCAEuTk8O1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAts +F/tnyMKtsc2AtJfcdgEWFelq16TheEfOhtX7MfP6Mb40qij7cEwdScevLJ1tZqa2 +jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wovJ5pGfaENda1UhhXcSTvx +ls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7Q3hub/FC +VGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHK +YS1tB6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoH +EgKXTiCQ8P8NHuJBO9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThN +Xo+EHWbNxWCWtFJaBYmOlXqYwZE8lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1Ud +DgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNVHRMEBTADAQH/MDkGBGcqBwAE +MTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg209yewDL7MTqK +UWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ +TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyf +qzvS/3WXy6TjZwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaK +ZEk9GhiHkASfQlK3T8v+R0F2Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFE +JPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlUD7gsL0u8qV1bYH+Mh6XgUmMqvtg7 +hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6QzDxARvBMB1uUO07+1 +EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+HbkZ6Mm +nD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WX +udpVBrkk7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44Vbnz +ssQwmSNOXfJIoRIM3BKQCZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDe +LMDDav7v3Aun+kbfYNucpllQdSNpc5Oy+fwC00fmcc4QAu4njIT/rEUNE1yDMuAl +pYYsfPQS +-----END CERTIFICATE----- + +Firmaprofesional Root CA +======================== + +MD5 Fingerprint=11:92:79:40:3C:B1:83:40:E5:AB:66:4A:67:92:80:DF +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=ES, L=C/ Muntaner 244 Barcelona, CN=Autoridad de Certificacion Firmaprofesional CIF A62634068/emailAddress=ca@firmaprofesional.com + Validity + Not Before: Oct 24 22:00:00 2001 GMT + Not After : Oct 24 22:00:00 2013 GMT + Subject: C=ES, L=C/ Muntaner 244 Barcelona, CN=Autoridad de Certificacion Firmaprofesional CIF A62634068/emailAddress=ca@firmaprofesional.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:e7:23:03:6f:6f:23:a5:5e:78:ce:95:2c:ed:94: + 1e:6e:0a:9e:01:c7:ea:30:d1:2c:9d:dd:37:e8:9b: + 98:79:56:d3:fc:73:df:d0:8a:de:55:8f:51:f9:5a: + ea:de:b5:70:c4:ed:a4:ed:ff:a3:0d:6e:0f:64:50: + 31:af:01:27:58:ae:fe:6c:a7:4a:2f:17:2d:d3:73: + d5:13:1c:8f:59:a5:34:2c:1d:54:04:45:cd:68:b8: + a0:c0:03:a5:cf:85:42:47:95:28:5b:cf:ef:80:6c: + e0:90:97:8a:01:3c:1d:f3:87:10:30:26:48:7d:d7: + fc:e9:9d:91:71:ff:41:9a:a9:40:b5:37:9c:29:20: + 4f:1f:52:e3:a0:7d:13:6d:54:b7:0a:de:e9:6a:4e: + 07:ac:ac:19:5f:dc:7e:62:74:f6:b2:05:00:ba:85: + a0:fd:1d:38:6e:cb:5a:bb:86:bc:94:67:33:35:83: + 2c:1f:23:cd:f8:c8:91:71:cc:97:8b:ef:ae:0f:dc: + 29:03:1b:c0:39:eb:70:ed:c1:6e:0e:d8:67:0b:89: + a9:bc:35:e4:ef:b6:34:b4:a5:b6:c4:2d:a5:be:d0: + c3:94:24:48:db:df:96:d3:00:b5:66:1a:8b:66:05: + 0f:dd:3f:3f:cb:3f:aa:5e:9a:4a:f8:b4:4a:ef:95: + 37:1b + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Alternative Name: + URI:http://www.firmaprofesional.com + X509v3 Basic Constraints: critical + CA:TRUE, pathlen:1 + X509v3 Private Key Usage Period: + Not Before: Oct 24 22:00:00 2001 GMT, Not After: Oct 24 22:00:00 2013 GMT + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Subject Key Identifier: + 33:0B:A0:66:D1:EA:DA:CE:DE:62:93:04:28:52:B5:14:7F:38:68:B7 + Signature Algorithm: sha1WithRSAEncryption + 47:73:fe:8d:27:54:f0:f5:d4:77:9c:27:79:57:57:b7:15:56: + ec:c7:d8:58:b7:01:02:f4:33:ed:93:50:88:9e:7c:46:b1:bd: + 3f:14:6f:f1:b3:47:48:8b:8c:97:06:d7:ea:7e:a3:5c:2a:bb: + 4d:2f:47:e2:f8:39:06:c9:9c:2e:31:1a:03:78:f4:bc:38:c6: + 22:8b:33:31:f0:16:04:04:7d:f9:76:e4:4b:d7:c0:e6:83:ec: + 59:cc:3f:de:ff:4f:6b:b7:67:7e:a6:86:81:32:23:03:9d:c8: + f7:5f:c1:4a:60:a5:92:a9:b1:a4:a0:60:c3:78:87:b3:22:f3: + 2a:eb:5b:a9:ed:05:ab:37:0f:b1:e2:d3:95:76:63:56:74:8c: + 58:72:1b:37:e5:64:a1:be:4d:0c:93:98:0c:97:f6:87:6d:b3: + 3f:e7:cb:80:a6:ed:88:c7:5f:50:62:02:e8:99:74:16:d0:e6: + b4:39:f1:27:cb:c8:40:d6:e3:86:10:a9:23:12:92:e0:69:41: + 63:a7:af:25:0b:c0:c5:92:cb:1e:98:a3:5a:ba:c5:33:0f:a0: + 97:01:dd:7f:e0:7b:d6:06:54:cf:a1:e2:4d:38:eb:4b:50:b5: + cb:26:f4:ca:da:70:4a:6a:a1:e2:79:aa:e1:a7:33:f6:fd:4a: + 1f:f6:d9:60 +-----BEGIN CERTIFICATE----- +MIIEVzCCAz+gAwIBAgIBATANBgkqhkiG9w0BAQUFADCBnTELMAkGA1UEBhMCRVMx +IjAgBgNVBAcTGUMvIE11bnRhbmVyIDI0NCBCYXJjZWxvbmExQjBABgNVBAMTOUF1 +dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2 +MjYzNDA2ODEmMCQGCSqGSIb3DQEJARYXY2FAZmlybWFwcm9mZXNpb25hbC5jb20w +HhcNMDExMDI0MjIwMDAwWhcNMTMxMDI0MjIwMDAwWjCBnTELMAkGA1UEBhMCRVMx +IjAgBgNVBAcTGUMvIE11bnRhbmVyIDI0NCBCYXJjZWxvbmExQjBABgNVBAMTOUF1 +dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2 +MjYzNDA2ODEmMCQGCSqGSIb3DQEJARYXY2FAZmlybWFwcm9mZXNpb25hbC5jb20w +ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDnIwNvbyOlXnjOlSztlB5u +Cp4Bx+ow0Syd3Tfom5h5VtP8c9/Qit5Vj1H5WuretXDE7aTt/6MNbg9kUDGvASdY +rv5sp0ovFy3Tc9UTHI9ZpTQsHVQERc1ouKDAA6XPhUJHlShbz++AbOCQl4oBPB3z +hxAwJkh91/zpnZFx/0GaqUC1N5wpIE8fUuOgfRNtVLcK3ulqTgesrBlf3H5idPay +BQC6haD9HThuy1q7hryUZzM1gywfI834yJFxzJeL764P3CkDG8A563DtwW4O2GcL +iam8NeTvtjS0pbbELaW+0MOUJEjb35bTALVmGotmBQ/dPz/LP6pemkr4tErvlTcb +AgMBAAGjgZ8wgZwwKgYDVR0RBCMwIYYfaHR0cDovL3d3dy5maXJtYXByb2Zlc2lv +bmFsLmNvbTASBgNVHRMBAf8ECDAGAQH/AgEBMCsGA1UdEAQkMCKADzIwMDExMDI0 +MjIwMDAwWoEPMjAxMzEwMjQyMjAwMDBaMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4E +FgQUMwugZtHq2s7eYpMEKFK1FH84aLcwDQYJKoZIhvcNAQEFBQADggEBAEdz/o0n +VPD11HecJ3lXV7cVVuzH2Fi3AQL0M+2TUIiefEaxvT8Ub/GzR0iLjJcG1+p+o1wq +u00vR+L4OQbJnC4xGgN49Lw4xiKLMzHwFgQEffl25EvXwOaD7FnMP97/T2u3Z36m +hoEyIwOdyPdfwUpgpZKpsaSgYMN4h7Mi8yrrW6ntBas3D7Hi05V2Y1Z0jFhyGzfl +ZKG+TQyTmAyX9odtsz/ny4Cm7YjHX1BiAuiZdBbQ5rQ58SfLyEDW44YQqSMSkuBp +QWOnryULwMWSyx6Yo1q6xTMPoJcB3X/ge9YGVM+h4k0460tQtcsm9MracEpqoeJ5 +quGnM/b9Sh/22WA= +-----END CERTIFICATE----- + +Wells Fargo Root CA +=================== + +MD5 Fingerprint=20:0B:4A:7A:88:A7:A9:42:86:8A:5F:74:56:7B:88:05 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 971282334 (0x39e4979e) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=Wells Fargo, OU=Wells Fargo Certification Authority, CN=Wells Fargo Root Certificate Authority + Validity + Not Before: Oct 11 16:41:28 2000 GMT + Not After : Jan 14 16:41:28 2021 GMT + Subject: C=US, O=Wells Fargo, OU=Wells Fargo Certification Authority, CN=Wells Fargo Root Certificate Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:d5:a8:33:3b:26:f9:34:ff:cd:9b:7e:e5:04:47: + ce:00:e2:7d:77:e7:31:c2:2e:27:a5:4d:68:b9:31: + ba:8d:43:59:97:c7:73:aa:7f:3d:5c:40:9e:05:e5: + a1:e2:89:d9:4c:b8:3f:9b:f9:0c:b4:c8:62:19:2c: + 45:ae:91:1e:73:71:41:c4:4b:13:fd:70:c2:25:ac: + 22:f5:75:0b:b7:53:e4:a5:2b:dd:ce:bd:1c:3a:7a: + c3:f7:13:8f:26:54:9c:16:6b:6b:af:fb:d8:96:b1: + 60:9a:48:e0:25:22:24:79:34:ce:0e:26:00:0b:4e: + ab:fd:8b:ce:82:d7:2f:08:70:68:c1:a8:0a:f9:74: + 4f:07:ab:a4:f9:e2:83:7e:27:73:74:3e:b8:f9:38: + 42:fc:a5:a8:5b:48:23:b3:eb:e3:25:b2:80:ae:96: + d4:0a:9c:c2:78:9a:c6:68:18:ae:37:62:37:5e:51: + 75:a8:58:63:c0:51:ee:40:78:7e:a8:af:1a:a0:e1: + b0:78:9d:50:8c:7b:e7:b3:fc:8e:23:b0:db:65:00: + 70:84:01:08:00:14:6e:54:86:9a:ba:cc:f9:37:10: + f6:e0:de:84:2d:9d:a4:85:37:d3:87:e3:15:d0:c1: + 17:90:7e:19:21:6a:12:a9:76:fd:12:02:e9:4f:21: + 5e:17 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Certificate Policies: + Policy: 2.16.840.1.114171.903.1.11 + CPS: http://www.wellsfargo.com/certpolicy + + Signature Algorithm: sha1WithRSAEncryption + d2:27:dd:9c:0a:77:2b:bb:22:f2:02:b5:4a:4a:91:f9:d1:2d: + be:e4:bb:1a:68:ef:0e:a4:00:e9:ee:e7:ef:ee:f6:f9:e5:74: + a4:c2:d8:52:58:c4:74:fb:ce:6b:b5:3b:29:79:18:5a:ef:9b: + ed:1f:6b:36:ee:48:25:25:14:b6:56:a2:10:e8:ee:a7:7f:d0: + 3f:a3:d0:c3:5d:26:ee:07:cc:c3:c1:24:21:87:1e:df:2a:12: + 53:6f:41:16:e7:ed:ae:94:fa:8c:72:fa:13:47:f0:3c:7e:ae: + 7d:11:3a:13:ec:ed:fa:6f:72:64:7b:9d:7d:7f:26:fd:7a:fb: + 25:ad:ea:3e:29:7f:4c:e3:00:57:32:b0:b3:e9:ed:53:17:d9: + 8b:b2:14:0e:30:e8:e5:d5:13:c6:64:af:c4:00:d5:d8:58:24: + fc:f5:8f:ec:f1:c7:7d:a5:db:0f:27:d1:c6:f2:40:88:e6:1f: + f6:61:a8:f4:42:c8:b9:37:d3:a9:be:2c:56:78:c2:72:9b:59: + 5d:35:40:8a:e8:4e:63:1a:b6:e9:20:6a:51:e2:ce:a4:90:df: + 76:70:99:5c:70:43:4d:b7:b6:a7:19:64:4e:92:b7:c5:91:3c: + 7f:48:16:65:7b:16:fd:cb:fc:fb:d9:d5:d6:4f:21:65:3b:4a: + 7f:47:a3:fb +-----BEGIN CERTIFICATE----- +MIID5TCCAs2gAwIBAgIEOeSXnjANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UEBhMC +VVMxFDASBgNVBAoTC1dlbGxzIEZhcmdvMSwwKgYDVQQLEyNXZWxscyBGYXJnbyBD +ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEvMC0GA1UEAxMmV2VsbHMgRmFyZ28gUm9v +dCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDAxMDExMTY0MTI4WhcNMjEwMTE0 +MTY0MTI4WjCBgjELMAkGA1UEBhMCVVMxFDASBgNVBAoTC1dlbGxzIEZhcmdvMSww +KgYDVQQLEyNXZWxscyBGYXJnbyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEvMC0G +A1UEAxMmV2VsbHMgRmFyZ28gUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDVqDM7Jvk0/82bfuUER84A4n13 +5zHCLielTWi5MbqNQ1mXx3Oqfz1cQJ4F5aHiidlMuD+b+Qy0yGIZLEWukR5zcUHE +SxP9cMIlrCL1dQu3U+SlK93OvRw6esP3E48mVJwWa2uv+9iWsWCaSOAlIiR5NM4O +JgALTqv9i86C1y8IcGjBqAr5dE8Hq6T54oN+J3N0Prj5OEL8pahbSCOz6+MlsoCu +ltQKnMJ4msZoGK43YjdeUXWoWGPAUe5AeH6orxqg4bB4nVCMe+ez/I4jsNtlAHCE +AQgAFG5Uhpq6zPk3EPbg3oQtnaSFN9OH4xXQwReQfhkhahKpdv0SAulPIV4XAgMB +AAGjYTBfMA8GA1UdEwEB/wQFMAMBAf8wTAYDVR0gBEUwQzBBBgtghkgBhvt7hwcB +CzAyMDAGCCsGAQUFBwIBFiRodHRwOi8vd3d3LndlbGxzZmFyZ28uY29tL2NlcnRw +b2xpY3kwDQYJKoZIhvcNAQEFBQADggEBANIn3ZwKdyu7IvICtUpKkfnRLb7kuxpo +7w6kAOnu5+/u9vnldKTC2FJYxHT7zmu1Oyl5GFrvm+0fazbuSCUlFLZWohDo7qd/ +0D+j0MNdJu4HzMPBJCGHHt8qElNvQRbn7a6U+oxy+hNH8Dx+rn0ROhPs7fpvcmR7 +nX1/Jv16+yWt6j4pf0zjAFcysLPp7VMX2YuyFA4w6OXVE8Zkr8QA1dhYJPz1j+zx +x32l2w8n0cbyQIjmH/ZhqPRCyLk306m+LFZ4wnKbWV01QIroTmMatukgalHizqSQ +33ZwmVxwQ023tqcZZE6St8WRPH9IFmV7Fv3L/PvZ1dZPIWU7Sn9Ho/s= +-----END CERTIFICATE----- + +Swisscom Root CA 1 +================== + +MD5 Fingerprint=F8:38:7C:77:88:DF:2C:16:68:2E:C2:E2:52:4B:B8:F9 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 5c:0b:85:5c:0b:e7:59:41:df:57:cc:3f:7f:9d:a8:36 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=ch, O=Swisscom, OU=Digital Certificate Services, CN=Swisscom Root CA 1 + Validity + Not Before: Aug 18 12:06:20 2005 GMT + Not After : Aug 18 22:06:20 2025 GMT + Subject: C=ch, O=Swisscom, OU=Digital Certificate Services, CN=Swisscom Root CA 1 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (4096 bit) + Modulus (4096 bit): + 00:d0:b9:b0:a8:0c:d9:bb:3f:21:f8:1b:d5:33:93: + 80:16:65:20:75:b2:3d:9b:60:6d:46:c8:8c:31:6f: + 17:c3:fa:9a:6c:56:ed:3c:c5:91:57:c3:cd:ab:96: + 49:90:2a:19:4b:1e:a3:6d:57:dd:f1:2b:62:28:75: + 45:5e:aa:d6:5b:fa:0b:25:d8:a1:16:f9:1c:c4:2e: + e6:95:2a:67:cc:d0:29:6e:3c:85:34:38:61:49:b1: + 00:9f:d6:3a:71:5f:4d:6d:ce:5f:b9:a9:e4:89:7f: + 6a:52:fa:ca:9b:f2:dc:a9:f9:9d:99:47:3f:4e:29: + 5f:b4:a6:8d:5d:7b:0b:99:11:03:03:fe:e7:db:db: + a3:ff:1d:a5:cd:90:1e:01:1f:35:b0:7f:00:db:90: + 6f:c6:7e:7b:d1:ee:7a:7a:a7:aa:0c:57:6f:a4:6d: + c5:13:3b:b0:a5:d9:ed:32:1c:b4:5e:67:8b:54:dc: + 73:87:e5:d3:17:7c:66:50:72:5d:d4:1a:58:c1:d9: + cf:d8:89:02:6f:a7:49:b4:36:5d:d0:a4:de:07:2c: + b6:75:b7:28:91:d6:97:be:28:f5:98:1e:ea:5b:26: + c9:bd:b0:97:73:da:ae:91:26:eb:68:c1:f9:39:15: + d6:67:4b:0a:6d:4f:cb:cf:b0:e4:42:71:8c:53:79: + e7:ee:e1:db:1d:a0:6e:1d:8c:1a:77:35:5c:16:1e: + 2b:53:1f:34:8b:d1:6c:fc:f2:67:07:7a:f5:ad:ed: + d6:9a:ab:a1:b1:4b:e1:cc:37:5f:fd:7f:cd:4d:ae: + b8:1f:9c:43:f9:2a:58:55:43:45:bc:96:cd:70:0e: + fc:c9:e3:66:ba:4e:8d:3b:81:cb:15:64:7b:b9:94: + e8:5d:33:52:85:71:2e:4f:8e:a2:06:11:51:c9:e3: + cb:a1:6e:31:08:64:0c:c2:d2:3c:f5:36:e8:d7:d0: + 0e:78:23:20:91:c9:24:2a:65:29:5b:22:f7:21:ce: + 83:5e:a4:f3:de:4b:d3:68:8f:46:75:5c:83:09:6e: + 29:6b:c4:70:8c:f5:9d:d7:20:2f:ff:46:d2:2b:38: + c2:2f:75:1c:3d:7e:da:a5:ef:1e:60:85:69:42:d3: + cc:f8:63:fe:1e:43:39:85:a6:b6:63:41:10:b3:73: + 1e:bc:d3:fa:ca:7d:16:47:e2:a7:d5:d0:a3:8a:0a: + 08:96:62:56:6e:34:db:d9:02:b9:30:75:e3:04:d2: + e7:8f:c2:b0:11:40:0a:ac:d5:71:02:62:8b:31:be: + dd:c6:23:58:31:42:43:2d:74:f9:c6:9e:a6:8a:0f: + e9:fe:bf:83:e6:43:57:24:ba:ef:46:34:aa:d7:12: + 01:38:ed + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + 2.5.29.33: + 0.0...`.t.S....`.t.S.. + X509v3 Basic Constraints: critical + CA:TRUE, pathlen:7 + X509v3 Authority Key Identifier: + keyid:03:25:2F:DE:6F:82:01:3A:5C:2C:DC:2B:A1:69:B5:67:D4:8C:D3:FD + + X509v3 Subject Key Identifier: + 03:25:2F:DE:6F:82:01:3A:5C:2C:DC:2B:A1:69:B5:67:D4:8C:D3:FD + Signature Algorithm: sha1WithRSAEncryption + 35:10:cb:ec:a6:04:0d:0d:0f:cd:c0:db:ab:a8:f2:88:97:0c: + df:93:2f:4d:7c:40:56:31:7a:eb:a4:0f:60:cd:7a:f3:be:c3: + 27:8e:03:3e:a4:dd:12:ef:7e:1e:74:06:3c:3f:31:f2:1c:7b: + 91:31:21:b4:f0:d0:6c:97:d4:e9:97:b2:24:56:1e:56:c3:35: + bd:88:05:0f:5b:10:1a:64:e1:c7:82:30:f9:32:ad:9e:50:2c: + e7:78:05:d0:31:b1:5a:98:8a:75:4e:90:5c:6a:14:2a:e0:52: + 47:82:60:e6:1e:da:81:b1:fb:14:0b:5a:f1:9f:d2:95:ba:3e: + d0:1b:d6:15:1d:a3:be:86:d5:db:0f:c0:49:64:bb:2e:50:19: + 4b:d2:24:f8:dd:1e:07:56:d0:38:a0:95:70:20:76:8c:d7:dd: + 1e:de:9f:71:c4:23:ef:83:13:5c:a3:24:15:4d:29:40:3c:6a: + c4:a9:d8:b7:a6:44:a5:0d:f4:e0:9d:77:1e:40:70:26:fc:da: + d9:36:e4:79:e4:b5:3f:bc:9b:65:be:bb:11:96:cf:db:c6:28: + 39:3a:08:ce:47:5b:53:5a:c5:99:fe:5d:a9:dd:ef:4c:d4:c6: + a5:ad:02:e6:8c:07:12:1e:6f:03:d1:6f:a0:a3:f3:29:bd:12: + c7:50:a2:b0:7f:88:a9:99:77:9a:b1:c0:a5:39:2e:5c:7c:69: + e2:2c:b0:ea:37:6a:a4:e1:5a:e1:f5:50:e5:83:ef:a5:bb:2a: + 88:e7:8c:db:fd:6d:5e:97:19:a8:7e:66:75:6b:71:ea:bf:b1: + c7:6f:a0:f4:8e:a4:ec:34:51:5b:8c:26:03:70:a1:77:d5:01: + 12:57:00:35:db:23:de:0e:8a:28:99:fd:b1:10:6f:4b:ff:38: + 2d:60:4e:2c:9c:eb:67:b5:ad:49:ee:4b:1f:ac:af:fb:0d:90: + 5a:66:60:70:5d:aa:cd:78:d4:24:ee:c8:41:a0:93:01:92:9c: + 6a:9e:fc:b9:24:c5:b3:15:82:7e:be:ae:95:2b:eb:b1:c0:da: + e3:01:60:0b:5e:69:ac:84:56:61:be:71:17:fe:1d:13:0f:fe: + c6:87:45:e9:fe:32:a0:1a:0d:13:a4:94:55:71:a5:16:8b:ba: + ca:89:b0:b2:c7:fc:8f:d8:54:b5:93:62:9d:ce:cf:59:fb:3d: + 18:ce:2a:cb:35:15:82:5d:ff:54:22:5b:71:52:fb:b7:c9:fe: + 60:9b:00:41:64:f0:aa:2a:ec:b6:42:43:ce:89:66:81:c8:8b: + 9f:39:54:03:25:d3:16:35:8e:84:d0:5f:fa:30:1a:f5:9a:6c: + f4:0e:53:f9:3a:5b:d1:1c +-----BEGIN CERTIFICATE----- +MIIF2TCCA8GgAwIBAgIQXAuFXAvnWUHfV8w/f52oNjANBgkqhkiG9w0BAQUFADBk +MQswCQYDVQQGEwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0 +YWwgQ2VydGlmaWNhdGUgU2VydmljZXMxGzAZBgNVBAMTElN3aXNzY29tIFJvb3Qg +Q0EgMTAeFw0wNTA4MTgxMjA2MjBaFw0yNTA4MTgyMjA2MjBaMGQxCzAJBgNVBAYT +AmNoMREwDwYDVQQKEwhTd2lzc2NvbTElMCMGA1UECxMcRGlnaXRhbCBDZXJ0aWZp +Y2F0ZSBTZXJ2aWNlczEbMBkGA1UEAxMSU3dpc3Njb20gUm9vdCBDQSAxMIICIjAN +BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0LmwqAzZuz8h+BvVM5OAFmUgdbI9 +m2BtRsiMMW8Xw/qabFbtPMWRV8PNq5ZJkCoZSx6jbVfd8StiKHVFXqrWW/oLJdih +FvkcxC7mlSpnzNApbjyFNDhhSbEAn9Y6cV9Nbc5fuankiX9qUvrKm/LcqfmdmUc/ +TilftKaNXXsLmREDA/7n29uj/x2lzZAeAR81sH8A25Bvxn570e56eqeqDFdvpG3F +EzuwpdntMhy0XmeLVNxzh+XTF3xmUHJd1BpYwdnP2IkCb6dJtDZd0KTeByy2dbco +kdaXvij1mB7qWybJvbCXc9qukSbraMH5ORXWZ0sKbU/Lz7DkQnGMU3nn7uHbHaBu +HYwadzVcFh4rUx80i9Fs/PJnB3r1re3WmquhsUvhzDdf/X/NTa64H5xD+SpYVUNF +vJbNcA78yeNmuk6NO4HLFWR7uZToXTNShXEuT46iBhFRyePLoW4xCGQMwtI89Tbo +19AOeCMgkckkKmUpWyL3Ic6DXqTz3kvTaI9GdVyDCW4pa8RwjPWd1yAv/0bSKzjC +L3UcPX7ape8eYIVpQtPM+GP+HkM5haa2Y0EQs3MevNP6yn0WR+Kn1dCjigoIlmJW +bjTb2QK5MHXjBNLnj8KwEUAKrNVxAmKLMb7dxiNYMUJDLXT5xp6mig/p/r+D5kNX +JLrvRjSq1xIBOO0CAwEAAaOBhjCBgzAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0hBBYw +FDASBgdghXQBUwABBgdghXQBUwABMBIGA1UdEwEB/wQIMAYBAf8CAQcwHwYDVR0j +BBgwFoAUAyUv3m+CATpcLNwroWm1Z9SM0/0wHQYDVR0OBBYEFAMlL95vggE6XCzc +K6FptWfUjNP9MA0GCSqGSIb3DQEBBQUAA4ICAQA1EMvspgQNDQ/NwNurqPKIlwzf +ky9NfEBWMXrrpA9gzXrzvsMnjgM+pN0S734edAY8PzHyHHuRMSG08NBsl9Tpl7Ik +Vh5WwzW9iAUPWxAaZOHHgjD5Mq2eUCzneAXQMbFamIp1TpBcahQq4FJHgmDmHtqB +sfsUC1rxn9KVuj7QG9YVHaO+htXbD8BJZLsuUBlL0iT43R4HVtA4oJVwIHaM190e +3p9xxCPvgxNcoyQVTSlAPGrEqdi3pkSlDfTgnXceQHAm/NrZNuR55LU/vJtlvrsR +ls/bxig5OgjOR1tTWsWZ/l2p3e9M1MalrQLmjAcSHm8D0W+go/MpvRLHUKKwf4ip +mXeascClOS5cfGniLLDqN2qk4Vrh9VDlg++luyqI54zb/W1elxmofmZ1a3Hqv7HH +b6D0jqTsNFFbjCYDcKF31QESVwA12yPeDooomf2xEG9L/zgtYE4snOtnta1J7ksf +rK/7DZBaZmBwXarNeNQk7shBoJMBkpxqnvy5JMWzFYJ+vq6VK+uxwNrjAWALXmms +hFZhvnEX/h0TD/7Gh0Xp/jKgGg0TpJRVcaUWi7rKibCyx/yP2FS1k2Kdzs9Z+z0Y +zirLNRWCXf9UIltxUvu3yf5gmwBBZPCqKuy2QkPOiWaByIufOVQDJdMWNY6E0F/6 +MBr1mmz0DlP5OlvRHA== +-----END CERTIFICATE----- + +DigiCert Assured ID Root CA +=========================== + +MD5 Fingerprint=87:CE:0B:7B:2A:0E:49:00:E1:58:71:9B:37:A8:93:72 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 0c:e7:e0:e5:17:d8:46:fe:8f:e5:60:fc:1b:f0:30:39 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Assured ID Root CA + Validity + Not Before: Nov 10 00:00:00 2006 GMT + Not After : Nov 10 00:00:00 2031 GMT + Subject: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Assured ID Root CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:ad:0e:15:ce:e4:43:80:5c:b1:87:f3:b7:60:f9: + 71:12:a5:ae:dc:26:94:88:aa:f4:ce:f5:20:39:28: + 58:60:0c:f8:80:da:a9:15:95:32:61:3c:b5:b1:28: + 84:8a:8a:dc:9f:0a:0c:83:17:7a:8f:90:ac:8a:e7: + 79:53:5c:31:84:2a:f6:0f:98:32:36:76:cc:de:dd: + 3c:a8:a2:ef:6a:fb:21:f2:52:61:df:9f:20:d7:1f: + e2:b1:d9:fe:18:64:d2:12:5b:5f:f9:58:18:35:bc: + 47:cd:a1:36:f9:6b:7f:d4:b0:38:3e:c1:1b:c3:8c: + 33:d9:d8:2f:18:fe:28:0f:b3:a7:83:d6:c3:6e:44: + c0:61:35:96:16:fe:59:9c:8b:76:6d:d7:f1:a2:4b: + 0d:2b:ff:0b:72:da:9e:60:d0:8e:90:35:c6:78:55: + 87:20:a1:cf:e5:6d:0a:c8:49:7c:31:98:33:6c:22: + e9:87:d0:32:5a:a2:ba:13:82:11:ed:39:17:9d:99: + 3a:72:a1:e6:fa:a4:d9:d5:17:31:75:ae:85:7d:22: + ae:3f:01:46:86:f6:28:79:c8:b1:da:e4:57:17:c4: + 7e:1c:0e:b0:b4:92:a6:56:b3:bd:b2:97:ed:aa:a7: + f0:b7:c5:a8:3f:95:16:d0:ff:a1:96:eb:08:5f:18: + 77:4f + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 45:EB:A2:AF:F4:92:CB:82:31:2D:51:8B:A7:A7:21:9D:F3:6D:C8:0F + X509v3 Authority Key Identifier: + keyid:45:EB:A2:AF:F4:92:CB:82:31:2D:51:8B:A7:A7:21:9D:F3:6D:C8:0F + + Signature Algorithm: sha1WithRSAEncryption + a2:0e:bc:df:e2:ed:f0:e3:72:73:7a:64:94:bf:f7:72:66:d8: + 32:e4:42:75:62:ae:87:eb:f2:d5:d9:de:56:b3:9f:cc:ce:14: + 28:b9:0d:97:60:5c:12:4c:58:e4:d3:3d:83:49:45:58:97:35: + 69:1a:a8:47:ea:56:c6:79:ab:12:d8:67:81:84:df:7f:09:3c: + 94:e6:b8:26:2c:20:bd:3d:b3:28:89:f7:5f:ff:22:e2:97:84: + 1f:e9:65:ef:87:e0:df:c1:67:49:b3:5d:eb:b2:09:2a:eb:26: + ed:78:be:7d:3f:2b:f3:b7:26:35:6d:5f:89:01:b6:49:5b:9f: + 01:05:9b:ab:3d:25:c1:cc:b6:7f:c2:f1:6f:86:c6:fa:64:68: + eb:81:2d:94:eb:42:b7:fa:8c:1e:dd:62:f1:be:50:67:b7:6c: + bd:f3:f1:1f:6b:0c:36:07:16:7f:37:7c:a9:5b:6d:7a:f1:12: + 46:60:83:d7:27:04:be:4b:ce:97:be:c3:67:2a:68:11:df:80: + e7:0c:33:66:bf:13:0d:14:6e:f3:7f:1f:63:10:1e:fa:8d:1b: + 25:6d:6c:8f:a5:b7:61:01:b1:d2:a3:26:a1:10:71:9d:ad:e2: + c3:f9:c3:99:51:b7:2b:07:08:ce:2e:e6:50:b2:a7:fa:0a:45: + 2f:a2:f0:f2 +-----BEGIN CERTIFICATE----- +MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBl +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv +b3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzExMTEwMDAwMDAwWjBlMQswCQYDVQQG +EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl +cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7c +JpSIqvTO9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYP +mDI2dsze3Tyoou9q+yHyUmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+ +wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4 +VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpyoeb6pNnVFzF1roV9Iq4/ +AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whfGHdPAgMB +AAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW +BBRF66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYun +pyGd823IDzANBgkqhkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRC +dWKuh+vy1dneVrOfzM4UKLkNl2BcEkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTf +fwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38FnSbNd67IJKusm7Xi+fT8r87cm +NW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i8b5QZ7dsvfPx +H2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe ++o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g== +-----END CERTIFICATE----- + +DigiCert Global Root CA +======================= + +MD5 Fingerprint=79:E4:A9:84:0D:7D:3A:96:D7:C0:4F:E2:43:4C:89:2E +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 08:3b:e0:56:90:42:46:b1:a1:75:6a:c9:59:91:c7:4a + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Global Root CA + Validity + Not Before: Nov 10 00:00:00 2006 GMT + Not After : Nov 10 00:00:00 2031 GMT + Subject: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Global Root CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:e2:3b:e1:11:72:de:a8:a4:d3:a3:57:aa:50:a2: + 8f:0b:77:90:c9:a2:a5:ee:12:ce:96:5b:01:09:20: + cc:01:93:a7:4e:30:b7:53:f7:43:c4:69:00:57:9d: + e2:8d:22:dd:87:06:40:00:81:09:ce:ce:1b:83:bf: + df:cd:3b:71:46:e2:d6:66:c7:05:b3:76:27:16:8f: + 7b:9e:1e:95:7d:ee:b7:48:a3:08:da:d6:af:7a:0c: + 39:06:65:7f:4a:5d:1f:bc:17:f8:ab:be:ee:28:d7: + 74:7f:7a:78:99:59:85:68:6e:5c:23:32:4b:bf:4e: + c0:e8:5a:6d:e3:70:bf:77:10:bf:fc:01:f6:85:d9: + a8:44:10:58:32:a9:75:18:d5:d1:a2:be:47:e2:27: + 6a:f4:9a:33:f8:49:08:60:8b:d4:5f:b4:3a:84:bf: + a1:aa:4a:4c:7d:3e:cf:4f:5f:6c:76:5e:a0:4b:37: + 91:9e:dc:22:e6:6d:ce:14:1a:8e:6a:cb:fe:cd:b3: + 14:64:17:c7:5b:29:9e:32:bf:f2:ee:fa:d3:0b:42: + d4:ab:b7:41:32:da:0c:d4:ef:f8:81:d5:bb:8d:58: + 3f:b5:1b:e8:49:28:a2:70:da:31:04:dd:f7:b2:16: + f2:4c:0a:4e:07:a8:ed:4a:3d:5e:b5:7f:a3:90:c3: + af:27 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 03:DE:50:35:56:D1:4C:BB:66:F0:A3:E2:1B:1B:C3:97:B2:3D:D1:55 + X509v3 Authority Key Identifier: + keyid:03:DE:50:35:56:D1:4C:BB:66:F0:A3:E2:1B:1B:C3:97:B2:3D:D1:55 + + Signature Algorithm: sha1WithRSAEncryption + cb:9c:37:aa:48:13:12:0a:fa:dd:44:9c:4f:52:b0:f4:df:ae: + 04:f5:79:79:08:a3:24:18:fc:4b:2b:84:c0:2d:b9:d5:c7:fe: + f4:c1:1f:58:cb:b8:6d:9c:7a:74:e7:98:29:ab:11:b5:e3:70: + a0:a1:cd:4c:88:99:93:8c:91:70:e2:ab:0f:1c:be:93:a9:ff: + 63:d5:e4:07:60:d3:a3:bf:9d:5b:09:f1:d5:8e:e3:53:f4:8e: + 63:fa:3f:a7:db:b4:66:df:62:66:d6:d1:6e:41:8d:f2:2d:b5: + ea:77:4a:9f:9d:58:e2:2b:59:c0:40:23:ed:2d:28:82:45:3e: + 79:54:92:26:98:e0:80:48:a8:37:ef:f0:d6:79:60:16:de:ac: + e8:0e:cd:6e:ac:44:17:38:2f:49:da:e1:45:3e:2a:b9:36:53: + cf:3a:50:06:f7:2e:e8:c4:57:49:6c:61:21:18:d5:04:ad:78: + 3c:2c:3a:80:6b:a7:eb:af:15:14:e9:d8:89:c1:b9:38:6c:e2: + 91:6c:8a:ff:64:b9:77:25:57:30:c0:1b:24:a3:e1:dc:e9:df: + 47:7c:b5:b4:24:08:05:30:ec:2d:bd:0b:bf:45:bf:50:b9:a9: + f3:eb:98:01:12:ad:c8:88:c6:98:34:5f:8d:0a:3c:c6:e9:d5: + 95:95:6d:de +-----BEGIN CERTIFICATE----- +MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD +QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT +MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j +b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB +CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97 +nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt +43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P +T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4 +gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO +BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR +TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw +DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr +hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg +06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF +PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls +YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk +CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4= +-----END CERTIFICATE----- + +DigiCert High Assurance EV Root CA +================================== + +MD5 Fingerprint=D4:74:DE:57:5C:39:B2:D3:9C:85:83:C5:C0:65:49:8A +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 02:ac:5c:26:6a:0b:40:9b:8f:0b:79:f2:ae:46:25:77 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert High Assurance EV Root CA + Validity + Not Before: Nov 10 00:00:00 2006 GMT + Not After : Nov 10 00:00:00 2031 GMT + Subject: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert High Assurance EV Root CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:c6:cc:e5:73:e6:fb:d4:bb:e5:2d:2d:32:a6:df: + e5:81:3f:c9:cd:25:49:b6:71:2a:c3:d5:94:34:67: + a2:0a:1c:b0:5f:69:a6:40:b1:c4:b7:b2:8f:d0:98: + a4:a9:41:59:3a:d3:dc:94:d6:3c:db:74:38:a4:4a: + cc:4d:25:82:f7:4a:a5:53:12:38:ee:f3:49:6d:71: + 91:7e:63:b6:ab:a6:5f:c3:a4:84:f8:4f:62:51:be: + f8:c5:ec:db:38:92:e3:06:e5:08:91:0c:c4:28:41: + 55:fb:cb:5a:89:15:7e:71:e8:35:bf:4d:72:09:3d: + be:3a:38:50:5b:77:31:1b:8d:b3:c7:24:45:9a:a7: + ac:6d:00:14:5a:04:b7:ba:13:eb:51:0a:98:41:41: + 22:4e:65:61:87:81:41:50:a6:79:5c:89:de:19:4a: + 57:d5:2e:e6:5d:1c:53:2c:7e:98:cd:1a:06:16:a4: + 68:73:d0:34:04:13:5c:a1:71:d3:5a:7c:55:db:5e: + 64:e1:37:87:30:56:04:e5:11:b4:29:80:12:f1:79: + 39:88:a2:02:11:7c:27:66:b7:88:b7:78:f2:ca:0a: + a8:38:ab:0a:64:c2:bf:66:5d:95:84:c1:a1:25:1e: + 87:5d:1a:50:0b:20:12:cc:41:bb:6e:0b:51:38:b8: + 4b:cb + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + B1:3E:C3:69:03:F8:BF:47:01:D4:98:26:1A:08:02:EF:63:64:2B:C3 + X509v3 Authority Key Identifier: + keyid:B1:3E:C3:69:03:F8:BF:47:01:D4:98:26:1A:08:02:EF:63:64:2B:C3 + + Signature Algorithm: sha1WithRSAEncryption + 1c:1a:06:97:dc:d7:9c:9f:3c:88:66:06:08:57:21:db:21:47: + f8:2a:67:aa:bf:18:32:76:40:10:57:c1:8a:f3:7a:d9:11:65: + 8e:35:fa:9e:fc:45:b5:9e:d9:4c:31:4b:b8:91:e8:43:2c:8e: + b3:78:ce:db:e3:53:79:71:d6:e5:21:94:01:da:55:87:9a:24: + 64:f6:8a:66:cc:de:9c:37:cd:a8:34:b1:69:9b:23:c8:9e:78: + 22:2b:70:43:e3:55:47:31:61:19:ef:58:c5:85:2f:4e:30:f6: + a0:31:16:23:c8:e7:e2:65:16:33:cb:bf:1a:1b:a0:3d:f8:ca: + 5e:8b:31:8b:60:08:89:2d:0c:06:5c:52:b7:c4:f9:0a:98:d1: + 15:5f:9f:12:be:7c:36:63:38:bd:44:a4:7f:e4:26:2b:0a:c4: + 97:69:0d:e9:8c:e2:c0:10:57:b8:c8:76:12:91:55:f2:48:69: + d8:bc:2a:02:5b:0f:44:d4:20:31:db:f4:ba:70:26:5d:90:60: + 9e:bc:4b:17:09:2f:b4:cb:1e:43:68:c9:07:27:c1:d2:5c:f7: + ea:21:b9:68:12:9c:3c:9c:bf:9e:fc:80:5c:9b:63:cd:ec:47: + aa:25:27:67:a0:37:f3:00:82:7d:54:d7:a9:f8:e9:2e:13:a3: + 77:e8:1f:4a +-----BEGIN CERTIFICATE----- +MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j +ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL +MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3 +LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug +RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm ++9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW +PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM +xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB +Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3 +hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg +EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF +MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA +FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec +nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z +eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF +hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2 +Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe +vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep ++OkuE6N36B9K +-----END CERTIFICATE----- + +Certplus Class 2 Primary CA +=========================== + +MD5 Fingerprint=88:2C:8C:52:B8:A2:3C:F3:F7:BB:03:EA:AE:AC:42:0B +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 85:bd:4b:f3:d8:da:e3:69:f6:94:d7:5f:c3:a5:44:23 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=FR, O=Certplus, CN=Class 2 Primary CA + Validity + Not Before: Jul 7 17:05:00 1999 GMT + Not After : Jul 6 23:59:59 2019 GMT + Subject: C=FR, O=Certplus, CN=Class 2 Primary CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:dc:50:96:d0:12:f8:35:d2:08:78:7a:b6:52:70: + fd:6f:ee:cf:b9:11:cb:5d:77:e1:ec:e9:7e:04:8d: + d6:cc:6f:73:43:57:60:ac:33:0a:44:ec:03:5f:1c: + 80:24:91:e5:a8:91:56:12:82:f7:e0:2b:f4:db:ae: + 61:2e:89:10:8d:6b:6c:ba:b3:02:bd:d5:36:c5:48: + 37:23:e2:f0:5a:37:52:33:17:12:e2:d1:60:4d:be: + 2f:41:11:e3:f6:17:25:0c:8b:91:c0:1b:99:7b:99: + 56:0d:af:ee:d2:bc:47:57:e3:79:49:7b:34:89:27: + 24:84:de:b1:ec:e9:58:4e:fe:4e:df:5a:be:41:ad: + ac:08:c5:18:0e:ef:d2:53:ee:6c:d0:9d:12:01:13: + 8d:dc:80:62:f7:95:a9:44:88:4a:71:4e:60:55:9e: + db:23:19:79:56:07:0c:3f:63:0b:5c:b0:e2:be:7e: + 15:fc:94:33:58:41:38:74:c4:e1:8f:8b:df:26:ac: + 1f:b5:8b:3b:b7:43:59:6b:b0:24:a6:6d:90:8b:c4: + 72:ea:5d:33:98:b7:cb:de:5e:7b:ef:94:f1:1b:3e: + ca:c9:21:c1:c5:98:02:aa:a2:f6:5b:77:9b:f5:7e: + 96:55:34:1c:67:69:c0:f1:42:e3:47:ac:fc:28:1c: + 66:55 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:TRUE, pathlen:10 + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Subject Key Identifier: + E3:73:2D:DF:CB:0E:28:0C:DE:DD:B3:A4:CA:79:B8:8E:BB:E8:30:89 + Netscape Cert Type: + SSL CA, S/MIME CA + X509v3 CRL Distribution Points: + URI:http://www.certplus.com/CRL/class2.crl + + Signature Algorithm: sha1WithRSAEncryption + a7:54:cf:88:44:19:cb:df:d4:7f:00:df:56:33:62:b5:f7:51: + 01:90:eb:c3:3f:d1:88:44:e9:24:5d:ef:e7:14:bd:20:b7:9a: + 3c:00:fe:6d:9f:db:90:dc:d7:f4:62:d6:8b:70:5d:e7:e5:04: + 48:a9:68:7c:c9:f1:42:f3:6c:7f:c5:7a:7c:1d:51:88:ba:d2: + 0a:3e:27:5d:de:2d:51:4e:d3:13:64:69:e4:2e:e3:d3:e7:9b: + 09:99:a6:e0:95:9b:ce:1a:d7:7f:be:3c:ce:52:b3:11:15:c1: + 0f:17:cd:03:bb:9c:25:15:ba:a2:76:89:fc:06:f1:18:d0:93: + 4b:0e:7c:82:b7:a5:f4:f6:5f:fe:ed:40:a6:9d:84:74:39:b9: + dc:1e:85:16:da:29:1b:86:23:00:c9:bb:89:7e:6e:80:88:1e: + 2f:14:b4:03:24:a8:32:6f:03:9a:47:2c:30:be:56:c6:a7:42: + 02:70:1b:ea:40:d8:ba:05:03:70:07:a4:96:ff:fd:48:33:0a: + e1:dc:a5:81:90:9b:4d:dd:7d:e7:e7:b2:cd:5c:c8:6a:95:f8: + a5:f6:8d:c4:5d:78:08:be:7b:06:d6:49:cf:19:36:50:23:2e: + 08:e6:9e:05:4d:47:18:d5:16:e9:b1:d6:b6:10:d5:bb:97:bf: + a2:8e:b4:54 +-----BEGIN CERTIFICATE----- +MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAw +PTELMAkGA1UEBhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFz +cyAyIFByaW1hcnkgQ0EwHhcNOTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9 +MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2VydHBsdXMxGzAZBgNVBAMTEkNsYXNz +IDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANxQ +ltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR5aiR +VhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyL +kcAbmXuZVg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCd +EgETjdyAYveVqUSISnFOYFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yas +H7WLO7dDWWuwJKZtkIvEcupdM5i3y95ee++U8Rs+yskhwcWYAqqi9lt3m/V+llU0 +HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRMECDAGAQH/AgEKMAsGA1Ud +DwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJYIZIAYb4 +QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMu +Y29tL0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/ +AN9WM2K191EBkOvDP9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8 +yfFC82x/xXp8HVGIutIKPidd3i1RTtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMR +FcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+7UCmnYR0ObncHoUW2ikbhiMA +ybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW//1IMwrh3KWB +kJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7 +l7+ijrRU +-----END CERTIFICATE----- + +DST Root CA X3 +============== + +MD5 Fingerprint=41:03:52:DC:0F:F7:50:1B:16:F0:02:8E:BA:6F:45:C5 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 44:af:b0:80:d6:a3:27:ba:89:30:39:86:2e:f8:40:6b + Signature Algorithm: sha1WithRSAEncryption + Issuer: O=Digital Signature Trust Co., CN=DST Root CA X3 + Validity + Not Before: Sep 30 21:12:19 2000 GMT + Not After : Sep 30 14:01:15 2021 GMT + Subject: O=Digital Signature Trust Co., CN=DST Root CA X3 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:df:af:e9:97:50:08:83:57:b4:cc:62:65:f6:90: + 82:ec:c7:d3:2c:6b:30:ca:5b:ec:d9:c3:7d:c7:40: + c1:18:14:8b:e0:e8:33:76:49:2a:e3:3f:21:49:93: + ac:4e:0e:af:3e:48:cb:65:ee:fc:d3:21:0f:65:d2: + 2a:d9:32:8f:8c:e5:f7:77:b0:12:7b:b5:95:c0:89: + a3:a9:ba:ed:73:2e:7a:0c:06:32:83:a2:7e:8a:14: + 30:cd:11:a0:e1:2a:38:b9:79:0a:31:fd:50:bd:80: + 65:df:b7:51:63:83:c8:e2:88:61:ea:4b:61:81:ec: + 52:6b:b9:a2:e2:4b:1a:28:9f:48:a3:9e:0c:da:09: + 8e:3e:17:2e:1e:dd:20:df:5b:c6:2a:8a:ab:2e:bd: + 70:ad:c5:0b:1a:25:90:74:72:c5:7b:6a:ab:34:d6: + 30:89:ff:e5:68:13:7b:54:0b:c8:d6:ae:ec:5a:9c: + 92:1e:3d:64:b3:8c:c6:df:bf:c9:41:70:ec:16:72: + d5:26:ec:38:55:39:43:d0:fc:fd:18:5c:40:f1:97: + eb:d5:9a:9b:8d:1d:ba:da:25:b9:c6:d8:df:c1:15: + 02:3a:ab:da:6e:f1:3e:2e:f5:5c:08:9c:3c:d6:83: + 69:e4:10:9b:19:2a:b6:29:57:e3:e5:3d:9b:9f:f0: + 02:5d + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Subject Key Identifier: + C4:A7:B1:A4:7B:2C:71:FA:DB:E1:4B:90:75:FF:C4:15:60:85:89:10 + Signature Algorithm: sha1WithRSAEncryption + a3:1a:2c:9b:17:00:5c:a9:1e:ee:28:66:37:3a:bf:83:c7:3f: + 4b:c3:09:a0:95:20:5d:e3:d9:59:44:d2:3e:0d:3e:bd:8a:4b: + a0:74:1f:ce:10:82:9c:74:1a:1d:7e:98:1a:dd:cb:13:4b:b3: + 20:44:e4:91:e9:cc:fc:7d:a5:db:6a:e5:fe:e6:fd:e0:4e:dd: + b7:00:3a:b5:70:49:af:f2:e5:eb:02:f1:d1:02:8b:19:cb:94: + 3a:5e:48:c4:18:1e:58:19:5f:1e:02:5a:f0:0c:f1:b1:ad:a9: + dc:59:86:8b:6e:e9:91:f5:86:ca:fa:b9:66:33:aa:59:5b:ce: + e2:a7:16:73:47:cb:2b:cc:99:b0:37:48:cf:e3:56:4b:f5:cf: + 0f:0c:72:32:87:c6:f0:44:bb:53:72:6d:43:f5:26:48:9a:52: + 67:b7:58:ab:fe:67:76:71:78:db:0d:a2:56:14:13:39:24:31: + 85:a2:a8:02:5a:30:47:e1:dd:50:07:bc:02:09:90:00:eb:64: + 63:60:9b:16:bc:88:c9:12:e6:d2:7d:91:8b:f9:3d:32:8d:65: + b4:e9:7c:b1:57:76:ea:c5:b6:28:39:bf:15:65:1c:c8:f6:77: + 96:6a:0a:8d:77:0b:d8:91:0b:04:8e:07:db:29:b6:0a:ee:9d: + 82:35:35:10 +-----BEGIN CERTIFICATE----- +MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/ +MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT +DkRTVCBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVow +PzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD +Ew5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +AN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmTrE4O +rz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEq +OLl5CjH9UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9b +xiqKqy69cK3FCxolkHRyxXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw +7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40dutolucbY38EVAjqr2m7xPi71XAicPNaD +aeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV +HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQMA0GCSqG +SIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69 +ikugdB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXr +AvHRAosZy5Q6XkjEGB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZz +R8srzJmwN0jP41ZL9c8PDHIyh8bwRLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5 +JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubSfZGL+T0yjWW06XyxV3bqxbYo +Ob8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ +-----END CERTIFICATE----- + +Digital Signature Trust Co. Global CA 1 +======================================= + +MD5 Fingerprint=25:7A:BA:83:2E:B6:A2:0B:DA:FE:F5:02:0F:08:D7:AD +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 913315222 (0x36701596) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=Digital Signature Trust Co., OU=DSTCA E1 + Validity + Not Before: Dec 10 18:10:23 1998 GMT + Not After : Dec 10 18:40:23 2018 GMT + Subject: C=US, O=Digital Signature Trust Co., OU=DSTCA E1 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:a0:6c:81:a9:cf:34:1e:24:dd:fe:86:28:cc:de: + 83:2f:f9:5e:d4:42:d2:e8:74:60:66:13:98:06:1c: + a9:51:12:69:6f:31:55:b9:49:72:00:08:7e:d3:a5: + 62:44:37:24:99:8f:d9:83:48:8f:99:6d:95:13:bb: + 43:3b:2e:49:4e:88:37:c1:bb:58:7f:fe:e1:bd:f8: + bb:61:cd:f3:47:c0:99:a6:f1:f3:91:e8:78:7c:00: + cb:61:c9:44:27:71:69:55:4a:7e:49:4d:ed:a2:a3: + be:02:4c:00:ca:02:a8:ee:01:02:31:64:0f:52:2d: + 13:74:76:36:b5:7a:b4:2d:71 + Exponent: 3 (0x3) + X509v3 extensions: + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 CRL Distribution Points: + DirName:/C=US/O=Digital Signature Trust Co./OU=DSTCA E1/CN=CRL1 + + X509v3 Private Key Usage Period: + Not Before: Dec 10 18:10:23 1998 GMT, Not After: Dec 10 18:10:23 2018 GMT + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:6A:79:7E:91:69:46:18:13:0A:02:77:A5:59:5B:60:98:25:0E:A2:F8 + + X509v3 Subject Key Identifier: + 6A:79:7E:91:69:46:18:13:0A:02:77:A5:59:5B:60:98:25:0E:A2:F8 + X509v3 Basic Constraints: + CA:TRUE + 1.2.840.113533.7.65.0: + 0 +..V4.0.... + Signature Algorithm: sha1WithRSAEncryption + 22:12:d8:7a:1d:dc:81:06:b6:09:65:b2:87:c8:1f:5e:b4:2f: + e9:c4:1e:f2:3c:c1:bb:04:90:11:4a:83:4e:7e:93:b9:4d:42: + c7:92:26:a0:5c:34:9a:38:72:f8:fd:6b:16:3e:20:ee:82:8b: + 31:2a:93:36:85:23:88:8a:3c:03:68:d3:c9:09:0f:4d:fc:6c: + a4:da:28:72:93:0e:89:80:b0:7d:fe:80:6f:65:6d:18:33:97: + 8b:c2:6b:89:ee:60:3d:c8:9b:ef:7f:2b:32:62:73:93:cb:3c: + e3:7b:e2:76:78:45:bc:a1:93:04:bb:86:9f:3a:5b:43:7a:c3: + 8a:65 +-----BEGIN CERTIFICATE----- +MIIDKTCCApKgAwIBAgIENnAVljANBgkqhkiG9w0BAQUFADBGMQswCQYDVQQGEwJV +UzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMREwDwYDVQQL +EwhEU1RDQSBFMTAeFw05ODEyMTAxODEwMjNaFw0xODEyMTAxODQwMjNaMEYxCzAJ +BgNVBAYTAlVTMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4x +ETAPBgNVBAsTCERTVENBIEUxMIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQCg +bIGpzzQeJN3+hijM3oMv+V7UQtLodGBmE5gGHKlREmlvMVW5SXIACH7TpWJENySZ +j9mDSI+ZbZUTu0M7LklOiDfBu1h//uG9+LthzfNHwJmm8fOR6Hh8AMthyUQncWlV +Sn5JTe2io74CTADKAqjuAQIxZA9SLRN0dja1erQtcQIBA6OCASQwggEgMBEGCWCG +SAGG+EIBAQQEAwIABzBoBgNVHR8EYTBfMF2gW6BZpFcwVTELMAkGA1UEBhMCVVMx +JDAiBgNVBAoTG0RpZ2l0YWwgU2lnbmF0dXJlIFRydXN0IENvLjERMA8GA1UECxMI +RFNUQ0EgRTExDTALBgNVBAMTBENSTDEwKwYDVR0QBCQwIoAPMTk5ODEyMTAxODEw +MjNagQ8yMDE4MTIxMDE4MTAyM1owCwYDVR0PBAQDAgEGMB8GA1UdIwQYMBaAFGp5 +fpFpRhgTCgJ3pVlbYJglDqL4MB0GA1UdDgQWBBRqeX6RaUYYEwoCd6VZW2CYJQ6i ++DAMBgNVHRMEBTADAQH/MBkGCSqGSIb2fQdBAAQMMAobBFY0LjADAgSQMA0GCSqG +SIb3DQEBBQUAA4GBACIS2Hod3IEGtgllsofIH160L+nEHvI8wbsEkBFKg05+k7lN +QseSJqBcNJo4cvj9axY+IO6CizEqkzaFI4iKPANo08kJD038bKTaKHKTDomAsH3+ +gG9lbRgzl4vCa4nuYD3Im+9/KzJic5PLPON74nZ4RbyhkwS7hp86W0N6w4pl +-----END CERTIFICATE----- + +DST ACES CA X6 +============== + +MD5 Fingerprint=21:D8:4C:82:2B:99:09:33:A2:EB:14:24:8D:8E:5F:E8 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 0d:5e:99:0a:d6:9d:b7:78:ec:d8:07:56:3b:86:15:d9 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=Digital Signature Trust, OU=DST ACES, CN=DST ACES CA X6 + Validity + Not Before: Nov 20 21:19:58 2003 GMT + Not After : Nov 20 21:19:58 2017 GMT + Subject: C=US, O=Digital Signature Trust, OU=DST ACES, CN=DST ACES CA X6 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b9:3d:f5:2c:c9:94:dc:75:8a:95:5d:63:e8:84: + 77:76:66:b9:59:91:5c:46:dd:92:3e:9f:f9:0e:03: + b4:3d:61:92:bd:23:26:b5:63:ee:92:d2:9e:d6:3c: + c8:0d:90:5f:64:81:b1:a8:08:0d:4c:d8:f9:d3:05: + 28:52:b4:01:25:c5:95:1c:0c:7e:3e:10:84:75:cf: + c1:19:91:63:cf:e8:a8:91:88:b9:43:52:bb:80:b1: + 55:89:8b:31:fa:d0:b7:76:be:41:3d:30:9a:a4:22: + 25:17:73:e8:1e:e2:d3:ac:2a:bd:5b:38:21:d5:2a: + 4b:d7:55:7d:e3:3a:55:bd:d7:6d:6b:02:57:6b:e6: + 47:7c:08:c8:82:ba:de:a7:87:3d:a1:6d:b8:30:56: + c2:b3:02:81:5f:2d:f5:e2:9a:30:18:28:b8:66:d3: + cb:01:96:6f:ea:8a:45:55:d6:e0:9d:ff:67:2b:17: + 02:a6:4e:1a:6a:11:0b:7e:b7:7b:e7:98:d6:8c:76: + 6f:c1:3b:db:50:93:7e:e5:d0:8e:1f:37:b8:bd:ba: + c6:9f:6c:e9:7c:33:f2:32:3c:26:47:fa:27:24:02: + c9:7e:1d:5b:88:42:13:6a:35:7c:7d:35:e9:2e:66: + 91:72:93:d5:32:26:c4:74:f5:53:a3:b3:5d:9a:f6: + 09:cb + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Digital Signature, Non Repudiation, Certificate Sign, CRL Sign + X509v3 Subject Alternative Name: + email:pki-ops@trustdst.com + X509v3 Certificate Policies: + Policy: 2.16.840.1.101.3.2.1.1.1 + CPS: http://www.trustdst.com/certificates/policy/ACES-index.html + + X509v3 Subject Key Identifier: + 09:72:06:4E:18:43:0F:E5:D6:CC:C3:6A:8B:31:7B:78:8F:A8:83:B8 + Signature Algorithm: sha1WithRSAEncryption + a3:d8:8e:d6:b2:db:ce:05:e7:32:cd:01:d3:04:03:e5:76:e4: + 56:2b:9c:99:90:e8:08:30:6c:df:7d:3d:ee:e5:bf:b5:24:40: + 84:49:e1:d1:28:ae:c4:c2:3a:53:30:88:f1:f5:77:6e:51:ca: + fa:ff:99:af:24:5f:1b:a0:fd:f2:ac:84:ca:df:a9:f0:5f:04: + 2e:ad:16:bf:21:97:10:81:3d:e3:ff:87:8d:32:dc:94:e5:47: + 8a:5e:6a:13:c9:94:95:3d:d2:ee:c8:34:95:d0:80:d4:ad:32: + 08:80:54:3c:e0:bd:52:53:d7:52:7c:b2:69:3f:7f:7a:cf:6a: + 74:ca:fa:04:2a:9c:4c:5a:06:a5:e9:20:ad:45:66:0f:69:f1: + dd:bf:e9:e3:32:8b:fa:e0:c1:86:4d:72:3c:2e:d8:93:78:0a: + 2a:f8:d8:d2:27:3d:19:89:5f:5a:7b:8a:3b:cc:0c:da:51:ae: + c7:0b:f7:2b:b0:37:05:ec:bc:57:23:e2:38:d2:9b:68:f3:56: + 12:88:4f:42:7c:b8:31:c4:b5:db:e4:c8:21:34:e9:48:11:35: + ee:fa:c7:92:57:c5:9f:34:e4:c7:f6:f7:0e:0b:4c:9c:68:78: + 7b:71:31:c7:eb:1e:e0:67:41:f3:b7:a0:a7:cd:e5:7a:33:36: + 6a:fa:9a:2b +-----BEGIN CERTIFICATE----- +MIIECTCCAvGgAwIBAgIQDV6ZCtadt3js2AdWO4YV2TANBgkqhkiG9w0BAQUFADBb +MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3Qx +ETAPBgNVBAsTCERTVCBBQ0VTMRcwFQYDVQQDEw5EU1QgQUNFUyBDQSBYNjAeFw0w +MzExMjAyMTE5NThaFw0xNzExMjAyMTE5NThaMFsxCzAJBgNVBAYTAlVTMSAwHgYD +VQQKExdEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdDERMA8GA1UECxMIRFNUIEFDRVMx +FzAVBgNVBAMTDkRTVCBBQ0VTIENBIFg2MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A +MIIBCgKCAQEAuT31LMmU3HWKlV1j6IR3dma5WZFcRt2SPp/5DgO0PWGSvSMmtWPu +ktKe1jzIDZBfZIGxqAgNTNj50wUoUrQBJcWVHAx+PhCEdc/BGZFjz+iokYi5Q1K7 +gLFViYsx+tC3dr5BPTCapCIlF3PoHuLTrCq9Wzgh1SpL11V94zpVvddtawJXa+ZH +fAjIgrrep4c9oW24MFbCswKBXy314powGCi4ZtPLAZZv6opFVdbgnf9nKxcCpk4a +ahELfrd755jWjHZvwTvbUJN+5dCOHze4vbrGn2zpfDPyMjwmR/onJALJfh1biEIT +ajV8fTXpLmaRcpPVMibEdPVTo7NdmvYJywIDAQABo4HIMIHFMA8GA1UdEwEB/wQF +MAMBAf8wDgYDVR0PAQH/BAQDAgHGMB8GA1UdEQQYMBaBFHBraS1vcHNAdHJ1c3Rk +c3QuY29tMGIGA1UdIARbMFkwVwYKYIZIAWUDAgEBATBJMEcGCCsGAQUFBwIBFjto +dHRwOi8vd3d3LnRydXN0ZHN0LmNvbS9jZXJ0aWZpY2F0ZXMvcG9saWN5L0FDRVMt +aW5kZXguaHRtbDAdBgNVHQ4EFgQUCXIGThhDD+XWzMNqizF7eI+og7gwDQYJKoZI +hvcNAQEFBQADggEBAKPYjtay284F5zLNAdMEA+V25FYrnJmQ6AgwbN99Pe7lv7Uk +QIRJ4dEorsTCOlMwiPH1d25Ryvr/ma8kXxug/fKshMrfqfBfBC6tFr8hlxCBPeP/ +h40y3JTlR4peahPJlJU90u7INJXQgNStMgiAVDzgvVJT11J8smk/f3rPanTK+gQq +nExaBqXpIK1FZg9p8d2/6eMyi/rgwYZNcjwu2JN4Cir42NInPRmJX1p7ijvMDNpR +rscL9yuwNwXsvFcj4jjSm2jzVhKIT0J8uDHEtdvkyCE06UgRNe76x5JXxZ805Mf2 +9w4LTJxoeHtxMcfrHuBnQfO3oKfN5XozNmr6mis= +-----END CERTIFICATE----- + +TURKTRUST Certificate Services Provider Root 1 +============================================== + +MD5 Fingerprint=F1:6A:22:18:C9:CD:DF:CE:82:1D:1D:B7:78:5C:A9:A5 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: CN=T\xC3\x9CRKTRUST Elektronik Sertifika Hizmet Sa\xC4\x9Flay\xC4\xB1c\xC4\xB1s\xC4\xB1, C=TR, L=ANKARA, O=(c) 2005 T\xC3\x9CRKTRUST Bilgi \xC4\xB0leti\xC5\x9Fim ve Bili\xC5\x9Fim G\xC3\xBCvenli\xC4\x9Fi Hizmetleri A.\xC5\x9E. + Validity + Not Before: May 13 10:27:17 2005 GMT + Not After : Mar 22 10:27:17 2015 GMT + Subject: CN=T\xC3\x9CRKTRUST Elektronik Sertifika Hizmet Sa\xC4\x9Flay\xC4\xB1c\xC4\xB1s\xC4\xB1, C=TR, L=ANKARA, O=(c) 2005 T\xC3\x9CRKTRUST Bilgi \xC4\xB0leti\xC5\x9Fim ve Bili\xC5\x9Fim G\xC3\xBCvenli\xC4\x9Fi Hizmetleri A.\xC5\x9E. + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:ca:52:05:d6:63:03:d8:1c:5f:dd:d2:7b:5d:f2: + 0c:60:61:5b:6b:3b:74:2b:78:0d:7d:45:bd:22:74: + e8:8c:03:c1:c6:11:2a:3d:95:bc:a9:94:b0:bb:91: + 97:c8:69:7c:84:c5:b4:91:6c:6c:13:6a:a4:55:ad: + a4:85:e8:95:7e:b3:00:af:00:c2:05:18:f5:70:9d: + 36:8b:ae:cb:e4:1b:81:7f:93:88:fb:6a:55:bb:7d: + 85:92:ce:ba:58:9f:db:32:c5:bd:5d:ef:22:4a:2f: + 41:07:7e:49:61:b3:86:ec:4e:a6:41:6e:84:bc:03: + ec:f5:3b:1c:c8:1f:c2:ee:a8:ee:ea:12:4a:8d:14: + cf:f3:0a:e0:50:39:f9:08:35:f8:11:59:ad:e7:22: + ea:4b:ca:14:06:de:42:ba:b2:99:f3:2d:54:88:10: + 06:ea:e1:1a:3e:3d:67:1f:fb:ce:fb:7c:82:e8:11: + 5d:4a:c1:b9:14:ea:54:d9:66:9b:7c:89:7d:04:9a: + 62:c9:e9:52:3c:9e:9c:ef:d2:f5:26:e4:e6:e5:18: + 7c:8b:6e:df:6c:cc:78:5b:4f:72:b2:cb:5c:3f:8c: + 05:8d:d1:4c:8c:ad:92:c7:e1:78:7f:65:6c:49:06: + 50:2c:9e:32:c2:d7:4a:c6:75:8a:59:4e:75:6f:47: + 5e:c1 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:TRUE + Signature Algorithm: sha1WithRSAEncryption + 15:f5:55:ff:37:96:80:59:21:a4:fc:a1:15:4c:20:f6:d4:5f: + da:03:24:fc:cf:90:1a:f4:21:0a:9a:ee:3a:b1:6a:ef:ef:f8: + 60:d1:4c:36:66:45:1d:f3:66:02:74:04:7b:92:30:a8:de:0a: + 76:0f:ef:95:6e:bd:c9:37:e6:1a:0d:ac:89:48:5b:cc:83:36: + c2:f5:46:5c:59:82:56:b4:d5:fe:23:b4:d8:54:1c:44:ab:c4: + a7:e5:14:ce:3c:41:61:7c:43:e6:cd:c4:81:09:8b:24:fb:54: + 25:d6:16:a8:96:0c:67:07:6f:b3:50:47:e3:1c:24:28:dd:2a: + 98:a4:61:fe:db:ea:12:37:bc:01:1a:34:85:bd:6e:4f:e7:91: + 72:07:44:85:1e:58:ca:54:44:dd:f7:ac:b9:cb:89:21:72:db: + 8f:c0:69:29:97:2a:a3:ae:18:23:97:1c:41:2a:8b:7c:2a:c1: + 7c:90:e8:a9:28:c0:d3:91:c6:ad:28:87:40:68:b5:ff:ec:a7: + d2:d3:38:18:9c:d3:7d:69:5d:f0:c6:a5:1e:24:1b:a3:47:fc: + 69:07:68:e7:e4:9a:b4:ed:0f:a1:87:87:02:ce:87:d2:48:4e: + e1:bc:ff:cb:f1:72:92:44:64:03:25:ea:de:5b:6e:9f:c9:f2: + 4e:ac:dd:c7 +-----BEGIN CERTIFICATE----- +MIID+zCCAuOgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBtzE/MD0GA1UEAww2VMOc +UktUUlVTVCBFbGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sx +c8SxMQswCQYDVQQGDAJUUjEPMA0GA1UEBwwGQU5LQVJBMVYwVAYDVQQKDE0oYykg +MjAwNSBUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmlsacWfaW0gR8O8 +dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLjAeFw0wNTA1MTMxMDI3MTdaFw0xNTAz +MjIxMDI3MTdaMIG3MT8wPQYDVQQDDDZUw5xSS1RSVVNUIEVsZWt0cm9uaWsgU2Vy +dGlmaWthIEhpem1ldCBTYcSfbGF5xLFjxLFzxLExCzAJBgNVBAYMAlRSMQ8wDQYD +VQQHDAZBTktBUkExVjBUBgNVBAoMTShjKSAyMDA1IFTDnFJLVFJVU1QgQmlsZ2kg +xLBsZXRpxZ9pbSB2ZSBCaWxpxZ9pbSBHw7x2ZW5sacSfaSBIaXptZXRsZXJpIEEu +xZ4uMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAylIF1mMD2Bxf3dJ7 +XfIMYGFbazt0K3gNfUW9InTojAPBxhEqPZW8qZSwu5GXyGl8hMW0kWxsE2qkVa2k +heiVfrMArwDCBRj1cJ02i67L5BuBf5OI+2pVu32Fks66WJ/bMsW9Xe8iSi9BB35J +YbOG7E6mQW6EvAPs9TscyB/C7qju6hJKjRTP8wrgUDn5CDX4EVmt5yLqS8oUBt5C +urKZ8y1UiBAG6uEaPj1nH/vO+3yC6BFdSsG5FOpU2WabfIl9BJpiyelSPJ6c79L1 +JuTm5Rh8i27fbMx4W09ysstcP4wFjdFMjK2Sx+F4f2VsSQZQLJ4ywtdKxnWKWU51 +b0dewQIDAQABoxAwDjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAV +9VX/N5aAWSGk/KEVTCD21F/aAyT8z5Aa9CEKmu46sWrv7/hg0Uw2ZkUd82YCdAR7 +kjCo3gp2D++Vbr3JN+YaDayJSFvMgzbC9UZcWYJWtNX+I7TYVBxEq8Sn5RTOPEFh +fEPmzcSBCYsk+1Ql1haolgxnB2+zUEfjHCQo3SqYpGH+2+oSN7wBGjSFvW5P55Fy +B0SFHljKVETd96y5y4khctuPwGkplyqjrhgjlxxBKot8KsF8kOipKMDTkcatKIdA +aLX/7KfS0zgYnNN9aV3wxqUeJBujR/xpB2jn5Jq07Q+hh4cCzofSSE7hvP/L8XKS +RGQDJereW26fyfJOrN3H +-----END CERTIFICATE----- + +TURKTRUST Certificate Services Provider Root 2 +============================================== + +MD5 Fingerprint=37:A5:6E:D4:B1:25:84:97:B7:FD:56:15:7A:F9:A2:00 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: CN=T\xC3\x9CRKTRUST Elektronik Sertifika Hizmet Sa\xC4\x9Flay\xC4\xB1c\xC4\xB1s\xC4\xB1, C=TR, L=Ankara, O=T\xC3\x9CRKTRUST Bilgi \xC4\xB0leti\xC5\x9Fim ve Bili\xC5\x9Fim G\xC3\xBCvenli\xC4\x9Fi Hizmetleri A.\xC5\x9E. (c) Kas\xC4\xB1m 2005 + Validity + Not Before: Nov 7 10:07:57 2005 GMT + Not After : Sep 16 10:07:57 2015 GMT + Subject: CN=T\xC3\x9CRKTRUST Elektronik Sertifika Hizmet Sa\xC4\x9Flay\xC4\xB1c\xC4\xB1s\xC4\xB1, C=TR, L=Ankara, O=T\xC3\x9CRKTRUST Bilgi \xC4\xB0leti\xC5\x9Fim ve Bili\xC5\x9Fim G\xC3\xBCvenli\xC4\x9Fi Hizmetleri A.\xC5\x9E. (c) Kas\xC4\xB1m 2005 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:a9:36:7e:c3:91:43:4c:c3:19:98:08:c8:c7:58: + 7b:4f:16:8c:a5:ce:49:01:1f:73:0e:ac:75:13:a6: + fa:9e:2c:20:de:d8:90:0e:0a:d1:69:d2:27:fb:aa: + 77:9f:27:52:25:e2:cb:5d:d8:d8:83:50:17:7d:8a: + b5:82:3f:04:8e:b4:d5:f0:49:a7:64:b7:1e:2e:5f: + 20:9c:50:75:4f:af:e1:b5:41:14:f4:98:92:88:c7: + e5:e5:64:47:61:47:79:fd:c0:51:f1:c1:99:e7:dc: + ce:6a:fb:af:b5:01:30:dc:46:1c:ef:8a:ec:95:ef: + dc:ff:af:10:1c:eb:9d:d8:b0:aa:6a:85:18:0d:17: + c9:3e:bf:f1:9b:d0:09:89:42:fd:a0:42:b4:9d:89: + 51:55:29:cf:1b:70:bc:84:54:ad:c1:13:1f:98:f4: + 2e:76:60:8b:5d:3f:9a:ad:ca:0c:bf:a7:56:5b:8f: + 77:b8:d5:9e:79:49:92:3f:e0:f1:97:24:7a:6c:9b: + 17:0f:6d:ef:53:98:91:2b:e4:0f:be:59:79:07:78: + bb:97:95:f4:9f:69:d4:58:87:0a:a9:e3:cc:b6:58: + 19:9f:26:21:b1:c4:59:8d:b2:41:75:c0:ad:69:ce: + 9c:00:08:f2:36:ff:3e:f0:a1:0f:1a:ac:14:fd:a6: + 60:0f + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + D9:37:B3:4E:05:FD:D9:CF:9F:12:16:AE:B6:89:2F:EB:25:3A:88:1C + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: sha1WithRSAEncryption + 72:60:96:b7:c9:dc:d8:29:5e:23:85:5f:b2:b3:2d:76:fb:88: + d7:17:fe:7b:6d:45:b8:f6:85:6c:9f:22:fc:2a:10:22:ec:aa: + b9:30:f6:ab:58:d6:39:10:31:99:29:00:bd:89:66:41:fb:74: + de:91:c1:18:0b:9f:b5:61:cb:9d:3a:be:f5:a8:94:a3:22:55: + 6e:17:49:ff:d2:29:f1:38:26:5d:ef:a5:aa:3a:f9:71:7b:e6: + da:58:1d:d3:74:c2:01:fa:3e:69:58:5f:ad:cb:68:be:14:2e: + 9b:6c:c0:b6:dc:a0:26:fa:77:1a:e2:24:da:1a:37:e0:67:ad: + d1:73:83:0d:a5:1a:1d:6e:12:92:7e:84:62:00:17:bd:bc:25: + 18:57:f2:d7:a9:6f:59:88:bc:34:b7:2e:85:78:9d:96:dc:14: + c3:2c:8a:52:9b:96:8c:52:66:3d:86:16:8b:47:b8:51:09:8c: + ea:7d:cd:88:72:b3:60:33:b1:f0:0a:44:ef:0f:f5:09:37:88: + 24:0e:2c:6b:20:3a:a2:fa:11:f2:40:35:9c:44:68:63:3b:ac: + 33:6f:63:bc:2c:bb:f2:d2:cb:76:7d:7d:88:d8:1d:c8:05:1d: + 6e:bc:94:a9:66:8c:77:71:c7:fa:91:fa:2f:51:9e:e9:39:52: + b6:e7:04:42 +-----BEGIN CERTIFICATE----- +MIIEPDCCAySgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvjE/MD0GA1UEAww2VMOc +UktUUlVTVCBFbGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sx +c8SxMQswCQYDVQQGEwJUUjEPMA0GA1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xS +S1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnEn2kg +SGl6bWV0bGVyaSBBLsWeLiAoYykgS2FzxLFtIDIwMDUwHhcNMDUxMTA3MTAwNzU3 +WhcNMTUwOTE2MTAwNzU3WjCBvjE/MD0GA1UEAww2VMOcUktUUlVTVCBFbGVrdHJv +bmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJU +UjEPMA0GA1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xSS1RSVVNUIEJpbGdpIMSw +bGV0acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWe +LiAoYykgS2FzxLFtIDIwMDUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB +AQCpNn7DkUNMwxmYCMjHWHtPFoylzkkBH3MOrHUTpvqeLCDe2JAOCtFp0if7qnef +J1Il4std2NiDUBd9irWCPwSOtNXwSadktx4uXyCcUHVPr+G1QRT0mJKIx+XlZEdh +R3n9wFHxwZnn3M5q+6+1ATDcRhzviuyV79z/rxAc653YsKpqhRgNF8k+v/Gb0AmJ +Qv2gQrSdiVFVKc8bcLyEVK3BEx+Y9C52YItdP5qtygy/p1Zbj3e41Z55SZI/4PGX +JHpsmxcPbe9TmJEr5A++WXkHeLuXlfSfadRYhwqp48y2WBmfJiGxxFmNskF1wK1p +zpwACPI2/z7woQ8arBT9pmAPAgMBAAGjQzBBMB0GA1UdDgQWBBTZN7NOBf3Zz58S +Fq62iS/rJTqIHDAPBgNVHQ8BAf8EBQMDBwYAMA8GA1UdEwEB/wQFMAMBAf8wDQYJ +KoZIhvcNAQEFBQADggEBAHJglrfJ3NgpXiOFX7KzLXb7iNcX/nttRbj2hWyfIvwq +ECLsqrkw9qtY1jkQMZkpAL2JZkH7dN6RwRgLn7Vhy506vvWolKMiVW4XSf/SKfE4 +Jl3vpao6+XF75tpYHdN0wgH6PmlYX63LaL4ULptswLbcoCb6dxriJNoaN+BnrdFz +gw2lGh1uEpJ+hGIAF728JRhX8tepb1mIvDS3LoV4nZbcFMMsilKbloxSZj2GFotH +uFEJjOp9zYhys2AzsfAKRO8P9Qk3iCQOLGsgOqL6EfJANZxEaGM7rDNvY7wsu/LS +y3Z9fYjYHcgFHW68lKlmjHdxx/qR+i9Rnuk5UrbnBEI= +-----END CERTIFICATE----- + +SwissSign Platinum CA - G2 +========================== + +MD5 Fingerprint=C9:98:27:77:28:1E:3D:0E:15:3C:84:00:B8:85:03:E6 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 4e:b2:00:67:0c:03:5d:4f + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=CH, O=SwissSign AG, CN=SwissSign Platinum CA - G2 + Validity + Not Before: Oct 25 08:36:00 2006 GMT + Not After : Oct 25 08:36:00 2036 GMT + Subject: C=CH, O=SwissSign AG, CN=SwissSign Platinum CA - G2 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (4096 bit) + Modulus (4096 bit): + 00:ca:df:a2:02:e2:da:f8:fc:07:16:b1:de:60:aa: + de:96:5c:64:1f:c7:2f:7e:cf:67:fa:44:42:d6:76: + 63:95:ae:eb:af:72:20:8a:45:47:86:62:78:86:d6: + 20:39:26:f4:ae:a3:fd:23:e7:a5:9c:b5:22:21:19: + b7:37:93:22:c0:50:9c:82:7b:d4:d5:04:44:5c:cb: + b4:c2:9f:92:be:24:d8:7b:67:22:e2:69:5f:e5:05: + 78:d4:87:d9:71:70:33:25:53:b4:87:3b:29:90:28: + 36:9a:55:44:30:68:a4:83:97:7f:0d:1e:9c:76:ff: + 15:9d:60:97:00:8d:8a:85:03:ec:80:be:ea:2c:6e: + 10:51:92:cc:7e:d5:a3:33:d8:d6:49:de:58:2a:af: + f6:16:eb:4b:7b:90:32:97:b9:ba:9d:58:f1:f8:57: + 49:04:1e:a2:5d:06:70:dd:71:db:f9:dd:8b:9a:1b: + 8c:cf:3d:a3:4d:ce:cb:7c:f6:bb:9c:a0:fa:09:ce: + 23:62:b2:e9:0d:1f:e2:72:28:8f:9f:ac:68:20:7d: + 6f:3b:a8:85:31:09:7f:0b:c7:e8:65:e9:e3:78:0e: + 09:67:30:8b:34:82:fb:5d:e0:cc:9d:81:6d:62:ee: + 08:1e:04:2c:4e:9b:ec:fe:a9:4f:5f:fd:69:78:ef: + 09:1f:a1:b4:bf:fa:f3:ef:90:1e:4c:05:8b:1e:ea: + 7a:91:7a:c3:d7:e5:fb:30:bc:6c:1b:10:58:98:f7: + 1a:5f:d0:29:32:03:13:46:4d:61:6a:85:4c:52:74: + 2f:06:1f:7b:11:e2:84:97:c6:99:f3:6d:7f:d7:67: + 83:7e:13:68:d8:71:28:5a:d8:ce:dd:e8:10:14:9a: + fe:6d:23:87:6e:8e:5a:70:3c:d5:8d:09:00:a7:aa: + bc:b0:31:37:6d:c8:84:14:1e:5b:bd:45:63:20:6b: + 4b:74:8c:bd:db:3a:0e:c1:cf:5a:16:8f:a5:98:f2: + 76:89:b2:13:12:3b:0b:77:77:ac:bb:e5:3c:29:4a: + 92:72:ca:61:1a:2b:5e:4c:e2:83:74:77:fa:35:48: + 7a:85:4d:8d:9a:53:c4:df:78:ca:97:91:48:2b:45: + 2b:01:f7:1c:1a:a2:ed:18:ba:0a:bd:83:fa:6f:bc: + 8d:57:93:3b:d4:d4:a6:ce:1e:f1:a0:b1:ce:ab:fd: + 2b:28:9a:4f:1b:d7:c3:72:db:a4:c4:bf:5d:4c:f5: + dd:7b:96:69:ee:68:80:e6:e7:98:ba:36:b7:fe:6e: + ed:2b:bd:20:f8:65:19:da:55:09:7e:25:dc:fe:61: + 62:72:f9:7e:18:02:ef:63:b4:d0:fb:af:e5:3b:63: + 8c:67:8f + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 50:AF:CC:07:87:15:47:6F:38:C5:B4:65:D1:DE:95:AA:E9:DF:9C:CC + X509v3 Authority Key Identifier: + keyid:50:AF:CC:07:87:15:47:6F:38:C5:B4:65:D1:DE:95:AA:E9:DF:9C:CC + + X509v3 Certificate Policies: + Policy: 2.16.756.1.89.1.1.1.1 + CPS: http://repository.swisssign.com/ + + Signature Algorithm: sha1WithRSAEncryption + 08:85:a6:f5:16:0c:fc:44:1a:c1:63:e0:f9:55:46:08:fc:70: + 1c:42:28:96:8e:b7:c5:c1:41:75:4e:09:71:79:e5:6d:96:ca: + 4b:a5:88:60:d0:30:74:b8:ca:08:dc:b4:30:9e:40:07:16:6b: + 65:95:77:01:ae:a4:b7:35:0b:81:da:71:15:a9:74:17:38:7b: + 58:ca:f9:2f:fb:c0:65:76:8d:5b:01:b9:7d:de:82:3d:64:b8: + be:14:74:a3:0a:54:d3:2c:95:18:17:35:f5:51:6b:3f:8f:a2: + 96:61:39:78:6b:4b:e5:a6:a0:f8:53:df:51:10:93:62:e7:80: + 2f:e2:d1:e0:bc:8e:36:46:77:33:ec:b8:fb:8e:9a:2c:89:4d: + 31:11:0f:26:9e:04:bb:b7:04:8d:0b:f2:b9:fc:5a:9d:3b:16: + b7:2f:c8:98:ab:fe:8a:50:59:2e:a3:3b:fc:29:5d:8b:c1:4b: + c9:e2:8a:13:1d:b1:bf:bb:42:1d:52:dd:4e:d8:14:5e:10:c6: + 31:07:ef:71:27:f7:1b:39:09:dc:82:ea:8b:b3:95:86:5e:fd: + f5:da:5d:31:a6:e0:31:b6:94:e6:44:49:74:c5:16:e5:f7:1f: + 03:61:28:c5:c8:cb:12:a0:42:4b:f9:6b:88:08:8d:b4:32:18: + f3:75:9f:c4:7f:00:4f:05:95:9c:a3:17:02:c3:b3:53:9b:aa: + 20:39:29:2b:66:fa:9d:af:5e:b3:92:d2:b5:a6:e1:1a:f9:2d: + 41:69:81:14:b4:b4:b5:ed:89:3d:ce:fb:a9:9d:35:42:44:b1: + 1c:14:73:81:cf:2a:01:35:9a:31:d5:2d:8f:6d:84:df:80:4d: + 57:e3:3f:c5:84:75:da:89:c6:30:bb:eb:8f:cb:22:08:a0:ae: + aa:f1:03:6c:3a:4b:4d:09:a5:0e:72:c6:56:6b:21:42:4e:23: + 25:14:68:ae:76:0a:7c:0c:07:70:64:f9:9a:2f:f6:05:39:26: + c6:0c:8f:19:7f:43:5e:6e:f4:5b:15:2f:db:61:5d:e6:67:2f: + 3f:08:94:f9:60:b4:98:31:da:74:f1:84:93:71:4d:5f:fb:60: + 58:d1:fb:c4:c1:6d:89:a2:bb:20:1f:9d:71:91:cb:32:9b:13: + 3d:3e:7d:92:52:35:ac:92:94:a2:d3:18:c2:7c:c7:ea:af:76: + 05:16:dd:67:27:c2:7e:1c:07:22:21:f3:40:0a:1b:34:07:44: + 13:c2:84:6a:8e:df:19:5a:bf:7f:eb:1d:e2:1a:38:d1:5c:af: + 47:92:6b:80:b5:30:a5:c9:8d:d8:ab:31:81:1f:df:c2:66:37: + d3:93:a9:85:86:79:65:d2 +-----BEGIN CERTIFICATE----- +MIIFwTCCA6mgAwIBAgIITrIAZwwDXU8wDQYJKoZIhvcNAQEFBQAwSTELMAkGA1UE +BhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzEjMCEGA1UEAxMaU3dpc3NTaWdu +IFBsYXRpbnVtIENBIC0gRzIwHhcNMDYxMDI1MDgzNjAwWhcNMzYxMDI1MDgzNjAw +WjBJMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dpc3NTaWduIEFHMSMwIQYDVQQD +ExpTd2lzc1NpZ24gUGxhdGludW0gQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQAD +ggIPADCCAgoCggIBAMrfogLi2vj8Bxax3mCq3pZcZB/HL37PZ/pEQtZ2Y5Wu669y +IIpFR4ZieIbWIDkm9K6j/SPnpZy1IiEZtzeTIsBQnIJ71NUERFzLtMKfkr4k2Htn +IuJpX+UFeNSH2XFwMyVTtIc7KZAoNppVRDBopIOXfw0enHb/FZ1glwCNioUD7IC+ +6ixuEFGSzH7VozPY1kneWCqv9hbrS3uQMpe5up1Y8fhXSQQeol0GcN1x2/ndi5ob +jM89o03Oy3z2u5yg+gnOI2Ky6Q0f4nIoj5+saCB9bzuohTEJfwvH6GXp43gOCWcw +izSC+13gzJ2BbWLuCB4ELE6b7P6pT1/9aXjvCR+htL/68++QHkwFix7qepF6w9fl ++zC8bBsQWJj3Gl/QKTIDE0ZNYWqFTFJ0LwYfexHihJfGmfNtf9dng34TaNhxKFrY +zt3oEBSa/m0jh26OWnA81Y0JAKeqvLAxN23IhBQeW71FYyBrS3SMvds6DsHPWhaP +pZjydomyExI7C3d3rLvlPClKknLKYRorXkzig3R3+jVIeoVNjZpTxN94ypeRSCtF +KwH3HBqi7Ri6Cr2D+m+8jVeTO9TUps4e8aCxzqv9KyiaTxvXw3LbpMS/XUz13XuW +ae5ogObnmLo2t/5u7Su9IPhlGdpVCX4l3P5hYnL5fhgC72O00Puv5TtjjGePAgMB +AAGjgawwgakwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O +BBYEFFCvzAeHFUdvOMW0ZdHelarp35zMMB8GA1UdIwQYMBaAFFCvzAeHFUdvOMW0 +ZdHelarp35zMMEYGA1UdIAQ/MD0wOwYJYIV0AVkBAQEBMC4wLAYIKwYBBQUHAgEW +IGh0dHA6Ly9yZXBvc2l0b3J5LnN3aXNzc2lnbi5jb20vMA0GCSqGSIb3DQEBBQUA +A4ICAQAIhab1Fgz8RBrBY+D5VUYI/HAcQiiWjrfFwUF1TglxeeVtlspLpYhg0DB0 +uMoI3LQwnkAHFmtllXcBrqS3NQuB2nEVqXQXOHtYyvkv+8Bldo1bAbl93oI9ZLi+ +FHSjClTTLJUYFzX1UWs/j6KWYTl4a0vlpqD4U99REJNi54Av4tHgvI42Rncz7Lj7 +jposiU0xEQ8mngS7twSNC/K5/FqdOxa3L8iYq/6KUFkuozv8KV2LwUvJ4ooTHbG/ +u0IdUt1O2BReEMYxB+9xJ/cbOQncguqLs5WGXv312l0xpuAxtpTmREl0xRbl9x8D +YSjFyMsSoEJL+WuICI20MhjzdZ/EfwBPBZWcoxcCw7NTm6ogOSkrZvqdr16zktK1 +puEa+S1BaYEUtLS17Yk9zvupnTVCRLEcFHOBzyoBNZox1S2PbYTfgE1X4z/FhHXa +icYwu+uPyyIIoK6q8QNsOktNCaUOcsZWayFCTiMlFGiudgp8DAdwZPmaL/YFOSbG +DI8Zf0NebvRbFS/bYV3mZy8/CJT5YLSYMdp08YSTcU1f+2BY0fvEwW2JorsgH51x +kcsymxM9Pn2SUjWskpSi0xjCfMfqr3YFFt1nJ8J+HAciIfNAChs0B0QTwoRqjt8Z +Wr9/6x3iGjjRXK9HkmuAtTClyY3YqzGBH9/CZjfTk6mFhnll0g== +-----END CERTIFICATE----- + +SwissSign Gold CA - G2 +====================== + +MD5 Fingerprint=24:77:D9:A8:91:D1:3B:FA:88:2D:C2:FF:F8:CD:33:93 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + bb:40:1c:43:f5:5e:4f:b0 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=CH, O=SwissSign AG, CN=SwissSign Gold CA - G2 + Validity + Not Before: Oct 25 08:30:35 2006 GMT + Not After : Oct 25 08:30:35 2036 GMT + Subject: C=CH, O=SwissSign AG, CN=SwissSign Gold CA - G2 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (4096 bit) + Modulus (4096 bit): + 00:af:e4:ee:7e:8b:24:0e:12:6e:a9:50:2d:16:44: + 3b:92:92:5c:ca:b8:5d:84:92:42:13:2a:bc:65:57: + 82:40:3e:57:24:cd:50:8b:25:2a:b7:6f:fc:ef:a2: + d0:c0:1f:02:24:4a:13:96:8f:23:13:e6:28:58:00: + a3:47:c7:06:a7:84:23:2b:bb:bd:96:2b:7f:55:cc: + 8b:c1:57:1f:0e:62:65:0f:dd:3d:56:8a:73:da:ae: + 7e:6d:ba:81:1c:7e:42:8c:20:35:d9:43:4d:84:fa: + 84:db:52:2c:f3:0e:27:77:0b:6b:bf:11:2f:72:78: + 9f:2e:d8:3e:e6:18:37:5a:2a:72:f9:da:62:90:92: + 95:ca:1f:9c:e9:b3:3c:2b:cb:f3:01:13:bf:5a:cf: + c1:b5:0a:60:bd:dd:b5:99:64:53:b8:a0:96:b3:6f: + e2:26:77:91:8c:e0:62:10:02:9f:34:0f:a4:d5:92: + 33:51:de:be:8d:ba:84:7a:60:3c:6a:db:9f:2b:ec: + de:de:01:3f:6e:4d:e5:50:86:cb:b4:af:ed:44:40: + c5:ca:5a:8c:da:d2:2b:7c:a8:ee:be:a6:e5:0a:aa: + 0e:a5:df:05:52:b7:55:c7:22:5d:32:6a:97:97:63: + 13:db:c9:db:79:36:7b:85:3a:4a:c5:52:89:f9:24: + e7:9d:77:a9:82:ff:55:1c:a5:71:69:2b:d1:02:24: + f2:b3:26:d4:6b:da:04:55:e5:c1:0a:c7:6d:30:37: + 90:2a:e4:9e:14:33:5e:16:17:55:c5:5b:b5:cb:34: + 89:92:f1:9d:26:8f:a1:07:d4:c6:b2:78:50:db:0c: + 0c:0b:7c:0b:8c:41:d7:b9:e9:dd:8c:88:f7:a3:4d: + b2:32:cc:d8:17:da:cd:b7:ce:66:9d:d4:fd:5e:ff: + bd:97:3e:29:75:e7:7e:a7:62:58:af:25:34:a5:41: + c7:3d:bc:0d:50:ca:03:03:0f:08:5a:1f:95:73:78: + 62:bf:af:72:14:69:0e:a5:e5:03:0e:78:8e:26:28: + 42:f0:07:0b:62:20:10:67:39:46:fa:a9:03:cc:04: + 38:7a:66:ef:20:83:b5:8c:4a:56:8e:91:00:fc:8e: + 5c:82:de:88:a0:c3:e2:68:6e:7d:8d:ef:3c:dd:65: + f4:5d:ac:51:ef:24:80:ae:aa:56:97:6f:f9:ad:7d: + da:61:3f:98:77:3c:a5:91:b6:1c:8c:26:da:65:a2: + 09:6d:c1:e2:54:e3:b9:ca:4c:4c:80:8f:77:7b:60: + 9a:1e:df:b6:f2:48:1e:0e:ba:4e:54:6d:98:e0:e1: + a2:1a:a2:77:50:cf:c4:63:92:ec:47:19:9d:eb:e6: + 6b:ce:c1 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 5B:25:7B:96:A4:65:51:7E:B8:39:F3:C0:78:66:5E:E8:3A:E7:F0:EE + X509v3 Authority Key Identifier: + keyid:5B:25:7B:96:A4:65:51:7E:B8:39:F3:C0:78:66:5E:E8:3A:E7:F0:EE + + X509v3 Certificate Policies: + Policy: 2.16.756.1.89.1.2.1.1 + CPS: http://repository.swisssign.com/ + + Signature Algorithm: sha1WithRSAEncryption + 27:ba:e3:94:7c:f1:ae:c0:de:17:e6:e5:d8:d5:f5:54:b0:83: + f4:bb:cd:5e:05:7b:4f:9f:75:66:af:3c:e8:56:7e:fc:72:78: + 38:03:d9:2b:62:1b:00:b9:f8:e9:60:cd:cc:ce:51:8a:c7:50: + 31:6e:e1:4a:7e:18:2f:69:59:b6:3d:64:81:2b:e3:83:84:e6: + 22:87:8e:7d:e0:ee:02:99:61:b8:1e:f4:b8:2b:88:12:16:84: + c2:31:93:38:96:31:a6:b9:3b:53:3f:c3:24:93:56:5b:69:92: + ec:c5:c1:bb:38:00:e3:ec:17:a9:b8:dc:c7:7c:01:83:9f:32: + 47:ba:52:22:34:1d:32:7a:09:56:a7:7c:25:36:a9:3d:4b:da: + c0:82:6f:0a:bb:12:c8:87:4b:27:11:f9:1e:2d:c7:93:3f:9e: + db:5f:26:6b:52:d9:2e:8a:f1:14:c6:44:8d:15:a9:b7:bf:bd: + de:a6:1a:ee:ae:2d:fb:48:77:17:fe:bb:ec:af:18:f5:2a:51: + f0:39:84:97:95:6c:6e:1b:c3:2b:c4:74:60:79:25:b0:0a:27: + df:df:5e:d2:39:cf:45:7d:42:4b:df:b3:2c:1e:c5:c6:5d:ca: + 55:3a:a0:9c:69:9a:8f:da:ef:b2:b0:3c:9f:87:6c:12:2b:65: + 70:15:52:31:1a:24:cf:6f:31:23:50:1f:8c:4f:8f:23:c3:74: + 41:63:1c:55:a8:14:dd:3e:e0:51:50:cf:f1:1b:30:56:0e:92: + b0:82:85:d8:83:cb:22:64:bc:2d:b8:25:d5:54:a2:b8:06:ea: + ad:92:a4:24:a0:c1:86:b5:4a:13:6a:47:cf:2e:0b:56:95:54: + cb:ce:9a:db:6a:b4:a6:b2:db:41:08:86:27:77:f7:6a:a0:42: + 6c:0b:38:ce:d7:75:50:32:92:c2:df:2b:30:22:48:d0:d5:41: + 38:25:5d:a4:e9:5d:9f:c6:94:75:d0:45:fd:30:97:43:8f:90: + ab:0a:c7:86:73:60:4a:69:2d:de:a5:78:d7:06:da:6a:9e:4b: + 3e:77:3a:20:13:22:01:d0:bf:68:9e:63:60:6b:35:4d:0b:6d: + ba:a1:3d:c0:93:e0:7f:23:b3:55:ad:72:25:4e:46:f9:d2:16: + ef:b0:64:c1:01:9e:e9:ca:a0:6a:98:0e:cf:d8:60:f2:2f:49: + b8:e4:42:e1:38:35:16:f4:c8:6e:4f:f7:81:56:e8:ba:a3:be: + 23:af:ae:fd:6f:03:e0:02:3b:30:76:fa:1b:6d:41:cf:01:b1: + e9:b8:c9:66:f4:db:26:f3:3a:a4:74:f2:49:24:5b:c9:b0:d0: + 57:c1:fa:3e:7a:e1:97:c9 +-----BEGIN CERTIFICATE----- +MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV +BAYTAkNIMRUwEwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2ln +biBHb2xkIENBIC0gRzIwHhcNMDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBF +MQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dpc3NTaWduIEFHMR8wHQYDVQQDExZT +d2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC +CgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUqt2/8 +76LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+ +bbqBHH5CjCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c +6bM8K8vzARO/Ws/BtQpgvd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqE +emA8atufK+ze3gE/bk3lUIbLtK/tREDFylqM2tIrfKjuvqblCqoOpd8FUrdVxyJd +MmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvRAiTysybUa9oEVeXBCsdt +MDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuendjIj3o02y +MszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69y +FGkOpeUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPi +aG59je883WX0XaxR7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxM +gI93e2CaHt+28kgeDrpOVG2Y4OGiGqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCB +qTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUWyV7 +lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64OfPAeGZe6Drn +8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov +L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe6 +45R88a7A3hfm5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczO +UYrHUDFu4Up+GC9pWbY9ZIEr44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5 +O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOfMke6UiI0HTJ6CVanfCU2qT1L2sCC +bwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6mGu6uLftIdxf+u+yv +GPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxpmo/a +77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCC +hdiDyyJkvC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid3 +92qgQmwLOM7XdVAyksLfKzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEpp +Ld6leNcG2mqeSz53OiATIgHQv2ieY2BrNU0LbbqhPcCT4H8js1WtciVORvnSFu+w +ZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6LqjviOvrv1vA+ACOzB2+htt +Qc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ +-----END CERTIFICATE----- + +SwissSign Silver CA - G2 +======================== + +MD5 Fingerprint=E0:06:A1:C9:7D:CF:C9:FC:0D:C0:56:75:96:D8:62:13 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 4f:1b:d4:2f:54:bb:2f:4b + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=CH, O=SwissSign AG, CN=SwissSign Silver CA - G2 + Validity + Not Before: Oct 25 08:32:46 2006 GMT + Not After : Oct 25 08:32:46 2036 GMT + Subject: C=CH, O=SwissSign AG, CN=SwissSign Silver CA - G2 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (4096 bit) + Modulus (4096 bit): + 00:c4:f1:87:7f:d3:78:31:f7:38:c9:f8:c3:99:43: + bc:c7:f7:bc:37:e7:4e:71:ba:4b:8f:a5:73:1d:5c: + 6e:98:ae:03:57:ae:38:37:43:2f:17:3d:1f:c8:ce: + 68:10:c1:78:ae:19:03:2b:10:fa:2c:79:83:f6:e8: + b9:68:b9:55:f2:04:44:a7:39:f9:fc:04:8b:1e:f1: + a2:4d:27:f9:61:7b:ba:b7:e5:a2:13:b6:eb:61:3e: + d0:6c:d1:e6:fb:fa:5e:ed:1d:b4:9e:a0:35:5b:a1: + 92:cb:f0:49:92:fe:85:0a:05:3e:e6:d9:0b:e2:4f: + bb:dc:95:37:fc:91:e9:32:35:22:d1:1f:3a:4e:27: + 85:9d:b0:15:94:32:da:61:0d:47:4d:60:42:ae:92: + 47:e8:83:5a:50:58:e9:8a:8b:b9:5d:a1:dc:dd:99: + 4a:1f:36:67:bb:48:e4:83:b6:37:eb:48:3a:af:0f: + 67:8f:17:07:e8:04:ca:ef:6a:31:87:d4:c0:b6:f9: + 94:71:7b:67:64:b8:b6:91:4a:42:7b:65:2e:30:6a: + 0c:f5:90:ee:95:e6:f2:cd:82:ec:d9:a1:4a:ec:f6: + b2:4b:e5:45:85:e6:6d:78:93:04:2e:9c:82:6d:36: + a9:c4:31:64:1f:86:83:0b:2a:f4:35:0a:78:c9:55: + cf:41:b0:47:e9:30:9f:99:be:61:a8:06:84:b9:28: + 7a:5f:38:d9:1b:a9:38:b0:83:7f:73:c1:c3:3b:48: + 2a:82:0f:21:9b:b8:cc:a8:35:c3:84:1b:83:b3:3e: + be:a4:95:69:01:3a:89:00:78:04:d9:c9:f4:99:19: + ab:56:7e:5b:8b:86:39:15:91:a4:10:2c:09:32:80: + 60:b3:93:c0:2a:b6:18:0b:9d:7e:8d:49:f2:10:4a: + 7f:f9:d5:46:2f:19:92:a3:99:a7:26:ac:bb:8c:3c: + e6:0e:bc:47:07:dc:73:51:f1:70:64:2f:08:f9:b4: + 47:1d:30:6c:44:ea:29:37:85:92:68:66:bc:83:38: + fe:7b:39:2e:d3:50:f0:1f:fb:5e:60:b6:a9:a6:fa: + 27:41:f1:9b:18:72:f2:f5:84:74:4a:c9:67:c4:54: + ae:48:64:df:8c:d1:6e:b0:1d:e1:07:8f:08:1e:99: + 9c:71:e9:4c:d8:a5:f7:47:12:1f:74:d1:51:9e:86: + f3:c2:a2:23:40:0b:73:db:4b:a6:e7:73:06:8c:c1: + a0:e9:c1:59:ac:46:fa:e6:2f:f8:cf:71:9c:46:6d: + b9:c4:15:8d:38:79:03:45:48:ef:c4:5d:d7:08:ee: + 87:39:22:86:b2:0d:0f:58:43:f7:71:a9:48:2e:fd: + ea:d6:1f + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 17:A0:CD:C1:E4:41:B6:3A:5B:3B:CB:45:9D:BD:1C:C2:98:FA:86:58 + X509v3 Authority Key Identifier: + keyid:17:A0:CD:C1:E4:41:B6:3A:5B:3B:CB:45:9D:BD:1C:C2:98:FA:86:58 + + X509v3 Certificate Policies: + Policy: 2.16.756.1.89.1.3.1.1 + CPS: http://repository.swisssign.com/ + + Signature Algorithm: sha1WithRSAEncryption + 73:c6:81:e0:27:d2:2d:0f:e0:95:30:e2:9a:41:7f:50:2c:5f: + 5f:62:61:a9:86:6a:69:18:0c:74:49:d6:5d:84:ea:41:52:18: + 6f:58:ad:50:56:20:6a:c6:bd:28:69:58:91:dc:91:11:35:a9: + 3a:1d:bc:1a:a5:60:9e:d8:1f:7f:45:91:69:d9:7e:bb:78:72: + c1:06:0f:2a:ce:8f:85:70:61:ac:a0:cd:0b:b8:39:29:56:84: + 32:4e:86:bb:3d:c4:2a:d9:d7:1f:72:ee:fe:51:a1:22:41:b1: + 71:02:63:1a:82:b0:62:ab:5e:57:12:1f:df:cb:dd:75:a0:c0: + 5d:79:90:8c:1b:e0:50:e6:de:31:fe:98:7b:70:5f:a5:90:d8: + ad:f8:02:b6:6f:d3:60:dd:40:4b:22:c5:3d:ad:3a:7a:9f:1a: + 1a:47:91:79:33:ba:82:dc:32:69:03:96:6e:1f:4b:f0:71:fe: + e3:67:72:a0:b1:bf:5c:8b:e4:fa:99:22:c7:84:b9:1b:8d:23: + 97:3f:ed:25:e0:cf:65:bb:f5:61:04:ef:dd:1e:b2:5a:41:22: + 5a:a1:9f:5d:2c:e8:5b:c9:6d:a9:0c:0c:78:aa:60:c6:56:8f: + 01:5a:0c:68:bc:69:19:79:c4:1f:7e:97:05:bf:c5:e9:24:51: + 5e:d4:d5:4b:53:ed:d9:23:5a:36:03:65:a3:c1:03:ad:41:30: + f3:46:1b:85:90:af:65:b5:d5:b1:e4:16:5b:78:75:1d:97:7a: + 6d:59:a9:2a:8f:7b:de:c3:87:89:10:99:49:73:78:c8:3d:bd: + 51:35:74:2a:d5:f1:7e:69:1b:2a:bb:3b:bd:25:b8:9a:5a:3d: + 72:61:90:66:87:ee:0c:d6:4d:d4:11:74:0b:6a:fe:0b:03:fc: + a3:55:57:89:fe:4a:cb:ae:5b:17:05:c8:f2:8d:23:31:53:38: + d2:2d:6a:3f:82:b9:8d:08:6a:f7:5e:41:74:6e:c3:11:7e:07: + ac:29:60:91:3f:38:ca:57:10:0d:bd:30:2f:c7:a5:e6:41:a0: + da:ae:05:87:9a:a0:a4:65:6c:4c:09:0c:89:ba:b8:d3:b9:c0: + 93:8a:30:fa:8d:e5:9a:6b:15:01:4e:67:aa:da:62:56:3e:84: + 08:66:d2:c4:36:7d:a7:3e:10:fc:88:e0:d4:80:e5:00:bd:aa: + f3:4e:06:a3:7a:6a:f9:62:72:e3:09:4f:eb:9b:0e:01:23:f1: + 9f:bb:7c:dc:dc:6c:11:97:25:b2:f2:b4:63:14:d2:06:2a:67: + 8c:83:f5:ce:ea:07:d8:9a:6a:1e:ec:e4:0a:bb:2a:4c:eb:09: + 60:39:ce:ca:62:d8:2e:6e +-----BEGIN CERTIFICATE----- +MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UE +BhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWdu +IFNpbHZlciBDQSAtIEcyMB4XDTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0Nlow +RzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMY +U3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A +MIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644N0Mv +Fz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7br +YT7QbNHm+/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieF +nbAVlDLaYQ1HTWBCrpJH6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH +6ATK72oxh9TAtvmUcXtnZLi2kUpCe2UuMGoM9ZDulebyzYLs2aFK7PayS+VFheZt +eJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5hqAaEuSh6XzjZG6k4sIN/ +c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5FZGkECwJ +MoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRH +HTBsROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTf +jNFusB3hB48IHpmccelM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb6 +5i/4z3GcRm25xBWNOHkDRUjvxF3XCO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOB +rDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU +F6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRBtjpbO8tFnb0c +wpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0 +cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIB +AHPGgeAn0i0P4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShp +WJHckRE1qTodvBqlYJ7YH39FkWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9 +xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L3XWgwF15kIwb4FDm3jH+mHtwX6WQ +2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx/uNncqCxv1yL5PqZ +IseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFaDGi8 +aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2X +em1ZqSqPe97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQR +dAtq/gsD/KNVV4n+SsuuWxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/ +OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJDIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+ +hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ubDgEj8Z+7fNzcbBGXJbLy +tGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u +-----END CERTIFICATE----- + +GeoTrust Primary Certification Authority +======================================== + +MD5 Fingerprint=02:26:C3:01:5E:08:30:37:43:A9:D0:7D:CF:37:E6:BF +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 18:ac:b5:6a:fd:69:b6:15:3a:63:6c:af:da:fa:c4:a1 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=GeoTrust Inc., CN=GeoTrust Primary Certification Authority + Validity + Not Before: Nov 27 00:00:00 2006 GMT + Not After : Jul 16 23:59:59 2036 GMT + Subject: C=US, O=GeoTrust Inc., CN=GeoTrust Primary Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:be:b8:15:7b:ff:d4:7c:7d:67:ad:83:64:7b:c8: + 42:53:2d:df:f6:84:08:20:61:d6:01:59:6a:9c:44: + 11:af:ef:76:fd:95:7e:ce:61:30:bb:7a:83:5f:02: + bd:01:66:ca:ee:15:8d:6f:a1:30:9c:bd:a1:85:9e: + 94:3a:f3:56:88:00:31:cf:d8:ee:6a:96:02:d9:ed: + 03:8c:fb:75:6d:e7:ea:b8:55:16:05:16:9a:f4:e0: + 5e:b1:88:c0:64:85:5c:15:4d:88:c7:b7:ba:e0:75: + e9:ad:05:3d:9d:c7:89:48:e0:bb:28:c8:03:e1:30: + 93:64:5e:52:c0:59:70:22:35:57:88:8a:f1:95:0a: + 83:d7:bc:31:73:01:34:ed:ef:46:71:e0:6b:02:a8: + 35:72:6b:97:9b:66:e0:cb:1c:79:5f:d8:1a:04:68: + 1e:47:02:e6:9d:60:e2:36:97:01:df:ce:35:92:df: + be:67:c7:6d:77:59:3b:8f:9d:d6:90:15:94:bc:42: + 34:10:c1:39:f9:b1:27:3e:7e:d6:8a:75:c5:b2:af: + 96:d3:a2:de:9b:e4:98:be:7d:e1:e9:81:ad:b6:6f: + fc:d7:0e:da:e0:34:b0:0d:1a:77:e7:e3:08:98:ef: + 58:fa:9c:84:b7:36:af:c2:df:ac:d2:f4:10:06:70: + 71:35 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Subject Key Identifier: + 2C:D5:50:41:97:15:8B:F0:8F:36:61:5B:4A:FB:6B:D9:99:C9:33:92 + Signature Algorithm: sha1WithRSAEncryption + 5a:70:7f:2c:dd:b7:34:4f:f5:86:51:a9:26:be:4b:b8:aa:f1: + 71:0d:dc:61:c7:a0:ea:34:1e:7a:77:0f:04:35:e8:27:8f:6c: + 90:bf:91:16:24:46:3e:4a:4e:ce:2b:16:d5:0b:52:1d:fc:1f: + 67:a2:02:45:31:4f:ce:f3:fa:03:a7:79:9d:53:6a:d9:da:63: + 3a:f8:80:d7:d3:99:e1:a5:e1:be:d4:55:71:98:35:3a:be:93: + ea:ae:ad:42:b2:90:6f:e0:fc:21:4d:35:63:33:89:49:d6:9b: + 4e:ca:c7:e7:4e:09:00:f7:da:c7:ef:99:62:99:77:b6:95:22: + 5e:8a:a0:ab:f4:b8:78:98:ca:38:19:99:c9:72:9e:78:cd:4b: + ac:af:19:a0:73:12:2d:fc:c2:41:ba:81:91:da:16:5a:31:b7: + f9:b4:71:80:12:48:99:72:73:5a:59:53:c1:63:52:33:ed:a7: + c9:d2:39:02:70:fa:e0:b1:42:66:29:aa:9b:51:ed:30:54:22: + 14:5f:d9:ab:1d:c1:e4:94:f0:f8:f5:2b:f7:ea:ca:78:46:d6: + b8:91:fd:a6:0d:2b:1a:14:01:3e:80:f0:42:a0:95:07:5e:6d: + cd:cc:4b:a4:45:8d:ab:12:e8:b3:de:5a:e5:a0:7c:e8:0f:22: + 1d:5a:e9:59 +-----BEGIN CERTIFICATE----- +MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBY +MQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMo +R2VvVHJ1c3QgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjEx +MjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgxCzAJBgNVBAYTAlVTMRYwFAYDVQQK +Ew1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQcmltYXJ5IENlcnRp +ZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC +AQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9 +AWbK7hWNb6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjA +ZIVcFU2Ix7e64HXprQU9nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE0 +7e9GceBrAqg1cmuXm2bgyxx5X9gaBGgeRwLmnWDiNpcB3841kt++Z8dtd1k7j53W +kBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGttm/81w7a4DSwDRp35+MI +mO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4G +A1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJ +KoZIhvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ1 +6CePbJC/kRYkRj5KTs4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl +4b7UVXGYNTq+k+qurUKykG/g/CFNNWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6K +oKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHaFloxt/m0cYASSJlyc1pZU8Fj +UjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG1riR/aYNKxoU +AT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk= +-----END CERTIFICATE----- + +thawte Primary Root CA +====================== + +MD5 Fingerprint=8C:CA:DC:0B:22:CE:F5:BE:72:AC:41:1A:11:A8:D8:12 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 34:4e:d5:57:20:d5:ed:ec:49:f4:2f:ce:37:db:2b:6d + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=thawte, Inc., OU=Certification Services Division, OU=(c) 2006 thawte, Inc. - For authorized use only, CN=thawte Primary Root CA + Validity + Not Before: Nov 17 00:00:00 2006 GMT + Not After : Jul 16 23:59:59 2036 GMT + Subject: C=US, O=thawte, Inc., OU=Certification Services Division, OU=(c) 2006 thawte, Inc. - For authorized use only, CN=thawte Primary Root CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:ac:a0:f0:fb:80:59:d4:9c:c7:a4:cf:9d:a1:59: + 73:09:10:45:0c:0d:2c:6e:68:f1:6c:5b:48:68:49: + 59:37:fc:0b:33:19:c2:77:7f:cc:10:2d:95:34:1c: + e6:eb:4d:09:a7:1c:d2:b8:c9:97:36:02:b7:89:d4: + 24:5f:06:c0:cc:44:94:94:8d:02:62:6f:eb:5a:dd: + 11:8d:28:9a:5c:84:90:10:7a:0d:bd:74:66:2f:6a: + 38:a0:e2:d5:54:44:eb:1d:07:9f:07:ba:6f:ee:e9: + fd:4e:0b:29:f5:3e:84:a0:01:f1:9c:ab:f8:1c:7e: + 89:a4:e8:a1:d8:71:65:0d:a3:51:7b:ee:bc:d2:22: + 60:0d:b9:5b:9d:df:ba:fc:51:5b:0b:af:98:b2:e9: + 2e:e9:04:e8:62:87:de:2b:c8:d7:4e:c1:4c:64:1e: + dd:cf:87:58:ba:4a:4f:ca:68:07:1d:1c:9d:4a:c6: + d5:2f:91:cc:7c:71:72:1c:c5:c0:67:eb:32:fd:c9: + 92:5c:94:da:85:c0:9b:bf:53:7d:2b:09:f4:8c:9d: + 91:1f:97:6a:52:cb:de:09:36:a4:77:d8:7b:87:50: + 44:d5:3e:6e:29:69:fb:39:49:26:1e:09:a5:80:7b: + 40:2d:eb:e8:27:85:c9:fe:61:fd:7e:e6:7c:97:1d: + d5:9d + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Subject Key Identifier: + 7B:5B:45:CF:AF:CE:CB:7A:FD:31:92:1A:6A:B6:F3:46:EB:57:48:50 + Signature Algorithm: sha1WithRSAEncryption + 79:11:c0:4b:b3:91:b6:fc:f0:e9:67:d4:0d:6e:45:be:55:e8: + 93:d2:ce:03:3f:ed:da:25:b0:1d:57:cb:1e:3a:76:a0:4c:ec: + 50:76:e8:64:72:0c:a4:a9:f1:b8:8b:d6:d6:87:84:bb:32:e5: + 41:11:c0:77:d9:b3:60:9d:eb:1b:d5:d1:6e:44:44:a9:a6:01: + ec:55:62:1d:77:b8:5c:8e:48:49:7c:9c:3b:57:11:ac:ad:73: + 37:8e:2f:78:5c:90:68:47:d9:60:60:e6:fc:07:3d:22:20:17: + c4:f7:16:e9:c4:d8:72:f9:c8:73:7c:df:16:2f:15:a9:3e:fd: + 6a:27:b6:a1:eb:5a:ba:98:1f:d5:e3:4d:64:0a:9d:13:c8:61: + ba:f5:39:1c:87:ba:b8:bd:7b:22:7f:f6:fe:ac:40:79:e5:ac: + 10:6f:3d:8f:1b:79:76:8b:c4:37:b3:21:18:84:e5:36:00:eb: + 63:20:99:b9:e9:fe:33:04:bb:41:c8:c1:02:f9:44:63:20:9e: + 81:ce:42:d3:d6:3f:2c:76:d3:63:9c:59:dd:8f:a6:e1:0e:a0: + 2e:41:f7:2e:95:47:cf:bc:fd:33:f3:f6:0b:61:7e:7e:91:2b: + 81:47:c2:27:30:ee:a7:10:5d:37:8f:5c:39:2b:e4:04:f0:7b: + 8d:56:8c:68 +-----BEGIN CERTIFICATE----- +MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCB +qTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMf +Q2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIw +MDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNV +BAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3MDAwMDAwWhcNMzYw +NzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5j +LjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYG +A1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl +IG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCsoPD7gFnUnMekz52hWXMJEEUMDSxuaPFs +W0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ1CRfBsDMRJSUjQJib+ta +3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGcq/gcfomk +6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6 +Sk/KaAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94J +NqR32HuHUETVPm4pafs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBA +MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XP +r87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUFAAOCAQEAeRHAS7ORtvzw6WfU +DW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeEuzLlQRHAd9mz +YJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX +xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2 +/qxAeeWsEG89jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/ +LHbTY5xZ3Y+m4Q6gLkH3LpVHz7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7 +jVaMaA== +-----END CERTIFICATE----- + +VeriSign Class 3 Public Primary Certification Authority - G5 +============================================================ + +MD5 Fingerprint=CB:17:E4:31:67:3E:E2:09:FE:45:57:93:F3:0A:FA:1C +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 18:da:d1:9e:26:7d:e8:bb:4a:21:58:cd:cc:6b:3b:4a + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 2006 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 3 Public Primary Certification Authority - G5 + Validity + Not Before: Nov 8 00:00:00 2006 GMT + Not After : Jul 16 23:59:59 2036 GMT + Subject: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 2006 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 3 Public Primary Certification Authority - G5 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:af:24:08:08:29:7a:35:9e:60:0c:aa:e7:4b:3b: + 4e:dc:7c:bc:3c:45:1c:bb:2b:e0:fe:29:02:f9:57: + 08:a3:64:85:15:27:f5:f1:ad:c8:31:89:5d:22:e8: + 2a:aa:a6:42:b3:8f:f8:b9:55:b7:b1:b7:4b:b3:fe: + 8f:7e:07:57:ec:ef:43:db:66:62:15:61:cf:60:0d: + a4:d8:de:f8:e0:c3:62:08:3d:54:13:eb:49:ca:59: + 54:85:26:e5:2b:8f:1b:9f:eb:f5:a1:91:c2:33:49: + d8:43:63:6a:52:4b:d2:8f:e8:70:51:4d:d1:89:69: + 7b:c7:70:f6:b3:dc:12:74:db:7b:5d:4b:56:d3:96: + bf:15:77:a1:b0:f4:a2:25:f2:af:1c:92:67:18:e5: + f4:06:04:ef:90:b9:e4:00:e4:dd:3a:b5:19:ff:02: + ba:f4:3c:ee:e0:8b:eb:37:8b:ec:f4:d7:ac:f2:f6: + f0:3d:af:dd:75:91:33:19:1d:1c:40:cb:74:24:19: + 21:93:d9:14:fe:ac:2a:52:c7:8f:d5:04:49:e4:8d: + 63:47:88:3c:69:83:cb:fe:47:bd:2b:7e:4f:c5:95: + ae:0e:9d:d4:d1:43:c0:67:73:e3:14:08:7e:e5:3f: + 9f:73:b8:33:0a:cf:5d:3f:34:87:96:8a:ee:53:e8: + 25:15 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + 1.3.6.1.5.5.7.1.12: + 0_.].[0Y0W0U..image/gif0!0.0...+..............k...j.H.,{..0%.#http://logo.verisign.com/vslogo.gif + X509v3 Subject Key Identifier: + 7F:D3:65:A7:C2:DD:EC:BB:F0:30:09:F3:43:39:FA:02:AF:33:31:33 + Signature Algorithm: sha1WithRSAEncryption + 93:24:4a:30:5f:62:cf:d8:1a:98:2f:3d:ea:dc:99:2d:bd:77: + f6:a5:79:22:38:ec:c4:a7:a0:78:12:ad:62:0e:45:70:64:c5: + e7:97:66:2d:98:09:7e:5f:af:d6:cc:28:65:f2:01:aa:08:1a: + 47:de:f9:f9:7c:92:5a:08:69:20:0d:d9:3e:6d:6e:3c:0d:6e: + d8:e6:06:91:40:18:b9:f8:c1:ed:df:db:41:aa:e0:96:20:c9: + cd:64:15:38:81:c9:94:ee:a2:84:29:0b:13:6f:8e:db:0c:dd: + 25:02:db:a4:8b:19:44:d2:41:7a:05:69:4a:58:4f:60:ca:7e: + 82:6a:0b:02:aa:25:17:39:b5:db:7f:e7:84:65:2a:95:8a:bd: + 86:de:5e:81:16:83:2d:10:cc:de:fd:a8:82:2a:6d:28:1f:0d: + 0b:c4:e5:e7:1a:26:19:e1:f4:11:6f:10:b5:95:fc:e7:42:05: + 32:db:ce:9d:51:5e:28:b6:9e:85:d3:5b:ef:a5:7d:45:40:72: + 8e:b7:0e:6b:0e:06:fb:33:35:48:71:b8:9d:27:8b:c4:65:5f: + 0d:86:76:9c:44:7a:f6:95:5c:f6:5d:32:08:33:a4:54:b6:18: + 3f:68:5c:f2:42:4a:85:38:54:83:5f:d1:e8:2c:f2:ac:11:d6: + a8:ed:63:6a +-----BEGIN CERTIFICATE----- +MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCB +yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL +ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJp +U2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxW +ZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0 +aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCByjEL +MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZW +ZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2ln +biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJp +U2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9y +aXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvJAgIKXo1 +nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKzj/i5Vbex +t0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIz +SdhDY2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQG +BO+QueQA5N06tRn/Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+ +rCpSx4/VBEnkjWNHiDxpg8v+R70rfk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/ +NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8E +BAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEwHzAH +BgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy +aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKv +MzEzMA0GCSqGSIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzE +p6B4Eq1iDkVwZMXnl2YtmAl+X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y +5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKEKQsTb47bDN0lAtukixlE0kF6BWlK +WE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiCKm0oHw0LxOXnGiYZ +4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vEZV8N +hnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq +-----END CERTIFICATE----- + +SecureTrust CA +============== + +MD5 Fingerprint=DC:32:C3:A7:6D:25:57:C7:68:09:9D:EA:2D:A9:A2:D1 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 0c:f0:8e:5c:08:16:a5:ad:42:7f:f0:eb:27:18:59:d0 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=SecureTrust Corporation, CN=SecureTrust CA + Validity + Not Before: Nov 7 19:31:18 2006 GMT + Not After : Dec 31 19:40:55 2029 GMT + Subject: C=US, O=SecureTrust Corporation, CN=SecureTrust CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:ab:a4:81:e5:95:cd:f5:f6:14:8e:c2:4f:ca:d4: + e2:78:95:58:9c:41:e1:0d:99:40:24:17:39:91:33: + 66:e9:be:e1:83:af:62:5c:89:d1:fc:24:5b:61:b3: + e0:11:11:41:1c:1d:6e:f0:b8:bb:f8:de:a7:81:ba: + a6:48:c6:9f:1d:bd:be:8e:a9:41:3e:b8:94:ed:29: + 1a:d4:8e:d2:03:1d:03:ef:6d:0d:67:1c:57:d7:06: + ad:ca:c8:f5:fe:0e:af:66:25:48:04:96:0b:5d:a3: + ba:16:c3:08:4f:d1:46:f8:14:5c:f2:c8:5e:01:99: + 6d:fd:88:cc:86:a8:c1:6f:31:42:6c:52:3e:68:cb: + f3:19:34:df:bb:87:18:56:80:26:c4:d0:dc:c0:6f: + df:de:a0:c2:91:16:a0:64:11:4b:44:bc:1e:f6:e7: + fa:63:de:66:ac:76:a4:71:a3:ec:36:94:68:7a:77: + a4:b1:e7:0e:2f:81:7a:e2:b5:72:86:ef:a2:6b:8b: + f0:0f:db:d3:59:3f:ba:72:bc:44:24:9c:e3:73:b3: + f7:af:57:2f:42:26:9d:a9:74:ba:00:52:f2:4b:cd: + 53:7c:47:0b:36:85:0e:66:a9:08:97:16:34:57:c1: + 66:f7:80:e3:ed:70:54:c7:93:e0:2e:28:15:59:87: + ba:bb + Exponent: 65537 (0x10001) + X509v3 extensions: + 1.3.6.1.4.1.311.20.2: + ...C.A + X509v3 Key Usage: + Digital Signature, Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 42:32:B6:16:FA:04:FD:FE:5D:4B:7A:C3:FD:F7:4C:40:1D:5A:43:AF + X509v3 CRL Distribution Points: + URI:http://crl.securetrust.com/STCA.crl + + 1.3.6.1.4.1.311.21.1: + ... + Signature Algorithm: sha1WithRSAEncryption + 30:ed:4f:4a:e1:58:3a:52:72:5b:b5:a6:a3:65:18:a6:bb:51: + 3b:77:e9:9d:ea:d3:9f:5c:e0:45:65:7b:0d:ca:5b:e2:70:50: + b2:94:05:14:ae:49:c7:8d:41:07:12:73:94:7e:0c:23:21:fd: + bc:10:7f:60:10:5a:72:f5:98:0e:ac:ec:b9:7f:dd:7a:6f:5d: + d3:1c:f4:ff:88:05:69:42:a9:05:71:c8:b7:ac:26:e8:2e:b4: + 8c:6a:ff:71:dc:b8:b1:df:99:bc:7c:21:54:2b:e4:58:a2:bb: + 57:29:ae:9e:a9:a3:19:26:0f:99:2e:08:b0:ef:fd:69:cf:99: + 1a:09:8d:e3:a7:9f:2b:c9:36:34:7b:24:b3:78:4c:95:17:a4: + 06:26:1e:b6:64:52:36:5f:60:67:d9:9c:c5:05:74:0b:e7:67: + 23:d2:08:fc:88:e9:ae:8b:7f:e1:30:f4:37:7e:fd:c6:32:da: + 2d:9e:44:30:30:6c:ee:07:de:d2:34:fc:d2:ff:40:f6:4b:f4: + 66:46:06:54:a6:f2:32:0a:63:26:30:6b:9b:d1:dc:8b:47:ba: + e1:b9:d5:62:d0:a2:a0:f4:67:05:78:29:63:1a:6f:04:d6:f8: + c6:4c:a3:9a:b1:37:b4:8d:e5:28:4b:1d:9e:2c:c2:b8:68:bc: + ed:02:ee:31 +-----BEGIN CERTIFICATE----- +MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBI +MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x +FzAVBgNVBAMTDlNlY3VyZVRydXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIz +MTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAeBgNVBAoTF1NlY3VyZVRydXN0IENv +cnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCCASIwDQYJKoZIhvcN +AQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQXOZEz +Zum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO +0gMdA+9tDWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIao +wW8xQmxSPmjL8xk037uHGFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj +7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b01k/unK8RCSc43Oz969XL0Imnal0ugBS +8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmHursCAwEAAaOBnTCBmjAT +BgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB +/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCeg +JYYjaHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGC +NxUBBAMCAQAwDQYJKoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt3 +6Z3q059c4EVlew3KW+JwULKUBRSuSceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/ +3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHfmbx8IVQr5Fiiu1cprp6poxkm +D5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZnMUFdAvnZyPS +CPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR +3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE= +-----END CERTIFICATE----- + +Digital Signature Trust Co. Global CA 3 +======================================= + +MD5 Fingerprint=93:C2:8E:11:7B:D4:F3:03:19:BD:28:75:13:4A:45:4A +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 913232846 (0x366ed3ce) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=Digital Signature Trust Co., OU=DSTCA E2 + Validity + Not Before: Dec 9 19:17:26 1998 GMT + Not After : Dec 9 19:47:26 2018 GMT + Subject: C=US, O=Digital Signature Trust Co., OU=DSTCA E2 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:bf:93:8f:17:92:ef:33:13:18:eb:10:7f:4e:16: + bf:ff:06:8f:2a:85:bc:5e:f9:24:a6:24:88:b6:03: + b7:c1:c3:5f:03:5b:d1:6f:ae:7e:42:ea:66:23:b8: + 63:83:56:fb:28:2d:e1:38:8b:b4:ee:a8:01:e1:ce: + 1c:b6:88:2a:22:46:85:fb:9f:a7:70:a9:47:14:3f: + ce:de:65:f0:a8:71:f7:4f:26:6c:8c:bc:c6:b5:ef: + de:49:27:ff:48:2a:7d:e8:4d:03:cc:c7:b2:52:c6: + 17:31:13:3b:b5:4d:db:c8:c4:f6:c3:0f:24:2a:da: + 0c:9d:e7:91:5b:80:cd:94:9d + Exponent: 3 (0x3) + X509v3 extensions: + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 CRL Distribution Points: + DirName:/C=US/O=Digital Signature Trust Co./OU=DSTCA E2/CN=CRL1 + + X509v3 Private Key Usage Period: + Not Before: Dec 9 19:17:26 1998 GMT, Not After: Dec 9 19:17:26 2018 GMT + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:1E:82:4D:28:65:80:3C:C9:41:6E:AC:35:2E:5A:CB:DE:EE:F8:39:5B + + X509v3 Subject Key Identifier: + 1E:82:4D:28:65:80:3C:C9:41:6E:AC:35:2E:5A:CB:DE:EE:F8:39:5B + X509v3 Basic Constraints: + CA:TRUE + 1.2.840.113533.7.65.0: + 0 +..V4.0.... + Signature Algorithm: sha1WithRSAEncryption + 47:8d:83:ad:62:f2:db:b0:9e:45:22:05:b9:a2:d6:03:0e:38: + 72:e7:9e:fc:7b:e6:93:b6:9a:a5:a2:94:c8:34:1d:91:d1:c5: + d7:f4:0a:25:0f:3d:78:81:9e:0f:b1:67:c4:90:4c:63:dd:5e: + a7:e2:ba:9f:f5:f7:4d:a5:31:7b:9c:29:2d:4c:fe:64:3e:ec: + b6:53:fe:ea:9b:ed:82:db:74:75:4b:07:79:6e:1e:d8:19:83: + 73:de:f5:3e:d0:b5:de:e7:4b:68:7d:43:2e:2a:20:e1:7e:a0: + 78:44:9e:08:f5:98:f9:c7:7f:1b:1b:d6:06:20:02:58:a1:c3: + a2:03 +-----BEGIN CERTIFICATE----- +MIIDKTCCApKgAwIBAgIENm7TzjANBgkqhkiG9w0BAQUFADBGMQswCQYDVQQGEwJV +UzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMREwDwYDVQQL +EwhEU1RDQSBFMjAeFw05ODEyMDkxOTE3MjZaFw0xODEyMDkxOTQ3MjZaMEYxCzAJ +BgNVBAYTAlVTMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4x +ETAPBgNVBAsTCERTVENBIEUyMIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQC/ +k48Xku8zExjrEH9OFr//Bo8qhbxe+SSmJIi2A7fBw18DW9Fvrn5C6mYjuGODVvso +LeE4i7TuqAHhzhy2iCoiRoX7n6dwqUcUP87eZfCocfdPJmyMvMa1795JJ/9IKn3o +TQPMx7JSxhcxEzu1TdvIxPbDDyQq2gyd55FbgM2UnQIBA6OCASQwggEgMBEGCWCG +SAGG+EIBAQQEAwIABzBoBgNVHR8EYTBfMF2gW6BZpFcwVTELMAkGA1UEBhMCVVMx +JDAiBgNVBAoTG0RpZ2l0YWwgU2lnbmF0dXJlIFRydXN0IENvLjERMA8GA1UECxMI +RFNUQ0EgRTIxDTALBgNVBAMTBENSTDEwKwYDVR0QBCQwIoAPMTk5ODEyMDkxOTE3 +MjZagQ8yMDE4MTIwOTE5MTcyNlowCwYDVR0PBAQDAgEGMB8GA1UdIwQYMBaAFB6C +TShlgDzJQW6sNS5ay97u+DlbMB0GA1UdDgQWBBQegk0oZYA8yUFurDUuWsve7vg5 +WzAMBgNVHRMEBTADAQH/MBkGCSqGSIb2fQdBAAQMMAobBFY0LjADAgSQMA0GCSqG +SIb3DQEBBQUAA4GBAEeNg61i8tuwnkUiBbmi1gMOOHLnnvx75pO2mqWilMg0HZHR +xdf0CiUPPXiBng+xZ8SQTGPdXqfiup/1902lMXucKS1M/mQ+7LZT/uqb7YLbdHVL +B3luHtgZg3Pe9T7Qtd7nS2h9Qy4qIOF+oHhEngj1mPnHfxsb1gYgAlihw6ID +-----END CERTIFICATE----- + +Secure Global CA +================ + +MD5 Fingerprint=CF:F4:27:0D:D4:ED:DC:65:16:49:6D:3D:DA:BF:6E:DE +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 07:56:22:a4:e8:d4:8a:89:4d:f4:13:c8:f0:f8:ea:a5 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=SecureTrust Corporation, CN=Secure Global CA + Validity + Not Before: Nov 7 19:42:28 2006 GMT + Not After : Dec 31 19:52:06 2029 GMT + Subject: C=US, O=SecureTrust Corporation, CN=Secure Global CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:af:35:2e:d8:ac:6c:55:69:06:71:e5:13:68:24: + b3:4f:d8:cc:21:47:f8:f1:60:38:89:89:03:e9:bd: + ea:5e:46:53:09:dc:5c:f5:5a:e8:f7:45:2a:02:eb: + 31:61:d7:29:33:4c:ce:c7:7c:0a:37:7e:0f:ba:32: + 98:e1:1d:97:af:8f:c7:dc:c9:38:96:f3:db:1a:fc: + 51:ed:68:c6:d0:6e:a4:7c:24:d1:ae:42:c8:96:50: + 63:2e:e0:fe:75:fe:98:a7:5f:49:2e:95:e3:39:33: + 64:8e:1e:a4:5f:90:d2:67:3c:b2:d9:fe:41:b9:55: + a7:09:8e:72:05:1e:8b:dd:44:85:82:42:d0:49:c0: + 1d:60:f0:d1:17:2c:95:eb:f6:a5:c1:92:a3:c5:c2: + a7:08:60:0d:60:04:10:96:79:9e:16:34:e6:a9:b6: + fa:25:45:39:c8:1e:65:f9:93:f5:aa:f1:52:dc:99: + 98:3d:a5:86:1a:0c:35:33:fa:4b:a5:04:06:15:1c: + 31:80:ef:aa:18:6b:c2:7b:d7:da:ce:f9:33:20:d5: + f5:bd:6a:33:2d:81:04:fb:b0:5c:d4:9c:a3:e2:5c: + 1d:e3:a9:42:75:5e:7b:d4:77:ef:39:54:ba:c9:0a: + 18:1b:12:99:49:2f:88:4b:fd:50:62:d1:73:e7:8f: + 7a:43 + Exponent: 65537 (0x10001) + X509v3 extensions: + 1.3.6.1.4.1.311.20.2: + ...C.A + X509v3 Key Usage: + Digital Signature, Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + AF:44:04:C2:41:7E:48:83:DB:4E:39:02:EC:EC:84:7A:E6:CE:C9:A4 + X509v3 CRL Distribution Points: + URI:http://crl.securetrust.com/SGCA.crl + + 1.3.6.1.4.1.311.21.1: + ... + Signature Algorithm: sha1WithRSAEncryption + 63:1a:08:40:7d:a4:5e:53:0d:77:d8:7a:ae:1f:0d:0b:51:16: + 03:ef:18:7c:c8:e3:af:6a:58:93:14:60:91:b2:84:dc:88:4e: + be:39:8a:3a:f3:e6:82:89:5d:01:37:b3:ab:24:a4:15:0e:92: + 35:5a:4a:44:5e:4e:57:fa:75:ce:1f:48:ce:66:f4:3c:40:26: + 92:98:6c:1b:ee:24:46:0c:17:b3:52:a5:db:a5:91:91:cf:37: + d3:6f:e7:27:08:3a:4e:19:1f:3a:a7:58:5c:17:cf:79:3f:8b: + e4:a7:d3:26:23:9d:26:0f:58:69:fc:47:7e:b2:d0:8d:8b:93: + bf:29:4f:43:69:74:76:67:4b:cf:07:8c:e6:02:f7:b5:e1:b4: + 43:b5:4b:2d:14:9f:f9:dc:26:0d:bf:a6:47:74:06:d8:88:d1: + 3a:29:30:84:ce:d2:39:80:62:1b:a8:c7:57:49:bc:6a:55:51: + 67:15:4a:be:35:07:e4:d5:75:98:37:79:30:14:db:29:9d:6c: + c5:69:cc:47:55:a2:30:f7:cc:5c:7f:c2:c3:98:1c:6b:4e:16: + 80:eb:7a:78:65:45:a2:00:1a:af:0c:0d:55:64:34:48:b8:92: + b9:f1:b4:50:29:f2:4f:23:1f:da:6c:ac:1f:44:e1:dd:23:78: + 51:5b:c7:16 +-----BEGIN CERTIFICATE----- +MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBK +MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x +GTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkx +MjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3Qg +Q29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwgQ0EwggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jxYDiJ +iQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa +/FHtaMbQbqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJ +jnIFHovdRIWCQtBJwB1g8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnI +HmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYVHDGA76oYa8J719rO+TMg1fW9ajMtgQT7 +sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi0XPnj3pDAgMBAAGjgZ0w +gZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1UdEwEB/wQF +MAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCsw +KaAnoCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsG +AQQBgjcVAQQDAgEAMA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0L +URYD7xh8yOOvaliTFGCRsoTciE6+OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXO +H0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cnCDpOGR86p1hcF895P4vkp9Mm +I50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/53CYNv6ZHdAbY +iNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc +f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW +-----END CERTIFICATE----- + +COMODO Certification Authority +============================== + +MD5 Fingerprint=5C:48:DC:F7:42:72:EC:56:94:6D:1C:CC:71:35:80:75 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 4e:81:2d:8a:82:65:e0:0b:02:ee:3e:35:02:46:e5:3d + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=GB, ST=Greater Manchester, L=Salford, O=COMODO CA Limited, CN=COMODO Certification Authority + Validity + Not Before: Dec 1 00:00:00 2006 GMT + Not After : Dec 31 23:59:59 2029 GMT + Subject: C=GB, ST=Greater Manchester, L=Salford, O=COMODO CA Limited, CN=COMODO Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:d0:40:8b:8b:72:e3:91:1b:f7:51:c1:1b:54:04: + 98:d3:a9:bf:c1:e6:8a:5d:3b:87:fb:bb:88:ce:0d: + e3:2f:3f:06:96:f0:a2:29:50:99:ae:db:3b:a1:57: + b0:74:51:71:cd:ed:42:91:4d:41:fe:a9:c8:d8:6a: + 86:77:44:bb:59:66:97:50:5e:b4:d4:2c:70:44:cf: + da:37:95:42:69:3c:30:c4:71:b3:52:f0:21:4d:a1: + d8:ba:39:7c:1c:9e:a3:24:9d:f2:83:16:98:aa:16: + 7c:43:9b:15:5b:b7:ae:34:91:fe:d4:62:26:18:46: + 9a:3f:eb:c1:f9:f1:90:57:eb:ac:7a:0d:8b:db:72: + 30:6a:66:d5:e0:46:a3:70:dc:68:d9:ff:04:48:89: + 77:de:b5:e9:fb:67:6d:41:e9:bc:39:bd:32:d9:62: + 02:f1:b1:a8:3d:6e:37:9c:e2:2f:e2:d3:a2:26:8b: + c6:b8:55:43:88:e1:23:3e:a5:d2:24:39:6a:47:ab: + 00:d4:a1:b3:a9:25:fe:0d:3f:a7:1d:ba:d3:51:c1: + 0b:a4:da:ac:38:ef:55:50:24:05:65:46:93:34:4f: + 2d:8d:ad:c6:d4:21:19:d2:8e:ca:05:61:71:07:73: + 47:e5:8a:19:12:bd:04:4d:ce:4e:9c:a5:48:ac:bb: + 26:f7 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + 0B:58:E5:8B:C6:4C:15:37:A4:40:A9:30:A9:21:BE:47:36:5A:56:FF + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 CRL Distribution Points: + URI:http://crl.comodoca.com/COMODOCertificationAuthority.crl + + Signature Algorithm: sha1WithRSAEncryption + 3e:98:9e:9b:f6:1b:e9:d7:39:b7:78:ae:1d:72:18:49:d3:87: + e4:43:82:eb:3f:c9:aa:f5:a8:b5:ef:55:7c:21:52:65:f9:d5: + 0d:e1:6c:f4:3e:8c:93:73:91:2e:02:c4:4e:07:71:6f:c0:8f: + 38:61:08:a8:1e:81:0a:c0:2f:20:2f:41:8b:91:dc:48:45:bc: + f1:c6:de:ba:76:6b:33:c8:00:2d:31:46:4c:ed:e7:9d:cf:88: + 94:ff:33:c0:56:e8:24:86:26:b8:d8:38:38:df:2a:6b:dd:12: + cc:c7:3f:47:17:4c:a2:c2:06:96:09:d6:db:fe:3f:3c:46:41: + df:58:e2:56:0f:3c:3b:c1:1c:93:35:d9:38:52:ac:ee:c8:ec: + 2e:30:4e:94:35:b4:24:1f:4b:78:69:da:f2:02:38:cc:95:52: + 93:f0:70:25:59:9c:20:67:c4:ee:f9:8b:57:61:f4:92:76:7d: + 3f:84:8d:55:b7:e8:e5:ac:d5:f1:f5:19:56:a6:5a:fb:90:1c: + af:93:eb:e5:1c:d4:67:97:5d:04:0e:be:0b:83:a6:17:83:b9: + 30:12:a0:c5:33:15:05:b9:0d:fb:c7:05:76:e3:d8:4a:8d:fc: + 34:17:a3:c6:21:28:be:30:45:31:1e:c7:78:be:58:61:38:ac: + 3b:e2:01:65 +-----BEGIN CERTIFICATE----- +MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCB +gTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G +A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNV +BAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjEyMDEwMDAw +MDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEbMBkGA1UECBMSR3Jl +YXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFDT01P +RE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0 +aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3 +UcEbVASY06m/weaKXTuH+7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI +2GqGd0S7WWaXUF601CxwRM/aN5VCaTwwxHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8 +Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV4EajcNxo2f8ESIl33rXp ++2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA1KGzqSX+ +DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5O +nKVIrLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW +/zAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6g +PKA6hjhodHRwOi8vY3JsLmNvbW9kb2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9u +QXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOCAQEAPpiem/Yb6dc5t3iuHXIY +SdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CPOGEIqB6BCsAv +IC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/ +RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4 +zJVSk/BwJVmcIGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5dd +BA6+C4OmF4O5MBKgxTMVBbkN+8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IB +ZQ== +-----END CERTIFICATE----- + +DigiNotar Root CA +================= + +MD5 Fingerprint=7A:79:54:4D:07:92:3B:5B:FF:41:F0:0E:C7:39:A2:98 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 0c:76:da:9c:91:0c:4e:2c:9e:fe:15:d0:58:93:3c:4c + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=NL, O=DigiNotar, CN=DigiNotar Root CA/emailAddress=info@diginotar.nl + Validity + Not Before: May 16 17:19:36 2007 GMT + Not After : Mar 31 18:19:21 2025 GMT + Subject: C=NL, O=DigiNotar, CN=DigiNotar Root CA/emailAddress=info@diginotar.nl + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (4096 bit) + Modulus (4096 bit): + 00:ac:b0:58:c1:00:bd:d8:21:08:0b:2b:9a:fe:6e: + 56:30:05:9f:1b:77:90:10:41:5c:c3:0d:87:11:77: + 8e:81:f1:ca:7c:e9:8c:6a:ed:38:74:35:bb:da:df: + f9:bb:c0:09:37:b4:96:73:81:7d:33:1a:98:39:f7: + 93:6f:95:7f:3d:b9:b1:75:87:ba:51:48:e8:8b:70: + 3e:95:04:c5:d8:b6:c3:16:d9:88:b0:b1:87:1d:70: + da:86:b4:0f:14:8b:7a:cf:10:d1:74:36:a2:12:7b: + 77:86:4a:79:e6:7b:df:02:11:68:a5:4e:86:ae:34: + 58:9b:24:13:78:56:22:25:1e:01:8b:4b:51:71:fb: + 82:cc:59:96:69:88:5a:68:53:c5:b9:0d:02:37:cb: + 4b:bc:66:4a:90:7e:2a:0b:05:07:ed:16:5f:55:90: + 75:d8:46:c9:1b:83:e2:08:be:f1:23:cc:99:1d:d6: + 2a:0f:83:20:15:58:27:82:2e:fa:e2:22:c2:49:b1: + b9:01:81:6a:9d:6d:9d:40:77:68:76:4e:21:2a:6d: + 84:40:85:4e:76:99:7c:82:f3:f3:b7:02:59:d4:26: + 01:1b:8e:df:ad:53:06:d1:ae:18:dd:e2:b2:3a:cb: + d7:88:38:8e:ac:5b:29:b9:19:d3:98:f9:18:03:cf: + 48:82:86:66:0b:1b:69:0f:c9:eb:38:88:7a:26:1a: + 05:4c:92:d7:24:d4:96:f2:ac:52:2d:a3:47:d5:52: + f6:3f:fe:ce:84:06:70:a6:aa:3e:a2:f2:b6:56:34: + 18:57:a2:e4:81:6d:e7:ca:f0:6a:d3:c7:91:6b:02: + 83:41:7c:15:ef:6b:9a:64:5e:e3:d0:3c:e5:b1:eb: + 7b:5d:86:fb:cb:e6:77:49:cd:a3:65:dc:f7:b9:9c: + b8:e4:0b:5f:93:cf:cc:30:1a:32:1c:ce:1c:63:95: + a5:f9:ea:e1:74:8b:9e:e9:2b:a9:30:7b:a0:18:1f: + 0e:18:0b:e5:5b:a9:d3:d1:6c:1e:07:67:8f:91:4b: + a9:8a:bc:d2:66:aa:93:01:88:b2:91:fa:31:5c:d5: + a6:c1:52:08:09:cd:0a:63:a2:d3:22:a6:e8:a1:d9: + 39:06:97:f5:6e:8d:02:90:8c:14:7b:3f:80:cd:1b: + 9c:ba:c4:58:72:23:af:b6:56:9f:c6:7a:42:33:29: + 07:3f:82:c9:e6:1f:05:0d:cd:4c:28:36:8b:d3:c8: + 3e:1c:c6:88:ef:5e:ee:89:64:e9:1d:eb:da:89:7e: + 32:a6:69:d1:dd:cc:88:9f:d1:d0:c9:66:21:dc:06: + 67:c5:94:7a:9a:6d:62:4c:7d:cc:e0:64:80:b2:9e: + 47:8e:a3 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Subject Key Identifier: + 88:68:BF:E0:8E:35:C4:3B:38:6B:62:F7:28:3B:84:81:C8:0C:D7:4D + Signature Algorithm: sha1WithRSAEncryption + 3b:02:8d:cb:3c:30:e8:6e:a0:ad:f2:73:b3:5f:9e:25:13:04: + 05:d3:f6:e3:8b:bb:0b:79:ce:53:de:e4:96:c5:d1:af:73:bc: + d5:c3:d0:40:55:7c:40:7f:cd:1b:5f:09:d5:f2:7c:9f:68:1d: + bb:5d:ce:7a:39:c2:8c:d6:98:7b:c5:83:55:a8:d5:7d:40:ca: + e0:1e:f7:89:5e:63:5d:a1:13:c2:5d:8a:b6:8a:7c:00:f3:23: + c3:ed:85:5f:71:76:f0:68:63:aa:45:21:39:48:61:78:36:dc: + f1:43:93:d4:25:c7:f2:80:65:e1:53:02:75:51:fc:7a:3a:ef: + 37:ab:84:28:57:0c:d8:d4:d4:99:56:6c:e3:a2:fe:59:84:b4: + 31:e8:33:f8:64:94:94:51:97:ab:39:c5:4b:ed:da:dd:80:0b: + 6f:7c:29:0d:c4:8e:8a:72:0d:e7:53:14:b2:60:41:3d:84:91: + 31:68:3d:27:44:db:e5:de:f4:fa:63:45:c8:4c:3e:98:f5:3f: + 41:ba:4e:cb:37:0d:ba:66:98:f1:dd:cb:9f:5c:f7:54:36:82: + 6b:2c:bc:13:61:97:42:f8:78:bb:cc:c8:a2:9f:ca:f0:68:bd: + 6b:1d:b2:df:8d:6f:07:9d:da:8e:67:c7:47:1e:ca:b9:bf:2a: + 42:91:b7:63:53:66:f1:42:a3:e1:f4:5a:4d:58:6b:b5:e4:a4: + 33:ad:5c:70:1d:dc:e0:f2:eb:73:14:91:9a:03:c1:ea:00:65: + bc:07:fc:cf:12:11:22:2c:ae:a0:bd:3a:e0:a2:2a:d8:59:e9: + 29:d3:18:35:a4:ac:11:5f:19:b5:b5:1b:ff:22:4a:5c:c6:7a: + e4:17:ef:20:a9:a7:f4:3f:ad:8a:a7:9a:04:25:9d:0e:ca:37: + e6:50:fd:8c:42:29:04:9a:ec:b9:cf:4b:72:bd:e2:08:36:af: + 23:2f:62:e5:ca:01:d3:70:db:7c:82:23:2c:16:31:0c:c6:36: + 07:90:7a:b1:1f:67:58:c4:3b:58:59:89:b0:8c:8c:50:b3:d8: + 86:cb:68:a3:c4:0a:e7:69:4b:20:ce:c1:1e:56:4b:95:a9:23: + 68:d8:30:d8:c3:eb:b0:55:51:cd:e5:fd:2b:b8:f5:bb:11:9f: + 53:54:f6:34:19:8c:79:09:36:ca:61:17:25:17:0b:82:98:73: + 0c:77:74:c3:d5:0d:c7:a8:12:4c:c7:a7:54:71:47:2e:2c:1a: + 7d:c9:e3:2b:3b:48:de:27:84:a7:63:36:b3:7d:8f:a0:64:39: + 24:0d:3d:7b:87:af:66:5c:74:1b:4b:73:b2:e5:8c:f0:86:99: + b8:e5:c5:df:84:c1:b7:eb +-----BEGIN CERTIFICATE----- +MIIFijCCA3KgAwIBAgIQDHbanJEMTiye/hXQWJM8TDANBgkqhkiG9w0BAQUFADBf +MQswCQYDVQQGEwJOTDESMBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdp +Tm90YXIgUm9vdCBDQTEgMB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmww +HhcNMDcwNTE2MTcxOTM2WhcNMjUwMzMxMTgxOTIxWjBfMQswCQYDVQQGEwJOTDES +MBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdpTm90YXIgUm9vdCBDQTEg +MB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmwwggIiMA0GCSqGSIb3DQEB +AQUAA4ICDwAwggIKAoICAQCssFjBAL3YIQgLK5r+blYwBZ8bd5AQQVzDDYcRd46B +8cp86Yxq7Th0Nbva3/m7wAk3tJZzgX0zGpg595NvlX89ubF1h7pRSOiLcD6VBMXY +tsMW2YiwsYcdcNqGtA8Ui3rPENF0NqISe3eGSnnme98CEWilToauNFibJBN4ViIl +HgGLS1Fx+4LMWZZpiFpoU8W5DQI3y0u8ZkqQfioLBQftFl9VkHXYRskbg+IIvvEj +zJkd1ioPgyAVWCeCLvriIsJJsbkBgWqdbZ1Ad2h2TiEqbYRAhU52mXyC8/O3AlnU +JgEbjt+tUwbRrhjd4rI6y9eIOI6sWym5GdOY+RgDz0iChmYLG2kPyes4iHomGgVM +ktck1JbyrFIto0fVUvY//s6EBnCmqj6i8rZWNBhXouSBbefK8GrTx5FrAoNBfBXv +a5pkXuPQPOWx63tdhvvL5ndJzaNl3Pe5nLjkC1+Tz8wwGjIczhxjlaX56uF0i57p +K6kwe6AYHw4YC+VbqdPRbB4HZ4+RS6mKvNJmqpMBiLKR+jFc1abBUggJzQpjotMi +puih2TkGl/VujQKQjBR7P4DNG5y6xFhyI6+2Vp/GekIzKQc/gsnmHwUNzUwoNovT +yD4cxojvXu6JZOkd69qJfjKmadHdzIif0dDJZiHcBmfFlHqabWJMfczgZICynkeO +owIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNV +HQ4EFgQUiGi/4I41xDs4a2L3KDuEgcgM100wDQYJKoZIhvcNAQEFBQADggIBADsC +jcs8MOhuoK3yc7NfniUTBAXT9uOLuwt5zlPe5JbF0a9zvNXD0EBVfEB/zRtfCdXy +fJ9oHbtdzno5wozWmHvFg1Wo1X1AyuAe94leY12hE8JdiraKfADzI8PthV9xdvBo +Y6pFITlIYXg23PFDk9Qlx/KAZeFTAnVR/Ho67zerhChXDNjU1JlWbOOi/lmEtDHo +M/hklJRRl6s5xUvt2t2AC298KQ3EjopyDedTFLJgQT2EkTFoPSdE2+Xe9PpjRchM +Ppj1P0G6Tss3DbpmmPHdy59c91Q2gmssvBNhl0L4eLvMyKKfyvBovWsdst+Nbwed +2o5nx0ceyrm/KkKRt2NTZvFCo+H0Wk1Ya7XkpDOtXHAd3ODy63MUkZoDweoAZbwH +/M8SESIsrqC9OuCiKthZ6SnTGDWkrBFfGbW1G/8iSlzGeuQX7yCpp/Q/rYqnmgQl +nQ7KN+ZQ/YxCKQSa7LnPS3K94gg2ryMvYuXKAdNw23yCIywWMQzGNgeQerEfZ1jE +O1hZibCMjFCz2IbLaKPECudpSyDOwR5WS5WpI2jYMNjD67BVUc3l/Su49bsRn1NU +9jQZjHkJNsphFyUXC4KYcwx3dMPVDceoEkzHp1RxRy4sGn3J4ys7SN4nhKdjNrN9 +j6BkOSQNPXuHr2ZcdBtLc7LljPCGmbjlxd+Ewbfr +-----END CERTIFICATE----- + +Network Solutions Certificate Authority +======================================= + +MD5 Fingerprint=D3:F3:A6:16:C0:FA:6B:1D:59:B1:2D:96:4D:0E:11:2E +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 57:cb:33:6f:c2:5c:16:e6:47:16:17:e3:90:31:68:e0 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=Network Solutions L.L.C., CN=Network Solutions Certificate Authority + Validity + Not Before: Dec 1 00:00:00 2006 GMT + Not After : Dec 31 23:59:59 2029 GMT + Subject: C=US, O=Network Solutions L.L.C., CN=Network Solutions Certificate Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:e4:bc:7e:92:30:6d:c6:d8:8e:2b:0b:bc:46:ce: + e0:27:96:de:de:f9:fa:12:d3:3c:33:73:b3:04:2f: + bc:71:8c:e5:9f:b6:22:60:3e:5f:5d:ce:09:ff:82: + 0c:1b:9a:51:50:1a:26:89:dd:d5:61:5d:19:dc:12: + 0f:2d:0a:a2:43:5d:17:d0:34:92:20:ea:73:cf:38: + 2c:06:26:09:7a:72:f7:fa:50:32:f8:c2:93:d3:69: + a2:23:ce:41:b1:cc:e4:d5:1f:36:d1:8a:3a:f8:8c: + 63:e2:14:59:69:ed:0d:d3:7f:6b:e8:b8:03:e5:4f: + 6a:e5:98:63:69:48:05:be:2e:ff:33:b6:e9:97:59: + 69:f8:67:19:ae:93:61:96:44:15:d3:72:b0:3f:bc: + 6a:7d:ec:48:7f:8d:c3:ab:aa:71:2b:53:69:41:53: + 34:b5:b0:b9:c5:06:0a:c4:b0:45:f5:41:5d:6e:89: + 45:7b:3d:3b:26:8c:74:c2:e5:d2:d1:7d:b2:11:d4: + fb:58:32:22:9a:80:c9:dc:fd:0c:e9:7f:5e:03:97: + ce:3b:00:14:87:27:70:38:a9:8e:6e:b3:27:76:98: + 51:e0:05:e3:21:ab:1a:d5:85:22:3c:29:b5:9a:16: + c5:80:a8:f4:bb:6b:30:8f:2f:46:02:a2:b1:0c:22: + e0:d3 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + 21:30:C9:FB:00:D7:4E:98:DA:87:AA:2A:D0:A7:2E:B1:40:31:A7:4C + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 CRL Distribution Points: + URI:http://crl.netsolssl.com/NetworkSolutionsCertificateAuthority.crl + + Signature Algorithm: sha1WithRSAEncryption + bb:ae:4b:e7:b7:57:eb:7f:aa:2d:b7:73:47:85:6a:c1:e4:a5: + 1d:e4:e7:3c:e9:f4:59:65:77:b5:7a:5b:5a:8d:25:36:e0:7a: + 97:2e:38:c0:57:60:83:98:06:83:9f:b9:76:7a:6e:50:e0:ba: + 88:2c:fc:45:cc:18:b0:99:95:51:0e:ec:1d:b8:88:ff:87:50: + 1c:82:c2:e3:e0:32:80:bf:a0:0b:47:c8:c3:31:ef:99:67:32: + 80:4f:17:21:79:0c:69:5c:de:5e:34:ae:02:b5:26:ea:50:df: + 7f:18:65:2c:c9:f2:63:e1:a9:07:fe:7c:71:1f:6b:33:24:6a: + 1e:05:f7:05:68:c0:6a:12:cb:2e:5e:61:cb:ae:28:d3:7e:c2: + b4:66:91:26:5f:3c:2e:24:5f:cb:58:0f:eb:28:ec:af:11:96: + f3:dc:7b:6f:c0:a7:88:f2:53:77:b3:60:5e:ae:ae:28:da:35: + 2c:6f:34:45:d3:26:e1:de:ec:5b:4f:27:6b:16:7c:bd:44:04: + 18:82:b3:89:79:17:10:71:3d:7a:a2:16:4e:f5:01:cd:a4:6c: + 65:68:a1:49:76:5c:43:c9:d8:bc:36:67:6c:a5:94:b5:d4:cc: + b9:bd:6a:35:56:21:de:d8:c3:eb:fb:cb:a4:60:4c:b0:55:a0: + a0:7b:57:b2 +-----BEGIN CERTIFICATE----- +MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBi +MQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu +MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3Jp +dHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMxMjM1OTU5WjBiMQswCQYDVQQGEwJV +UzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydO +ZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwz +c7MEL7xxjOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPP +OCwGJgl6cvf6UDL4wpPTaaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rl +mGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXTcrA/vGp97Eh/jcOrqnErU2lBUzS1sLnF +BgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc/Qzpf14Dl847ABSHJ3A4 +qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMBAAGjgZcw +gZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIB +BjAPBgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwu +bmV0c29sc3NsLmNvbS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3Jp +dHkuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc8 +6fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q4LqILPxFzBiwmZVRDuwduIj/ +h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/GGUsyfJj4akH +/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv +wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHN +pGxlaKFJdlxDydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey +-----END CERTIFICATE----- + +Digital Signature Trust Co. Global CA 2 +======================================= + +MD5 Fingerprint=6C:C9:A7:6E:47:F1:0C:E3:53:3B:78:4C:4D:C2:6A:C5 +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + d0:1e:40:8b:00:00:02:7c:00:00:00:02:00:00:00:01 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=us, ST=Utah, L=Salt Lake City, O=Digital Signature Trust Co., OU=DSTCA X1, CN=DST RootCA X1/emailAddress=ca@digsigtrust.com + Validity + Not Before: Dec 1 18:18:55 1998 GMT + Not After : Nov 28 18:18:55 2008 GMT + Subject: C=us, ST=Utah, L=Salt Lake City, O=Digital Signature Trust Co., OU=DSTCA X1, CN=DST RootCA X1/emailAddress=ca@digsigtrust.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:d2:c6:26:b6:e7:a5:3d:c1:c4:68:d5:50:6f:53: + c5:6f:49:13:09:b8:af:2c:48:8d:14:6a:a3:17:5f: + 5a:f9:d3:2e:75:2f:d8:28:62:d1:93:2f:fc:4d:d4: + ab:87:e5:08:c7:99:e7:92:3f:75:bd:eb:25:b4:15: + c1:9b:19:3d:d2:44:8d:d7:74:20:6d:37:02:8f:69: + 93:5b:8a:c4:19:9d:f4:b2:0e:fc:16:6c:b9:b1:05: + 92:83:d1:85:2c:60:94:3e:45:55:a0:d9:ab:08:21: + e6:60:e8:3b:74:f2:99:50:51:68:d0:03:2d:b1:80: + be:a3:d8:52:b0:44:cd:43:4a:70:8e:58:85:95:e1: + 4e:2c:d6:2d:41:6f:d6:84:e7:c8:98:44:ca:47:db: + 2c:24:a5:69:26:cf:6b:b8:27:62:c3:f4:c9:7a:92: + 23:ed:13:67:82:ae:45:2e:45:e5:7e:72:3f:85:9d: + 94:62:10:e6:3c:91:a1:ad:77:00:e0:15:ec:f3:84: + 80:72:7a:8e:6e:60:97:c7:24:59:10:34:83:5b:e1: + a5:a4:69:b6:57:35:1c:78:59:c6:d3:2f:3a:73:67: + ee:94:ca:04:13:05:62:06:70:23:b3:f4:7c:ee:45: + d9:64:0b:5b:49:aa:a4:43:ce:26:c4:44:12:6c:b8: + dd:79 + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + a2:37:b2:3f:69:fb:d7:86:79:54:49:31:95:33:2b:f3:d1:09: + 14:49:62:60:86:a5:b0:11:e2:50:c2:1d:06:57:3e:2d:e8:33: + 64:be:9b:aa:ad:5f:1b:4d:d4:99:95:a2:8b:9a:c9:62:72:b5: + 69:ea:d9:58:ab:35:ed:15:a2:43:d6:b6:bc:07:79:65:64:73: + 7d:d7:79:ca:7b:d5:5a:51:c6:e1:53:04:96:8d:38:cf:a3:17: + ac:39:71:6b:01:c3:8b:53:3c:63:e9:ee:79:c0:e4:be:92:32: + 64:7a:b3:1f:97:94:62:bd:ea:b2:20:15:95:fb:97:f2:78:2f: + 63:36:40:38:e3:46:0f:1d:dd:ac:95:ca:e7:4b:90:7b:b1:4b: + a9:d4:c5:eb:9a:da:aa:d5:a3:94:14:46:8d:2d:1f:f3:3a:d6: + 93:3a:f6:3e:79:fc:e8:e6:b0:75:ed:ee:3d:c9:70:c7:5d:aa: + 81:4b:46:25:1c:c7:6c:15:e3:95:4e:0f:aa:32:37:94:0a:17: + 24:92:13:84:58:d2:63:6f:2b:f7:e6:5b:62:0b:13:17:b0:0d: + 52:4c:fe:fe:6f:5c:e2:91:6e:1d:fd:a4:62:d7:68:fa:8e:7a: + 4f:d2:08:da:93:dc:f0:92:11:7a:d0:dc:72:93:0c:73:93:62: + 85:68:d0:f4 +-----BEGIN CERTIFICATE----- +MIID2DCCAsACEQDQHkCLAAACfAAAAAIAAAABMA0GCSqGSIb3DQEBBQUAMIGpMQsw +CQYDVQQGEwJ1czENMAsGA1UECBMEVXRhaDEXMBUGA1UEBxMOU2FsdCBMYWtlIENp +dHkxJDAiBgNVBAoTG0RpZ2l0YWwgU2lnbmF0dXJlIFRydXN0IENvLjERMA8GA1UE +CxMIRFNUQ0EgWDExFjAUBgNVBAMTDURTVCBSb290Q0EgWDExITAfBgkqhkiG9w0B +CQEWEmNhQGRpZ3NpZ3RydXN0LmNvbTAeFw05ODEyMDExODE4NTVaFw0wODExMjgx +ODE4NTVaMIGpMQswCQYDVQQGEwJ1czENMAsGA1UECBMEVXRhaDEXMBUGA1UEBxMO +U2FsdCBMYWtlIENpdHkxJDAiBgNVBAoTG0RpZ2l0YWwgU2lnbmF0dXJlIFRydXN0 +IENvLjERMA8GA1UECxMIRFNUQ0EgWDExFjAUBgNVBAMTDURTVCBSb290Q0EgWDEx +ITAfBgkqhkiG9w0BCQEWEmNhQGRpZ3NpZ3RydXN0LmNvbTCCASIwDQYJKoZIhvcN +AQEBBQADggEPADCCAQoCggEBANLGJrbnpT3BxGjVUG9TxW9JEwm4ryxIjRRqoxdf +WvnTLnUv2Chi0ZMv/E3Uq4flCMeZ55I/db3rJbQVwZsZPdJEjdd0IG03Ao9pk1uK +xBmd9LIO/BZsubEFkoPRhSxglD5FVaDZqwgh5mDoO3TymVBRaNADLbGAvqPYUrBE +zUNKcI5YhZXhTizWLUFv1oTnyJhEykfbLCSlaSbPa7gnYsP0yXqSI+0TZ4KuRS5F +5X5yP4WdlGIQ5jyRoa13AOAV7POEgHJ6jm5gl8ckWRA0g1vhpaRptlc1HHhZxtMv +OnNn7pTKBBMFYgZwI7P0fO5F2WQLW0mqpEPOJsREEmy43XkCAwEAATANBgkqhkiG +9w0BAQUFAAOCAQEAojeyP2n714Z5VEkxlTMr89EJFEliYIalsBHiUMIdBlc+Legz +ZL6bqq1fG03UmZWii5rJYnK1aerZWKs17RWiQ9a2vAd5ZWRzfdd5ynvVWlHG4VME +lo04z6MXrDlxawHDi1M8Y+nuecDkvpIyZHqzH5eUYr3qsiAVlfuX8ngvYzZAOONG +Dx3drJXK50uQe7FLqdTF65raqtWjlBRGjS0f8zrWkzr2Pnn86Oawde3uPclwx12q +gUtGJRzHbBXjlU4PqjI3lAoXJJIThFjSY28r9+ZbYgsTF7ANUkz+/m9c4pFuHf2k +Ytdo+o56T9II2pPc8JIRetDccpMMc5NihWjQ9A== +-----END CERTIFICATE----- + +Digital Signature Trust Co. Global CA 4 +======================================= + +MD5 Fingerprint=CD:3B:3D:62:5B:09:B8:09:36:87:9E:12:2F:71:64:BA +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + d0:1e:40:8b:00:00:77:6d:00:00:00:01:00:00:00:04 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=us, ST=Utah, L=Salt Lake City, O=Digital Signature Trust Co., OU=DSTCA X2, CN=DST RootCA X2/emailAddress=ca@digsigtrust.com + Validity + Not Before: Nov 30 22:46:16 1998 GMT + Not After : Nov 27 22:46:16 2008 GMT + Subject: C=us, ST=Utah, L=Salt Lake City, O=Digital Signature Trust Co., OU=DSTCA X2, CN=DST RootCA X2/emailAddress=ca@digsigtrust.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:dc:75:f0:8c:c0:75:96:9a:c0:62:1f:26:f7:c4: + e1:9a:ea:e0:56:73:5b:99:cd:01:44:a8:08:b6:d5: + a7:da:1a:04:18:39:92:4a:78:a3:81:c2:f5:77:7a: + 50:b4:70:ff:9a:ab:c6:c7:ca:6e:83:4f:42:98:fb: + 26:0b:da:dc:6d:d6:a9:99:55:52:67:e9:28:03:92: + dc:e5:b0:05:9a:0f:15:f9:6b:59:72:56:f2:fa:39: + fc:aa:68:ee:0f:1f:10:83:2f:fc:9d:fa:17:96:dd: + 82:e3:e6:45:7d:c0:4b:80:44:1f:ed:2c:e0:84:fd: + 91:5c:92:54:69:25:e5:62:69:dc:e5:ee:00:52:bd: + 33:0b:ad:75:02:85:a7:64:50:2d:c5:19:19:30:c0: + 26:db:c9:d3:fd:2e:99:ad:59:b5:0b:4d:d4:41:ae: + 85:48:43:59:dc:b7:a8:e2:a2:de:c3:8f:d7:b8:a1: + 62:a6:68:50:52:e4:cf:31:a7:94:85:da:9f:46:32: + 17:56:e5:f2:eb:66:3d:12:ff:43:db:98:ef:77:cf: + cb:81:8d:34:b1:c6:50:4a:26:d1:e4:3e:41:50:af: + 6c:ae:22:34:2e:d5:6b:6e:83:ba:79:b8:76:65:48: + da:09:29:64:63:22:b9:fb:47:76:85:8c:86:44:cb: + 09:db + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + b5:36:0e:5d:e1:61:28:5a:11:65:c0:3f:83:03:79:4d:be:28: + a6:0b:07:02:52:85:cd:f8:91:d0:10:6c:b5:6a:20:5b:1c:90: + d9:30:3c:c6:48:9e:8a:5e:64:f9:a1:71:77:ef:04:27:1f:07: + eb:e4:26:f7:73:74:c9:44:18:1a:66:d3:e0:43:af:91:3b:d1: + cb:2c:d8:74:54:3a:1c:4d:ca:d4:68:cd:23:7c:1d:10:9e:45: + e9:f6:00:6e:a6:cd:19:ff:4f:2c:29:8f:57:4d:c4:77:92:be: + e0:4c:09:fb:5d:44:86:66:21:a8:b9:32:a2:56:d5:e9:8c:83: + 7c:59:3f:c4:f1:0b:e7:9d:ec:9e:bd:9c:18:0e:3e:c2:39:79: + 28:b7:03:0d:08:cb:c6:e7:d9:01:37:50:10:ec:cc:61:16:40: + d4:af:31:74:7b:fc:3f:31:a7:d0:47:73:33:39:1b:cc:4e:6a: + d7:49:83:11:06:fe:eb:82:58:33:32:4c:f0:56:ac:1e:9c:2f: + 56:9a:7b:c1:4a:1c:a5:fd:55:36:ce:fc:96:4d:f4:b0:f0:ec: + b7:6c:82:ed:2f:31:99:42:4c:a9:b2:0d:b8:15:5d:f1:df:ba: + c9:b5:4a:d4:64:98:b3:26:a9:30:c8:fd:a6:ec:ab:96:21:ad: + 7f:c2:78:b6 +-----BEGIN CERTIFICATE----- +MIID2DCCAsACEQDQHkCLAAB3bQAAAAEAAAAEMA0GCSqGSIb3DQEBBQUAMIGpMQsw +CQYDVQQGEwJ1czENMAsGA1UECBMEVXRhaDEXMBUGA1UEBxMOU2FsdCBMYWtlIENp +dHkxJDAiBgNVBAoTG0RpZ2l0YWwgU2lnbmF0dXJlIFRydXN0IENvLjERMA8GA1UE +CxMIRFNUQ0EgWDIxFjAUBgNVBAMTDURTVCBSb290Q0EgWDIxITAfBgkqhkiG9w0B +CQEWEmNhQGRpZ3NpZ3RydXN0LmNvbTAeFw05ODExMzAyMjQ2MTZaFw0wODExMjcy +MjQ2MTZaMIGpMQswCQYDVQQGEwJ1czENMAsGA1UECBMEVXRhaDEXMBUGA1UEBxMO +U2FsdCBMYWtlIENpdHkxJDAiBgNVBAoTG0RpZ2l0YWwgU2lnbmF0dXJlIFRydXN0 +IENvLjERMA8GA1UECxMIRFNUQ0EgWDIxFjAUBgNVBAMTDURTVCBSb290Q0EgWDIx +ITAfBgkqhkiG9w0BCQEWEmNhQGRpZ3NpZ3RydXN0LmNvbTCCASIwDQYJKoZIhvcN +AQEBBQADggEPADCCAQoCggEBANx18IzAdZaawGIfJvfE4Zrq4FZzW5nNAUSoCLbV +p9oaBBg5kkp4o4HC9Xd6ULRw/5qrxsfKboNPQpj7Jgva3G3WqZlVUmfpKAOS3OWw +BZoPFflrWXJW8vo5/Kpo7g8fEIMv/J36F5bdguPmRX3AS4BEH+0s4IT9kVySVGkl +5WJp3OXuAFK9MwutdQKFp2RQLcUZGTDAJtvJ0/0uma1ZtQtN1EGuhUhDWdy3qOKi +3sOP17ihYqZoUFLkzzGnlIXan0YyF1bl8utmPRL/Q9uY73fPy4GNNLHGUEom0eQ+ +QVCvbK4iNC7Va26Dunm4dmVI2gkpZGMiuftHdoWMhkTLCdsCAwEAATANBgkqhkiG +9w0BAQUFAAOCAQEAtTYOXeFhKFoRZcA/gwN5Tb4opgsHAlKFzfiR0BBstWogWxyQ +2TA8xkieil5k+aFxd+8EJx8H6+Qm93N0yUQYGmbT4EOvkTvRyyzYdFQ6HE3K1GjN +I3wdEJ5F6fYAbqbNGf9PLCmPV03Ed5K+4EwJ+11EhmYhqLkyolbV6YyDfFk/xPEL +553snr2cGA4+wjl5KLcDDQjLxufZATdQEOzMYRZA1K8xdHv8PzGn0EdzMzkbzE5q +10mDEQb+64JYMzJM8FasHpwvVpp7wUocpf1VNs78lk30sPDst2yC7S8xmUJMqbIN +uBVd8d+6ybVK1GSYsyapMMj9puyrliGtf8J4tg== +-----END CERTIFICATE----- + +Verisign Class 1 Public Primary Certification Authority +======================================================= + +MD5 Fingerprint=97:60:E8:57:5F:D3:50:47:E5:43:0C:94:36:8A:B0:62 +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + cd:ba:7f:56:f0:df:e4:bc:54:fe:22:ac:b3:72:aa:55 + Signature Algorithm: md2WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=Class 1 Public Primary Certification Authority + Validity + Not Before: Jan 29 00:00:00 1996 GMT + Not After : Aug 1 23:59:59 2028 GMT + Subject: C=US, O=VeriSign, Inc., OU=Class 1 Public Primary Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:e5:19:bf:6d:a3:56:61:2d:99:48:71:f6:67:de: + b9:8d:eb:b7:9e:86:80:0a:91:0e:fa:38:25:af:46: + 88:82:e5:73:a8:a0:9b:24:5d:0d:1f:cc:65:6e:0c: + b0:d0:56:84:18:87:9a:06:9b:10:a1:73:df:b4:58: + 39:6b:6e:c1:f6:15:d5:a8:a8:3f:aa:12:06:8d:31: + ac:7f:b0:34:d7:8f:34:67:88:09:cd:14:11:e2:4e: + 45:56:69:1f:78:02:80:da:dc:47:91:29:bb:36:c9: + 63:5c:c5:e0:d7:2d:87:7b:a1:b7:32:b0:7b:30:ba: + 2a:2f:31:aa:ee:a3:67:da:db + Exponent: 65537 (0x10001) + Signature Algorithm: md2WithRSAEncryption + 4c:3f:b8:8b:c6:68:df:ee:43:33:0e:5d:e9:a6:cb:07:84:4d: + 7a:33:ff:92:1b:f4:36:ad:d8:95:22:36:68:11:6c:7c:42:cc: + f3:9c:2e:c4:07:3f:14:b0:0f:4f:ff:90:92:76:f9:e2:bc:4a: + e9:8f:cd:a0:80:0a:f7:c5:29:f1:82:22:5d:b8:b1:dd:81:23: + a3:7b:25:15:46:30:79:16:f8:ea:05:4b:94:7f:1d:c2:1c:c8: + e3:b7:f4:10:40:3c:13:c3:5f:1f:53:e8:48:e4:86:b4:7b:a1: + 35:b0:7b:25:ba:b8:d3:8e:ab:3f:38:9d:00:34:00:98:f3:d1: + 71:94 +-----BEGIN CERTIFICATE----- +MIICPTCCAaYCEQDNun9W8N/kvFT+IqyzcqpVMA0GCSqGSIb3DQEBAgUAMF8xCzAJ +BgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xh +c3MgMSBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05 +NjAxMjkwMDAwMDBaFw0yODA4MDEyMzU5NTlaMF8xCzAJBgNVBAYTAlVTMRcwFQYD +VQQKEw5WZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgMSBQdWJsaWMgUHJp +bWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCBnzANBgkqhkiG9w0BAQEFAAOB +jQAwgYkCgYEA5Rm/baNWYS2ZSHH2Z965jeu3noaACpEO+jglr0aIguVzqKCbJF0N +H8xlbgyw0FaEGIeaBpsQoXPftFg5a27B9hXVqKg/qhIGjTGsf7A01480Z4gJzRQR +4k5FVmkfeAKA2txHkSm7NsljXMXg1y2He6G3MrB7MLoqLzGq7qNn2tsCAwEAATAN +BgkqhkiG9w0BAQIFAAOBgQBMP7iLxmjf7kMzDl3ppssHhE16M/+SG/Q2rdiVIjZo +EWx8QszznC7EBz8UsA9P/5CSdvnivErpj82ggAr3xSnxgiJduLHdgSOjeyUVRjB5 +FvjqBUuUfx3CHMjjt/QQQDwTw18fU+hI5Ia0e6E1sHslurjTjqs/OJ0ANACY89Fx +lA== +-----END CERTIFICATE----- + +Verisign Class 2 Public Primary Certification Authority +======================================================= + +MD5 Fingerprint=B3:9C:25:B1:C3:2E:32:53:80:15:30:9D:4D:02:77:3E +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + 2d:1b:fc:4a:17:8d:a3:91:eb:e7:ff:f5:8b:45:be:0b + Signature Algorithm: md2WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=Class 2 Public Primary Certification Authority + Validity + Not Before: Jan 29 00:00:00 1996 GMT + Not After : Aug 1 23:59:59 2028 GMT + Subject: C=US, O=VeriSign, Inc., OU=Class 2 Public Primary Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:b6:5a:8b:a3:0d:6a:23:83:80:6b:cf:39:87:f4: + 21:13:33:06:4c:25:a2:ed:55:12:97:c5:a7:80:b9: + fa:83:c1:20:a0:fa:2f:15:0d:7c:a1:60:6b:7e:79: + 2c:fa:06:0f:3a:ae:f6:1b:6f:b1:d2:ff:2f:28:52: + 5f:83:7d:4b:c4:7a:b7:f8:66:1f:80:54:fc:b7:c2: + 8e:59:4a:14:57:46:d1:9a:93:be:41:91:03:bb:15: + 80:93:5c:eb:e7:cc:08:6c:3f:3e:b3:4a:fc:ff:4b: + 6c:23:d5:50:82:26:44:19:8e:23:c3:71:ea:19:24: + 47:04:9e:75:bf:c8:a6:00:1f + Exponent: 65537 (0x10001) + Signature Algorithm: md2WithRSAEncryption + 8a:1b:2b:fa:39:c1:74:d7:5e:d8:19:64:a2:58:4a:2d:37:e0: + 33:47:0f:ac:ed:f7:aa:db:1e:e4:8b:06:5c:60:27:ca:45:52: + ce:16:ef:3f:06:64:e7:94:68:7c:60:33:15:11:69:af:9d:62: + 8d:a3:03:54:6b:a6:be:e5:ee:05:18:60:04:bf:42:80:fd:d0: + a8:a8:1e:01:3b:f7:a3:5c:af:a3:dc:e6:26:80:23:3c:b8:44: + 74:f7:0a:ae:49:8b:61:78:cc:24:bf:88:8a:a7:0e:ea:73:19: + 41:fd:4d:03:f0:88:d1:e5:78:8d:a5:2a:4f:f6:97:0d:17:77: + ca:d8 +-----BEGIN CERTIFICATE----- +MIICPDCCAaUCEC0b/EoXjaOR6+f/9YtFvgswDQYJKoZIhvcNAQECBQAwXzELMAkG +A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz +cyAyIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2 +MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV +BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAyIFB1YmxpYyBQcmlt +YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN +ADCBiQKBgQC2WoujDWojg4BrzzmH9CETMwZMJaLtVRKXxaeAufqDwSCg+i8VDXyh +YGt+eSz6Bg86rvYbb7HS/y8oUl+DfUvEerf4Zh+AVPy3wo5ZShRXRtGak75BkQO7 +FYCTXOvnzAhsPz6zSvz/S2wj1VCCJkQZjiPDceoZJEcEnnW/yKYAHwIDAQABMA0G +CSqGSIb3DQEBAgUAA4GBAIobK/o5wXTXXtgZZKJYSi034DNHD6zt96rbHuSLBlxg +J8pFUs4W7z8GZOeUaHxgMxURaa+dYo2jA1Rrpr7l7gUYYAS/QoD90KioHgE796Nc +r6Pc5iaAIzy4RHT3Cq5Ji2F4zCS/iIqnDupzGUH9TQPwiNHleI2lKk/2lw0Xd8rY +-----END CERTIFICATE----- + +Verisign Class 3 Public Primary Certification Authority +======================================================= + +MD5 Fingerprint=10:FC:63:5D:F6:26:3E:0D:F3:25:BE:5F:79:CD:67:67 +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + 70:ba:e4:1d:10:d9:29:34:b6:38:ca:7b:03:cc:ba:bf + Signature Algorithm: md2WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification Authority + Validity + Not Before: Jan 29 00:00:00 1996 GMT + Not After : Aug 1 23:59:59 2028 GMT + Subject: C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:c9:5c:59:9e:f2:1b:8a:01:14:b4:10:df:04:40: + db:e3:57:af:6a:45:40:8f:84:0c:0b:d1:33:d9:d9: + 11:cf:ee:02:58:1f:25:f7:2a:a8:44:05:aa:ec:03: + 1f:78:7f:9e:93:b9:9a:00:aa:23:7d:d6:ac:85:a2: + 63:45:c7:72:27:cc:f4:4c:c6:75:71:d2:39:ef:4f: + 42:f0:75:df:0a:90:c6:8e:20:6f:98:0f:f8:ac:23: + 5f:70:29:36:a4:c9:86:e7:b1:9a:20:cb:53:a5:85: + e7:3d:be:7d:9a:fe:24:45:33:dc:76:15:ed:0f:a2: + 71:64:4c:65:2e:81:68:45:a7 + Exponent: 65537 (0x10001) + Signature Algorithm: md2WithRSAEncryption + bb:4c:12:2b:cf:2c:26:00:4f:14:13:dd:a6:fb:fc:0a:11:84: + 8c:f3:28:1c:67:92:2f:7c:b6:c5:fa:df:f0:e8:95:bc:1d:8f: + 6c:2c:a8:51:cc:73:d8:a4:c0:53:f0:4e:d6:26:c0:76:01:57: + 81:92:5e:21:f1:d1:b1:ff:e7:d0:21:58:cd:69:17:e3:44:1c: + 9c:19:44:39:89:5c:dc:9c:00:0f:56:8d:02:99:ed:a2:90:45: + 4c:e4:bb:10:a4:3d:f0:32:03:0e:f1:ce:f8:e8:c9:51:8c:e6: + 62:9f:e6:9f:c0:7d:b7:72:9c:c9:36:3a:6b:9f:4e:a8:ff:64: + 0d:64 +-----BEGIN CERTIFICATE----- +MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG +A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz +cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2 +MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV +BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt +YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN +ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE +BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is +I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G +CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do +lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc +AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k +-----END CERTIFICATE----- + +Verisign Class 1 Public Primary Certification Authority - G2 +============================================================ + +MD5 Fingerprint=DB:23:3D:F9:69:FA:4B:B9:95:80:44:73:5E:7D:41:83 +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + 4c:c7:ea:aa:98:3e:71:d3:93:10:f8:3d:3a:89:91:92 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=Class 1 Public Primary Certification Authority - G2, OU=(c) 1998 VeriSign, Inc. - For authorized use only, OU=VeriSign Trust Network + Validity + Not Before: May 18 00:00:00 1998 GMT + Not After : Aug 1 23:59:59 2028 GMT + Subject: C=US, O=VeriSign, Inc., OU=Class 1 Public Primary Certification Authority - G2, OU=(c) 1998 VeriSign, Inc. - For authorized use only, OU=VeriSign Trust Network + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:aa:d0:ba:be:16:2d:b8:83:d4:ca:d2:0f:bc:76: + 31:ca:94:d8:1d:93:8c:56:02:bc:d9:6f:1a:6f:52: + 36:6e:75:56:0a:55:d3:df:43:87:21:11:65:8a:7e: + 8f:bd:21:de:6b:32:3f:1b:84:34:95:05:9d:41:35: + eb:92:eb:96:dd:aa:59:3f:01:53:6d:99:4f:ed:e5: + e2:2a:5a:90:c1:b9:c4:a6:15:cf:c8:45:eb:a6:5d: + 8e:9c:3e:f0:64:24:76:a5:cd:ab:1a:6f:b6:d8:7b: + 51:61:6e:a6:7f:87:c8:e2:b7:e5:34:dc:41:88:ea: + 09:40:be:73:92:3d:6b:e7:75 + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + a9:4f:c3:0d:c7:67:be:2c:cb:d9:a8:cd:2d:75:e7:7e:15:9e: + 3b:72:eb:7e:eb:5c:2d:09:87:d6:6b:6d:60:7c:e5:ae:c5:90: + 23:0c:5c:4a:d0:af:b1:5d:f3:c7:b6:0a:db:e0:15:93:0d:dd: + 03:bc:c7:76:8a:b5:dd:4f:c3:9b:13:75:b8:01:c0:e6:c9:5b: + 6b:a5:b8:89:dc:ac:a4:dd:72:ed:4e:a1:f7:4f:bc:06:d3:ea: + c8:64:74:7b:c2:95:41:9c:65:73:58:f1:90:9a:3c:6a:b1:98: + c9:c4:87:bc:cf:45:6d:45:e2:6e:22:3f:fe:bc:0f:31:5c:e8: + f2:d9 +-----BEGIN CERTIFICATE----- +MIIDAjCCAmsCEEzH6qqYPnHTkxD4PTqJkZIwDQYJKoZIhvcNAQEFBQAwgcExCzAJ +BgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xh +c3MgMSBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcy +MTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3Jp +emVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMB4X +DTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVTMRcw +FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMSBQdWJsaWMg +UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEo +YykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5 +MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEB +AQUAA4GNADCBiQKBgQCq0Lq+Fi24g9TK0g+8djHKlNgdk4xWArzZbxpvUjZudVYK +VdPfQ4chEWWKfo+9Id5rMj8bhDSVBZ1BNeuS65bdqlk/AVNtmU/t5eIqWpDBucSm +Fc/IReumXY6cPvBkJHalzasab7bYe1FhbqZ/h8jit+U03EGI6glAvnOSPWvndQID +AQABMA0GCSqGSIb3DQEBBQUAA4GBAKlPww3HZ74sy9mozS11534Vnjty637rXC0J +h9ZrbWB85a7FkCMMXErQr7Fd88e2CtvgFZMN3QO8x3aKtd1Pw5sTdbgBwObJW2ul +uIncrKTdcu1OofdPvAbT6shkdHvClUGcZXNY8ZCaPGqxmMnEh7zPRW1F4m4iP/68 +DzFc6PLZ +-----END CERTIFICATE----- + +Verisign Class 2 Public Primary Certification Authority - G2 +============================================================ + +MD5 Fingerprint=2D:BB:E5:25:D3:D1:65:82:3A:B7:0E:FA:E6:EB:E2:E1 +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + b9:2f:60:cc:88:9f:a1:7a:46:09:b8:5b:70:6c:8a:af + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=Class 2 Public Primary Certification Authority - G2, OU=(c) 1998 VeriSign, Inc. - For authorized use only, OU=VeriSign Trust Network + Validity + Not Before: May 18 00:00:00 1998 GMT + Not After : Aug 1 23:59:59 2028 GMT + Subject: C=US, O=VeriSign, Inc., OU=Class 2 Public Primary Certification Authority - G2, OU=(c) 1998 VeriSign, Inc. - For authorized use only, OU=VeriSign Trust Network + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:a7:88:01:21:74:2c:e7:1a:03:f0:98:e1:97:3c: + 0f:21:08:f1:9c:db:97:e9:9a:fc:c2:04:06:13:be: + 5f:52:c8:cc:1e:2c:12:56:2c:b8:01:69:2c:cc:99: + 1f:ad:b0:96:ae:79:04:f2:13:39:c1:7b:98:ba:08: + 2c:e8:c2:84:13:2c:aa:69:e9:09:f4:c7:a9:02:a4: + 42:c2:23:4f:4a:d8:f0:0e:a2:fb:31:6c:c9:e6:6f: + 99:27:07:f5:e6:f4:4c:78:9e:6d:eb:46:86:fa:b9: + 86:c9:54:f2:b2:c4:af:d4:46:1c:5a:c9:15:30:ff: + 0d:6c:f5:2d:0e:6d:ce:7f:77 + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + 72:2e:f9:7f:d1:f1:71:fb:c4:9e:f6:c5:5e:51:8a:40:98:b8: + 68:f8:9b:1c:83:d8:e2:9d:bd:ff:ed:a1:e6:66:ea:2f:09:f4: + ca:d7:ea:a5:2b:95:f6:24:60:86:4d:44:2e:83:a5:c4:2d:a0: + d3:ae:78:69:6f:72:da:6c:ae:08:f0:63:92:37:e6:bb:c4:30: + 17:ad:77:cc:49:35:aa:cf:d8:8f:d1:be:b7:18:96:47:73:6a: + 54:22:34:64:2d:b6:16:9b:59:5b:b4:51:59:3a:b3:0b:14:f4: + 12:df:67:a0:f4:ad:32:64:5e:b1:46:72:27:8c:12:7b:c5:44: + b4:ae +-----BEGIN CERTIFICATE----- +MIIDAzCCAmwCEQC5L2DMiJ+hekYJuFtwbIqvMA0GCSqGSIb3DQEBBQUAMIHBMQsw +CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xPDA6BgNVBAsTM0Ns +YXNzIDIgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBH +MjE6MDgGA1UECxMxKGMpIDE5OTggVmVyaVNpZ24sIEluYy4gLSBGb3IgYXV0aG9y +aXplZCB1c2Ugb25seTEfMB0GA1UECxMWVmVyaVNpZ24gVHJ1c3QgTmV0d29yazAe +Fw05ODA1MTgwMDAwMDBaFw0yODA4MDEyMzU5NTlaMIHBMQswCQYDVQQGEwJVUzEX +MBUGA1UEChMOVmVyaVNpZ24sIEluYy4xPDA6BgNVBAsTM0NsYXNzIDIgUHVibGlj +IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjE6MDgGA1UECxMx +KGMpIDE5OTggVmVyaVNpZ24sIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25s +eTEfMB0GA1UECxMWVmVyaVNpZ24gVHJ1c3QgTmV0d29yazCBnzANBgkqhkiG9w0B +AQEFAAOBjQAwgYkCgYEAp4gBIXQs5xoD8JjhlzwPIQjxnNuX6Zr8wgQGE75fUsjM +HiwSViy4AWkszJkfrbCWrnkE8hM5wXuYuggs6MKEEyyqaekJ9MepAqRCwiNPStjw +DqL7MWzJ5m+ZJwf15vRMeJ5t60aG+rmGyVTyssSv1EYcWskVMP8NbPUtDm3Of3cC +AwEAATANBgkqhkiG9w0BAQUFAAOBgQByLvl/0fFx+8Se9sVeUYpAmLho+Jscg9ji +nb3/7aHmZuovCfTK1+qlK5X2JGCGTUQug6XELaDTrnhpb3LabK4I8GOSN+a7xDAX +rXfMSTWqz9iP0b63GJZHc2pUIjRkLbYWm1lbtFFZOrMLFPQS32eg9K0yZF6xRnIn +jBJ7xUS0rg== +-----END CERTIFICATE----- + +GTE CyberTrust Root CA +====================== + +MD5 Fingerprint=C4:D7:F0:B2:A3:C5:7D:61:67:F0:04:CD:43:D3:BA:58 +Certificate: + Data: + Version: 1 (0x0) + Serial Number: 419 (0x1a3) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=US, O=GTE Corporation, CN=GTE CyberTrust Root + Validity + Not Before: Feb 23 23:01:00 1996 GMT + Not After : Feb 23 23:59:00 2006 GMT + Subject: C=US, O=GTE Corporation, CN=GTE CyberTrust Root + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:b8:e6:4f:ba:db:98:7c:71:7c:af:44:b7:d3:0f: + 46:d9:64:e5:93:c1:42:8e:c7:ba:49:8d:35:2d:7a: + e7:8b:bd:e5:05:31:59:c6:b1:2f:0a:0c:fb:9f:a7: + 3f:a2:09:66:84:56:1e:37:29:1b:87:e9:7e:0c:ca: + 9a:9f:a5:7f:f5:15:94:a3:d5:a2:46:82:d8:68:4c: + d1:37:15:06:68:af:bd:f8:b0:b3:f0:29:f5:95:5a: + 09:16:61:77:0a:22:25:d4:4f:45:aa:c7:bd:e5:96: + df:f9:d4:a8:8e:42:cc:24:c0:1e:91:27:4a:b5:6d: + 06:80:63:39:c4:a2:5e:38:03 + Exponent: 65537 (0x10001) + Signature Algorithm: md5WithRSAEncryption + 12:b3:75:c6:5f:1d:e1:61:55:80:00:d4:81:4b:7b:31:0f:23: + 63:e7:3d:f3:03:f9:f4:36:a8:bb:d9:e3:a5:97:4d:ea:2b:29: + e0:d6:6a:73:81:e6:c0:89:a3:d3:f1:e0:a5:a5:22:37:9a:63: + c2:48:20:b4:db:72:e3:c8:f6:d9:7c:be:b1:af:53:da:14:b4: + 21:b8:d6:d5:96:e3:fe:4e:0c:59:62:b6:9a:4a:f9:42:dd:8c: + 6f:81:a9:71:ff:f4:0a:72:6d:6d:44:0e:9d:f3:74:74:a8:d5: + 34:49:e9:5e:9e:e9:b4:7a:e1:e5:5a:1f:84:30:9c:d3:9f:a5: + 25:d8 +-----BEGIN CERTIFICATE----- +MIIB+jCCAWMCAgGjMA0GCSqGSIb3DQEBBAUAMEUxCzAJBgNVBAYTAlVTMRgwFgYD +VQQKEw9HVEUgQ29ycG9yYXRpb24xHDAaBgNVBAMTE0dURSBDeWJlclRydXN0IFJv +b3QwHhcNOTYwMjIzMjMwMTAwWhcNMDYwMjIzMjM1OTAwWjBFMQswCQYDVQQGEwJV +UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMRwwGgYDVQQDExNHVEUgQ3liZXJU +cnVzdCBSb290MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC45k+625h8cXyv +RLfTD0bZZOWTwUKOx7pJjTUteueLveUFMVnGsS8KDPufpz+iCWaEVh43KRuH6X4M +ypqfpX/1FZSj1aJGgthoTNE3FQZor734sLPwKfWVWgkWYXcKIiXUT0Wqx73llt/5 +1KiOQswkwB6RJ0q1bQaAYznEol44AwIDAQABMA0GCSqGSIb3DQEBBAUAA4GBABKz +dcZfHeFhVYAA1IFLezEPI2PnPfMD+fQ2qLvZ46WXTeorKeDWanOB5sCJo9Px4KWl +IjeaY8JIILTbcuPI9tl8vrGvU9oUtCG41tWW4/5ODFlitppK+ULdjG+BqXH/9Apy +bW1EDp3zdHSo1TRJ6V6e6bR64eVaH4QwnNOfpSXY +-----END CERTIFICATE----- + +Verisign Class 3 Public Primary Certification Authority - G2 +============================================================ + +MD5 Fingerprint=A2:33:9B:4C:74:78:73:D4:6C:E7:C1:F3:8D:CB:5C:E9 +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + 7d:d9:fe:07:cf:a8:1e:b7:10:79:67:fb:a7:89:34:c6 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification Authority - G2, OU=(c) 1998 VeriSign, Inc. - For authorized use only, OU=VeriSign Trust Network + Validity + Not Before: May 18 00:00:00 1998 GMT + Not After : Aug 1 23:59:59 2028 GMT + Subject: C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification Authority - G2, OU=(c) 1998 VeriSign, Inc. - For authorized use only, OU=VeriSign Trust Network + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:cc:5e:d1:11:5d:5c:69:d0:ab:d3:b9:6a:4c:99: + 1f:59:98:30:8e:16:85:20:46:6d:47:3f:d4:85:20: + 84:e1:6d:b3:f8:a4:ed:0c:f1:17:0f:3b:f9:a7:f9: + 25:d7:c1:cf:84:63:f2:7c:63:cf:a2:47:f2:c6:5b: + 33:8e:64:40:04:68:c1:80:b9:64:1c:45:77:c7:d8: + 6e:f5:95:29:3c:50:e8:34:d7:78:1f:a8:ba:6d:43: + 91:95:8f:45:57:5e:7e:c5:fb:ca:a4:04:eb:ea:97: + 37:54:30:6f:bb:01:47:32:33:cd:dc:57:9b:64:69: + 61:f8:9b:1d:1c:89:4f:5c:67 + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + 51:4d:cd:be:5c:cb:98:19:9c:15:b2:01:39:78:2e:4d:0f:67: + 70:70:99:c6:10:5a:94:a4:53:4d:54:6d:2b:af:0d:5d:40:8b: + 64:d3:d7:ee:de:56:61:92:5f:a6:c4:1d:10:61:36:d3:2c:27: + 3c:e8:29:09:b9:11:64:74:cc:b5:73:9f:1c:48:a9:bc:61:01: + ee:e2:17:a6:0c:e3:40:08:3b:0e:e7:eb:44:73:2a:9a:f1:69: + 92:ef:71:14:c3:39:ac:71:a7:91:09:6f:e4:71:06:b3:ba:59: + 57:26:79:00:f6:f8:0d:a2:33:30:28:d4:aa:58:a0:9d:9d:69: + 91:fd +-----BEGIN CERTIFICATE----- +MIIDAjCCAmsCEH3Z/gfPqB63EHln+6eJNMYwDQYJKoZIhvcNAQEFBQAwgcExCzAJ +BgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xh +c3MgMyBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcy +MTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3Jp +emVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMB4X +DTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVTMRcw +FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMg +UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEo +YykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5 +MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEB +AQUAA4GNADCBiQKBgQDMXtERXVxp0KvTuWpMmR9ZmDCOFoUgRm1HP9SFIIThbbP4 +pO0M8RcPO/mn+SXXwc+EY/J8Y8+iR/LGWzOOZEAEaMGAuWQcRXfH2G71lSk8UOg0 +13gfqLptQ5GVj0VXXn7F+8qkBOvqlzdUMG+7AUcyM83cV5tkaWH4mx0ciU9cZwID +AQABMA0GCSqGSIb3DQEBBQUAA4GBAFFNzb5cy5gZnBWyATl4Lk0PZ3BwmcYQWpSk +U01UbSuvDV1Ai2TT1+7eVmGSX6bEHRBhNtMsJzzoKQm5EWR0zLVznxxIqbxhAe7i +F6YM40AIOw7n60RzKprxaZLvcRTDOaxxp5EJb+RxBrO6WVcmeQD2+A2iMzAo1KpY +oJ2daZH9 +-----END CERTIFICATE----- + +Verisign Class 4 Public Primary Certification Authority - G2 +============================================================ + +MD5 Fingerprint=26:6D:2C:19:98:B6:70:68:38:50:54:19:EC:90:34:60 +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + 32:88:8e:9a:d2:f5:eb:13:47:f8:7f:c4:20:37:25:f8 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=Class 4 Public Primary Certification Authority - G2, OU=(c) 1998 VeriSign, Inc. - For authorized use only, OU=VeriSign Trust Network + Validity + Not Before: May 18 00:00:00 1998 GMT + Not After : Aug 1 23:59:59 2028 GMT + Subject: C=US, O=VeriSign, Inc., OU=Class 4 Public Primary Certification Authority - G2, OU=(c) 1998 VeriSign, Inc. - For authorized use only, OU=VeriSign Trust Network + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:ba:f0:e4:cf:f9:c4:ae:85:54:b9:07:57:f9:8f: + c5:7f:68:11:f8:c4:17:b0:44:dc:e3:30:73:d5:2a: + 62:2a:b8:d0:cc:1c:ed:28:5b:7e:bd:6a:dc:b3:91: + 24:ca:41:62:3c:fc:02:01:bf:1c:16:31:94:05:97: + 76:6e:a2:ad:bd:61:17:6c:4e:30:86:f0:51:37:2a: + 50:c7:a8:62:81:dc:5b:4a:aa:c1:a0:b4:6e:eb:2f: + e5:57:c5:b1:2b:40:70:db:5a:4d:a1:8e:1f:bd:03: + 1f:d8:03:d4:8f:4c:99:71:bc:e2:82:cc:58:e8:98: + 3a:86:d3:86:38:f3:00:29:1f + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + 85:8c:12:c1:a7:b9:50:15:7a:cb:3e:ac:b8:43:8a:dc:aa:dd: + 14:ba:89:81:7e:01:3c:23:71:21:88:2f:82:dc:63:fa:02:45: + ac:45:59:d7:2a:58:44:5b:b7:9f:81:3b:92:68:3d:e2:37:24: + f5:7b:6c:8f:76:35:96:09:a8:59:9d:b9:ce:23:ab:74:d6:83: + fd:32:73:27:d8:69:3e:43:74:f6:ae:c5:89:9a:e7:53:7c:e9: + 7b:f6:4b:f3:c1:65:83:de:8d:8a:9c:3c:88:8d:39:59:fc:aa: + 3f:22:8d:a1:c1:66:50:81:72:4c:ed:22:64:4f:4f:ca:80:91: + b6:29 +-----BEGIN CERTIFICATE----- +MIIDAjCCAmsCEDKIjprS9esTR/h/xCA3JfgwDQYJKoZIhvcNAQEFBQAwgcExCzAJ +BgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xh +c3MgNCBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcy +MTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3Jp +emVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMB4X +DTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVTMRcw +FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgNCBQdWJsaWMg +UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEo +YykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5 +MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEB +AQUAA4GNADCBiQKBgQC68OTP+cSuhVS5B1f5j8V/aBH4xBewRNzjMHPVKmIquNDM +HO0oW369atyzkSTKQWI8/AIBvxwWMZQFl3Zuoq29YRdsTjCG8FE3KlDHqGKB3FtK +qsGgtG7rL+VXxbErQHDbWk2hjh+9Ax/YA9SPTJlxvOKCzFjomDqG04Y48wApHwID +AQABMA0GCSqGSIb3DQEBBQUAA4GBAIWMEsGnuVAVess+rLhDityq3RS6iYF+ATwj +cSGIL4LcY/oCRaxFWdcqWERbt5+BO5JoPeI3JPV7bI92NZYJqFmduc4jq3TWg/0y +cyfYaT5DdPauxYma51N86Xv2S/PBZYPejYqcPIiNOVn8qj8ijaHBZlCBckztImRP +T8qAkbYp +-----END CERTIFICATE----- + +GlobalSign Root CA +================== + +MD5 Fingerprint=AB:BF:EA:E3:6B:29:A6:CC:A6:78:35:99:EF:AD:2B:80 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 02:00:00:00:00:00:d6:78:b7:94:05 + Signature Algorithm: md5WithRSAEncryption + Issuer: C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA + Validity + Not Before: Sep 1 12:00:00 1998 GMT + Not After : Jan 28 12:00:00 2014 GMT + Subject: C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:da:0e:e6:99:8d:ce:a3:e3:4f:8a:7e:fb:f1:8b: + 83:25:6b:ea:48:1f:f1:2a:b0:b9:95:11:04:bd:f0: + 63:d1:e2:67:66:cf:1c:dd:cf:1b:48:2b:ee:8d:89: + 8e:9a:af:29:80:65:ab:e9:c7:2d:12:cb:ab:1c:4c: + 70:07:a1:3d:0a:30:cd:15:8d:4f:f8:dd:d4:8c:50: + 15:1c:ef:50:ee:c4:2e:f7:fc:e9:52:f2:91:7d:e0: + 6d:d5:35:30:8e:5e:43:73:f2:41:e9:d5:6a:e3:b2: + 89:3a:56:39:38:6f:06:3c:88:69:5b:2a:4d:c5:a7: + 54:b8:6c:89:cc:9b:f9:3c:ca:e5:fd:89:f5:12:3c: + 92:78:96:d6:dc:74:6e:93:44:61:d1:8d:c7:46:b2: + 75:0e:86:e8:19:8a:d5:6d:6c:d5:78:16:95:a2:e9: + c8:0a:38:eb:f2:24:13:4f:73:54:93:13:85:3a:1b: + bc:1e:34:b5:8b:05:8c:b9:77:8b:b1:db:1f:20:91: + ab:09:53:6e:90:ce:7b:37:74:b9:70:47:91:22:51: + 63:16:79:ae:b1:ae:41:26:08:c8:19:2b:d1:46:aa: + 48:d6:64:2a:d7:83:34:ff:2c:2a:c1:6c:19:43:4a: + 07:85:e7:d3:7c:f6:21:68:ef:ea:f2:52:9f:7f:93: + 90:cf + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Subject Key Identifier: + 60:7B:66:1A:45:0D:97:CA:89:50:2F:7D:04:CD:34:A8:FF:FC:FD:4B + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: md5WithRSAEncryption + ae:aa:9f:fc:b7:d2:cb:1f:5f:39:29:28:18:9e:34:c9:6c:4f: + 6f:1a:f0:64:a2:70:4a:4f:13:86:9b:60:28:9e:e8:81:49:98: + 7d:0a:bb:e5:b0:9d:3d:36:db:8f:05:51:ff:09:31:2a:1f:dd: + 89:77:9e:0f:2e:6c:95:04:ed:86:cb:b4:00:3f:84:02:4d:80: + 6a:2a:2d:78:0b:ae:6f:2b:a2:83:44:83:1f:cd:50:82:4c:24: + af:bd:f7:a5:b4:c8:5a:0f:f4:e7:47:5e:49:8e:37:96:fe:9a: + 88:05:3a:d9:c0:db:29:87:e6:19:96:47:a7:3a:a6:8c:8b:3c: + 77:fe:46:63:a7:53:da:21:d1:ac:7e:49:a2:4b:e6:c3:67:59: + 2f:b3:8a:0e:bb:2c:bd:a9:aa:42:7c:35:c1:d8:7f:d5:a7:31: + 3a:4e:63:43:39:af:08:b0:61:34:8c:d3:98:a9:43:34:f6:0f: + 87:29:3b:9d:c2:56:58:98:77:c3:f7:1b:ac:f6:9d:f8:3e:aa: + a7:54:45:f0:f5:f9:d5:31:65:fe:6b:58:9c:71:b3:1e:d7:52: + ea:32:17:fc:40:60:1d:c9:79:24:b2:f6:6c:fd:a8:66:0e:82: + dd:98:cb:da:c2:44:4f:2e:a0:7b:f2:f7:6b:2c:76:11:84:46: + 8a:78:a3:e3 +-----BEGIN CERTIFICATE----- +MIIDdTCCAl2gAwIBAgILAgAAAAAA1ni3lAUwDQYJKoZIhvcNAQEEBQAwVzELMAkG +A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv +b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw +MDBaFw0xNDAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i +YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT +aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ +jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp +xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp +1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG +snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ +U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8 +9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIABjAdBgNVHQ4EFgQU +YHtmGkUNl8qJUC99BM00qP/8/UswDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0B +AQQFAAOCAQEArqqf/LfSyx9fOSkoGJ40yWxPbxrwZKJwSk8ThptgKJ7ogUmYfQq7 +5bCdPTbbjwVR/wkxKh/diXeeDy5slQTthsu0AD+EAk2AaioteAuubyuig0SDH81Q +gkwkr733pbTIWg/050deSY43lv6aiAU62cDbKYfmGZZHpzqmjIs8d/5GY6dT2iHR +rH5Jokvmw2dZL7OKDrssvamqQnw1wdh/1acxOk5jQzmvCLBhNIzTmKlDNPYPhyk7 +ncJWWJh3w/cbrPad+D6qp1RF8PX51TFl/mtYnHGzHtdS6jIX/EBgHcl5JLL2bP2o +Zg6C3ZjL2sJETy6ge/L3ayx2EYRGinij4w== +-----END CERTIFICATE----- + +GlobalSign Root CA - R2 +======================= + +MD5 Fingerprint=94:14:77:7E:3E:5E:FD:8F:30:BD:41:B0:CF:E7:D0:30 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 04:00:00:00:00:01:0f:86:26:e6:0d + Signature Algorithm: sha1WithRSAEncryption + Issuer: OU=GlobalSign Root CA - R2, O=GlobalSign, CN=GlobalSign + Validity + Not Before: Dec 15 08:00:00 2006 GMT + Not After : Dec 15 08:00:00 2021 GMT + Subject: OU=GlobalSign Root CA - R2, O=GlobalSign, CN=GlobalSign + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:a6:cf:24:0e:be:2e:6f:28:99:45:42:c4:ab:3e: + 21:54:9b:0b:d3:7f:84:70:fa:12:b3:cb:bf:87:5f: + c6:7f:86:d3:b2:30:5c:d6:fd:ad:f1:7b:dc:e5:f8: + 60:96:09:92:10:f5:d0:53:de:fb:7b:7e:73:88:ac: + 52:88:7b:4a:a6:ca:49:a6:5e:a8:a7:8c:5a:11:bc: + 7a:82:eb:be:8c:e9:b3:ac:96:25:07:97:4a:99:2a: + 07:2f:b4:1e:77:bf:8a:0f:b5:02:7c:1b:96:b8:c5: + b9:3a:2c:bc:d6:12:b9:eb:59:7d:e2:d0:06:86:5f: + 5e:49:6a:b5:39:5e:88:34:ec:bc:78:0c:08:98:84: + 6c:a8:cd:4b:b4:a0:7d:0c:79:4d:f0:b8:2d:cb:21: + ca:d5:6c:5b:7d:e1:a0:29:84:a1:f9:d3:94:49:cb: + 24:62:91:20:bc:dd:0b:d5:d9:cc:f9:ea:27:0a:2b: + 73:91:c6:9d:1b:ac:c8:cb:e8:e0:a0:f4:2f:90:8b: + 4d:fb:b0:36:1b:f6:19:7a:85:e0:6d:f2:61:13:88: + 5c:9f:e0:93:0a:51:97:8a:5a:ce:af:ab:d5:f7:aa: + 09:aa:60:bd:dc:d9:5f:df:72:a9:60:13:5e:00:01: + c9:4a:fa:3f:a4:ea:07:03:21:02:8e:82:ca:03:c2: + 9b:8f + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 9B:E2:07:57:67:1C:1E:C0:6A:06:DE:59:B4:9A:2D:DF:DC:19:86:2E + X509v3 CRL Distribution Points: + URI:http://crl.globalsign.net/root-r2.crl + + X509v3 Authority Key Identifier: + keyid:9B:E2:07:57:67:1C:1E:C0:6A:06:DE:59:B4:9A:2D:DF:DC:19:86:2E + + Signature Algorithm: sha1WithRSAEncryption + 99:81:53:87:1c:68:97:86:91:ec:e0:4a:b8:44:0b:ab:81:ac: + 27:4f:d6:c1:b8:1c:43:78:b3:0c:9a:fc:ea:2c:3c:6e:61:1b: + 4d:4b:29:f5:9f:05:1d:26:c1:b8:e9:83:00:62:45:b6:a9:08: + 93:b9:a9:33:4b:18:9a:c2:f8:87:88:4e:db:dd:71:34:1a:c1: + 54:da:46:3f:e0:d3:2a:ab:6d:54:22:f5:3a:62:cd:20:6f:ba: + 29:89:d7:dd:91:ee:d3:5c:a2:3e:a1:5b:41:f5:df:e5:64:43: + 2d:e9:d5:39:ab:d2:a2:df:b7:8b:d0:c0:80:19:1c:45:c0:2d: + 8c:e8:f8:2d:a4:74:56:49:c5:05:b5:4f:15:de:6e:44:78:39: + 87:a8:7e:bb:f3:79:18:91:bb:f4:6f:9d:c1:f0:8c:35:8c:5d: + 01:fb:c3:6d:b9:ef:44:6d:79:46:31:7e:0a:fe:a9:82:c1:ff: + ef:ab:6e:20:c4:50:c9:5f:9d:4d:9b:17:8c:0c:e5:01:c9:a0: + 41:6a:73:53:fa:a5:50:b4:6e:25:0f:fb:4c:18:f4:fd:52:d9: + 8e:69:b1:e8:11:0f:de:88:d8:fb:1d:49:f7:aa:de:95:cf:20: + 78:c2:60:12:db:25:40:8c:6a:fc:7e:42:38:40:64:12:f7:9e: + 81:e1:93:2e +-----BEGIN CERTIFICATE----- +MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4G +A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNp +Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1 +MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMjETMBEG +A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6ErPL +v4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8 +eoLrvozps6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklq +tTleiDTsvHgMCJiEbKjNS7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzd +C9XZzPnqJworc5HGnRusyMvo4KD0L5CLTfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pa +zq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6CygPCm48CAwEAAaOBnDCB +mTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUm+IH +V2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5n +bG9iYWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG +3lm0mi3f3BmGLjANBgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4Gs +J0/WwbgcQ3izDJr86iw8bmEbTUsp9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO +291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu01yiPqFbQfXf5WRDLenVOavS +ot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG79G+dwfCMNYxd +AfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7 +TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg== +-----END CERTIFICATE----- + +ValiCert Class 1 VA +=================== + +MD5 Fingerprint=65:58:AB:15:AD:57:6C:1E:A8:A7:B5:69:AC:BF:FF:EB +Certificate: + Data: + Version: 1 (0x0) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: L=ValiCert Validation Network, O=ValiCert, Inc., OU=ValiCert Class 1 Policy Validation Authority, CN=http://www.valicert.com//emailAddress=info@valicert.com + Validity + Not Before: Jun 25 22:23:48 1999 GMT + Not After : Jun 25 22:23:48 2019 GMT + Subject: L=ValiCert Validation Network, O=ValiCert, Inc., OU=ValiCert Class 1 Policy Validation Authority, CN=http://www.valicert.com//emailAddress=info@valicert.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:d8:59:82:7a:89:b8:96:ba:a6:2f:68:6f:58:2e: + a7:54:1c:06:6e:f4:ea:8d:48:bc:31:94:17:f0:f3: + 4e:bc:b2:b8:35:92:76:b0:d0:a5:a5:01:d7:00:03: + 12:22:19:08:f8:ff:11:23:9b:ce:07:f5:bf:69:1a: + 26:fe:4e:e9:d1:7f:9d:2c:40:1d:59:68:6e:a6:f8: + 58:b0:9d:1a:8f:d3:3f:f1:dc:19:06:81:a8:0e:e0: + 3a:dd:c8:53:45:09:06:e6:0f:70:c3:fa:40:a6:0e: + e2:56:05:0f:18:4d:fc:20:82:d1:73:55:74:8d:76: + 72:a0:1d:9d:1d:c0:dd:3f:71 + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + 50:68:3d:49:f4:2c:1c:06:94:df:95:60:7f:96:7b:17:fe:4f: + 71:ad:64:c8:dd:77:d2:ef:59:55:e8:3f:e8:8e:05:2a:21:f2: + 07:d2:b5:a7:52:fe:9c:b1:b6:e2:5b:77:17:40:ea:72:d6:23: + cb:28:81:32:c3:00:79:18:ec:59:17:89:c9:c6:6a:1e:71:c9: + fd:b7:74:a5:25:45:69:c5:48:ab:19:e1:45:8a:25:6b:19:ee: + e5:bb:12:f5:7f:f7:a6:8d:51:c3:f0:9d:74:b7:a9:3e:a0:a5: + ff:b6:49:03:13:da:22:cc:ed:71:82:2b:99:cf:3a:b7:f5:2d: + 72:c8 +-----BEGIN CERTIFICATE----- +MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0 +IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAz +BgNVBAsTLFZhbGlDZXJ0IENsYXNzIDEgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9y +aXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG +9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNTIyMjM0OFoXDTE5MDYy +NTIyMjM0OFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0d29y +azEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs +YXNzIDEgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRw +Oi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNl +cnQuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDYWYJ6ibiWuqYvaG9Y +LqdUHAZu9OqNSLwxlBfw8068srg1knaw0KWlAdcAAxIiGQj4/xEjm84H9b9pGib+ +TunRf50sQB1ZaG6m+FiwnRqP0z/x3BkGgagO4DrdyFNFCQbmD3DD+kCmDuJWBQ8Y +TfwggtFzVXSNdnKgHZ0dwN0/cQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFBoPUn0 +LBwGlN+VYH+Wexf+T3GtZMjdd9LvWVXoP+iOBSoh8gfStadS/pyxtuJbdxdA6nLW +I8sogTLDAHkY7FkXicnGah5xyf23dKUlRWnFSKsZ4UWKJWsZ7uW7EvV/96aNUcPw +nXS3qT6gpf+2SQMT2iLM7XGCK5nPOrf1LXLI +-----END CERTIFICATE----- + +ValiCert Class 2 VA +=================== + +MD5 Fingerprint=A9:23:75:9B:BA:49:36:6E:31:C2:DB:F2:E7:66:BA:87 +Certificate: + Data: + Version: 1 (0x0) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: L=ValiCert Validation Network, O=ValiCert, Inc., OU=ValiCert Class 2 Policy Validation Authority, CN=http://www.valicert.com//emailAddress=info@valicert.com + Validity + Not Before: Jun 26 00:19:54 1999 GMT + Not After : Jun 26 00:19:54 2019 GMT + Subject: L=ValiCert Validation Network, O=ValiCert, Inc., OU=ValiCert Class 2 Policy Validation Authority, CN=http://www.valicert.com//emailAddress=info@valicert.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:ce:3a:71:ca:e5:ab:c8:59:92:55:d7:ab:d8:74: + 0e:f9:ee:d9:f6:55:47:59:65:47:0e:05:55:dc:eb: + 98:36:3c:5c:53:5d:d3:30:cf:38:ec:bd:41:89:ed: + 25:42:09:24:6b:0a:5e:b3:7c:dd:52:2d:4c:e6:d4: + d6:7d:5a:59:a9:65:d4:49:13:2d:24:4d:1c:50:6f: + b5:c1:85:54:3b:fe:71:e4:d3:5c:42:f9:80:e0:91: + 1a:0a:5b:39:36:67:f3:3f:55:7c:1b:3f:b4:5f:64: + 73:34:e3:b4:12:bf:87:64:f8:da:12:ff:37:27:c1: + b3:43:bb:ef:7b:6e:2e:69:f7 + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + 3b:7f:50:6f:6f:50:94:99:49:62:38:38:1f:4b:f8:a5:c8:3e: + a7:82:81:f6:2b:c7:e8:c5:ce:e8:3a:10:82:cb:18:00:8e:4d: + bd:a8:58:7f:a1:79:00:b5:bb:e9:8d:af:41:d9:0f:34:ee:21: + 81:19:a0:32:49:28:f4:c4:8e:56:d5:52:33:fd:50:d5:7e:99: + 6c:03:e4:c9:4c:fc:cb:6c:ab:66:b3:4a:21:8c:e5:b5:0c:32: + 3e:10:b2:cc:6c:a1:dc:9a:98:4c:02:5b:f3:ce:b9:9e:a5:72: + 0e:4a:b7:3f:3c:e6:16:68:f8:be:ed:74:4c:bc:5b:d5:62:1f: + 43:dd +-----BEGIN CERTIFICATE----- +MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0 +IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAz +BgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9y +aXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG +9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAwMTk1NFoXDTE5MDYy +NjAwMTk1NFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0d29y +azEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs +YXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRw +Oi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNl +cnQuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDOOnHK5avIWZJV16vY +dA757tn2VUdZZUcOBVXc65g2PFxTXdMwzzjsvUGJ7SVCCSRrCl6zfN1SLUzm1NZ9 +WlmpZdRJEy0kTRxQb7XBhVQ7/nHk01xC+YDgkRoKWzk2Z/M/VXwbP7RfZHM047QS +v4dk+NoS/zcnwbNDu+97bi5p9wIDAQABMA0GCSqGSIb3DQEBBQUAA4GBADt/UG9v +UJSZSWI4OB9L+KXIPqeCgfYrx+jFzug6EILLGACOTb2oWH+heQC1u+mNr0HZDzTu +IYEZoDJJKPTEjlbVUjP9UNV+mWwD5MlM/Mtsq2azSiGM5bUMMj4QssxsodyamEwC +W/POuZ6lcg5Ktz885hZo+L7tdEy8W9ViH0Pd +-----END CERTIFICATE----- + +RSA Root Certificate 1 +====================== + +MD5 Fingerprint=A2:6F:53:B7:EE:40:DB:4A:68:E7:FA:18:D9:10:4B:72 +Certificate: + Data: + Version: 1 (0x0) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: L=ValiCert Validation Network, O=ValiCert, Inc., OU=ValiCert Class 3 Policy Validation Authority, CN=http://www.valicert.com//emailAddress=info@valicert.com + Validity + Not Before: Jun 26 00:22:33 1999 GMT + Not After : Jun 26 00:22:33 2019 GMT + Subject: L=ValiCert Validation Network, O=ValiCert, Inc., OU=ValiCert Class 3 Policy Validation Authority, CN=http://www.valicert.com//emailAddress=info@valicert.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:e3:98:51:96:1c:e8:d5:b1:06:81:6a:57:c3:72: + 75:93:ab:cf:9e:a6:fc:f3:16:52:d6:2d:4d:9f:35: + 44:a8:2e:04:4d:07:49:8a:38:29:f5:77:37:e7:b7: + ab:5d:df:36:71:14:99:8f:dc:c2:92:f1:e7:60:92: + 97:ec:d8:48:dc:bf:c1:02:20:c6:24:a4:28:4c:30: + 5a:76:6d:b1:5c:f3:dd:de:9e:10:71:a1:88:c7:5b: + 9b:41:6d:ca:b0:b8:8e:15:ee:ad:33:2b:cf:47:04: + 5c:75:71:0a:98:24:98:29:a7:49:59:a5:dd:f8:b7: + 43:62:61:f3:d3:e2:d0:55:3f + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + 56:bb:02:58:84:67:08:2c:df:1f:db:7b:49:33:f5:d3:67:9d: + f4:b4:0a:10:b3:c9:c5:2c:e2:92:6a:71:78:27:f2:70:83:42: + d3:3e:cf:a9:54:f4:f1:d8:92:16:8c:d1:04:cb:4b:ab:c9:9f: + 45:ae:3c:8a:a9:b0:71:33:5d:c8:c5:57:df:af:a8:35:b3:7f: + 89:87:e9:e8:25:92:b8:7f:85:7a:ae:d6:bc:1e:37:58:2a:67: + c9:91:cf:2a:81:3e:ed:c6:39:df:c0:3e:19:9c:19:cc:13:4d: + 82:41:b5:8c:de:e0:3d:60:08:20:0f:45:7e:6b:a2:7f:a3:8c: + 15:ee +-----BEGIN CERTIFICATE----- +MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0 +IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAz +BgNVBAsTLFZhbGlDZXJ0IENsYXNzIDMgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9y +aXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG +9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAwMjIzM1oXDTE5MDYy +NjAwMjIzM1owgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0d29y +azEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs +YXNzIDMgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRw +Oi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNl +cnQuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDjmFGWHOjVsQaBalfD +cnWTq8+epvzzFlLWLU2fNUSoLgRNB0mKOCn1dzfnt6td3zZxFJmP3MKS8edgkpfs +2Ejcv8ECIMYkpChMMFp2bbFc893enhBxoYjHW5tBbcqwuI4V7q0zK89HBFx1cQqY +JJgpp0lZpd34t0NiYfPT4tBVPwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFa7AliE +Zwgs3x/be0kz9dNnnfS0ChCzycUs4pJqcXgn8nCDQtM+z6lU9PHYkhaM0QTLS6vJ +n0WuPIqpsHEzXcjFV9+vqDWzf4mH6eglkrh/hXqu1rweN1gqZ8mRzyqBPu3GOd/A +PhmcGcwTTYJBtYze4D1gCCAPRX5ron+jjBXu +-----END CERTIFICATE----- + +Verisign Class 1 Public Primary Certification Authority - G3 +============================================================ + +MD5 Fingerprint=B1:47:BC:18:57:D1:18:A0:78:2D:EC:71:E8:2A:95:73 +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + 8b:5b:75:56:84:54:85:0b:00:cf:af:38:48:ce:b1:a4 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 1999 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 1 Public Primary Certification Authority - G3 + Validity + Not Before: Oct 1 00:00:00 1999 GMT + Not After : Jul 16 23:59:59 2036 GMT + Subject: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 1999 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 1 Public Primary Certification Authority - G3 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:dd:84:d4:b9:b4:f9:a7:d8:f3:04:78:9c:de:3d: + dc:6c:13:16:d9:7a:dd:24:51:66:c0:c7:26:59:0d: + ac:06:08:c2:94:d1:33:1f:f0:83:35:1f:6e:1b:c8: + de:aa:6e:15:4e:54:27:ef:c4:6d:1a:ec:0b:e3:0e: + f0:44:a5:57:c7:40:58:1e:a3:47:1f:71:ec:60:f6: + 6d:94:c8:18:39:ed:fe:42:18:56:df:e4:4c:49:10: + 78:4e:01:76:35:63:12:36:dd:66:bc:01:04:36:a3: + 55:68:d5:a2:36:09:ac:ab:21:26:54:06:ad:3f:ca: + 14:e0:ac:ca:ad:06:1d:95:e2:f8:9d:f1:e0:60:ff: + c2:7f:75:2b:4c:cc:da:fe:87:99:21:ea:ba:fe:3e: + 54:d7:d2:59:78:db:3c:6e:cf:a0:13:00:1a:b8:27: + a1:e4:be:67:96:ca:a0:c5:b3:9c:dd:c9:75:9e:eb: + 30:9a:5f:a3:cd:d9:ae:78:19:3f:23:e9:5c:db:29: + bd:ad:55:c8:1b:54:8c:63:f6:e8:a6:ea:c7:37:12: + 5c:a3:29:1e:02:d9:db:1f:3b:b4:d7:0f:56:47:81: + 15:04:4a:af:83:27:d1:c5:58:88:c1:dd:f6:aa:a7: + a3:18:da:68:aa:6d:11:51:e1:bf:65:6b:9f:96:76: + d1:3d + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + ab:66:8d:d7:b3:ba:c7:9a:b6:e6:55:d0:05:f1:9f:31:8d:5a: + aa:d9:aa:46:26:0f:71:ed:a5:ad:53:56:62:01:47:2a:44:e9: + fe:3f:74:0b:13:9b:b9:f4:4d:1b:b2:d1:5f:b2:b6:d2:88:5c: + b3:9f:cd:cb:d4:a7:d9:60:95:84:3a:f8:c1:37:1d:61:ca:e7: + b0:c5:e5:91:da:54:a6:ac:31:81:ae:97:de:cd:08:ac:b8:c0: + 97:80:7f:6e:72:a4:e7:69:13:95:65:1f:c4:93:3c:fd:79:8f: + 04:d4:3e:4f:ea:f7:9e:ce:cd:67:7c:4f:65:02:ff:91:85:54: + 73:c7:ff:36:f7:86:2d:ec:d0:5e:4f:ff:11:9f:72:06:d6:b8: + 1a:f1:4c:0d:26:65:e2:44:80:1e:c7:9f:e3:dd:e8:0a:da:ec: + a5:20:80:69:68:a1:4f:7e:e1:6b:cf:07:41:fa:83:8e:bc:38: + dd:b0:2e:11:b1:6b:b2:42:cc:9a:bc:f9:48:22:79:4a:19:0f: + b2:1c:3e:20:74:d9:6a:c3:be:f2:28:78:13:56:79:4f:6d:50: + ea:1b:b0:b5:57:b1:37:66:58:23:f3:dc:0f:df:0a:87:c4:ef: + 86:05:d5:38:14:60:99:a3:4b:de:06:96:71:2c:f2:db:b6:1f: + a4:ef:3f:ee +-----BEGIN CERTIFICATE----- +MIIEGjCCAwICEQCLW3VWhFSFCwDPrzhIzrGkMA0GCSqGSIb3DQEBBQUAMIHKMQsw +CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZl +cmlTaWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWdu +LCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlT +aWduIENsYXNzIDEgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3Jp +dHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQswCQYD +VQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlT +aWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJ +bmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWdu +IENsYXNzIDEgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg +LSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAN2E1Lm0+afY8wR4 +nN493GwTFtl63SRRZsDHJlkNrAYIwpTRMx/wgzUfbhvI3qpuFU5UJ+/EbRrsC+MO +8ESlV8dAWB6jRx9x7GD2bZTIGDnt/kIYVt/kTEkQeE4BdjVjEjbdZrwBBDajVWjV +ojYJrKshJlQGrT/KFOCsyq0GHZXi+J3x4GD/wn91K0zM2v6HmSHquv4+VNfSWXjb +PG7PoBMAGrgnoeS+Z5bKoMWznN3JdZ7rMJpfo83ZrngZPyPpXNspva1VyBtUjGP2 +6KbqxzcSXKMpHgLZ2x87tNcPVkeBFQRKr4Mn0cVYiMHd9qqnoxjaaKptEVHhv2Vr +n5Z20T0CAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAq2aN17O6x5q25lXQBfGfMY1a +qtmqRiYPce2lrVNWYgFHKkTp/j90CxObufRNG7LRX7K20ohcs5/Ny9Sn2WCVhDr4 +wTcdYcrnsMXlkdpUpqwxga6X3s0IrLjAl4B/bnKk52kTlWUfxJM8/XmPBNQ+T+r3 +ns7NZ3xPZQL/kYVUc8f/NveGLezQXk//EZ9yBta4GvFMDSZl4kSAHsef493oCtrs +pSCAaWihT37ha88HQfqDjrw43bAuEbFrskLMmrz5SCJ5ShkPshw+IHTZasO+8ih4 +E1Z5T21Q6huwtVexN2ZYI/PcD98Kh8TvhgXVOBRgmaNL3gaWcSzy27YfpO8/7g== +-----END CERTIFICATE----- + +Verisign Class 2 Public Primary Certification Authority - G3 +============================================================ + +MD5 Fingerprint=F8:BE:C4:63:22:C9:A8:46:74:8B:B8:1D:1E:4A:2B:F6 +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + 61:70:cb:49:8c:5f:98:45:29:e7:b0:a6:d9:50:5b:7a + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 1999 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 2 Public Primary Certification Authority - G3 + Validity + Not Before: Oct 1 00:00:00 1999 GMT + Not After : Jul 16 23:59:59 2036 GMT + Subject: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 1999 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 2 Public Primary Certification Authority - G3 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:af:0a:0d:c2:d5:2c:db:67:b9:2d:e5:94:27:dd: + a5:be:e0:b0:4d:8f:b3:61:56:3c:d6:7c:c3:f4:cd: + 3e:86:cb:a2:88:e2:e1:d8:a4:69:c5:b5:e2:bf:c1: + a6:47:50:5e:46:39:8b:d5:96:ba:b5:6f:14:bf:10: + ce:27:13:9e:05:47:9b:31:7a:13:d8:1f:d9:d3:02: + 37:8b:ad:2c:47:f0:8e:81:06:a7:0d:30:0c:eb:f7: + 3c:0f:20:1d:dc:72:46:ee:a5:02:c8:5b:c3:c9:56: + 69:4c:c5:18:c1:91:7b:0b:d5:13:00:9b:bc:ef:c3: + 48:3e:46:60:20:85:2a:d5:90:b6:cd:8b:a0:cc:32: + dd:b7:fd:40:55:b2:50:1c:56:ae:cc:8d:77:4d:c7: + 20:4d:a7:31:76:ef:68:92:8a:90:1e:08:81:56:b2: + ad:69:a3:52:d0:cb:1c:c4:23:3d:1f:99:fe:4c:e8: + 16:63:8e:c6:08:8e:f6:31:f6:d2:fa:e5:76:dd:b5: + 1c:92:a3:49:cd:cd:01:cd:68:cd:a9:69:ba:a3:eb: + 1d:0d:9c:a4:20:a6:c1:a0:c5:d1:46:4c:17:6d:d2: + ac:66:3f:96:8c:e0:84:d4:36:ff:22:59:c5:f9:11: + 60:a8:5f:04:7d:f2:1a:f6:25:42:61:0f:c4:4a:b8: + 3e:89 + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + 34:26:15:3c:c0:8d:4d:43:49:1d:bd:e9:21:92:d7:66:9c:b7: + de:c5:b8:d0:e4:5d:5f:76:22:c0:26:f9:84:3a:3a:f9:8c:b5: + fb:ec:60:f1:e8:ce:04:b0:c8:dd:a7:03:8f:30:f3:98:df:a4: + e6:a4:31:df:d3:1c:0b:46:dc:72:20:3f:ae:ee:05:3c:a4:33: + 3f:0b:39:ac:70:78:73:4b:99:2b:df:30:c2:54:b0:a8:3b:55: + a1:fe:16:28:cd:42:bd:74:6e:80:db:27:44:a7:ce:44:5d:d4: + 1b:90:98:0d:1e:42:94:b1:00:2c:04:d0:74:a3:02:05:22:63: + 63:cd:83:b5:fb:c1:6d:62:6b:69:75:fd:5d:70:41:b9:f5:bf: + 7c:df:be:c1:32:73:22:21:8b:58:81:7b:15:91:7a:ba:e3:64: + 48:b0:7f:fb:36:25:da:95:d0:f1:24:14:17:dd:18:80:6b:46: + 23:39:54:f5:8e:62:09:04:1d:94:90:a6:9b:e6:25:e2:42:45: + aa:b8:90:ad:be:08:8f:a9:0b:42:18:94:cf:72:39:e1:b1:43: + e0:28:cf:b7:e7:5a:6c:13:6b:49:b3:ff:e3:18:7c:89:8b:33: + 5d:ac:33:d7:a7:f9:da:3a:55:c9:58:10:f9:aa:ef:5a:b6:cf: + 4b:4b:df:2a +-----BEGIN CERTIFICATE----- +MIIEGTCCAwECEGFwy0mMX5hFKeewptlQW3owDQYJKoZIhvcNAQEFBQAwgcoxCzAJ +BgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjEfMB0GA1UECxMWVmVy +aVNpZ24gVHJ1c3QgTmV0d29yazE6MDgGA1UECxMxKGMpIDE5OTkgVmVyaVNpZ24s +IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTFFMEMGA1UEAxM8VmVyaVNp +Z24gQ2xhc3MgMiBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0 +eSAtIEczMB4XDTk5MTAwMTAwMDAwMFoXDTM2MDcxNjIzNTk1OVowgcoxCzAJBgNV +BAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjEfMB0GA1UECxMWVmVyaVNp +Z24gVHJ1c3QgTmV0d29yazE6MDgGA1UECxMxKGMpIDE5OTkgVmVyaVNpZ24sIElu +Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTFFMEMGA1UEAxM8VmVyaVNpZ24g +Q2xhc3MgMiBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt +IEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArwoNwtUs22e5LeWU +J92lvuCwTY+zYVY81nzD9M0+hsuiiOLh2KRpxbXiv8GmR1BeRjmL1Za6tW8UvxDO +JxOeBUebMXoT2B/Z0wI3i60sR/COgQanDTAM6/c8DyAd3HJG7qUCyFvDyVZpTMUY +wZF7C9UTAJu878NIPkZgIIUq1ZC2zYugzDLdt/1AVbJQHFauzI13TccgTacxdu9o +koqQHgiBVrKtaaNS0MscxCM9H5n+TOgWY47GCI72MfbS+uV23bUckqNJzc0BzWjN +qWm6o+sdDZykIKbBoMXRRkwXbdKsZj+WjOCE1Db/IlnF+RFgqF8EffIa9iVCYQ/E +Srg+iQIDAQABMA0GCSqGSIb3DQEBBQUAA4IBAQA0JhU8wI1NQ0kdvekhktdmnLfe +xbjQ5F1fdiLAJvmEOjr5jLX77GDx6M4EsMjdpwOPMPOY36TmpDHf0xwLRtxyID+u +7gU8pDM/CzmscHhzS5kr3zDCVLCoO1Wh/hYozUK9dG6A2ydEp85EXdQbkJgNHkKU +sQAsBNB0owIFImNjzYO1+8FtYmtpdf1dcEG59b98377BMnMiIYtYgXsVkXq642RI +sH/7NiXaldDxJBQX3RiAa0YjOVT1jmIJBB2UkKab5iXiQkWquJCtvgiPqQtCGJTP +cjnhsUPgKM+351psE2tJs//jGHyJizNdrDPXp/naOlXJWBD5qu9ats9LS98q +-----END CERTIFICATE----- + +Verisign Class 3 Public Primary Certification Authority - G3 +============================================================ + +MD5 Fingerprint=CD:68:B6:A7:C7:C4:CE:75:E0:1D:4F:57:44:61:92:09 +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + 9b:7e:06:49:a3:3e:62:b9:d5:ee:90:48:71:29:ef:57 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 1999 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 3 Public Primary Certification Authority - G3 + Validity + Not Before: Oct 1 00:00:00 1999 GMT + Not After : Jul 16 23:59:59 2036 GMT + Subject: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 1999 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 3 Public Primary Certification Authority - G3 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:cb:ba:9c:52:fc:78:1f:1a:1e:6f:1b:37:73:bd: + f8:c9:6b:94:12:30:4f:f0:36:47:f5:d0:91:0a:f5: + 17:c8:a5:61:c1:16:40:4d:fb:8a:61:90:e5:76:20: + c1:11:06:7d:ab:2c:6e:a6:f5:11:41:8e:fa:2d:ad: + 2a:61:59:a4:67:26:4c:d0:e8:bc:52:5b:70:20:04: + 58:d1:7a:c9:a4:69:bc:83:17:64:ad:05:8b:bc:d0: + 58:ce:8d:8c:f5:eb:f0:42:49:0b:9d:97:27:67:32: + 6e:e1:ae:93:15:1c:70:bc:20:4d:2f:18:de:92:88: + e8:6c:85:57:11:1a:e9:7e:e3:26:11:54:a2:45:96: + 55:83:ca:30:89:e8:dc:d8:a3:ed:2a:80:3f:7f:79: + 65:57:3e:15:20:66:08:2f:95:93:bf:aa:47:2f:a8: + 46:97:f0:12:e2:fe:c2:0a:2b:51:e6:76:e6:b7:46: + b7:e2:0d:a6:cc:a8:c3:4c:59:55:89:e6:e8:53:5c: + 1c:ea:9d:f0:62:16:0b:a7:c9:5f:0c:f0:de:c2:76: + ce:af:f7:6a:f2:fa:41:a6:a2:33:14:c9:e5:7a:63: + d3:9e:62:37:d5:85:65:9e:0e:e6:53:24:74:1b:5e: + 1d:12:53:5b:c7:2c:e7:83:49:3b:15:ae:8a:68:b9: + 57:97 + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + 11:14:96:c1:ab:92:08:f7:3f:2f:c9:b2:fe:e4:5a:9f:64:de: + db:21:4f:86:99:34:76:36:57:dd:d0:15:2f:c5:ad:7f:15:1f: + 37:62:73:3e:d4:e7:5f:ce:17:03:db:35:fa:2b:db:ae:60:09: + 5f:1e:5f:8f:6e:bb:0b:3d:ea:5a:13:1e:0c:60:6f:b5:c0:b5: + 23:22:2e:07:0b:cb:a9:74:cb:47:bb:1d:c1:d7:a5:6b:cc:2f: + d2:42:fd:49:dd:a7:89:cf:53:ba:da:00:5a:28:bf:82:df:f8: + ba:13:1d:50:86:82:fd:8e:30:8f:29:46:b0:1e:3d:35:da:38: + 62:16:18:4a:ad:e6:b6:51:6c:de:af:62:eb:01:d0:1e:24:fe: + 7a:8f:12:1a:12:68:b8:fb:66:99:14:14:45:5c:ae:e7:ae:69: + 17:81:2b:5a:37:c9:5e:2a:f4:c6:e2:a1:5c:54:9b:a6:54:00: + cf:f0:f1:c1:c7:98:30:1a:3b:36:16:db:a3:6e:ea:fd:ad:b2: + c2:da:ef:02:47:13:8a:c0:f1:b3:31:ad:4f:1c:e1:4f:9c:af: + 0f:0c:9d:f7:78:0d:d8:f4:35:56:80:da:b7:6d:17:8f:9d:1e: + 81:64:e1:fe:c5:45:ba:ad:6b:b9:0a:7a:4e:4f:4b:84:ee:4b: + f1:7d:dd:11 +-----BEGIN CERTIFICATE----- +MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQsw +CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZl +cmlTaWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWdu +LCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlT +aWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3Jp +dHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQswCQYD +VQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlT +aWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJ +bmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWdu +IENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg +LSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMu6nFL8eB8aHm8b +N3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1EUGO+i2t +KmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGu +kxUccLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBm +CC+Vk7+qRy+oRpfwEuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJ +Xwzw3sJ2zq/3avL6QaaiMxTJ5Xpj055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWu +imi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAERSWwauSCPc/L8my/uRan2Te +2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5fj267Cz3qWhMe +DGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC +/Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565p +F4ErWjfJXir0xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGt +TxzhT5yvDwyd93gN2PQ1VoDat20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ== +-----END CERTIFICATE----- + +GTE CyberTrust Global Root +========================== + +MD5 Fingerprint=CA:3D:D3:68:F1:03:5C:D0:32:FA:B8:2B:59:E8:5A:DB +Certificate: + Data: + Version: 1 (0x0) + Serial Number: 421 (0x1a5) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=US, O=GTE Corporation, OU=GTE CyberTrust Solutions, Inc., CN=GTE CyberTrust Global Root + Validity + Not Before: Aug 13 00:29:00 1998 GMT + Not After : Aug 13 23:59:00 2018 GMT + Subject: C=US, O=GTE Corporation, OU=GTE CyberTrust Solutions, Inc., CN=GTE CyberTrust Global Root + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:95:0f:a0:b6:f0:50:9c:e8:7a:c7:88:cd:dd:17: + 0e:2e:b0:94:d0:1b:3d:0e:f6:94:c0:8a:94:c7:06: + c8:90:97:c8:b8:64:1a:7a:7e:6c:3c:53:e1:37:28: + 73:60:7f:b2:97:53:07:9f:53:f9:6d:58:94:d2:af: + 8d:6d:88:67:80:e6:ed:b2:95:cf:72:31:ca:a5:1c: + 72:ba:5c:02:e7:64:42:e7:f9:a9:2c:d6:3a:0d:ac: + 8d:42:aa:24:01:39:e6:9c:3f:01:85:57:0d:58:87: + 45:f8:d3:85:aa:93:69:26:85:70:48:80:3f:12:15: + c7:79:b4:1f:05:2f:3b:62:99 + Exponent: 65537 (0x10001) + Signature Algorithm: md5WithRSAEncryption + 6d:eb:1b:09:e9:5e:d9:51:db:67:22:61:a4:2a:3c:48:77:e3: + a0:7c:a6:de:73:a2:14:03:85:3d:fb:ab:0e:30:c5:83:16:33: + 81:13:08:9e:7b:34:4e:df:40:c8:74:d7:b9:7d:dc:f4:76:55: + 7d:9b:63:54:18:e9:f0:ea:f3:5c:b1:d9:8b:42:1e:b9:c0:95: + 4e:ba:fa:d5:e2:7c:f5:68:61:bf:8e:ec:05:97:5f:5b:b0:d7: + a3:85:34:c4:24:a7:0d:0f:95:93:ef:cb:94:d8:9e:1f:9d:5c: + 85:6d:c7:aa:ae:4f:1f:22:b5:cd:95:ad:ba:a7:cc:f9:ab:0b: + 7a:7f +-----BEGIN CERTIFICATE----- +MIICWjCCAcMCAgGlMA0GCSqGSIb3DQEBBAUAMHUxCzAJBgNVBAYTAlVTMRgwFgYD +VQQKEw9HVEUgQ29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRydXN0IFNv +bHV0aW9ucywgSW5jLjEjMCEGA1UEAxMaR1RFIEN5YmVyVHJ1c3QgR2xvYmFsIFJv +b3QwHhcNOTgwODEzMDAyOTAwWhcNMTgwODEzMjM1OTAwWjB1MQswCQYDVQQGEwJV +UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU +cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds +b2JhbCBSb290MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCVD6C28FCc6HrH +iM3dFw4usJTQGz0O9pTAipTHBsiQl8i4ZBp6fmw8U+E3KHNgf7KXUwefU/ltWJTS +r41tiGeA5u2ylc9yMcqlHHK6XALnZELn+aks1joNrI1CqiQBOeacPwGFVw1Yh0X4 +04Wqk2kmhXBIgD8SFcd5tB8FLztimQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAG3r +GwnpXtlR22ciYaQqPEh346B8pt5zohQDhT37qw4wxYMWM4ETCJ57NE7fQMh017l9 +3PR2VX2bY1QY6fDq81yx2YtCHrnAlU66+tXifPVoYb+O7AWXX1uw16OFNMQkpw0P +lZPvy5TYnh+dXIVtx6quTx8itc2VrbqnzPmrC3p/ +-----END CERTIFICATE----- + +Verisign Class 4 Public Primary Certification Authority - G3 +============================================================ + +MD5 Fingerprint=DB:C8:F2:27:2E:B1:EA:6A:29:23:5D:FE:56:3E:33:DF +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + ec:a0:a7:8b:6e:75:6a:01:cf:c4:7c:cc:2f:94:5e:d7 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 1999 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 4 Public Primary Certification Authority - G3 + Validity + Not Before: Oct 1 00:00:00 1999 GMT + Not After : Jul 16 23:59:59 2036 GMT + Subject: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 1999 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 4 Public Primary Certification Authority - G3 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:ad:cb:a5:11:69:c6:59:ab:f1:8f:b5:19:0f:56: + ce:cc:b5:1f:20:e4:9e:26:25:4b:e0:73:65:89:59: + de:d0:83:e4:f5:0f:b5:bb:ad:f1:7c:e8:21:fc:e4: + e8:0c:ee:7c:45:22:19:76:92:b4:13:b7:20:5b:09: + fa:61:ae:a8:f2:a5:8d:85:c2:2a:d6:de:66:36:d2: + 9b:02:f4:a8:92:60:7c:9c:69:b4:8f:24:1e:d0:86: + 52:f6:32:9c:41:58:1e:22:bd:cd:45:62:95:08:6e: + d0:66:dd:53:a2:cc:f0:10:dc:54:73:8b:04:a1:46: + 33:33:5c:17:40:b9:9e:4d:d3:f3:be:55:83:e8:b1: + 89:8e:5a:7c:9a:96:22:90:3b:88:25:f2:d2:53:88: + 02:0c:0b:78:f2:e6:37:17:4b:30:46:07:e4:80:6d: + a6:d8:96:2e:e8:2c:f8:11:b3:38:0d:66:a6:9b:ea: + c9:23:5b:db:8e:e2:f3:13:8e:1a:59:2d:aa:02:f0: + ec:a4:87:66:dc:c1:3f:f5:d8:b9:f4:ec:82:c6:d2: + 3d:95:1d:e5:c0:4f:84:c9:d9:a3:44:28:06:6a:d7: + 45:ac:f0:6b:6a:ef:4e:5f:f8:11:82:1e:38:63:34: + 66:50:d4:3e:93:73:fa:30:c3:66:ad:ff:93:2d:97: + ef:03 + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + 8f:fa:25:6b:4f:5b:e4:a4:4e:27:55:ab:22:15:59:3c:ca:b5: + 0a:d4:4a:db:ab:dd:a1:5f:53:c5:a0:57:39:c2:ce:47:2b:be: + 3a:c8:56:bf:c2:d9:27:10:3a:b1:05:3c:c0:77:31:bb:3a:d3: + 05:7b:6d:9a:1c:30:8c:80:cb:93:93:2a:83:ab:05:51:82:02: + 00:11:67:6b:f3:88:61:47:5f:03:93:d5:5b:0d:e0:f1:d4:a1: + 32:35:85:b2:3a:db:b0:82:ab:d1:cb:0a:bc:4f:8c:5b:c5:4b: + 00:3b:1f:2a:82:a6:7e:36:85:dc:7e:3c:67:00:b5:e4:3b:52: + e0:a8:eb:5d:15:f9:c6:6d:f0:ad:1d:0e:85:b7:a9:9a:73:14: + 5a:5b:8f:41:28:c0:d5:e8:2d:4d:a4:5e:cd:aa:d9:ed:ce:dc: + d8:d5:3c:42:1d:17:c1:12:5d:45:38:c3:38:f3:fc:85:2e:83: + 46:48:b2:d7:20:5f:92:36:8f:e7:79:0f:98:5e:99:e8:f0:d0: + a4:bb:f5:53:bd:2a:ce:59:b0:af:6e:7f:6c:bb:d2:1e:00:b0: + 21:ed:f8:41:62:82:b9:d8:b2:c4:bb:46:50:f3:31:c5:8f:01: + a8:74:eb:f5:78:27:da:e7:f7:66:43:f3:9e:83:3e:20:aa:c3: + 35:60:91:ce +-----BEGIN CERTIFICATE----- +MIIEGjCCAwICEQDsoKeLbnVqAc/EfMwvlF7XMA0GCSqGSIb3DQEBBQUAMIHKMQsw +CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZl +cmlTaWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWdu +LCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlT +aWduIENsYXNzIDQgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3Jp +dHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQswCQYD +VQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlT +aWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJ +bmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWdu +IENsYXNzIDQgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg +LSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK3LpRFpxlmr8Y+1 +GQ9Wzsy1HyDkniYlS+BzZYlZ3tCD5PUPtbut8XzoIfzk6AzufEUiGXaStBO3IFsJ ++mGuqPKljYXCKtbeZjbSmwL0qJJgfJxptI8kHtCGUvYynEFYHiK9zUVilQhu0Gbd +U6LM8BDcVHOLBKFGMzNcF0C5nk3T875Vg+ixiY5afJqWIpA7iCXy0lOIAgwLePLm +NxdLMEYH5IBtptiWLugs+BGzOA1mppvqySNb247i8xOOGlktqgLw7KSHZtzBP/XY +ufTsgsbSPZUd5cBPhMnZo0QoBmrXRazwa2rvTl/4EYIeOGM0ZlDUPpNz+jDDZq3/ +ky2X7wMCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAj/ola09b5KROJ1WrIhVZPMq1 +CtRK26vdoV9TxaBXOcLORyu+OshWv8LZJxA6sQU8wHcxuzrTBXttmhwwjIDLk5Mq +g6sFUYICABFna/OIYUdfA5PVWw3g8dShMjWFsjrbsIKr0csKvE+MW8VLADsfKoKm +fjaF3H48ZwC15DtS4KjrXRX5xm3wrR0OhbepmnMUWluPQSjA1egtTaRezarZ7c7c +2NU8Qh0XwRJdRTjDOPP8hS6DRkiy1yBfkjaP53kPmF6Z6PDQpLv1U70qzlmwr25/ +bLvSHgCwIe34QWKCudiyxLtGUPMxxY8BqHTr9Xgn2uf3ZkPznoM+IKrDNWCRzg== +-----END CERTIFICATE----- + +Entrust.net Secure Server CA +============================ + +MD5 Fingerprint=DF:F2:80:73:CC:F1:E6:61:73:FC:F5:42:E9:C5:7C:EE +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 927650371 (0x374ad243) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=Entrust.net, OU=www.entrust.net/CPS incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Secure Server Certification Authority + Validity + Not Before: May 25 16:09:40 1999 GMT + Not After : May 25 16:39:40 2019 GMT + Subject: C=US, O=Entrust.net, OU=www.entrust.net/CPS incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Secure Server Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:cd:28:83:34:54:1b:89:f3:0f:af:37:91:31:ff: + af:31:60:c9:a8:e8:b2:10:68:ed:9f:e7:93:36:f1: + 0a:64:bb:47:f5:04:17:3f:23:47:4d:c5:27:19:81: + 26:0c:54:72:0d:88:2d:d9:1f:9a:12:9f:bc:b3:71: + d3:80:19:3f:47:66:7b:8c:35:28:d2:b9:0a:df:24: + da:9c:d6:50:79:81:7a:5a:d3:37:f7:c2:4a:d8:29: + 92:26:64:d1:e4:98:6c:3a:00:8a:f5:34:9b:65:f8: + ed:e3:10:ff:fd:b8:49:58:dc:a0:de:82:39:6b:81: + b1:16:19:61:b9:54:b6:e6:43 + Exponent: 3 (0x3) + X509v3 extensions: + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 CRL Distribution Points: + DirName:/C=US/O=Entrust.net/OU=www.entrust.net/CPS incorp. by ref. (limits liab.)/OU=(c) 1999 Entrust.net Limited/CN=Entrust.net Secure Server Certification Authority/CN=CRL1 + URI:http://www.entrust.net/CRL/net1.crl + + X509v3 Private Key Usage Period: + Not Before: May 25 16:09:40 1999 GMT, Not After: May 25 16:09:40 2019 GMT + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:F0:17:62:13:55:3D:B3:FF:0A:00:6B:FB:50:84:97:F3:ED:62:D0:1A + + X509v3 Subject Key Identifier: + F0:17:62:13:55:3D:B3:FF:0A:00:6B:FB:50:84:97:F3:ED:62:D0:1A + X509v3 Basic Constraints: + CA:TRUE + 1.2.840.113533.7.65.0: + 0 +..V4.0.... + Signature Algorithm: sha1WithRSAEncryption + 90:dc:30:02:fa:64:74:c2:a7:0a:a5:7c:21:8d:34:17:a8:fb: + 47:0e:ff:25:7c:8d:13:0a:fb:e4:98:b5:ef:8c:f8:c5:10:0d: + f7:92:be:f1:c3:d5:d5:95:6a:04:bb:2c:ce:26:36:65:c8:31: + c6:e7:ee:3f:e3:57:75:84:7a:11:ef:46:4f:18:f4:d3:98:bb: + a8:87:32:ba:72:f6:3c:e2:3d:9f:d7:1d:d9:c3:60:43:8c:58: + 0e:22:96:2f:62:a3:2c:1f:ba:ad:05:ef:ab:32:78:87:a0:54: + 73:19:b5:5c:05:f9:52:3e:6d:2d:45:0b:f7:0a:93:ea:ed:06: + f9:b2 +-----BEGIN CERTIFICATE----- +MIIE2DCCBEGgAwIBAgIEN0rSQzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC +VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u +ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc +KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u +ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05OTA1 +MjUxNjA5NDBaFw0xOTA1MjUxNjM5NDBaMIHDMQswCQYDVQQGEwJVUzEUMBIGA1UE +ChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5j +b3JwLiBieSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBF +bnRydXN0Lm5ldCBMaW1pdGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUg +U2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGdMA0GCSqGSIb3DQEBAQUA +A4GLADCBhwKBgQDNKIM0VBuJ8w+vN5Ex/68xYMmo6LIQaO2f55M28Qpku0f1BBc/ +I0dNxScZgSYMVHINiC3ZH5oSn7yzcdOAGT9HZnuMNSjSuQrfJNqc1lB5gXpa0zf3 +wkrYKZImZNHkmGw6AIr1NJtl+O3jEP/9uElY3KDegjlrgbEWGWG5VLbmQwIBA6OC +AdcwggHTMBEGCWCGSAGG+EIBAQQEAwIABzCCARkGA1UdHwSCARAwggEMMIHeoIHb +oIHYpIHVMIHSMQswCQYDVQQGEwJVUzEUMBIGA1UEChMLRW50cnVzdC5uZXQxOzA5 +BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5jb3JwLiBieSByZWYuIChsaW1p +dHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBFbnRydXN0Lm5ldCBMaW1pdGVk +MTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENlcnRpZmljYXRp +b24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMCmgJ6AlhiNodHRwOi8vd3d3LmVu +dHJ1c3QubmV0L0NSTC9uZXQxLmNybDArBgNVHRAEJDAigA8xOTk5MDUyNTE2MDk0 +MFqBDzIwMTkwNTI1MTYwOTQwWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAU8Bdi +E1U9s/8KAGv7UISX8+1i0BowHQYDVR0OBBYEFPAXYhNVPbP/CgBr+1CEl/PtYtAa +MAwGA1UdEwQFMAMBAf8wGQYJKoZIhvZ9B0EABAwwChsEVjQuMAMCBJAwDQYJKoZI +hvcNAQEFBQADgYEAkNwwAvpkdMKnCqV8IY00F6j7Rw7/JXyNEwr75Ji174z4xRAN +95K+8cPV1ZVqBLssziY2ZcgxxufuP+NXdYR6Ee9GTxj005i7qIcyunL2POI9n9cd +2cNgQ4xYDiKWL2KjLB+6rQXvqzJ4h6BUcxm1XAX5Uj5tLUUL9wqT6u0G+bI= +-----END CERTIFICATE----- + +Entrust.net Secure Personal CA +============================== + +MD5 Fingerprint=0C:41:2F:13:5B:A0:54:F5:96:66:2D:7E:CD:0E:03:F4 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 939758062 (0x380391ee) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=US, O=Entrust.net, OU=www.entrust.net/Client_CA_Info/CPS incorp. by ref. limits liab., OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Client Certification Authority + Validity + Not Before: Oct 12 19:24:30 1999 GMT + Not After : Oct 12 19:54:30 2019 GMT + Subject: C=US, O=Entrust.net, OU=www.entrust.net/Client_CA_Info/CPS incorp. by ref. limits liab., OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Client Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:c8:3a:99:5e:31:17:df:ac:27:6f:90:7b:e4:19: + ff:45:a3:34:c2:db:c1:a8:4f:f0:68:ea:84:fd:9f: + 75:79:cf:c1:8a:51:94:af:c7:57:03:47:64:9e:ad: + 82:1b:5a:da:7f:37:78:47:bb:37:98:12:96:ce:c6: + 13:7d:ef:d2:0c:30:51:a9:39:9e:55:f8:fb:b1:e7: + 30:de:83:b2:ba:3e:f1:d5:89:3b:3b:85:ba:aa:74: + 2c:fe:3f:31:6e:af:91:95:6e:06:d4:07:4d:4b:2c: + 56:47:18:04:52:da:0e:10:93:bf:63:90:9b:e1:df: + 8c:e6:02:a4:e6:4f:5e:f7:8b + Exponent: 3 (0x3) + X509v3 extensions: + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 CRL Distribution Points: + DirName:/C=US/O=Entrust.net/OU=www.entrust.net/Client_CA_Info/CPS incorp. by ref. limits liab./OU=(c) 1999 Entrust.net Limited/CN=Entrust.net Client Certification Authority/CN=CRL1 + URI:http://www.entrust.net/CRL/Client1.crl + + X509v3 Private Key Usage Period: + Not Before: Oct 12 19:24:30 1999 GMT, Not After: Oct 12 19:24:30 2019 GMT + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:C4:FB:9C:29:7B:97:CD:4C:96:FC:EE:5B:B3:CA:99:74:8B:95:EA:4C + + X509v3 Subject Key Identifier: + C4:FB:9C:29:7B:97:CD:4C:96:FC:EE:5B:B3:CA:99:74:8B:95:EA:4C + X509v3 Basic Constraints: + CA:TRUE + 1.2.840.113533.7.65.0: + 0 +..V4.0.... + Signature Algorithm: md5WithRSAEncryption + 3f:ae:8a:f1:d7:66:03:05:9e:3e:fa:ea:1c:46:bb:a4:5b:8f: + 78:9a:12:48:99:f9:f4:35:de:0c:36:07:02:6b:10:3a:89:14: + 81:9c:31:a6:7c:b2:41:b2:6a:e7:07:01:a1:4b:f9:9f:25:3b: + 96:ca:99:c3:3e:a1:51:1c:f3:c3:2e:44:f7:b0:67:46:aa:92: + e5:3b:da:1c:19:14:38:30:d5:e2:a2:31:25:2e:f1:ec:45:38: + ed:f8:06:58:03:73:62:b0:10:31:8f:40:bf:64:e0:5c:3e:c5: + 4f:1f:da:12:43:ff:4c:e6:06:26:a8:9b:19:aa:44:3c:76:b2: + 5c:ec +-----BEGIN CERTIFICATE----- +MIIE7TCCBFagAwIBAgIEOAOR7jANBgkqhkiG9w0BAQQFADCByTELMAkGA1UEBhMC +VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MUgwRgYDVQQLFD93d3cuZW50cnVzdC5u +ZXQvQ2xpZW50X0NBX0luZm8vQ1BTIGluY29ycC4gYnkgcmVmLiBsaW1pdHMgbGlh +Yi4xJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV +BAMTKkVudHJ1c3QubmV0IENsaWVudCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAe +Fw05OTEwMTIxOTI0MzBaFw0xOTEwMTIxOTU0MzBaMIHJMQswCQYDVQQGEwJVUzEU +MBIGA1UEChMLRW50cnVzdC5uZXQxSDBGBgNVBAsUP3d3dy5lbnRydXN0Lm5ldC9D +bGllbnRfQ0FfSW5mby9DUFMgaW5jb3JwLiBieSByZWYuIGxpbWl0cyBsaWFiLjEl +MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMq +RW50cnVzdC5uZXQgQ2xpZW50IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGdMA0G +CSqGSIb3DQEBAQUAA4GLADCBhwKBgQDIOpleMRffrCdvkHvkGf9FozTC28GoT/Bo +6oT9n3V5z8GKUZSvx1cDR2SerYIbWtp/N3hHuzeYEpbOxhN979IMMFGpOZ5V+Pux +5zDeg7K6PvHViTs7hbqqdCz+PzFur5GVbgbUB01LLFZHGARS2g4Qk79jkJvh34zm +AqTmT173iwIBA6OCAeAwggHcMBEGCWCGSAGG+EIBAQQEAwIABzCCASIGA1UdHwSC +ARkwggEVMIHkoIHhoIHepIHbMIHYMQswCQYDVQQGEwJVUzEUMBIGA1UEChMLRW50 +cnVzdC5uZXQxSDBGBgNVBAsUP3d3dy5lbnRydXN0Lm5ldC9DbGllbnRfQ0FfSW5m +by9DUFMgaW5jb3JwLiBieSByZWYuIGxpbWl0cyBsaWFiLjElMCMGA1UECxMcKGMp +IDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5uZXQg +Q2xpZW50IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMCyg +KqAohiZodHRwOi8vd3d3LmVudHJ1c3QubmV0L0NSTC9DbGllbnQxLmNybDArBgNV +HRAEJDAigA8xOTk5MTAxMjE5MjQzMFqBDzIwMTkxMDEyMTkyNDMwWjALBgNVHQ8E +BAMCAQYwHwYDVR0jBBgwFoAUxPucKXuXzUyW/O5bs8qZdIuV6kwwHQYDVR0OBBYE +FMT7nCl7l81MlvzuW7PKmXSLlepMMAwGA1UdEwQFMAMBAf8wGQYJKoZIhvZ9B0EA +BAwwChsEVjQuMAMCBJAwDQYJKoZIhvcNAQEEBQADgYEAP66K8ddmAwWePvrqHEa7 +pFuPeJoSSJn59DXeDDYHAmsQOokUgZwxpnyyQbJq5wcBoUv5nyU7lsqZwz6hURzz +wy5E97BnRqqS5TvaHBkUODDV4qIxJS7x7EU47fgGWANzYrAQMY9Av2TgXD7FTx/a +EkP/TOYGJqibGapEPHayXOw= +-----END CERTIFICATE----- + +Entrust.net Premium 2048 Secure Server CA +========================================= + +MD5 Fingerprint=BA:21:EA:20:D6:DD:DB:8F:C1:57:8B:40:AD:A1:FC:FC +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 946059622 (0x3863b966) + Signature Algorithm: sha1WithRSAEncryption + Issuer: O=Entrust.net, OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Certification Authority (2048) + Validity + Not Before: Dec 24 17:50:51 1999 GMT + Not After : Dec 24 18:20:51 2019 GMT + Subject: O=Entrust.net, OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Certification Authority (2048) + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:ad:4d:4b:a9:12:86:b2:ea:a3:20:07:15:16:64: + 2a:2b:4b:d1:bf:0b:4a:4d:8e:ed:80:76:a5:67:b7: + 78:40:c0:73:42:c8:68:c0:db:53:2b:dd:5e:b8:76: + 98:35:93:8b:1a:9d:7c:13:3a:0e:1f:5b:b7:1e:cf: + e5:24:14:1e:b1:81:a9:8d:7d:b8:cc:6b:4b:03:f1: + 02:0c:dc:ab:a5:40:24:00:7f:74:94:a1:9d:08:29: + b3:88:0b:f5:87:77:9d:55:cd:e4:c3:7e:d7:6a:64: + ab:85:14:86:95:5b:97:32:50:6f:3d:c8:ba:66:0c: + e3:fc:bd:b8:49:c1:76:89:49:19:fd:c0:a8:bd:89: + a3:67:2f:c6:9f:bc:71:19:60:b8:2d:e9:2c:c9:90: + 76:66:7b:94:e2:af:78:d6:65:53:5d:3c:d6:9c:b2: + cf:29:03:f9:2f:a4:50:b2:d4:48:ce:05:32:55:8a: + fd:b2:64:4c:0e:e4:98:07:75:db:7f:df:b9:08:55: + 60:85:30:29:f9:7b:48:a4:69:86:e3:35:3f:1e:86: + 5d:7a:7a:15:bd:ef:00:8e:15:22:54:17:00:90:26: + 93:bc:0e:49:68:91:bf:f8:47:d3:9d:95:42:c1:0e: + 4d:df:6f:26:cf:c3:18:21:62:66:43:70:d6:d5:c0: + 07:e1 + Exponent: 65537 (0x10001) + X509v3 extensions: + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Authority Key Identifier: + keyid:55:E4:81:D1:11:80:BE:D8:89:B9:08:A3:31:F9:A1:24:09:16:B9:70 + + X509v3 Subject Key Identifier: + 55:E4:81:D1:11:80:BE:D8:89:B9:08:A3:31:F9:A1:24:09:16:B9:70 + 1.2.840.113533.7.65.0: + 0...V5.0:4.0.... + Signature Algorithm: sha1WithRSAEncryption + 59:47:ac:21:84:8a:17:c9:9c:89:53:1e:ba:80:85:1a:c6:3c: + 4e:3e:b1:9c:b6:7c:c6:92:5d:18:64:02:e3:d3:06:08:11:61: + 7c:63:e3:2b:9d:31:03:70:76:d2:a3:28:a0:f4:bb:9a:63:73: + ed:6d:e5:2a:db:ed:14:a9:2b:c6:36:11:d0:2b:eb:07:8b:a5: + da:9e:5c:19:9d:56:12:f5:54:29:c8:05:ed:b2:12:2a:8d:f4: + 03:1b:ff:e7:92:10:87:b0:3a:b5:c3:9d:05:37:12:a3:c7:f4: + 15:b9:d5:a4:39:16:9b:53:3a:23:91:f1:a8:82:a2:6a:88:68: + c1:79:02:22:bc:aa:a6:d6:ae:df:b0:14:5f:b8:87:d0:dd:7c: + 7f:7b:ff:af:1c:cf:e6:db:07:ad:5e:db:85:9d:d0:2b:0d:33: + db:04:d1:e6:49:40:13:2b:76:fb:3e:e9:9c:89:0f:15:ce:18: + b0:85:78:21:4f:6b:4f:0e:fa:36:67:cd:07:f2:ff:08:d0:e2: + de:d9:bf:2a:af:b8:87:86:21:3c:04:ca:b7:94:68:7f:cf:3c: + e9:98:d7:38:ff:ec:c0:d9:50:f0:2e:4b:58:ae:46:6f:d0:2e: + c3:60:da:72:55:72:bd:4c:45:9e:61:ba:bf:84:81:92:03:d1: + d2:69:7c:c5 +-----BEGIN CERTIFICATE----- +MIIEXDCCA0SgAwIBAgIEOGO5ZjANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChML +RW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBp +bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5 +IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENlcnRp +ZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQxNzUwNTFaFw0xOTEy +MjQxODIwNTFaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3d3d3 +LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxp +YWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEG +A1UEAxMqRW50cnVzdC5uZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgp +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArU1LqRKGsuqjIAcVFmQq +K0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOLGp18EzoOH1u3Hs/lJBQe +sYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSrhRSGlVuX +MlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVT +XTzWnLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/ +HoZdenoVve8AjhUiVBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH +4QIDAQABo3QwcjARBglghkgBhvhCAQEEBAMCAAcwHwYDVR0jBBgwFoAUVeSB0RGA +vtiJuQijMfmhJAkWuXAwHQYDVR0OBBYEFFXkgdERgL7YibkIozH5oSQJFrlwMB0G +CSqGSIb2fQdBAAQQMA4bCFY1LjA6NC4wAwIEkDANBgkqhkiG9w0BAQUFAAOCAQEA +WUesIYSKF8mciVMeuoCFGsY8Tj6xnLZ8xpJdGGQC49MGCBFhfGPjK50xA3B20qMo +oPS7mmNz7W3lKtvtFKkrxjYR0CvrB4ul2p5cGZ1WEvVUKcgF7bISKo30Axv/55IQ +h7A6tcOdBTcSo8f0FbnVpDkWm1M6I5HxqIKiaohowXkCIryqptau37AUX7iH0N18 +f3v/rxzP5tsHrV7bhZ3QKw0z2wTR5klAEyt2+z7pnIkPFc4YsIV4IU9rTw76NmfN +B/L/CNDi3tm/Kq+4h4YhPATKt5Rof8886ZjXOP/swNlQ8C5LWK5Gb9Auw2DaclVy +vUxFnmG6v4SBkgPR0ml8xQ== +-----END CERTIFICATE----- + +Baltimore CyberTrust Root +========================= + +MD5 Fingerprint=AC:B6:94:A5:9C:17:E0:D7:91:52:9B:B1:97:06:A6:E4 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 33554617 (0x20000b9) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=IE, O=Baltimore, OU=CyberTrust, CN=Baltimore CyberTrust Root + Validity + Not Before: May 12 18:46:00 2000 GMT + Not After : May 12 23:59:00 2025 GMT + Subject: C=IE, O=Baltimore, OU=CyberTrust, CN=Baltimore CyberTrust Root + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:a3:04:bb:22:ab:98:3d:57:e8:26:72:9a:b5:79: + d4:29:e2:e1:e8:95:80:b1:b0:e3:5b:8e:2b:29:9a: + 64:df:a1:5d:ed:b0:09:05:6d:db:28:2e:ce:62:a2: + 62:fe:b4:88:da:12:eb:38:eb:21:9d:c0:41:2b:01: + 52:7b:88:77:d3:1c:8f:c7:ba:b9:88:b5:6a:09:e7: + 73:e8:11:40:a7:d1:cc:ca:62:8d:2d:e5:8f:0b:a6: + 50:d2:a8:50:c3:28:ea:f5:ab:25:87:8a:9a:96:1c: + a9:67:b8:3f:0c:d5:f7:f9:52:13:2f:c2:1b:d5:70: + 70:f0:8f:c0:12:ca:06:cb:9a:e1:d9:ca:33:7a:77: + d6:f8:ec:b9:f1:68:44:42:48:13:d2:c0:c2:a4:ae: + 5e:60:fe:b6:a6:05:fc:b4:dd:07:59:02:d4:59:18: + 98:63:f5:a5:63:e0:90:0c:7d:5d:b2:06:7a:f3:85: + ea:eb:d4:03:ae:5e:84:3e:5f:ff:15:ed:69:bc:f9: + 39:36:72:75:cf:77:52:4d:f3:c9:90:2c:b9:3d:e5: + c9:23:53:3f:1f:24:98:21:5c:07:99:29:bd:c6:3a: + ec:e7:6e:86:3a:6b:97:74:63:33:bd:68:18:31:f0: + 78:8d:76:bf:fc:9e:8e:5d:2a:86:a7:4d:90:dc:27: + 1a:39 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + E5:9D:59:30:82:47:58:CC:AC:FA:08:54:36:86:7B:3A:B5:04:4D:F0 + X509v3 Basic Constraints: critical + CA:TRUE, pathlen:3 + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 85:0c:5d:8e:e4:6f:51:68:42:05:a0:dd:bb:4f:27:25:84:03: + bd:f7:64:fd:2d:d7:30:e3:a4:10:17:eb:da:29:29:b6:79:3f: + 76:f6:19:13:23:b8:10:0a:f9:58:a4:d4:61:70:bd:04:61:6a: + 12:8a:17:d5:0a:bd:c5:bc:30:7c:d6:e9:0c:25:8d:86:40:4f: + ec:cc:a3:7e:38:c6:37:11:4f:ed:dd:68:31:8e:4c:d2:b3:01: + 74:ee:be:75:5e:07:48:1a:7f:70:ff:16:5c:84:c0:79:85:b8: + 05:fd:7f:be:65:11:a3:0f:c0:02:b4:f8:52:37:39:04:d5:a9: + 31:7a:18:bf:a0:2a:f4:12:99:f7:a3:45:82:e3:3c:5e:f5:9d: + 9e:b5:c8:9e:7c:2e:c8:a4:9e:4e:08:14:4b:6d:fd:70:6d:6b: + 1a:63:bd:64:e6:1f:b7:ce:f0:f2:9f:2e:bb:1b:b7:f2:50:88: + 73:92:c2:e2:e3:16:8d:9a:32:02:ab:8e:18:dd:e9:10:11:ee: + 7e:35:ab:90:af:3e:30:94:7a:d0:33:3d:a7:65:0f:f5:fc:8e: + 9e:62:cf:47:44:2c:01:5d:bb:1d:b5:32:d2:47:d2:38:2e:d0: + fe:81:dc:32:6a:1e:b5:ee:3c:d5:fc:e7:81:1d:19:c3:24:42: + ea:63:39:a9 +-----BEGIN CERTIFICATE----- +MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJ +RTESMBAGA1UEChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYD +VQQDExlCYWx0aW1vcmUgQ3liZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoX +DTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMCSUUxEjAQBgNVBAoTCUJhbHRpbW9y +ZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFsdGltb3JlIEN5YmVy +VHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKMEuyKr +mD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjr +IZ3AQSsBUnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeK +mpYcqWe4PwzV9/lSEy/CG9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSu +XmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9XbIGevOF6uvUA65ehD5f/xXtabz5OTZy +dc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjprl3RjM71oGDHweI12v/ye +jl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoIVDaGezq1 +BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3 +DQEBBQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT92 +9hkTI7gQCvlYpNRhcL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3Wgx +jkzSswF07r51XgdIGn9w/xZchMB5hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0 +Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsaY71k5h+3zvDyny67G7fyUIhz +ksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9HRCwBXbsdtTLS +R9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp +-----END CERTIFICATE----- + +Equifax Secure Global eBusiness CA +================================== + +MD5 Fingerprint=8F:5D:77:06:27:C4:98:3C:5B:93:78:E7:D7:7D:9B:CC +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=US, O=Equifax Secure Inc., CN=Equifax Secure Global eBusiness CA-1 + Validity + Not Before: Jun 21 04:00:00 1999 GMT + Not After : Jun 21 04:00:00 2020 GMT + Subject: C=US, O=Equifax Secure Inc., CN=Equifax Secure Global eBusiness CA-1 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:ba:e7:17:90:02:65:b1:34:55:3c:49:c2:51:d5: + df:a7:d1:37:8f:d1:e7:81:73:41:52:60:9b:9d:a1: + 17:26:78:ad:c7:b1:e8:26:94:32:b5:de:33:8d:3a: + 2f:db:f2:9a:7a:5a:73:98:a3:5c:e9:fb:8a:73:1b: + 5c:e7:c3:bf:80:6c:cd:a9:f4:d6:2b:c0:f7:f9:99: + aa:63:a2:b1:47:02:0f:d4:e4:51:3a:12:3c:6c:8a: + 5a:54:84:70:db:c1:c5:90:cf:72:45:cb:a8:59:c0: + cd:33:9d:3f:a3:96:eb:85:33:21:1c:3e:1e:3e:60: + 6e:76:9c:67:85:c5:c8:c3:61 + Exponent: 65537 (0x10001) + X509v3 extensions: + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Authority Key Identifier: + keyid:BE:A8:A0:74:72:50:6B:44:B7:C9:23:D8:FB:A8:FF:B3:57:6B:68:6C + + X509v3 Subject Key Identifier: + BE:A8:A0:74:72:50:6B:44:B7:C9:23:D8:FB:A8:FF:B3:57:6B:68:6C + Signature Algorithm: md5WithRSAEncryption + 30:e2:01:51:aa:c7:ea:5f:da:b9:d0:65:0f:30:d6:3e:da:0d: + 14:49:6e:91:93:27:14:31:ef:c4:f7:2d:45:f8:ec:c7:bf:a2: + 41:0d:23:b4:92:f9:19:00:67:bd:01:af:cd:e0:71:fc:5a:cf: + 64:c4:e0:96:98:d0:a3:40:e2:01:8a:ef:27:07:f1:65:01:8a: + 44:2d:06:65:75:52:c0:86:10:20:21:5f:6c:6b:0f:6c:ae:09: + 1c:af:f2:a2:18:34:c4:75:a4:73:1c:f1:8d:dc:ef:ad:f9:b3: + 76:b4:92:bf:dc:95:10:1e:be:cb:c8:3b:5a:84:60:19:56:94: + a9:55 +-----BEGIN CERTIFICATE----- +MIICkDCCAfmgAwIBAgIBATANBgkqhkiG9w0BAQQFADBaMQswCQYDVQQGEwJVUzEc +MBoGA1UEChMTRXF1aWZheCBTZWN1cmUgSW5jLjEtMCsGA1UEAxMkRXF1aWZheCBT +ZWN1cmUgR2xvYmFsIGVCdXNpbmVzcyBDQS0xMB4XDTk5MDYyMTA0MDAwMFoXDTIw +MDYyMTA0MDAwMFowWjELMAkGA1UEBhMCVVMxHDAaBgNVBAoTE0VxdWlmYXggU2Vj +dXJlIEluYy4xLTArBgNVBAMTJEVxdWlmYXggU2VjdXJlIEdsb2JhbCBlQnVzaW5l +c3MgQ0EtMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAuucXkAJlsTRVPEnC +UdXfp9E3j9HngXNBUmCbnaEXJnitx7HoJpQytd4zjTov2/KaelpzmKNc6fuKcxtc +58O/gGzNqfTWK8D3+ZmqY6KxRwIP1ORROhI8bIpaVIRw28HFkM9yRcuoWcDNM50/ +o5brhTMhHD4ePmBudpxnhcXIw2ECAwEAAaNmMGQwEQYJYIZIAYb4QgEBBAQDAgAH +MA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUvqigdHJQa0S3ySPY+6j/s1dr +aGwwHQYDVR0OBBYEFL6ooHRyUGtEt8kj2Puo/7NXa2hsMA0GCSqGSIb3DQEBBAUA +A4GBADDiAVGqx+pf2rnQZQ8w1j7aDRRJbpGTJxQx78T3LUX47Me/okENI7SS+RkA +Z70Br83gcfxaz2TE4JaY0KNA4gGK7ycH8WUBikQtBmV1UsCGECAhX2xrD2yuCRyv +8qIYNMR1pHMc8Y3c7635s3a0kr/clRAevsvIO1qEYBlWlKlV +-----END CERTIFICATE----- + +Equifax Secure eBusiness CA 1 +============================= + +MD5 Fingerprint=64:9C:EF:2E:44:FC:C6:8F:52:07:D0:51:73:8F:CB:3D +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 4 (0x4) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=US, O=Equifax Secure Inc., CN=Equifax Secure eBusiness CA-1 + Validity + Not Before: Jun 21 04:00:00 1999 GMT + Not After : Jun 21 04:00:00 2020 GMT + Subject: C=US, O=Equifax Secure Inc., CN=Equifax Secure eBusiness CA-1 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:ce:2f:19:bc:17:b7:77:de:93:a9:5f:5a:0d:17: + 4f:34:1a:0c:98:f4:22:d9:59:d4:c4:68:46:f0:b4: + 35:c5:85:03:20:c6:af:45:a5:21:51:45:41:eb:16: + 58:36:32:6f:e2:50:62:64:f9:fd:51:9c:aa:24:d9: + f4:9d:83:2a:87:0a:21:d3:12:38:34:6c:8d:00:6e: + 5a:a0:d9:42:ee:1a:21:95:f9:52:4c:55:5a:c5:0f: + 38:4f:46:fa:6d:f8:2e:35:d6:1d:7c:eb:e2:f0:b0: + 75:80:c8:a9:13:ac:be:88:ef:3a:6e:ab:5f:2a:38: + 62:02:b0:12:7b:fe:8f:a6:03 + Exponent: 65537 (0x10001) + X509v3 extensions: + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Authority Key Identifier: + keyid:4A:78:32:52:11:DB:59:16:36:5E:DF:C1:14:36:40:6A:47:7C:4C:A1 + + X509v3 Subject Key Identifier: + 4A:78:32:52:11:DB:59:16:36:5E:DF:C1:14:36:40:6A:47:7C:4C:A1 + Signature Algorithm: md5WithRSAEncryption + 75:5b:a8:9b:03:11:e6:e9:56:4c:cd:f9:a9:4c:c0:0d:9a:f3: + cc:65:69:e6:25:76:cc:59:b7:d6:54:c3:1d:cd:99:ac:19:dd: + b4:85:d5:e0:3d:fc:62:20:a7:84:4b:58:65:f1:e2:f9:95:21: + 3f:f5:d4:7e:58:1e:47:87:54:3e:58:a1:b5:b5:f8:2a:ef:71: + e7:bc:c3:f6:b1:49:46:e2:d7:a0:6b:e5:56:7a:9a:27:98:7c: + 46:62:14:e7:c9:fc:6e:03:12:79:80:38:1d:48:82:8d:fc:17: + fe:2a:96:2b:b5:62:a6:a6:3d:bd:7f:92:59:cd:5a:2a:82:b2: + 37:79 +-----BEGIN CERTIFICATE----- +MIICgjCCAeugAwIBAgIBBDANBgkqhkiG9w0BAQQFADBTMQswCQYDVQQGEwJVUzEc +MBoGA1UEChMTRXF1aWZheCBTZWN1cmUgSW5jLjEmMCQGA1UEAxMdRXF1aWZheCBT +ZWN1cmUgZUJ1c2luZXNzIENBLTEwHhcNOTkwNjIxMDQwMDAwWhcNMjAwNjIxMDQw +MDAwWjBTMQswCQYDVQQGEwJVUzEcMBoGA1UEChMTRXF1aWZheCBTZWN1cmUgSW5j +LjEmMCQGA1UEAxMdRXF1aWZheCBTZWN1cmUgZUJ1c2luZXNzIENBLTEwgZ8wDQYJ +KoZIhvcNAQEBBQADgY0AMIGJAoGBAM4vGbwXt3fek6lfWg0XTzQaDJj0ItlZ1MRo +RvC0NcWFAyDGr0WlIVFFQesWWDYyb+JQYmT5/VGcqiTZ9J2DKocKIdMSODRsjQBu +WqDZQu4aIZX5UkxVWsUPOE9G+m34LjXWHXzr4vCwdYDIqROsvojvOm6rXyo4YgKw +Env+j6YDAgMBAAGjZjBkMBEGCWCGSAGG+EIBAQQEAwIABzAPBgNVHRMBAf8EBTAD +AQH/MB8GA1UdIwQYMBaAFEp4MlIR21kWNl7fwRQ2QGpHfEyhMB0GA1UdDgQWBBRK +eDJSEdtZFjZe38EUNkBqR3xMoTANBgkqhkiG9w0BAQQFAAOBgQB1W6ibAxHm6VZM +zfmpTMANmvPMZWnmJXbMWbfWVMMdzZmsGd20hdXgPfxiIKeES1hl8eL5lSE/9dR+ +WB5Hh1Q+WKG1tfgq73HnvMP2sUlG4tega+VWeponmHxGYhTnyfxuAxJ5gDgdSIKN +/Bf+KpYrtWKmpj29f5JZzVoqgrI3eQ== +-----END CERTIFICATE----- + +Equifax Secure eBusiness CA 2 +============================= + +MD5 Fingerprint=AA:BF:BF:64:97:DA:98:1D:6F:C6:08:3A:95:70:33:CA +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 930140085 (0x3770cfb5) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=Equifax Secure, OU=Equifax Secure eBusiness CA-2 + Validity + Not Before: Jun 23 12:14:45 1999 GMT + Not After : Jun 23 12:14:45 2019 GMT + Subject: C=US, O=Equifax Secure, OU=Equifax Secure eBusiness CA-2 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:e4:39:39:93:1e:52:06:1b:28:36:f8:b2:a3:29: + c5:ed:8e:b2:11:bd:fe:eb:e7:b4:74:c2:8f:ff:05: + e7:d9:9d:06:bf:12:c8:3f:0e:f2:d6:d1:24:b2:11: + de:d1:73:09:8a:d4:b1:2c:98:09:0d:1e:50:46:b2: + 83:a6:45:8d:62:68:bb:85:1b:20:70:32:aa:40:cd: + a6:96:5f:c4:71:37:3f:04:f3:b7:41:24:39:07:1a: + 1e:2e:61:58:a0:12:0b:e5:a5:df:c5:ab:ea:37:71: + cc:1c:c8:37:3a:b9:97:52:a7:ac:c5:6a:24:94:4e: + 9c:7b:cf:c0:6a:d6:df:21:bd + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 CRL Distribution Points: + DirName:/C=US/O=Equifax Secure/OU=Equifax Secure eBusiness CA-2/CN=CRL1 + + X509v3 Private Key Usage Period: + Not After: Jun 23 12:14:45 2019 GMT + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:50:9E:0B:EA:AF:5E:B9:20:48:A6:50:6A:CB:FD:D8:20:7A:A7:82:76 + + X509v3 Subject Key Identifier: + 50:9E:0B:EA:AF:5E:B9:20:48:A6:50:6A:CB:FD:D8:20:7A:A7:82:76 + X509v3 Basic Constraints: + CA:TRUE + 1.2.840.113533.7.65.0: + 0...V3.0c.... + Signature Algorithm: sha1WithRSAEncryption + 0c:86:82:ad:e8:4e:1a:f5:8e:89:27:e2:35:58:3d:29:b4:07: + 8f:36:50:95:bf:6e:c1:9e:eb:c4:90:b2:85:a8:bb:b7:42:e0: + 0f:07:39:df:fb:9e:90:b2:d1:c1:3e:53:9f:03:44:b0:7e:4b: + f4:6f:e4:7c:1f:e7:e2:b1:e4:b8:9a:ef:c3:bd:ce:de:0b:32: + 34:d9:de:28:ed:33:6b:c4:d4:d7:3d:12:58:ab:7d:09:2d:cb: + 70:f5:13:8a:94:a1:27:a4:d6:70:c5:6d:94:b5:c9:7d:9d:a0: + d2:c6:08:49:d9:66:9b:a6:d3:f4:0b:dc:c5:26:57:e1:91:30: + ea:cd +-----BEGIN CERTIFICATE----- +MIIDIDCCAomgAwIBAgIEN3DPtTANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV +UzEXMBUGA1UEChMORXF1aWZheCBTZWN1cmUxJjAkBgNVBAsTHUVxdWlmYXggU2Vj +dXJlIGVCdXNpbmVzcyBDQS0yMB4XDTk5MDYyMzEyMTQ0NVoXDTE5MDYyMzEyMTQ0 +NVowTjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkVxdWlmYXggU2VjdXJlMSYwJAYD +VQQLEx1FcXVpZmF4IFNlY3VyZSBlQnVzaW5lc3MgQ0EtMjCBnzANBgkqhkiG9w0B +AQEFAAOBjQAwgYkCgYEA5Dk5kx5SBhsoNviyoynF7Y6yEb3+6+e0dMKP/wXn2Z0G +vxLIPw7y1tEkshHe0XMJitSxLJgJDR5QRrKDpkWNYmi7hRsgcDKqQM2mll/EcTc/ +BPO3QSQ5BxoeLmFYoBIL5aXfxavqN3HMHMg3OrmXUqesxWoklE6ce8/AatbfIb0C +AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEX +MBUGA1UEChMORXF1aWZheCBTZWN1cmUxJjAkBgNVBAsTHUVxdWlmYXggU2VjdXJl +IGVCdXNpbmVzcyBDQS0yMQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTkw +NjIzMTIxNDQ1WjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUUJ4L6q9euSBIplBq +y/3YIHqngnYwHQYDVR0OBBYEFFCeC+qvXrkgSKZQasv92CB6p4J2MAwGA1UdEwQF +MAMBAf8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUA +A4GBAAyGgq3oThr1jokn4jVYPSm0B482UJW/bsGe68SQsoWou7dC4A8HOd/7npCy +0cE+U58DRLB+S/Rv5Hwf5+Kx5Lia78O9zt4LMjTZ3ijtM2vE1Nc9ElirfQkty3D1 +E4qUoSek1nDFbZS1yX2doNLGCEnZZpum0/QL3MUmV+GRMOrN +-----END CERTIFICATE----- + +Visa International Global Root 2 +================================ + +MD5 Fingerprint=35:48:95:36:4A:54:5A:72:96:8E:E0:64:CC:EF:2C:8C +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 798 (0x31e) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VISA, OU=Visa International Service Association, CN=GP Root 2 + Validity + Not Before: Aug 16 22:51:00 2000 GMT + Not After : Aug 15 23:59:00 2020 GMT + Subject: C=US, O=VISA, OU=Visa International Service Association, CN=GP Root 2 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:a9:01:70:b5:aa:c4:40:f0:ab:6a:26:61:79:19: + 00:fc:bf:9b:37:59:0c:af:6f:64:1b:f8:da:95:94: + 24:69:33:11:70:ca:e3:56:74:a2:17:57:64:5c:20: + 06:e1:d6:ef:71:b7:3b:f7:ab:c1:69:d0:49:a4:b1: + 04:d7:f4:57:62:89:5c:b0:75:2d:17:24:69:e3:42: + 60:e4:ee:74:d6:ab:80:56:d8:88:28:e1:fb:6d:22: + fd:23:7c:46:73:4f:7e:54:73:1e:a8:2c:55:58:75: + b7:4c:f3:5a:45:a5:02:1a:fa:da:9d:c3:45:c3:22: + 5e:f3:8b:f1:60:29:d2:c7:5f:b4:0c:3a:51:83:ef: + 30:f8:d4:e7:c7:f2:fa:99:a3:22:50:be:f9:05:37: + a3:ad:ed:9a:c3:e6:ec:88:1b:b6:19:27:1b:38:8b: + 80:4d:ec:b9:c7:c5:89:cb:fc:1a:32:ed:23:f0:b5: + 01:58:f9:f6:8f:e0:85:a9:4c:09:72:39:12:db:b3: + f5:cf:4e:62:64:da:c6:19:15:3a:63:1d:e9:17:55: + a1:4c:22:3c:34:32:46:f8:65:57:ba:2b:ef:36:8c: + 6a:fa:d9:d9:44:f4:aa:dd:84:d7:0d:1c:b2:54:ac: + 32:85:b4:64:0d:de:41:bb:b1:34:c6:01:86:32:64: + d5:9f + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + 9E:7D:4B:34:BF:71:AD:C2:05:F6:03:75:80:CE:A9:4F:1A:C4:24:4C + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 21:a5:76:14:55:f9:ad:27:70:8f:3c:f4:d5:6c:c8:cc:0a:ab: + a3:98:0b:8a:06:23:c5:c9:61:db:99:07:69:35:26:31:fe:c7: + 2e:84:c2:99:61:d4:0d:e9:7d:2e:13:2b:7c:8e:85:b6:85:c7: + 4b:cf:35:b6:2c:47:3d:ce:29:2f:d8:6f:9f:89:1c:64:93:bf: + 08:bd:76:d0:90:8a:94:b3:7f:28:5b:6e:ac:4d:33:2c:ed:65: + dc:16:cc:e2:cd:ae:a4:3d:62:92:06:95:26:bf:df:b9:e4:20: + a6:73:6a:c1:be:f7:94:44:d6:4d:6f:2a:0b:6b:18:4d:74:10: + 36:68:6a:5a:c1:6a:a7:dd:36:29:8c:b8:30:8b:4f:21:3f:00: + 2e:54:30:07:3a:ba:8a:e4:c3:9e:ca:d8:b5:d8:7b:ce:75:45: + 66:07:f4:6d:2d:d8:7a:ca:e9:89:8a:f2:23:d8:2f:cb:6e:00: + 36:4f:fb:f0:2f:01:cc:0f:c0:22:65:f4:ab:e2:4e:61:2d:03: + 82:7d:91:16:b5:30:d5:14:de:5e:c7:90:fc:a1:fc:ab:10:af: + 5c:6b:70:a7:07:ef:29:86:e8:b2:25:c7:20:ff:26:dd:77:ef: + 79:44:14:c4:bd:dd:3b:c5:03:9b:77:23:ec:a0:ec:bb:5a:39: + b5:cc:ad:06 +-----BEGIN CERTIFICATE----- +MIIDgDCCAmigAwIBAgICAx4wDQYJKoZIhvcNAQEFBQAwYTELMAkGA1UEBhMCVVMx +DTALBgNVBAoTBFZJU0ExLzAtBgNVBAsTJlZpc2EgSW50ZXJuYXRpb25hbCBTZXJ2 +aWNlIEFzc29jaWF0aW9uMRIwEAYDVQQDEwlHUCBSb290IDIwHhcNMDAwODE2MjI1 +MTAwWhcNMjAwODE1MjM1OTAwWjBhMQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklT +QTEvMC0GA1UECxMmVmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRp +b24xEjAQBgNVBAMTCUdQIFJvb3QgMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC +AQoCggEBAKkBcLWqxEDwq2omYXkZAPy/mzdZDK9vZBv42pWUJGkzEXDK41Z0ohdX +ZFwgBuHW73G3O/erwWnQSaSxBNf0V2KJXLB1LRckaeNCYOTudNargFbYiCjh+20i +/SN8RnNPflRzHqgsVVh1t0zzWkWlAhr62p3DRcMiXvOL8WAp0sdftAw6UYPvMPjU +58fy+pmjIlC++QU3o63tmsPm7IgbthknGziLgE3sucfFicv8GjLtI/C1AVj59o/g +halMCXI5Etuz9c9OYmTaxhkVOmMd6RdVoUwiPDQyRvhlV7or7zaMavrZ2UT0qt2E +1w0cslSsMoW0ZA3eQbuxNMYBhjJk1Z8CAwEAAaNCMEAwHQYDVR0OBBYEFJ59SzS/ +ca3CBfYDdYDOqU8axCRMMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEG +MA0GCSqGSIb3DQEBBQUAA4IBAQAhpXYUVfmtJ3CPPPTVbMjMCqujmAuKBiPFyWHb +mQdpNSYx/scuhMKZYdQN6X0uEyt8joW2hcdLzzW2LEc9zikv2G+fiRxkk78IvXbQ +kIqUs38oW26sTTMs7WXcFsziza6kPWKSBpUmv9+55CCmc2rBvveURNZNbyoLaxhN +dBA2aGpawWqn3TYpjLgwi08hPwAuVDAHOrqK5MOeyti12HvOdUVmB/RtLdh6yumJ +ivIj2C/LbgA2T/vwLwHMD8AiZfSr4k5hLQOCfZEWtTDVFN5ex5D8ofyrEK9ca3Cn +B+8phuiyJccg/ybdd+95RBTEvd07xQObdyPsoOy7Wjm1zK0G +-----END CERTIFICATE----- + +beTRUSTed Root CA +================= + +MD5 Fingerprint=85:CA:76:5A:1B:D1:68:22:DC:A2:23:12:CA:C6:80:34 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 961510791 (0x394f7d87) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=WW, O=beTRUSTed, CN=beTRUSTed Root CAs, CN=beTRUSTed Root CA + Validity + Not Before: Jun 20 14:21:04 2000 GMT + Not After : Jun 20 13:21:04 2010 GMT + Subject: C=WW, O=beTRUSTed, CN=beTRUSTed Root CAs, CN=beTRUSTed Root CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:d4:b4:73:7a:13:0a:38:55:01:be:89:56:e1:94: + 9e:d4:be:5a:eb:4a:34:75:1b:61:29:c4:e1:ad:08: + 60:21:78:48:ff:b4:d0:fa:5e:41:8d:61:44:87:e8: + ed:c9:58:fa:fc:93:9a:df:4f:ea:3e:35:7d:f8:33: + 7a:e6:f1:d7:cd:6f:49:4b:3d:4f:2d:6e:0e:83:3a: + 18:78:77:a3:cf:e7:f4:4d:73:d8:9a:3b:1a:1d:be: + 95:53:cf:20:97:c2:cf:3e:24:52:6c:0c:8e:65:59: + c5:71:ff:62:09:8f:aa:c5:8f:cc:60:a0:73:4a:d7: + 38:3f:15:72:bf:a2:97:b7:70:e8:af:e2:7e:16:06: + 4c:f5:aa:64:26:72:07:25:ad:35:fc:18:b1:26:d7: + d8:ff:19:0e:83:1b:8c:dc:78:45:67:34:3d:f4:af: + 1c:8d:e4:6d:6b:ed:20:b3:67:9a:b4:61:cb:17:6f: + 89:35:ff:e7:4e:c0:32:12:e7:ee:ec:df:ff:97:30: + 74:ed:8d:47:8e:eb:b4:c3:44:e6:a7:4c:7f:56:43: + e8:b8:bc:b6:be:fa:83:97:e6:bb:fb:c4:b6:93:be: + 19:18:3e:8c:81:b9:73:88:16:f4:96:43:9c:67:73: + 17:90:d8:09:6e:63:ac:4a:b6:23:c4:01:a1:ad:a4: + e4:c5 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Certificate Policies: + Policy: 1.3.6.1.4.1.6334.1.0.0 + User Notice: + Explicit Text: Reliance on this certificate by any party assumes acceptance of the then applicable standard terms and conditions of use, and certification practice statement, which can be found at beTRUSTed's web site, https://www.beTRUSTed.com/vault/terms + CPS: https://www.beTRUSTed.com/vault/terms + + X509v3 CRL Distribution Points: + DirName:/O=beTRUSTed/C=WW + + X509v3 Subject Key Identifier: + 2A:B9:9B:69:2E:3B:9B:D8:CD:DE:2A:31:04:34:6B:CA:07:18:AB:67 + X509v3 Authority Key Identifier: + keyid:2A:B9:9B:69:2E:3B:9B:D8:CD:DE:2A:31:04:34:6B:CA:07:18:AB:67 + + X509v3 Key Usage: critical + Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment, Key Agreement, Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 79:61:db:a3:5e:6e:16:b1:ea:76:51:f9:cb:15:9b:cb:69:be: + e6:81:6b:9f:28:1f:65:3e:dd:11:85:92:d4:e8:41:bf:7e:33: + bd:23:e7:f1:20:bf:a4:b4:a6:19:01:c6:8c:8d:35:7c:65:a4: + 4f:09:a4:d6:d8:23:15:05:13:a7:43:79:af:db:a3:0e:9b:7b: + 78:1a:f3:04:86:5a:c6:f6:8c:20:47:38:49:50:06:9d:72:67: + 3a:f0:98:03:ad:96:67:44:fc:3f:10:0d:86:4d:e4:00:3b:29: + 7b:ce:3b:3b:99:86:61:25:40:84:dc:13:62:b7:fa:ca:59:d6: + 03:1e:d6:53:01:cd:6d:4c:68:55:40:e1:ee:6b:c7:2a:00:00: + 48:82:b3:0a:01:c3:60:2a:0c:f7:82:35:ee:48:86:96:e4:74: + d4:3d:ea:01:71:ba:04:75:40:a7:a9:7f:39:39:9a:55:97:29: + 65:ae:19:55:25:05:72:47:d3:e8:18:dc:b8:e9:af:43:73:01: + 12:74:a3:e1:5c:5f:15:5d:24:f3:f9:e4:f4:b6:67:67:12:e7: + 64:22:8a:f6:a5:41:a6:1c:b6:60:63:45:8a:10:b4:ba:46:10: + ae:41:57:65:6c:3f:23:10:3f:21:10:59:b7:e4:40:dd:26:0c: + 23:f6:aa:ae +-----BEGIN CERTIFICATE----- +MIIFLDCCBBSgAwIBAgIEOU99hzANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJX +VzESMBAGA1UEChMJYmVUUlVTVGVkMRswGQYDVQQDExJiZVRSVVNUZWQgUm9vdCBD +QXMxGjAYBgNVBAMTEWJlVFJVU1RlZCBSb290IENBMB4XDTAwMDYyMDE0MjEwNFoX +DTEwMDYyMDEzMjEwNFowWjELMAkGA1UEBhMCV1cxEjAQBgNVBAoTCWJlVFJVU1Rl +ZDEbMBkGA1UEAxMSYmVUUlVTVGVkIFJvb3QgQ0FzMRowGAYDVQQDExFiZVRSVVNU +ZWQgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANS0c3oT +CjhVAb6JVuGUntS+WutKNHUbYSnE4a0IYCF4SP+00PpeQY1hRIfo7clY+vyTmt9P +6j41ffgzeubx181vSUs9Ty1uDoM6GHh3o8/n9E1z2Jo7Gh2+lVPPIJfCzz4kUmwM +jmVZxXH/YgmPqsWPzGCgc0rXOD8Vcr+il7dw6K/ifhYGTPWqZCZyByWtNfwYsSbX +2P8ZDoMbjNx4RWc0PfSvHI3kbWvtILNnmrRhyxdviTX/507AMhLn7uzf/5cwdO2N +R47rtMNE5qdMf1ZD6Li8tr76g5fmu/vEtpO+GRg+jIG5c4gW9JZDnGdzF5DYCW5j +rEq2I8QBoa2k5MUCAwEAAaOCAfgwggH0MA8GA1UdEwEB/wQFMAMBAf8wggFZBgNV +HSAEggFQMIIBTDCCAUgGCisGAQQBsT4BAAAwggE4MIIBAQYIKwYBBQUHAgIwgfQa +gfFSZWxpYW5jZSBvbiB0aGlzIGNlcnRpZmljYXRlIGJ5IGFueSBwYXJ0eSBhc3N1 +bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJsZSBzdGFuZGFyZCB0 +ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGFuZCBjZXJ0aWZpY2F0aW9uIHBy +YWN0aWNlIHN0YXRlbWVudCwgd2hpY2ggY2FuIGJlIGZvdW5kIGF0IGJlVFJVU1Rl +ZCdzIHdlYiBzaXRlLCBodHRwczovL3d3dy5iZVRSVVNUZWQuY29tL3ZhdWx0L3Rl +cm1zMDEGCCsGAQUFBwIBFiVodHRwczovL3d3dy5iZVRSVVNUZWQuY29tL3ZhdWx0 +L3Rlcm1zMDQGA1UdHwQtMCswKaAnoCWkIzAhMRIwEAYDVQQKEwliZVRSVVNUZWQx +CzAJBgNVBAYTAldXMB0GA1UdDgQWBBQquZtpLjub2M3eKjEENGvKBxirZzAfBgNV +HSMEGDAWgBQquZtpLjub2M3eKjEENGvKBxirZzAOBgNVHQ8BAf8EBAMCAf4wDQYJ +KoZIhvcNAQEFBQADggEBAHlh26Nebhax6nZR+csVm8tpvuaBa58oH2U+3RGFktTo +Qb9+M70j5/Egv6S0phkBxoyNNXxlpE8JpNbYIxUFE6dDea/bow6be3ga8wSGWsb2 +jCBHOElQBp1yZzrwmAOtlmdE/D8QDYZN5AA7KXvOOzuZhmElQITcE2K3+spZ1gMe +1lMBzW1MaFVA4e5rxyoAAEiCswoBw2AqDPeCNe5IhpbkdNQ96gFxugR1QKepfzk5 +mlWXKWWuGVUlBXJH0+gY3Ljpr0NzARJ0o+FcXxVdJPP55PS2Z2cS52QiivalQaYc +tmBjRYoQtLpGEK5BV2VsPyMQPyEQWbfkQN0mDCP2qq4= +-----END CERTIFICATE----- + +Thawte Personal Basic CA +======================== + +MD5 Fingerprint=E6:0B:D2:C9:CA:2D:88:DB:1A:71:0E:4B:78:EB:02:41 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting, OU=Certification Services Division, CN=Thawte Personal Basic CA/emailAddress=personal-basic@thawte.com + Validity + Not Before: Jan 1 00:00:00 1996 GMT + Not After : Dec 31 23:59:59 2020 GMT + Subject: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting, OU=Certification Services Division, CN=Thawte Personal Basic CA/emailAddress=personal-basic@thawte.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:bc:bc:93:53:6d:c0:50:4f:82:15:e6:48:94:35: + a6:5a:be:6f:42:fa:0f:47:ee:77:75:72:dd:8d:49: + 9b:96:57:a0:78:d4:ca:3f:51:b3:69:0b:91:76:17: + 22:07:97:6a:c4:51:93:4b:e0:8d:ef:37:95:a1:0c: + 4d:da:34:90:1d:17:89:97:e0:35:38:57:4a:c0:f4: + 08:70:e9:3c:44:7b:50:7e:61:9a:90:e3:23:d3:88: + 11:46:27:f5:0b:07:0e:bb:dd:d1:7f:20:0a:88:b9: + 56:0b:2e:1c:80:da:f1:e3:9e:29:ef:14:bd:0a:44: + fb:1b:5b:18:d1:bf:23:93:21 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: md5WithRSAEncryption + 2d:e2:99:6b:b0:3d:7a:89:d7:59:a2:94:01:1f:2b:dd:12:4b: + 53:c2:ad:7f:aa:a7:00:5c:91:40:57:25:4a:38:aa:84:70:b9: + d9:80:0f:a5:7b:5c:fb:73:c6:bd:d7:8a:61:5c:03:e3:2d:27: + a8:17:e0:84:85:42:dc:5e:9b:c6:b7:b2:6d:bb:74:af:e4:3f: + cb:a7:b7:b0:e0:5d:be:78:83:25:94:d2:db:81:0f:79:07:6d: + 4f:f4:39:15:5a:52:01:7b:de:32:d6:4d:38:f6:12:5c:06:50: + df:05:5b:bd:14:4b:a1:df:29:ba:3b:41:8d:f7:63:56:a1:df: + 22:b1 +-----BEGIN CERTIFICATE----- +MIIDITCCAoqgAwIBAgIBADANBgkqhkiG9w0BAQQFADCByzELMAkGA1UEBhMCWkEx +FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMRowGAYD +VQQKExFUaGF3dGUgQ29uc3VsdGluZzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBT +ZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UEAxMYVGhhd3RlIFBlcnNvbmFsIEJhc2lj +IENBMSgwJgYJKoZIhvcNAQkBFhlwZXJzb25hbC1iYXNpY0B0aGF3dGUuY29tMB4X +DTk2MDEwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgcsxCzAJBgNVBAYTAlpBMRUw +EwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEaMBgGA1UE +ChMRVGhhd3RlIENvbnN1bHRpbmcxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2Vy +dmljZXMgRGl2aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQZXJzb25hbCBCYXNpYyBD +QTEoMCYGCSqGSIb3DQEJARYZcGVyc29uYWwtYmFzaWNAdGhhd3RlLmNvbTCBnzAN +BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAvLyTU23AUE+CFeZIlDWmWr5vQvoPR+53 +dXLdjUmbllegeNTKP1GzaQuRdhciB5dqxFGTS+CN7zeVoQxN2jSQHReJl+A1OFdK +wPQIcOk8RHtQfmGakOMj04gRRif1CwcOu93RfyAKiLlWCy4cgNrx454p7xS9CkT7 +G1sY0b8jkyECAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQQF +AAOBgQAt4plrsD16iddZopQBHyvdEktTwq1/qqcAXJFAVyVKOKqEcLnZgA+le1z7 +c8a914phXAPjLSeoF+CEhULcXpvGt7Jtu3Sv5D/Lp7ew4F2+eIMllNLbgQ95B21P +9DkVWlIBe94y1k049hJcBlDfBVu9FEuh3ym6O0GN92NWod8isQ== +-----END CERTIFICATE----- + +AddTrust Low-Value Services Root +================================ + +MD5 Fingerprint=1E:42:95:02:33:92:6B:B9:5F:C0:7F:DA:D6:B2:4B:FC +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=SE, O=AddTrust AB, OU=AddTrust TTP Network, CN=AddTrust Class 1 CA Root + Validity + Not Before: May 30 10:38:31 2000 GMT + Not After : May 30 10:38:31 2020 GMT + Subject: C=SE, O=AddTrust AB, OU=AddTrust TTP Network, CN=AddTrust Class 1 CA Root + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:96:96:d4:21:49:60:e2:6b:e8:41:07:0c:de:c4: + e0:dc:13:23:cd:c1:35:c7:fb:d6:4e:11:0a:67:5e: + f5:06:5b:6b:a5:08:3b:5b:29:16:3a:e7:87:b2:34: + 06:c5:bc:05:a5:03:7c:82:cb:29:10:ae:e1:88:81: + bd:d6:9e:d3:fe:2d:56:c1:15:ce:e3:26:9d:15:2e: + 10:fb:06:8f:30:04:de:a7:b4:63:b4:ff:b1:9c:ae: + 3c:af:77:b6:56:c5:b5:ab:a2:e9:69:3a:3d:0e:33: + 79:32:3f:70:82:92:99:61:6d:8d:30:08:8f:71:3f: + a6:48:57:19:f8:25:dc:4b:66:5c:a5:74:8f:98:ae: + c8:f9:c0:06:22:e7:ac:73:df:a5:2e:fb:52:dc:b1: + 15:65:20:fa:35:66:69:de:df:2c:f1:6e:bc:30:db: + 2c:24:12:db:eb:35:35:68:90:cb:00:b0:97:21:3d: + 74:21:23:65:34:2b:bb:78:59:a3:d6:e1:76:39:9a: + a4:49:8e:8c:74:af:6e:a4:9a:a3:d9:9b:d2:38:5c: + 9b:a2:18:cc:75:23:84:be:eb:e2:4d:33:71:8e:1a: + f0:c2:f8:c7:1d:a2:ad:03:97:2c:f8:cf:25:c6:f6: + b8:24:31:b1:63:5d:92:7f:63:f0:25:c9:53:2e:1f: + bf:4d + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + 95:B1:B4:F0:94:B6:BD:C7:DA:D1:11:09:21:BE:C1:AF:49:FD:10:7B + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Authority Key Identifier: + keyid:95:B1:B4:F0:94:B6:BD:C7:DA:D1:11:09:21:BE:C1:AF:49:FD:10:7B + DirName:/C=SE/O=AddTrust AB/OU=AddTrust TTP Network/CN=AddTrust Class 1 CA Root + serial:01 + + Signature Algorithm: sha1WithRSAEncryption + 2c:6d:64:1b:1f:cd:0d:dd:b9:01:fa:96:63:34:32:48:47:99: + ae:97:ed:fd:72:16:a6:73:47:5a:f4:eb:dd:e9:f5:d6:fb:45: + cc:29:89:44:5d:bf:46:39:3d:e8:ee:bc:4d:54:86:1e:1d:6c: + e3:17:27:43:e1:89:56:2b:a9:6f:72:4e:49:33:e3:72:7c:2a: + 23:9a:bc:3e:ff:28:2a:ed:a3:ff:1c:23:ba:43:57:09:67:4d: + 4b:62:06:2d:f8:ff:6c:9d:60:1e:d8:1c:4b:7d:b5:31:2f:d9: + d0:7c:5d:f8:de:6b:83:18:78:37:57:2f:e8:33:07:67:df:1e: + c7:6b:2a:95:76:ae:8f:57:a3:f0:f4:52:b4:a9:53:08:cf:e0: + 4f:d3:7a:53:8b:fd:bb:1c:56:36:f2:fe:b2:b6:e5:76:bb:d5: + 22:65:a7:3f:fe:d1:66:ad:0b:bc:6b:99:86:ef:3f:7d:f3:18: + 32:ca:7b:c6:e3:ab:64:46:95:f8:26:69:d9:55:83:7b:2c:96: + 07:ff:59:2c:44:a3:c6:e5:e9:a9:dc:a1:63:80:5a:21:5e:21: + cf:53:54:f0:ba:6f:89:db:a8:aa:95:cf:8b:e3:71:cc:1e:1b: + 20:44:08:c0:7a:b6:40:fd:c4:e4:35:e1:1d:16:1c:d0:bc:2b: + 8e:d6:71:d9 +-----BEGIN CERTIFICATE----- +MIIEGDCCAwCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQGEwJTRTEU +MBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3 +b3JrMSEwHwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3QwHhcNMDAwNTMw +MTAzODMxWhcNMjAwNTMwMTAzODMxWjBlMQswCQYDVQQGEwJTRTEUMBIGA1UEChML +QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEwHwYD +VQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUA +A4IBDwAwggEKAoIBAQCWltQhSWDia+hBBwzexODcEyPNwTXH+9ZOEQpnXvUGW2ul +CDtbKRY654eyNAbFvAWlA3yCyykQruGIgb3WntP+LVbBFc7jJp0VLhD7Bo8wBN6n +tGO0/7Gcrjyvd7ZWxbWroulpOj0OM3kyP3CCkplhbY0wCI9xP6ZIVxn4JdxLZlyl +dI+Yrsj5wAYi56xz36Uu+1LcsRVlIPo1Zmne3yzxbrww2ywkEtvrNTVokMsAsJch +PXQhI2U0K7t4WaPW4XY5mqRJjox0r26kmqPZm9I4XJuiGMx1I4S+6+JNM3GOGvDC ++Mcdoq0Dlyz4zyXG9rgkMbFjXZJ/Y/AlyVMuH79NAgMBAAGjgdIwgc8wHQYDVR0O +BBYEFJWxtPCUtr3H2tERCSG+wa9J/RB7MAsGA1UdDwQEAwIBBjAPBgNVHRMBAf8E +BTADAQH/MIGPBgNVHSMEgYcwgYSAFJWxtPCUtr3H2tERCSG+wa9J/RB7oWmkZzBl +MQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFk +ZFRydXN0IFRUUCBOZXR3b3JrMSEwHwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENB +IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBACxtZBsfzQ3duQH6lmM0MkhHma6X +7f1yFqZzR1r0693p9db7RcwpiURdv0Y5PejuvE1Uhh4dbOMXJ0PhiVYrqW9yTkkz +43J8KiOavD7/KCrto/8cI7pDVwlnTUtiBi34/2ydYB7YHEt9tTEv2dB8Xfjea4MY +eDdXL+gzB2ffHsdrKpV2ro9Xo/D0UrSpUwjP4E/TelOL/bscVjby/rK25Xa71SJl +pz/+0WatC7xrmYbvP33zGDLKe8bjq2RGlfgmadlVg3sslgf/WSxEo8bl6ancoWOA +WiFeIc9TVPC6b4nbqKqVz4vjccweGyBECMB6tkD9xOQ14R0WHNC8K47Wcdk= +-----END CERTIFICATE----- + +AddTrust External Root +====================== + +MD5 Fingerprint=1D:35:54:04:85:78:B0:3F:42:42:4D:BF:20:73:0A:3F +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=SE, O=AddTrust AB, OU=AddTrust External TTP Network, CN=AddTrust External CA Root + Validity + Not Before: May 30 10:48:38 2000 GMT + Not After : May 30 10:48:38 2020 GMT + Subject: C=SE, O=AddTrust AB, OU=AddTrust External TTP Network, CN=AddTrust External CA Root + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b7:f7:1a:33:e6:f2:00:04:2d:39:e0:4e:5b:ed: + 1f:bc:6c:0f:cd:b5:fa:23:b6:ce:de:9b:11:33:97: + a4:29:4c:7d:93:9f:bd:4a:bc:93:ed:03:1a:e3:8f: + cf:e5:6d:50:5a:d6:97:29:94:5a:80:b0:49:7a:db: + 2e:95:fd:b8:ca:bf:37:38:2d:1e:3e:91:41:ad:70: + 56:c7:f0:4f:3f:e8:32:9e:74:ca:c8:90:54:e9:c6: + 5f:0f:78:9d:9a:40:3c:0e:ac:61:aa:5e:14:8f:9e: + 87:a1:6a:50:dc:d7:9a:4e:af:05:b3:a6:71:94:9c: + 71:b3:50:60:0a:c7:13:9d:38:07:86:02:a8:e9:a8: + 69:26:18:90:ab:4c:b0:4f:23:ab:3a:4f:84:d8:df: + ce:9f:e1:69:6f:bb:d7:42:d7:6b:44:e4:c7:ad:ee: + 6d:41:5f:72:5a:71:08:37:b3:79:65:a4:59:a0:94: + 37:f7:00:2f:0d:c2:92:72:da:d0:38:72:db:14:a8: + 45:c4:5d:2a:7d:b7:b4:d6:c4:ee:ac:cd:13:44:b7: + c9:2b:dd:43:00:25:fa:61:b9:69:6a:58:23:11:b7: + a7:33:8f:56:75:59:f5:cd:29:d7:46:b7:0a:2b:65: + b6:d3:42:6f:15:b2:b8:7b:fb:ef:e9:5d:53:d5:34: + 5a:27 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + AD:BD:98:7A:34:B4:26:F7:FA:C4:26:54:EF:03:BD:E0:24:CB:54:1A + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Authority Key Identifier: + keyid:AD:BD:98:7A:34:B4:26:F7:FA:C4:26:54:EF:03:BD:E0:24:CB:54:1A + DirName:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root + serial:01 + + Signature Algorithm: sha1WithRSAEncryption + b0:9b:e0:85:25:c2:d6:23:e2:0f:96:06:92:9d:41:98:9c:d9: + 84:79:81:d9:1e:5b:14:07:23:36:65:8f:b0:d8:77:bb:ac:41: + 6c:47:60:83:51:b0:f9:32:3d:e7:fc:f6:26:13:c7:80:16:a5: + bf:5a:fc:87:cf:78:79:89:21:9a:e2:4c:07:0a:86:35:bc:f2: + de:51:c4:d2:96:b7:dc:7e:4e:ee:70:fd:1c:39:eb:0c:02:51: + 14:2d:8e:bd:16:e0:c1:df:46:75:e7:24:ad:ec:f4:42:b4:85: + 93:70:10:67:ba:9d:06:35:4a:18:d3:2b:7a:cc:51:42:a1:7a: + 63:d1:e6:bb:a1:c5:2b:c2:36:be:13:0d:e6:bd:63:7e:79:7b: + a7:09:0d:40:ab:6a:dd:8f:8a:c3:f6:f6:8c:1a:42:05:51:d4: + 45:f5:9f:a7:62:21:68:15:20:43:3c:99:e7:7c:bd:24:d8:a9: + 91:17:73:88:3f:56:1b:31:38:18:b4:71:0f:9a:cd:c8:0e:9e: + 8e:2e:1b:e1:8c:98:83:cb:1f:31:f1:44:4c:c6:04:73:49:76: + 60:0f:c7:f8:bd:17:80:6b:2e:e9:cc:4c:0e:5a:9a:79:0f:20: + 0a:2e:d5:9e:63:26:1e:55:92:94:d8:82:17:5a:7b:d0:bc:c7: + 8f:4e:86:04 +-----BEGIN CERTIFICATE----- +MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEU +MBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFs +IFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290 +MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFowbzELMAkGA1UEBhMCU0Ux +FDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5h +bCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9v +dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvt +H7xsD821+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9 +uMq/NzgtHj6RQa1wVsfwTz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzX +mk6vBbOmcZSccbNQYArHE504B4YCqOmoaSYYkKtMsE8jqzpPhNjfzp/haW+710LX +a0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy2xSoRcRdKn23tNbE7qzN +E0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv77+ldU9U0 +WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYD +VR0PBAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0 +Jvf6xCZU7wO94CTLVBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRU +cnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsx +IjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENBIFJvb3SCAQEwDQYJKoZIhvcN +AQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZlj7DYd7usQWxH +YINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5 +6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvC +Nr4TDea9Y355e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEX +c4g/VhsxOBi0cQ+azcgOno4uG+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5a +mnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ= +-----END CERTIFICATE----- + +AddTrust Public Services Root +============================= + +MD5 Fingerprint=C1:62:3E:23:C5:82:73:9C:03:59:4B:2B:E9:77:49:7F +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=SE, O=AddTrust AB, OU=AddTrust TTP Network, CN=AddTrust Public CA Root + Validity + Not Before: May 30 10:41:50 2000 GMT + Not After : May 30 10:41:50 2020 GMT + Subject: C=SE, O=AddTrust AB, OU=AddTrust TTP Network, CN=AddTrust Public CA Root + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:e9:1a:30:8f:83:88:14:c1:20:d8:3c:9b:8f:1b: + 7e:03:74:bb:da:69:d3:46:a5:f8:8e:c2:0c:11:90: + 51:a5:2f:66:54:40:55:ea:db:1f:4a:56:ee:9f:23: + 6e:f4:39:cb:a1:b9:6f:f2:7e:f9:5d:87:26:61:9e: + 1c:f8:e2:ec:a6:81:f8:21:c5:24:cc:11:0c:3f:db: + 26:72:7a:c7:01:97:07:17:f9:d7:18:2c:30:7d:0e: + 7a:1e:62:1e:c6:4b:c0:fd:7d:62:77:d3:44:1e:27: + f6:3f:4b:44:b3:b7:38:d9:39:1f:60:d5:51:92:73: + 03:b4:00:69:e3:f3:14:4e:ee:d1:dc:09:cf:77:34: + 46:50:b0:f8:11:f2:fe:38:79:f7:07:39:fe:51:92: + 97:0b:5b:08:5f:34:86:01:ad:88:97:eb:66:cd:5e: + d1:ff:dc:7d:f2:84:da:ba:77:ad:dc:80:08:c7:a7: + 87:d6:55:9f:97:6a:e8:c8:11:64:ba:e7:19:29:3f: + 11:b3:78:90:84:20:52:5b:11:ef:78:d0:83:f6:d5: + 48:90:d0:30:1c:cf:80:f9:60:fe:79:e4:88:f2:dd: + 00:eb:94:45:eb:65:94:69:40:ba:c0:d5:b4:b8:ba: + 7d:04:11:a8:eb:31:05:96:94:4e:58:21:8e:9f:d0: + 60:fd + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + 81:3E:37:D8:92:B0:1F:77:9F:5C:B4:AB:73:AA:E7:F6:34:60:2F:FA + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Authority Key Identifier: + keyid:81:3E:37:D8:92:B0:1F:77:9F:5C:B4:AB:73:AA:E7:F6:34:60:2F:FA + DirName:/C=SE/O=AddTrust AB/OU=AddTrust TTP Network/CN=AddTrust Public CA Root + serial:01 + + Signature Algorithm: sha1WithRSAEncryption + 03:f7:15:4a:f8:24:da:23:56:16:93:76:dd:36:28:b9:ae:1b: + b8:c3:f1:64:ba:20:18:78:95:29:27:57:05:bc:7c:2a:f4:b9: + 51:55:da:87:02:de:0f:16:17:31:f8:aa:79:2e:09:13:bb:af: + b2:20:19:12:e5:93:f9:4b:f9:83:e8:44:d5:b2:41:25:bf:88: + 75:6f:ff:10:fc:4a:54:d0:5f:f0:fa:ef:36:73:7d:1b:36:45: + c6:21:6d:b4:15:b8:4e:cf:9c:5c:a5:3d:5a:00:8e:06:e3:3c: + 6b:32:7b:f2:9f:f0:b6:fd:df:f0:28:18:48:f0:c6:bc:d0:bf: + 34:80:96:c2:4a:b1:6d:8e:c7:90:45:de:2f:67:ac:45:04:a3: + 7a:dc:55:92:c9:47:66:d8:1a:8c:c7:ed:9c:4e:9a:e0:12:bb: + b5:6a:4c:84:e1:e1:22:0d:87:00:64:fe:8c:7d:62:39:65:a6: + ef:42:b6:80:25:12:61:01:a8:24:13:70:00:11:26:5f:fa:35: + 50:c5:48:cc:06:47:e8:27:d8:70:8d:5f:64:e6:a1:44:26:5e: + 22:ec:92:cd:ff:42:9a:44:21:6d:5c:c5:e3:22:1d:5f:47:12: + e7:ce:5f:5d:fa:d8:aa:b1:33:2d:d9:76:f2:4e:3a:33:0c:2b: + b3:2d:90:06 +-----BEGIN CERTIFICATE----- +MIIEFTCCAv2gAwIBAgIBATANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQGEwJTRTEU +MBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3 +b3JrMSAwHgYDVQQDExdBZGRUcnVzdCBQdWJsaWMgQ0EgUm9vdDAeFw0wMDA1MzAx +MDQxNTBaFw0yMDA1MzAxMDQxNTBaMGQxCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtB +ZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQIE5ldHdvcmsxIDAeBgNV +BAMTF0FkZFRydXN0IFB1YmxpYyBDQSBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOC +AQ8AMIIBCgKCAQEA6Rowj4OIFMEg2Dybjxt+A3S72mnTRqX4jsIMEZBRpS9mVEBV +6tsfSlbunyNu9DnLoblv8n75XYcmYZ4c+OLspoH4IcUkzBEMP9smcnrHAZcHF/nX +GCwwfQ56HmIexkvA/X1id9NEHif2P0tEs7c42TkfYNVRknMDtABp4/MUTu7R3AnP +dzRGULD4EfL+OHn3Bzn+UZKXC1sIXzSGAa2Il+tmzV7R/9x98oTaunet3IAIx6eH +1lWfl2royBFkuucZKT8Rs3iQhCBSWxHveNCD9tVIkNAwHM+A+WD+eeSI8t0A65RF +62WUaUC6wNW0uLp9BBGo6zEFlpROWCGOn9Bg/QIDAQABo4HRMIHOMB0GA1UdDgQW +BBSBPjfYkrAfd59ctKtzquf2NGAv+jALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/BAUw +AwEB/zCBjgYDVR0jBIGGMIGDgBSBPjfYkrAfd59ctKtzquf2NGAv+qFopGYwZDEL +MAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRU +cnVzdCBUVFAgTmV0d29yazEgMB4GA1UEAxMXQWRkVHJ1c3QgUHVibGljIENBIFJv +b3SCAQEwDQYJKoZIhvcNAQEFBQADggEBAAP3FUr4JNojVhaTdt02KLmuG7jD8WS6 +IBh4lSknVwW8fCr0uVFV2ocC3g8WFzH4qnkuCRO7r7IgGRLlk/lL+YPoRNWyQSW/ +iHVv/xD8SlTQX/D67zZzfRs2RcYhbbQVuE7PnFylPVoAjgbjPGsye/Kf8Lb93/Ao +GEjwxrzQvzSAlsJKsW2Ox5BF3i9nrEUEo3rcVZLJR2bYGozH7ZxOmuASu7VqTITh +4SINhwBk/ox9Yjllpu9CtoAlEmEBqCQTcAARJl/6NVDFSMwGR+gn2HCNX2TmoUQm +XiLsks3/QppEIW1cxeMiHV9HEufOX1362KqxMy3ZdvJOOjMMK7MtkAY= +-----END CERTIFICATE----- + +AddTrust Qualified Certificates Root +==================================== + +MD5 Fingerprint=27:EC:39:47:CD:DA:5A:AF:E2:9A:01:65:21:A9:4C:BB +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=SE, O=AddTrust AB, OU=AddTrust TTP Network, CN=AddTrust Qualified CA Root + Validity + Not Before: May 30 10:44:50 2000 GMT + Not After : May 30 10:44:50 2020 GMT + Subject: C=SE, O=AddTrust AB, OU=AddTrust TTP Network, CN=AddTrust Qualified CA Root + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:e4:1e:9a:fe:dc:09:5a:87:a4:9f:47:be:11:5f: + af:84:34:db:62:3c:79:78:b7:e9:30:b5:ec:0c:1c: + 2a:c4:16:ff:e0:ec:71:eb:8a:f5:11:6e:ed:4f:0d: + 91:d2:12:18:2d:49:15:01:c2:a4:22:13:c7:11:64: + ff:22:12:9a:b9:8e:5c:2f:08:cf:71:6a:b3:67:01: + 59:f1:5d:46:f3:b0:78:a5:f6:0e:42:7a:e3:7f:1b: + cc:d0:f0:b7:28:fd:2a:ea:9e:b3:b0:b9:04:aa:fd: + f6:c7:b4:b1:b8:2a:a0:fb:58:f1:19:a0:6f:70:25: + 7e:3e:69:4a:7f:0f:22:d8:ef:ad:08:11:9a:29:99: + e1:aa:44:45:9a:12:5e:3e:9d:6d:52:fc:e7:a0:3d: + 68:2f:f0:4b:70:7c:13:38:ad:bc:15:25:f1:d6:ce: + ab:a2:c0:31:d6:2f:9f:e0:ff:14:59:fc:84:93:d9: + 87:7c:4c:54:13:eb:9f:d1:2d:11:f8:18:3a:3a:de: + 25:d9:f7:d3:40:ed:a4:06:12:c4:3b:e1:91:c1:56: + 35:f0:14:dc:65:36:09:6e:ab:a4:07:c7:35:d1:c2: + 03:33:36:5b:75:26:6d:42:f1:12:6b:43:6f:4b:71: + 94:fa:34:1d:ed:13:6e:ca:80:7f:98:2f:6c:b9:65: + d8:e9 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + 39:95:8B:62:8B:5C:C9:D4:80:BA:58:0F:97:3F:15:08:43:CC:98:A7 + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Authority Key Identifier: + keyid:39:95:8B:62:8B:5C:C9:D4:80:BA:58:0F:97:3F:15:08:43:CC:98:A7 + DirName:/C=SE/O=AddTrust AB/OU=AddTrust TTP Network/CN=AddTrust Qualified CA Root + serial:01 + + Signature Algorithm: sha1WithRSAEncryption + 19:ab:75:ea:f8:8b:65:61:95:13:ba:69:04:ef:86:ca:13:a0: + c7:aa:4f:64:1b:3f:18:f6:a8:2d:2c:55:8f:05:b7:30:ea:42: + 6a:1d:c0:25:51:2d:a7:bf:0c:b3:ed:ef:08:7f:6c:3c:46:1a: + ea:18:43:df:76:cc:f9:66:86:9c:2c:68:f5:e9:17:f8:31:b3: + 18:c4:d6:48:7d:23:4c:68:c1:7e:bb:01:14:6f:c5:d9:6e:de: + bb:04:42:6a:f8:f6:5c:7d:e5:da:fa:87:eb:0d:35:52:67:d0: + 9e:97:76:05:93:3f:95:c7:01:e6:69:55:38:7f:10:61:99:c9: + e3:5f:a6:ca:3e:82:63:48:aa:e2:08:48:3e:aa:f2:b2:85:62: + a6:b4:a7:d9:bd:37:9c:68:b5:2d:56:7d:b0:b7:3f:a0:b1:07: + d6:e9:4f:dc:de:45:71:30:32:7f:1b:2e:09:f9:bf:52:a1:ee: + c2:80:3e:06:5c:2e:55:40:c1:1b:f5:70:45:b0:dc:5d:fa:f6: + 72:5a:77:d2:63:cd:cf:58:89:00:42:63:3f:79:39:d0:44:b0: + 82:6e:41:19:e8:dd:e0:c1:88:5a:d1:1e:71:93:1f:24:30:74: + e5:1e:a8:de:3c:27:37:7f:83:ae:9e:77:cf:f0:30:b1:ff:4b: + 99:e8:c6:a1 +-----BEGIN CERTIFICATE----- +MIIEHjCCAwagAwIBAgIBATANBgkqhkiG9w0BAQUFADBnMQswCQYDVQQGEwJTRTEU +MBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3 +b3JrMSMwIQYDVQQDExpBZGRUcnVzdCBRdWFsaWZpZWQgQ0EgUm9vdDAeFw0wMDA1 +MzAxMDQ0NTBaFw0yMDA1MzAxMDQ0NTBaMGcxCzAJBgNVBAYTAlNFMRQwEgYDVQQK +EwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQIE5ldHdvcmsxIzAh +BgNVBAMTGkFkZFRydXN0IFF1YWxpZmllZCBDQSBSb290MIIBIjANBgkqhkiG9w0B +AQEFAAOCAQ8AMIIBCgKCAQEA5B6a/twJWoekn0e+EV+vhDTbYjx5eLfpMLXsDBwq +xBb/4Oxx64r1EW7tTw2R0hIYLUkVAcKkIhPHEWT/IhKauY5cLwjPcWqzZwFZ8V1G +87B4pfYOQnrjfxvM0PC3KP0q6p6zsLkEqv32x7SxuCqg+1jxGaBvcCV+PmlKfw8i +2O+tCBGaKZnhqkRFmhJePp1tUvznoD1oL/BLcHwTOK28FSXx1s6rosAx1i+f4P8U +WfyEk9mHfExUE+uf0S0R+Bg6Ot4l2ffTQO2kBhLEO+GRwVY18BTcZTYJbqukB8c1 +0cIDMzZbdSZtQvESa0NvS3GU+jQd7RNuyoB/mC9suWXY6QIDAQABo4HUMIHRMB0G +A1UdDgQWBBQ5lYtii1zJ1IC6WA+XPxUIQ8yYpzALBgNVHQ8EBAMCAQYwDwYDVR0T +AQH/BAUwAwEB/zCBkQYDVR0jBIGJMIGGgBQ5lYtii1zJ1IC6WA+XPxUIQ8yYp6Fr +pGkwZzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQL +ExRBZGRUcnVzdCBUVFAgTmV0d29yazEjMCEGA1UEAxMaQWRkVHJ1c3QgUXVhbGlm +aWVkIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBABmrder4i2VhlRO6aQTv +hsoToMeqT2QbPxj2qC0sVY8FtzDqQmodwCVRLae/DLPt7wh/bDxGGuoYQ992zPlm +hpwsaPXpF/gxsxjE1kh9I0xowX67ARRvxdlu3rsEQmr49lx95dr6h+sNNVJn0J6X +dgWTP5XHAeZpVTh/EGGZyeNfpso+gmNIquIISD6q8rKFYqa0p9m9N5xotS1WfbC3 +P6CxB9bpT9zeRXEwMn8bLgn5v1Kh7sKAPgZcLlVAwRv1cEWw3F369nJad9Jjzc9Y +iQBCYz95OdBEsIJuQRno3eDBiFrRHnGTHyQwdOUeqN48Jzd/g66ed8/wMLH/S5no +xqE= +-----END CERTIFICATE----- + +Verisign Time Stamping Authority CA +=================================== + +MD5 Fingerprint=89:49:54:8C:C8:68:9A:83:29:EC:DC:06:73:21:AB:97 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 53:61:b2:60:ae:db:71:8e:a7:94:b3:13:33:f4:07:09 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification Authority - G2, OU=(c) 1998 VeriSign, Inc. - For authorized use only, OU=VeriSign Trust Network + Validity + Not Before: Sep 26 00:00:00 2000 GMT + Not After : Sep 25 23:59:59 2010 GMT + Subject: O=VeriSign, Inc., OU=VeriSign Trust Network, OU=Terms of use at https://www.verisign.com/rpa (c)00, CN=VeriSign Time Stamping Authority CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:d2:19:9d:67:c2:00:21:59:62:ce:b4:09:22:44: + 69:8a:f8:25:5a:db:ed:0d:b7:36:7e:4e:e0:bb:94: + 3e:90:25:87:c2:61:47:29:d9:bd:54:b8:63:cc:2c: + 7d:69:b4:33:36:f4:37:07:9a:c1:dd:40:54:fc:e0: + 78:9d:a0:93:b9:09:3d:23:51:7f:44:c2:14:74:db: + 0a:be:cb:c9:30:34:40:98:3e:d0:d7:25:10:81:94: + bd:07:4f:9c:d6:54:27:df:2e:a8:bf:cb:90:8c:8d: + 75:4b:bc:e2:e8:44:87:cd:e6:41:0a:25:6e:e8:f4: + 24:02:c5:52:0f:6e:ec:98:75 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:TRUE, pathlen:0 + X509v3 Certificate Policies: + Policy: 2.16.840.1.113733.1.7.23.1.3 + CPS: https://www.verisign.com/rpa + + X509v3 CRL Distribution Points: + URI:http://crl.verisign.com/pca3.crl + + X509v3 Key Usage: + Certificate Sign, CRL Sign + Authority Information Access: + OCSP - URI:http://ocsp.verisign.com/ocsp/status + + Signature Algorithm: sha1WithRSAEncryption + 82:70:68:95:df:b6:0d:c2:01:70:19:4a:d2:54:56:1e:ac:f2: + 45:4c:87:b8:f5:35:eb:78:4b:05:a9:c8:9d:3b:19:21:2e:70: + 34:4a:a2:f5:89:e0:15:75:45:e7:28:37:00:34:27:29:e8:37: + 4b:f2:ef:44:97:6b:17:51:1a:c3:56:9d:3c:1a:8a:f6:4a:46: + 46:37:8c:fa:cb:f5:64:5a:38:68:2e:1c:c3:ef:70:ce:b8:46: + 06:16:bf:f7:7e:e7:b5:a8:3e:45:ac:a9:25:75:22:7b:6f:3f: + b0:9c:94:e7:c7:73:ab:ac:1f:ee:25:9b:c0:16:ed:b7:ca:5b: + f0:14 +-----BEGIN CERTIFICATE----- +MIIDzTCCAzagAwIBAgIQU2GyYK7bcY6nlLMTM/QHCTANBgkqhkiG9w0BAQUFADCB +wTELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTwwOgYDVQQL +EzNDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5 +IC0gRzIxOjA4BgNVBAsTMShjKSAxOTk4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1 +dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv +cmswHhcNMDAwOTI2MDAwMDAwWhcNMTAwOTI1MjM1OTU5WjCBpTEXMBUGA1UEChMO +VmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdvcmsx +OzA5BgNVBAsTMlRlcm1zIG9mIHVzZSBhdCBodHRwczovL3d3dy52ZXJpc2lnbi5j +b20vcnBhIChjKTAwMSwwKgYDVQQDEyNWZXJpU2lnbiBUaW1lIFN0YW1waW5nIEF1 +dGhvcml0eSBDQTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0hmdZ8IAIVli +zrQJIkRpivglWtvtDbc2fk7gu5Q+kCWHwmFHKdm9VLhjzCx9abQzNvQ3B5rB3UBU +/OB4naCTuQk9I1F/RMIUdNsKvsvJMDRAmD7Q1yUQgZS9B0+c1lQn3y6ov8uQjI11 +S7zi6ESHzeZBCiVu6PQkAsVSD27smHUCAwEAAaOB3zCB3DAPBgNVHRMECDAGAQH/ +AgEAMEUGA1UdIAQ+MDwwOgYMYIZIAYb4RQEHFwEDMCowKAYIKwYBBQUHAgEWHGh0 +dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9ycGEwMQYDVR0fBCowKDAmoCSgIoYgaHR0 +cDovL2NybC52ZXJpc2lnbi5jb20vcGNhMy5jcmwwCwYDVR0PBAQDAgEGMEIGCCsG +AQUFBwEBBDYwNDAyBggrBgEFBQcwAaYmFiRodHRwOi8vb2NzcC52ZXJpc2lnbi5j +b20vb2NzcC9zdGF0dXMwDQYJKoZIhvcNAQEFBQADgYEAgnBold+2DcIBcBlK0lRW +HqzyRUyHuPU163hLBanInTsZIS5wNEqi9YngFXVF5yg3ADQnKeg3S/LvRJdrF1Ea +w1adPBqK9kpGRjeM+sv1ZFo4aC4cw+9wzrhGBha/937ntag+RaypJXUie28/sJyU +58dzq6wf7iWbwBbtt8pb8BQ= +-----END CERTIFICATE----- + +Thawte Time Stamping CA +======================= + +MD5 Fingerprint=7F:66:7A:71:D3:EB:69:78:20:9A:51:14:9D:83:DA:20 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=ZA, ST=Western Cape, L=Durbanville, O=Thawte, OU=Thawte Certification, CN=Thawte Timestamping CA + Validity + Not Before: Jan 1 00:00:00 1997 GMT + Not After : Dec 31 23:59:59 2020 GMT + Subject: C=ZA, ST=Western Cape, L=Durbanville, O=Thawte, OU=Thawte Certification, CN=Thawte Timestamping CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:d6:2b:58:78:61:45:86:53:ea:34:7b:51:9c:ed: + b0:e6:2e:18:0e:fe:e0:5f:a8:27:d3:b4:c9:e0:7c: + 59:4e:16:0e:73:54:60:c1:7f:f6:9f:2e:e9:3a:85: + 24:15:3c:db:47:04:63:c3:9e:c4:94:1a:5a:df:4c: + 7a:f3:d9:43:1d:3c:10:7a:79:25:db:90:fe:f0:51: + e7:30:d6:41:00:fd:9f:28:df:79:be:94:bb:9d:b6: + 14:e3:23:85:d7:a9:41:e0:4c:a4:79:b0:2b:1a:8b: + f2:f8:3b:8a:3e:45:ac:71:92:00:b4:90:41:98:fb: + 5f:ed:fa:b7:2e:8a:f8:88:37 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: md5WithRSAEncryption + 67:db:e2:c2:e6:87:3d:40:83:86:37:35:7d:1f:ce:9a:c3:0c: + 66:20:a8:ba:aa:04:89:86:c2:f5:10:08:0d:bf:cb:a2:05:8a: + d0:4d:36:3e:f4:d7:ef:69:c6:5e:e4:b0:94:6f:4a:b9:e7:de: + 5b:88:b6:7b:db:e3:27:e5:76:c3:f0:35:c1:cb:b5:27:9b:33: + 79:dc:90:a6:00:9e:77:fa:fc:cd:27:94:42:16:9c:d3:1c:68: + ec:bf:5c:dd:e5:a9:7b:10:0a:32:74:54:13:31:8b:85:03:84: + 91:b7:58:01:30:14:38:af:28:ca:fc:b1:50:19:19:09:ac:89: + 49:d3 +-----BEGIN CERTIFICATE----- +MIICoTCCAgqgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBizELMAkGA1UEBhMCWkEx +FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTEUMBIGA1UEBxMLRHVyYmFudmlsbGUxDzAN +BgNVBAoTBlRoYXd0ZTEdMBsGA1UECxMUVGhhd3RlIENlcnRpZmljYXRpb24xHzAd +BgNVBAMTFlRoYXd0ZSBUaW1lc3RhbXBpbmcgQ0EwHhcNOTcwMTAxMDAwMDAwWhcN +MjAxMjMxMjM1OTU5WjCBizELMAkGA1UEBhMCWkExFTATBgNVBAgTDFdlc3Rlcm4g +Q2FwZTEUMBIGA1UEBxMLRHVyYmFudmlsbGUxDzANBgNVBAoTBlRoYXd0ZTEdMBsG +A1UECxMUVGhhd3RlIENlcnRpZmljYXRpb24xHzAdBgNVBAMTFlRoYXd0ZSBUaW1l +c3RhbXBpbmcgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANYrWHhhRYZT +6jR7UZztsOYuGA7+4F+oJ9O0yeB8WU4WDnNUYMF/9p8u6TqFJBU820cEY8OexJQa +Wt9MevPZQx08EHp5JduQ/vBR5zDWQQD9nyjfeb6Uu522FOMjhdepQeBMpHmwKxqL +8vg7ij5FrHGSALSQQZj7X+36ty6K+Ig3AgMBAAGjEzARMA8GA1UdEwEB/wQFMAMB +Af8wDQYJKoZIhvcNAQEEBQADgYEAZ9viwuaHPUCDhjc1fR/OmsMMZiCouqoEiYbC +9RAIDb/LogWK0E02PvTX72nGXuSwlG9KuefeW4i2e9vjJ+V2w/A1wcu1J5szedyQ +pgCed/r8zSeUQhac0xxo7L9c3eWpexAKMnRUEzGLhQOEkbdYATAUOK8oyvyxUBkZ +CayJSdM= +-----END CERTIFICATE----- + +Entrust.net Global Secure Server CA +=================================== + +MD5 Fingerprint=9D:66:6A:CC:FF:D5:F5:43:B4:BF:8C:16:D1:2B:A8:99 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 949686588 (0x389b113c) + Signature Algorithm: md5WithRSAEncryption + Issuer: O=Entrust.net, OU=www.entrust.net/SSL_CPS incorp. by ref. (limits liab.), OU=(c) 2000 Entrust.net Limited, CN=Entrust.net Secure Server Certification Authority + Validity + Not Before: Feb 4 17:20:00 2000 GMT + Not After : Feb 4 17:50:00 2020 GMT + Subject: O=Entrust.net, OU=www.entrust.net/SSL_CPS incorp. by ref. (limits liab.), OU=(c) 2000 Entrust.net Limited, CN=Entrust.net Secure Server Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:c7:c1:5f:4e:71:f1:ce:f0:60:86:0f:d2:58:7f: + d3:33:97:2d:17:a2:75:30:b5:96:64:26:2f:68:c3: + 44:ab:a8:75:e6:00:67:34:57:9e:65:c7:22:9b:73: + e6:d3:dd:08:0e:37:55:aa:25:46:81:6c:bd:fe:a8: + f6:75:57:57:8c:90:6c:4a:c3:3e:8b:4b:43:0a:c9: + 11:56:9a:9a:27:22:99:cf:55:9e:61:d9:02:e2:7c: + b6:7c:38:07:dc:e3:7f:4f:9a:b9:03:41:80:b6:75: + 67:13:0b:9f:e8:57:36:c8:5d:00:36:de:66:14:da: + 6e:76:1f:4f:37:8c:82:13:89 + Exponent: 65537 (0x10001) + X509v3 extensions: + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 CRL Distribution Points: + DirName:/O=Entrust.net/OU=www.entrust.net/SSL_CPS incorp. by ref. (limits liab.)/OU=(c) 2000 Entrust.net Limited/CN=Entrust.net Secure Server Certification Authority/CN=CRL1 + + X509v3 Private Key Usage Period: + Not Before: Feb 4 17:20:00 2000 GMT, Not After: Feb 4 17:50:00 2020 GMT + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:CB:6C:C0:6B:E3:BB:3E:CB:FC:22:9C:FE:FB:8B:92:9C:B0:F2:6E:22 + + X509v3 Subject Key Identifier: + CB:6C:C0:6B:E3:BB:3E:CB:FC:22:9C:FE:FB:8B:92:9C:B0:F2:6E:22 + X509v3 Basic Constraints: + CA:TRUE + 1.2.840.113533.7.65.0: + 0...V5.0:4.0.... + Signature Algorithm: md5WithRSAEncryption + 62:db:81:91:ce:c8:9a:77:42:2f:ec:bd:27:a3:53:0f:50:1b: + ea:4e:92:f0:a9:af:a9:a0:ba:48:61:cb:ef:c9:06:ef:1f:d5: + f4:ee:df:56:2d:e6:ca:6a:19:73:aa:53:be:92:b3:50:02:b6: + 85:26:72:63:d8:75:50:62:75:14:b7:b3:50:1a:3f:ca:11:00: + 0b:85:45:69:6d:b6:a5:ae:51:e1:4a:dc:82:3f:6c:8c:34:b2: + 77:6b:d9:02:f6:7f:0e:ea:65:04:f1:cd:54:ca:ba:c9:cc:e0: + 84:f7:c8:3e:11:97:d3:60:09:18:bc:05:ff:6c:89:33:f0:ec: + 15:0f +-----BEGIN CERTIFICATE----- +MIIElTCCA/6gAwIBAgIEOJsRPDANBgkqhkiG9w0BAQQFADCBujEUMBIGA1UEChML +RW50cnVzdC5uZXQxPzA9BgNVBAsUNnd3dy5lbnRydXN0Lm5ldC9TU0xfQ1BTIGlu +Y29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMcKGMpIDIwMDAg +RW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5uZXQgU2VjdXJl +IFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMDAyMDQxNzIwMDBa +Fw0yMDAyMDQxNzUwMDBaMIG6MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDE/MD0GA1UE +CxQ2d3d3LmVudHJ1c3QubmV0L1NTTF9DUFMgaW5jb3JwLiBieSByZWYuIChsaW1p +dHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMjAwMCBFbnRydXN0Lm5ldCBMaW1pdGVk +MTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENlcnRpZmljYXRp +b24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDHwV9OcfHO +8GCGD9JYf9Mzly0XonUwtZZkJi9ow0SrqHXmAGc0V55lxyKbc+bT3QgON1WqJUaB +bL3+qPZ1V1eMkGxKwz6LS0MKyRFWmponIpnPVZ5h2QLifLZ8OAfc439PmrkDQYC2 +dWcTC5/oVzbIXQA23mYU2m52H083jIITiQIDAQABo4IBpDCCAaAwEQYJYIZIAYb4 +QgEBBAQDAgAHMIHjBgNVHR8EgdswgdgwgdWggdKggc+kgcwwgckxFDASBgNVBAoT +C0VudHJ1c3QubmV0MT8wPQYDVQQLFDZ3d3cuZW50cnVzdC5uZXQvU1NMX0NQUyBp +bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAyMDAw +IEVudHJ1c3QubmV0IExpbWl0ZWQxOjA4BgNVBAMTMUVudHJ1c3QubmV0IFNlY3Vy +ZSBTZXJ2ZXIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxDTALBgNVBAMTBENSTDEw +KwYDVR0QBCQwIoAPMjAwMDAyMDQxNzIwMDBagQ8yMDIwMDIwNDE3NTAwMFowCwYD +VR0PBAQDAgEGMB8GA1UdIwQYMBaAFMtswGvjuz7L/CKc/vuLkpyw8m4iMB0GA1Ud +DgQWBBTLbMBr47s+y/winP77i5KcsPJuIjAMBgNVHRMEBTADAQH/MB0GCSqGSIb2 +fQdBAAQQMA4bCFY1LjA6NC4wAwIEkDANBgkqhkiG9w0BAQQFAAOBgQBi24GRzsia +d0Iv7L0no1MPUBvqTpLwqa+poLpIYcvvyQbvH9X07t9WLebKahlzqlO+krNQAraF +JnJj2HVQYnUUt7NQGj/KEQALhUVpbbalrlHhStyCP2yMNLJ3a9kC9n8O6mUE8c1U +yrrJzOCE98g+EZfTYAkYvAX/bIkz8OwVDw== +-----END CERTIFICATE----- + +Entrust.net Global Secure Personal CA +===================================== + +MD5 Fingerprint=9A:77:19:18:ED:96:CF:DF:1B:B7:0E:F5:8D:B9:88:2E +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 949941988 (0x389ef6e4) + Signature Algorithm: md5WithRSAEncryption + Issuer: O=Entrust.net, OU=www.entrust.net/GCCA_CPS incorp. by ref. (limits liab.), OU=(c) 2000 Entrust.net Limited, CN=Entrust.net Client Certification Authority + Validity + Not Before: Feb 7 16:16:40 2000 GMT + Not After : Feb 7 16:46:40 2020 GMT + Subject: O=Entrust.net, OU=www.entrust.net/GCCA_CPS incorp. by ref. (limits liab.), OU=(c) 2000 Entrust.net Limited, CN=Entrust.net Client Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:93:74:b4:b6:e4:c5:4b:d6:a1:68:7f:62:d5:ec: + f7:51:57:b3:72:4a:98:f5:d0:89:c9:ad:63:cd:4d: + 35:51:6a:84:d4:ad:c9:68:79:6f:b8:eb:11:db:87: + ae:5c:24:51:13:f1:54:25:84:af:29:2b:9f:e3:80: + e2:d9:cb:dd:c6:45:49:34:88:90:5e:01:97:ef:ea: + 53:a6:dd:fc:c1:de:4b:2a:25:e4:e9:35:fa:55:05: + 06:e5:89:7a:ea:a4:11:57:3b:fc:7c:3d:36:cd:67: + 35:6d:a4:a9:25:59:bd:66:f5:f9:27:e4:95:67:d6: + 3f:92:80:5e:f2:34:7d:2b:85 + Exponent: 65537 (0x10001) + X509v3 extensions: + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 CRL Distribution Points: + DirName:/O=Entrust.net/OU=www.entrust.net/GCCA_CPS incorp. by ref. (limits liab.)/OU=(c) 2000 Entrust.net Limited/CN=Entrust.net Client Certification Authority/CN=CRL1 + + X509v3 Private Key Usage Period: + Not Before: Feb 7 16:16:40 2000 GMT, Not After: Feb 7 16:46:40 2020 GMT + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:84:8B:74:FD:C5:8D:C0:FF:27:6D:20:37:45:7C:FE:2D:CE:BA:D3:7D + + X509v3 Subject Key Identifier: + 84:8B:74:FD:C5:8D:C0:FF:27:6D:20:37:45:7C:FE:2D:CE:BA:D3:7D + X509v3 Basic Constraints: + CA:TRUE + 1.2.840.113533.7.65.0: + 0...V5.0:4.0.... + Signature Algorithm: md5WithRSAEncryption + 4e:6f:35:80:3b:d1:8a:f5:0e:a7:20:cb:2d:65:55:d0:92:f4: + e7:84:b5:06:26:83:12:84:0b:ac:3b:b2:44:ee:bd:cf:40:db: + 20:0e:ba:6e:14:ea:30:e0:3b:62:7c:7f:8b:6b:7c:4a:a7:d5: + 35:3c:be:a8:5c:ea:4b:bb:93:8e:80:66:ab:0f:29:fd:4d:2d: + bf:1a:9b:0a:90:c5:ab:da:d1:b3:86:d4:2f:24:52:5c:7a:6d: + c6:f2:fe:e5:4d:1a:30:8c:90:f2:ba:d7:4a:3e:43:7e:d4:c8: + 50:1a:87:f8:4f:81:c7:76:0b:84:3a:72:9d:ce:65:66:97:ae: + 26:5e +-----BEGIN CERTIFICATE----- +MIIEgzCCA+ygAwIBAgIEOJ725DANBgkqhkiG9w0BAQQFADCBtDEUMBIGA1UEChML +RW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9HQ0NBX0NQUyBp +bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAyMDAw +IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENsaWVu +dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMDAyMDcxNjE2NDBaFw0yMDAy +MDcxNjQ2NDBaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3d3d3 +LmVudHJ1c3QubmV0L0dDQ0FfQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxp +YWIuKTElMCMGA1UECxMcKGMpIDIwMDAgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEG +A1UEAxMqRW50cnVzdC5uZXQgQ2xpZW50IENlcnRpZmljYXRpb24gQXV0aG9yaXR5 +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCTdLS25MVL1qFof2LV7PdRV7Ny +Spj10InJrWPNTTVRaoTUrcloeW+46xHbh65cJFET8VQlhK8pK5/jgOLZy93GRUk0 +iJBeAZfv6lOm3fzB3ksqJeTpNfpVBQbliXrqpBFXO/x8PTbNZzVtpKklWb1m9fkn +5JVn1j+SgF7yNH0rhQIDAQABo4IBnjCCAZowEQYJYIZIAYb4QgEBBAQDAgAHMIHd +BgNVHR8EgdUwgdIwgc+ggcyggcmkgcYwgcMxFDASBgNVBAoTC0VudHJ1c3QubmV0 +MUAwPgYDVQQLFDd3d3cuZW50cnVzdC5uZXQvR0NDQV9DUFMgaW5jb3JwLiBieSBy +ZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMjAwMCBFbnRydXN0Lm5l +dCBMaW1pdGVkMTMwMQYDVQQDEypFbnRydXN0Lm5ldCBDbGllbnQgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkxDTALBgNVBAMTBENSTDEwKwYDVR0QBCQwIoAPMjAwMDAy +MDcxNjE2NDBagQ8yMDIwMDIwNzE2NDY0MFowCwYDVR0PBAQDAgEGMB8GA1UdIwQY +MBaAFISLdP3FjcD/J20gN0V8/i3OutN9MB0GA1UdDgQWBBSEi3T9xY3A/ydtIDdF +fP4tzrrTfTAMBgNVHRMEBTADAQH/MB0GCSqGSIb2fQdBAAQQMA4bCFY1LjA6NC4w +AwIEkDANBgkqhkiG9w0BAQQFAAOBgQBObzWAO9GK9Q6nIMstZVXQkvTnhLUGJoMS +hAusO7JE7r3PQNsgDrpuFOow4DtifH+La3xKp9U1PL6oXOpLu5OOgGarDyn9TS2/ +GpsKkMWr2tGzhtQvJFJcem3G8v7lTRowjJDyutdKPkN+1MhQGof4T4HHdguEOnKd +zmVml64mXg== +-----END CERTIFICATE----- + +Entrust Root Certification Authority +==================================== + +MD5 Fingerprint=D6:A5:C3:ED:5D:DD:3E:00:C1:3D:87:92:1F:1D:3F:E4 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1164660820 (0x456b5054) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=Entrust, Inc., OU=www.entrust.net/CPS is incorporated by reference, OU=(c) 2006 Entrust, Inc., CN=Entrust Root Certification Authority + Validity + Not Before: Nov 27 20:23:42 2006 GMT + Not After : Nov 27 20:53:42 2026 GMT + Subject: C=US, O=Entrust, Inc., OU=www.entrust.net/CPS is incorporated by reference, OU=(c) 2006 Entrust, Inc., CN=Entrust Root Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b6:95:b6:43:42:fa:c6:6d:2a:6f:48:df:94:4c: + 39:57:05:ee:c3:79:11:41:68:36:ed:ec:fe:9a:01: + 8f:a1:38:28:fc:f7:10:46:66:2e:4d:1e:1a:b1:1a: + 4e:c6:d1:c0:95:88:b0:c9:ff:31:8b:33:03:db:b7: + 83:7b:3e:20:84:5e:ed:b2:56:28:a7:f8:e0:b9:40: + 71:37:c5:cb:47:0e:97:2a:68:c0:22:95:62:15:db: + 47:d9:f5:d0:2b:ff:82:4b:c9:ad:3e:de:4c:db:90: + 80:50:3f:09:8a:84:00:ec:30:0a:3d:18:cd:fb:fd: + 2a:59:9a:23:95:17:2c:45:9e:1f:6e:43:79:6d:0c: + 5c:98:fe:48:a7:c5:23:47:5c:5e:fd:6e:e7:1e:b4: + f6:68:45:d1:86:83:5b:a2:8a:8d:b1:e3:29:80:fe: + 25:71:88:ad:be:bc:8f:ac:52:96:4b:aa:51:8d:e4: + 13:31:19:e8:4e:4d:9f:db:ac:b3:6a:d5:bc:39:54: + 71:ca:7a:7a:7f:90:dd:7d:1d:80:d9:81:bb:59:26: + c2:11:fe:e6:93:e2:f7:80:e4:65:fb:34:37:0e:29: + 80:70:4d:af:38:86:2e:9e:7f:57:af:9e:17:ae:eb: + 1c:cb:28:21:5f:b6:1c:d8:e7:a2:04:22:f9:d3:da: + d8:cb + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Private Key Usage Period: + Not Before: Nov 27 20:23:42 2006 GMT, Not After: Nov 27 20:53:42 2026 GMT + X509v3 Authority Key Identifier: + keyid:68:90:E4:67:A4:A6:53:80:C7:86:66:A4:F1:F7:4B:43:FB:84:BD:6D + + X509v3 Subject Key Identifier: + 68:90:E4:67:A4:A6:53:80:C7:86:66:A4:F1:F7:4B:43:FB:84:BD:6D + 1.2.840.113533.7.65.0: + 0...V7.1:4.0.... + Signature Algorithm: sha1WithRSAEncryption + 93:d4:30:b0:d7:03:20:2a:d0:f9:63:e8:91:0c:05:20:a9:5f: + 19:ca:7b:72:4e:d4:b1:db:d0:96:fb:54:5a:19:2c:0c:08:f7: + b2:bc:85:a8:9d:7f:6d:3b:52:b3:2a:db:e7:d4:84:8c:63:f6: + 0f:cb:26:01:91:50:6c:f4:5f:14:e2:93:74:c0:13:9e:30:3a: + 50:e3:b4:60:c5:1c:f0:22:44:8d:71:47:ac:c8:1a:c9:e9:9b: + 9a:00:60:13:ff:70:7e:5f:11:4d:49:1b:b3:15:52:7b:c9:54: + da:bf:9d:95:af:6b:9a:d8:9e:e9:f1:e4:43:8d:e2:11:44:3a: + bf:af:bd:83:42:73:52:8b:aa:bb:a7:29:cf:f5:64:1c:0a:4d: + d1:bc:aa:ac:9f:2a:d0:ff:7f:7f:da:7d:ea:b1:ed:30:25:c1: + 84:da:34:d2:5b:78:83:56:ec:9c:36:c3:26:e2:11:f6:67:49: + 1d:92:ab:8c:fb:eb:ff:7a:ee:85:4a:a7:50:80:f0:a7:5c:4a: + 94:2e:5f:05:99:3c:52:41:e0:cd:b4:63:cf:01:43:ba:9c:83: + dc:8f:60:3b:f3:5a:b4:b4:7b:ae:da:0b:90:38:75:ef:81:1d: + 66:d2:f7:57:70:36:b3:bf:fc:28:af:71:25:85:5b:13:fe:1e: + 7f:5a:b4:3c +-----BEGIN CERTIFICATE----- +MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMC +VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0 +Lm5ldC9DUFMgaXMgaW5jb3Jwb3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMW +KGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsGA1UEAxMkRW50cnVzdCBSb290IENl +cnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0MloXDTI2MTEyNzIw +NTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMTkw +NwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSBy +ZWZlcmVuY2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNV +BAMTJEVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJ +KoZIhvcNAQEBBQADggEPADCCAQoCggEBALaVtkNC+sZtKm9I35RMOVcF7sN5EUFo +Nu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYszA9u3g3s+IIRe7bJWKKf4 +4LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOwwCj0Yzfv9 +KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGI +rb68j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi +94DkZfs0Nw4pgHBNrziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOB +sDCBrTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAi +gA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1MzQyWjAfBgNVHSMEGDAWgBRo +kORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DHhmak8fdLQ/uE +vW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA +A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9t +O1KzKtvn1ISMY/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6Zua +AGAT/3B+XxFNSRuzFVJ7yVTav52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP +9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTSW3iDVuycNsMm4hH2Z0kdkquM++v/ +eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0tHuu2guQOHXvgR1m +0vdXcDazv/wor3ElhVsT/h5/WrQ8 +-----END CERTIFICATE----- + +AOL Time Warner Root Certification Authority 1 +============================================== + +MD5 Fingerprint=E7:7A:DC:B1:1F:6E:06:1F:74:6C:59:16:27:C3:4B:C0 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=AOL Time Warner Inc., OU=America Online Inc., CN=AOL Time Warner Root Certification Authority 1 + Validity + Not Before: May 29 06:00:00 2002 GMT + Not After : Nov 20 15:03:00 2037 GMT + Subject: C=US, O=AOL Time Warner Inc., OU=America Online Inc., CN=AOL Time Warner Root Certification Authority 1 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:99:de:8f:c3:25:a3:69:34:e8:05:f7:74:b9:bf: + 5a:97:19:b9:2f:94:d2:93:e5:2d:89:ca:84:7c:3f: + 10:43:1b:8c:8b:7c:84:58:f8:24:7c:48:cf:2a:fd: + c0:15:d9:18:7e:84:1a:17:d3:db:9e:d7:ca:e4:d9: + d7:aa:58:51:87:f0:f0:8b:48:4e:e2:c2:c4:59:69: + 30:62:b6:30:a2:8c:0b:11:99:61:35:6d:7e:ef:c5: + b1:19:06:20:12:8e:42:e1:df:0f:96:10:52:a8:cf: + 9c:5f:95:14:d8:af:3b:75:0b:31:20:1f:44:2f:a2: + 62:41:b3:bb:18:21:db:ca:71:3c:8c:ec:b6:b9:0d: + 9f:ef:51:ef:4d:7b:12:f2:0b:0c:e1:ac:40:8f:77: + 7f:b0:ca:78:71:0c:5d:16:71:70:a2:d7:c2:3a:85: + cd:0e:9a:c4:e0:00:b0:d5:25:ea:dc:2b:e4:94:2d: + 38:9c:89:41:57:64:28:65:19:1c:b6:44:b4:c8:31: + 6b:8e:01:7b:76:59:25:7f:15:1c:84:08:7c:73:65: + 20:0a:a1:04:2e:1a:32:a8:9a:20:b1:9c:2c:21:59: + e7:fb:cf:ee:70:2d:08:ca:63:3e:2c:9b:93:19:6a: + a4:c2:97:ff:b7:86:57:88:85:6c:9e:15:16:2b:4d: + 2c:b3 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + A1:36:30:16:CB:86:90:00:45:80:53:B1:8F:C8:D8:3D:7C:BE:5F:12 + X509v3 Authority Key Identifier: + keyid:A1:36:30:16:CB:86:90:00:45:80:53:B1:8F:C8:D8:3D:7C:BE:5F:12 + + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 8a:20:18:a5:be:b3:2f:b4:a6:84:00:40:30:29:fa:b4:14:73: + 4c:79:45:a7:f6:70:e0:e8:7e:64:1e:0a:95:7c:6a:61:c2:ef: + 4e:1f:be:ff:c9:99:1f:07:61:4a:e1:5d:4c:cd:ad:ee:d0:52: + 32:d9:59:32:bc:da:79:72:d6:7b:09:e8:02:81:35:d3:0a:df: + 11:1d:c9:79:a0:80:4d:fe:5a:d7:56:d6:ed:0f:2a:af:a7:18: + 75:33:0c:ea:c1:61:05:4f:6a:9a:89:f2:8d:b9:9f:2e:ef:b0: + 5f:5a:00:eb:be:ad:a0:f8:44:05:67:bc:cb:04:ef:9e:64:c5: + e9:c8:3f:05:bf:c6:2f:07:1c:c3:36:71:86:ca:38:66:4a:cd: + d6:b8:4b:c6:6c:a7:97:3b:fa:13:2d:6e:23:61:87:a1:63:42: + ac:c2:cb:97:9f:61:68:cf:2d:4c:04:9d:d7:25:4f:0a:0e:4d: + 90:8b:18:56:a8:93:48:57:dc:6f:ae:bd:9e:67:57:77:89:50: + b3:be:11:9b:45:67:83:86:19:87:d3:98:bd:08:1a:16:1f:58: + 82:0b:e1:96:69:05:4b:8e:ec:83:51:31:07:d5:d4:9f:ff:59: + 7b:a8:6e:85:cf:d3:4b:a9:49:b0:5f:b0:39:28:68:0e:73:dd: + 25:9a:de:12 +-----BEGIN CERTIFICATE----- +MIID5jCCAs6gAwIBAgIBATANBgkqhkiG9w0BAQUFADCBgzELMAkGA1UEBhMCVVMx +HTAbBgNVBAoTFEFPTCBUaW1lIFdhcm5lciBJbmMuMRwwGgYDVQQLExNBbWVyaWNh +IE9ubGluZSBJbmMuMTcwNQYDVQQDEy5BT0wgVGltZSBXYXJuZXIgUm9vdCBDZXJ0 +aWZpY2F0aW9uIEF1dGhvcml0eSAxMB4XDTAyMDUyOTA2MDAwMFoXDTM3MTEyMDE1 +MDMwMFowgYMxCzAJBgNVBAYTAlVTMR0wGwYDVQQKExRBT0wgVGltZSBXYXJuZXIg +SW5jLjEcMBoGA1UECxMTQW1lcmljYSBPbmxpbmUgSW5jLjE3MDUGA1UEAxMuQU9M +IFRpbWUgV2FybmVyIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMTCCASIw +DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnej8Mlo2k06AX3dLm/WpcZuS+U +0pPlLYnKhHw/EEMbjIt8hFj4JHxIzyr9wBXZGH6EGhfT257XyuTZ16pYUYfw8ItI +TuLCxFlpMGK2MKKMCxGZYTVtfu/FsRkGIBKOQuHfD5YQUqjPnF+VFNivO3ULMSAf +RC+iYkGzuxgh28pxPIzstrkNn+9R7017EvILDOGsQI93f7DKeHEMXRZxcKLXwjqF +zQ6axOAAsNUl6twr5JQtOJyJQVdkKGUZHLZEtMgxa44Be3ZZJX8VHIQIfHNlIAqh +BC4aMqiaILGcLCFZ5/vP7nAtCMpjPiybkxlqpMKX/7eGV4iFbJ4VFitNLLMCAwEA +AaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUoTYwFsuGkABFgFOxj8jY +PXy+XxIwHwYDVR0jBBgwFoAUoTYwFsuGkABFgFOxj8jYPXy+XxIwDgYDVR0PAQH/ +BAQDAgGGMA0GCSqGSIb3DQEBBQUAA4IBAQCKIBilvrMvtKaEAEAwKfq0FHNMeUWn +9nDg6H5kHgqVfGphwu9OH77/yZkfB2FK4V1Mza3u0FIy2VkyvNp5ctZ7CegCgTXT +Ct8RHcl5oIBN/lrXVtbtDyqvpxh1MwzqwWEFT2qaifKNuZ8u77BfWgDrvq2g+EQF +Z7zLBO+eZMXpyD8Fv8YvBxzDNnGGyjhmSs3WuEvGbKeXO/oTLW4jYYehY0KswsuX +n2Fozy1MBJ3XJU8KDk2QixhWqJNIV9xvrr2eZ1d3iVCzvhGbRWeDhhmH05i9CBoW +H1iCC+GWaQVLjuyDUTEH1dSf/1l7qG6Fz9NLqUmwX7A5KGgOc90lmt4S +-----END CERTIFICATE----- + +Thawte Personal Premium CA +========================== + +MD5 Fingerprint=3A:B2:DE:22:9A:20:93:49:F9:ED:C8:D2:8A:E7:68:0D +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting, OU=Certification Services Division, CN=Thawte Personal Premium CA/emailAddress=personal-premium@thawte.com + Validity + Not Before: Jan 1 00:00:00 1996 GMT + Not After : Dec 31 23:59:59 2020 GMT + Subject: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting, OU=Certification Services Division, CN=Thawte Personal Premium CA/emailAddress=personal-premium@thawte.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:c9:66:d9:f8:07:44:cf:b9:8c:2e:f0:a1:ef:13: + 45:6c:05:df:de:27:16:51:36:41:11:6c:6c:3b:ed: + fe:10:7d:12:9e:e5:9b:42:9a:fe:60:31:c3:66:b7: + 73:3a:48:ae:4e:d0:32:37:94:88:b5:0d:b6:d9:f3: + f2:44:d9:d5:88:12:dd:76:4d:f2:1a:fc:6f:23:1e: + 7a:f1:d8:98:45:4e:07:10:ef:16:42:d0:43:75:6d: + 4a:de:e2:aa:c9:31:ff:1f:00:70:7c:66:cf:10:25: + 08:ba:fa:ee:00:e9:46:03:66:27:11:15:3b:aa:5b: + f2:98:dd:36:42:b2:da:88:75 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: md5WithRSAEncryption + 69:36:89:f7:34:2a:33:72:2f:6d:3b:d4:22:b2:b8:6f:9a:c5: + 36:66:0e:1b:3c:a1:b1:75:5a:e6:fd:35:d3:f8:a8:f2:07:6f: + 85:67:8e:de:2b:b9:e2:17:b0:3a:a0:f0:0e:a2:00:9a:df:f3: + 14:15:6e:bb:c8:85:5a:98:80:f9:ff:be:74:1d:3d:f3:fe:30: + 25:d1:37:34:67:fa:a5:71:79:30:61:29:72:c0:e0:2c:4c:fb: + 56:e4:3a:a8:6f:e5:32:59:52:db:75:28:50:59:0c:f8:0b:19: + e4:ac:d9:af:96:8d:2f:50:db:07:c3:ea:1f:ab:33:e0:f5:2b: + 31:89 +-----BEGIN CERTIFICATE----- +MIIDKTCCApKgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBzzELMAkGA1UEBhMCWkEx +FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMRowGAYD +VQQKExFUaGF3dGUgQ29uc3VsdGluZzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBT +ZXJ2aWNlcyBEaXZpc2lvbjEjMCEGA1UEAxMaVGhhd3RlIFBlcnNvbmFsIFByZW1p +dW0gQ0ExKjAoBgkqhkiG9w0BCQEWG3BlcnNvbmFsLXByZW1pdW1AdGhhd3RlLmNv +bTAeFw05NjAxMDEwMDAwMDBaFw0yMDEyMzEyMzU5NTlaMIHPMQswCQYDVQQGEwJa +QTEVMBMGA1UECBMMV2VzdGVybiBDYXBlMRIwEAYDVQQHEwlDYXBlIFRvd24xGjAY +BgNVBAoTEVRoYXd0ZSBDb25zdWx0aW5nMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9u +IFNlcnZpY2VzIERpdmlzaW9uMSMwIQYDVQQDExpUaGF3dGUgUGVyc29uYWwgUHJl +bWl1bSBDQTEqMCgGCSqGSIb3DQEJARYbcGVyc29uYWwtcHJlbWl1bUB0aGF3dGUu +Y29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJZtn4B0TPuYwu8KHvE0Vs +Bd/eJxZRNkERbGw77f4QfRKe5ZtCmv5gMcNmt3M6SK5O0DI3lIi1DbbZ8/JE2dWI +Et12TfIa/G8jHnrx2JhFTgcQ7xZC0EN1bUre4qrJMf8fAHB8Zs8QJQi6+u4A6UYD +ZicRFTuqW/KY3TZCstqIdQIDAQABoxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqG +SIb3DQEBBAUAA4GBAGk2ifc0KjNyL2071CKyuG+axTZmDhs8obF1Wub9NdP4qPIH +b4Vnjt4rueIXsDqg8A6iAJrf8xQVbrvIhVqYgPn/vnQdPfP+MCXRNzRn+qVxeTBh +KXLA4CxM+1bkOqhv5TJZUtt1KFBZDPgLGeSs2a+WjS9Q2wfD6h+rM+D1KzGJ +-----END CERTIFICATE----- + +AOL Time Warner Root Certification Authority 2 +============================================== + +MD5 Fingerprint=01:5A:99:C3:D6:4F:A9:4B:3C:3B:B1:A3:AB:27:4C:BF +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=AOL Time Warner Inc., OU=America Online Inc., CN=AOL Time Warner Root Certification Authority 2 + Validity + Not Before: May 29 06:00:00 2002 GMT + Not After : Sep 28 23:43:00 2037 GMT + Subject: C=US, O=AOL Time Warner Inc., OU=America Online Inc., CN=AOL Time Warner Root Certification Authority 2 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (4096 bit) + Modulus (4096 bit): + 00:b4:37:5a:08:16:99:14:e8:55:b1:1b:24:6b:fc: + c7:8b:e6:87:a9:89:ee:8b:99:cd:4f:40:86:a4:b6: + 4d:c9:d9:b1:dc:3c:4d:0d:85:4c:15:6c:46:8b:52: + 78:9f:f8:23:fd:67:f5:24:3a:68:5d:d0:f7:64:61: + 41:54:a3:8b:a5:08:d2:29:5b:9b:60:4f:26:83:d1: + 63:12:56:49:76:a4:16:c2:a5:9d:45:ac:8b:84:95: + a8:16:b1:ec:9f:ea:24:1a:ef:b9:57:5c:9a:24:21: + 2c:4d:0e:71:1f:a6:ac:5d:45:74:03:98:c4:54:8c: + 16:4a:41:77:86:95:75:0c:47:01:66:60:fc:15:f1: + 0f:ea:f5:14:78:c7:0e:d7:6e:81:1c:5e:bf:5e:e7: + 3a:2a:d8:97:17:30:7c:00:ad:08:9d:33:af:b8:99: + 61:80:8b:a8:95:7e:14:dc:12:6c:a4:d0:d8:ef:40: + 49:02:36:f9:6e:a9:d6:1d:96:56:04:b2:b3:2d:16: + 56:86:8f:d9:20:57:80:cd:67:10:6d:b0:4c:f0:da: + 46:b6:ea:25:2e:46:af:8d:b0:85:38:34:8b:14:26: + 82:2b:ac:ae:99:0b:8e:14:d7:52:bd:9e:69:c3:86: + 02:0b:ea:76:75:31:09:ce:33:19:21:85:43:e6:89: + 2d:9f:25:37:67:f1:23:6a:d2:00:6d:97:f9:9f:e7: + 29:ca:dd:1f:d7:06:ea:b8:c9:b9:09:21:9f:c8:3f: + 06:c5:d2:e9:12:46:00:4e:7b:08:eb:42:3d:2b:48: + 6e:9d:67:dd:4b:02:e4:44:f3:93:19:a5:27:ce:69: + 7a:be:67:d3:fc:50:a4:2c:ab:c3:6b:b9:e3:80:4c: + cf:05:61:4b:2b:dc:1b:b9:a6:d2:d0:aa:f5:2b:73: + fb:ce:90:35:9f:0c:52:1c:bf:5c:21:61:11:5b:15: + 4b:a9:24:51:fc:a4:5c:f7:17:9d:b0:d2:fa:07:e9: + 8f:56:e4:1a:8c:68:8a:04:d3:7c:5a:e3:9e:a2:a1: + ca:71:5b:a2:d4:a0:e7:29:85:5d:03:68:2a:4f:d2: + 06:d7:3d:f9:c3:03:2f:3f:65:f9:67:1e:47:40:d3: + 63:0f:e3:d5:8e:f9:85:ab:97:4c:b3:d7:26:eb:96: + 0a:94:de:85:36:9c:c8:7f:81:09:02:49:2a:0e:f5: + 64:32:0c:82:d1:ba:6a:82:1b:b3:4b:74:11:f3:8c: + 77:d6:9f:bf:dc:37:a4:a7:55:04:2f:d4:31:e8:d3: + 46:b9:03:7c:da:12:4e:59:64:b7:51:31:31:50:a0: + ca:1c:27:d9:10:2e:ad:d6:bd:10:66:2b:c3:b0:22: + 4a:12:5b + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 4F:69:6D:03:7E:9D:9F:07:18:43:BC:B7:10:4E:D5:BF:A9:C4:20:28 + X509v3 Authority Key Identifier: + keyid:4F:69:6D:03:7E:9D:9F:07:18:43:BC:B7:10:4E:D5:BF:A9:C4:20:28 + + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 3b:f3:ae:ca:e8:2e:87:85:fb:65:59:e7:ad:11:14:a5:57:bc: + 58:9f:24:12:57:bb:fb:3f:34:da:ee:ad:7a:2a:34:72:70:31: + 6b:c7:19:98:80:c9:82:de:37:77:5e:54:8b:8e:f2:ea:67:4f: + c9:74:84:91:56:09:d5:e5:7a:9a:81:b6:81:c2:ad:36:e4:f1: + 54:11:53:f3:34:45:01:26:c8:e5:1a:bc:34:44:21:de:ad:25: + fc:76:16:77:21:90:80:98:57:9d:4e:ea:ec:2f:aa:3c:14:7b: + 57:c1:7e:18:14:67:ee:24:c6:bd:ba:15:b0:d2:18:bd:b7:55: + 81:ac:53:c0:e8:dd:69:12:13:42:b7:02:b5:05:41:ca:79:50: + 6e:82:0e:71:72:93:46:e8:9d:0d:5d:bd:ae:ce:29:ad:63:d5: + 55:16:80:30:27:ff:76:ba:f7:b8:d6:4a:e3:d9:b5:f9:52:d0: + 4e:40:a9:c7:e5:c2:32:c7:aa:76:24:e1:6b:05:50:eb:c5:bf: + 0a:54:e5:b9:42:3c:24:fb:b7:07:9c:30:9f:79:5a:e6:e0:40: + 52:15:f4:fc:aa:f4:56:f9:44:97:87:ed:0e:65:72:5e:be:26: + fb:4d:a4:2d:08:07:de:d8:5c:a0:dc:81:33:99:18:25:11:77: + a7:eb:fd:58:09:2c:99:6b:1b:8a:f3:52:3f:1a:4d:48:60:f1: + a0:f6:33:02:53:8b:ed:25:09:b8:0d:2d:ed:97:73:ec:d7:96: + 1f:8e:60:0e:da:10:9b:2f:18:24:f6:a6:4d:0a:f9:3b:cb:75: + c2:cc:2f:ce:24:69:c9:0a:22:8e:59:a7:f7:82:0c:d7:d7:6b: + 35:9c:43:00:6a:c4:95:67:ba:9c:45:cb:b8:0e:37:f7:dc:4e: + 01:4f:be:0a:b6:03:d3:ad:8a:45:f7:da:27:4d:29:b1:48:df: + e4:11:e4:96:46:bd:6c:02:3e:d6:51:c8:95:17:01:15:a9:f2: + aa:aa:f2:bf:2f:65:1b:6f:d0:b9:1a:93:f5:8e:35:c4:80:87: + 3e:94:2f:66:e4:e9:a8:ff:41:9c:70:2a:4f:2a:39:18:95:1e: + 7e:fb:61:01:3c:51:08:2e:28:18:a4:16:0f:31:fd:3a:6c:23: + 93:20:76:e1:fd:07:85:d1:5b:3f:d2:1c:73:32:dd:fa:b9:f8: + 8c:cf:02:87:7a:9a:96:e4:ed:4f:89:8d:53:43:ab:0e:13:c0: + 01:15:b4:79:38:db:fc:6e:3d:9e:51:b6:b8:13:8b:67:cf:f9: + 7c:d9:22:1d:f6:5d:c5:1c:01:2f:98:e8:7a:24:18:bc:84:d7: + fa:dc:72:5b:f7:c1:3a:68 +-----BEGIN CERTIFICATE----- +MIIF5jCCA86gAwIBAgIBATANBgkqhkiG9w0BAQUFADCBgzELMAkGA1UEBhMCVVMx +HTAbBgNVBAoTFEFPTCBUaW1lIFdhcm5lciBJbmMuMRwwGgYDVQQLExNBbWVyaWNh +IE9ubGluZSBJbmMuMTcwNQYDVQQDEy5BT0wgVGltZSBXYXJuZXIgUm9vdCBDZXJ0 +aWZpY2F0aW9uIEF1dGhvcml0eSAyMB4XDTAyMDUyOTA2MDAwMFoXDTM3MDkyODIz +NDMwMFowgYMxCzAJBgNVBAYTAlVTMR0wGwYDVQQKExRBT0wgVGltZSBXYXJuZXIg +SW5jLjEcMBoGA1UECxMTQW1lcmljYSBPbmxpbmUgSW5jLjE3MDUGA1UEAxMuQU9M +IFRpbWUgV2FybmVyIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMjCCAiIw +DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALQ3WggWmRToVbEbJGv8x4vmh6mJ +7ouZzU9AhqS2TcnZsdw8TQ2FTBVsRotSeJ/4I/1n9SQ6aF3Q92RhQVSji6UI0ilb +m2BPJoPRYxJWSXakFsKlnUWsi4SVqBax7J/qJBrvuVdcmiQhLE0OcR+mrF1FdAOY +xFSMFkpBd4aVdQxHAWZg/BXxD+r1FHjHDtdugRxev17nOirYlxcwfACtCJ0zr7iZ +YYCLqJV+FNwSbKTQ2O9ASQI2+W6p1h2WVgSysy0WVoaP2SBXgM1nEG2wTPDaRrbq +JS5Gr42whTg0ixQmgiusrpkLjhTXUr2eacOGAgvqdnUxCc4zGSGFQ+aJLZ8lN2fx +I2rSAG2X+Z/nKcrdH9cG6rjJuQkhn8g/BsXS6RJGAE57COtCPStIbp1n3UsC5ETz +kxmlJ85per5n0/xQpCyrw2u544BMzwVhSyvcG7mm0tCq9Stz+86QNZ8MUhy/XCFh +EVsVS6kkUfykXPcXnbDS+gfpj1bkGoxoigTTfFrjnqKhynFbotSg5ymFXQNoKk/S +Btc9+cMDLz9l+WceR0DTYw/j1Y75hauXTLPXJuuWCpTehTacyH+BCQJJKg71ZDIM +gtG6aoIbs0t0EfOMd9afv9w3pKdVBC/UMejTRrkDfNoSTllkt1ExMVCgyhwn2RAu +rda9EGYrw7AiShJbAgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE +FE9pbQN+nZ8HGEO8txBO1b+pxCAoMB8GA1UdIwQYMBaAFE9pbQN+nZ8HGEO8txBO +1b+pxCAoMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQUFAAOCAgEAO/Ouyugu +h4X7ZVnnrREUpVe8WJ8kEle7+z802u6teio0cnAxa8cZmIDJgt43d15Ui47y6mdP +yXSEkVYJ1eV6moG2gcKtNuTxVBFT8zRFASbI5Rq8NEQh3q0l/HYWdyGQgJhXnU7q +7C+qPBR7V8F+GBRn7iTGvboVsNIYvbdVgaxTwOjdaRITQrcCtQVBynlQboIOcXKT +RuidDV29rs4prWPVVRaAMCf/drr3uNZK49m1+VLQTkCpx+XCMseqdiThawVQ68W/ +ClTluUI8JPu3B5wwn3la5uBAUhX0/Kr0VvlEl4ftDmVyXr4m+02kLQgH3thcoNyB +M5kYJRF3p+v9WAksmWsbivNSPxpNSGDxoPYzAlOL7SUJuA0t7Zdz7NeWH45gDtoQ +my8YJPamTQr5O8t1wswvziRpyQoijlmn94IM19drNZxDAGrElWe6nEXLuA4399xO +AU++CrYD062KRffaJ00psUjf5BHklka9bAI+1lHIlRcBFanyqqryvy9lG2/QuRqT +9Y41xICHPpQvZuTpqP9BnHAqTyo5GJUefvthATxRCC4oGKQWDzH9OmwjkyB24f0H +hdFbP9IcczLd+rn4jM8Ch3qaluTtT4mNU0OrDhPAARW0eTjb/G49nlG2uBOLZ8/5 +fNkiHfZdxRwBL5joeiQYvITX+txyW/fBOmg= +-----END CERTIFICATE----- + +beTRUSTed Root CA-Baltimore Implementation +========================================== + +MD5 Fingerprint=81:35:B9:FB:FB:12:CA:18:69:36:EB:AE:69:78:A1:F1 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1018510662 (0x3cb53d46) + Signature Algorithm: sha1WithRSAEncryption + Issuer: O=beTRUSTed, OU=beTRUSTed Root CAs, CN=beTRUSTed Root CA-Baltimore Implementation + Validity + Not Before: Apr 11 07:38:51 2002 GMT + Not After : Apr 11 07:38:51 2022 GMT + Subject: O=beTRUSTed, OU=beTRUSTed Root CAs, CN=beTRUSTed Root CA-Baltimore Implementation + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:bc:7e:c4:39:9c:8c:e3:d6:1c:86:ff:ca:62:ad: + e0:7f:30:45:7a:8e:1a:b3:b8:c7:f9:d1:36:ff:22: + f3:4e:6a:5f:84:10:fb:66:81:c3:94:79:31:d2:91: + e1:77:8e:18:2a:c3:14:de:51:f5:4f:a3:2b:bc:18: + 16:e2:b5:dd:79:de:22:f8:82:7e:cb:81:1f:fd:27: + 2c:8f:fa:97:64:22:8e:f8:ff:61:a3:9c:1b:1e:92: + 8f:c0:a8:09:df:09:11:ec:b7:7d:31:9a:1a:ea:83: + 21:06:3c:9f:ba:5c:ff:94:ea:6a:b8:c3:6b:55:34: + 4f:3d:32:1f:dd:81:14:e0:c4:3c:cd:9d:30:f8:30: + a9:97:d3:ee:cc:a3:d0:1f:5f:1c:13:81:d4:18:ab: + 94:d1:63:c3:9e:7f:35:92:9e:5f:44:ea:ec:f4:22: + 5c:b7:e8:3d:7d:a4:f9:89:a9:91:b2:2a:d9:eb:33: + 87:ee:a5:fd:e3:da:cc:88:e6:89:26:6e:c7:2b:82: + d0:5e:9d:59:db:14:ec:91:83:05:c3:5e:0e:c6:2a: + d0:04:dd:71:3d:20:4e:58:27:fc:53:fb:78:78:19: + 14:b2:fc:90:52:89:38:62:60:07:b4:a0:ec:ac:6b: + 50:d6:fd:b9:28:6b:ef:52:2d:3a:b2:ff:f1:01:40: + ac:37 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Certificate Policies: + Policy: 1.3.6.1.4.1.6334.0.0.1.9.40.51377 + User Notice: + Explicit Text: Reliance on or use of this Certificate creates an acknowledgment and acceptance of the then applicable standard terms and conditions of use, the Certification Practice Statement and the Relying Party Agreement, which can be found at the beTRUSTed web site, http://www.betrusted.com/products_services/index.html + CPS: http://www.betrusted.com/products_services/index.html + + X509v3 Subject Key Identifier: + 45:3D:C3:A9:D1:DC:3F:24:56:98:1C:73:18:88:6A:FF:83:47:ED:B6 + X509v3 Authority Key Identifier: + keyid:45:3D:C3:A9:D1:DC:3F:24:56:98:1C:73:18:88:6A:FF:83:47:ED:B6 + + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 49:92:bc:a3:ee:ac:bd:fa:0d:c9:8b:79:86:1c:23:76:b0:80: + 59:77:fc:da:7f:b4:4b:df:c3:64:4b:6a:4e:0e:ad:f2:7d:59: + 77:05:ad:0a:89:73:b0:fa:bc:cb:dc:8d:00:88:8f:a6:a0:b2: + ea:ac:52:27:bf:a1:48:7c:97:10:7b:ba:ed:13:1d:9a:07:6e: + cb:31:62:12:e8:63:03:aa:7d:6d:e3:f8:1b:76:21:78:1b:9f: + 4b:43:8c:d3:49:86:f6:1b:5c:f6:2e:60:15:d3:e9:e3:7b:75: + 3f:d0:02:83:d0:18:82:41:cd:65:37:ea:8e:32:7e:bd:6b:99: + 5d:30:11:c8:db:48:54:1c:3b:e1:a7:13:d3:6a:48:93:f7:3d: + 8c:7f:05:e8:ce:f3:88:2a:63:04:b8:ea:7e:58:7c:01:7b:5b: + e1:c5:7d:ef:21:e0:8d:0e:5d:51:7d:b1:67:fd:a3:bd:38:36: + c6:f2:38:86:87:1a:96:68:60:46:fb:28:14:47:55:e1:a7:80: + 0c:6b:e2:ea:df:4d:7c:90:48:a0:36:bd:09:17:89:7f:c3:f2: + d3:9c:9c:e3:dd:c4:1b:dd:f5:b7:71:b3:53:05:89:06:d0:cb: + 4a:80:c1:c8:53:90:b5:3c:31:88:17:50:9f:c9:c4:0e:8b:d8: + a8:02:63:0d +-----BEGIN CERTIFICATE----- +MIIFajCCBFKgAwIBAgIEPLU9RjANBgkqhkiG9w0BAQUFADBmMRIwEAYDVQQKEwli +ZVRSVVNUZWQxGzAZBgNVBAsTEmJlVFJVU1RlZCBSb290IENBczEzMDEGA1UEAxMq +YmVUUlVTVGVkIFJvb3QgQ0EtQmFsdGltb3JlIEltcGxlbWVudGF0aW9uMB4XDTAy +MDQxMTA3Mzg1MVoXDTIyMDQxMTA3Mzg1MVowZjESMBAGA1UEChMJYmVUUlVTVGVk +MRswGQYDVQQLExJiZVRSVVNUZWQgUm9vdCBDQXMxMzAxBgNVBAMTKmJlVFJVU1Rl +ZCBSb290IENBLUJhbHRpbW9yZSBJbXBsZW1lbnRhdGlvbjCCASIwDQYJKoZIhvcN +AQEBBQADggEPADCCAQoCggEBALx+xDmcjOPWHIb/ymKt4H8wRXqOGrO4x/nRNv8i +805qX4QQ+2aBw5R5MdKR4XeOGCrDFN5R9U+jK7wYFuK13XneIviCfsuBH/0nLI/6 +l2Qijvj/YaOcGx6Sj8CoCd8JEey3fTGaGuqDIQY8n7pc/5TqarjDa1U0Tz0yH92B +FODEPM2dMPgwqZfT7syj0B9fHBOB1BirlNFjw55/NZKeX0Tq7PQiXLfoPX2k+Ymp +kbIq2eszh+6l/ePazIjmiSZuxyuC0F6dWdsU7JGDBcNeDsYq0ATdcT0gTlgn/FP7 +eHgZFLL8kFKJOGJgB7Sg7KxrUNb9uShr71ItOrL/8QFArDcCAwEAAaOCAh4wggIa +MA8GA1UdEwEB/wQFMAMBAf8wggG1BgNVHSAEggGsMIIBqDCCAaQGDysGAQQBsT4A +AAEJKIORMTCCAY8wggFIBggrBgEFBQcCAjCCAToaggE2UmVsaWFuY2Ugb24gb3Ig +dXNlIG9mIHRoaXMgQ2VydGlmaWNhdGUgY3JlYXRlcyBhbiBhY2tub3dsZWRnbWVu +dCBhbmQgYWNjZXB0YW5jZSBvZiB0aGUgdGhlbiBhcHBsaWNhYmxlIHN0YW5kYXJk +IHRlcm1zIGFuZCBjb25kaXRpb25zIG9mIHVzZSwgdGhlIENlcnRpZmljYXRpb24g +UHJhY3RpY2UgU3RhdGVtZW50IGFuZCB0aGUgUmVseWluZyBQYXJ0eSBBZ3JlZW1l +bnQsIHdoaWNoIGNhbiBiZSBmb3VuZCBhdCB0aGUgYmVUUlVTVGVkIHdlYiBzaXRl +LCBodHRwOi8vd3d3LmJldHJ1c3RlZC5jb20vcHJvZHVjdHNfc2VydmljZXMvaW5k +ZXguaHRtbDBBBggrBgEFBQcCARY1aHR0cDovL3d3dy5iZXRydXN0ZWQuY29tL3By +b2R1Y3RzX3NlcnZpY2VzL2luZGV4Lmh0bWwwHQYDVR0OBBYEFEU9w6nR3D8kVpgc +cxiIav+DR+22MB8GA1UdIwQYMBaAFEU9w6nR3D8kVpgccxiIav+DR+22MA4GA1Ud +DwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEASZK8o+6svfoNyYt5hhwjdrCA +WXf82n+0S9/DZEtqTg6t8n1ZdwWtColzsPq8y9yNAIiPpqCy6qxSJ7+hSHyXEHu6 +7RMdmgduyzFiEuhjA6p9beP4G3YheBufS0OM00mG9htc9i5gFdPp43t1P9ACg9AY +gkHNZTfqjjJ+vWuZXTARyNtIVBw74acT02pIk/c9jH8F6M7ziCpjBLjqflh8AXtb +4cV97yHgjQ5dUX2xZ/2jvTg2xvI4hocalmhgRvsoFEdV4aeADGvi6t9NfJBIoDa9 +CReJf8Py05yc493EG931t3GzUwWJBtDLSoDByFOQtTwxiBdQn8nEDovYqAJjDQ== +-----END CERTIFICATE----- + +beTRUSTed Root CA - Entrust Implementation +========================================== + +MD5 Fingerprint=7D:86:90:8F:5B:F1:F2:40:C0:F7:3D:62:B5:A4:A9:3B +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1018515264 (0x3cb54f40) + Signature Algorithm: sha1WithRSAEncryption + Issuer: O=beTRUSTed, OU=beTRUSTed Root CAs, CN=beTRUSTed Root CA - Entrust Implementation + Validity + Not Before: Apr 11 08:24:27 2002 GMT + Not After : Apr 11 08:54:27 2022 GMT + Subject: O=beTRUSTed, OU=beTRUSTed Root CAs, CN=beTRUSTed Root CA - Entrust Implementation + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:ba:f4:44:03:aa:12:6a:b5:43:ec:55:92:b6:30: + 7d:35:57:0c:db:f3:0d:27:6e:4c:f7:50:a8:9b:4e: + 2b:6f:db:f5:ad:1c:4b:5d:b3:a9:c1:fe:7b:44:eb: + 5b:a3:05:0d:1f:c5:34:2b:30:00:29:f1:78:40:b2: + a4:ff:3a:f4:01:88:17:7e:e6:d4:26:d3:ba:4c:ea: + 32:fb:43:77:97:87:23:c5:db:43:a3:f5:2a:a3:51: + 5e:e1:3b:d2:65:69:7e:55:15:9b:7a:e7:69:f7:44: + e0:57:b5:15:e8:66:60:0f:0d:03:fb:82:8e:a3:e8: + 11:7b:6c:be:c7:63:0e:17:93:df:cf:4b:ae:6e:73: + 75:e0:f3:aa:b9:a4:c0:09:1b:85:ea:71:29:88:41: + 32:f9:f0:2a:0e:6c:09:f2:74:6b:66:6c:52:13:1f: + 18:bc:d4:3e:f7:d8:6e:20:9e:ca:fe:fc:21:94:ee: + 13:28:4b:d7:5c:5e:0c:66:ee:e9:bb:0f:c1:34:b1: + 7f:08:76:f3:3d:26:70:c9:8b:25:1d:62:24:0c:ea: + 1c:75:4e:c0:12:e4:ba:13:1d:30:29:2d:56:33:05: + bb:97:59:7e:c6:49:4f:89:d7:2f:24:a8:b6:88:40: + b5:64:92:53:56:24:e4:a2:a0:85:b3:5e:90:b4:12: + 33:cd + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Certificate Policies: + Policy: 1.3.6.1.4.1.6334.0.0.2.9.40.51377 + User Notice: + Explicit Text: Reliance on or use of this Certificate creates an acknowledgment and acceptance of the then applicable standard terms and conditions of use, the Certification Practice Statement and the Relying Party Agreement, which can be found at the beTRUSTed web site, https://www.betrusted.com/products_services/index.html + CPS: https://www.betrusted.com/products_services/index.html + + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 CRL Distribution Points: + DirName:/O=beTRUSTed/OU=beTRUSTed Root CAs/CN=beTRUSTed Root CA - Entrust Implementation/CN=CRL1 + + X509v3 Private Key Usage Period: + Not Before: Apr 11 08:24:27 2002 GMT, Not After: Apr 11 08:54:27 2022 GMT + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:7D:70:E5:AE:38:8B:06:3F:AA:1C:1A:8F:F9:CF:24:30:AA:84:84:16 + + X509v3 Subject Key Identifier: + 7D:70:E5:AE:38:8B:06:3F:AA:1C:1A:8F:F9:CF:24:30:AA:84:84:16 + X509v3 Basic Constraints: + CA:TRUE + 1.2.840.113533.7.65.0: + 0...V6.0:4.0.... + Signature Algorithm: sha1WithRSAEncryption + 2a:b8:17:ce:1f:10:94:eb:b8:9a:b7:b9:5f:ec:da:f7:92:24: + ac:dc:92:3b:c7:20:8d:f2:99:e5:5d:38:a1:c2:34:ed:c5:13: + 59:5c:05:b5:2b:4f:61:9b:91:fb:41:fc:fc:d5:3c:4d:98:76: + 06:f5:81:7d:eb:dd:90:e6:d1:56:54:da:e3:2d:0c:9f:11:32: + 94:22:01:7a:f6:6c:2c:74:67:04:cc:a5:8f:8e:2c:b3:43:b5: + 94:a2:d0:7d:e9:62:7f:06:be:27:01:83:9e:3a:fd:8a:ee:98: + 43:4a:6b:d7:b5:97:3b:3a:bf:4f:6d:b4:63:fa:33:00:34:2e: + 2d:6d:96:c9:7b:ca:99:63:ba:be:f4:f6:30:a0:2d:98:96:e9: + 56:44:05:a9:44:a3:61:10:eb:82:a1:67:5d:bc:5d:27:75:aa: + 8a:28:36:2a:38:92:d9:dd:a4:5e:00:a5:cc:cc:7c:29:2a:de: + 28:90:ab:b7:e1:b6:ff:7d:25:0b:40:d8:aa:34:a3:2d:de:07: + eb:5f:ce:0a:dd:ca:7e:3a:7d:26:c1:62:68:3a:e6:2f:37:f3: + 81:86:21:c4:a9:64:aa:ef:45:36:d1:1a:66:7c:f8:e9:37:d6: + d6:61:be:a2:ad:48:e7:df:e6:74:fe:d3:6d:7d:d2:25:dc:ac: + 62:57:a9:f7 +-----BEGIN CERTIFICATE----- +MIIGUTCCBTmgAwIBAgIEPLVPQDANBgkqhkiG9w0BAQUFADBmMRIwEAYDVQQKEwli +ZVRSVVNUZWQxGzAZBgNVBAsTEmJlVFJVU1RlZCBSb290IENBczEzMDEGA1UEAxMq +YmVUUlVTVGVkIFJvb3QgQ0EgLSBFbnRydXN0IEltcGxlbWVudGF0aW9uMB4XDTAy +MDQxMTA4MjQyN1oXDTIyMDQxMTA4NTQyN1owZjESMBAGA1UEChMJYmVUUlVTVGVk +MRswGQYDVQQLExJiZVRSVVNUZWQgUm9vdCBDQXMxMzAxBgNVBAMTKmJlVFJVU1Rl +ZCBSb290IENBIC0gRW50cnVzdCBJbXBsZW1lbnRhdGlvbjCCASIwDQYJKoZIhvcN +AQEBBQADggEPADCCAQoCggEBALr0RAOqEmq1Q+xVkrYwfTVXDNvzDSduTPdQqJtO +K2/b9a0cS12zqcH+e0TrW6MFDR/FNCswACnxeECypP869AGIF37m1CbTukzqMvtD +d5eHI8XbQ6P1KqNRXuE70mVpflUVm3rnafdE4Fe1FehmYA8NA/uCjqPoEXtsvsdj +DheT389Lrm5zdeDzqrmkwAkbhepxKYhBMvnwKg5sCfJ0a2ZsUhMfGLzUPvfYbiCe +yv78IZTuEyhL11xeDGbu6bsPwTSxfwh28z0mcMmLJR1iJAzqHHVOwBLkuhMdMCkt +VjMFu5dZfsZJT4nXLySotohAtWSSU1Yk5KKghbNekLQSM80CAwEAAaOCAwUwggMB +MIIBtwYDVR0gBIIBrjCCAaowggGmBg8rBgEEAbE+AAACCSiDkTEwggGRMIIBSQYI +KwYBBQUHAgIwggE7GoIBN1JlbGlhbmNlIG9uIG9yIHVzZSBvZiB0aGlzIENlcnRp +ZmljYXRlIGNyZWF0ZXMgYW4gYWNrbm93bGVkZ21lbnQgYW5kIGFjY2VwdGFuY2Ug +b2YgdGhlIHRoZW4gYXBwbGljYWJsZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0 +aW9ucyBvZiB1c2UsIHRoZSBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVu +dCBhbmQgdGhlIFJlbHlpbmcgUGFydHkgQWdyZWVtZW50LCB3aGljaCBjYW4gYmUg +Zm91bmQgYXQgdGhlIGJlVFJVU1RlZCB3ZWIgc2l0ZSwgaHR0cHM6Ly93d3cuYmV0 +cnVzdGVkLmNvbS9wcm9kdWN0c19zZXJ2aWNlcy9pbmRleC5odG1sMEIGCCsGAQUF +BwIBFjZodHRwczovL3d3dy5iZXRydXN0ZWQuY29tL3Byb2R1Y3RzX3NlcnZpY2Vz +L2luZGV4Lmh0bWwwEQYJYIZIAYb4QgEBBAQDAgAHMIGJBgNVHR8EgYEwfzB9oHug +eaR3MHUxEjAQBgNVBAoTCWJlVFJVU1RlZDEbMBkGA1UECxMSYmVUUlVTVGVkIFJv +b3QgQ0FzMTMwMQYDVQQDEypiZVRSVVNUZWQgUm9vdCBDQSAtIEVudHJ1c3QgSW1w +bGVtZW50YXRpb24xDTALBgNVBAMTBENSTDEwKwYDVR0QBCQwIoAPMjAwMjA0MTEw +ODI0MjdagQ8yMDIyMDQxMTA4NTQyN1owCwYDVR0PBAQDAgEGMB8GA1UdIwQYMBaA +FH1w5a44iwY/qhwaj/nPJDCqhIQWMB0GA1UdDgQWBBR9cOWuOIsGP6ocGo/5zyQw +qoSEFjAMBgNVHRMEBTADAQH/MB0GCSqGSIb2fQdBAAQQMA4bCFY2LjA6NC4wAwIE +kDANBgkqhkiG9w0BAQUFAAOCAQEAKrgXzh8QlOu4mre5X+za95IkrNySO8cgjfKZ +5V04ocI07cUTWVwFtStPYZuR+0H8/NU8TZh2BvWBfevdkObRVlTa4y0MnxEylCIB +evZsLHRnBMylj44ss0O1lKLQfelifwa+JwGDnjr9iu6YQ0pr17WXOzq/T220Y/oz +ADQuLW2WyXvKmWO6vvT2MKAtmJbpVkQFqUSjYRDrgqFnXbxdJ3Wqiig2KjiS2d2k +XgClzMx8KSreKJCrt+G2/30lC0DYqjSjLd4H61/OCt3Kfjp9JsFiaDrmLzfzgYYh +xKlkqu9FNtEaZnz46TfW1mG+oq1I59/mdP7TbX3SJdysYlep9w== +-----END CERTIFICATE----- + +beTRUSTed Root CA - RSA Implementation +====================================== + +MD5 Fingerprint=86:42:05:09:BC:A7:9D:EC:1D:F3:2E:0E:BA:D8:1D:D0 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 3b:59:c7:7b:cd:5b:57:9e:bd:37:52:ac:76:b4:aa:1a + Signature Algorithm: sha1WithRSAEncryption + Issuer: O=beTRUSTed, OU=beTRUSTed Root CAs, CN=beTRUSTed Root CA - RSA Implementation + Validity + Not Before: Apr 11 11:18:13 2002 GMT + Not After : Apr 12 11:07:25 2022 GMT + Subject: O=beTRUSTed, OU=beTRUSTed Root CAs, CN=beTRUSTed Root CA - RSA Implementation + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:e4:ba:34:30:09:8e:57:d0:b9:06:2c:6f:6e:24: + 80:22:bf:5d:43:a6:fa:4f:ac:82:e7:1c:68:70:85: + 1b:a3:6e:b5:aa:78:d9:6e:07:4b:3f:e9:df:f5:ea: + e8:54:a1:61:8a:0e:2f:69:75:18:b7:0c:e5:14:8d: + 71:6e:98:b8:55:fc:0c:95:d0:9b:6e:e1:2d:88:d4: + 3a:40:6b:92:f1:99:96:64:de:db:ff:78:f4:ee:96: + 1d:47:89:7c:d4:be:b9:88:77:23:3a:09:e6:04:9e: + 6d:aa:5e:d2:c8:bd:9a:4e:19:df:89:ea:5b:0e:7e: + c3:e4:b4:f0:e0:69:3b:88:0f:41:90:f8:d4:71:43: + 24:c1:8f:26:4b:3b:56:e9:ff:8c:6c:37:e9:45:ad: + 85:8c:53:c3:60:86:90:4a:96:c9:b3:54:b0:bb:17: + f0:1c:45:d9:d4:1b:19:64:56:0a:19:f7:cc:e1:ff: + 86:af:7e:58:5e:ac:7a:90:1f:c9:28:39:45:7b:a2: + b6:c7:9c:1f:da:85:d4:21:86:59:30:93:be:53:33: + 37:f6:ef:41:cf:33:c7:ab:72:6b:25:f5:f3:53:1b: + 0c:4c:2e:f1:75:4b:ef:a0:87:f7:fe:8a:15:d0:6c: + d5:cb:f9:68:53:b9:70:15:13:c2:f5:2e:fb:43:35: + 75:2d + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:TRUE + X509v3 Certificate Policies: + Policy: 1.3.6.1.4.1.6334.0.0.3.9.40.51377 + CPS: http://www.betrusted.com/products_services/index.html + User Notice: + Explicit Text: Reliance on or use of this Certificate creates an acknowledgment and acceptance of the then applicable standard terms and conditions of use, the Certification Practice Statement and the Relying Party Agreement, which can be found at the beTRUSTed web site, http://www.betrusted.com/products_services/index.html + + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:A9:EC:14:7E:F9:D9:43:CC:53:2B:14:AD:CF:F7:F0:59:89:41:CD:19 + + X509v3 Subject Key Identifier: + A9:EC:14:7E:F9:D9:43:CC:53:2B:14:AD:CF:F7:F0:59:89:41:CD:19 + Signature Algorithm: sha1WithRSAEncryption + db:97:b0:75:ea:0c:c4:c1:98:ca:56:05:c0:a8:ad:26:48:af: + 2d:20:e8:81:c7:b6:df:43:c1:2c:1d:75:4b:d4:42:8d:e7:7a: + a8:74:dc:66:42:59:87:b3:f5:69:6d:d9:a9:9e:b3:7d:1c:31: + c1:f5:54:e2:59:24:49:e5:ee:bd:39:a6:6b:8a:98:44:fb:9b: + d7:2a:83:97:34:2d:c7:7d:35:4c:2d:34:b8:3e:0d:c4:ec:88: + 27:af:9e:92:fd:50:61:82:a8:60:07:14:53:cc:65:13:c1:f6: + 47:44:69:d2:31:c8:a6:dd:2e:b3:0b:de:4a:8d:5b:3d:ab:0d: + c2:35:52:a2:56:37:cc:32:8b:28:85:42:9c:91:40:7a:70:2b: + 38:36:d5:e1:73:1a:1f:e5:fa:7e:5f:dc:d6:9c:3b:30:ea:db: + c0:5b:27:5c:d3:73:07:c1:c2:f3:4c:9b:6f:9f:1b:ca:1e:aa: + a8:38:33:09:58:b2:ae:fc:07:e8:36:dc:55:ba:2f:4f:40:fe: + 7a:bd:06:a6:81:c1:93:22:7c:86:11:0a:06:77:48:ae:35:b7: + 2f:32:9a:61:5e:8b:be:29:9f:29:24:88:56:39:2c:a8:d2:ab: + 96:03:5a:d4:48:9f:b9:40:84:0b:98:68:fb:01:43:d6:1b:e2: + 09:b1:97:1c +-----BEGIN CERTIFICATE----- +MIIFaDCCBFCgAwIBAgIQO1nHe81bV569N1KsdrSqGjANBgkqhkiG9w0BAQUFADBi +MRIwEAYDVQQKEwliZVRSVVNUZWQxGzAZBgNVBAsTEmJlVFJVU1RlZCBSb290IENB +czEvMC0GA1UEAxMmYmVUUlVTVGVkIFJvb3QgQ0EgLSBSU0EgSW1wbGVtZW50YXRp +b24wHhcNMDIwNDExMTExODEzWhcNMjIwNDEyMTEwNzI1WjBiMRIwEAYDVQQKEwli +ZVRSVVNUZWQxGzAZBgNVBAsTEmJlVFJVU1RlZCBSb290IENBczEvMC0GA1UEAxMm +YmVUUlVTVGVkIFJvb3QgQ0EgLSBSU0EgSW1wbGVtZW50YXRpb24wggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkujQwCY5X0LkGLG9uJIAiv11DpvpPrILn +HGhwhRujbrWqeNluB0s/6d/16uhUoWGKDi9pdRi3DOUUjXFumLhV/AyV0Jtu4S2I +1DpAa5LxmZZk3tv/ePTulh1HiXzUvrmIdyM6CeYEnm2qXtLIvZpOGd+J6lsOfsPk +tPDgaTuID0GQ+NRxQyTBjyZLO1bp/4xsN+lFrYWMU8NghpBKlsmzVLC7F/AcRdnU +GxlkVgoZ98zh/4avflherHqQH8koOUV7orbHnB/ahdQhhlkwk75TMzf270HPM8er +cmsl9fNTGwxMLvF1S++gh/f+ihXQbNXL+WhTuXAVE8L1LvtDNXUtAgMBAAGjggIY +MIICFDAMBgNVHRMEBTADAQH/MIIBtQYDVR0gBIIBrDCCAagwggGkBg8rBgEEAbE+ +AAADCSiDkTEwggGPMEEGCCsGAQUFBwIBFjVodHRwOi8vd3d3LmJldHJ1c3RlZC5j +b20vcHJvZHVjdHNfc2VydmljZXMvaW5kZXguaHRtbDCCAUgGCCsGAQUFBwICMIIB +OhqCATZSZWxpYW5jZSBvbiBvciB1c2Ugb2YgdGhpcyBDZXJ0aWZpY2F0ZSBjcmVh +dGVzIGFuIGFja25vd2xlZGdtZW50IGFuZCBhY2NlcHRhbmNlIG9mIHRoZSB0aGVu +IGFwcGxpY2FibGUgc3RhbmRhcmQgdGVybXMgYW5kIGNvbmRpdGlvbnMgb2YgdXNl +LCB0aGUgQ2VydGlmaWNhdGlvbiBQcmFjdGljZSBTdGF0ZW1lbnQgYW5kIHRoZSBS +ZWx5aW5nIFBhcnR5IEFncmVlbWVudCwgd2hpY2ggY2FuIGJlIGZvdW5kIGF0IHRo +ZSBiZVRSVVNUZWQgd2ViIHNpdGUsIGh0dHA6Ly93d3cuYmV0cnVzdGVkLmNvbS9w +cm9kdWN0c19zZXJ2aWNlcy9pbmRleC5odG1sMAsGA1UdDwQEAwIBBjAfBgNVHSME +GDAWgBSp7BR++dlDzFMrFK3P9/BZiUHNGTAdBgNVHQ4EFgQUqewUfvnZQ8xTKxSt +z/fwWYlBzRkwDQYJKoZIhvcNAQEFBQADggEBANuXsHXqDMTBmMpWBcCorSZIry0g +6IHHtt9DwSwddUvUQo3neqh03GZCWYez9Wlt2ames30cMcH1VOJZJEnl7r05pmuK +mET7m9cqg5c0Lcd9NUwtNLg+DcTsiCevnpL9UGGCqGAHFFPMZRPB9kdEadIxyKbd +LrML3kqNWz2rDcI1UqJWN8wyiyiFQpyRQHpwKzg21eFzGh/l+n5f3NacOzDq28Bb +J1zTcwfBwvNMm2+fG8oeqqg4MwlYsq78B+g23FW6L09A/nq9BqaBwZMifIYRCgZ3 +SK41ty8ymmFei74pnykkiFY5LKjSq5YDWtRIn7lAhAuYaPsBQ9Yb4gmxlxw= +-----END CERTIFICATE----- + +RSA Security 2048 v3 +==================== + +MD5 Fingerprint=77:0D:19:B1:21:FD:00:42:9C:3E:0C:A5:DD:0B:02:8E +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 0a:01:01:01:00:00:02:7c:00:00:00:0a:00:00:00:02 + Signature Algorithm: sha1WithRSAEncryption + Issuer: O=RSA Security Inc, OU=RSA Security 2048 V3 + Validity + Not Before: Feb 22 20:39:23 2001 GMT + Not After : Feb 22 20:39:23 2026 GMT + Subject: O=RSA Security Inc, OU=RSA Security 2048 V3 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b7:8f:55:71:d2:80:dd:7b:69:79:a7:f0:18:50: + 32:3c:62:67:f6:0a:95:07:dd:e6:1b:f3:9e:d9:d2: + 41:54:6b:ad:9f:7c:be:19:cd:fb:46:ab:41:68:1e: + 18:ea:55:c8:2f:91:78:89:28:fb:27:29:60:ff:df: + 8f:8c:3b:c9:49:9b:b5:a4:94:ce:01:ea:3e:b5:63: + 7b:7f:26:fd:19:dd:c0:21:bd:84:d1:2d:4f:46:c3: + 4e:dc:d8:37:39:3b:28:af:cb:9d:1a:ea:2b:af:21: + a5:c1:23:22:b8:b8:1b:5a:13:87:57:83:d1:f0:20: + e7:e8:4f:23:42:b0:00:a5:7d:89:e9:e9:61:73:94: + 98:71:26:bc:2d:6a:e0:f7:4d:f0:f1:b6:2a:38:31: + 81:0d:29:e1:00:c1:51:0f:4c:52:f8:04:5a:aa:7d: + 72:d3:b8:87:2a:bb:63:10:03:2a:b3:a1:4f:0d:5a: + 5e:46:b7:3d:0e:f5:74:ec:99:9f:f9:3d:24:81:88: + a6:dd:60:54:e8:95:36:3d:c6:09:93:9a:a3:12:80: + 00:55:99:19:47:bd:d0:a5:7c:c3:ba:fb:1f:f7:f5: + 0f:f8:ac:b9:b5:f4:37:98:13:18:de:85:5b:b7:0c: + 82:3b:87:6f:95:39:58:30:da:6e:01:68:17:22:cc: + c0:0b + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:07:C3:51:30:A4:AA:E9:45:AE:35:24:FA:FF:24:2C:33:D0:B1:9D:8C + + X509v3 Subject Key Identifier: + 07:C3:51:30:A4:AA:E9:45:AE:35:24:FA:FF:24:2C:33:D0:B1:9D:8C + Signature Algorithm: sha1WithRSAEncryption + 5f:3e:86:76:6e:b8:35:3c:4e:36:1c:1e:79:98:bf:fd:d5:12: + 11:79:52:0e:ee:31:89:bc:dd:7f:f9:d1:c6:15:21:e8:8a:01: + 54:0d:3a:fb:54:b9:d6:63:d4:b1:aa:96:4d:a2:42:4d:d4:53: + 1f:8b:10:de:7f:65:be:60:13:27:71:88:a4:73:e3:84:63:d1: + a4:55:e1:50:93:e6:1b:0e:79:d0:67:bc:46:c8:bf:3f:17:0d: + 95:e6:c6:90:69:de:e7:b4:2f:de:95:7d:d0:12:3f:3d:3e:7f: + 4d:3f:14:68:f5:11:50:d5:c1:f4:90:a5:08:1d:31:60:ff:60: + 8c:23:54:0a:af:fe:a1:6e:c5:d1:7a:2a:68:78:cf:1e:82:0a: + 20:b4:1f:ad:e5:85:b2:6a:68:75:4e:ad:25:37:94:85:be:bd: + a1:d4:ea:b7:0c:4b:3c:9d:e8:12:00:f0:5f:ac:0d:e1:ac:70: + 63:73:f7:7f:79:9f:32:25:42:74:05:80:28:bf:bd:c1:24:96: + 58:15:b1:17:21:e9:89:4b:db:07:88:67:f4:15:ad:70:3e:2f: + 4d:85:3b:c2:b7:db:fe:98:68:23:89:e1:74:0f:de:f4:c5:84: + 63:29:1b:cc:cb:07:c9:00:a4:a9:d7:c2:22:4f:67:d7:77:ec: + 20:05:61:de +-----BEGIN CERTIFICATE----- +MIIDYTCCAkmgAwIBAgIQCgEBAQAAAnwAAAAKAAAAAjANBgkqhkiG9w0BAQUFADA6 +MRkwFwYDVQQKExBSU0EgU2VjdXJpdHkgSW5jMR0wGwYDVQQLExRSU0EgU2VjdXJp +dHkgMjA0OCBWMzAeFw0wMTAyMjIyMDM5MjNaFw0yNjAyMjIyMDM5MjNaMDoxGTAX +BgNVBAoTEFJTQSBTZWN1cml0eSBJbmMxHTAbBgNVBAsTFFJTQSBTZWN1cml0eSAy +MDQ4IFYzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAt49VcdKA3Xtp +eafwGFAyPGJn9gqVB93mG/Oe2dJBVGutn3y+Gc37RqtBaB4Y6lXIL5F4iSj7Jylg +/9+PjDvJSZu1pJTOAeo+tWN7fyb9Gd3AIb2E0S1PRsNO3Ng3OTsor8udGuorryGl +wSMiuLgbWhOHV4PR8CDn6E8jQrAApX2J6elhc5SYcSa8LWrg903w8bYqODGBDSnh +AMFRD0xS+ARaqn1y07iHKrtjEAMqs6FPDVpeRrc9DvV07Jmf+T0kgYim3WBU6JU2 +PcYJk5qjEoAAVZkZR73QpXzDuvsf9/UP+Ky5tfQ3mBMY3oVbtwyCO4dvlTlYMNpu +AWgXIszACwIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB +BjAfBgNVHSMEGDAWgBQHw1EwpKrpRa41JPr/JCwz0LGdjDAdBgNVHQ4EFgQUB8NR +MKSq6UWuNST6/yQsM9CxnYwwDQYJKoZIhvcNAQEFBQADggEBAF8+hnZuuDU8TjYc +HnmYv/3VEhF5Ug7uMYm83X/50cYVIeiKAVQNOvtUudZj1LGqlk2iQk3UUx+LEN5/ +Zb5gEydxiKRz44Rj0aRV4VCT5hsOedBnvEbIvz8XDZXmxpBp3ue0L96VfdASPz0+ +f00/FGj1EVDVwfSQpQgdMWD/YIwjVAqv/qFuxdF6Kmh4zx6CCiC0H63lhbJqaHVO +rSU3lIW+vaHU6rcMSzyd6BIA8F+sDeGscGNz9395nzIlQnQFgCi/vcEkllgVsRch +6YlL2weIZ/QVrXA+L02FO8K32/6YaCOJ4XQP3vTFhGMpG8zLB8kApKnXwiJPZ9d3 +7CAFYd4= +-----END CERTIFICATE----- + +RSA Security 1024 v3 +==================== + +MD5 Fingerprint=3A:E5:50:B0:39:BE:C7:46:36:33:A1:FE:82:3E:8D:94 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 0a:01:01:01:00:00:02:7c:00:00:00:0b:00:00:00:02 + Signature Algorithm: sha1WithRSAEncryption + Issuer: O=RSA Security Inc, OU=RSA Security 1024 V3 + Validity + Not Before: Feb 22 21:01:49 2001 GMT + Not After : Feb 22 20:01:49 2026 GMT + Subject: O=RSA Security Inc, OU=RSA Security 1024 V3 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:d5:dd:fe:66:09:cf:24:3c:3e:ae:81:4e:4e:8a: + c4:69:80:5b:59:3b:df:b9:4d:4c:ca:b5:2d:c3:27: + 2d:3c:af:00:42:6d:bc:28:a6:96:cf:7f:d7:58:ac: + 83:0a:a3:55:b5:7b:17:90:15:84:4c:8a:ee:26:99: + dc:58:ef:c7:38:a6:aa:af:d0:8e:42:c8:62:d7:ab: + ac:a9:fb:4a:7d:bf:ea:fe:12:4d:dd:ff:26:2d:6f: + 36:54:68:c8:d2:84:56:ee:92:53:61:09:b3:3f:39: + 9b:a8:c9:9b:bd:ce:9f:7e:d4:19:6a:16:29:18:be: + d7:3a:69:dc:25:5b:33:1a:51 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:C4:C0:1C:A4:07:94:FD:CD:4D:01:D4:54:DA:A5:0C:5F:DE:AE:05:5A + + X509v3 Subject Key Identifier: + C4:C0:1C:A4:07:94:FD:CD:4D:01:D4:54:DA:A5:0C:5F:DE:AE:05:5A + Signature Algorithm: sha1WithRSAEncryption + 3f:2d:6a:e3:26:43:95:7d:89:97:65:fb:75:e4:72:1d:46:57: + c4:61:6b:69:9f:12:9b:2c:d5:5a:e8:c0:a2:f0:43:95:e3:1f: + e9:76:cd:dc:eb:bc:93:a0:65:0a:c7:4d:4f:5f:a7:af:a2:46: + 14:b9:0c:f3:cc:bd:6a:6e:b7:9d:de:25:42:d0:54:ff:9e:68: + 73:63:dc:24:eb:22:bf:a8:72:f2:5e:00:e1:0d:4e:3a:43:6e: + 99:4e:3f:89:78:03:98:ca:f3:55:cc:9d:ae:8e:c1:aa:45:98: + fa:8f:1a:a0:8d:88:23:f1:15:41:0d:a5:46:3e:91:3f:8b:eb: + f7:71 +-----BEGIN CERTIFICATE----- +MIICXDCCAcWgAwIBAgIQCgEBAQAAAnwAAAALAAAAAjANBgkqhkiG9w0BAQUFADA6 +MRkwFwYDVQQKExBSU0EgU2VjdXJpdHkgSW5jMR0wGwYDVQQLExRSU0EgU2VjdXJp +dHkgMTAyNCBWMzAeFw0wMTAyMjIyMTAxNDlaFw0yNjAyMjIyMDAxNDlaMDoxGTAX +BgNVBAoTEFJTQSBTZWN1cml0eSBJbmMxHTAbBgNVBAsTFFJTQSBTZWN1cml0eSAx +MDI0IFYzMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDV3f5mCc8kPD6ugU5O +isRpgFtZO9+5TUzKtS3DJy08rwBCbbwoppbPf9dYrIMKo1W1exeQFYRMiu4mmdxY +78c4pqqv0I5CyGLXq6yp+0p9v+r+Ek3d/yYtbzZUaMjShFbuklNhCbM/OZuoyZu9 +zp9+1BlqFikYvtc6adwlWzMaUQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4G +A1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBTEwBykB5T9zU0B1FTapQxf3q4FWjAd +BgNVHQ4EFgQUxMAcpAeU/c1NAdRU2qUMX96uBVowDQYJKoZIhvcNAQEFBQADgYEA +Py1q4yZDlX2Jl2X7deRyHUZXxGFraZ8SmyzVWujAovBDleMf6XbN3Ou8k6BlCsdN +T1+nr6JGFLkM88y9am63nd4lQtBU/55oc2PcJOsiv6hy8l4A4Q1OOkNumU4/iXgD +mMrzVcydro7BqkWY+o8aoI2II/EVQQ2lRj6RP4vr93E= +-----END CERTIFICATE----- + +GeoTrust Global CA +================== + +MD5 Fingerprint=F7:75:AB:29:FB:51:4E:B7:77:5E:FF:05:3C:99:8E:F5 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 144470 (0x23456) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=GeoTrust Inc., CN=GeoTrust Global CA + Validity + Not Before: May 21 04:00:00 2002 GMT + Not After : May 21 04:00:00 2022 GMT + Subject: C=US, O=GeoTrust Inc., CN=GeoTrust Global CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:da:cc:18:63:30:fd:f4:17:23:1a:56:7e:5b:df: + 3c:6c:38:e4:71:b7:78:91:d4:bc:a1:d8:4c:f8:a8: + 43:b6:03:e9:4d:21:07:08:88:da:58:2f:66:39:29: + bd:05:78:8b:9d:38:e8:05:b7:6a:7e:71:a4:e6:c4: + 60:a6:b0:ef:80:e4:89:28:0f:9e:25:d6:ed:83:f3: + ad:a6:91:c7:98:c9:42:18:35:14:9d:ad:98:46:92: + 2e:4f:ca:f1:87:43:c1:16:95:57:2d:50:ef:89:2d: + 80:7a:57:ad:f2:ee:5f:6b:d2:00:8d:b9:14:f8:14: + 15:35:d9:c0:46:a3:7b:72:c8:91:bf:c9:55:2b:cd: + d0:97:3e:9c:26:64:cc:df:ce:83:19:71:ca:4e:e6: + d4:d5:7b:a9:19:cd:55:de:c8:ec:d2:5e:38:53:e5: + 5c:4f:8c:2d:fe:50:23:36:fc:66:e6:cb:8e:a4:39: + 19:00:b7:95:02:39:91:0b:0e:fe:38:2e:d1:1d:05: + 9a:f6:4d:3e:6f:0f:07:1d:af:2c:1e:8f:60:39:e2: + fa:36:53:13:39:d4:5e:26:2b:db:3d:a8:14:bd:32: + eb:18:03:28:52:04:71:e5:ab:33:3d:e1:38:bb:07: + 36:84:62:9c:79:ea:16:30:f4:5f:c0:2b:e8:71:6b: + e4:f9 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + C0:7A:98:68:8D:89:FB:AB:05:64:0C:11:7D:AA:7D:65:B8:CA:CC:4E + X509v3 Authority Key Identifier: + keyid:C0:7A:98:68:8D:89:FB:AB:05:64:0C:11:7D:AA:7D:65:B8:CA:CC:4E + + Signature Algorithm: sha1WithRSAEncryption + 35:e3:29:6a:e5:2f:5d:54:8e:29:50:94:9f:99:1a:14:e4:8f: + 78:2a:62:94:a2:27:67:9e:d0:cf:1a:5e:47:e9:c1:b2:a4:cf: + dd:41:1a:05:4e:9b:4b:ee:4a:6f:55:52:b3:24:a1:37:0a:eb: + 64:76:2a:2e:2c:f3:fd:3b:75:90:bf:fa:71:d8:c7:3d:37:d2: + b5:05:95:62:b9:a6:de:89:3d:36:7b:38:77:48:97:ac:a6:20: + 8f:2e:a6:c9:0c:c2:b2:99:45:00:c7:ce:11:51:22:22:e0:a5: + ea:b6:15:48:09:64:ea:5e:4f:74:f7:05:3e:c7:8a:52:0c:db: + 15:b4:bd:6d:9b:e5:c6:b1:54:68:a9:e3:69:90:b6:9a:a5:0f: + b8:b9:3f:20:7d:ae:4a:b5:b8:9c:e4:1d:b6:ab:e6:94:a5:c1: + c7:83:ad:db:f5:27:87:0e:04:6c:d5:ff:dd:a0:5d:ed:87:52: + b7:2b:15:02:ae:39:a6:6a:74:e9:da:c4:e7:bc:4d:34:1e:a9: + 5c:4d:33:5f:92:09:2f:88:66:5d:77:97:c7:1d:76:13:a9:d5: + e5:f1:16:09:11:35:d5:ac:db:24:71:70:2c:98:56:0b:d9:17: + b4:d1:e3:51:2b:5e:75:e8:d5:d0:dc:4f:34:ed:c2:05:66:80: + a1:cb:e6:33 +-----BEGIN CERTIFICATE----- +MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT +MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i +YWwgQ0EwHhcNMDIwNTIxMDQwMDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQG +EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UEAxMSR2VvVHJ1c3Qg +R2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2swYYzD9 +9BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjoBbdq +fnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDv +iS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU +1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+ +bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5aszPeE4uwc2hGKceeoW +MPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTA +ephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVkDBF9qn1l +uMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKIn +Z57QzxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfS +tQWVYrmm3ok9Nns4d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcF +PseKUgzbFbS9bZvlxrFUaKnjaZC2mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Un +hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV +5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw== +-----END CERTIFICATE----- + +GeoTrust Global CA 2 +==================== + +MD5 Fingerprint=0E:40:A7:6C:DE:03:5D:8F:D1:0F:E4:D1:8D:F9:6C:A9 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=GeoTrust Inc., CN=GeoTrust Global CA 2 + Validity + Not Before: Mar 4 05:00:00 2004 GMT + Not After : Mar 4 05:00:00 2019 GMT + Subject: C=US, O=GeoTrust Inc., CN=GeoTrust Global CA 2 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:ef:3c:4d:40:3d:10:df:3b:53:00:e1:67:fe:94: + 60:15:3e:85:88:f1:89:0d:90:c8:28:23:99:05:e8: + 2b:20:9d:c6:f3:60:46:d8:c1:b2:d5:8c:31:d9:dc: + 20:79:24:81:bf:35:32:fc:63:69:db:b1:2a:6b:ee: + 21:58:f2:08:e9:78:cb:6f:cb:fc:16:52:c8:91:c4: + ff:3d:73:de:b1:3e:a7:c2:7d:66:c1:f5:7e:52:24: + 1a:e2:d5:67:91:d0:82:10:d7:78:4b:4f:2b:42:39: + bd:64:2d:40:a0:b0:10:d3:38:48:46:88:a1:0c:bb: + 3a:33:2a:62:98:fb:00:9d:13:59:7f:6f:3b:72:aa: + ee:a6:0f:86:f9:05:61:ea:67:7f:0c:37:96:8b:e6: + 69:16:47:11:c2:27:59:03:b3:a6:60:c2:21:40:56: + fa:a0:c7:7d:3a:13:e3:ec:57:c7:b3:d6:ae:9d:89: + 80:f7:01:e7:2c:f6:96:2b:13:0d:79:2c:d9:c0:e4: + 86:7b:4b:8c:0c:72:82:8a:fb:17:cd:00:6c:3a:13: + 3c:b0:84:87:4b:16:7a:29:b2:4f:db:1d:d4:0b:f3: + 66:37:bd:d8:f6:57:bb:5e:24:7a:b8:3c:8b:b9:fa: + 92:1a:1a:84:9e:d8:74:8f:aa:1b:7f:5e:f4:fe:45: + 22:21 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 71:38:36:F2:02:31:53:47:2B:6E:BA:65:46:A9:10:15:58:20:05:09 + X509v3 Authority Key Identifier: + keyid:71:38:36:F2:02:31:53:47:2B:6E:BA:65:46:A9:10:15:58:20:05:09 + + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 03:f7:b5:2b:ab:5d:10:fc:7b:b2:b2:5e:ac:9b:0e:7e:53:78: + 59:3e:42:04:fe:75:a3:ad:ac:81:4e:d7:02:8b:5e:c4:2d:c8: + 52:76:c7:2c:1f:fc:81:32:98:d1:4b:c6:92:93:33:35:31:2f: + fc:d8:1d:44:dd:e0:81:7f:9d:e9:8b:e1:64:91:62:0b:39:08: + 8c:ac:74:9d:59:d9:7a:59:52:97:11:b9:16:7b:6f:45:d3:96: + d9:31:7d:02:36:0f:9c:3b:6e:cf:2c:0d:03:46:45:eb:a0:f4: + 7f:48:44:c6:08:40:cc:de:1b:70:b5:29:ad:ba:8b:3b:34:65: + 75:1b:71:21:1d:2c:14:0a:b0:96:95:b8:d6:ea:f2:65:fb:29: + ba:4f:ea:91:93:74:69:b6:f2:ff:e1:1a:d0:0c:d1:76:85:cb: + 8a:25:bd:97:5e:2c:6f:15:99:26:e7:b6:29:ff:22:ec:c9:02: + c7:56:00:cd:49:b9:b3:6c:7b:53:04:1a:e2:a8:c9:aa:12:05: + 23:c2:ce:e7:bb:04:02:cc:c0:47:a2:e4:c4:29:2f:5b:45:57: + 89:51:ee:3c:eb:52:08:ff:07:35:1e:9f:35:6a:47:4a:56:98: + d1:5a:85:1f:8c:f5:22:bf:ab:ce:83:f3:e2:22:29:ae:7d:83: + 40:a8:ba:6c +-----BEGIN CERTIFICATE----- +MIIDZjCCAk6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJVUzEW +MBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEdMBsGA1UEAxMUR2VvVHJ1c3QgR2xvYmFs +IENBIDIwHhcNMDQwMzA0MDUwMDAwWhcNMTkwMzA0MDUwMDAwWjBEMQswCQYDVQQG +EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEdMBsGA1UEAxMUR2VvVHJ1c3Qg +R2xvYmFsIENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDvPE1A +PRDfO1MA4Wf+lGAVPoWI8YkNkMgoI5kF6CsgncbzYEbYwbLVjDHZ3CB5JIG/NTL8 +Y2nbsSpr7iFY8gjpeMtvy/wWUsiRxP89c96xPqfCfWbB9X5SJBri1WeR0IIQ13hL +TytCOb1kLUCgsBDTOEhGiKEMuzozKmKY+wCdE1l/bztyqu6mD4b5BWHqZ38MN5aL +5mkWRxHCJ1kDs6ZgwiFAVvqgx306E+PsV8ez1q6diYD3Aecs9pYrEw15LNnA5IZ7 +S4wMcoKK+xfNAGw6EzywhIdLFnopsk/bHdQL82Y3vdj2V7teJHq4PIu5+pIaGoSe +2HSPqht/XvT+RSIhAgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE +FHE4NvICMVNHK266ZUapEBVYIAUJMB8GA1UdIwQYMBaAFHE4NvICMVNHK266ZUap +EBVYIAUJMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQUFAAOCAQEAA/e1K6td +EPx7srJerJsOflN4WT5CBP51o62sgU7XAotexC3IUnbHLB/8gTKY0UvGkpMzNTEv +/NgdRN3ggX+d6YvhZJFiCzkIjKx0nVnZellSlxG5FntvRdOW2TF9AjYPnDtuzywN +A0ZF66D0f0hExghAzN4bcLUprbqLOzRldRtxIR0sFAqwlpW41uryZfspuk/qkZN0 +abby/+Ea0AzRdoXLiiW9l14sbxWZJue2Kf8i7MkCx1YAzUm5s2x7UwQa4qjJqhIF +I8LO57sEAszAR6LkxCkvW0VXiVHuPOtSCP8HNR6fNWpHSlaY0VqFH4z1Ir+rzoPz +4iIprn2DQKi6bA== +-----END CERTIFICATE----- + +GeoTrust Universal CA +===================== + +MD5 Fingerprint=92:65:58:8B:A2:1A:31:72:73:68:5C:B4:A5:7A:07:48 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=GeoTrust Inc., CN=GeoTrust Universal CA + Validity + Not Before: Mar 4 05:00:00 2004 GMT + Not After : Mar 4 05:00:00 2029 GMT + Subject: C=US, O=GeoTrust Inc., CN=GeoTrust Universal CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (4096 bit) + Modulus (4096 bit): + 00:a6:15:55:a0:a3:c6:e0:1f:8c:9d:21:50:d7:c1: + be:2b:5b:b5:a4:9e:a1:d9:72:58:bd:00:1b:4c:bf: + 61:c9:14:1d:45:82:ab:c6:1d:80:d6:3d:eb:10:9c: + 3a:af:6d:24:f8:bc:71:01:9e:06:f5:7c:5f:1e:c1: + 0e:55:ca:83:9a:59:30:ae:19:cb:30:48:95:ed:22: + 37:8d:f4:4a:9a:72:66:3e:ad:95:c0:e0:16:00:e0: + 10:1f:2b:31:0e:d7:94:54:d3:42:33:a0:34:1d:1e: + 45:76:dd:4f:ca:18:37:ec:85:15:7a:19:08:fc:d5: + c7:9c:f0:f2:a9:2e:10:a9:92:e6:3d:58:3d:a9:16: + 68:3c:2f:75:21:18:7f:28:77:a5:e1:61:17:b7:a6: + e9:f8:1e:99:db:73:6e:f4:0a:a2:21:6c:ee:da:aa: + 85:92:66:af:f6:7a:6b:82:da:ba:22:08:35:0f:cf: + 42:f1:35:fa:6a:ee:7e:2b:25:cc:3a:11:e4:6d:af: + 73:b2:76:1d:ad:d0:b2:78:67:1a:a4:39:1c:51:0b: + 67:56:83:fd:38:5d:0d:ce:dd:f0:bb:2b:96:1f:de: + 7b:32:52:fd:1d:bb:b5:06:a1:b2:21:5e:a5:d6:95: + 68:7f:f0:99:9e:dc:45:08:3e:e7:d2:09:0d:35:94: + dd:80:4e:53:97:d7:b5:09:44:20:64:16:17:03:02: + 4c:53:0d:68:de:d5:aa:72:4d:93:6d:82:0e:db:9c: + bd:cf:b4:f3:5c:5d:54:7a:69:09:96:d6:db:11:c1: + 8d:75:a8:b4:cf:39:c8:ce:3c:bc:24:7c:e6:62:ca: + e1:bd:7d:a7:bd:57:65:0b:e4:fe:25:ed:b6:69:10: + dc:28:1a:46:bd:01:1d:d0:97:b5:e1:98:3b:c0:37: + 64:d6:3d:94:ee:0b:e1:f5:28:ae:0b:56:bf:71:8b: + 23:29:41:8e:86:c5:4b:52:7b:d8:71:ab:1f:8a:15: + a6:3b:83:5a:d7:58:01:51:c6:4c:41:d9:7f:d8:41: + 67:72:a2:28:df:60:83:a9:9e:c8:7b:fc:53:73:72: + 59:f5:93:7a:17:76:0e:ce:f7:e5:5c:d9:0b:55:34: + a2:aa:5b:b5:6a:54:e7:13:ca:57:ec:97:6d:f4:5e: + 06:2f:45:8b:58:d4:23:16:92:e4:16:6e:28:63:59: + 30:df:50:01:9c:63:89:1a:9f:db:17:94:82:70:37: + c3:24:9e:9a:47:d6:5a:ca:4e:a8:69:89:72:1f:91: + 6c:db:7e:9e:1b:ad:c7:1f:73:dd:2c:4f:19:65:fd: + 7f:93:40:10:2e:d2:f0:ed:3c:9e:2e:28:3e:69:26: + 33:c5:7b + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + DA:BB:2E:AA:B0:0C:B8:88:26:51:74:5C:6D:03:D3:C0:D8:8F:7A:D6 + X509v3 Authority Key Identifier: + keyid:DA:BB:2E:AA:B0:0C:B8:88:26:51:74:5C:6D:03:D3:C0:D8:8F:7A:D6 + + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 31:78:e6:c7:b5:df:b8:94:40:c9:71:c4:a8:35:ec:46:1d:c2: + 85:f3:28:58:86:b0:0b:fc:8e:b2:39:8f:44:55:ab:64:84:5c: + 69:a9:d0:9a:38:3c:fa:e5:1f:35:e5:44:e3:80:79:94:68:a4: + bb:c4:9f:3d:e1:34:cd:30:46:8b:54:2b:95:a5:ef:f7:3f:99: + 84:fd:35:e6:cf:31:c6:dc:6a:bf:a7:d7:23:08:e1:98:5e:c3: + 5a:08:76:a9:a6:af:77:2f:b7:60:bd:44:46:6a:ef:97:ff:73: + 95:c1:8e:e8:93:fb:fd:31:b7:ec:57:11:11:45:9b:30:f1:1a: + 88:39:c1:4f:3c:a7:00:d5:c7:fc:ab:6d:80:22:70:a5:0c:e0: + 5d:04:29:02:fb:cb:a0:91:d1:7c:d6:c3:7e:50:d5:9d:58:be: + 41:38:eb:b9:75:3c:15:d9:9b:c9:4a:83:59:c0:da:53:fd:33: + bb:36:18:9b:85:0f:15:dd:ee:2d:ac:76:93:b9:d9:01:8d:48: + 10:a8:fb:f5:38:86:f1:db:0a:c6:bd:84:a3:23:41:de:d6:77: + 6f:85:d4:85:1c:50:e0:ae:51:8a:ba:8d:3e:76:e2:b9:ca:27: + f2:5f:9f:ef:6e:59:0d:06:d8:2b:17:a4:d2:7c:6b:bb:5f:14: + 1a:48:8f:1a:4c:e7:b3:47:1c:8e:4c:45:2b:20:ee:48:df:e7: + dd:09:8e:18:a8:da:40:8d:92:26:11:53:61:73:5d:eb:bd:e7: + c4:4d:29:37:61:eb:ac:39:2d:67:2e:16:d6:f5:00:83:85:a1: + cc:7f:76:c4:7d:e4:b7:4b:66:ef:03:45:60:69:b6:0c:52:96: + 92:84:5e:a6:a3:b5:a4:3e:2b:d9:cc:d8:1b:47:aa:f2:44:da: + 4f:f9:03:e8:f0:14:cb:3f:f3:83:de:d0:c1:54:e3:b7:e8:0a: + 37:4d:8b:20:59:03:30:19:a1:2c:c8:bd:11:1f:df:ae:c9:4a: + c5:f3:27:66:66:86:ac:68:91:ff:d9:e6:53:1c:0f:8b:5c:69: + 65:0a:26:c8:1e:34:c3:5d:51:7b:d7:a9:9c:06:a1:36:dd:d5: + 89:94:bc:d9:e4:2d:0c:5e:09:6c:08:97:7c:a3:3d:7c:93:ff: + 3f:a1:14:a7:cf:b5:5d:eb:db:db:1c:c4:76:df:88:b9:bd:45: + 05:95:1b:ae:fc:46:6a:4c:af:48:e3:ce:ae:0f:d2:7e:eb:e6: + 6c:9c:4f:81:6a:7a:64:ac:bb:3e:d5:e7:cb:76:2e:c5:a7:48: + c1:5c:90:0f:cb:c8:3f:fa:e6:32:e1:8d:1b:6f:a4:e6:8e:d8: + f9:29:48:8a:ce:73:fe:2c +-----BEGIN CERTIFICATE----- +MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEW +MBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVy +c2FsIENBMB4XDTA0MDMwNDA1MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UE +BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xHjAcBgNVBAMTFUdlb1RydXN0 +IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKYV +VaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9tJPi8 +cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTT +QjOgNB0eRXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFh +F7em6fgemdtzbvQKoiFs7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2v +c7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d8Lsrlh/eezJS/R27tQahsiFepdaVaH/w +mZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7VqnJNk22CDtucvc+081xd +VHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3CgaRr0BHdCX +teGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZ +f9hBZ3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfRe +Bi9Fi1jUIxaS5BZuKGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+ +nhutxx9z3SxPGWX9f5NAEC7S8O08ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB +/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0XG0D08DYj3rWMB8GA1UdIwQY +MBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG +9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc +aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fX +IwjhmF7DWgh2qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzyn +ANXH/KttgCJwpQzgXQQpAvvLoJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0z +uzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsKxr2EoyNB3tZ3b4XUhRxQ4K5RirqN +Pnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxFKyDuSN/n3QmOGKja +QI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2DFKW +koRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9 +ER/frslKxfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQt +DF4JbAiXfKM9fJP/P6EUp8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/Sfuvm +bJxPgWp6ZKy7PtXny3YuxadIwVyQD8vIP/rmMuGNG2+k5o7Y+SlIis5z/iw= +-----END CERTIFICATE----- + +GeoTrust Universal CA 2 +======================= + +MD5 Fingerprint=34:FC:B8:D0:36:DB:9E:14:B3:C2:F2:DB:8F:E4:94:C7 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=GeoTrust Inc., CN=GeoTrust Universal CA 2 + Validity + Not Before: Mar 4 05:00:00 2004 GMT + Not After : Mar 4 05:00:00 2029 GMT + Subject: C=US, O=GeoTrust Inc., CN=GeoTrust Universal CA 2 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (4096 bit) + Modulus (4096 bit): + 00:b3:54:52:c1:c9:3e:f2:d9:dc:b1:53:1a:59:29: + e7:b1:c3:45:28:e5:d7:d1:ed:c5:c5:4b:a1:aa:74: + 7b:57:af:4a:26:fc:d8:f5:5e:a7:6e:19:db:74:0c: + 4f:35:5b:32:0b:01:e3:db:eb:7a:77:35:ea:aa:5a: + e0:d6:e8:a1:57:94:f0:90:a3:74:56:94:44:30:03: + 1e:5c:4e:2b:85:26:74:82:7a:0c:76:a0:6f:4d:ce: + 41:2d:a0:15:06:14:5f:b7:42:cd:7b:8f:58:61:34: + dc:2a:08:f9:2e:c3:01:a6:22:44:1c:4c:07:82:e6: + 5b:ce:d0:4a:7c:04:d3:19:73:27:f0:aa:98:7f:2e: + af:4e:eb:87:1e:24:77:6a:5d:b6:e8:5b:45:ba:dc: + c3:a1:05:6f:56:8e:8f:10:26:a5:49:c3:2e:d7:41: + 87:22:e0:4f:86:ca:60:b5:ea:a1:63:c0:01:97:10: + 79:bd:00:3c:12:6d:2b:15:b1:ac:4b:b1:ee:18:b9: + 4e:96:dc:dc:76:ff:3b:be:cf:5f:03:c0:fc:3b:e8: + be:46:1b:ff:da:40:c2:52:f7:fe:e3:3a:f7:6a:77: + 35:d0:da:8d:eb:5e:18:6a:31:c7:1e:ba:3c:1b:28: + d6:6b:54:c6:aa:5b:d7:a2:2c:1b:19:cc:a2:02:f6: + 9b:59:bd:37:6b:86:b5:6d:82:ba:d8:ea:c9:56:bc: + a9:36:58:fd:3e:19:f3:ed:0c:26:a9:93:38:f8:4f: + c1:5d:22:06:d0:97:ea:e1:ad:c6:55:e0:81:2b:28: + 83:3a:fa:f4:7b:21:51:00:be:52:38:ce:cd:66:79: + a8:f4:81:56:e2:d0:83:09:47:51:5b:50:6a:cf:db: + 48:1a:5d:3e:f7:cb:f6:65:f7:6c:f1:95:f8:02:3b: + 32:56:82:39:7a:5b:bd:2f:89:1b:bf:a1:b4:e8:ff: + 7f:8d:8c:df:03:f1:60:4e:58:11:4c:eb:a3:3f:10: + 2b:83:9a:01:73:d9:94:6d:84:00:27:66:ac:f0:70: + 40:09:42:92:ad:4f:93:0d:61:09:51:24:d8:92:d5: + 0b:94:61:b2:87:b2:ed:ff:9a:35:ff:85:54:ca:ed: + 44:43:ac:1b:3c:16:6b:48:4a:0a:1c:40:88:1f:92: + c2:0b:00:05:ff:f2:c8:02:4a:a4:aa:a9:cc:99:96: + 9c:2f:58:e0:7d:e1:be:bb:07:dc:5f:04:72:5c:31: + 34:c3:ec:5f:2d:e0:3d:64:90:22:e6:d1:ec:b8:2e: + dd:59:ae:d9:a1:37:bf:54:35:dc:73:32:4f:8c:04: + 1e:33:b2:c9:46:f1:d8:5c:c8:55:50:c9:68:bd:a8: + ba:36:09 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 76:F3:55:E1:FA:A4:36:FB:F0:9F:5C:62:71:ED:3C:F4:47:38:10:2B + X509v3 Authority Key Identifier: + keyid:76:F3:55:E1:FA:A4:36:FB:F0:9F:5C:62:71:ED:3C:F4:47:38:10:2B + + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 66:c1:c6:23:f3:d9:e0:2e:6e:5f:e8:cf:ae:b0:b0:25:4d:2b: + f8:3b:58:9b:40:24:37:5a:cb:ab:16:49:ff:b3:75:79:33:a1: + 2f:6d:70:17:34:91:fe:67:7e:8f:ec:9b:e5:5e:82:a9:55:1f: + 2f:dc:d4:51:07:12:fe:ac:16:3e:2c:35:c6:63:fc:dc:10:eb: + 0d:a3:aa:d0:7c:cc:d1:d0:2f:51:2e:c4:14:5a:de:e8:19:e1: + 3e:c6:cc:a4:29:e7:2e:84:aa:06:30:78:76:54:73:28:98:59: + 38:e0:00:0d:62:d3:42:7d:21:9f:ae:3d:3a:8c:d5:fa:77:0d: + 18:2b:16:0e:5f:36:e1:fc:2a:b5:30:24:cf:e0:63:0c:7b:58: + 1a:fe:99:ba:42:12:b1:91:f4:7c:68:e2:c8:e8:af:2c:ea:c9: + 7e:ae:bb:2a:3d:0d:15:dc:34:95:b6:18:74:a8:6a:0f:c7:b4: + f4:13:c4:e4:5b:ed:0a:d2:a4:97:4c:2a:ed:2f:6c:12:89:3d: + f1:27:70:aa:6a:03:52:21:9f:40:a8:67:50:f2:f3:5a:1f:df: + df:23:f6:dc:78:4e:e6:98:4f:55:3a:53:e3:ef:f2:f4:9f:c7: + 7c:d8:58:af:29:22:97:b8:e0:bd:91:2e:b0:76:ec:57:11:cf: + ef:29:44:f3:e9:85:7a:60:63:e4:5d:33:89:17:d9:31:aa:da: + d6:f3:18:35:72:cf:87:2b:2f:63:23:84:5d:84:8c:3f:57:a0: + 88:fc:99:91:28:26:69:99:d4:8f:97:44:be:8e:d5:48:b1:a4: + 28:29:f1:15:b4:e1:e5:9e:dd:f8:8f:a6:6f:26:d7:09:3c:3a: + 1c:11:0e:a6:6c:37:f7:ad:44:87:2c:28:c7:d8:74:82:b3:d0: + 6f:4a:57:bb:35:29:27:a0:8b:e8:21:a7:87:64:36:5d:cc:d8: + 16:ac:c7:b2:27:40:92:55:38:28:8d:51:6e:dd:14:67:53:6c: + 71:5c:26:84:4d:75:5a:b6:7e:60:56:a9:4d:ad:fb:9b:1e:97: + f3:0d:d9:d2:97:54:77:da:3d:12:b7:e0:1e:ef:08:06:ac:f9: + 85:87:e9:a2:dc:af:7e:18:12:83:fd:56:17:41:2e:d5:29:82: + 7d:99:f4:31:f6:71:a9:cf:2c:01:27:a5:05:b9:aa:b2:48:4e: + 2a:ef:9f:93:52:51:95:3c:52:73:8e:56:4c:17:40:c0:09:28: + e4:8b:6a:48:53:db:ec:cd:55:55:f1:c6:f8:e9:a2:2c:4c:a6: + d1:26:5f:7e:af:5a:4c:da:1f:a6:f2:1c:2c:7e:ae:02:16:d2: + 56:d0:2f:57:53:47:e8:92 +-----BEGIN CERTIFICATE----- +MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEW +MBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVy +c2FsIENBIDIwHhcNMDQwMzA0MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYD +VQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1 +c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC +AQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0DE81 +WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUG +FF+3Qs17j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdq +XbboW0W63MOhBW9Wjo8QJqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxL +se4YuU6W3Nx2/zu+z18DwPw76L5GG//aQMJS9/7jOvdqdzXQ2o3rXhhqMcceujwb +KNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2WP0+GfPtDCapkzj4T8Fd +IgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP20gaXT73 +y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRt +hAAnZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgoc +QIgfksILAAX/8sgCSqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4 +Lt1ZrtmhN79UNdxzMk+MBB4zsslG8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNV +HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAfBgNV +HSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8EBAMCAYYwDQYJ +KoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z +dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQ +L1EuxBRa3ugZ4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgr +Fg5fNuH8KrUwJM/gYwx7WBr+mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSo +ag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpqA1Ihn0CoZ1Dy81of398j9tx4TuaY +T1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpgY+RdM4kX2TGq2tbz +GDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiPpm8m +1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJV +OCiNUW7dFGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH +6aLcr34YEoP9VhdBLtUpgn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwX +QMAJKOSLakhT2+zNVVXxxvjpoixMptEmX36vWkzaH6byHCx+rgIW0lbQL1dTR+iS +-----END CERTIFICATE----- + +Thawte Personal Freemail CA +=========================== + +MD5 Fingerprint=1E:74:C3:86:3C:0C:35:C5:3E:C2:7F:EF:3C:AA:3C:D9 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting, OU=Certification Services Division, CN=Thawte Personal Freemail CA/emailAddress=personal-freemail@thawte.com + Validity + Not Before: Jan 1 00:00:00 1996 GMT + Not After : Dec 31 23:59:59 2020 GMT + Subject: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting, OU=Certification Services Division, CN=Thawte Personal Freemail CA/emailAddress=personal-freemail@thawte.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:d4:69:d7:d4:b0:94:64:5b:71:e9:47:d8:0c:51: + b6:ea:72:91:b0:84:5e:7d:2d:0d:8f:7b:12:df:85: + 25:75:28:74:3a:42:2c:63:27:9f:95:7b:4b:ef:7e: + 19:87:1d:86:ea:a3:dd:b9:ce:96:64:1a:c2:14:6e: + 44:ac:7c:e6:8f:e8:4d:0f:71:1f:40:38:a6:00:a3: + 87:78:f6:f9:94:86:5e:ad:ea:c0:5e:76:eb:d9:14: + a3:5d:6e:7a:7c:0c:a5:4b:55:7f:06:19:29:7f:9e: + 9a:26:d5:6a:bb:38:24:08:6a:98:c7:b1:da:a3:98: + 91:fd:79:db:e5:5a:c4:1c:b9 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: md5WithRSAEncryption + c7:ec:92:7e:4e:f8:f5:96:a5:67:62:2a:a4:f0:4d:11:60:d0: + 6f:8d:60:58:61:ac:26:bb:52:35:5c:08:cf:30:fb:a8:4a:96: + 8a:1f:62:42:23:8c:17:0f:f4:ba:64:9c:17:ac:47:29:df:9d: + 98:5e:d2:6c:60:71:5c:a2:ac:dc:79:e3:e7:6e:00:47:1f:b5: + 0d:28:e8:02:9d:e4:9a:fd:13:f4:a6:d9:7c:b1:f8:dc:5f:23: + 26:09:91:80:73:d0:14:1b:de:43:a9:83:25:f2:e6:9c:2f:15: + ca:fe:a6:ab:8a:07:75:8b:0c:dd:51:84:6b:e4:f8:d1:ce:77: + a2:81 +-----BEGIN CERTIFICATE----- +MIIDLTCCApagAwIBAgIBADANBgkqhkiG9w0BAQQFADCB0TELMAkGA1UEBhMCWkEx +FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMRowGAYD +VQQKExFUaGF3dGUgQ29uc3VsdGluZzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBT +ZXJ2aWNlcyBEaXZpc2lvbjEkMCIGA1UEAxMbVGhhd3RlIFBlcnNvbmFsIEZyZWVt +YWlsIENBMSswKQYJKoZIhvcNAQkBFhxwZXJzb25hbC1mcmVlbWFpbEB0aGF3dGUu +Y29tMB4XDTk2MDEwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgdExCzAJBgNVBAYT +AlpBMRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEa +MBgGA1UEChMRVGhhd3RlIENvbnN1bHRpbmcxKDAmBgNVBAsTH0NlcnRpZmljYXRp +b24gU2VydmljZXMgRGl2aXNpb24xJDAiBgNVBAMTG1RoYXd0ZSBQZXJzb25hbCBG +cmVlbWFpbCBDQTErMCkGCSqGSIb3DQEJARYccGVyc29uYWwtZnJlZW1haWxAdGhh +d3RlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA1GnX1LCUZFtx6UfY +DFG26nKRsIRefS0Nj3sS34UldSh0OkIsYyeflXtL734Zhx2G6qPduc6WZBrCFG5E +rHzmj+hND3EfQDimAKOHePb5lIZererAXnbr2RSjXW56fAylS1V/Bhkpf56aJtVq +uzgkCGqYx7Hao5iR/Xnb5VrEHLkCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zAN +BgkqhkiG9w0BAQQFAAOBgQDH7JJ+Tvj1lqVnYiqk8E0RYNBvjWBYYawmu1I1XAjP +MPuoSpaKH2JCI4wXD/S6ZJwXrEcp352YXtJsYHFcoqzceePnbgBHH7UNKOgCneSa +/RP0ptl8sfjcXyMmCZGAc9AUG95DqYMl8uacLxXK/qarigd1iwzdUYRr5PjRznei +gQ== +-----END CERTIFICATE----- + +UTN-USER First-Network Applications +=================================== + +MD5 Fingerprint=BF:60:59:A3:5B:BA:F6:A7:76:42:DA:6F:1A:7B:50:CF +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 44:be:0c:8b:50:00:24:b4:11:d3:36:30:4b:c0:33:77 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN-USERFirst-Network Applications + Validity + Not Before: Jul 9 18:48:39 1999 GMT + Not After : Jul 9 18:57:49 2019 GMT + Subject: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN-USERFirst-Network Applications + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b3:fb:91:a1:e4:36:55:85:ac:06:34:5b:a0:9a: + 58:b2:f8:b5:0f:05:77:83:ae:32:b1:76:92:68:ec: + 23:4a:c9:76:3f:e3:9c:b6:37:79:03:b9:ab:69:8d: + 07:25:b6:19:67:e4:b0:1b:18:73:61:4a:e8:7e:cd: + d3:2f:64:e3:a6:7c:0c:fa:17:80:a3:0d:47:89:4f: + 51:71:2f:ee:fc:3f:f9:b8:16:80:87:89:93:25:20: + 9a:43:82:69:24:76:28:59:35:a1:1d:c0:7f:83:06: + 64:16:20:2c:d3:49:a4:85:b4:c0:61:7f:51:08:f8: + 68:15:91:80:cb:a5:d5:ee:3b:3a:f4:84:04:5e:60: + 59:a7:8c:34:72:ee:b8:78:c5:d1:3b:12:4a:6f:7e: + 65:27:b9:a4:55:c5:b9:6f:43:a4:c5:1d:2c:99:c0: + 52:a4:78:4c:15:b3:40:98:08:6b:43:c6:01:b0:7a: + 7b:f5:6b:1c:22:3f:cb:ef:ff:a8:d0:3a:4b:76:15: + 9e:d2:d1:c6:2e:e3:db:57:1b:32:a2:b8:6f:e8:86: + a6:3f:70:ab:e5:70:92:ab:44:1e:40:50:fb:9c:a3: + 62:e4:6c:6e:a0:c8:de:e2:80:42:fa:e9:2f:e8:ce: + 32:04:8f:7c:8d:b7:1c:a3:35:3c:15:dd:9e:c3:ae: + 97:a5 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: + Digital Signature, Non Repudiation, Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + FA:86:C9:DB:E0:BA:E9:78:F5:4B:A8:D6:15:DF:F0:D3:E1:6A:14:3C + X509v3 CRL Distribution Points: + URI:http://crl.usertrust.com/UTN-USERFirst-NetworkApplications.crl + + Signature Algorithm: sha1WithRSAEncryption + a4:f3:25:cc:d1:d4:91:83:22:d0:cc:32:ab:9b:96:4e:34:91: + 54:20:25:34:61:5f:2a:02:15:e1:8b:aa:ff:7d:64:51:cf:0a: + ff:bc:7d:d8:21:6a:78:cb:2f:51:6f:f8:42:1d:33:bd:eb:b5: + 7b:94:c3:c3:a9:a0:2d:df:d1:29:1f:1d:fe:8f:3f:bb:a8:45: + 2a:7f:d1:6e:55:24:e2:bb:02:fb:31:3f:be:e8:bc:ec:40:2b: + f8:01:d4:56:38:e4:ca:44:82:b5:61:20:21:67:65:f6:f0:0b: + e7:34:f8:a5:c2:9c:a3:5c:40:1f:85:93:95:06:de:4f:d4:27: + a9:b6:a5:fc:16:cd:73:31:3f:b8:65:27:cf:d4:53:1a:f0:ac: + 6e:9f:4f:05:0c:03:81:a7:84:29:c4:5a:bd:64:57:72:ad:3b: + cf:37:18:a6:98:c6:ad:06:b4:dc:08:a3:04:d5:29:a4:96:9a: + 12:67:4a:8c:60:45:9d:f1:23:9a:b0:00:9c:68:b5:98:50:d3: + ef:8e:2e:92:65:b1:48:3e:21:be:15:30:2a:0d:b5:0c:a3:6b: + 3f:ae:7f:57:f5:1f:96:7c:df:6f:dd:82:30:2c:65:1b:40:4a: + cd:68:b9:72:ec:71:76:ec:54:8e:1f:85:0c:01:6a:fa:a6:38: + ac:1f:c4:84 +-----BEGIN CERTIFICATE----- +MIIEZDCCA0ygAwIBAgIQRL4Mi1AAJLQR0zYwS8AzdzANBgkqhkiG9w0BAQUFADCB +ozELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug +Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho +dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xKzApBgNVBAMTIlVUTi1VU0VSRmlyc3Qt +TmV0d29yayBBcHBsaWNhdGlvbnMwHhcNOTkwNzA5MTg0ODM5WhcNMTkwNzA5MTg1 +NzQ5WjCBozELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0 +IExha2UgQ2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYD +VQQLExhodHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xKzApBgNVBAMTIlVUTi1VU0VS +Rmlyc3QtTmV0d29yayBBcHBsaWNhdGlvbnMwggEiMA0GCSqGSIb3DQEBAQUAA4IB +DwAwggEKAoIBAQCz+5Gh5DZVhawGNFugmliy+LUPBXeDrjKxdpJo7CNKyXY/45y2 +N3kDuatpjQclthln5LAbGHNhSuh+zdMvZOOmfAz6F4CjDUeJT1FxL+78P/m4FoCH +iZMlIJpDgmkkdihZNaEdwH+DBmQWICzTSaSFtMBhf1EI+GgVkYDLpdXuOzr0hARe +YFmnjDRy7rh4xdE7EkpvfmUnuaRVxblvQ6TFHSyZwFKkeEwVs0CYCGtDxgGwenv1 +axwiP8vv/6jQOkt2FZ7S0cYu49tXGzKiuG/ohqY/cKvlcJKrRB5AUPuco2LkbG6g +yN7igEL66S/ozjIEj3yNtxyjNTwV3Z7DrpelAgMBAAGjgZEwgY4wCwYDVR0PBAQD +AgHGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFPqGydvguul49Uuo1hXf8NPh +ahQ8ME8GA1UdHwRIMEYwRKBCoECGPmh0dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9V +VE4tVVNFUkZpcnN0LU5ldHdvcmtBcHBsaWNhdGlvbnMuY3JsMA0GCSqGSIb3DQEB +BQUAA4IBAQCk8yXM0dSRgyLQzDKrm5ZONJFUICU0YV8qAhXhi6r/fWRRzwr/vH3Y +IWp4yy9Rb/hCHTO967V7lMPDqaAt39EpHx3+jz+7qEUqf9FuVSTiuwL7MT++6Lzs +QCv4AdRWOOTKRIK1YSAhZ2X28AvnNPilwpyjXEAfhZOVBt5P1CeptqX8Fs1zMT+4 +ZSfP1FMa8Kxun08FDAOBp4QpxFq9ZFdyrTvPNximmMatBrTcCKME1SmklpoSZ0qM +YEWd8SOasACcaLWYUNPvji6SZbFIPiG+FTAqDbUMo2s/rn9X9R+WfN9v3YIwLGUb +QErNaLly7HF27FSOH4UMAWr6pjisH8SE +-----END CERTIFICATE----- + +America Online Root Certification Authority 1 +============================================= + +MD5 Fingerprint=14:F1:08:AD:9D:FA:64:E2:89:E7:1C:CF:A8:AD:7D:5E +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=America Online Inc., CN=America Online Root Certification Authority 1 + Validity + Not Before: May 28 06:00:00 2002 GMT + Not After : Nov 19 20:43:00 2037 GMT + Subject: C=US, O=America Online Inc., CN=America Online Root Certification Authority 1 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:a8:2f:e8:a4:69:06:03:47:c3:e9:2a:98:ff:19: + a2:70:9a:c6:50:b2:7e:a5:df:68:4d:1b:7c:0f:b6: + 97:68:7d:2d:a6:8b:97:e9:64:86:c9:a3:ef:a0:86: + bf:60:65:9c:4b:54:88:c2:48:c5:4a:39:bf:14:e3: + 59:55:e5:19:b4:74:c8:b4:05:39:5c:16:a5:e2:95: + 05:e0:12:ae:59:8b:a2:33:68:58:1c:a6:d4:15:b7: + d8:9f:d7:dc:71:ab:7e:9a:bf:9b:8e:33:0f:22:fd: + 1f:2e:e7:07:36:ef:62:39:c5:dd:cb:ba:25:14:23: + de:0c:c6:3d:3c:ce:82:08:e6:66:3e:da:51:3b:16: + 3a:a3:05:7f:a0:dc:87:d5:9c:fc:72:a9:a0:7d:78: + e4:b7:31:55:1e:65:bb:d4:61:b0:21:60:ed:10:32: + 72:c5:92:25:1e:f8:90:4a:18:78:47:df:7e:30:37: + 3e:50:1b:db:1c:d3:6b:9a:86:53:07:b0:ef:ac:06: + 78:f8:84:99:fe:21:8d:4c:80:b6:0c:82:f6:66:70: + 79:1a:d3:4f:a3:cf:f1:cf:46:b0:4b:0f:3e:dd:88: + 62:b8:8c:a9:09:28:3b:7a:c7:97:e1:1e:e5:f4:9f: + c0:c0:ae:24:a0:c8:a1:d9:0f:d6:7b:26:82:69:32: + 3d:a7 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 00:AD:D9:A3:F6:79:F6:6E:74:A9:7F:33:3D:81:17:D7:4C:CF:33:DE + X509v3 Authority Key Identifier: + keyid:00:AD:D9:A3:F6:79:F6:6E:74:A9:7F:33:3D:81:17:D7:4C:CF:33:DE + + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 7c:8a:d1:1f:18:37:82:e0:b8:b0:a3:ed:56:95:c8:62:61:9c: + 05:a2:cd:c2:62:26:61:cd:10:16:d7:cc:b4:65:34:d0:11:8a: + ad:a8:a9:05:66:ef:74:f3:6d:5f:9d:99:af:f6:8b:fb:eb:52: + b2:05:98:a2:6f:2a:c5:54:bd:25:bd:5f:ae:c8:86:ea:46:2c: + c1:b3:bd:c1:e9:49:70:18:16:97:08:13:8c:20:e0:1b:2e:3a: + 47:cb:1e:e4:00:30:95:5b:f4:45:a3:c0:1a:b0:01:4e:ab:bd: + c0:23:6e:63:3f:80:4a:c5:07:ed:dc:e2:6f:c7:c1:62:f1:e3: + 72:d6:04:c8:74:67:0b:fa:88:ab:a1:01:c8:6f:f0:14:af:d2: + 99:cd:51:93:7e:ed:2e:38:c7:bd:ce:46:50:3d:72:e3:79:25: + 9d:9b:88:2b:10:20:dd:a5:b8:32:9f:8d:e0:29:df:21:74:86: + 82:db:2f:82:30:c6:c7:35:86:b3:f9:96:5f:46:db:0c:45:fd: + f3:50:c3:6f:c6:c3:48:ad:46:a6:e1:27:47:0a:1d:0e:9b:b6: + c2:77:7f:63:f2:e0:7d:1a:be:fc:e0:df:d7:c7:a7:6c:b0:f9: + ae:ba:3c:fd:74:b4:11:e8:58:0d:80:bc:d3:a8:80:3a:99:ed: + 75:cc:46:7b +-----BEGIN CERTIFICATE----- +MIIDpDCCAoygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEc +MBoGA1UEChMTQW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBP +bmxpbmUgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAxMB4XDTAyMDUyODA2 +MDAwMFoXDTM3MTExOTIwNDMwMFowYzELMAkGA1UEBhMCVVMxHDAaBgNVBAoTE0Ft +ZXJpY2EgT25saW5lIEluYy4xNjA0BgNVBAMTLUFtZXJpY2EgT25saW5lIFJvb3Qg +Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMTCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBAKgv6KRpBgNHw+kqmP8ZonCaxlCyfqXfaE0bfA+2l2h9LaaLl+lk +hsmj76CGv2BlnEtUiMJIxUo5vxTjWVXlGbR0yLQFOVwWpeKVBeASrlmLojNoWBym +1BW32J/X3HGrfpq/m44zDyL9Hy7nBzbvYjnF3cu6JRQj3gzGPTzOggjmZj7aUTsW +OqMFf6Dch9Wc/HKpoH145LcxVR5lu9RhsCFg7RAycsWSJR74kEoYeEfffjA3PlAb +2xzTa5qGUwew76wGePiEmf4hjUyAtgyC9mZweRrTT6PP8c9GsEsPPt2IYriMqQko +O3rHl+Ee5fSfwMCuJKDIodkP1nsmgmkyPacCAwEAAaNjMGEwDwYDVR0TAQH/BAUw +AwEB/zAdBgNVHQ4EFgQUAK3Zo/Z59m50qX8zPYEX10zPM94wHwYDVR0jBBgwFoAU +AK3Zo/Z59m50qX8zPYEX10zPM94wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB +BQUAA4IBAQB8itEfGDeC4Liwo+1WlchiYZwFos3CYiZhzRAW18y0ZTTQEYqtqKkF +Zu90821fnZmv9ov761KyBZiibyrFVL0lvV+uyIbqRizBs73B6UlwGBaXCBOMIOAb +LjpHyx7kADCVW/RFo8AasAFOq73AI25jP4BKxQft3OJvx8Fi8eNy1gTIdGcL+oir +oQHIb/AUr9KZzVGTfu0uOMe9zkZQPXLjeSWdm4grECDdpbgyn43gKd8hdIaC2y+C +MMbHNYaz+ZZfRtsMRf3zUMNvxsNIrUam4SdHCh0Om7bCd39j8uB9Gr784N/Xx6ds +sPmuujz9dLQR6FgNgLzTqIA6me11zEZ7 +-----END CERTIFICATE----- + +America Online Root Certification Authority 2 +============================================= + +MD5 Fingerprint=D6:ED:3C:CA:E2:66:0F:AF:10:43:0D:77:9B:04:09:BF +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=America Online Inc., CN=America Online Root Certification Authority 2 + Validity + Not Before: May 28 06:00:00 2002 GMT + Not After : Sep 29 14:08:00 2037 GMT + Subject: C=US, O=America Online Inc., CN=America Online Root Certification Authority 2 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (4096 bit) + Modulus (4096 bit): + 00:cc:41:45:1d:e9:3d:4d:10:f6:8c:b1:41:c9:e0: + 5e:cb:0d:b7:bf:47:73:d3:f0:55:4d:dd:c6:0c:fa: + b1:66:05:6a:cd:78:b4:dc:02:db:4e:81:f3:d7:a7: + 7c:71:bc:75:63:a0:5d:e3:07:0c:48:ec:25:c4:03: + 20:f4:ff:0e:3b:12:ff:9b:8d:e1:c6:d5:1b:b4:6d: + 22:e3:b1:db:7f:21:64:af:86:bc:57:22:2a:d6:47: + 81:57:44:82:56:53:bd:86:14:01:0b:fc:7f:74:a4: + 5a:ae:f1:ba:11:b5:9b:58:5a:80:b4:37:78:09:33: + 7c:32:47:03:5c:c4:a5:83:48:f4:57:56:6e:81:36: + 27:18:4f:ec:9b:28:c2:d4:b4:d7:7c:0c:3e:0c:2b: + df:ca:04:d7:c6:8e:ea:58:4e:a8:a4:a5:18:1c:6c: + 45:98:a3:41:d1:2d:d2:c7:6d:8d:19:f1:ad:79:b7: + 81:3f:bd:06:82:27:2d:10:58:05:b5:78:05:b9:2f: + db:0c:6b:90:90:7e:14:59:38:bb:94:24:13:e5:d1: + 9d:14:df:d3:82:4d:46:f0:80:39:52:32:0f:e3:84: + b2:7a:43:f2:5e:de:5f:3f:1d:dd:e3:b2:1b:a0:a1: + 2a:23:03:6e:2e:01:15:87:5c:a6:75:75:c7:97:61: + be:de:86:dc:d4:48:db:bd:2a:bf:4a:55:da:e8:7d: + 50:fb:b4:80:17:b8:94:bf:01:3d:ea:da:ba:7c:e0: + 58:67:17:b9:58:e0:88:86:46:67:6c:9d:10:47:58: + 32:d0:35:7c:79:2a:90:a2:5a:10:11:23:35:ad:2f: + cc:e4:4a:5b:a7:c8:27:f2:83:de:5e:bb:5e:77:e7: + e8:a5:6e:63:c2:0d:5d:61:d0:8c:d2:6c:5a:21:0e: + ca:28:a3:ce:2a:e9:95:c7:48:cf:96:6f:1d:92:25: + c8:c6:c6:c1:c1:0c:05:ac:26:c4:d2:75:d2:e1:2a: + 67:c0:3d:5b:a5:9a:eb:cf:7b:1a:a8:9d:14:45:e5: + 0f:a0:9a:65:de:2f:28:bd:ce:6f:94:66:83:48:29: + d8:ea:65:8c:af:93:d9:64:9f:55:57:26:bf:6f:cb: + 37:31:99:a3:60:bb:1c:ad:89:34:32:62:b8:43:21: + 06:72:0c:a1:5c:6d:46:c5:fa:29:cf:30:de:89:dc: + 71:5b:dd:b6:37:3e:df:50:f5:b8:07:25:26:e5:bc: + b5:fe:3c:02:b3:b7:f8:be:43:c1:87:11:94:9e:23: + 6c:17:8a:b8:8a:27:0c:54:47:f0:a9:b3:c0:80:8c: + a0:27:eb:1d:19:e3:07:8e:77:70:ca:2b:f4:7d:76: + e0:78:67 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 4D:45:C1:68:38:BB:73:A9:69:A1:20:E7:ED:F5:22:A1:23:14:D7:9E + X509v3 Authority Key Identifier: + keyid:4D:45:C1:68:38:BB:73:A9:69:A1:20:E7:ED:F5:22:A1:23:14:D7:9E + + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 67:6b:06:b9:5f:45:3b:2a:4b:33:b3:e6:1b:6b:59:4e:22:cc: + b9:b7:a4:25:c9:a7:c4:f0:54:96:0b:64:f3:b1:58:4f:5e:51: + fc:b2:97:7b:27:65:c2:e5:ca:e7:0d:0c:25:7b:62:e3:fa:9f: + b4:87:b7:45:46:af:83:a5:97:48:8c:a5:bd:f1:16:2b:9b:76: + 2c:7a:35:60:6c:11:80:97:cc:a9:92:52:e6:2b:e6:69:ed:a9: + f8:36:2d:2c:77:bf:61:48:d1:63:0b:b9:5b:52:ed:18:b0:43: + 42:22:a6:b1:77:ae:de:69:c5:cd:c7:1c:a1:b1:a5:1c:10:fb: + 18:be:1a:70:dd:c1:92:4b:be:29:5a:9d:3f:35:be:e5:7d:51: + f8:55:e0:25:75:23:87:1e:5c:dc:ba:9d:b0:ac:b3:69:db:17: + 83:c9:f7:de:0c:bc:08:dc:91:9e:a8:d0:d7:15:37:73:a5:35: + b8:fc:7e:c5:44:40:06:c3:eb:f8:22:80:5c:47:ce:02:e3:11: + 9f:44:ff:fd:9a:32:cc:7d:64:51:0e:eb:57:26:76:3a:e3:1e: + 22:3c:c2:a6:36:dd:19:ef:a7:fc:12:f3:26:c0:59:31:85:4c: + 9c:d8:cf:df:a4:cc:cc:29:93:ff:94:6d:76:5c:13:08:97:f2: + ed:a5:0b:4d:dd:e8:c9:68:0e:66:d3:00:0e:33:12:5b:bc:95: + e5:32:90:a8:b3:c6:6c:83:ad:77:ee:8b:7e:7e:b1:a9:ab:d3: + e1:f1:b6:c0:b1:ea:88:c0:e7:d3:90:e9:28:92:94:7b:68:7b: + 97:2a:0a:67:2d:85:02:38:10:e4:03:61:d4:da:25:36:c7:08: + 58:2d:a1:a7:51:af:30:0a:49:f5:a6:69:87:07:2d:44:46:76: + 8e:2a:e5:9a:3b:d7:18:a2:fc:9c:38:10:cc:c6:3b:d2:b5:17: + 3a:6f:fd:ae:25:bd:f5:72:59:64:b1:74:2a:38:5f:18:4c:df: + cf:71:04:5a:36:d4:bf:2f:99:9c:e8:d9:ba:b1:95:e6:02:4b: + 21:a1:5b:d5:c1:4f:8f:ae:69:6d:53:db:01:93:b5:5c:1e:18: + dd:64:5a:ca:18:28:3e:63:04:11:fd:1c:8d:00:0f:b8:37:df: + 67:8a:9d:66:a9:02:6a:91:ff:13:ca:2f:5d:83:bc:87:93:6c: + dc:24:51:16:04:25:66:fa:b3:d9:c2:ba:29:be:9a:48:38:82: + 99:f4:bf:3b:4a:31:19:f9:bf:8e:21:33:14:ca:4f:54:5f:fb: + ce:fb:8f:71:7f:fd:5e:19:a0:0f:4b:91:b8:c4:54:bc:06:b0: + 45:8f:26:91:a2:8e:fe:a9 +-----BEGIN CERTIFICATE----- +MIIFpDCCA4ygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEc +MBoGA1UEChMTQW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBP +bmxpbmUgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAyMB4XDTAyMDUyODA2 +MDAwMFoXDTM3MDkyOTE0MDgwMFowYzELMAkGA1UEBhMCVVMxHDAaBgNVBAoTE0Ft +ZXJpY2EgT25saW5lIEluYy4xNjA0BgNVBAMTLUFtZXJpY2EgT25saW5lIFJvb3Qg +Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIP +ADCCAgoCggIBAMxBRR3pPU0Q9oyxQcngXssNt79Hc9PwVU3dxgz6sWYFas14tNwC +206B89enfHG8dWOgXeMHDEjsJcQDIPT/DjsS/5uN4cbVG7RtIuOx238hZK+GvFci +KtZHgVdEglZTvYYUAQv8f3SkWq7xuhG1m1hagLQ3eAkzfDJHA1zEpYNI9FdWboE2 +JxhP7JsowtS013wMPgwr38oE18aO6lhOqKSlGBxsRZijQdEt0sdtjRnxrXm3gT+9 +BoInLRBYBbV4Bbkv2wxrkJB+FFk4u5QkE+XRnRTf04JNRvCAOVIyD+OEsnpD8l7e +Xz8d3eOyG6ChKiMDbi4BFYdcpnV1x5dhvt6G3NRI270qv0pV2uh9UPu0gBe4lL8B +PeraunzgWGcXuVjgiIZGZ2ydEEdYMtA1fHkqkKJaEBEjNa0vzORKW6fIJ/KD3l67 +Xnfn6KVuY8INXWHQjNJsWiEOyiijzirplcdIz5ZvHZIlyMbGwcEMBawmxNJ10uEq +Z8A9W6Wa6897GqidFEXlD6CaZd4vKL3Ob5Rmg0gp2OpljK+T2WSfVVcmv2/LNzGZ +o2C7HK2JNDJiuEMhBnIMoVxtRsX6Kc8w3onccVvdtjc+31D1uAclJuW8tf48ArO3 ++L5DwYcRlJ4jbBeKuIonDFRH8KmzwICMoCfrHRnjB453cMor9H124HhnAgMBAAGj +YzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFE1FwWg4u3OpaaEg5+31IqEj +FNeeMB8GA1UdIwQYMBaAFE1FwWg4u3OpaaEg5+31IqEjFNeeMA4GA1UdDwEB/wQE +AwIBhjANBgkqhkiG9w0BAQUFAAOCAgEAZ2sGuV9FOypLM7PmG2tZTiLMubekJcmn +xPBUlgtk87FYT15R/LKXeydlwuXK5w0MJXti4/qftIe3RUavg6WXSIylvfEWK5t2 +LHo1YGwRgJfMqZJS5ivmae2p+DYtLHe/YUjRYwu5W1LtGLBDQiKmsXeu3mnFzccc +obGlHBD7GL4acN3Bkku+KVqdPzW+5X1R+FXgJXUjhx5c3LqdsKyzadsXg8n33gy8 +CNyRnqjQ1xU3c6U1uPx+xURABsPr+CKAXEfOAuMRn0T//ZoyzH1kUQ7rVyZ2OuMe +IjzCpjbdGe+n/BLzJsBZMYVMnNjP36TMzCmT/5RtdlwTCJfy7aULTd3oyWgOZtMA +DjMSW7yV5TKQqLPGbIOtd+6Lfn6xqavT4fG2wLHqiMDn05DpKJKUe2h7lyoKZy2F +AjgQ5ANh1NolNscIWC2hp1GvMApJ9aZphwctREZ2jirlmjvXGKL8nDgQzMY70rUX +Om/9riW99XJZZLF0KjhfGEzfz3EEWjbUvy+ZnOjZurGV5gJLIaFb1cFPj65pbVPb +AZO1XB4Y3WRayhgoPmMEEf0cjQAPuDffZ4qdZqkCapH/E8ovXYO8h5Ns3CRRFgQl +Zvqz2cK6Kb6aSDiCmfS/O0oxGfm/jiEzFMpPVF/7zvuPcX/9XhmgD0uRuMRUvAaw +RY8mkaKO/qk= +-----END CERTIFICATE----- + +Visa eCommerce Root +=================== + +MD5 Fingerprint=FC:11:B8:D8:08:93:30:00:6D:23:F9:7E:EB:52:1E:02 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 13:86:35:4d:1d:3f:06:f2:c1:f9:65:05:d5:90:1c:62 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VISA, OU=Visa International Service Association, CN=Visa eCommerce Root + Validity + Not Before: Jun 26 02:18:36 2002 GMT + Not After : Jun 24 00:16:12 2022 GMT + Subject: C=US, O=VISA, OU=Visa International Service Association, CN=Visa eCommerce Root + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:af:57:de:56:1e:6e:a1:da:60:b1:94:27:cb:17: + db:07:3f:80:85:4f:c8:9c:b6:d0:f4:6f:4f:cf:99: + d8:e1:db:c2:48:5c:3a:ac:39:33:c7:1f:6a:8b:26: + 3d:2b:35:f5:48:b1:91:c1:02:4e:04:96:91:7b:b0: + 33:f0:b1:14:4e:11:6f:b5:40:af:1b:45:a5:4a:ef: + 7e:b6:ac:f2:a0:1f:58:3f:12:46:60:3c:8d:a1:e0: + 7d:cf:57:3e:33:1e:fb:47:f1:aa:15:97:07:55:66: + a5:b5:2d:2e:d8:80:59:b2:a7:0d:b7:46:ec:21:63: + ff:35:ab:a5:02:cf:2a:f4:4c:fe:7b:f5:94:5d:84: + 4d:a8:f2:60:8f:db:0e:25:3c:9f:73:71:cf:94:df: + 4a:ea:db:df:72:38:8c:f3:96:bd:f1:17:bc:d2:ba: + 3b:45:5a:c6:a7:f6:c6:17:8b:01:9d:fc:19:a8:2a: + 83:16:b8:3a:48:fe:4e:3e:a0:ab:06:19:e9:53:f3: + 80:13:07:ed:2d:bf:3f:0a:3c:55:20:39:2c:2c:00: + 69:74:95:4a:bc:20:b2:a9:79:e5:18:89:91:a8:dc: + 1c:4d:ef:bb:7e:37:0b:5d:fe:39:a5:88:52:8c:00: + 6c:ec:18:7c:41:bd:f6:8b:75:77:ba:60:9d:84:e7: + fe:2d + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Subject Key Identifier: + 15:38:83:0F:3F:2C:3F:70:33:1E:CD:46:FE:07:8C:20:E0:D7:C3:B7 + Signature Algorithm: sha1WithRSAEncryption + 5f:f1:41:7d:7c:5c:08:b9:2b:e0:d5:92:47:fa:67:5c:a5:13: + c3:03:21:9b:2b:4c:89:46:cf:59:4d:c9:fe:a5:40:b6:63:cd: + dd:71:28:95:67:11:cc:24:ac:d3:44:6c:71:ae:01:20:6b:03: + a2:8f:18:b7:29:3a:7d:e5:16:60:53:78:3c:c0:af:15:83:f7: + 8f:52:33:24:bd:64:93:97:ee:8b:f7:db:18:a8:6d:71:b3:f7: + 2c:17:d0:74:25:69:f7:fe:6b:3c:94:be:4d:4b:41:8c:4e:e2: + 73:d0:e3:90:22:73:43:cd:f3:ef:ea:73:ce:45:8a:b0:a6:49: + ff:4c:7d:9d:71:88:c4:76:1d:90:5b:1d:ee:fd:cc:f7:ee:fd: + 60:a5:b1:7a:16:71:d1:16:d0:7c:12:3c:6c:69:97:db:ae:5f: + 39:9a:70:2f:05:3c:19:46:04:99:20:36:d0:60:6e:61:06:bb: + 16:42:8c:70:f7:30:fb:e0:db:66:a3:00:01:bd:e6:2c:da:91: + 5f:a0:46:8b:4d:6a:9c:3d:3d:dd:05:46:fe:76:bf:a0:0a:3c: + e4:00:e6:27:b7:ff:84:2d:de:ba:22:27:96:10:71:eb:22:ed: + df:df:33:9c:cf:e3:ad:ae:8e:d4:8e:e6:4f:51:af:16:92:e0: + 5c:f6:07:0f +-----BEGIN CERTIFICATE----- +MIIDojCCAoqgAwIBAgIQE4Y1TR0/BvLB+WUF1ZAcYjANBgkqhkiG9w0BAQUFADBr +MQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRl +cm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNv +bW1lcmNlIFJvb3QwHhcNMDIwNjI2MDIxODM2WhcNMjIwNjI0MDAxNjEyWjBrMQsw +CQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRlcm5h +dGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNvbW1l +cmNlIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvV95WHm6h +2mCxlCfLF9sHP4CFT8icttD0b0/Pmdjh28JIXDqsOTPHH2qLJj0rNfVIsZHBAk4E +lpF7sDPwsRROEW+1QK8bRaVK7362rPKgH1g/EkZgPI2h4H3PVz4zHvtH8aoVlwdV +ZqW1LS7YgFmypw23RuwhY/81q6UCzyr0TP579ZRdhE2o8mCP2w4lPJ9zcc+U30rq +299yOIzzlr3xF7zSujtFWsan9sYXiwGd/BmoKoMWuDpI/k4+oKsGGelT84ATB+0t +vz8KPFUgOSwsAGl0lUq8ILKpeeUYiZGo3BxN77t+Nwtd/jmliFKMAGzsGHxBvfaL +dXe6YJ2E5/4tAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD +AgEGMB0GA1UdDgQWBBQVOIMPPyw/cDMezUb+B4wg4NfDtzANBgkqhkiG9w0BAQUF +AAOCAQEAX/FBfXxcCLkr4NWSR/pnXKUTwwMhmytMiUbPWU3J/qVAtmPN3XEolWcR +zCSs00Rsca4BIGsDoo8Ytyk6feUWYFN4PMCvFYP3j1IzJL1kk5fui/fbGKhtcbP3 +LBfQdCVp9/5rPJS+TUtBjE7ic9DjkCJzQ83z7+pzzkWKsKZJ/0x9nXGIxHYdkFsd +7v3M9+79YKWxehZx0RbQfBI8bGmX265fOZpwLwU8GUYEmSA20GBuYQa7FkKMcPcw +++DbZqMAAb3mLNqRX6BGi01qnD093QVG/na/oAo85ADmJ7f/hC3euiInlhBx6yLt +398znM/jra6O1I7mT1GvFpLgXPYHDw== +-----END CERTIFICATE----- + +TC TrustCenter, Germany, Class 2 CA +=================================== + +MD5 Fingerprint=B8:16:33:4C:4C:4C:F2:D8:D3:4D:06:B4:A6:5B:40:03 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1002 (0x3ea) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=DE, ST=Hamburg, L=Hamburg, O=TC TrustCenter for Security in Data Networks GmbH, OU=TC TrustCenter Class 2 CA/emailAddress=certificate@trustcenter.de + Validity + Not Before: Mar 9 11:59:59 1998 GMT + Not After : Jan 1 11:59:59 2011 GMT + Subject: C=DE, ST=Hamburg, L=Hamburg, O=TC TrustCenter for Security in Data Networks GmbH, OU=TC TrustCenter Class 2 CA/emailAddress=certificate@trustcenter.de + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:da:38:e8:ed:32:00:29:71:83:01:0d:bf:8c:01: + dc:da:c6:ad:39:a4:a9:8a:2f:d5:8b:5c:68:5f:50: + c6:62:f5:66:bd:ca:91:22:ec:aa:1d:51:d7:3d:b3: + 51:b2:83:4e:5d:cb:49:b0:f0:4c:55:e5:6b:2d:c7: + 85:0b:30:1c:92:4e:82:d4:ca:02:ed:f7:6f:be:dc: + e0:e3:14:b8:05:53:f2:9a:f4:56:8b:5a:9e:85:93: + d1:b4:82:56:ae:4d:bb:a8:4b:57:16:bc:fe:f8:58: + 9e:f8:29:8d:b0:7b:cd:78:c9:4f:ac:8b:67:0c:f1: + 9c:fb:fc:57:9b:57:5c:4f:0d + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + Netscape CA Policy Url: + http://www.trustcenter.de/guidelines + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + Signature Algorithm: md5WithRSAEncryption + 84:52:fb:28:df:ff:1f:75:01:bc:01:be:04:56:97:6a:74:42: + 24:31:83:f9:46:b1:06:8a:89:cf:96:2c:33:bf:8c:b5:5f:7a: + 72:a1:85:06:ce:86:f8:05:8e:e8:f9:25:ca:da:83:8c:06:ac: + eb:36:6d:85:91:34:04:36:f4:42:f0:f8:79:2e:0a:48:5c:ab: + cc:51:4f:78:76:a0:d9:ac:19:bd:2a:d1:69:04:28:91:ca:36: + 10:27:80:57:5b:d2:5c:f5:c2:5b:ab:64:81:63:74:51:f4:97: + bf:cd:12:28:f7:4d:66:7f:a7:f0:1c:01:26:78:b2:66:47:70: + 51:64 +-----BEGIN CERTIFICATE----- +MIIDXDCCAsWgAwIBAgICA+owDQYJKoZIhvcNAQEEBQAwgbwxCzAJBgNVBAYTAkRF +MRAwDgYDVQQIEwdIYW1idXJnMRAwDgYDVQQHEwdIYW1idXJnMTowOAYDVQQKEzFU +QyBUcnVzdENlbnRlciBmb3IgU2VjdXJpdHkgaW4gRGF0YSBOZXR3b3JrcyBHbWJI +MSIwIAYDVQQLExlUQyBUcnVzdENlbnRlciBDbGFzcyAyIENBMSkwJwYJKoZIhvcN +AQkBFhpjZXJ0aWZpY2F0ZUB0cnVzdGNlbnRlci5kZTAeFw05ODAzMDkxMTU5NTla +Fw0xMTAxMDExMTU5NTlaMIG8MQswCQYDVQQGEwJERTEQMA4GA1UECBMHSGFtYnVy +ZzEQMA4GA1UEBxMHSGFtYnVyZzE6MDgGA1UEChMxVEMgVHJ1c3RDZW50ZXIgZm9y +IFNlY3VyaXR5IGluIERhdGEgTmV0d29ya3MgR21iSDEiMCAGA1UECxMZVEMgVHJ1 +c3RDZW50ZXIgQ2xhc3MgMiBDQTEpMCcGCSqGSIb3DQEJARYaY2VydGlmaWNhdGVA +dHJ1c3RjZW50ZXIuZGUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANo46O0y +AClxgwENv4wB3NrGrTmkqYov1YtcaF9QxmL1Zr3KkSLsqh1R1z2zUbKDTl3LSbDw +TFXlay3HhQswHJJOgtTKAu33b77c4OMUuAVT8pr0VotanoWT0bSCVq5Nu6hLVxa8 +/vhYnvgpjbB7zXjJT6yLZwzxnPv8V5tXXE8NAgMBAAGjazBpMA8GA1UdEwEB/wQF +MAMBAf8wDgYDVR0PAQH/BAQDAgGGMDMGCWCGSAGG+EIBCAQmFiRodHRwOi8vd3d3 +LnRydXN0Y2VudGVyLmRlL2d1aWRlbGluZXMwEQYJYIZIAYb4QgEBBAQDAgAHMA0G +CSqGSIb3DQEBBAUAA4GBAIRS+yjf/x91AbwBvgRWl2p0QiQxg/lGsQaKic+WLDO/ +jLVfenKhhQbOhvgFjuj5Jcrag4wGrOs2bYWRNAQ29ELw+HkuCkhcq8xRT3h2oNms +Gb0q0WkEKJHKNhAngFdb0lz1wlurZIFjdFH0l7/NEij3TWZ/p/AcASZ4smZHcFFk +-----END CERTIFICATE----- + +TC TrustCenter, Germany, Class 3 CA +=================================== + +MD5 Fingerprint=5F:94:4A:73:22:B8:F7:D1:31:EC:59:39:F7:8E:FE:6E +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1003 (0x3eb) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=DE, ST=Hamburg, L=Hamburg, O=TC TrustCenter for Security in Data Networks GmbH, OU=TC TrustCenter Class 3 CA/emailAddress=certificate@trustcenter.de + Validity + Not Before: Mar 9 11:59:59 1998 GMT + Not After : Jan 1 11:59:59 2011 GMT + Subject: C=DE, ST=Hamburg, L=Hamburg, O=TC TrustCenter for Security in Data Networks GmbH, OU=TC TrustCenter Class 3 CA/emailAddress=certificate@trustcenter.de + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:b6:b4:c1:35:05:2e:0d:8d:ec:a0:40:6a:1c:0e: + 27:a6:50:92:6b:50:1b:07:de:2e:e7:76:cc:e0:da: + fc:84:a8:5e:8c:63:6a:2b:4d:d9:4e:02:76:11:c1: + 0b:f2:8d:79:ca:00:b6:f1:b0:0e:d7:fb:a4:17:3d: + af:ab:69:7a:96:27:bf:af:33:a1:9a:2a:59:aa:c4: + b5:37:08:f2:12:a5:31:b6:43:f5:32:96:71:28:28: + ab:8d:28:86:df:bb:ee:e3:0c:7d:30:d6:c3:52:ab: + 8f:5d:27:9c:6b:c0:a3:e7:05:6b:57:49:44:b3:6e: + ea:64:cf:d2:8e:7a:50:77:77 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + Netscape CA Policy Url: + http://www.trustcenter.de/guidelines + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + Signature Algorithm: md5WithRSAEncryption + 16:3d:c6:cd:c1:bb:85:71:85:46:9f:3e:20:8f:51:28:99:ec: + 2d:45:21:63:23:5b:04:bb:4c:90:b8:88:92:04:4d:bd:7d:01: + a3:3f:f6:ec:ce:f1:de:fe:7d:e5:e1:3e:bb:c6:ab:5e:0b:dd: + 3d:96:c4:cb:a9:d4:f9:26:e6:06:4e:9e:0c:a5:7a:ba:6e:c3: + 7c:82:19:d1:c7:b1:b1:c3:db:0d:8e:9b:40:7c:37:0b:f1:5d: + e8:fd:1f:90:88:a5:0e:4e:37:64:21:a8:4e:8d:b4:9f:f1:de: + 48:ad:d5:56:18:52:29:8b:47:34:12:09:d4:bb:92:35:ef:0f: + db:34 +-----BEGIN CERTIFICATE----- +MIIDXDCCAsWgAwIBAgICA+swDQYJKoZIhvcNAQEEBQAwgbwxCzAJBgNVBAYTAkRF +MRAwDgYDVQQIEwdIYW1idXJnMRAwDgYDVQQHEwdIYW1idXJnMTowOAYDVQQKEzFU +QyBUcnVzdENlbnRlciBmb3IgU2VjdXJpdHkgaW4gRGF0YSBOZXR3b3JrcyBHbWJI +MSIwIAYDVQQLExlUQyBUcnVzdENlbnRlciBDbGFzcyAzIENBMSkwJwYJKoZIhvcN +AQkBFhpjZXJ0aWZpY2F0ZUB0cnVzdGNlbnRlci5kZTAeFw05ODAzMDkxMTU5NTla +Fw0xMTAxMDExMTU5NTlaMIG8MQswCQYDVQQGEwJERTEQMA4GA1UECBMHSGFtYnVy +ZzEQMA4GA1UEBxMHSGFtYnVyZzE6MDgGA1UEChMxVEMgVHJ1c3RDZW50ZXIgZm9y +IFNlY3VyaXR5IGluIERhdGEgTmV0d29ya3MgR21iSDEiMCAGA1UECxMZVEMgVHJ1 +c3RDZW50ZXIgQ2xhc3MgMyBDQTEpMCcGCSqGSIb3DQEJARYaY2VydGlmaWNhdGVA +dHJ1c3RjZW50ZXIuZGUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALa0wTUF +Lg2N7KBAahwOJ6ZQkmtQGwfeLud2zODa/ISoXoxjaitN2U4CdhHBC/KNecoAtvGw +Dtf7pBc9r6tpepYnv68zoZoqWarEtTcI8hKlMbZD9TKWcSgoq40oht+77uMMfTDW +w1Krj10nnGvAo+cFa1dJRLNu6mTP0o56UHd3AgMBAAGjazBpMA8GA1UdEwEB/wQF +MAMBAf8wDgYDVR0PAQH/BAQDAgGGMDMGCWCGSAGG+EIBCAQmFiRodHRwOi8vd3d3 +LnRydXN0Y2VudGVyLmRlL2d1aWRlbGluZXMwEQYJYIZIAYb4QgEBBAQDAgAHMA0G +CSqGSIb3DQEBBAUAA4GBABY9xs3Bu4VxhUafPiCPUSiZ7C1FIWMjWwS7TJC4iJIE +Tb19AaM/9uzO8d7+feXhPrvGq14L3T2WxMup1Pkm5gZOngylerpuw3yCGdHHsbHD +2w2Om0B8NwvxXej9H5CIpQ5ON2QhqE6NtJ/x3kit1VYYUimLRzQSCdS7kjXvD9s0 +-----END CERTIFICATE----- + +Certum Root CA +============== + +MD5 Fingerprint=2C:8F:9F:66:1D:18:90:B1:47:26:9D:8E:86:82:8C:A9 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 65568 (0x10020) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=PL, O=Unizeto Sp. z o.o., CN=Certum CA + Validity + Not Before: Jun 11 10:46:39 2002 GMT + Not After : Jun 11 10:46:39 2027 GMT + Subject: C=PL, O=Unizeto Sp. z o.o., CN=Certum CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:ce:b1:c1:2e:d3:4f:7c:cd:25:ce:18:3e:4f:c4: + 8c:6f:80:6a:73:c8:5b:51:f8:9b:d2:dc:bb:00:5c: + b1:a0:fc:75:03:ee:81:f0:88:ee:23:52:e9:e6:15: + 33:8d:ac:2d:09:c5:76:f9:2b:39:80:89:e4:97:4b: + 90:a5:a8:78:f8:73:43:7b:a4:61:b0:d8:58:cc:e1: + 6c:66:7e:9c:f3:09:5e:55:63:84:d5:a8:ef:f3:b1: + 2e:30:68:b3:c4:3c:d8:ac:6e:8d:99:5a:90:4e:34: + dc:36:9a:8f:81:88:50:b7:6d:96:42:09:f3:d7:95: + 83:0d:41:4b:b0:6a:6b:f8:fc:0f:7e:62:9f:67:c4: + ed:26:5f:10:26:0f:08:4f:f0:a4:57:28:ce:8f:b8: + ed:45:f6:6e:ee:25:5d:aa:6e:39:be:e4:93:2f:d9: + 47:a0:72:eb:fa:a6:5b:af:ca:53:3f:e2:0e:c6:96: + 56:11:6e:f7:e9:66:a9:26:d8:7f:95:53:ed:0a:85: + 88:ba:4f:29:a5:42:8c:5e:b6:fc:85:20:00:aa:68: + 0b:a1:1a:85:01:9c:c4:46:63:82:88:b6:22:b1:ee: + fe:aa:46:59:7e:cf:35:2c:d5:b6:da:5d:f7:48:33: + 14:54:b6:eb:d9:6f:ce:cd:88:d6:ab:1b:da:96:3b: + 1d:59 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: sha1WithRSAEncryption + b8:8d:ce:ef:e7:14:ba:cf:ee:b0:44:92:6c:b4:39:3e:a2:84: + 6e:ad:b8:21:77:d2:d4:77:82:87:e6:20:41:81:ee:e2:f8:11: + b7:63:d1:17:37:be:19:76:24:1c:04:1a:4c:eb:3d:aa:67:6f: + 2d:d4:cd:fe:65:31:70:c5:1b:a6:02:0a:ba:60:7b:6d:58:c2: + 9a:49:fe:63:32:0b:6b:e3:3a:c0:ac:ab:3b:b0:e8:d3:09:51: + 8c:10:83:c6:34:e0:c5:2b:e0:1a:b6:60:14:27:6c:32:77:8c: + bc:b2:72:98:cf:cd:cc:3f:b9:c8:24:42:14:d6:57:fc:e6:26: + 43:a9:1d:e5:80:90:ce:03:54:28:3e:f7:3f:d3:f8:4d:ed:6a: + 0a:3a:93:13:9b:3b:14:23:13:63:9c:3f:d1:87:27:79:e5:4c: + 51:e3:01:ad:85:5d:1a:3b:b1:d5:73:10:a4:d3:f2:bc:6e:64: + f5:5a:56:90:a8:c7:0e:4c:74:0f:2e:71:3b:f7:c8:47:f4:69: + 6f:15:f2:11:5e:83:1e:9c:7c:52:ae:fd:02:da:12:a8:59:67: + 18:db:bc:70:dd:9b:b1:69:ed:80:ce:89:40:48:6a:0e:35:ca: + 29:66:15:21:94:2c:e8:60:2a:9b:85:4a:40:f3:6b:8a:24:ec: + 06:16:2c:73 +-----BEGIN CERTIFICATE----- +MIIDDDCCAfSgAwIBAgIDAQAgMA0GCSqGSIb3DQEBBQUAMD4xCzAJBgNVBAYTAlBM +MRswGQYDVQQKExJVbml6ZXRvIFNwLiB6IG8uby4xEjAQBgNVBAMTCUNlcnR1bSBD +QTAeFw0wMjA2MTExMDQ2MzlaFw0yNzA2MTExMDQ2MzlaMD4xCzAJBgNVBAYTAlBM +MRswGQYDVQQKExJVbml6ZXRvIFNwLiB6IG8uby4xEjAQBgNVBAMTCUNlcnR1bSBD +QTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM6xwS7TT3zNJc4YPk/E +jG+AanPIW1H4m9LcuwBcsaD8dQPugfCI7iNS6eYVM42sLQnFdvkrOYCJ5JdLkKWo +ePhzQ3ukYbDYWMzhbGZ+nPMJXlVjhNWo7/OxLjBos8Q82KxujZlakE403Daaj4GI +ULdtlkIJ89eVgw1BS7Bqa/j8D35in2fE7SZfECYPCE/wpFcozo+47UX2bu4lXapu +Ob7kky/ZR6By6/qmW6/KUz/iDsaWVhFu9+lmqSbYf5VT7QqFiLpPKaVCjF62/IUg +AKpoC6EahQGcxEZjgoi2IrHu/qpGWX7PNSzVttpd90gzFFS269lvzs2I1qsb2pY7 +HVkCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEA +uI3O7+cUus/usESSbLQ5PqKEbq24IXfS1HeCh+YgQYHu4vgRt2PRFze+GXYkHAQa +TOs9qmdvLdTN/mUxcMUbpgIKumB7bVjCmkn+YzILa+M6wKyrO7Do0wlRjBCDxjTg +xSvgGrZgFCdsMneMvLJymM/NzD+5yCRCFNZX/OYmQ6kd5YCQzgNUKD73P9P4Te1q +CjqTE5s7FCMTY5w/0YcneeVMUeMBrYVdGjux1XMQpNPyvG5k9VpWkKjHDkx0Dy5x +O/fIR/RpbxXyEV6DHpx8Uq79AtoSqFlnGNu8cN2bsWntgM6JQEhqDjXKKWYVIZQs +6GAqm4VKQPNriiTsBhYscw== +-----END CERTIFICATE----- + +Comodo AAA Services root +======================== + +MD5 Fingerprint=49:79:04:B0:EB:87:19:AC:47:B0:BC:11:51:9B:74:D0 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=AAA Certificate Services + Validity + Not Before: Jan 1 00:00:00 2004 GMT + Not After : Dec 31 23:59:59 2028 GMT + Subject: C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=AAA Certificate Services + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:be:40:9d:f4:6e:e1:ea:76:87:1c:4d:45:44:8e: + be:46:c8:83:06:9d:c1:2a:fe:18:1f:8e:e4:02:fa: + f3:ab:5d:50:8a:16:31:0b:9a:06:d0:c5:70:22:cd: + 49:2d:54:63:cc:b6:6e:68:46:0b:53:ea:cb:4c:24: + c0:bc:72:4e:ea:f1:15:ae:f4:54:9a:12:0a:c3:7a: + b2:33:60:e2:da:89:55:f3:22:58:f3:de:dc:cf:ef: + 83:86:a2:8c:94:4f:9f:68:f2:98:90:46:84:27:c7: + 76:bf:e3:cc:35:2c:8b:5e:07:64:65:82:c0:48:b0: + a8:91:f9:61:9f:76:20:50:a8:91:c7:66:b5:eb:78: + 62:03:56:f0:8a:1a:13:ea:31:a3:1e:a0:99:fd:38: + f6:f6:27:32:58:6f:07:f5:6b:b8:fb:14:2b:af:b7: + aa:cc:d6:63:5f:73:8c:da:05:99:a8:38:a8:cb:17: + 78:36:51:ac:e9:9e:f4:78:3a:8d:cf:0f:d9:42:e2: + 98:0c:ab:2f:9f:0e:01:de:ef:9f:99:49:f1:2d:df: + ac:74:4d:1b:98:b5:47:c5:e5:29:d1:f9:90:18:c7: + 62:9c:be:83:c7:26:7b:3e:8a:25:c7:c0:dd:9d:e6: + 35:68:10:20:9d:8f:d8:de:d2:c3:84:9c:0d:5e:e8: + 2f:c9 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + A0:11:0A:23:3E:96:F1:07:EC:E2:AF:29:EF:82:A5:7F:D0:30:A4:B4 + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 CRL Distribution Points: + URI:http://crl.comodoca.com/AAACertificateServices.crl + URI:http://crl.comodo.net/AAACertificateServices.crl + + Signature Algorithm: sha1WithRSAEncryption + 08:56:fc:02:f0:9b:e8:ff:a4:fa:d6:7b:c6:44:80:ce:4f:c4: + c5:f6:00:58:cc:a6:b6:bc:14:49:68:04:76:e8:e6:ee:5d:ec: + 02:0f:60:d6:8d:50:18:4f:26:4e:01:e3:e6:b0:a5:ee:bf:bc: + 74:54:41:bf:fd:fc:12:b8:c7:4f:5a:f4:89:60:05:7f:60:b7: + 05:4a:f3:f6:f1:c2:bf:c4:b9:74:86:b6:2d:7d:6b:cc:d2:f3: + 46:dd:2f:c6:e0:6a:c3:c3:34:03:2c:7d:96:dd:5a:c2:0e:a7: + 0a:99:c1:05:8b:ab:0c:2f:f3:5c:3a:cf:6c:37:55:09:87:de: + 53:40:6c:58:ef:fc:b6:ab:65:6e:04:f6:1b:dc:3c:e0:5a:15: + c6:9e:d9:f1:59:48:30:21:65:03:6c:ec:e9:21:73:ec:9b:03: + a1:e0:37:ad:a0:15:18:8f:fa:ba:02:ce:a7:2c:a9:10:13:2c: + d4:e5:08:26:ab:22:97:60:f8:90:5e:74:d4:a2:9a:53:bd:f2: + a9:68:e0:a2:6e:c2:d7:6c:b1:a3:0f:9e:bf:eb:68:e7:56:f2: + ae:f2:e3:2b:38:3a:09:81:b5:6b:85:d7:be:2d:ed:3f:1a:b7: + b2:63:e2:f5:62:2c:82:d4:6a:00:41:50:f1:39:83:9f:95:e9: + 36:96:98:6e +-----BEGIN CERTIFICATE----- +MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEb +MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow +GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmlj +YXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAwMFoXDTI4MTIzMTIzNTk1OVowezEL +MAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE +BwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNVBAMM +GEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQua +BtDFcCLNSS1UY8y2bmhGC1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe +3M/vg4aijJRPn2jymJBGhCfHdr/jzDUsi14HZGWCwEiwqJH5YZ92IFCokcdmtet4 +YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszWY19zjNoFmag4qMsXeDZR +rOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjHYpy+g8cm +ez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQU +oBEKIz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF +MAMBAf8wewYDVR0fBHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20v +QUFBQ2VydGlmaWNhdGVTZXJ2aWNlcy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29t +b2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2VzLmNybDANBgkqhkiG9w0BAQUF +AAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm7l3sAg9g1o1Q +GE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz +Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2 +G9w84FoVxp7Z8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsi +l2D4kF501KKaU73yqWjgom7C12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3 +smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg== +-----END CERTIFICATE----- + +Comodo Secure Services root +=========================== + +MD5 Fingerprint=D3:D9:BD:AE:9F:AC:67:24:B3:C8:1B:52:E1:B9:A9:BD +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=Secure Certificate Services + Validity + Not Before: Jan 1 00:00:00 2004 GMT + Not After : Dec 31 23:59:59 2028 GMT + Subject: C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=Secure Certificate Services + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:c0:71:33:82:8a:d0:70:eb:73:87:82:40:d5:1d: + e4:cb:c9:0e:42:90:f9:de:34:b9:a1:ba:11:f4:25: + 85:f3:cc:72:6d:f2:7b:97:6b:b3:07:f1:77:24:91: + 5f:25:8f:f6:74:3d:e4:80:c2:f8:3c:0d:f3:bf:40: + ea:f7:c8:52:d1:72:6f:ef:c8:ab:41:b8:6e:2e:17: + 2a:95:69:0c:cd:d2:1e:94:7b:2d:94:1d:aa:75:d7: + b3:98:cb:ac:bc:64:53:40:bc:8f:ac:ac:36:cb:5c: + ad:bb:dd:e0:94:17:ec:d1:5c:d0:bf:ef:a5:95:c9: + 90:c5:b0:ac:fb:1b:43:df:7a:08:5d:b7:b8:f2:40: + 1b:2b:27:9e:50:ce:5e:65:82:88:8c:5e:d3:4e:0c: + 7a:ea:08:91:b6:36:aa:2b:42:fb:ea:c2:a3:39:e5: + db:26:38:ad:8b:0a:ee:19:63:c7:1c:24:df:03:78: + da:e6:ea:c1:47:1a:0b:0b:46:09:dd:02:fc:de:cb: + 87:5f:d7:30:63:68:a1:ae:dc:32:a1:ba:be:fe:44: + ab:68:b6:a5:17:15:fd:bd:d5:a7:a7:9a:e4:44:33: + e9:88:8e:fc:ed:51:eb:93:71:4e:ad:01:e7:44:8e: + ab:2d:cb:a8:fe:01:49:48:f0:c0:dd:c7:68:d8:92: + fe:3d + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + 3C:D8:93:88:C2:C0:82:09:CC:01:99:06:93:20:E9:9E:70:09:63:4F + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 CRL Distribution Points: + URI:http://crl.comodoca.com/SecureCertificateServices.crl + URI:http://crl.comodo.net/SecureCertificateServices.crl + + Signature Algorithm: sha1WithRSAEncryption + 87:01:6d:23:1d:7e:5b:17:7d:c1:61:32:cf:8f:e7:f3:8a:94: + 59:66:e0:9e:28:a8:5e:d3:b7:f4:34:e6:aa:39:b2:97:16:c5: + 82:6f:32:a4:e9:8c:e7:af:fd:ef:c2:e8:b9:4b:aa:a3:f4:e6: + da:8d:65:21:fb:ba:80:eb:26:28:85:1a:fe:39:8c:de:5b:04: + 04:b4:54:f9:a3:67:9e:41:fa:09:52:cc:05:48:a8:c9:3f:21: + 04:1e:ce:48:6b:fc:85:e8:c2:7b:af:7f:b7:cc:f8:5f:3a:fd: + 35:c6:0d:ef:97:dc:4c:ab:11:e1:6b:cb:31:d1:6c:fb:48:80: + ab:dc:9c:37:b8:21:14:4b:0d:71:3d:ec:83:33:6e:d1:6e:32: + 16:ec:98:c7:16:8b:59:a6:34:ab:05:57:2d:93:f7:aa:13:cb: + d2:13:e2:b7:2e:3b:cd:6b:50:17:09:68:3e:b5:26:57:ee:b6: + e0:b6:dd:b9:29:80:79:7d:8f:a3:f0:a4:28:a4:15:c4:85:f4: + 27:d4:6b:bf:e5:5c:e4:65:02:76:54:b4:e3:37:66:24:d3:19: + 61:c8:52:10:e5:8b:37:9a:b9:a9:f9:1d:bf:ea:99:92:61:96: + ff:01:cd:a1:5f:0d:bc:71:bc:0e:ac:0b:1d:47:45:1d:c1:ec: + 7c:ec:fd:29 +-----BEGIN CERTIFICATE----- +MIIEPzCCAyegAwIBAgIBATANBgkqhkiG9w0BAQUFADB+MQswCQYDVQQGEwJHQjEb +MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow +GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEkMCIGA1UEAwwbU2VjdXJlIENlcnRp +ZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAwMFoXDTI4MTIzMTIzNTk1OVow +fjELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G +A1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxJDAiBgNV +BAMMG1NlY3VyZSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEB +BQADggEPADCCAQoCggEBAMBxM4KK0HDrc4eCQNUd5MvJDkKQ+d40uaG6EfQlhfPM +cm3ye5drswfxdySRXyWP9nQ95IDC+DwN879A6vfIUtFyb+/Iq0G4bi4XKpVpDM3S +HpR7LZQdqnXXs5jLrLxkU0C8j6ysNstcrbvd4JQX7NFc0L/vpZXJkMWwrPsbQ996 +CF23uPJAGysnnlDOXmWCiIxe004MeuoIkbY2qitC++rCoznl2yY4rYsK7hljxxwk +3wN42ubqwUcaCwtGCd0C/N7Lh1/XMGNooa7cMqG6vv5Eq2i2pRcV/b3Vp6ea5EQz +6YiO/O1R65NxTq0B50SOqy3LqP4BSUjwwN3HaNiS/j0CAwEAAaOBxzCBxDAdBgNV +HQ4EFgQUPNiTiMLAggnMAZkGkyDpnnAJY08wDgYDVR0PAQH/BAQDAgEGMA8GA1Ud +EwEB/wQFMAMBAf8wgYEGA1UdHwR6MHgwO6A5oDeGNWh0dHA6Ly9jcmwuY29tb2Rv +Y2EuY29tL1NlY3VyZUNlcnRpZmljYXRlU2VydmljZXMuY3JsMDmgN6A1hjNodHRw +Oi8vY3JsLmNvbW9kby5uZXQvU2VjdXJlQ2VydGlmaWNhdGVTZXJ2aWNlcy5jcmww +DQYJKoZIhvcNAQEFBQADggEBAIcBbSMdflsXfcFhMs+P5/OKlFlm4J4oqF7Tt/Q0 +5qo5spcWxYJvMqTpjOev/e/C6LlLqqP05tqNZSH7uoDrJiiFGv45jN5bBAS0VPmj +Z55B+glSzAVIqMk/IQQezkhr/IXownuvf7fM+F86/TXGDe+X3EyrEeFryzHRbPtI +gKvcnDe4IRRLDXE97IMzbtFuMhbsmMcWi1mmNKsFVy2T96oTy9IT4rcuO81rUBcJ +aD61JlfutuC23bkpgHl9j6PwpCikFcSF9CfUa7/lXORlAnZUtOM3ZiTTGWHIUhDl +izeauan5Hb/qmZJhlv8BzaFfDbxxvA6sCx1HRR3B7Hzs/Sk= +-----END CERTIFICATE----- + +Comodo Trusted Services root +============================ + +MD5 Fingerprint=91:1B:3F:6E:CD:9E:AB:EE:07:FE:1F:71:D2:B3:61:27 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=Trusted Certificate Services + Validity + Not Before: Jan 1 00:00:00 2004 GMT + Not After : Dec 31 23:59:59 2028 GMT + Subject: C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=Trusted Certificate Services + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:df:71:6f:36:58:53:5a:f2:36:54:57:80:c4:74: + 08:20:ed:18:7f:2a:1d:e6:35:9a:1e:25:ac:9c:e5: + 96:7e:72:52:a0:15:42:db:59:dd:64:7a:1a:d0:b8: + 7b:dd:39:15:bc:55:48:c4:ed:3a:00:ea:31:11:ba: + f2:71:74:1a:67:b8:cf:33:cc:a8:31:af:a3:e3:d7: + 7f:bf:33:2d:4c:6a:3c:ec:8b:c3:92:d2:53:77:24: + 74:9c:07:6e:70:fc:bd:0b:5b:76:ba:5f:f2:ff:d7: + 37:4b:4a:60:78:f7:f0:fa:ca:70:b4:ea:59:aa:a3: + ce:48:2f:a9:c3:b2:0b:7e:17:72:16:0c:a6:07:0c: + 1b:38:cf:c9:62:b7:3f:a0:93:a5:87:41:f2:b7:70: + 40:77:d8:be:14:7c:e3:a8:c0:7a:8e:e9:63:6a:d1: + 0f:9a:c6:d2:f4:8b:3a:14:04:56:d4:ed:b8:cc:6e: + f5:fb:e2:2c:58:bd:7f:4f:6b:2b:f7:60:24:58:24: + ce:26:ef:34:91:3a:d5:e3:81:d0:b2:f0:04:02:d7: + 5b:b7:3e:92:ac:6b:12:8a:f9:e4:05:b0:3b:91:49: + 5c:b2:eb:53:ea:f8:9f:47:86:ee:bf:95:c0:c0:06: + 9f:d2:5b:5e:11:1b:f4:c7:04:35:29:d2:55:5c:e4: + ed:eb + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + C5:7B:58:BD:ED:DA:25:69:D2:F7:59:16:A8:B3:32:C0:7B:27:5B:F4 + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 CRL Distribution Points: + URI:http://crl.comodoca.com/TrustedCertificateServices.crl + URI:http://crl.comodo.net/TrustedCertificateServices.crl + + Signature Algorithm: sha1WithRSAEncryption + c8:93:81:3b:89:b4:af:b8:84:12:4c:8d:d2:f0:db:70:ba:57: + 86:15:34:10:b9:2f:7f:1e:b0:a8:89:60:a1:8a:c2:77:0c:50: + 4a:9b:00:8b:d8:8b:f4:41:e2:d0:83:8a:4a:1c:14:06:b0:a3: + 68:05:70:31:30:a7:53:9b:0e:e9:4a:a0:58:69:67:0e:ae:9d: + f6:a5:2c:41:bf:3c:06:6b:e4:59:cc:6d:10:f1:96:6f:1f:df: + f4:04:02:a4:9f:45:3e:c8:d8:fa:36:46:44:50:3f:82:97:91: + 1f:28:db:18:11:8c:2a:e4:65:83:57:12:12:8c:17:3f:94:36: + fe:5d:b0:c0:04:77:13:b8:f4:15:d5:3f:38:cc:94:3a:55:d0: + ac:98:f5:ba:00:5f:e0:86:19:81:78:2f:28:c0:7e:d3:cc:42: + 0a:f5:ae:50:a0:d1:3e:c6:a1:71:ec:3f:a0:20:8c:66:3a:89: + b4:8e:d4:d8:b1:4d:25:47:ee:2f:88:c8:b5:e1:05:45:c0:be: + 14:71:de:7a:fd:8e:7b:7d:4d:08:96:a5:12:73:f0:2d:ca:37: + 27:74:12:27:4c:cb:b6:97:e9:d9:ae:08:6d:5a:39:40:dd:05: + 47:75:6a:5a:21:b3:a3:18:cf:4e:f7:2e:57:b7:98:70:5e:c8: + c4:78:b0:62 +-----BEGIN CERTIFICATE----- +MIIEQzCCAyugAwIBAgIBATANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJHQjEb +MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow +GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDElMCMGA1UEAwwcVHJ1c3RlZCBDZXJ0 +aWZpY2F0ZSBTZXJ2aWNlczAeFw0wNDAxMDEwMDAwMDBaFw0yODEyMzEyMzU5NTla +MH8xCzAJBgNVBAYTAkdCMRswGQYDVQQIDBJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAO +BgNVBAcMB1NhbGZvcmQxGjAYBgNVBAoMEUNvbW9kbyBDQSBMaW1pdGVkMSUwIwYD +VQQDDBxUcnVzdGVkIENlcnRpZmljYXRlIFNlcnZpY2VzMIIBIjANBgkqhkiG9w0B +AQEFAAOCAQ8AMIIBCgKCAQEA33FvNlhTWvI2VFeAxHQIIO0Yfyod5jWaHiWsnOWW +fnJSoBVC21ndZHoa0Lh73TkVvFVIxO06AOoxEbrycXQaZ7jPM8yoMa+j49d/vzMt +TGo87IvDktJTdyR0nAducPy9C1t2ul/y/9c3S0pgePfw+spwtOpZqqPOSC+pw7IL +fhdyFgymBwwbOM/JYrc/oJOlh0Hyt3BAd9i+FHzjqMB6juljatEPmsbS9Is6FARW +1O24zG71++IsWL1/T2sr92AkWCTOJu80kTrV44HQsvAEAtdbtz6SrGsSivnkBbA7 +kUlcsutT6vifR4buv5XAwAaf0lteERv0xwQ1KdJVXOTt6wIDAQABo4HJMIHGMB0G +A1UdDgQWBBTFe1i97doladL3WRaoszLAeydb9DAOBgNVHQ8BAf8EBAMCAQYwDwYD +VR0TAQH/BAUwAwEB/zCBgwYDVR0fBHwwejA8oDqgOIY2aHR0cDovL2NybC5jb21v +ZG9jYS5jb20vVHJ1c3RlZENlcnRpZmljYXRlU2VydmljZXMuY3JsMDqgOKA2hjRo +dHRwOi8vY3JsLmNvbW9kby5uZXQvVHJ1c3RlZENlcnRpZmljYXRlU2VydmljZXMu +Y3JsMA0GCSqGSIb3DQEBBQUAA4IBAQDIk4E7ibSvuIQSTI3S8NtwuleGFTQQuS9/ +HrCoiWChisJ3DFBKmwCL2Iv0QeLQg4pKHBQGsKNoBXAxMKdTmw7pSqBYaWcOrp32 +pSxBvzwGa+RZzG0Q8ZZvH9/0BAKkn0U+yNj6NkZEUD+Cl5EfKNsYEYwq5GWDVxIS +jBc/lDb+XbDABHcTuPQV1T84zJQ6VdCsmPW6AF/ghhmBeC8owH7TzEIK9a5QoNE+ +xqFx7D+gIIxmOom0jtTYsU0lR+4viMi14QVFwL4Ucd56/Y57fU0IlqUSc/Atyjcn +dBInTMu2l+nZrghtWjlA3QVHdWpaIbOjGM9O9y5Xt5hwXsjEeLBi +-----END CERTIFICATE----- + +Thawte Server CA +================ + +MD5 Fingerprint=C5:70:C4:A2:ED:53:78:0C:C8:10:53:81:64:CB:D0:1D +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc, OU=Certification Services Division, CN=Thawte Server CA/emailAddress=server-certs@thawte.com + Validity + Not Before: Aug 1 00:00:00 1996 GMT + Not After : Dec 31 23:59:59 2020 GMT + Subject: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc, OU=Certification Services Division, CN=Thawte Server CA/emailAddress=server-certs@thawte.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:d3:a4:50:6e:c8:ff:56:6b:e6:cf:5d:b6:ea:0c: + 68:75:47:a2:aa:c2:da:84:25:fc:a8:f4:47:51:da: + 85:b5:20:74:94:86:1e:0f:75:c9:e9:08:61:f5:06: + 6d:30:6e:15:19:02:e9:52:c0:62:db:4d:99:9e:e2: + 6a:0c:44:38:cd:fe:be:e3:64:09:70:c5:fe:b1:6b: + 29:b6:2f:49:c8:3b:d4:27:04:25:10:97:2f:e7:90: + 6d:c0:28:42:99:d7:4c:43:de:c3:f5:21:6d:54:9f: + 5d:c3:58:e1:c0:e4:d9:5b:b0:b8:dc:b4:7b:df:36: + 3a:c2:b5:66:22:12:d6:87:0d + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: md5WithRSAEncryption + 07:fa:4c:69:5c:fb:95:cc:46:ee:85:83:4d:21:30:8e:ca:d9: + a8:6f:49:1a:e6:da:51:e3:60:70:6c:84:61:11:a1:1a:c8:48: + 3e:59:43:7d:4f:95:3d:a1:8b:b7:0b:62:98:7a:75:8a:dd:88: + 4e:4e:9e:40:db:a8:cc:32:74:b9:6f:0d:c6:e3:b3:44:0b:d9: + 8a:6f:9a:29:9b:99:18:28:3b:d1:e3:40:28:9a:5a:3c:d5:b5: + e7:20:1b:8b:ca:a4:ab:8d:e9:51:d9:e2:4c:2c:59:a9:da:b9: + b2:75:1b:f6:42:f2:ef:c7:f2:18:f9:89:bc:a3:ff:8a:23:2e: + 70:47 +-----BEGIN CERTIFICATE----- +MIIDEzCCAnygAwIBAgIBATANBgkqhkiG9w0BAQQFADCBxDELMAkGA1UEBhMCWkEx +FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYD +VQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlv +biBTZXJ2aWNlcyBEaXZpc2lvbjEZMBcGA1UEAxMQVGhhd3RlIFNlcnZlciBDQTEm +MCQGCSqGSIb3DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0ZS5jb20wHhcNOTYwODAx +MDAwMDAwWhcNMjAxMjMxMjM1OTU5WjCBxDELMAkGA1UEBhMCWkExFTATBgNVBAgT +DFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3 +dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNl +cyBEaXZpc2lvbjEZMBcGA1UEAxMQVGhhd3RlIFNlcnZlciBDQTEmMCQGCSqGSIb3 +DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0ZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQAD +gY0AMIGJAoGBANOkUG7I/1Zr5s9dtuoMaHVHoqrC2oQl/Kj0R1HahbUgdJSGHg91 +yekIYfUGbTBuFRkC6VLAYttNmZ7iagxEOM3+vuNkCXDF/rFrKbYvScg71CcEJRCX +L+eQbcAoQpnXTEPew/UhbVSfXcNY4cDk2VuwuNy0e982OsK1ZiIS1ocNAgMBAAGj +EzARMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAB/pMaVz7lcxG +7oWDTSEwjsrZqG9JGubaUeNgcGyEYRGhGshIPllDfU+VPaGLtwtimHp1it2ITk6e +QNuozDJ0uW8NxuOzRAvZim+aKZuZGCg70eNAKJpaPNW15yAbi8qkq43pUdniTCxZ +qdq5snUb9kLy78fyGPmJvKP/iiMucEc= +-----END CERTIFICATE----- + +IPS Chained CAs root +==================== + +MD5 Fingerprint=8D:72:51:DB:A0:3A:CF:20:77:DF:F2:65:06:5E:DF:EF +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA Chained CAs Certification Authority, CN=IPS CA Chained CAs Certification Authority/emailAddress=ips@mail.ips.es + Validity + Not Before: Dec 29 00:53:58 2001 GMT + Not After : Dec 27 00:53:58 2025 GMT + Subject: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA Chained CAs Certification Authority, CN=IPS CA Chained CAs Certification Authority/emailAddress=ips@mail.ips.es + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:dc:56:92:49:b2:94:20:bc:98:4f:50:eb:68:a4: + a7:49:0b:bf:d2:31:e8:c7:4f:c2:86:0b:fa:68:fd: + 43:5a:8a:f3:60:92:35:99:38:bb:4d:03:52:21:5b: + f0:37:99:35:e1:41:20:81:85:81:05:71:81:9d:b4: + 95:19:a9:5f:76:34:2e:63:37:35:57:8e:b4:1f:42: + 3f:15:5c:e1:7a:c1:5f:13:18:32:31:c9:ad:be:a3: + c7:83:66:1e:b9:9c:04:13:cb:69:c1:06:de:30:06: + bb:33:a3:b5:1f:f0:8f:6f:ce:ff:96:e8:54:be:66: + 80:ae:6b:db:41:84:36:a2:3d + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + A1:AD:31:B1:F9:3E:E1:17:A6:C8:AB:34:FC:52:87:09:1E:62:52:41 + X509v3 Authority Key Identifier: + keyid:A1:AD:31:B1:F9:3E:E1:17:A6:C8:AB:34:FC:52:87:09:1E:62:52:41 + DirName:/C=ES/ST=Barcelona/L=Barcelona/O=IPS Internet publishing Services s.l./O=ips@mail.ips.es C.I.F. B-60929452/OU=IPS CA Chained CAs Certification Authority/CN=IPS CA Chained CAs Certification Authority/emailAddress=ips@mail.ips.es + serial:00 + + X509v3 Basic Constraints: + CA:TRUE + X509v3 Key Usage: + Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment, Key Agreement, Certificate Sign, CRL Sign, Encipher Only, Decipher Only + X509v3 Extended Key Usage: + TLS Web Server Authentication, TLS Web Client Authentication, Code Signing, E-mail Protection, Time Stamping, Microsoft Individual Code Signing, Microsoft Commercial Code Signing, Microsoft Trust List Signing, Microsoft Encrypted File System + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Subject Alternative Name: + email:ips@mail.ips.es + X509v3 Issuer Alternative Name: + email:ips@mail.ips.es + Netscape Comment: + Chained CA Certificate issued by http://www.ips.es/ + Netscape Base Url: + http://www.ips.es/ips2002/ + Netscape CA Revocation Url: + http://www.ips.es/ips2002/ips2002CAC.crl + Netscape Revocation Url: + http://www.ips.es/ips2002/revocationCAC.html? + Netscape Renewal Url: + http://www.ips.es/ips2002/renewalCAC.html? + Netscape CA Policy Url: + http://www.ips.es/ips2002/policyCAC.html + X509v3 CRL Distribution Points: + URI:http://www.ips.es/ips2002/ips2002CAC.crl + URI:http://wwwback.ips.es/ips2002/ips2002CAC.crl + + Authority Information Access: + OCSP - URI:http://ocsp.ips.es/ + + Signature Algorithm: sha1WithRSAEncryption + 44:72:30:9d:56:58:a2:41:1b:28:b7:95:e1:a6:1a:95:5f:a7: + 78:40:2b:ef:db:96:4a:fc:4c:71:63:d9:73:95:bd:02:e2:a2: + 06:c7:be:97:2a:93:80:34:86:03:fa:dc:d8:3d:1e:07:cd:1e: + 73:43:24:60:f5:1d:61:dc:dc:96:a0:bc:fb:1d:e3:e7:12:00: + 27:33:02:c0:c0:2b:53:3d:d8:6b:03:81:a3:db:d6:93:95:20: + ef:d3:96:7e:26:90:89:9c:26:9b:cd:6f:66:ab:ed:03:22:44: + 38:cc:59:bd:9f:db:f6:07:a2:01:7f:26:c4:63:f5:25:42:5e: + 62:bd +-----BEGIN CERTIFICATE----- +MIIH9zCCB2CgAwIBAgIBADANBgkqhkiG9w0BAQUFADCCARwxCzAJBgNVBAYTAkVT +MRIwEAYDVQQIEwlCYXJjZWxvbmExEjAQBgNVBAcTCUJhcmNlbG9uYTEuMCwGA1UE +ChMlSVBTIEludGVybmV0IHB1Ymxpc2hpbmcgU2VydmljZXMgcy5sLjErMCkGA1UE +ChQiaXBzQG1haWwuaXBzLmVzIEMuSS5GLiAgQi02MDkyOTQ1MjEzMDEGA1UECxMq +SVBTIENBIENoYWluZWQgQ0FzIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MTMwMQYD +VQQDEypJUFMgQ0EgQ2hhaW5lZCBDQXMgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkx +HjAcBgkqhkiG9w0BCQEWD2lwc0BtYWlsLmlwcy5lczAeFw0wMTEyMjkwMDUzNTha +Fw0yNTEyMjcwMDUzNThaMIIBHDELMAkGA1UEBhMCRVMxEjAQBgNVBAgTCUJhcmNl +bG9uYTESMBAGA1UEBxMJQmFyY2Vsb25hMS4wLAYDVQQKEyVJUFMgSW50ZXJuZXQg +cHVibGlzaGluZyBTZXJ2aWNlcyBzLmwuMSswKQYDVQQKFCJpcHNAbWFpbC5pcHMu +ZXMgQy5JLkYuICBCLTYwOTI5NDUyMTMwMQYDVQQLEypJUFMgQ0EgQ2hhaW5lZCBD +QXMgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxMzAxBgNVBAMTKklQUyBDQSBDaGFp +bmVkIENBcyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEeMBwGCSqGSIb3DQEJARYP +aXBzQG1haWwuaXBzLmVzMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDcVpJJ +spQgvJhPUOtopKdJC7/SMejHT8KGC/po/UNaivNgkjWZOLtNA1IhW/A3mTXhQSCB +hYEFcYGdtJUZqV92NC5jNzVXjrQfQj8VXOF6wV8TGDIxya2+o8eDZh65nAQTy2nB +Bt4wBrszo7Uf8I9vzv+W6FS+ZoCua9tBhDaiPQIDAQABo4IEQzCCBD8wHQYDVR0O +BBYEFKGtMbH5PuEXpsirNPxShwkeYlJBMIIBTgYDVR0jBIIBRTCCAUGAFKGtMbH5 +PuEXpsirNPxShwkeYlJBoYIBJKSCASAwggEcMQswCQYDVQQGEwJFUzESMBAGA1UE +CBMJQmFyY2Vsb25hMRIwEAYDVQQHEwlCYXJjZWxvbmExLjAsBgNVBAoTJUlQUyBJ +bnRlcm5ldCBwdWJsaXNoaW5nIFNlcnZpY2VzIHMubC4xKzApBgNVBAoUImlwc0Bt +YWlsLmlwcy5lcyBDLkkuRi4gIEItNjA5Mjk0NTIxMzAxBgNVBAsTKklQUyBDQSBD +aGFpbmVkIENBcyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEzMDEGA1UEAxMqSVBT +IENBIENoYWluZWQgQ0FzIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MR4wHAYJKoZI +hvcNAQkBFg9pcHNAbWFpbC5pcHMuZXOCAQAwDAYDVR0TBAUwAwEB/zAMBgNVHQ8E +BQMDB/+AMGsGA1UdJQRkMGIGCCsGAQUFBwMBBggrBgEFBQcDAgYIKwYBBQUHAwMG +CCsGAQUFBwMEBggrBgEFBQcDCAYKKwYBBAGCNwIBFQYKKwYBBAGCNwIBFgYKKwYB +BAGCNwoDAQYKKwYBBAGCNwoDBDARBglghkgBhvhCAQEEBAMCAAcwGgYDVR0RBBMw +EYEPaXBzQG1haWwuaXBzLmVzMBoGA1UdEgQTMBGBD2lwc0BtYWlsLmlwcy5lczBC +BglghkgBhvhCAQ0ENRYzQ2hhaW5lZCBDQSBDZXJ0aWZpY2F0ZSBpc3N1ZWQgYnkg +aHR0cDovL3d3dy5pcHMuZXMvMCkGCWCGSAGG+EIBAgQcFhpodHRwOi8vd3d3Lmlw +cy5lcy9pcHMyMDAyLzA3BglghkgBhvhCAQQEKhYoaHR0cDovL3d3dy5pcHMuZXMv +aXBzMjAwMi9pcHMyMDAyQ0FDLmNybDA8BglghkgBhvhCAQMELxYtaHR0cDovL3d3 +dy5pcHMuZXMvaXBzMjAwMi9yZXZvY2F0aW9uQ0FDLmh0bWw/MDkGCWCGSAGG+EIB +BwQsFipodHRwOi8vd3d3Lmlwcy5lcy9pcHMyMDAyL3JlbmV3YWxDQUMuaHRtbD8w +NwYJYIZIAYb4QgEIBCoWKGh0dHA6Ly93d3cuaXBzLmVzL2lwczIwMDIvcG9saWN5 +Q0FDLmh0bWwwbQYDVR0fBGYwZDAuoCygKoYoaHR0cDovL3d3dy5pcHMuZXMvaXBz +MjAwMi9pcHMyMDAyQ0FDLmNybDAyoDCgLoYsaHR0cDovL3d3d2JhY2suaXBzLmVz +L2lwczIwMDIvaXBzMjAwMkNBQy5jcmwwLwYIKwYBBQUHAQEEIzAhMB8GCCsGAQUF +BzABhhNodHRwOi8vb2NzcC5pcHMuZXMvMA0GCSqGSIb3DQEBBQUAA4GBAERyMJ1W +WKJBGyi3leGmGpVfp3hAK+/blkr8THFj2XOVvQLiogbHvpcqk4A0hgP63Ng9HgfN +HnNDJGD1HWHc3JagvPsd4+cSACczAsDAK1M92GsDgaPb1pOVIO/Tln4mkImcJpvN +b2ar7QMiRDjMWb2f2/YHogF/JsRj9SVCXmK9 +-----END CERTIFICATE----- + +IPS CLASE1 root +=============== + +MD5 Fingerprint=84:90:1D:95:30:49:56:FC:41:81:F0:45:D7:76:C4:6B +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA CLASE1 Certification Authority, CN=IPS CA CLASE1 Certification Authority/emailAddress=ips@mail.ips.es + Validity + Not Before: Dec 29 00:59:38 2001 GMT + Not After : Dec 27 00:59:38 2025 GMT + Subject: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA CLASE1 Certification Authority, CN=IPS CA CLASE1 Certification Authority/emailAddress=ips@mail.ips.es + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:e0:51:27:a7:0b:dd:af:d1:b9:43:5b:82:37:45: + 56:72:ef:9a:b6:c2:12:ef:2c:12:cc:76:f9:06:59: + af:5d:21:d4:d2:5a:b8:a0:d4:f3:6a:fd:ca:69:8d: + 66:48:f7:74:e6:ee:36:bd:e8:96:91:75:a6:71:28: + ca:e7:22:12:32:69:b0:3e:1e:6b:f4:50:52:62:62: + fd:63:3b:7d:7e:ec:ee:38:ea:62:f4:6c:a8:71:8d: + e1:e9:8b:c9:3f:c6:b5:cd:94:42:6f:dd:82:45:3c: + e8:df:09:e8:ef:0a:55:a9:56:47:61:4c:49:64:73: + 10:28:3f:ca:bf:09:ff:c6:2f + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + EB:B3:19:79:F3:C1:A5:1C:AC:DC:BA:1F:66:A2:B2:9B:69:D0:78:08 + X509v3 Authority Key Identifier: + keyid:EB:B3:19:79:F3:C1:A5:1C:AC:DC:BA:1F:66:A2:B2:9B:69:D0:78:08 + DirName:/C=ES/ST=Barcelona/L=Barcelona/O=IPS Internet publishing Services s.l./O=ips@mail.ips.es C.I.F. B-60929452/OU=IPS CA CLASE1 Certification Authority/CN=IPS CA CLASE1 Certification Authority/emailAddress=ips@mail.ips.es + serial:00 + + X509v3 Basic Constraints: + CA:TRUE + X509v3 Key Usage: + Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment, Key Agreement, Certificate Sign, CRL Sign, Encipher Only, Decipher Only + X509v3 Extended Key Usage: + TLS Web Server Authentication, TLS Web Client Authentication, Code Signing, E-mail Protection, Time Stamping, Microsoft Individual Code Signing, Microsoft Commercial Code Signing, Microsoft Trust List Signing, Microsoft Encrypted File System + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Subject Alternative Name: + email:ips@mail.ips.es + X509v3 Issuer Alternative Name: + email:ips@mail.ips.es + Netscape Comment: + CLASE1 CA Certificate issued by http://www.ips.es/ + Netscape Base Url: + http://www.ips.es/ips2002/ + Netscape CA Revocation Url: + http://www.ips.es/ips2002/ips2002CLASE1.crl + Netscape Revocation Url: + http://www.ips.es/ips2002/revocationCLASE1.html? + Netscape Renewal Url: + http://www.ips.es/ips2002/renewalCLASE1.html? + Netscape CA Policy Url: + http://www.ips.es/ips2002/policyCLASE1.html + X509v3 CRL Distribution Points: + URI:http://www.ips.es/ips2002/ips2002CLASE1.crl + URI:http://wwwback.ips.es/ips2002/ips2002CLASE1.crl + + Authority Information Access: + OCSP - URI:http://ocsp.ips.es/ + + Signature Algorithm: sha1WithRSAEncryption + 2b:d0:eb:fd:da:c8:ca:59:6a:da:d3:cc:32:2e:c9:54:1b:8a: + 62:7e:15:2d:e9:d9:31:d3:2e:f4:27:23:ff:5b:ab:c5:4a:b6: + 72:40:ae:53:74:f4:bc:05:b4:c6:d9:c8:c9:77:fb:b7:f9:34: + 7f:78:00:f8:d6:a4:e4:52:3f:2c:4a:63:57:81:75:5a:8e:e8: + 8c:fb:02:c0:94:c6:29:ba:b3:dc:1c:e8:b2:af:d2:2e:62:5b: + 1a:a9:8e:0e:cc:c5:57:45:51:14:e9:4e:1c:88:a5:91:f4:a3: + f7:8e:51:c8:a9:be:86:33:3e:e6:2f:48:6e:af:54:90:4e:ad: + b1:25 +-----BEGIN CERTIFICATE----- +MIIH6jCCB1OgAwIBAgIBADANBgkqhkiG9w0BAQUFADCCARIxCzAJBgNVBAYTAkVT +MRIwEAYDVQQIEwlCYXJjZWxvbmExEjAQBgNVBAcTCUJhcmNlbG9uYTEuMCwGA1UE +ChMlSVBTIEludGVybmV0IHB1Ymxpc2hpbmcgU2VydmljZXMgcy5sLjErMCkGA1UE +ChQiaXBzQG1haWwuaXBzLmVzIEMuSS5GLiAgQi02MDkyOTQ1MjEuMCwGA1UECxMl +SVBTIENBIENMQVNFMSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEuMCwGA1UEAxMl +SVBTIENBIENMQVNFMSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEeMBwGCSqGSIb3 +DQEJARYPaXBzQG1haWwuaXBzLmVzMB4XDTAxMTIyOTAwNTkzOFoXDTI1MTIyNzAw +NTkzOFowggESMQswCQYDVQQGEwJFUzESMBAGA1UECBMJQmFyY2Vsb25hMRIwEAYD +VQQHEwlCYXJjZWxvbmExLjAsBgNVBAoTJUlQUyBJbnRlcm5ldCBwdWJsaXNoaW5n +IFNlcnZpY2VzIHMubC4xKzApBgNVBAoUImlwc0BtYWlsLmlwcy5lcyBDLkkuRi4g +IEItNjA5Mjk0NTIxLjAsBgNVBAsTJUlQUyBDQSBDTEFTRTEgQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkxLjAsBgNVBAMTJUlQUyBDQSBDTEFTRTEgQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkxHjAcBgkqhkiG9w0BCQEWD2lwc0BtYWlsLmlwcy5lczCBnzAN +BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA4FEnpwvdr9G5Q1uCN0VWcu+atsIS7ywS +zHb5BlmvXSHU0lq4oNTzav3KaY1mSPd05u42veiWkXWmcSjK5yISMmmwPh5r9FBS +YmL9Yzt9fuzuOOpi9GyocY3h6YvJP8a1zZRCb92CRTzo3wno7wpVqVZHYUxJZHMQ +KD/Kvwn/xi8CAwEAAaOCBEowggRGMB0GA1UdDgQWBBTrsxl588GlHKzcuh9morKb +adB4CDCCAUQGA1UdIwSCATswggE3gBTrsxl588GlHKzcuh9morKbadB4CKGCARqk +ggEWMIIBEjELMAkGA1UEBhMCRVMxEjAQBgNVBAgTCUJhcmNlbG9uYTESMBAGA1UE +BxMJQmFyY2Vsb25hMS4wLAYDVQQKEyVJUFMgSW50ZXJuZXQgcHVibGlzaGluZyBT +ZXJ2aWNlcyBzLmwuMSswKQYDVQQKFCJpcHNAbWFpbC5pcHMuZXMgQy5JLkYuICBC +LTYwOTI5NDUyMS4wLAYDVQQLEyVJUFMgQ0EgQ0xBU0UxIENlcnRpZmljYXRpb24g +QXV0aG9yaXR5MS4wLAYDVQQDEyVJUFMgQ0EgQ0xBU0UxIENlcnRpZmljYXRpb24g +QXV0aG9yaXR5MR4wHAYJKoZIhvcNAQkBFg9pcHNAbWFpbC5pcHMuZXOCAQAwDAYD +VR0TBAUwAwEB/zAMBgNVHQ8EBQMDB/+AMGsGA1UdJQRkMGIGCCsGAQUFBwMBBggr +BgEFBQcDAgYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEFBQcDCAYKKwYBBAGCNwIB +FQYKKwYBBAGCNwIBFgYKKwYBBAGCNwoDAQYKKwYBBAGCNwoDBDARBglghkgBhvhC +AQEEBAMCAAcwGgYDVR0RBBMwEYEPaXBzQG1haWwuaXBzLmVzMBoGA1UdEgQTMBGB +D2lwc0BtYWlsLmlwcy5lczBBBglghkgBhvhCAQ0ENBYyQ0xBU0UxIENBIENlcnRp +ZmljYXRlIGlzc3VlZCBieSBodHRwOi8vd3d3Lmlwcy5lcy8wKQYJYIZIAYb4QgEC +BBwWGmh0dHA6Ly93d3cuaXBzLmVzL2lwczIwMDIvMDoGCWCGSAGG+EIBBAQtFito +dHRwOi8vd3d3Lmlwcy5lcy9pcHMyMDAyL2lwczIwMDJDTEFTRTEuY3JsMD8GCWCG +SAGG+EIBAwQyFjBodHRwOi8vd3d3Lmlwcy5lcy9pcHMyMDAyL3Jldm9jYXRpb25D +TEFTRTEuaHRtbD8wPAYJYIZIAYb4QgEHBC8WLWh0dHA6Ly93d3cuaXBzLmVzL2lw +czIwMDIvcmVuZXdhbENMQVNFMS5odG1sPzA6BglghkgBhvhCAQgELRYraHR0cDov +L3d3dy5pcHMuZXMvaXBzMjAwMi9wb2xpY3lDTEFTRTEuaHRtbDBzBgNVHR8EbDBq +MDGgL6AthitodHRwOi8vd3d3Lmlwcy5lcy9pcHMyMDAyL2lwczIwMDJDTEFTRTEu +Y3JsMDWgM6Axhi9odHRwOi8vd3d3YmFjay5pcHMuZXMvaXBzMjAwMi9pcHMyMDAy +Q0xBU0UxLmNybDAvBggrBgEFBQcBAQQjMCEwHwYIKwYBBQUHMAGGE2h0dHA6Ly9v +Y3NwLmlwcy5lcy8wDQYJKoZIhvcNAQEFBQADgYEAK9Dr/drIyllq2tPMMi7JVBuK +Yn4VLenZMdMu9Ccj/1urxUq2ckCuU3T0vAW0xtnIyXf7t/k0f3gA+Nak5FI/LEpj +V4F1Wo7ojPsCwJTGKbqz3Bzosq/SLmJbGqmODszFV0VRFOlOHIilkfSj945RyKm+ +hjM+5i9Ibq9UkE6tsSU= +-----END CERTIFICATE----- + +IPS CLASE3 root +=============== + +MD5 Fingerprint=42:76:97:68:CF:A6:B4:38:24:AA:A1:1B:F2:67:DE:CA +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA CLASE3 Certification Authority, CN=IPS CA CLASE3 Certification Authority/emailAddress=ips@mail.ips.es + Validity + Not Before: Dec 29 01:01:44 2001 GMT + Not After : Dec 27 01:01:44 2025 GMT + Subject: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA CLASE3 Certification Authority, CN=IPS CA CLASE3 Certification Authority/emailAddress=ips@mail.ips.es + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:ab:17:fe:0e:b0:c6:68:1b:53:f0:52:be:9f:fa: + da:fa:8b:13:04:bb:01:8f:32:d9:1f:8f:4d:ce:36: + 98:da:e4:00:44:8c:28:d8:13:44:2a:a4:6b:4e:17: + 24:42:9c:d3:88:a4:41:82:d6:23:fb:8b:c9:86:e5: + b9:a9:82:05:dc:f1:de:1f:e0:0c:99:55:98:f2:38: + ec:6c:9d:20:03:c0:ef:aa:a3:c6:64:04:51:2d:78: + 0d:a3:d2:a8:3a:d6:24:4c:e9:96:7a:18:ac:13:23: + 22:1b:7c:e8:31:11:b3:5f:09:aa:30:70:71:46:25: + 6b:49:71:80:2b:95:01:b2:1f + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + B8:93:FF:2E:CB:DC:2C:8E:A2:E7:7A:FE:36:51:21:A3:98:5B:0C:34 + X509v3 Authority Key Identifier: + keyid:B8:93:FF:2E:CB:DC:2C:8E:A2:E7:7A:FE:36:51:21:A3:98:5B:0C:34 + DirName:/C=ES/ST=Barcelona/L=Barcelona/O=IPS Internet publishing Services s.l./O=ips@mail.ips.es C.I.F. B-60929452/OU=IPS CA CLASE3 Certification Authority/CN=IPS CA CLASE3 Certification Authority/emailAddress=ips@mail.ips.es + serial:00 + + X509v3 Basic Constraints: + CA:TRUE + X509v3 Key Usage: + Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment, Key Agreement, Certificate Sign, CRL Sign, Encipher Only, Decipher Only + X509v3 Extended Key Usage: + TLS Web Server Authentication, TLS Web Client Authentication, Code Signing, E-mail Protection, Time Stamping, Microsoft Individual Code Signing, Microsoft Commercial Code Signing, Microsoft Trust List Signing, Microsoft Encrypted File System + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Subject Alternative Name: + email:ips@mail.ips.es + X509v3 Issuer Alternative Name: + email:ips@mail.ips.es + Netscape Comment: + CLASE3 CA Certificate issued by http://www.ips.es/ + Netscape Base Url: + http://www.ips.es/ips2002/ + Netscape CA Revocation Url: + http://www.ips.es/ips2002/ips2002CLASE3.crl + Netscape Revocation Url: + http://www.ips.es/ips2002/revocationCLASE3.html? + Netscape Renewal Url: + http://www.ips.es/ips2002/renewalCLASE3.html? + Netscape CA Policy Url: + http://www.ips.es/ips2002/policyCLASE3.html + X509v3 CRL Distribution Points: + URI:http://www.ips.es/ips2002/ips2002CLASE3.crl + URI:http://wwwback.ips.es/ips2002/ips2002CLASE3.crl + + Authority Information Access: + OCSP - URI:http://ocsp.ips.es/ + + Signature Algorithm: sha1WithRSAEncryption + 17:65:5c:99:95:43:03:27:af:26:e5:eb:d0:b3:17:23:f7:43: + aa:c7:f0:7d:ec:0f:c6:a9:ae:ae:96:0f:76:29:1c:e2:06:2d: + 7e:26:c5:3c:fa:a1:c1:81:ce:53:b0:42:d1:97:57:1a:17:7e: + a4:51:61:c6:ee:e9:5e:ef:05:ba:eb:bd:0f:a7:92:6f:d8:a3: + 06:68:29:8e:79:f5:ff:bf:f9:a7:af:e4:b1:ce:c2:d1:80:42: + 27:05:04:34:f8:c3:7f:16:78:23:0c:07:24:f2:46:47:ad:3b: + 54:d0:af:d5:31:b2:af:7d:c8:ea:e9:d4:56:d9:0e:13:b2:c5: + 45:50 +-----BEGIN CERTIFICATE----- +MIIH6jCCB1OgAwIBAgIBADANBgkqhkiG9w0BAQUFADCCARIxCzAJBgNVBAYTAkVT +MRIwEAYDVQQIEwlCYXJjZWxvbmExEjAQBgNVBAcTCUJhcmNlbG9uYTEuMCwGA1UE +ChMlSVBTIEludGVybmV0IHB1Ymxpc2hpbmcgU2VydmljZXMgcy5sLjErMCkGA1UE +ChQiaXBzQG1haWwuaXBzLmVzIEMuSS5GLiAgQi02MDkyOTQ1MjEuMCwGA1UECxMl +SVBTIENBIENMQVNFMyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEuMCwGA1UEAxMl +SVBTIENBIENMQVNFMyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEeMBwGCSqGSIb3 +DQEJARYPaXBzQG1haWwuaXBzLmVzMB4XDTAxMTIyOTAxMDE0NFoXDTI1MTIyNzAx +MDE0NFowggESMQswCQYDVQQGEwJFUzESMBAGA1UECBMJQmFyY2Vsb25hMRIwEAYD +VQQHEwlCYXJjZWxvbmExLjAsBgNVBAoTJUlQUyBJbnRlcm5ldCBwdWJsaXNoaW5n +IFNlcnZpY2VzIHMubC4xKzApBgNVBAoUImlwc0BtYWlsLmlwcy5lcyBDLkkuRi4g +IEItNjA5Mjk0NTIxLjAsBgNVBAsTJUlQUyBDQSBDTEFTRTMgQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkxLjAsBgNVBAMTJUlQUyBDQSBDTEFTRTMgQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkxHjAcBgkqhkiG9w0BCQEWD2lwc0BtYWlsLmlwcy5lczCBnzAN +BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAqxf+DrDGaBtT8FK+n/ra+osTBLsBjzLZ +H49NzjaY2uQARIwo2BNEKqRrThckQpzTiKRBgtYj+4vJhuW5qYIF3PHeH+AMmVWY +8jjsbJ0gA8DvqqPGZARRLXgNo9KoOtYkTOmWehisEyMiG3zoMRGzXwmqMHBxRiVr +SXGAK5UBsh8CAwEAAaOCBEowggRGMB0GA1UdDgQWBBS4k/8uy9wsjqLnev42USGj +mFsMNDCCAUQGA1UdIwSCATswggE3gBS4k/8uy9wsjqLnev42USGjmFsMNKGCARqk +ggEWMIIBEjELMAkGA1UEBhMCRVMxEjAQBgNVBAgTCUJhcmNlbG9uYTESMBAGA1UE +BxMJQmFyY2Vsb25hMS4wLAYDVQQKEyVJUFMgSW50ZXJuZXQgcHVibGlzaGluZyBT +ZXJ2aWNlcyBzLmwuMSswKQYDVQQKFCJpcHNAbWFpbC5pcHMuZXMgQy5JLkYuICBC +LTYwOTI5NDUyMS4wLAYDVQQLEyVJUFMgQ0EgQ0xBU0UzIENlcnRpZmljYXRpb24g +QXV0aG9yaXR5MS4wLAYDVQQDEyVJUFMgQ0EgQ0xBU0UzIENlcnRpZmljYXRpb24g +QXV0aG9yaXR5MR4wHAYJKoZIhvcNAQkBFg9pcHNAbWFpbC5pcHMuZXOCAQAwDAYD +VR0TBAUwAwEB/zAMBgNVHQ8EBQMDB/+AMGsGA1UdJQRkMGIGCCsGAQUFBwMBBggr +BgEFBQcDAgYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEFBQcDCAYKKwYBBAGCNwIB +FQYKKwYBBAGCNwIBFgYKKwYBBAGCNwoDAQYKKwYBBAGCNwoDBDARBglghkgBhvhC +AQEEBAMCAAcwGgYDVR0RBBMwEYEPaXBzQG1haWwuaXBzLmVzMBoGA1UdEgQTMBGB +D2lwc0BtYWlsLmlwcy5lczBBBglghkgBhvhCAQ0ENBYyQ0xBU0UzIENBIENlcnRp +ZmljYXRlIGlzc3VlZCBieSBodHRwOi8vd3d3Lmlwcy5lcy8wKQYJYIZIAYb4QgEC +BBwWGmh0dHA6Ly93d3cuaXBzLmVzL2lwczIwMDIvMDoGCWCGSAGG+EIBBAQtFito +dHRwOi8vd3d3Lmlwcy5lcy9pcHMyMDAyL2lwczIwMDJDTEFTRTMuY3JsMD8GCWCG +SAGG+EIBAwQyFjBodHRwOi8vd3d3Lmlwcy5lcy9pcHMyMDAyL3Jldm9jYXRpb25D +TEFTRTMuaHRtbD8wPAYJYIZIAYb4QgEHBC8WLWh0dHA6Ly93d3cuaXBzLmVzL2lw +czIwMDIvcmVuZXdhbENMQVNFMy5odG1sPzA6BglghkgBhvhCAQgELRYraHR0cDov +L3d3dy5pcHMuZXMvaXBzMjAwMi9wb2xpY3lDTEFTRTMuaHRtbDBzBgNVHR8EbDBq +MDGgL6AthitodHRwOi8vd3d3Lmlwcy5lcy9pcHMyMDAyL2lwczIwMDJDTEFTRTMu +Y3JsMDWgM6Axhi9odHRwOi8vd3d3YmFjay5pcHMuZXMvaXBzMjAwMi9pcHMyMDAy +Q0xBU0UzLmNybDAvBggrBgEFBQcBAQQjMCEwHwYIKwYBBQUHMAGGE2h0dHA6Ly9v +Y3NwLmlwcy5lcy8wDQYJKoZIhvcNAQEFBQADgYEAF2VcmZVDAyevJuXr0LMXI/dD +qsfwfewPxqmurpYPdikc4gYtfibFPPqhwYHOU7BC0ZdXGhd+pFFhxu7pXu8Fuuu9 +D6eSb9ijBmgpjnn1/7/5p6/ksc7C0YBCJwUENPjDfxZ4IwwHJPJGR607VNCv1TGy +r33I6unUVtkOE7LFRVA= +-----END CERTIFICATE----- + +IPS CLASEA1 root +================ + +MD5 Fingerprint=0C:F8:9E:17:FC:D4:03:BD:E6:8D:9B:3C:05:87:FE:84 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA CLASEA1 Certification Authority, CN=IPS CA CLASEA1 Certification Authority/emailAddress=ips@mail.ips.es + Validity + Not Before: Dec 29 01:05:32 2001 GMT + Not After : Dec 27 01:05:32 2025 GMT + Subject: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA CLASEA1 Certification Authority, CN=IPS CA CLASEA1 Certification Authority/emailAddress=ips@mail.ips.es + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:bb:30:d7:dc:d0:54:bd:35:4e:9f:c5:4c:82:ea: + d1:50:3c:47:98:fc:9b:69:9d:77:cd:6e:e0:3f:ee: + eb:32:5f:5f:9f:d2:d0:79:e5:95:73:44:21:32:e0: + 0a:db:9d:d7:ce:8d:ab:52:8b:2b:78:e0:9b:5b:7d: + f4:fd:6d:09:e5:ae:e1:6c:1d:07:23:a0:17:d1:f9: + 7d:a8:46:46:91:22:a8:b2:69:c6:ad:f7:f5:f5:94: + a1:30:94:bd:00:cc:44:7f:ee:c4:9e:c9:c1:e6:8f: + 0a:36:c1:fd:24:3d:01:a0:f5:7b:e2:7c:78:66:43: + 8b:4f:59:f2:9b:d9:fa:49:b3 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + 67:26:96:E7:A1:BF:D8:B5:03:9D:FE:3B:DC:FE:F2:8A:E6:15:DD:30 + X509v3 Authority Key Identifier: + keyid:67:26:96:E7:A1:BF:D8:B5:03:9D:FE:3B:DC:FE:F2:8A:E6:15:DD:30 + DirName:/C=ES/ST=Barcelona/L=Barcelona/O=IPS Internet publishing Services s.l./O=ips@mail.ips.es C.I.F. B-60929452/OU=IPS CA CLASEA1 Certification Authority/CN=IPS CA CLASEA1 Certification Authority/emailAddress=ips@mail.ips.es + serial:00 + + X509v3 Basic Constraints: + CA:TRUE + X509v3 Key Usage: + Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment, Key Agreement, Certificate Sign, CRL Sign, Encipher Only, Decipher Only + X509v3 Extended Key Usage: + TLS Web Server Authentication, TLS Web Client Authentication, Code Signing, E-mail Protection, Time Stamping, Microsoft Individual Code Signing, Microsoft Commercial Code Signing, Microsoft Trust List Signing, Microsoft Encrypted File System + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Subject Alternative Name: + email:ips@mail.ips.es + X509v3 Issuer Alternative Name: + email:ips@mail.ips.es + Netscape Comment: + CLASEA1 CA Certificate issued by http://www.ips.es/ + Netscape Base Url: + http://www.ips.es/ips2002/ + Netscape CA Revocation Url: + http://www.ips.es/ips2002/ips2002CLASEA1.crl + Netscape Revocation Url: + http://www.ips.es/ips2002/revocationCLASEA1.html? + Netscape Renewal Url: + http://www.ips.es/ips2002/renewalCLASEA1.html? + Netscape CA Policy Url: + http://www.ips.es/ips2002/policyCLASEA1.html + X509v3 CRL Distribution Points: + URI:http://www.ips.es/ips2002/ips2002CLASEA1.crl + URI:http://wwwback.ips.es/ips2002/ips2002CLASEA1.crl + + Authority Information Access: + OCSP - URI:http://ocsp.ips.es/ + + Signature Algorithm: sha1WithRSAEncryption + 7e:ba:8a:ac:80:00:84:15:0a:d5:98:51:0c:64:c5:9c:02:58: + 83:66:ca:ad:1e:07:cd:7e:6a:da:80:07:df:03:34:4a:1c:93: + c4:4b:58:20:35:36:71:ed:a2:0a:35:12:a5:a6:65:a7:85:69: + 0a:0e:e3:61:ee:ea:be:28:93:33:d5:ec:e8:be:c4:db:5f:7f: + a8:f9:63:31:c8:6b:96:e2:29:c2:5b:a0:e7:97:36:9d:77:5e: + 31:6b:fe:d3:a7:db:2a:db:db:96:8b:1f:66:de:b6:03:c0:2b: + b3:78:d6:55:07:e5:8f:39:50:de:07:23:72:e6:bd:20:14:4b: + b4:86 +-----BEGIN CERTIFICATE----- +MIIH9zCCB2CgAwIBAgIBADANBgkqhkiG9w0BAQUFADCCARQxCzAJBgNVBAYTAkVT +MRIwEAYDVQQIEwlCYXJjZWxvbmExEjAQBgNVBAcTCUJhcmNlbG9uYTEuMCwGA1UE +ChMlSVBTIEludGVybmV0IHB1Ymxpc2hpbmcgU2VydmljZXMgcy5sLjErMCkGA1UE +ChQiaXBzQG1haWwuaXBzLmVzIEMuSS5GLiAgQi02MDkyOTQ1MjEvMC0GA1UECxMm +SVBTIENBIENMQVNFQTEgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxLzAtBgNVBAMT +JklQUyBDQSBDTEFTRUExIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MR4wHAYJKoZI +hvcNAQkBFg9pcHNAbWFpbC5pcHMuZXMwHhcNMDExMjI5MDEwNTMyWhcNMjUxMjI3 +MDEwNTMyWjCCARQxCzAJBgNVBAYTAkVTMRIwEAYDVQQIEwlCYXJjZWxvbmExEjAQ +BgNVBAcTCUJhcmNlbG9uYTEuMCwGA1UEChMlSVBTIEludGVybmV0IHB1Ymxpc2hp +bmcgU2VydmljZXMgcy5sLjErMCkGA1UEChQiaXBzQG1haWwuaXBzLmVzIEMuSS5G +LiAgQi02MDkyOTQ1MjEvMC0GA1UECxMmSVBTIENBIENMQVNFQTEgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkxLzAtBgNVBAMTJklQUyBDQSBDTEFTRUExIENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5MR4wHAYJKoZIhvcNAQkBFg9pcHNAbWFpbC5pcHMuZXMw +gZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALsw19zQVL01Tp/FTILq0VA8R5j8 +m2mdd81u4D/u6zJfX5/S0HnllXNEITLgCtud186Nq1KLK3jgm1t99P1tCeWu4Wwd +ByOgF9H5fahGRpEiqLJpxq339fWUoTCUvQDMRH/uxJ7JweaPCjbB/SQ9AaD1e+J8 +eGZDi09Z8pvZ+kmzAgMBAAGjggRTMIIETzAdBgNVHQ4EFgQUZyaW56G/2LUDnf47 +3P7yiuYV3TAwggFGBgNVHSMEggE9MIIBOYAUZyaW56G/2LUDnf473P7yiuYV3TCh +ggEcpIIBGDCCARQxCzAJBgNVBAYTAkVTMRIwEAYDVQQIEwlCYXJjZWxvbmExEjAQ +BgNVBAcTCUJhcmNlbG9uYTEuMCwGA1UEChMlSVBTIEludGVybmV0IHB1Ymxpc2hp +bmcgU2VydmljZXMgcy5sLjErMCkGA1UEChQiaXBzQG1haWwuaXBzLmVzIEMuSS5G +LiAgQi02MDkyOTQ1MjEvMC0GA1UECxMmSVBTIENBIENMQVNFQTEgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkxLzAtBgNVBAMTJklQUyBDQSBDTEFTRUExIENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5MR4wHAYJKoZIhvcNAQkBFg9pcHNAbWFpbC5pcHMuZXOC +AQAwDAYDVR0TBAUwAwEB/zAMBgNVHQ8EBQMDB/+AMGsGA1UdJQRkMGIGCCsGAQUF +BwMBBggrBgEFBQcDAgYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEFBQcDCAYKKwYB +BAGCNwIBFQYKKwYBBAGCNwIBFgYKKwYBBAGCNwoDAQYKKwYBBAGCNwoDBDARBglg +hkgBhvhCAQEEBAMCAAcwGgYDVR0RBBMwEYEPaXBzQG1haWwuaXBzLmVzMBoGA1Ud +EgQTMBGBD2lwc0BtYWlsLmlwcy5lczBCBglghkgBhvhCAQ0ENRYzQ0xBU0VBMSBD +QSBDZXJ0aWZpY2F0ZSBpc3N1ZWQgYnkgaHR0cDovL3d3dy5pcHMuZXMvMCkGCWCG +SAGG+EIBAgQcFhpodHRwOi8vd3d3Lmlwcy5lcy9pcHMyMDAyLzA7BglghkgBhvhC +AQQELhYsaHR0cDovL3d3dy5pcHMuZXMvaXBzMjAwMi9pcHMyMDAyQ0xBU0VBMS5j +cmwwQAYJYIZIAYb4QgEDBDMWMWh0dHA6Ly93d3cuaXBzLmVzL2lwczIwMDIvcmV2 +b2NhdGlvbkNMQVNFQTEuaHRtbD8wPQYJYIZIAYb4QgEHBDAWLmh0dHA6Ly93d3cu +aXBzLmVzL2lwczIwMDIvcmVuZXdhbENMQVNFQTEuaHRtbD8wOwYJYIZIAYb4QgEI +BC4WLGh0dHA6Ly93d3cuaXBzLmVzL2lwczIwMDIvcG9saWN5Q0xBU0VBMS5odG1s +MHUGA1UdHwRuMGwwMqAwoC6GLGh0dHA6Ly93d3cuaXBzLmVzL2lwczIwMDIvaXBz +MjAwMkNMQVNFQTEuY3JsMDagNKAyhjBodHRwOi8vd3d3YmFjay5pcHMuZXMvaXBz +MjAwMi9pcHMyMDAyQ0xBU0VBMS5jcmwwLwYIKwYBBQUHAQEEIzAhMB8GCCsGAQUF +BzABhhNodHRwOi8vb2NzcC5pcHMuZXMvMA0GCSqGSIb3DQEBBQUAA4GBAH66iqyA +AIQVCtWYUQxkxZwCWINmyq0eB81+atqAB98DNEock8RLWCA1NnHtogo1EqWmZaeF +aQoO42Hu6r4okzPV7Oi+xNtff6j5YzHIa5biKcJboOeXNp13XjFr/tOn2yrb25aL +H2betgPAK7N41lUH5Y85UN4HI3LmvSAUS7SG +-----END CERTIFICATE----- + +IPS CLASEA3 root +================ + +MD5 Fingerprint=06:F9:EB:EC:CC:56:9D:88:BA:90:F5:BA:B0:1A:E0:02 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA CLASEA3 Certification Authority, CN=IPS CA CLASEA3 Certification Authority/emailAddress=ips@mail.ips.es + Validity + Not Before: Dec 29 01:07:50 2001 GMT + Not After : Dec 27 01:07:50 2025 GMT + Subject: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA CLASEA3 Certification Authority, CN=IPS CA CLASEA3 Certification Authority/emailAddress=ips@mail.ips.es + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:ee:80:00:f6:1a:64:2e:ad:6a:c8:83:b1:8b:a7: + ee:8f:d9:b6:db:cd:1b:bb:86:06:22:76:33:0c:12: + 6d:48:56:61:d2:dc:82:25:62:2f:9f:d2:69:30:65: + 03:42:23:58:bc:47:dc:6b:d6:75:5d:17:3c:e1:ff: + f2:58:67:79:a0:c1:81:b1:d4:56:a2:f2:8d:11:99: + fd:f6:7d:f1:c7:c4:5e:02:2a:9a:e2:4a:b5:13:8a: + 00:fd:8c:77:86:e6:d7:94:f5:20:75:2e:0e:4c:bf: + 74:c4:3f:81:3e:83:b4:a3:38:36:29:e7:e8:2a:f5: + 8c:88:41:aa:80:a6:e3:6c:ef + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + 1E:9F:57:50:47:B6:61:93:39:D3:2C:FC:DA:5D:3D:05:75:B7:99:02 + X509v3 Authority Key Identifier: + keyid:1E:9F:57:50:47:B6:61:93:39:D3:2C:FC:DA:5D:3D:05:75:B7:99:02 + DirName:/C=ES/ST=Barcelona/L=Barcelona/O=IPS Internet publishing Services s.l./O=ips@mail.ips.es C.I.F. B-60929452/OU=IPS CA CLASEA3 Certification Authority/CN=IPS CA CLASEA3 Certification Authority/emailAddress=ips@mail.ips.es + serial:00 + + X509v3 Basic Constraints: + CA:TRUE + X509v3 Key Usage: + Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment, Key Agreement, Certificate Sign, CRL Sign, Encipher Only, Decipher Only + X509v3 Extended Key Usage: + TLS Web Server Authentication, TLS Web Client Authentication, Code Signing, E-mail Protection, Time Stamping, Microsoft Individual Code Signing, Microsoft Commercial Code Signing, Microsoft Trust List Signing, Microsoft Encrypted File System + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Subject Alternative Name: + email:ips@mail.ips.es + X509v3 Issuer Alternative Name: + email:ips@mail.ips.es + Netscape Comment: + CLASEA3 CA Certificate issued by http://www.ips.es/ + Netscape Base Url: + http://www.ips.es/ips2002/ + Netscape CA Revocation Url: + http://www.ips.es/ips2002/ips2002CLASEA3.crl + Netscape Revocation Url: + http://www.ips.es/ips2002/revocationCLASEA3.html? + Netscape Renewal Url: + http://www.ips.es/ips2002/renewalCLASEA3.html? + Netscape CA Policy Url: + http://www.ips.es/ips2002/policyCLASEA3.html + X509v3 CRL Distribution Points: + URI:http://www.ips.es/ips2002/ips2002CLASEA3.crl + URI:http://wwwback.ips.es/ips2002/ips2002CLASEA3.crl + + Authority Information Access: + OCSP - URI:http://ocsp.ips.es/ + + Signature Algorithm: sha1WithRSAEncryption + 4a:3d:20:47:1a:da:89:f4:7a:2b:31:79:ec:01:c0:cc:01:f5: + d6:c1:fc:c8:c3:f3:50:02:51:90:58:2a:9f:e7:35:09:5b:30: + 0a:81:00:25:47:af:d4:0f:0e:9e:60:26:a8:95:a7:83:08:df: + 2d:ac:e9:0e:f7:9c:c8:9f:cb:93:45:f1:ba:6a:c6:67:51:4a: + 69:4f:6b:fe:7d:0b:2f:52:29:c2:50:ad:24:44:ed:23:b3:48: + cb:44:40:c1:03:95:0c:0a:78:06:12:01:f5:91:31:2d:49:8d: + bb:3f:45:4e:2c:e0:e8:cd:b5:c9:14:15:0c:e3:07:83:9b:26: + 75:ef +-----BEGIN CERTIFICATE----- +MIIH9zCCB2CgAwIBAgIBADANBgkqhkiG9w0BAQUFADCCARQxCzAJBgNVBAYTAkVT +MRIwEAYDVQQIEwlCYXJjZWxvbmExEjAQBgNVBAcTCUJhcmNlbG9uYTEuMCwGA1UE +ChMlSVBTIEludGVybmV0IHB1Ymxpc2hpbmcgU2VydmljZXMgcy5sLjErMCkGA1UE +ChQiaXBzQG1haWwuaXBzLmVzIEMuSS5GLiAgQi02MDkyOTQ1MjEvMC0GA1UECxMm +SVBTIENBIENMQVNFQTMgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxLzAtBgNVBAMT +JklQUyBDQSBDTEFTRUEzIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MR4wHAYJKoZI +hvcNAQkBFg9pcHNAbWFpbC5pcHMuZXMwHhcNMDExMjI5MDEwNzUwWhcNMjUxMjI3 +MDEwNzUwWjCCARQxCzAJBgNVBAYTAkVTMRIwEAYDVQQIEwlCYXJjZWxvbmExEjAQ +BgNVBAcTCUJhcmNlbG9uYTEuMCwGA1UEChMlSVBTIEludGVybmV0IHB1Ymxpc2hp +bmcgU2VydmljZXMgcy5sLjErMCkGA1UEChQiaXBzQG1haWwuaXBzLmVzIEMuSS5G +LiAgQi02MDkyOTQ1MjEvMC0GA1UECxMmSVBTIENBIENMQVNFQTMgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkxLzAtBgNVBAMTJklQUyBDQSBDTEFTRUEzIENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5MR4wHAYJKoZIhvcNAQkBFg9pcHNAbWFpbC5pcHMuZXMw +gZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAO6AAPYaZC6tasiDsYun7o/ZttvN +G7uGBiJ2MwwSbUhWYdLcgiViL5/SaTBlA0IjWLxH3GvWdV0XPOH/8lhneaDBgbHU +VqLyjRGZ/fZ98cfEXgIqmuJKtROKAP2Md4bm15T1IHUuDky/dMQ/gT6DtKM4Ninn +6Cr1jIhBqoCm42zvAgMBAAGjggRTMIIETzAdBgNVHQ4EFgQUHp9XUEe2YZM50yz8 +2l09BXW3mQIwggFGBgNVHSMEggE9MIIBOYAUHp9XUEe2YZM50yz82l09BXW3mQKh +ggEcpIIBGDCCARQxCzAJBgNVBAYTAkVTMRIwEAYDVQQIEwlCYXJjZWxvbmExEjAQ +BgNVBAcTCUJhcmNlbG9uYTEuMCwGA1UEChMlSVBTIEludGVybmV0IHB1Ymxpc2hp +bmcgU2VydmljZXMgcy5sLjErMCkGA1UEChQiaXBzQG1haWwuaXBzLmVzIEMuSS5G +LiAgQi02MDkyOTQ1MjEvMC0GA1UECxMmSVBTIENBIENMQVNFQTMgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkxLzAtBgNVBAMTJklQUyBDQSBDTEFTRUEzIENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5MR4wHAYJKoZIhvcNAQkBFg9pcHNAbWFpbC5pcHMuZXOC +AQAwDAYDVR0TBAUwAwEB/zAMBgNVHQ8EBQMDB/+AMGsGA1UdJQRkMGIGCCsGAQUF +BwMBBggrBgEFBQcDAgYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEFBQcDCAYKKwYB +BAGCNwIBFQYKKwYBBAGCNwIBFgYKKwYBBAGCNwoDAQYKKwYBBAGCNwoDBDARBglg +hkgBhvhCAQEEBAMCAAcwGgYDVR0RBBMwEYEPaXBzQG1haWwuaXBzLmVzMBoGA1Ud +EgQTMBGBD2lwc0BtYWlsLmlwcy5lczBCBglghkgBhvhCAQ0ENRYzQ0xBU0VBMyBD +QSBDZXJ0aWZpY2F0ZSBpc3N1ZWQgYnkgaHR0cDovL3d3dy5pcHMuZXMvMCkGCWCG +SAGG+EIBAgQcFhpodHRwOi8vd3d3Lmlwcy5lcy9pcHMyMDAyLzA7BglghkgBhvhC +AQQELhYsaHR0cDovL3d3dy5pcHMuZXMvaXBzMjAwMi9pcHMyMDAyQ0xBU0VBMy5j +cmwwQAYJYIZIAYb4QgEDBDMWMWh0dHA6Ly93d3cuaXBzLmVzL2lwczIwMDIvcmV2 +b2NhdGlvbkNMQVNFQTMuaHRtbD8wPQYJYIZIAYb4QgEHBDAWLmh0dHA6Ly93d3cu +aXBzLmVzL2lwczIwMDIvcmVuZXdhbENMQVNFQTMuaHRtbD8wOwYJYIZIAYb4QgEI +BC4WLGh0dHA6Ly93d3cuaXBzLmVzL2lwczIwMDIvcG9saWN5Q0xBU0VBMy5odG1s +MHUGA1UdHwRuMGwwMqAwoC6GLGh0dHA6Ly93d3cuaXBzLmVzL2lwczIwMDIvaXBz +MjAwMkNMQVNFQTMuY3JsMDagNKAyhjBodHRwOi8vd3d3YmFjay5pcHMuZXMvaXBz +MjAwMi9pcHMyMDAyQ0xBU0VBMy5jcmwwLwYIKwYBBQUHAQEEIzAhMB8GCCsGAQUF +BzABhhNodHRwOi8vb2NzcC5pcHMuZXMvMA0GCSqGSIb3DQEBBQUAA4GBAEo9IEca +2on0eisxeewBwMwB9dbB/MjD81ACUZBYKp/nNQlbMAqBACVHr9QPDp5gJqiVp4MI +3y2s6Q73nMify5NF8bpqxmdRSmlPa/59Cy9SKcJQrSRE7SOzSMtEQMEDlQwKeAYS +AfWRMS1Jjbs/RU4s4OjNtckUFQzjB4ObJnXv +-----END CERTIFICATE----- + +IPS Servidores root +=================== + +MD5 Fingerprint=7B:B5:08:99:9A:8C:18:BF:85:27:7D:0E:AE:DA:B2:AB +Certificate: + Data: + Version: 1 (0x0) + Serial Number: 0 (0x0) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=ES, ST=BARCELONA, L=BARCELONA, O=IPS Seguridad CA, OU=Certificaciones, CN=IPS SERVIDORES/emailAddress=ips@mail.ips.es + Validity + Not Before: Jan 1 23:21:07 1998 GMT + Not After : Dec 29 23:21:07 2009 GMT + Subject: C=ES, ST=BARCELONA, L=BARCELONA, O=IPS Seguridad CA, OU=Certificaciones, CN=IPS SERVIDORES/emailAddress=ips@mail.ips.es + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:ac:4f:52:74:9f:39:ea:8e:dc:25:c4:bc:98:5d: + 98:64:24:09:3c:21:b3:cc:19:b5:8e:94:8e:87:d1: + f8:37:3e:a1:c8:2d:58:a4:80:35:5b:a1:75:6c:1d: + 45:0c:1f:61:63:6a:5e:6f:9b:0a:4c:c1:c8:b8:61: + 23:35:81:ff:fe:ac:78:70:2d:68:e1:3a:07:98:95: + 02:54:dd:cd:23:b7:80:53:d7:c8:37:45:72:06:24: + 12:ba:13:61:21:8a:6e:75:28:e0:c5:0f:34:fd:36: + d8:45:7f:e1:b8:36:ef:b3:e1:c6:20:8e:e8:b4:38: + bc:e1:3e:f6:11:de:8c:9d:01 + Exponent: 65537 (0x10001) + Signature Algorithm: md5WithRSAEncryption + 2c:f3:c3:79:58:24:de:c6:3b:d1:e0:42:69:b8:ee:64:b3:3d: + 62:01:b9:b3:84:df:23:7d:dd:98:cf:10:a9:fe:00:d8:22:96: + 05:13:07:54:57:c5:a7:de:cb:d9:b8:88:42:f6:99:db:14:77: + 1f:b6:fe:25:3d:e1:a2:3e:03:a9:81:d2:2d:6c:47:f5:96:46: + 8c:22:ab:c8:cc:0d:0e:97:5e:8b:41:b4:3b:c4:0a:06:40:1d: + dd:46:f4:01:dd:ba:82:2e:3c:3d:78:70:9e:7c:18:d0:ab:f8: + b8:77:07:46:71:f1:ca:0b:63:5c:6a:f9:72:94:d5:01:4f:a0: + db:42 +-----BEGIN CERTIFICATE----- +MIICtzCCAiACAQAwDQYJKoZIhvcNAQEEBQAwgaMxCzAJBgNVBAYTAkVTMRIwEAYD +VQQIEwlCQVJDRUxPTkExEjAQBgNVBAcTCUJBUkNFTE9OQTEZMBcGA1UEChMQSVBT +IFNlZ3VyaWRhZCBDQTEYMBYGA1UECxMPQ2VydGlmaWNhY2lvbmVzMRcwFQYDVQQD +Ew5JUFMgU0VSVklET1JFUzEeMBwGCSqGSIb3DQEJARYPaXBzQG1haWwuaXBzLmVz +MB4XDTk4MDEwMTIzMjEwN1oXDTA5MTIyOTIzMjEwN1owgaMxCzAJBgNVBAYTAkVT +MRIwEAYDVQQIEwlCQVJDRUxPTkExEjAQBgNVBAcTCUJBUkNFTE9OQTEZMBcGA1UE +ChMQSVBTIFNlZ3VyaWRhZCBDQTEYMBYGA1UECxMPQ2VydGlmaWNhY2lvbmVzMRcw +FQYDVQQDEw5JUFMgU0VSVklET1JFUzEeMBwGCSqGSIb3DQEJARYPaXBzQG1haWwu +aXBzLmVzMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCsT1J0nznqjtwlxLyY +XZhkJAk8IbPMGbWOlI6H0fg3PqHILVikgDVboXVsHUUMH2Fjal5vmwpMwci4YSM1 +gf/+rHhwLWjhOgeYlQJU3c0jt4BT18g3RXIGJBK6E2Ehim51KODFDzT9NthFf+G4 +Nu+z4cYgjui0OLzhPvYR3oydAQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBACzzw3lY +JN7GO9HgQmm47mSzPWIBubOE3yN93ZjPEKn+ANgilgUTB1RXxafey9m4iEL2mdsU +dx+2/iU94aI+A6mB0i1sR/WWRowiq8jMDQ6XXotBtDvECgZAHd1G9AHduoIuPD14 +cJ58GNCr+Lh3B0Zx8coLY1xq+XKU1QFPoNtC +-----END CERTIFICATE----- + +IPS Timestamping root +===================== + +MD5 Fingerprint=2E:03:FD:C5:F5:D7:2B:94:64:C1:BE:89:31:F1:16:9B +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA Timestamping Certification Authority, CN=IPS CA Timestamping Certification Authority/emailAddress=ips@mail.ips.es + Validity + Not Before: Dec 29 01:10:18 2001 GMT + Not After : Dec 27 01:10:18 2025 GMT + Subject: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA Timestamping Certification Authority, CN=IPS CA Timestamping Certification Authority/emailAddress=ips@mail.ips.es + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:bc:b8:ee:56:a5:9a:8c:e6:36:c9:c2:62:a0:66: + 81:8d:1a:d5:7a:d2:73:9f:0e:84:64:ba:95:b4:90: + a7:78:af:ca:fe:54:61:5b:ce:b2:20:57:01:ae:44: + 92:43:10:38:11:f7:68:fc:17:40:a5:68:27:32:3b: + c4:a7:e6:42:71:c5:99:ef:76:ff:2b:95:24:f5:49: + 92:18:68:ca:00:b5:a4:5a:2f:6e:cb:d6:1b:2c:0d: + 54:67:6b:7a:29:a1:58:ab:a2:5a:00:d6:5b:bb:18: + c2:df:f6:1e:13:56:76:9b:a5:68:e2:98:ce:c6:03: + 8a:34:db:4c:83:41:a6:a9:a3 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + 8B:D0:10:50:09:81:F2:9D:09:D5:0E:60:78:03:22:A2:3F:C8:CA:66 + X509v3 Authority Key Identifier: + keyid:8B:D0:10:50:09:81:F2:9D:09:D5:0E:60:78:03:22:A2:3F:C8:CA:66 + DirName:/C=ES/ST=Barcelona/L=Barcelona/O=IPS Internet publishing Services s.l./O=ips@mail.ips.es C.I.F. B-60929452/OU=IPS CA Timestamping Certification Authority/CN=IPS CA Timestamping Certification Authority/emailAddress=ips@mail.ips.es + serial:00 + + X509v3 Basic Constraints: + CA:TRUE + X509v3 Key Usage: + Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment, Key Agreement, Certificate Sign, CRL Sign, Encipher Only, Decipher Only + X509v3 Extended Key Usage: + TLS Web Server Authentication, TLS Web Client Authentication, Code Signing, E-mail Protection, Time Stamping, Microsoft Individual Code Signing, Microsoft Commercial Code Signing, Microsoft Trust List Signing, Microsoft Encrypted File System + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Subject Alternative Name: + email:ips@mail.ips.es + X509v3 Issuer Alternative Name: + email:ips@mail.ips.es + Netscape Comment: + Timestamping CA Certificate issued by http://www.ips.es/ + Netscape Base Url: + http://www.ips.es/ips2002/ + Netscape CA Revocation Url: + http://www.ips.es/ips2002/ips2002Timestamping.crl + Netscape Revocation Url: + http://www.ips.es/ips2002/revocationTimestamping.html? + Netscape Renewal Url: + http://www.ips.es/ips2002/renewalTimestamping.html? + Netscape CA Policy Url: + http://www.ips.es/ips2002/policyTimestamping.html + X509v3 CRL Distribution Points: + URI:http://www.ips.es/ips2002/ips2002Timestamping.crl + URI:http://wwwback.ips.es/ips2002/ips2002Timestamping.crl + + Authority Information Access: + OCSP - URI:http://ocsp.ips.es/ + + Signature Algorithm: sha1WithRSAEncryption + 65:ba:c1:cc:00:1a:95:91:ca:e9:6c:3a:bf:3a:1e:14:08:7c: + fb:83:ee:6b:62:51:d3:33:91:b5:60:79:7e:04:d8:5d:79:37: + e8:c3:5b:b0:c4:67:2d:68:5a:b2:5f:0e:0a:fa:cd:3f:3a:45: + a1:ea:36:cf:26:1e:a7:11:28:c5:94:8f:84:4c:53:08:c5:93: + b3:fc:e2:7f:f5:8d:f3:b1:a9:85:5f:88:de:91:96:ee:17:5b: + ae:a5:ea:70:65:78:2c:21:64:01:95:ce:ce:4c:3e:50:f4:b6: + 59:cb:63:8d:b6:bd:18:d4:87:4a:5f:dc:ef:e9:56:f0:0a:0c: + e8:75 +-----BEGIN CERTIFICATE----- +MIIIODCCB6GgAwIBAgIBADANBgkqhkiG9w0BAQUFADCCAR4xCzAJBgNVBAYTAkVT +MRIwEAYDVQQIEwlCYXJjZWxvbmExEjAQBgNVBAcTCUJhcmNlbG9uYTEuMCwGA1UE +ChMlSVBTIEludGVybmV0IHB1Ymxpc2hpbmcgU2VydmljZXMgcy5sLjErMCkGA1UE +ChQiaXBzQG1haWwuaXBzLmVzIEMuSS5GLiAgQi02MDkyOTQ1MjE0MDIGA1UECxMr +SVBTIENBIFRpbWVzdGFtcGluZyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTE0MDIG +A1UEAxMrSVBTIENBIFRpbWVzdGFtcGluZyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0 +eTEeMBwGCSqGSIb3DQEJARYPaXBzQG1haWwuaXBzLmVzMB4XDTAxMTIyOTAxMTAx +OFoXDTI1MTIyNzAxMTAxOFowggEeMQswCQYDVQQGEwJFUzESMBAGA1UECBMJQmFy +Y2Vsb25hMRIwEAYDVQQHEwlCYXJjZWxvbmExLjAsBgNVBAoTJUlQUyBJbnRlcm5l +dCBwdWJsaXNoaW5nIFNlcnZpY2VzIHMubC4xKzApBgNVBAoUImlwc0BtYWlsLmlw +cy5lcyBDLkkuRi4gIEItNjA5Mjk0NTIxNDAyBgNVBAsTK0lQUyBDQSBUaW1lc3Rh +bXBpbmcgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxNDAyBgNVBAMTK0lQUyBDQSBU +aW1lc3RhbXBpbmcgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxHjAcBgkqhkiG9w0B +CQEWD2lwc0BtYWlsLmlwcy5lczCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA +vLjuVqWajOY2ycJioGaBjRrVetJznw6EZLqVtJCneK/K/lRhW86yIFcBrkSSQxA4 +Efdo/BdApWgnMjvEp+ZCccWZ73b/K5Uk9UmSGGjKALWkWi9uy9YbLA1UZ2t6KaFY +q6JaANZbuxjC3/YeE1Z2m6Vo4pjOxgOKNNtMg0GmqaMCAwEAAaOCBIAwggR8MB0G +A1UdDgQWBBSL0BBQCYHynQnVDmB4AyKiP8jKZjCCAVAGA1UdIwSCAUcwggFDgBSL +0BBQCYHynQnVDmB4AyKiP8jKZqGCASakggEiMIIBHjELMAkGA1UEBhMCRVMxEjAQ +BgNVBAgTCUJhcmNlbG9uYTESMBAGA1UEBxMJQmFyY2Vsb25hMS4wLAYDVQQKEyVJ +UFMgSW50ZXJuZXQgcHVibGlzaGluZyBTZXJ2aWNlcyBzLmwuMSswKQYDVQQKFCJp +cHNAbWFpbC5pcHMuZXMgQy5JLkYuICBCLTYwOTI5NDUyMTQwMgYDVQQLEytJUFMg +Q0EgVGltZXN0YW1waW5nIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MTQwMgYDVQQD +EytJUFMgQ0EgVGltZXN0YW1waW5nIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MR4w +HAYJKoZIhvcNAQkBFg9pcHNAbWFpbC5pcHMuZXOCAQAwDAYDVR0TBAUwAwEB/zAM +BgNVHQ8EBQMDB/+AMGsGA1UdJQRkMGIGCCsGAQUFBwMBBggrBgEFBQcDAgYIKwYB +BQUHAwMGCCsGAQUFBwMEBggrBgEFBQcDCAYKKwYBBAGCNwIBFQYKKwYBBAGCNwIB +FgYKKwYBBAGCNwoDAQYKKwYBBAGCNwoDBDARBglghkgBhvhCAQEEBAMCAAcwGgYD +VR0RBBMwEYEPaXBzQG1haWwuaXBzLmVzMBoGA1UdEgQTMBGBD2lwc0BtYWlsLmlw +cy5lczBHBglghkgBhvhCAQ0EOhY4VGltZXN0YW1waW5nIENBIENlcnRpZmljYXRl +IGlzc3VlZCBieSBodHRwOi8vd3d3Lmlwcy5lcy8wKQYJYIZIAYb4QgECBBwWGmh0 +dHA6Ly93d3cuaXBzLmVzL2lwczIwMDIvMEAGCWCGSAGG+EIBBAQzFjFodHRwOi8v +d3d3Lmlwcy5lcy9pcHMyMDAyL2lwczIwMDJUaW1lc3RhbXBpbmcuY3JsMEUGCWCG +SAGG+EIBAwQ4FjZodHRwOi8vd3d3Lmlwcy5lcy9pcHMyMDAyL3Jldm9jYXRpb25U +aW1lc3RhbXBpbmcuaHRtbD8wQgYJYIZIAYb4QgEHBDUWM2h0dHA6Ly93d3cuaXBz +LmVzL2lwczIwMDIvcmVuZXdhbFRpbWVzdGFtcGluZy5odG1sPzBABglghkgBhvhC +AQgEMxYxaHR0cDovL3d3dy5pcHMuZXMvaXBzMjAwMi9wb2xpY3lUaW1lc3RhbXBp +bmcuaHRtbDB/BgNVHR8EeDB2MDegNaAzhjFodHRwOi8vd3d3Lmlwcy5lcy9pcHMy +MDAyL2lwczIwMDJUaW1lc3RhbXBpbmcuY3JsMDugOaA3hjVodHRwOi8vd3d3YmFj +ay5pcHMuZXMvaXBzMjAwMi9pcHMyMDAyVGltZXN0YW1waW5nLmNybDAvBggrBgEF +BQcBAQQjMCEwHwYIKwYBBQUHMAGGE2h0dHA6Ly9vY3NwLmlwcy5lcy8wDQYJKoZI +hvcNAQEFBQADgYEAZbrBzAAalZHK6Ww6vzoeFAh8+4Pua2JR0zORtWB5fgTYXXk3 +6MNbsMRnLWhasl8OCvrNPzpFoeo2zyYepxEoxZSPhExTCMWTs/zif/WN87GphV+I +3pGW7hdbrqXqcGV4LCFkAZXOzkw+UPS2Wctjjba9GNSHSl/c7+lW8AoM6HU= +-----END CERTIFICATE----- + +QuoVadis Root CA +================ + +MD5 Fingerprint=27:DE:36:FE:72:B7:00:03:00:9D:F4:F0:1E:6C:04:24 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 985026699 (0x3ab6508b) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=BM, O=QuoVadis Limited, OU=Root Certification Authority, CN=QuoVadis Root Certification Authority + Validity + Not Before: Mar 19 18:33:33 2001 GMT + Not After : Mar 17 18:33:33 2021 GMT + Subject: C=BM, O=QuoVadis Limited, OU=Root Certification Authority, CN=QuoVadis Root Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:bf:61:b5:95:53:ba:57:fc:fa:f2:67:0b:3a:1a: + df:11:80:64:95:b4:d1:bc:cd:7a:cf:f6:29:96:2e: + 24:54:40:24:38:f7:1a:85:dc:58:4c:cb:a4:27:42: + 97:d0:9f:83:8a:c3:e4:06:03:5b:00:a5:51:1e:70: + 04:74:e2:c1:d4:3a:ab:d7:ad:3b:07:18:05:8e:fd: + 83:ac:ea:66:d9:18:1b:68:8a:f5:57:1a:98:ba:f5: + ed:76:3d:7c:d9:de:94:6a:3b:4b:17:c1:d5:8f:bd: + 65:38:3a:95:d0:3d:55:36:4e:df:79:57:31:2a:1e: + d8:59:65:49:58:20:98:7e:ab:5f:7e:9f:e9:d6:4d: + ec:83:74:a9:c7:6c:d8:ee:29:4a:85:2a:06:14:f9: + 54:e6:d3:da:65:07:8b:63:37:12:d7:d0:ec:c3:7b: + 20:41:44:a3:ed:cb:a0:17:e1:71:65:ce:1d:66:31: + f7:76:01:19:c8:7d:03:58:b6:95:49:1d:a6:12:26: + e8:c6:0c:76:e0:e3:66:cb:ea:5d:a6:26:ee:e5:cc: + 5f:bd:67:a7:01:27:0e:a2:ca:54:c5:b1:7a:95:1d: + 71:1e:4a:29:8a:03:dc:6a:45:c1:a4:19:5e:6f:36: + cd:c3:a2:b0:b7:fe:5c:38:e2:52:bc:f8:44:43:e6: + 90:bb + Exponent: 65537 (0x10001) + X509v3 extensions: + Authority Information Access: + OCSP - URI:https://ocsp.quovadisoffshore.com + + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Certificate Policies: + Policy: 1.3.6.1.4.1.8024.0.1 + User Notice: + Explicit Text: Reliance on the QuoVadis Root Certificate by any party assumes acceptance of the then applicable standard terms and conditions of use, certification practices, and the QuoVadis Certificate Policy. + CPS: http://www.quovadis.bm + + X509v3 Subject Key Identifier: + 8B:4B:6D:ED:D3:29:B9:06:19:EC:39:39:A9:F0:97:84:6A:CB:EF:DF + X509v3 Authority Key Identifier: + keyid:8B:4B:6D:ED:D3:29:B9:06:19:EC:39:39:A9:F0:97:84:6A:CB:EF:DF + DirName:/C=BM/O=QuoVadis Limited/OU=Root Certification Authority/CN=QuoVadis Root Certification Authority + serial:3A:B6:50:8B + + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 8a:d4:14:b5:fe:f4:9a:92:a7:19:d4:a4:7e:72:18:8f:d9:68: + 7c:52:24:dd:67:6f:39:7a:c4:aa:5e:3d:e2:58:b0:4d:70:98: + 84:61:e8:1b:e3:69:18:0e:ce:fb:47:50:a0:4e:ff:f0:24:1f: + bd:b2:ce:f5:27:fc:ec:2f:53:aa:73:7b:03:3d:74:6e:e6:16: + 9e:eb:a5:2e:c4:bf:56:27:50:2b:62:ba:be:4b:1c:3c:55:5c: + 41:1d:24:be:82:20:47:5d:d5:44:7e:7a:16:68:df:7d:4d:51: + 70:78:57:1d:33:1e:fd:02:99:9c:0c:cd:0a:05:4f:c7:bb:8e: + a4:75:fa:4a:6d:b1:80:8e:09:56:b9:9c:1a:60:fe:5d:c1:d7: + 7a:dc:11:78:d0:d6:5d:c1:b7:d5:ad:32:99:03:3a:8a:cc:54: + 25:39:31:81:7b:13:22:51:ba:46:6c:a1:bb:9e:fa:04:6c:49: + 26:74:8f:d2:73:eb:cc:30:a2:e6:ea:59:22:87:f8:97:f5:0e: + fd:ea:cc:92:a4:16:c4:52:18:ea:21:ce:b1:f1:e6:84:81:e5: + ba:a9:86:28:f2:43:5a:5d:12:9d:ac:1e:d9:a8:e5:0a:6a:a7: + 7f:a0:87:29:cf:f2:89:4d:d4:ec:c5:e2:e6:7a:d0:36:23:8a: + 4a:74:36:f9 +-----BEGIN CERTIFICATE----- +MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJC +TTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0 +aWZpY2F0aW9uIEF1dGhvcml0eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0 +aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAzMTkxODMzMzNaFw0yMTAzMTcxODMz +MzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUw +IwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQDEyVR +dW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Yp +li4kVEAkOPcahdxYTMukJ0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2D +rOpm2RgbaIr1VxqYuvXtdj182d6UajtLF8HVj71lODqV0D1VNk7feVcxKh7YWWVJ +WCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeLYzcS19Dsw3sgQUSj7cug +F+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWenAScOospU +xbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCC +Ak4wPQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVv +dmFkaXNvZmZzaG9yZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREw +ggENMIIBCQYJKwYBBAG+WAABMIH7MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNl +IG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmljYXRlIGJ5IGFueSBwYXJ0eSBh +c3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJsZSBzdGFuZGFy +ZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh +Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYI +KwYBBQUHAgEWFmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3T +KbkGGew5Oanwl4Rqy+/fMIGuBgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rq +y+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1p +dGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYD +VQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6tlCL +MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSk +fnIYj9lofFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf8 +7C9TqnN7Az10buYWnuulLsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1R +cHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2xgI4JVrmcGmD+XcHXetwReNDWXcG31a0y +mQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi5upZIof4l/UO/erMkqQW +xFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi5nrQNiOK +SnQ2+Q== +-----END CERTIFICATE----- + +QuoVadis Root CA 2 +================== + +MD5 Fingerprint=5E:39:7B:DD:F8:BA:EC:82:E9:AC:62:BA:0C:54:00:2B +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1289 (0x509) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 2 + Validity + Not Before: Nov 24 18:27:00 2006 GMT + Not After : Nov 24 18:23:33 2031 GMT + Subject: C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 2 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (4096 bit) + Modulus (4096 bit): + 00:9a:18:ca:4b:94:0d:00:2d:af:03:29:8a:f0:0f: + 81:c8:ae:4c:19:85:1d:08:9f:ab:29:44:85:f3:2f: + 81:ad:32:1e:90:46:bf:a3:86:26:1a:1e:fe:7e:1c: + 18:3a:5c:9c:60:17:2a:3a:74:83:33:30:7d:61:54: + 11:cb:ed:ab:e0:e6:d2:a2:7e:f5:6b:6f:18:b7:0a: + 0b:2d:fd:e9:3e:ef:0a:c6:b3:10:e9:dc:c2:46:17: + f8:5d:fd:a4:da:ff:9e:49:5a:9c:e6:33:e6:24:96: + f7:3f:ba:5b:2b:1c:7a:35:c2:d6:67:fe:ab:66:50: + 8b:6d:28:60:2b:ef:d7:60:c3:c7:93:bc:8d:36:91: + f3:7f:f8:db:11:13:c4:9c:77:76:c1:ae:b7:02:6a: + 81:7a:a9:45:83:e2:05:e6:b9:56:c1:94:37:8f:48: + 71:63:22:ec:17:65:07:95:8a:4b:df:8f:c6:5a:0a: + e5:b0:e3:5f:5e:6b:11:ab:0c:f9:85:eb:44:e9:f8: + 04:73:f2:e9:fe:5c:98:8c:f5:73:af:6b:b4:7e:cd: + d4:5c:02:2b:4c:39:e1:b2:95:95:2d:42:87:d7:d5: + b3:90:43:b7:6c:13:f1:de:dd:f6:c4:f8:89:3f:d1: + 75:f5:92:c3:91:d5:8a:88:d0:90:ec:dc:6d:de:89: + c2:65:71:96:8b:0d:03:fd:9c:bf:5b:16:ac:92:db: + ea:fe:79:7c:ad:eb:af:f7:16:cb:db:cd:25:2b:e5: + 1f:fb:9a:9f:e2:51:cc:3a:53:0c:48:e6:0e:bd:c9: + b4:76:06:52:e6:11:13:85:72:63:03:04:e0:04:36: + 2b:20:19:02:e8:74:a7:1f:b6:c9:56:66:f0:75:25: + dc:67:c1:0e:61:60:88:b3:3e:d1:a8:fc:a3:da:1d: + b0:d1:b1:23:54:df:44:76:6d:ed:41:d8:c1:b2:22: + b6:53:1c:df:35:1d:dc:a1:77:2a:31:e4:2d:f5:e5: + e5:db:c8:e0:ff:e5:80:d7:0b:63:a0:ff:33:a1:0f: + ba:2c:15:15:ea:97:b3:d2:a2:b5:be:f2:8c:96:1e: + 1a:8f:1d:6c:a4:61:37:b9:86:73:33:d7:97:96:9e: + 23:7d:82:a4:4c:81:e2:a1:d1:ba:67:5f:95:07:a3: + 27:11:ee:16:10:7b:bc:45:4a:4c:b2:04:d2:ab:ef: + d5:fd:0c:51:ce:50:6a:08:31:f9:91:da:0c:8f:64: + 5c:03:c3:3a:8b:20:3f:6e:8d:67:3d:3a:d6:fe:7d: + 5b:88:c9:5e:fb:cc:61:dc:8b:33:77:d3:44:32:35: + 09:62:04:92:16:10:d8:9e:27:47:fb:3b:21:e3:f8: + eb:1d:5b + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Subject Key Identifier: + 1A:84:62:BC:48:4C:33:25:04:D4:EE:D0:F6:03:C4:19:46:D1:94:6B + X509v3 Authority Key Identifier: + keyid:1A:84:62:BC:48:4C:33:25:04:D4:EE:D0:F6:03:C4:19:46:D1:94:6B + DirName:/C=BM/O=QuoVadis Limited/CN=QuoVadis Root CA 2 + serial:05:09 + + Signature Algorithm: sha1WithRSAEncryption + 3e:0a:16:4d:9f:06:5b:a8:ae:71:5d:2f:05:2f:67:e6:13:45: + 83:c4:36:f6:f3:c0:26:0c:0d:b5:47:64:5d:f8:b4:72:c9:46: + a5:03:18:27:55:89:78:7d:76:ea:96:34:80:17:20:dc:e7:83: + f8:8d:fc:07:b8:da:5f:4d:2e:67:b2:84:fd:d9:44:fc:77:50: + 81:e6:7c:b4:c9:0d:0b:72:53:f8:76:07:07:41:47:96:0c:fb: + e0:82:26:93:55:8c:fe:22:1f:60:65:7c:5f:e7:26:b3:f7:32: + 90:98:50:d4:37:71:55:f6:92:21:78:f7:95:79:fa:f8:2d:26: + 87:66:56:30:77:a6:37:78:33:52:10:58:ae:3f:61:8e:f2:6a: + b1:ef:18:7e:4a:59:63:ca:8d:a2:56:d5:a7:2f:bc:56:1f:cf: + 39:c1:e2:fb:0a:a8:15:2c:7d:4d:7a:63:c6:6c:97:44:3c:d2: + 6f:c3:4a:17:0a:f8:90:d2:57:a2:19:51:a5:2d:97:41:da:07: + 4f:a9:50:da:90:8d:94:46:e1:3e:f0:94:fd:10:00:38:f5:3b: + e8:40:e1:b4:6e:56:1a:20:cc:6f:58:8d:ed:2e:45:8f:d6:e9: + 93:3f:e7:b1:2c:df:3a:d6:22:8c:dc:84:bb:22:6f:d0:f8:e4: + c6:39:e9:04:88:3c:c3:ba:eb:55:7a:6d:80:99:24:f5:6c:01: + fb:f8:97:b0:94:5b:eb:fd:d2:6f:f1:77:68:0d:35:64:23:ac: + b8:55:a1:03:d1:4d:42:19:dc:f8:75:59:56:a3:f9:a8:49:79: + f8:af:0e:b9:11:a0:7c:b7:6a:ed:34:d0:b6:26:62:38:1a:87: + 0c:f8:e8:fd:2e:d3:90:7f:07:91:2a:1d:d6:7e:5c:85:83:99: + b0:38:08:3f:e9:5e:f9:35:07:e4:c9:62:6e:57:7f:a7:50:95: + f7:ba:c8:9b:e6:8e:a2:01:c5:d6:66:bf:79:61:f3:3c:1c:e1: + b9:82:5c:5d:a0:c3:e9:d8:48:bd:19:a2:11:14:19:6e:b2:86: + 1b:68:3e:48:37:1a:88:b7:5d:96:5e:9c:c7:ef:27:62:08:e2: + 91:19:5c:d2:f1:21:dd:ba:17:42:82:97:71:81:53:31:a9:9f: + f6:7d:62:bf:72:e1:a3:93:1d:cc:8a:26:5a:09:38:d0:ce:d7: + 0d:80:16:b4:78:a5:3a:87:4c:8d:8a:a5:d5:46:97:f2:2c:10: + b9:bc:54:22:c0:01:50:69:43:9e:f4:b2:ef:6d:f8:ec:da:f1: + e3:b1:ef:df:91:8f:54:2a:0b:25:c1:26:19:c4:52:10:05:65: + d5:82:10:ea:c2:31:cd:2e +-----BEGIN CERTIFICATE----- +MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0x +GTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJv +b3QgQ0EgMjAeFw0wNjExMjQxODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNV +BAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMRswGQYDVQQDExJRdW9W +YWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCa +GMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6XJxg +Fyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55J +WpzmM+Yklvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bB +rrcCaoF6qUWD4gXmuVbBlDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp ++ARz8un+XJiM9XOva7R+zdRcAitMOeGylZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1 +ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt66/3FsvbzSUr5R/7mp/i +Ucw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1JdxnwQ5hYIiz +PtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og +/zOhD7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UH +oycR7hYQe7xFSkyyBNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuI +yV77zGHcizN300QyNQliBJIWENieJ0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1Ud +EwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBQahGK8SEwzJQTU7tD2 +A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGUa6FJpEcwRTEL +MAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT +ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2f +BluornFdLwUvZ+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzn +g/iN/Ae42l9NLmeyhP3ZRPx3UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2Bl +fF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodmVjB3pjd4M1IQWK4/YY7yarHvGH5K +WWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK+JDSV6IZUaUtl0Ha +B0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrWIozc +hLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPR +TUIZ3Ph1WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWD +mbA4CD/pXvk1B+TJYm5Xf6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0Z +ohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y +4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8VCLAAVBpQ570su9t+Oza +8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u +-----END CERTIFICATE----- + +QuoVadis Root CA 3 +================== + +MD5 Fingerprint=31:85:3C:62:94:97:63:B9:AA:FD:89:4E:AF:6F:E0:CF +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1478 (0x5c6) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 3 + Validity + Not Before: Nov 24 19:11:23 2006 GMT + Not After : Nov 24 19:06:44 2031 GMT + Subject: C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 3 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (4096 bit) + Modulus (4096 bit): + 00:cc:57:42:16:54:9c:e6:98:d3:d3:4d:ee:fe:ed: + c7:9f:43:39:4a:65:b3:e8:16:88:34:db:0d:59:91: + 74:cf:92:b8:04:40:ad:02:4b:31:ab:bc:8d:91:68: + d8:20:0e:1a:01:e2:1a:7b:4e:17:5d:e2:8a:b7:3f: + 99:1a:cd:eb:61:ab:c2:65:a6:1f:b7:b7:bd:b7:8f: + fc:fd:70:8f:0b:a0:67:be:01:a2:59:cf:71:e6:0f: + 29:76:ff:b1:56:79:45:2b:1f:9e:7a:54:e8:a3:29: + 35:68:a4:01:4f:0f:a4:2e:37:ef:1b:bf:e3:8f:10: + a8:72:ab:58:57:e7:54:86:c8:c9:f3:5b:da:2c:da: + 5d:8e:6e:3c:a3:3e:da:fb:82:e5:dd:f2:5c:b2:05: + 33:6f:8a:36:ce:d0:13:4e:ff:bf:4a:0c:34:4c:a6: + c3:21:bd:50:04:55:eb:b1:bb:9d:fb:45:1e:64:15: + de:55:01:8c:02:76:b5:cb:a1:3f:42:69:bc:2f:bd: + 68:43:16:56:89:2a:37:61:91:fd:a6:ae:4e:c0:cb: + 14:65:94:37:4b:92:06:ef:04:d0:c8:9c:88:db:0b: + 7b:81:af:b1:3d:2a:c4:65:3a:78:b6:ee:dc:80:b1: + d2:d3:99:9c:3a:ee:6b:5a:6b:b3:8d:b7:d5:ce:9c: + c2:be:a5:4b:2f:16:b1:9e:68:3b:06:6f:ae:7d:9f: + f8:de:ec:cc:29:a7:98:a3:25:43:2f:ef:f1:5f:26: + e1:88:4d:f8:5e:6e:d7:d9:14:6e:19:33:69:a7:3b: + 84:89:93:c4:53:55:13:a1:51:78:40:f8:b8:c9:a2: + ee:7b:ba:52:42:83:9e:14:ed:05:52:5a:59:56:a7: + 97:fc:9d:3f:0a:29:d8:dc:4f:91:0e:13:bc:de:95: + a4:df:8b:99:be:ac:9b:33:88:ef:b5:81:af:1b:c6: + 22:53:c8:f6:c7:ee:97:14:b0:c5:7c:78:52:c8:f0: + ce:6e:77:60:84:a6:e9:2a:76:20:ed:58:01:17:30: + 93:e9:1a:8b:e0:73:63:d9:6a:92:94:49:4e:b4:ad: + 4a:85:c4:a3:22:30:fc:09:ed:68:22:73:a6:88:0c: + 55:21:58:c5:e1:3a:9f:2a:dd:ca:e1:90:e0:d9:73: + ab:6c:80:b8:e8:0b:64:93:a0:9c:8c:19:ff:b3:d2: + 0c:ec:91:26:87:8a:b3:a2:e1:70:8f:2c:0a:e5:cd: + 6d:68:51:eb:da:3f:05:7f:8b:32:e6:13:5c:6b:fe: + 5f:40:e2:22:c8:b4:b4:64:4f:d6:ba:7d:48:3e:a8: + 69:0c:d7:bb:86:71:c9:73:b8:3f:3b:9d:25:4b:da: + ff:40:eb + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Certificate Policies: + Policy: 1.3.6.1.4.1.8024.0.3 + User Notice: + Explicit Text: Any use of this Certificate constitutes acceptance of the QuoVadis Root CA 3 Certificate Policy / Certification Practice Statement. + CPS: http://www.quovadisglobal.com/cps + + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Subject Key Identifier: + F2:C0:13:E0:82:43:3E:FB:EE:2F:67:32:96:35:5C:DB:B8:CB:02:D0 + X509v3 Authority Key Identifier: + keyid:F2:C0:13:E0:82:43:3E:FB:EE:2F:67:32:96:35:5C:DB:B8:CB:02:D0 + DirName:/C=BM/O=QuoVadis Limited/CN=QuoVadis Root CA 3 + serial:05:C6 + + Signature Algorithm: sha1WithRSAEncryption + 4f:ad:a0:2c:4c:fa:c0:f2:6f:f7:66:55:ab:23:34:ee:e7:29: + da:c3:5b:b6:b0:83:d9:d0:d0:e2:21:fb:f3:60:a7:3b:5d:60: + 53:27:a2:9b:f6:08:22:2a:e7:bf:a0:72:e5:9c:24:6a:31:b1: + 90:7a:27:db:84:11:89:27:a6:77:5a:38:d7:bf:ac:86:fc:ee: + 5d:83:bc:06:c6:d1:77:6b:0f:6d:24:2f:4b:7a:6c:a7:07:96: + ca:e3:84:9f:ad:88:8b:1d:ab:16:8d:5b:66:17:d9:16:f4:8b: + 80:d2:dd:f8:b2:76:c3:fc:38:13:aa:0c:de:42:69:2b:6e:f3: + 3c:eb:80:27:db:f5:a6:44:0d:9f:5a:55:59:0b:d5:0d:52:48: + c5:ae:9f:f2:2f:80:c5:ea:32:50:35:12:97:2e:c1:e1:ff:f1: + 23:88:51:38:9f:f2:66:56:76:e7:0f:51:97:a5:52:0c:4d:49: + 51:95:36:3d:bf:a2:4b:0c:10:1d:86:99:4c:aa:f3:72:11:93: + e4:ea:f6:9b:da:a8:5d:a7:4d:b7:9e:02:ae:73:00:c8:da:23: + 03:e8:f9:ea:19:74:62:00:94:cb:22:20:be:94:a7:59:b5:82: + 6a:be:99:79:7a:a9:f2:4a:24:52:f7:74:fd:ba:4e:e6:a8:1d: + 02:6e:b1:0d:80:44:c1:ae:d3:23:37:5f:bb:85:7c:2b:92:2e: + e8:7e:a5:8b:dd:99:e1:bf:27:6f:2d:5d:aa:7b:87:fe:0a:dd: + 4b:fc:8e:f5:26:e4:6e:70:42:6e:33:ec:31:9e:7b:93:c1:e4: + c9:69:1a:3d:c0:6b:4e:22:6d:ee:ab:58:4d:c6:d0:41:c1:2b: + ea:4f:12:87:5e:eb:45:d8:6c:f5:98:02:d3:a0:d8:55:8a:06: + 99:19:a2:a0:77:d1:30:9e:ac:cc:75:ee:83:f5:b0:62:39:cf: + 6c:57:e2:4c:d2:91:0b:0e:75:28:1b:9a:bf:fd:1a:43:f1:ca: + 77:fb:3b:8f:61:b8:69:28:16:42:04:5e:70:2a:1c:21:d8:8f: + e1:bd:23:5b:2d:74:40:92:d9:63:19:0d:73:dd:69:bc:62:47: + bc:e0:74:2b:b2:eb:7d:be:41:1b:b5:c0:46:c5:a1:22:cb:5f: + 4e:c1:28:92:de:18:ba:d5:2a:28:bb:11:8b:17:93:98:99:60: + 94:5c:23:cf:5a:27:97:5e:0b:05:06:93:37:1e:3b:69:36:eb: + a9:9e:61:1d:8f:32:da:8e:0c:d6:74:3e:7b:09:24:da:01:77: + 47:c4:3b:cd:34:8c:99:f5:ca:e1:25:61:33:b2:59:1b:e2:6e: + d7:37:57:b6:0d:a9:12:da +-----BEGIN CERTIFICATE----- +MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0x +GTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJv +b3QgQ0EgMzAeFw0wNjExMjQxOTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNV +BAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMRswGQYDVQQDExJRdW9W +YWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDM +V0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNggDhoB +4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUr +H556VOijKTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd +8lyyBTNvijbO0BNO/79KDDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9Cabwv +vWhDFlaJKjdhkf2mrk7AyxRllDdLkgbvBNDInIjbC3uBr7E9KsRlOni27tyAsdLT +mZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwpp5ijJUMv7/FfJuGITfhe +btfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8nT8KKdjc +T5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDt +WAEXMJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZ +c6tsgLjoC2SToJyMGf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A +4iLItLRkT9a6fUg+qGkM17uGcclzuD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYD +VR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHTBgkrBgEEAb5YAAMwgcUwgZMG +CCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmljYXRlIGNvbnN0 +aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0 +aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVu +dC4wLQYIKwYBBQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2Nw +czALBgNVHQ8EBAMCAQYwHQYDVR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4G +A1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4ywLQoUmkRzBFMQswCQYDVQQGEwJC +TTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UEAxMSUXVvVmFkaXMg +Um9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZVqyM0 +7ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSem +d1o417+shvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd ++LJ2w/w4E6oM3kJpK27zPOuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B +4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadN +t54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp8kokUvd0/bpO5qgdAm6x +DYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBCbjPsMZ57 +k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6s +zHXug/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0j +Wy10QJLZYxkNc91pvGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeT +mJlglFwjz1onl14LBQaTNx47aTbrqZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK +4SVhM7JZG+Ju1zdXtg2pEto= +-----END CERTIFICATE----- + +Thawte Premium Server CA +======================== + +MD5 Fingerprint=06:9F:69:79:16:66:90:02:1B:8C:8C:A2:C3:07:6F:3A +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc, OU=Certification Services Division, CN=Thawte Premium Server CA/emailAddress=premium-server@thawte.com + Validity + Not Before: Aug 1 00:00:00 1996 GMT + Not After : Dec 31 23:59:59 2020 GMT + Subject: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc, OU=Certification Services Division, CN=Thawte Premium Server CA/emailAddress=premium-server@thawte.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:d2:36:36:6a:8b:d7:c2:5b:9e:da:81:41:62:8f: + 38:ee:49:04:55:d6:d0:ef:1c:1b:95:16:47:ef:18: + 48:35:3a:52:f4:2b:6a:06:8f:3b:2f:ea:56:e3:af: + 86:8d:9e:17:f7:9e:b4:65:75:02:4d:ef:cb:09:a2: + 21:51:d8:9b:d0:67:d0:ba:0d:92:06:14:73:d4:93: + cb:97:2a:00:9c:5c:4e:0c:bc:fa:15:52:fc:f2:44: + 6e:da:11:4a:6e:08:9f:2f:2d:e3:f9:aa:3a:86:73: + b6:46:53:58:c8:89:05:bd:83:11:b8:73:3f:aa:07: + 8d:f4:42:4d:e7:40:9d:1c:37 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: md5WithRSAEncryption + 26:48:2c:16:c2:58:fa:e8:16:74:0c:aa:aa:5f:54:3f:f2:d7: + c9:78:60:5e:5e:6e:37:63:22:77:36:7e:b2:17:c4:34:b9:f5: + 08:85:fc:c9:01:38:ff:4d:be:f2:16:42:43:e7:bb:5a:46:fb: + c1:c6:11:1f:f1:4a:b0:28:46:c9:c3:c4:42:7d:bc:fa:ab:59: + 6e:d5:b7:51:88:11:e3:a4:85:19:6b:82:4c:a4:0c:12:ad:e9: + a4:ae:3f:f1:c3:49:65:9a:8c:c5:c8:3e:25:b7:94:99:bb:92: + 32:71:07:f0:86:5e:ed:50:27:a6:0d:a6:23:f9:bb:cb:a6:07: + 14:42 +-----BEGIN CERTIFICATE----- +MIIDJzCCApCgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBzjELMAkGA1UEBhMCWkEx +FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYD +VQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlv +biBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UEAxMYVGhhd3RlIFByZW1pdW0gU2Vy +dmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNlcnZlckB0aGF3dGUuY29t +MB4XDTk2MDgwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgc4xCzAJBgNVBAYTAlpB +MRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsG +A1UEChMUVGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRp +b24gU2VydmljZXMgRGl2aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNl +cnZlciBDQTEoMCYGCSqGSIb3DQEJARYZcHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNv +bTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0jY2aovXwlue2oFBYo847kkE +VdbQ7xwblRZH7xhINTpS9CtqBo87L+pW46+GjZ4X9560ZXUCTe/LCaIhUdib0GfQ +ug2SBhRz1JPLlyoAnFxODLz6FVL88kRu2hFKbgifLy3j+ao6hnO2RlNYyIkFvYMR +uHM/qgeN9EJN50CdHDcCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG +9w0BAQQFAAOBgQAmSCwWwlj66BZ0DKqqX1Q/8tfJeGBeXm43YyJ3Nn6yF8Q0ufUI +hfzJATj/Tb7yFkJD57taRvvBxhEf8UqwKEbJw8RCfbz6q1lu1bdRiBHjpIUZa4JM +pAwSremkrj/xw0llmozFyD4lt5SZu5IycQfwhl7tUCemDaYj+bvLpgcUQg== +-----END CERTIFICATE----- + +Security Communication Root CA +============================== + +MD5 Fingerprint=F1:BC:63:6A:54:E0:B5:27:F5:CD:E7:1A:E3:4D:6E:4A +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=JP, O=SECOM Trust.net, OU=Security Communication RootCA1 + Validity + Not Before: Sep 30 04:20:49 2003 GMT + Not After : Sep 30 04:20:49 2023 GMT + Subject: C=JP, O=SECOM Trust.net, OU=Security Communication RootCA1 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b3:b3:fe:7f:d3:6d:b1:ef:16:7c:57:a5:0c:6d: + 76:8a:2f:4b:bf:64:fb:4c:ee:8a:f0:f3:29:7c:f5: + ff:ee:2a:e0:e9:e9:ba:5b:64:22:9a:9a:6f:2c:3a: + 26:69:51:05:99:26:dc:d5:1c:6a:71:c6:9a:7d:1e: + 9d:dd:7c:6c:c6:8c:67:67:4a:3e:f8:71:b0:19:27: + a9:09:0c:a6:95:bf:4b:8c:0c:fa:55:98:3b:d8:e8: + 22:a1:4b:71:38:79:ac:97:92:69:b3:89:7e:ea:21: + 68:06:98:14:96:87:d2:61:36:bc:6d:27:56:9e:57: + ee:c0:c0:56:fd:32:cf:a4:d9:8e:c2:23:d7:8d:a8: + f3:d8:25:ac:97:e4:70:38:f4:b6:3a:b4:9d:3b:97: + 26:43:a3:a1:bc:49:59:72:4c:23:30:87:01:58:f6: + 4e:be:1c:68:56:66:af:cd:41:5d:c8:b3:4d:2a:55: + 46:ab:1f:da:1e:e2:40:3d:db:cd:7d:b9:92:80:9c: + 37:dd:0c:96:64:9d:dc:22:f7:64:8b:df:61:de:15: + 94:52:15:a0:7d:52:c9:4b:a8:21:c9:c6:b1:ed:cb: + c3:95:60:d1:0f:f0:ab:70:f8:df:cb:4d:7e:ec:d6: + fa:ab:d9:bd:7f:54:f2:a5:e9:79:fa:d9:d6:76:24: + 28:73 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + A0:73:49:99:68:DC:85:5B:65:E3:9B:28:2F:57:9F:BD:33:BC:07:48 + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: sha1WithRSAEncryption + 68:40:a9:a8:bb:e4:4f:5d:79:b3:05:b5:17:b3:60:13:eb:c6: + 92:5d:e0:d1:d3:6a:fe:fb:be:9b:6d:bf:c7:05:6d:59:20:c4: + 1c:f0:b7:da:84:58:02:63:fa:48:16:ef:4f:a5:0b:f7:4a:98: + f2:3f:9e:1b:ad:47:6b:63:ce:08:47:eb:52:3f:78:9c:af:4d: + ae:f8:d5:4f:cf:9a:98:2a:10:41:39:52:c4:dd:d9:9b:0e:ef: + 93:01:ae:b2:2e:ca:68:42:24:42:6c:b0:b3:3a:3e:cd:e9:da: + 48:c4:15:cb:e9:f9:07:0f:92:50:49:8a:dd:31:97:5f:c9:e9: + 37:aa:3b:59:65:97:94:32:c9:b3:9f:3e:3a:62:58:c5:49:ad: + 62:0e:71:a5:32:aa:2f:c6:89:76:43:40:13:13:67:3d:a2:54: + 25:10:cb:f1:3a:f2:d9:fa:db:49:56:bb:a6:fe:a7:41:35:c3: + e0:88:61:c9:88:c7:df:36:10:22:98:59:ea:b0:4a:fb:56:16: + 73:6e:ac:4d:f7:22:a1:4f:ad:1d:7a:2d:45:27:e5:30:c1:5e: + f2:da:13:cb:25:42:51:95:47:03:8c:6c:21:cc:74:42:ed:53: + ff:33:8b:8f:0f:57:01:16:2f:cf:a6:ee:c9:70:22:14:bd:fd: + be:6c:0b:03 +-----BEGIN CERTIFICATE----- +MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEY +MBYGA1UEChMPU0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21t +dW5pY2F0aW9uIFJvb3RDQTEwHhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5 +WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMPU0VDT00gVHJ1c3QubmV0MScwJQYD +VQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEwggEiMA0GCSqGSIb3 +DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw8yl8 +9f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJ +DKaVv0uMDPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9 +Ms+k2Y7CI9eNqPPYJayX5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/N +QV3Is00qVUarH9oe4kA92819uZKAnDfdDJZkndwi92SL32HeFZRSFaB9UslLqCHJ +xrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2JChzAgMBAAGjPzA9MB0G +A1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYwDwYDVR0T +AQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vG +kl3g0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfr +Uj94nK9NrvjVT8+amCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5 +Bw+SUEmK3TGXX8npN6o7WWWXlDLJs58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJU +JRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ6rBK+1YWc26sTfcioU+tHXot +RSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAiFL39vmwLAw== +-----END CERTIFICATE----- + +Sonera Class 1 Root CA +====================== + +MD5 Fingerprint=33:B7:84:F5:5F:27:D7:68:27:DE:14:DE:12:2A:ED:6F +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 36 (0x24) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=FI, O=Sonera, CN=Sonera Class1 CA + Validity + Not Before: Apr 6 10:49:13 2001 GMT + Not After : Apr 6 10:49:13 2021 GMT + Subject: C=FI, O=Sonera, CN=Sonera Class1 CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b5:89:1f:2b:4f:67:0a:79:ff:c5:1e:f8:7f:3c: + ed:d1:7e:da:b0:cd:6d:2f:36:ac:34:c6:db:d9:64: + 17:08:63:30:33:22:8a:4c:ee:8e:bb:0f:0d:42:55: + c9:9d:2e:a5:ef:f7:a7:8c:c3:ab:b9:97:cb:8e:ef: + 3f:15:67:a8:82:72:63:53:0f:41:8c:7d:10:95:24: + a1:5a:a5:06:fa:92:57:9d:fa:a5:01:f2:75:e9:1f: + bc:56:26:52:4e:78:19:65:58:55:03:58:c0:14:ae: + 8c:7c:55:5f:70:5b:77:23:06:36:97:f3:24:b5:9a: + 46:95:e4:df:0d:0b:05:45:e5:d1:f2:1d:82:bb:c6: + 13:e0:fe:aa:7a:fd:69:30:94:f3:d2:45:85:fc:f2: + 32:5b:32:de:e8:6c:5d:1f:cb:a4:22:74:b0:80:8e: + 5d:94:f7:06:00:4b:a9:d4:5e:2e:35:50:09:f3:80: + 97:f4:0c:17:ae:39:d8:5f:cd:33:c1:1c:ca:89:c2: + 22:f7:45:12:ed:5e:12:93:9d:63:ab:82:2e:b9:eb: + 42:41:44:cb:4a:1a:00:82:0d:9e:f9:8b:57:3e:4c: + c7:17:ed:2c:8b:72:33:5f:72:7a:38:56:d5:e6:d9: + ae:05:1a:1d:75:45:b1:cb:a5:25:1c:12:57:36:fd: + 22:37 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 47:E2:0C:8B:F6:53:88:52 + X509v3 Key Usage: + Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 8b:1a:b2:c9:5d:61:b4:e1:b9:2b:b9:53:d1:b2:85:9d:77:8e: + 16:ee:11:3d:db:c2:63:d9:5b:97:65:fb:12:67:d8:2a:5c:b6: + ab:e5:5e:c3:b7:16:2f:c8:e8:ab:1d:8a:fd:ab:1a:7c:d5:5f: + 63:cf:dc:b0:dd:77:b9:a8:e6:d2:22:38:87:07:14:d9:ff:be: + 56:b5:fd:07:0e:3c:55:ca:16:cc:a7:a6:77:37:fb:db:5c:1f: + 4e:59:06:87:a3:03:43:f5:16:ab:b7:84:bd:4e:ef:9f:31:37: + f0:46:f1:40:b6:d1:0c:a5:64:f8:63:5e:21:db:55:4e:4f:31: + 76:9c:10:61:8e:b6:53:3a:a3:11:be:af:6d:7c:1e:bd:ae:2d: + e2:0c:69:c7:85:53:68:a2:61:ba:c5:3e:b4:79:54:78:9e:0a: + c7:02:be:62:d1:11:82:4b:65:2f:91:5a:c2:a8:87:b1:56:68: + 94:79:f9:25:f7:c1:d5:ae:1a:b8:bb:3d:8f:a9:8a:38:15:f7: + 73:d0:5a:60:d1:80:b0:f0:dc:d5:50:cd:4e:ee:92:48:69:ed: + b2:23:1e:30:cc:c8:94:c8:b6:f5:3b:86:7f:3f:a6:2e:9f:f6: + 3e:2c:b5:92:96:3e:df:2c:93:8a:ff:81:8c:0f:0f:59:21:19: + 57:bd:55:9a +-----BEGIN CERTIFICATE----- +MIIDIDCCAgigAwIBAgIBJDANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEP +MA0GA1UEChMGU29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MxIENBMB4XDTAx +MDQwNjEwNDkxM1oXDTIxMDQwNjEwNDkxM1owOTELMAkGA1UEBhMCRkkxDzANBgNV +BAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJhIENsYXNzMSBDQTCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBALWJHytPZwp5/8Ue+H887dF+2rDNbS82rDTG +29lkFwhjMDMiikzujrsPDUJVyZ0upe/3p4zDq7mXy47vPxVnqIJyY1MPQYx9EJUk +oVqlBvqSV536pQHydekfvFYmUk54GWVYVQNYwBSujHxVX3BbdyMGNpfzJLWaRpXk +3w0LBUXl0fIdgrvGE+D+qnr9aTCU89JFhfzyMlsy3uhsXR/LpCJ0sICOXZT3BgBL +qdReLjVQCfOAl/QMF6452F/NM8EcyonCIvdFEu1eEpOdY6uCLrnrQkFEy0oaAIIN +nvmLVz5MxxftLItyM19yejhW1ebZrgUaHXVFsculJRwSVzb9IjcCAwEAAaMzMDEw +DwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQIR+IMi/ZTiFIwCwYDVR0PBAQDAgEG +MA0GCSqGSIb3DQEBBQUAA4IBAQCLGrLJXWG04bkruVPRsoWdd44W7hE928Jj2VuX +ZfsSZ9gqXLar5V7DtxYvyOirHYr9qxp81V9jz9yw3Xe5qObSIjiHBxTZ/75Wtf0H +DjxVyhbMp6Z3N/vbXB9OWQaHowND9Rart4S9Tu+fMTfwRvFAttEMpWT4Y14h21VO +TzF2nBBhjrZTOqMRvq9tfB69ri3iDGnHhVNoomG6xT60eVR4ngrHAr5i0RGCS2Uv +kVrCqIexVmiUefkl98HVrhq4uz2PqYo4Ffdz0Fpg0YCw8NzVUM1O7pJIae2yIx4w +zMiUyLb1O4Z/P6Yun/Y+LLWSlj7fLJOK/4GMDw9ZIRlXvVWa +-----END CERTIFICATE----- + +Sonera Class 2 Root CA +====================== + +MD5 Fingerprint=A3:EC:75:0F:2E:88:DF:FA:48:01:4E:0B:5C:48:6F:FB +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 29 (0x1d) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=FI, O=Sonera, CN=Sonera Class2 CA + Validity + Not Before: Apr 6 07:29:40 2001 GMT + Not After : Apr 6 07:29:40 2021 GMT + Subject: C=FI, O=Sonera, CN=Sonera Class2 CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:90:17:4a:35:9d:ca:f0:0d:96:c7:44:fa:16:37: + fc:48:bd:bd:7f:80:2d:35:3b:e1:6f:a8:67:a9:bf: + 03:1c:4d:8c:6f:32:47:d5:41:68:a4:13:04:c1:35: + 0c:9a:84:43:fc:5c:1d:ff:89:b3:e8:17:18:cd:91: + 5f:fb:89:e3:ea:bf:4e:5d:7c:1b:26:d3:75:79:ed: + e6:84:e3:57:e5:ad:29:c4:f4:3a:28:e7:a5:7b:84: + 36:69:b3:fd:5e:76:bd:a3:2d:99:d3:90:4e:23:28: + 7d:18:63:f1:54:3b:26:9d:76:5b:97:42:b2:ff:ae: + f0:4e:ec:dd:39:95:4e:83:06:7f:e7:49:40:c8:c5: + 01:b2:54:5a:66:1d:3d:fc:f9:e9:3c:0a:9e:81:b8: + 70:f0:01:8b:e4:23:54:7c:c8:ae:f8:90:1e:00:96: + 72:d4:54:cf:61:23:bc:ea:fb:9d:02:95:d1:b6:b9: + 71:3a:69:08:3f:0f:b4:e1:42:c7:88:f5:3f:98:a8: + a7:ba:1c:e0:71:71:ef:58:57:81:50:7a:5c:6b:74: + 46:0e:83:03:98:c3:8e:a8:6e:f2:76:32:6e:27:83: + c2:73:f3:dc:18:e8:b4:93:ea:75:44:6b:04:60:20: + 71:57:87:9d:f3:be:a0:90:23:3d:8a:24:e1:da:21: + db:c3 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 4A:A0:AA:58:84:D3:5E:3C + X509v3 Key Usage: + Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 5a:ce:87:f9:16:72:15:57:4b:1d:d9:9b:e7:a2:26:30:ec:93: + 67:df:d6:2d:d2:34:af:f7:38:a5:ce:ab:16:b9:ab:2f:7c:35: + cb:ac:d0:0f:b4:4c:2b:fc:80:ef:6b:8c:91:5f:36:76:f7:db: + b3:1b:19:ea:f4:b2:11:fd:61:71:44:bf:28:b3:3a:1d:bf:b3: + 43:e8:9f:bf:dc:31:08:71:b0:9d:8d:d6:34:47:32:90:c6:65: + 24:f7:a0:4a:7c:04:73:8f:39:6f:17:8c:72:b5:bd:4b:c8:7a: + f8:7b:83:c3:28:4e:9c:09:ea:67:3f:b2:67:04:1b:c3:14:da: + f8:e7:49:24:91:d0:1d:6a:fa:61:39:ef:6b:e7:21:75:06:07: + d8:12:b4:21:20:70:42:71:81:da:3c:9a:36:be:a6:5b:0d:6a: + 6c:9a:1f:91:7b:f9:f9:ef:42:ba:4e:4e:9e:cc:0c:8d:94:dc: + d9:45:9c:5e:ec:42:50:63:ae:f4:5d:c4:b1:12:dc:ca:3b:a8: + 2e:9d:14:5a:05:75:b7:ec:d7:63:e2:ba:35:b6:04:08:91:e8: + da:9d:9c:f6:66:b5:18:ac:0a:a6:54:26:34:33:d2:1b:c1:d4: + 7f:1a:3a:8e:0b:aa:32:6e:db:fc:4f:25:9f:d9:32:c7:96:5a: + 70:ac:df:4c +-----BEGIN CERTIFICATE----- +MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEP +MA0GA1UEChMGU29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAx +MDQwNjA3Mjk0MFoXDTIxMDQwNjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNV +BAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJhIENsYXNzMiBDQTCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3/Ei9vX+ALTU74W+o +Z6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybTdXnt +5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s +3TmVToMGf+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2Ej +vOr7nQKV0ba5cTppCD8PtOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu +8nYybieDwnPz3BjotJPqdURrBGAgcVeHnfO+oJAjPYok4doh28MCAwEAAaMzMDEw +DwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITTXjwwCwYDVR0PBAQDAgEG +MA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt0jSv9zil +zqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/ +3DEIcbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvD +FNr450kkkdAdavphOe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6 +Tk6ezAyNlNzZRZxe7EJQY670XcSxEtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2 +ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLHllpwrN9M +-----END CERTIFICATE----- + +Staat der Nederlanden Root CA +============================= + +MD5 Fingerprint=60:84:7C:5A:CE:DB:0C:D4:CB:A7:E9:FE:02:C6:A9:C0 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 10000010 (0x98968a) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=NL, O=Staat der Nederlanden, CN=Staat der Nederlanden Root CA + Validity + Not Before: Dec 17 09:23:49 2002 GMT + Not After : Dec 16 09:15:38 2015 GMT + Subject: C=NL, O=Staat der Nederlanden, CN=Staat der Nederlanden Root CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:98:d2:b5:51:11:7a:81:a6:14:98:71:6d:be:cc: + e7:13:1b:d6:27:0e:7a:b3:6a:18:1c:b6:61:5a:d5: + 61:09:bf:de:90:13:c7:67:ee:dd:f3:da:c5:0c:12: + 9e:35:55:3e:2c:27:88:40:6b:f7:dc:dd:22:61:f5: + c2:c7:0e:f5:f6:d5:76:53:4d:8f:8c:bc:18:76:37: + 85:9d:e8:ca:49:c7:d2:4f:98:13:09:a2:3e:22:88: + 9c:7f:d6:f2:10:65:b4:ee:5f:18:d5:17:e3:f8:c5: + fd:e2:9d:a2:ef:53:0e:85:77:a2:0f:e1:30:47:ee: + 00:e7:33:7d:44:67:1a:0b:51:e8:8b:a0:9e:50:98: + 68:34:52:1f:2e:6d:01:f2:60:45:f2:31:eb:a9:31: + 68:29:bb:7a:41:9e:c6:19:7f:94:b4:51:39:03:7f: + b2:de:a7:32:9b:b4:47:8e:6f:b4:4a:ae:e5:af:b1: + dc:b0:1b:61:bc:99:72:de:e4:89:b7:7a:26:5d:da: + 33:49:5b:52:9c:0e:f5:8a:ad:c3:b8:3d:e8:06:6a: + c2:d5:2a:0b:6c:7b:84:bd:56:05:cb:86:65:92:ec: + 44:2b:b0:8e:b9:dc:70:0b:46:da:ad:bc:63:88:39: + fa:db:6a:fe:23:fa:bc:e4:48:f4:67:2b:6a:11:10: + 21:49 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:TRUE + X509v3 Certificate Policies: + Policy: 2.5.29.32.0 + CPS: http://www.pkioverheid.nl/policies/root-policy + + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Subject Key Identifier: + A8:7D:EB:BC:63:A4:74:13:74:00:EC:96:E0:D3:34:C1:2C:BF:6C:F8 + Signature Algorithm: sha1WithRSAEncryption + 05:84:87:55:74:36:61:c1:bb:d1:d4:c6:15:a8:13:b4:9f:a4: + fe:bb:ee:15:b4:2f:06:0c:29:f2:a8:92:a4:61:0d:fc:ab:5c: + 08:5b:51:13:2b:4d:c2:2a:61:c8:f8:09:58:fc:2d:02:b2:39: + 7d:99:66:81:bf:6e:5c:95:45:20:6c:e6:79:a7:d1:d8:1c:29: + fc:c2:20:27:51:c8:f1:7c:5d:34:67:69:85:11:30:c6:00:d2: + d7:f3:d3:7c:b6:f0:31:57:28:12:82:73:e9:33:2f:a6:55:b4: + 0b:91:94:47:9c:fa:bb:7a:42:32:e8:ae:7e:2d:c8:bc:ac:14: + bf:d9:0f:d9:5b:fc:c1:f9:7a:95:e1:7d:7e:96:fc:71:b0:c2: + 4c:c8:df:45:34:c9:ce:0d:f2:9c:64:08:d0:3b:c3:29:c5:b2: + ed:90:04:c1:b1:29:91:c5:30:6f:c1:a9:72:33:cc:fe:5d:16: + 17:2c:11:69:e7:7e:fe:c5:83:08:df:bc:dc:22:3a:2e:20:69: + 23:39:56:60:67:90:8b:2e:76:39:fb:11:88:97:f6:7c:bd:4b: + b8:20:16:67:05:8d:e2:3b:c1:72:3f:94:95:37:c7:5d:b9:9e: + d8:93:a1:17:8f:ff:0c:66:15:c1:24:7c:32:7c:03:1d:3b:a1: + 58:45:32:93 +-----BEGIN CERTIFICATE----- +MIIDujCCAqKgAwIBAgIEAJiWijANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQGEwJO +TDEeMBwGA1UEChMVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSYwJAYDVQQDEx1TdGFh +dCBkZXIgTmVkZXJsYW5kZW4gUm9vdCBDQTAeFw0wMjEyMTcwOTIzNDlaFw0xNTEy +MTYwOTE1MzhaMFUxCzAJBgNVBAYTAk5MMR4wHAYDVQQKExVTdGFhdCBkZXIgTmVk +ZXJsYW5kZW4xJjAkBgNVBAMTHVN0YWF0IGRlciBOZWRlcmxhbmRlbiBSb290IENB +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmNK1URF6gaYUmHFtvszn +ExvWJw56s2oYHLZhWtVhCb/ekBPHZ+7d89rFDBKeNVU+LCeIQGv33N0iYfXCxw71 +9tV2U02PjLwYdjeFnejKScfST5gTCaI+Ioicf9byEGW07l8Y1Rfj+MX94p2i71MO +hXeiD+EwR+4A5zN9RGcaC1Hoi6CeUJhoNFIfLm0B8mBF8jHrqTFoKbt6QZ7GGX+U +tFE5A3+y3qcym7RHjm+0Sq7lr7HcsBthvJly3uSJt3omXdozSVtSnA71iq3DuD3o +BmrC1SoLbHuEvVYFy4ZlkuxEK7COudxwC0barbxjiDn622r+I/q85Ej0ZytqERAh +SQIDAQABo4GRMIGOMAwGA1UdEwQFMAMBAf8wTwYDVR0gBEgwRjBEBgRVHSAAMDww +OgYIKwYBBQUHAgEWLmh0dHA6Ly93d3cucGtpb3ZlcmhlaWQubmwvcG9saWNpZXMv +cm9vdC1wb2xpY3kwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSofeu8Y6R0E3QA +7Jbg0zTBLL9s+DANBgkqhkiG9w0BAQUFAAOCAQEABYSHVXQ2YcG70dTGFagTtJ+k +/rvuFbQvBgwp8qiSpGEN/KtcCFtREytNwiphyPgJWPwtArI5fZlmgb9uXJVFIGzm +eafR2Bwp/MIgJ1HI8XxdNGdphREwxgDS1/PTfLbwMVcoEoJz6TMvplW0C5GUR5z6 +u3pCMuiufi3IvKwUv9kP2Vv8wfl6leF9fpb8cbDCTMjfRTTJzg3ynGQI0DvDKcWy +7ZAEwbEpkcUwb8GpcjPM/l0WFywRaed+/sWDCN+83CI6LiBpIzlWYGeQiy52OfsR +iJf2fL1LuCAWZwWN4jvBcj+UlTfHXbme2JOhF4//DGYVwSR8MnwDHTuhWEUykw== +-----END CERTIFICATE----- + +TDC Internet Root CA +==================== + +MD5 Fingerprint=91:F4:03:55:20:A1:F8:63:2C:62:DE:AC:FB:61:1C:8E +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 986490188 (0x3acca54c) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=DK, O=TDC Internet, OU=TDC Internet Root CA + Validity + Not Before: Apr 5 16:33:17 2001 GMT + Not After : Apr 5 17:03:17 2021 GMT + Subject: C=DK, O=TDC Internet, OU=TDC Internet Root CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:c4:b8:40:bc:91:d5:63:1f:d7:99:a0:8b:0c:40: + 1e:74:b7:48:9d:46:8c:02:b2:e0:24:5f:f0:19:13: + a7:37:83:6b:5d:c7:8e:f9:84:30:ce:1a:3b:fa:fb: + ce:8b:6d:23:c6:c3:6e:66:9f:89:a5:df:e0:42:50: + 67:fa:1f:6c:1e:f4:d0:05:d6:bf:ca:d6:4e:e4:68: + 60:6c:46:aa:1c:5d:63:e1:07:86:0e:65:00:a7:2e: + a6:71:c6:bc:b9:81:a8:3a:7d:1a:d2:f9:d1:ac:4b: + cb:ce:75:af:dc:7b:fa:81:73:d4:fc:ba:bd:41:88: + d4:74:b3:f9:5e:38:3a:3c:43:a8:d2:95:4e:77:6d: + 13:0c:9d:8f:78:01:b7:5a:20:1f:03:37:35:e2:2c: + db:4b:2b:2c:78:b9:49:db:c4:d0:c7:9c:9c:e4:8a: + 20:09:21:16:56:66:ff:05:ec:5b:e3:f0:cf:ab:24: + 24:5e:c3:7f:70:7a:12:c4:d2:b5:10:a0:b6:21:e1: + 8d:78:69:55:44:69:f5:ca:96:1c:34:85:17:25:77: + e2:f6:2f:27:98:78:fd:79:06:3a:a2:d6:5a:43:c1: + ff:ec:04:3b:ee:13:ef:d3:58:5a:ff:92:eb:ec:ae: + da:f2:37:03:47:41:b6:97:c9:2d:0a:41:22:bb:bb: + e6:a7 + Exponent: 65537 (0x10001) + X509v3 extensions: + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 CRL Distribution Points: + DirName:/C=DK/O=TDC Internet/OU=TDC Internet Root CA/CN=CRL1 + + X509v3 Private Key Usage Period: + Not Before: Apr 5 16:33:17 2001 GMT, Not After: Apr 5 17:03:17 2021 GMT + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:6C:64:01:C7:FD:85:6D:AC:C8:DA:9E:50:08:85:08:B5:3C:56:A8:50 + + X509v3 Subject Key Identifier: + 6C:64:01:C7:FD:85:6D:AC:C8:DA:9E:50:08:85:08:B5:3C:56:A8:50 + X509v3 Basic Constraints: + CA:TRUE + 1.2.840.113533.7.65.0: + 0...V5.0:4.0.... + Signature Algorithm: sha1WithRSAEncryption + 4e:43:cc:d1:dd:1d:10:1b:06:7f:b7:a4:fa:d3:d9:4d:fb:23: + 9f:23:54:5b:e6:8b:2f:04:28:8b:b5:27:6d:89:a1:ec:98:69: + dc:e7:8d:26:83:05:79:74:ec:b4:b9:a3:97:c1:35:00:fd:15: + da:39:81:3a:95:31:90:de:97:e9:86:a8:99:77:0c:e5:5a:a0: + 84:ff:12:16:ac:6e:b8:8d:c3:7b:92:c2:ac:2e:d0:7d:28:ec: + b6:f3:60:38:69:6f:3e:d8:04:55:3e:9e:cc:55:d2:ba:fe:bb: + 47:04:d7:0a:d9:16:0a:34:29:f5:58:13:d5:4f:cf:8f:56:4b: + b3:1e:ee:d3:98:79:da:08:1e:0c:6f:b8:f8:16:27:ef:c2:6f: + 3d:f6:a3:4b:3e:0e:e4:6d:6c:db:3b:41:12:9b:bd:0d:47:23: + 7f:3c:4a:d0:af:c0:af:f6:ef:1b:b5:15:c4:eb:83:c4:09:5f: + 74:8b:d9:11:fb:c2:56:b1:3c:f8:70:ca:34:8d:43:40:13:8c: + fd:99:03:54:79:c6:2e:ea:86:a1:f6:3a:d4:09:bc:f4:bc:66: + cc:3d:58:d0:57:49:0a:ee:25:e2:41:ee:13:f9:9b:38:34:d1: + 00:f5:7e:e7:94:1d:fc:69:03:62:b8:99:05:05:3d:6b:78:12: + bd:b0:6f:65 +-----BEGIN CERTIFICATE----- +MIIEKzCCAxOgAwIBAgIEOsylTDANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJE +SzEVMBMGA1UEChMMVERDIEludGVybmV0MR0wGwYDVQQLExRUREMgSW50ZXJuZXQg +Um9vdCBDQTAeFw0wMTA0MDUxNjMzMTdaFw0yMTA0MDUxNzAzMTdaMEMxCzAJBgNV +BAYTAkRLMRUwEwYDVQQKEwxUREMgSW50ZXJuZXQxHTAbBgNVBAsTFFREQyBJbnRl +cm5ldCBSb290IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxLhA +vJHVYx/XmaCLDEAedLdInUaMArLgJF/wGROnN4NrXceO+YQwzho7+vvOi20jxsNu +Zp+Jpd/gQlBn+h9sHvTQBda/ytZO5GhgbEaqHF1j4QeGDmUApy6mcca8uYGoOn0a +0vnRrEvLznWv3Hv6gXPU/Lq9QYjUdLP5Xjg6PEOo0pVOd20TDJ2PeAG3WiAfAzc1 +4izbSysseLlJ28TQx5yc5IogCSEWVmb/Bexb4/DPqyQkXsN/cHoSxNK1EKC2IeGN +eGlVRGn1ypYcNIUXJXfi9i8nmHj9eQY6otZaQ8H/7AQ77hPv01ha/5Lr7K7a8jcD +R0G2l8ktCkEiu7vmpwIDAQABo4IBJTCCASEwEQYJYIZIAYb4QgEBBAQDAgAHMGUG +A1UdHwReMFwwWqBYoFakVDBSMQswCQYDVQQGEwJESzEVMBMGA1UEChMMVERDIElu +dGVybmV0MR0wGwYDVQQLExRUREMgSW50ZXJuZXQgUm9vdCBDQTENMAsGA1UEAxME +Q1JMMTArBgNVHRAEJDAigA8yMDAxMDQwNTE2MzMxN1qBDzIwMjEwNDA1MTcwMzE3 +WjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUbGQBx/2FbazI2p5QCIUItTxWqFAw +HQYDVR0OBBYEFGxkAcf9hW2syNqeUAiFCLU8VqhQMAwGA1UdEwQFMAMBAf8wHQYJ +KoZIhvZ9B0EABBAwDhsIVjUuMDo0LjADAgSQMA0GCSqGSIb3DQEBBQUAA4IBAQBO +Q8zR3R0QGwZ/t6T609lN+yOfI1Rb5osvBCiLtSdtiaHsmGnc540mgwV5dOy0uaOX +wTUA/RXaOYE6lTGQ3pfphqiZdwzlWqCE/xIWrG64jcN7ksKsLtB9KOy282A4aW8+ +2ARVPp7MVdK6/rtHBNcK2RYKNCn1WBPVT8+PVkuzHu7TmHnaCB4Mb7j4Fifvwm89 +9qNLPg7kbWzbO0ESm70NRyN/PErQr8Cv9u8btRXE64PECV90i9kR+8JWsTz4cMo0 +jUNAE4z9mQNUecYu6oah9jrUCbz0vGbMPVjQV0kK7iXiQe4T+Zs4NNEA9X7nlB38 +aQNiuJkFBT1reBK9sG9l +-----END CERTIFICATE----- + +TDC OCES Root CA +================ + +MD5 Fingerprint=93:7F:90:1C:ED:84:67:17:A4:65:5F:9B:CB:30:02:97 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1044954564 (0x3e48bdc4) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=DK, O=TDC, CN=TDC OCES CA + Validity + Not Before: Feb 11 08:39:30 2003 GMT + Not After : Feb 11 09:09:30 2037 GMT + Subject: C=DK, O=TDC, CN=TDC OCES CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:ac:62:f6:61:20:b2:cf:c0:c6:85:d7:e3:79:e6: + cc:ed:f2:39:92:a4:97:2e:64:a3:84:5b:87:9c:4c: + fd:a4:f3:c4:5f:21:bd:56:10:eb:db:2e:61:ec:93: + 69:e3:a3:cc:bd:99:c3:05:fc:06:b8:ca:36:1c:fe: + 90:8e:49:4c:c4:56:9a:2f:56:bc:cf:7b:0c:f1:6f: + 47:a6:0d:43:4d:e2:e9:1d:39:34:cd:8d:2c:d9:12: + 98:f9:e3:e1:c1:4a:7c:86:38:c4:a9:c4:61:88:d2: + 5e:af:1a:26:4d:d5:e4:a0:22:47:84:d9:64:b7:19: + 96:fc:ec:19:e4:b2:97:26:4e:4a:4c:cb:8f:24:8b: + 54:18:1c:48:61:7b:d5:88:68:da:5d:b5:ea:cd:1a: + 30:c1:80:83:76:50:aa:4f:d1:d4:dd:38:f0:ef:16: + f4:e1:0c:50:06:bf:ea:fb:7a:49:a1:28:2b:1c:f6: + fc:15:32:a3:74:6a:8f:a9:c3:62:29:71:31:e5:3b: + a4:60:17:5e:74:e6:da:13:ed:e9:1f:1f:1b:d1:b2: + 68:73:c6:10:34:75:46:10:10:e3:90:00:76:40:cb: + 8b:b7:43:09:21:ff:ab:4e:93:c6:58:e9:a5:82:db: + 77:c4:3a:99:b1:72:95:49:04:f0:b7:2b:fa:7b:59: + 8e:dd + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Certificate Policies: + Policy: 1.2.208.169.1.1.1 + CPS: http://www.certifikat.dk/repository + User Notice: + Organization: TDC + Number: 1 + Explicit Text: Certifikater fra denne CA udstedes under OID 1.2.208.169.1.1.1. Certificates from this CA are issued under OID 1.2.208.169.1.1.1. + + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 CRL Distribution Points: + DirName:/C=DK/O=TDC/CN=TDC OCES CA/CN=CRL1 + URI:http://crl.oces.certifikat.dk/oces.crl + + X509v3 Private Key Usage Period: + Not Before: Feb 11 08:39:30 2003 GMT, Not After: Feb 11 09:09:30 2037 GMT + X509v3 Authority Key Identifier: + keyid:60:B5:85:EC:56:64:7E:12:19:27:67:1D:50:15:4B:73:AE:3B:F9:12 + + X509v3 Subject Key Identifier: + 60:B5:85:EC:56:64:7E:12:19:27:67:1D:50:15:4B:73:AE:3B:F9:12 + 1.2.840.113533.7.65.0: + 0...V6.0:4.0.... + Signature Algorithm: sha1WithRSAEncryption + 0a:ba:26:26:46:d3:73:a8:09:f3:6b:0b:30:99:fd:8a:e1:57: + 7a:11:d3:b8:94:d7:09:10:6e:a3:b1:38:03:d1:b6:f2:43:41: + 29:62:a7:72:d8:fb:7c:05:e6:31:70:27:54:18:4e:8a:7c:4e: + e5:d1:ca:8c:78:88:cf:1b:d3:90:8b:e6:23:f8:0b:0e:33:43: + 7d:9c:e2:0a:19:8f:c9:01:3e:74:5d:74:c9:8b:1c:03:e5:18: + c8:01:4c:3f:cb:97:05:5d:98:71:a6:98:6f:b6:7c:bd:37:7f: + be:e1:93:25:6d:6f:f0:0a:ad:17:18:e1:03:bc:07:29:c8:ad: + 26:e8:f8:61:f0:fd:21:09:7e:9a:8e:a9:68:7d:48:62:72:bd: + 00:ea:01:99:b8:06:82:51:81:4e:f1:f5:b4:91:54:b9:23:7a: + 00:9a:9f:5d:8d:e0:3c:64:b9:1a:12:92:2a:c7:82:44:72:39: + dc:e2:3c:c6:d8:55:f5:15:4e:c8:05:0e:db:c6:d0:62:a6:ec: + 15:b4:b5:02:82:db:ac:8c:a2:81:f0:9b:99:31:f5:20:20:a8: + 88:61:0a:07:9f:94:fc:d0:d7:1b:cc:2e:17:f3:04:27:76:67: + eb:54:83:fd:a4:90:7e:06:3d:04:a3:43:2d:da:fc:0b:62:ea: + 2f:5f:62:53 +-----BEGIN CERTIFICATE----- +MIIFGTCCBAGgAwIBAgIEPki9xDANBgkqhkiG9w0BAQUFADAxMQswCQYDVQQGEwJE +SzEMMAoGA1UEChMDVERDMRQwEgYDVQQDEwtUREMgT0NFUyBDQTAeFw0wMzAyMTEw +ODM5MzBaFw0zNzAyMTEwOTA5MzBaMDExCzAJBgNVBAYTAkRLMQwwCgYDVQQKEwNU +REMxFDASBgNVBAMTC1REQyBPQ0VTIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A +MIIBCgKCAQEArGL2YSCyz8DGhdfjeebM7fI5kqSXLmSjhFuHnEz9pPPEXyG9VhDr +2y5h7JNp46PMvZnDBfwGuMo2HP6QjklMxFaaL1a8z3sM8W9Hpg1DTeLpHTk0zY0s +2RKY+ePhwUp8hjjEqcRhiNJerxomTdXkoCJHhNlktxmW/OwZ5LKXJk5KTMuPJItU +GBxIYXvViGjaXbXqzRowwYCDdlCqT9HU3Tjw7xb04QxQBr/q+3pJoSgrHPb8FTKj +dGqPqcNiKXEx5TukYBdedObaE+3pHx8b0bJoc8YQNHVGEBDjkAB2QMuLt0MJIf+r +TpPGWOmlgtt3xDqZsXKVSQTwtyv6e1mO3QIDAQABo4ICNzCCAjMwDwYDVR0TAQH/ +BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwgewGA1UdIASB5DCB4TCB3gYIKoFQgSkB +AQEwgdEwLwYIKwYBBQUHAgEWI2h0dHA6Ly93d3cuY2VydGlmaWthdC5kay9yZXBv +c2l0b3J5MIGdBggrBgEFBQcCAjCBkDAKFgNUREMwAwIBARqBgUNlcnRpZmlrYXRl +ciBmcmEgZGVubmUgQ0EgdWRzdGVkZXMgdW5kZXIgT0lEIDEuMi4yMDguMTY5LjEu +MS4xLiBDZXJ0aWZpY2F0ZXMgZnJvbSB0aGlzIENBIGFyZSBpc3N1ZWQgdW5kZXIg +T0lEIDEuMi4yMDguMTY5LjEuMS4xLjARBglghkgBhvhCAQEEBAMCAAcwgYEGA1Ud +HwR6MHgwSKBGoESkQjBAMQswCQYDVQQGEwJESzEMMAoGA1UEChMDVERDMRQwEgYD +VQQDEwtUREMgT0NFUyBDQTENMAsGA1UEAxMEQ1JMMTAsoCqgKIYmaHR0cDovL2Ny +bC5vY2VzLmNlcnRpZmlrYXQuZGsvb2Nlcy5jcmwwKwYDVR0QBCQwIoAPMjAwMzAy +MTEwODM5MzBagQ8yMDM3MDIxMTA5MDkzMFowHwYDVR0jBBgwFoAUYLWF7FZkfhIZ +J2cdUBVLc647+RIwHQYDVR0OBBYEFGC1hexWZH4SGSdnHVAVS3OuO/kSMB0GCSqG +SIb2fQdBAAQQMA4bCFY2LjA6NC4wAwIEkDANBgkqhkiG9w0BAQUFAAOCAQEACrom +JkbTc6gJ82sLMJn9iuFXehHTuJTXCRBuo7E4A9G28kNBKWKnctj7fAXmMXAnVBhO +inxO5dHKjHiIzxvTkIvmI/gLDjNDfZziChmPyQE+dF10yYscA+UYyAFMP8uXBV2Y +caaYb7Z8vTd/vuGTJW1v8AqtFxjhA7wHKcitJuj4YfD9IQl+mo6paH1IYnK9AOoB +mbgGglGBTvH1tJFUuSN6AJqfXY3gPGS5GhKSKseCRHI53OI8xthV9RVOyAUO28bQ +YqbsFbS1AoLbrIyigfCbmTH1ICCoiGEKB5+U/NDXG8wuF/MEJ3Zn61SD/aSQfgY9 +BKNDLdr8C2LqL19iUw== +-----END CERTIFICATE----- + +UTN DATACorp SGC Root CA +======================== + +MD5 Fingerprint=B3:A5:3E:77:21:6D:AC:4A:C0:C9:FB:D5:41:3D:CA:06 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 44:be:0c:8b:50:00:21:b4:11:d3:2a:68:06:a9:ad:69 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN - DATACorp SGC + Validity + Not Before: Jun 24 18:57:21 1999 GMT + Not After : Jun 24 19:06:30 2019 GMT + Subject: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN - DATACorp SGC + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:df:ee:58:10:a2:2b:6e:55:c4:8e:bf:2e:46:09: + e7:e0:08:0f:2e:2b:7a:13:94:1b:bd:f6:b6:80:8e: + 65:05:93:00:1e:bc:af:e2:0f:8e:19:0d:12:47:ec: + ac:ad:a3:fa:2e:70:f8:de:6e:fb:56:42:15:9e:2e: + 5c:ef:23:de:21:b9:05:76:27:19:0f:4f:d6:c3:9c: + b4:be:94:19:63:f2:a6:11:0a:eb:53:48:9c:be:f2: + 29:3b:16:e8:1a:a0:4c:a6:c9:f4:18:59:68:c0:70: + f2:53:00:c0:5e:50:82:a5:56:6f:36:f9:4a:e0:44: + 86:a0:4d:4e:d6:47:6e:49:4a:cb:67:d7:a6:c4:05: + b9:8e:1e:f4:fc:ff:cd:e7:36:e0:9c:05:6c:b2:33: + 22:15:d0:b4:e0:cc:17:c0:b2:c0:f4:fe:32:3f:29: + 2a:95:7b:d8:f2:a7:4e:0f:54:7c:a1:0d:80:b3:09: + 03:c1:ff:5c:dd:5e:9a:3e:bc:ae:bc:47:8a:6a:ae: + 71:ca:1f:b1:2a:b8:5f:42:05:0b:ec:46:30:d1:72: + 0b:ca:e9:56:6d:f5:ef:df:78:be:61:ba:b2:a5:ae: + 04:4c:bc:a8:ac:69:15:97:bd:ef:eb:b4:8c:bf:35: + f8:d4:c3:d1:28:0e:5c:3a:9f:70:18:33:20:77:c4: + a2:af + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: + Digital Signature, Non Repudiation, Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 53:32:D1:B3:CF:7F:FA:E0:F1:A0:5D:85:4E:92:D2:9E:45:1D:B4:4F + X509v3 CRL Distribution Points: + URI:http://crl.usertrust.com/UTN-DATACorpSGC.crl + + X509v3 Extended Key Usage: + TLS Web Server Authentication, Microsoft Server Gated Crypto, Netscape Server Gated Crypto + Signature Algorithm: sha1WithRSAEncryption + 27:35:97:00:8a:8b:28:bd:c6:33:30:1e:29:fc:e2:f7:d5:98: + d4:40:bb:60:ca:bf:ab:17:2c:09:36:7f:50:fa:41:dc:ae:96: + 3a:0a:23:3e:89:59:c9:a3:07:ed:1b:37:ad:fc:7c:be:51:49: + 5a:de:3a:0a:54:08:16:45:c2:99:b1:87:cd:8c:68:e0:69:03: + e9:c4:4e:98:b2:3b:8c:16:b3:0e:a0:0c:98:50:9b:93:a9:70: + 09:c8:2c:a3:8f:df:02:e4:e0:71:3a:f1:b4:23:72:a0:aa:01: + df:df:98:3e:14:50:a0:31:26:bd:28:e9:5a:30:26:75:f9:7b: + 60:1c:8d:f3:cd:50:26:6d:04:27:9a:df:d5:0d:45:47:29:6b: + 2c:e6:76:d9:a9:29:7d:32:dd:c9:36:3c:bd:ae:35:f1:11:9e: + 1d:bb:90:3f:12:47:4e:8e:d7:7e:0f:62:73:1d:52:26:38:1c: + 18:49:fd:30:74:9a:c4:e5:22:2f:d8:c0:8d:ed:91:7a:4c:00: + 8f:72:7f:5d:da:dd:1b:8b:45:6b:e7:dd:69:97:a8:c5:56:4c: + 0f:0c:f6:9f:7a:91:37:f6:97:82:e0:dd:71:69:ff:76:3f:60: + 4d:3c:cf:f7:99:f9:c6:57:f4:c9:55:39:78:ba:2c:79:c9:a6: + 88:2b:f4:08 +-----BEGIN CERTIFICATE----- +MIIEXjCCA0agAwIBAgIQRL4Mi1AAIbQR0ypoBqmtaTANBgkqhkiG9w0BAQUFADCB +kzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug +Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho +dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZBgNVBAMTElVUTiAtIERBVEFDb3Jw +IFNHQzAeFw05OTA2MjQxODU3MjFaFw0xOTA2MjQxOTA2MzBaMIGTMQswCQYDVQQG +EwJVUzELMAkGA1UECBMCVVQxFzAVBgNVBAcTDlNhbHQgTGFrZSBDaXR5MR4wHAYD +VQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxITAfBgNVBAsTGGh0dHA6Ly93d3cu +dXNlcnRydXN0LmNvbTEbMBkGA1UEAxMSVVROIC0gREFUQUNvcnAgU0dDMIIBIjAN +BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3+5YEKIrblXEjr8uRgnn4AgPLit6 +E5Qbvfa2gI5lBZMAHryv4g+OGQ0SR+ysraP6LnD43m77VkIVni5c7yPeIbkFdicZ +D0/Ww5y0vpQZY/KmEQrrU0icvvIpOxboGqBMpsn0GFlowHDyUwDAXlCCpVZvNvlK +4ESGoE1O1kduSUrLZ9emxAW5jh70/P/N5zbgnAVssjMiFdC04MwXwLLA9P4yPykq +lXvY8qdOD1R8oQ2AswkDwf9c3V6aPryuvEeKaq5xyh+xKrhfQgUL7EYw0XILyulW +bfXv33i+Ybqypa4ETLyorGkVl73v67SMvzX41MPRKA5cOp9wGDMgd8SirwIDAQAB +o4GrMIGoMAsGA1UdDwQEAwIBxjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRT +MtGzz3/64PGgXYVOktKeRR20TzA9BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vY3Js +LnVzZXJ0cnVzdC5jb20vVVROLURBVEFDb3JwU0dDLmNybDAqBgNVHSUEIzAhBggr +BgEFBQcDAQYKKwYBBAGCNwoDAwYJYIZIAYb4QgQBMA0GCSqGSIb3DQEBBQUAA4IB +AQAnNZcAiosovcYzMB4p/OL31ZjUQLtgyr+rFywJNn9Q+kHcrpY6CiM+iVnJowft +Gzet/Hy+UUla3joKVAgWRcKZsYfNjGjgaQPpxE6YsjuMFrMOoAyYUJuTqXAJyCyj +j98C5OBxOvG0I3KgqgHf35g+FFCgMSa9KOlaMCZ1+XtgHI3zzVAmbQQnmt/VDUVH +KWss5nbZqSl9Mt3JNjy9rjXxEZ4du5A/EkdOjtd+D2JzHVImOBwYSf0wdJrE5SIv +2MCN7ZF6TACPcn9d2t0bi0Vr591pl6jFVkwPDPafepE39peC4N1xaf92P2BNPM/3 +mfnGV/TJVTl4uix5yaaIK/QI +-----END CERTIFICATE----- + +UTN USERFirst Email Root CA +=========================== + +MD5 Fingerprint=D7:34:3D:EF:1D:27:09:28:E1:31:02:5B:13:2B:DD:F7 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 44:be:0c:8b:50:00:24:b4:11:d3:36:25:25:67:c9:89 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN-USERFirst-Client Authentication and Email + Validity + Not Before: Jul 9 17:28:50 1999 GMT + Not After : Jul 9 17:36:58 2019 GMT + Subject: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN-USERFirst-Client Authentication and Email + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b2:39:85:a4:f2:7d:ab:41:3b:62:46:37:ae:cd: + c1:60:75:bc:39:65:f9:4a:1a:47:a2:b9:cc:48:cc: + 6a:98:d5:4d:35:19:b9:a4:42:e5:ce:49:e2:8a:2f: + 1e:7c:d2:31:07:c7:4e:b4:83:64:9d:2e:29:d5:a2: + 64:c4:85:bd:85:51:35:79:a4:4e:68:90:7b:1c:7a: + a4:92:a8:17:f2:98:15:f2:93:cc:c9:a4:32:95:bb: + 0c:4f:30:bd:98:a0:0b:8b:e5:6e:1b:a2:46:fa:78: + bc:a2:6f:ab:59:5e:a5:2f:cf:ca:da:6d:aa:2f:eb: + ac:a1:b3:6a:aa:b7:2e:67:35:8b:79:e1:1e:69:88: + e2:e6:46:cd:a0:a5:ea:be:0b:ce:76:3a:7a:0e:9b: + ea:fc:da:27:5b:3d:73:1f:22:e6:48:61:c6:4c:f3: + 69:b1:a8:2e:1b:b6:d4:31:20:2c:bc:82:8a:8e:a4: + 0e:a5:d7:89:43:fc:16:5a:af:1d:71:d7:11:59:da: + ba:87:0d:af:fa:f3:e1:c2:f0:a4:c5:67:8c:d6:d6: + 54:3a:de:0a:a4:ba:03:77:b3:65:c8:fd:1e:d3:74: + 62:aa:18:ca:68:93:1e:a1:85:7e:f5:47:65:cb:f8: + 4d:57:28:74:d2:34:ff:30:b6:ee:f6:62:30:14:8c: + 2c:eb + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: + Digital Signature, Non Repudiation, Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 89:82:67:7D:C4:9D:26:70:00:4B:B4:50:48:7C:DE:3D:AE:04:6E:7D + X509v3 CRL Distribution Points: + URI:http://crl.usertrust.com/UTN-USERFirst-ClientAuthenticationandEmail.crl + + X509v3 Extended Key Usage: + TLS Web Client Authentication, E-mail Protection + Signature Algorithm: sha1WithRSAEncryption + b1:6d:61:5d:a6:1a:7f:7c:ab:4a:e4:30:fc:53:6f:25:24:c6: + ca:ed:e2:31:5c:2b:0e:ee:ee:61:55:6f:04:3e:cf:39:de:c5: + 1b:49:94:e4:eb:20:4c:b4:e6:9e:50:2e:72:d9:8d:f5:aa:a3: + b3:4a:da:56:1c:60:97:80:dc:82:a2:ad:4a:bd:8a:2b:ff:0b: + 09:b4:c6:d7:20:04:45:e4:cd:80:01:ba:ba:2b:6e:ce:aa:d7: + 92:fe:e4:af:eb:f4:26:1d:16:2a:7f:6c:30:95:37:2f:33:12: + ac:7f:dd:c7:d1:11:8c:51:98:b2:d0:a3:91:d0:ad:f6:9f:9e: + 83:93:1e:1d:42:b8:46:af:6b:66:f0:9b:7f:ea:e3:03:02:e5: + 02:51:c1:aa:d5:35:9d:72:40:03:89:ba:31:1d:c5:10:68:52: + 9e:df:a2:85:c5:5c:08:a6:78:e6:53:4f:b1:e8:b7:d3:14:9e: + 93:a6:c3:64:e3:ac:7e:71:cd:bc:9f:e9:03:1b:cc:fb:e9:ac: + 31:c1:af:7c:15:74:02:99:c3:b2:47:a6:c2:32:61:d7:c7:6f: + 48:24:51:27:a1:d5:87:55:f2:7b:8f:98:3d:16:9e:ee:75:b6: + f8:d0:8e:f2:f3:c6:ae:28:5b:a7:f0:f3:36:17:fc:c3:05:d3: + ca:03:4a:54 +-----BEGIN CERTIFICATE----- +MIIEojCCA4qgAwIBAgIQRL4Mi1AAJLQR0zYlJWfJiTANBgkqhkiG9w0BAQUFADCB +rjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug +Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho +dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xNjA0BgNVBAMTLVVUTi1VU0VSRmlyc3Qt +Q2xpZW50IEF1dGhlbnRpY2F0aW9uIGFuZCBFbWFpbDAeFw05OTA3MDkxNzI4NTBa +Fw0xOTA3MDkxNzM2NThaMIGuMQswCQYDVQQGEwJVUzELMAkGA1UECBMCVVQxFzAV +BgNVBAcTDlNhbHQgTGFrZSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5l +dHdvcmsxITAfBgNVBAsTGGh0dHA6Ly93d3cudXNlcnRydXN0LmNvbTE2MDQGA1UE +AxMtVVROLVVTRVJGaXJzdC1DbGllbnQgQXV0aGVudGljYXRpb24gYW5kIEVtYWls +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsjmFpPJ9q0E7YkY3rs3B +YHW8OWX5ShpHornMSMxqmNVNNRm5pELlzkniii8efNIxB8dOtINknS4p1aJkxIW9 +hVE1eaROaJB7HHqkkqgX8pgV8pPMyaQylbsMTzC9mKALi+VuG6JG+ni8om+rWV6l +L8/K2m2qL+usobNqqrcuZzWLeeEeaYji5kbNoKXqvgvOdjp6Dpvq/NonWz1zHyLm +SGHGTPNpsaguG7bUMSAsvIKKjqQOpdeJQ/wWWq8dcdcRWdq6hw2v+vPhwvCkxWeM +1tZUOt4KpLoDd7NlyP0e03RiqhjKaJMeoYV+9Udly/hNVyh00jT/MLbu9mIwFIws +6wIDAQABo4G5MIG2MAsGA1UdDwQEAwIBxjAPBgNVHRMBAf8EBTADAQH/MB0GA1Ud +DgQWBBSJgmd9xJ0mcABLtFBIfN49rgRufTBYBgNVHR8EUTBPME2gS6BJhkdodHRw +Oi8vY3JsLnVzZXJ0cnVzdC5jb20vVVROLVVTRVJGaXJzdC1DbGllbnRBdXRoZW50 +aWNhdGlvbmFuZEVtYWlsLmNybDAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUH +AwQwDQYJKoZIhvcNAQEFBQADggEBALFtYV2mGn98q0rkMPxTbyUkxsrt4jFcKw7u +7mFVbwQ+zznexRtJlOTrIEy05p5QLnLZjfWqo7NK2lYcYJeA3IKirUq9iiv/Cwm0 +xtcgBEXkzYABurorbs6q15L+5K/r9CYdFip/bDCVNy8zEqx/3cfREYxRmLLQo5HQ +rfafnoOTHh1CuEava2bwm3/q4wMC5QJRwarVNZ1yQAOJujEdxRBoUp7fooXFXAim +eOZTT7Hot9MUnpOmw2TjrH5xzbyf6QMbzPvprDHBr3wVdAKZw7JHpsIyYdfHb0gk +USeh1YdV8nuPmD0Wnu51tvjQjvLzxq4oW6fw8zYX/MMF08oDSlQ= +-----END CERTIFICATE----- + +UTN USERFirst Hardware Root CA +============================== + +MD5 Fingerprint=4C:56:41:E5:0D:BB:2B:E8:CA:A3:ED:18:08:AD:43:39 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 44:be:0c:8b:50:00:24:b4:11:d3:36:2a:fe:65:0a:fd + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN-USERFirst-Hardware + Validity + Not Before: Jul 9 18:10:42 1999 GMT + Not After : Jul 9 18:19:22 2019 GMT + Subject: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN-USERFirst-Hardware + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b1:f7:c3:38:3f:b4:a8:7f:cf:39:82:51:67:d0: + 6d:9f:d2:ff:58:f3:e7:9f:2b:ec:0d:89:54:99:b9: + 38:99:16:f7:e0:21:79:48:c2:bb:61:74:12:96:1d: + 3c:6a:72:d5:3c:10:67:3a:39:ed:2b:13:cd:66:eb: + 95:09:33:a4:6c:97:b1:e8:c6:ec:c1:75:79:9c:46: + 5e:8d:ab:d0:6a:fd:b9:2a:55:17:10:54:b3:19:f0: + 9a:f6:f1:b1:5d:b6:a7:6d:fb:e0:71:17:6b:a2:88: + fb:00:df:fe:1a:31:77:0c:9a:01:7a:b1:32:e3:2b: + 01:07:38:6e:c3:a5:5e:23:bc:45:9b:7b:50:c1:c9: + 30:8f:db:e5:2b:7a:d3:5b:fb:33:40:1e:a0:d5:98: + 17:bc:8b:87:c3:89:d3:5d:a0:8e:b2:aa:aa:f6:8e: + 69:88:06:c5:fa:89:21:f3:08:9d:69:2e:09:33:9b: + 29:0d:46:0f:8c:cc:49:34:b0:69:51:bd:f9:06:cd: + 68:ad:66:4c:bc:3e:ac:61:bd:0a:88:0e:c8:df:3d: + ee:7c:04:4c:9d:0a:5e:6b:91:d6:ee:c7:ed:28:8d: + ab:4d:87:89:73:d0:6e:a4:d0:1e:16:8b:14:e1:76: + 44:03:7f:63:ac:e4:cd:49:9c:c5:92:f4:ab:32:a1: + 48:5b + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: + Digital Signature, Non Repudiation, Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + A1:72:5F:26:1B:28:98:43:95:5D:07:37:D5:85:96:9D:4B:D2:C3:45 + X509v3 CRL Distribution Points: + URI:http://crl.usertrust.com/UTN-USERFirst-Hardware.crl + + X509v3 Extended Key Usage: + TLS Web Server Authentication, IPSec End System, IPSec Tunnel, IPSec User + Signature Algorithm: sha1WithRSAEncryption + 47:19:0f:de:74:c6:99:97:af:fc:ad:28:5e:75:8e:eb:2d:67: + ee:4e:7b:2b:d7:0c:ff:f6:de:cb:55:a2:0a:e1:4c:54:65:93: + 60:6b:9f:12:9c:ad:5e:83:2c:eb:5a:ae:c0:e4:2d:f4:00:63: + 1d:b8:c0:6c:f2:cf:49:bb:4d:93:6f:06:a6:0a:22:b2:49:62: + 08:4e:ff:c8:c8:14:b2:88:16:5d:e7:01:e4:12:95:e5:45:34: + b3:8b:69:bd:cf:b4:85:8f:75:51:9e:7d:3a:38:3a:14:48:12: + c6:fb:a7:3b:1a:8d:0d:82:40:07:e8:04:08:90:a1:89:cb:19: + 50:df:ca:1c:01:bc:1d:04:19:7b:10:76:97:3b:ee:90:90:ca: + c4:0e:1f:16:6e:75:ef:33:f8:d3:6f:5b:1e:96:e3:e0:74:77: + 74:7b:8a:a2:6e:2d:dd:76:d6:39:30:82:f0:ab:9c:52:f2:2a: + c7:af:49:5e:7e:c7:68:e5:82:81:c8:6a:27:f9:27:88:2a:d5: + 58:50:95:1f:f0:3b:1c:57:bb:7d:14:39:62:2b:9a:c9:94:92: + 2a:a3:22:0c:ff:89:26:7d:5f:23:2b:47:d7:15:1d:a9:6a:9e: + 51:0d:2a:51:9e:81:f9:d4:3b:5e:70:12:7f:10:32:9c:1e:bb: + 9d:f8:66:a8 +-----BEGIN CERTIFICATE----- +MIIEdDCCA1ygAwIBAgIQRL4Mi1AAJLQR0zYq/mUK/TANBgkqhkiG9w0BAQUFADCB +lzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug +Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho +dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3Qt +SGFyZHdhcmUwHhcNOTkwNzA5MTgxMDQyWhcNMTkwNzA5MTgxOTIyWjCBlzELMAkG +A1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEe +MBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8v +d3d3LnVzZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdh +cmUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCx98M4P7Sof885glFn +0G2f0v9Y8+efK+wNiVSZuTiZFvfgIXlIwrthdBKWHTxqctU8EGc6Oe0rE81m65UJ +M6Rsl7HoxuzBdXmcRl6Nq9Bq/bkqVRcQVLMZ8Jr28bFdtqdt++BxF2uiiPsA3/4a +MXcMmgF6sTLjKwEHOG7DpV4jvEWbe1DByTCP2+UretNb+zNAHqDVmBe8i4fDidNd +oI6yqqr2jmmIBsX6iSHzCJ1pLgkzmykNRg+MzEk0sGlRvfkGzWitZky8PqxhvQqI +DsjfPe58BEydCl5rkdbux+0ojatNh4lz0G6k0B4WixThdkQDf2Os5M1JnMWS9Ksy +oUhbAgMBAAGjgbkwgbYwCwYDVR0PBAQDAgHGMA8GA1UdEwEB/wQFMAMBAf8wHQYD +VR0OBBYEFKFyXyYbKJhDlV0HN9WFlp1L0sNFMEQGA1UdHwQ9MDswOaA3oDWGM2h0 +dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9VVE4tVVNFUkZpcnN0LUhhcmR3YXJlLmNy +bDAxBgNVHSUEKjAoBggrBgEFBQcDAQYIKwYBBQUHAwUGCCsGAQUFBwMGBggrBgEF +BQcDBzANBgkqhkiG9w0BAQUFAAOCAQEARxkP3nTGmZev/K0oXnWO6y1n7k57K9cM +//bey1WiCuFMVGWTYGufEpytXoMs61quwOQt9ABjHbjAbPLPSbtNk28Gpgoiskli +CE7/yMgUsogWXecB5BKV5UU0s4tpvc+0hY91UZ59Ojg6FEgSxvunOxqNDYJAB+gE +CJChicsZUN/KHAG8HQQZexB2lzvukJDKxA4fFm517zP4029bHpbj4HR3dHuKom4t +3XbWOTCC8KucUvIqx69JXn7HaOWCgchqJ/kniCrVWFCVH/A7HFe7fRQ5YiuayZSS +KqMiDP+JJn1fIytH1xUdqWqeUQ0qUZ6B+dQ7XnASfxAynB67nfhmqA== +-----END CERTIFICATE----- + +UTN USERFirst Object Root CA +============================ + +MD5 Fingerprint=A7:F2:E4:16:06:41:11:50:30:6B:9C:E3:B4:9C:B0:C9 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 44:be:0c:8b:50:00:24:b4:11:d3:36:2d:e0:b3:5f:1b + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN-USERFirst-Object + Validity + Not Before: Jul 9 18:31:20 1999 GMT + Not After : Jul 9 18:40:36 2019 GMT + Subject: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN-USERFirst-Object + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:ce:aa:81:3f:a3:a3:61:78:aa:31:00:55:95:11: + 9e:27:0f:1f:1c:df:3a:9b:82:68:30:c0:4a:61:1d: + f1:2f:0e:fa:be:79:f7:a5:23:ef:55:51:96:84:cd: + db:e3:b9:6e:3e:31:d8:0a:20:67:c7:f4:d9:bf:94: + eb:47:04:3e:02:ce:2a:a2:5d:87:04:09:f6:30:9d: + 18:8a:97:b2:aa:1c:fc:41:d2:a1:36:cb:fb:3d:91: + ba:e7:d9:70:35:fa:e4:e7:90:c3:9b:a3:9b:d3:3c: + f5:12:99:77:b1:b7:09:e0:68:e6:1c:b8:f3:94:63: + 88:6a:6a:fe:0b:76:c9:be:f4:22:e4:67:b9:ab:1a: + 5e:77:c1:85:07:dd:0d:6c:bf:ee:06:c7:77:6a:41: + 9e:a7:0f:d7:fb:ee:94:17:b7:fc:85:be:a4:ab:c4: + 1c:31:dd:d7:b6:d1:e4:f0:ef:df:16:8f:b2:52:93: + d7:a1:d4:89:a1:07:2e:bf:e1:01:12:42:1e:1a:e1: + d8:95:34:db:64:79:28:ff:ba:2e:11:c2:e5:e8:5b: + 92:48:fb:47:0b:c2:6c:da:ad:32:83:41:f3:a5:e5: + 41:70:fd:65:90:6d:fa:fa:51:c4:f9:bd:96:2b:19: + 04:2c:d3:6d:a7:dc:f0:7f:6f:83:65:e2:6a:ab:87: + 86:75 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: + Digital Signature, Non Repudiation, Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + DA:ED:64:74:14:9C:14:3C:AB:DD:99:A9:BD:5B:28:4D:8B:3C:C9:D8 + X509v3 CRL Distribution Points: + URI:http://crl.usertrust.com/UTN-USERFirst-Object.crl + + X509v3 Extended Key Usage: + Code Signing, Time Stamping, Microsoft Encrypted File System + Signature Algorithm: sha1WithRSAEncryption + 08:1f:52:b1:37:44:78:db:fd:ce:b9:da:95:96:98:aa:55:64: + 80:b5:5a:40:dd:21:a5:c5:c1:f3:5f:2c:4c:c8:47:5a:69:ea: + e8:f0:35:35:f4:d0:25:f3:c8:a6:a4:87:4a:bd:1b:b1:73:08: + bd:d4:c3:ca:b6:35:bb:59:86:77:31:cd:a7:80:14:ae:13:ef: + fc:b1:48:f9:6b:25:25:2d:51:b6:2c:6d:45:c1:98:c8:8a:56: + 5d:3e:ee:43:4e:3e:6b:27:8e:d0:3a:4b:85:0b:5f:d3:ed:6a: + a7:75:cb:d1:5a:87:2f:39:75:13:5a:72:b0:02:81:9f:be:f0: + 0f:84:54:20:62:6c:69:d4:e1:4d:c6:0d:99:43:01:0d:12:96: + 8c:78:9d:bf:50:a2:b1:44:aa:6a:cf:17:7a:cf:6f:0f:d4:f8: + 24:55:5f:f0:34:16:49:66:3e:50:46:c9:63:71:38:31:62:b8: + 62:b9:f3:53:ad:6c:b5:2b:a2:12:aa:19:4f:09:da:5e:e7:93: + c6:8e:14:08:fe:f0:30:80:18:a0:86:85:4d:c8:7d:d7:8b:03: + fe:6e:d5:f7:9d:16:ac:92:2c:a0:23:e5:9c:91:52:1f:94:df: + 17:94:73:c3:b3:c1:c1:71:05:20:00:78:bd:13:52:1d:a8:3e: + cd:00:1f:c8 +-----BEGIN CERTIFICATE----- +MIIEZjCCA06gAwIBAgIQRL4Mi1AAJLQR0zYt4LNfGzANBgkqhkiG9w0BAQUFADCB +lTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug +Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho +dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHTAbBgNVBAMTFFVUTi1VU0VSRmlyc3Qt +T2JqZWN0MB4XDTk5MDcwOTE4MzEyMFoXDTE5MDcwOTE4NDAzNlowgZUxCzAJBgNV +BAYTAlVTMQswCQYDVQQIEwJVVDEXMBUGA1UEBxMOU2FsdCBMYWtlIENpdHkxHjAc +BgNVBAoTFVRoZSBVU0VSVFJVU1QgTmV0d29yazEhMB8GA1UECxMYaHR0cDovL3d3 +dy51c2VydHJ1c3QuY29tMR0wGwYDVQQDExRVVE4tVVNFUkZpcnN0LU9iamVjdDCC +ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM6qgT+jo2F4qjEAVZURnicP +HxzfOpuCaDDASmEd8S8O+r5596Uj71VRloTN2+O5bj4x2AogZ8f02b+U60cEPgLO +KqJdhwQJ9jCdGIqXsqoc/EHSoTbL+z2RuufZcDX65OeQw5ujm9M89RKZd7G3CeBo +5hy485RjiGpq/gt2yb70IuRnuasaXnfBhQfdDWy/7gbHd2pBnqcP1/vulBe3/IW+ +pKvEHDHd17bR5PDv3xaPslKT16HUiaEHLr/hARJCHhrh2JU022R5KP+6LhHC5ehb +kkj7RwvCbNqtMoNB86XlQXD9ZZBt+vpRxPm9lisZBCzTbafc8H9vg2XiaquHhnUC +AwEAAaOBrzCBrDALBgNVHQ8EBAMCAcYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E +FgQU2u1kdBScFDyr3ZmpvVsoTYs8ydgwQgYDVR0fBDswOTA3oDWgM4YxaHR0cDov +L2NybC51c2VydHJ1c3QuY29tL1VUTi1VU0VSRmlyc3QtT2JqZWN0LmNybDApBgNV +HSUEIjAgBggrBgEFBQcDAwYIKwYBBQUHAwgGCisGAQQBgjcKAwQwDQYJKoZIhvcN +AQEFBQADggEBAAgfUrE3RHjb/c652pWWmKpVZIC1WkDdIaXFwfNfLEzIR1pp6ujw +NTX00CXzyKakh0q9G7FzCL3Uw8q2NbtZhncxzaeAFK4T7/yxSPlrJSUtUbYsbUXB +mMiKVl0+7kNOPmsnjtA6S4ULX9Ptaqd1y9Fahy85dRNacrACgZ++8A+EVCBibGnU +4U3GDZlDAQ0Slox4nb9QorFEqmrPF3rPbw/U+CRVX/A0FklmPlBGyWNxODFiuGK5 +81OtbLUrohKqGU8J2l7nk8aOFAj+8DCAGKCGhU3IfdeLA/5u1fedFqySLKAj5ZyR +Uh+U3xeUc8OzwcFxBSAAeL0TUh2oPs0AH8g= +-----END CERTIFICATE----- + +Equifax Secure CA +================= + +MD5 Fingerprint=67:CB:9D:C0:13:24:8A:82:9B:B2:17:1E:D1:1B:EC:D4 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 903804111 (0x35def4cf) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=Equifax, OU=Equifax Secure Certificate Authority + Validity + Not Before: Aug 22 16:41:51 1998 GMT + Not After : Aug 22 16:41:51 2018 GMT + Subject: C=US, O=Equifax, OU=Equifax Secure Certificate Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:c1:5d:b1:58:67:08:62:ee:a0:9a:2d:1f:08:6d: + 91:14:68:98:0a:1e:fe:da:04:6f:13:84:62:21:c3: + d1:7c:ce:9f:05:e0:b8:01:f0:4e:34:ec:e2:8a:95: + 04:64:ac:f1:6b:53:5f:05:b3:cb:67:80:bf:42:02: + 8e:fe:dd:01:09:ec:e1:00:14:4f:fc:fb:f0:0c:dd: + 43:ba:5b:2b:e1:1f:80:70:99:15:57:93:16:f1:0f: + 97:6a:b7:c2:68:23:1c:cc:4d:59:30:ac:51:1e:3b: + af:2b:d6:ee:63:45:7b:c5:d9:5f:50:d2:e3:50:0f: + 3a:88:e7:bf:14:fd:e0:c7:b9 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 CRL Distribution Points: + DirName:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority/CN=CRL1 + + X509v3 Private Key Usage Period: + Not After: Aug 22 16:41:51 2018 GMT + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:48:E6:68:F9:2B:D2:B2:95:D7:47:D8:23:20:10:4F:33:98:90:9F:D4 + + X509v3 Subject Key Identifier: + 48:E6:68:F9:2B:D2:B2:95:D7:47:D8:23:20:10:4F:33:98:90:9F:D4 + X509v3 Basic Constraints: + CA:TRUE + 1.2.840.113533.7.65.0: + 0...V3.0c.... + Signature Algorithm: sha1WithRSAEncryption + 58:ce:29:ea:fc:f7:de:b5:ce:02:b9:17:b5:85:d1:b9:e3:e0: + 95:cc:25:31:0d:00:a6:92:6e:7f:b6:92:63:9e:50:95:d1:9a: + 6f:e4:11:de:63:85:6e:98:ee:a8:ff:5a:c8:d3:55:b2:66:71: + 57:de:c0:21:eb:3d:2a:a7:23:49:01:04:86:42:7b:fc:ee:7f: + a2:16:52:b5:67:67:d3:40:db:3b:26:58:b2:28:77:3d:ae:14: + 77:61:d6:fa:2a:66:27:a0:0d:fa:a7:73:5c:ea:70:f1:94:21: + 65:44:5f:fa:fc:ef:29:68:a9:a2:87:79:ef:79:ef:4f:ac:07: + 77:38 +-----BEGIN CERTIFICATE----- +MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV +UzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2Vy +dGlmaWNhdGUgQXV0aG9yaXR5MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1 +MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoTB0VxdWlmYXgxLTArBgNVBAsTJEVx +dWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCBnzANBgkqhkiG9w0B +AQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPRfM6f +BeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+A +cJkVV5MW8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kC +AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQ +MA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlm +aWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTgw +ODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvSspXXR9gj +IBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQF +MAMBAf8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUA +A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y +7qj/WsjTVbJmcVfewCHrPSqnI0kBBIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh +1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee9570+sB3c4 +-----END CERTIFICATE----- + +Camerfirma Chambers of Commerce Root +==================================== + +MD5 Fingerprint=B0:01:EE:14:D9:AF:29:18:94:76:8E:F1:69:33:2A:84 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=EU, O=AC Camerfirma SA CIF A82743287, OU=http://www.chambersign.org, CN=Chambers of Commerce Root + Validity + Not Before: Sep 30 16:13:43 2003 GMT + Not After : Sep 30 16:13:44 2037 GMT + Subject: C=EU, O=AC Camerfirma SA CIF A82743287, OU=http://www.chambersign.org, CN=Chambers of Commerce Root + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b7:36:55:e5:a5:5d:18:30:e0:da:89:54:91:fc: + c8:c7:52:f8:2f:50:d9:ef:b1:75:73:65:47:7d:1b: + 5b:ba:75:c5:fc:a1:88:24:fa:2f:ed:ca:08:4a:39: + 54:c4:51:7a:b5:da:60:ea:38:3c:81:b2:cb:f1:bb: + d9:91:23:3f:48:01:70:75:a9:05:2a:ad:1f:71:f3: + c9:54:3d:1d:06:6a:40:3e:b3:0c:85:ee:5c:1b:79: + c2:62:c4:b8:36:8e:35:5d:01:0c:23:04:47:35:aa: + 9b:60:4e:a0:66:3d:cb:26:0a:9c:40:a1:f4:5d:98: + bf:71:ab:a5:00:68:2a:ed:83:7a:0f:a2:14:b5:d4: + 22:b3:80:b0:3c:0c:5a:51:69:2d:58:18:8f:ed:99: + 9e:f1:ae:e2:95:e6:f6:47:a8:d6:0c:0f:b0:58:58: + db:c3:66:37:9e:9b:91:54:33:37:d2:94:1c:6a:48: + c9:c9:f2:a5:da:a5:0c:23:f7:23:0e:9c:32:55:5e: + 71:9c:84:05:51:9a:2d:fd:e6:4e:2a:34:5a:de:ca: + 40:37:67:0c:54:21:55:77:da:0a:0c:cc:97:ae:80: + dc:94:36:4a:f4:3e:ce:36:13:1e:53:e4:ac:4e:3a: + 05:ec:db:ae:72:9c:38:8b:d0:39:3b:89:0a:3e:77: + fe:75 + Exponent: 3 (0x3) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE, pathlen:12 + X509v3 CRL Distribution Points: + URI:http://crl.chambersign.org/chambersroot.crl + + X509v3 Subject Key Identifier: + E3:94:F5:B1:4D:E9:DB:A1:29:5B:57:8B:4D:76:06:76:E1:D1:A2:8A + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Subject Alternative Name: + email:chambersroot@chambersign.org + X509v3 Issuer Alternative Name: + email:chambersroot@chambersign.org + X509v3 Certificate Policies: + Policy: 1.3.6.1.4.1.17326.10.3.1 + CPS: http://cps.chambersign.org/cps/chambersroot.html + + Signature Algorithm: sha1WithRSAEncryption + 0c:41:97:c2:1a:86:c0:22:7c:9f:fb:90:f3:1a:d1:03:b1:ef: + 13:f9:21:5f:04:9c:da:c9:a5:8d:27:6c:96:87:91:be:41:90: + 01:72:93:e7:1e:7d:5f:f6:89:c6:5d:a7:40:09:3d:ac:49:45: + 45:dc:2e:8d:30:68:b2:09:ba:fb:c3:2f:cc:ba:0b:df:3f:77: + 7b:46:7d:3a:12:24:8e:96:8f:3c:05:0a:6f:d2:94:28:1d:6d: + 0c:c0:2e:88:22:d5:d8:cf:1d:13:c7:f0:48:d7:d7:05:a7:cf: + c7:47:9e:3b:3c:34:c8:80:4f:d4:14:bb:fc:0d:50:f7:fa:b3: + ec:42:5f:a9:dd:6d:c8:f4:75:cf:7b:c1:72:26:b1:01:1c:5c: + 2c:fd:7a:4e:b4:01:c5:05:57:b9:e7:3c:aa:05:d9:88:e9:07: + 46:41:ce:ef:41:81:ae:58:df:83:a2:ae:ca:d7:77:1f:e7:00: + 3c:9d:6f:8e:e4:32:09:1d:4d:78:34:78:34:3c:94:9b:26:ed: + 4f:71:c6:19:7a:bd:20:22:48:5a:fe:4b:7d:03:b7:e7:58:be: + c6:32:4e:74:1e:68:dd:a8:68:5b:b3:3e:ee:62:7d:d9:80:e8: + 0a:75:7a:b7:ee:b4:65:9a:21:90:e0:aa:d0:98:bc:38:b5:73: + 3c:8b:f8:dc +-----BEGIN CERTIFICATE----- +MIIEvTCCA6WgAwIBAgIBADANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJFVTEn +MCUGA1UEChMeQUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQL +ExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMg +b2YgQ29tbWVyY2UgUm9vdDAeFw0wMzA5MzAxNjEzNDNaFw0zNzA5MzAxNjEzNDRa +MH8xCzAJBgNVBAYTAkVVMScwJQYDVQQKEx5BQyBDYW1lcmZpcm1hIFNBIENJRiBB +ODI3NDMyODcxIzAhBgNVBAsTGmh0dHA6Ly93d3cuY2hhbWJlcnNpZ24ub3JnMSIw +IAYDVQQDExlDaGFtYmVycyBvZiBDb21tZXJjZSBSb290MIIBIDANBgkqhkiG9w0B +AQEFAAOCAQ0AMIIBCAKCAQEAtzZV5aVdGDDg2olUkfzIx1L4L1DZ77F1c2VHfRtb +unXF/KGIJPov7coISjlUxFF6tdpg6jg8gbLL8bvZkSM/SAFwdakFKq0fcfPJVD0d +BmpAPrMMhe5cG3nCYsS4No41XQEMIwRHNaqbYE6gZj3LJgqcQKH0XZi/caulAGgq +7YN6D6IUtdQis4CwPAxaUWktWBiP7Zme8a7ileb2R6jWDA+wWFjbw2Y3npuRVDM3 +0pQcakjJyfKl2qUMI/cjDpwyVV5xnIQFUZot/eZOKjRa3spAN2cMVCFVd9oKDMyX +roDclDZK9D7ONhMeU+SsTjoF7Nuucpw4i9A5O4kKPnf+dQIBA6OCAUQwggFAMBIG +A1UdEwEB/wQIMAYBAf8CAQwwPAYDVR0fBDUwMzAxoC+gLYYraHR0cDovL2NybC5j +aGFtYmVyc2lnbi5vcmcvY2hhbWJlcnNyb290LmNybDAdBgNVHQ4EFgQU45T1sU3p +26EpW1eLTXYGduHRooowDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIA +BzAnBgNVHREEIDAegRxjaGFtYmVyc3Jvb3RAY2hhbWJlcnNpZ24ub3JnMCcGA1Ud +EgQgMB6BHGNoYW1iZXJzcm9vdEBjaGFtYmVyc2lnbi5vcmcwWAYDVR0gBFEwTzBN +BgsrBgEEAYGHLgoDATA+MDwGCCsGAQUFBwIBFjBodHRwOi8vY3BzLmNoYW1iZXJz +aWduLm9yZy9jcHMvY2hhbWJlcnNyb290Lmh0bWwwDQYJKoZIhvcNAQEFBQADggEB +AAxBl8IahsAifJ/7kPMa0QOx7xP5IV8EnNrJpY0nbJaHkb5BkAFyk+cefV/2icZd +p0AJPaxJRUXcLo0waLIJuvvDL8y6C98/d3tGfToSJI6WjzwFCm/SlCgdbQzALogi +1djPHRPH8EjX1wWnz8dHnjs8NMiAT9QUu/wNUPf6s+xCX6ndbcj0dc97wXImsQEc +XCz9ek60AcUFV7nnPKoF2YjpB0ZBzu9Bga5Y34OirsrXdx/nADydb47kMgkdTXg0 +eDQ8lJsm7U9xxhl6vSAiSFr+S30Dt+dYvsYyTnQeaN2oaFuzPu5ifdmA6Ap1erfu +tGWaIZDgqtCYvDi1czyL+Nw= +-----END CERTIFICATE----- + +Camerfirma Global Chambersign Root +================================== + +MD5 Fingerprint=C5:E6:7B:BF:06:D0:4F:43:ED:C4:7A:65:8A:FB:6B:19 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=EU, O=AC Camerfirma SA CIF A82743287, OU=http://www.chambersign.org, CN=Global Chambersign Root + Validity + Not Before: Sep 30 16:14:18 2003 GMT + Not After : Sep 30 16:14:18 2037 GMT + Subject: C=EU, O=AC Camerfirma SA CIF A82743287, OU=http://www.chambersign.org, CN=Global Chambersign Root + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:a2:70:a2:d0:9f:42:ae:5b:17:c7:d8:7d:cf:14: + 83:fc:4f:c9:a1:b7:13:af:8a:d7:9e:3e:04:0a:92: + 8b:60:56:fa:b4:32:2f:88:4d:a1:60:08:f4:b7:09: + 4e:a0:49:2f:49:d6:d3:df:9d:97:5a:9f:94:04:70: + ec:3f:59:d9:b7:cc:66:8b:98:52:28:09:02:df:c5: + 2f:84:8d:7a:97:77:bf:ec:40:9d:25:72:ab:b5:3f: + 32:98:fb:b7:b7:fc:72:84:e5:35:87:f9:55:fa:a3: + 1f:0e:6f:2e:28:dd:69:a0:d9:42:10:c6:f8:b5:44: + c2:d0:43:7f:db:bc:e4:a2:3c:6a:55:78:0a:77:a9: + d8:ea:19:32:b7:2f:fe:5c:3f:1b:ee:b1:98:ec:ca: + ad:7a:69:45:e3:96:0f:55:f6:e6:ed:75:ea:65:e8: + 32:56:93:46:89:a8:25:8a:65:06:ee:6b:bf:79:07: + d0:f1:b7:af:ed:2c:4d:92:bb:c0:a8:5f:a7:67:7d: + 04:f2:15:08:70:ac:92:d6:7d:04:d2:33:fb:4c:b6: + 0b:0b:fb:1a:c9:c4:8d:03:a9:7e:5c:f2:50:ab:12: + a5:a1:cf:48:50:a5:ef:d2:c8:1a:13:fa:b0:7f:b1: + 82:1c:77:6a:0f:5f:dc:0b:95:8f:ef:43:7e:e6:45: + 09:25 + Exponent: 3 (0x3) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE, pathlen:12 + X509v3 CRL Distribution Points: + URI:http://crl.chambersign.org/chambersignroot.crl + + X509v3 Subject Key Identifier: + 43:9C:36:9F:B0:9E:30:4D:C6:CE:5F:AD:10:AB:E5:03:A5:FA:A9:14 + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Subject Alternative Name: + email:chambersignroot@chambersign.org + X509v3 Issuer Alternative Name: + email:chambersignroot@chambersign.org + X509v3 Certificate Policies: + Policy: 1.3.6.1.4.1.17326.10.1.1 + CPS: http://cps.chambersign.org/cps/chambersignroot.html + + Signature Algorithm: sha1WithRSAEncryption + 3c:3b:70:91:f9:04:54:27:91:e1:ed:ed:fe:68:7f:61:5d:e5: + 41:65:4f:32:f1:18:05:94:6a:1c:de:1f:70:db:3e:7b:32:02: + 34:b5:0c:6c:a1:8a:7c:a5:f4:8f:ff:d4:d8:ad:17:d5:2d:04: + d1:3f:58:80:e2:81:59:88:be:c0:e3:46:93:24:fe:90:bd:26: + a2:30:2d:e8:97:26:57:35:89:74:96:18:f6:15:e2:af:24:19: + 56:02:02:b2:ba:0f:14:ea:c6:8a:66:c1:86:45:55:8b:be:92: + be:9c:a4:04:c7:49:3c:9e:e8:29:7a:89:d7:fe:af:ff:68:f5: + a5:17:90:bd:ac:99:cc:a5:86:57:09:67:46:db:d6:16:c2:46: + f1:e4:a9:50:f5:8f:d1:92:15:d3:5f:3e:c6:00:49:3a:6e:58: + b2:d1:d1:27:0d:25:c8:32:f8:20:11:cd:7d:32:33:48:94:54: + 4c:dd:dc:79:c4:30:9f:eb:8e:b8:55:b5:d7:88:5c:c5:6a:24: + 3d:b2:d3:05:03:51:c6:07:ef:cc:14:72:74:3d:6e:72:ce:18: + 28:8c:4a:a0:77:e5:09:2b:45:44:47:ac:b7:67:7f:01:8a:05: + 5a:93:be:a1:c1:ff:f8:e7:0e:67:a4:47:49:76:5d:75:90:1a: + f5:26:8f:f0 +-----BEGIN CERTIFICATE----- +MIIExTCCA62gAwIBAgIBADANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJFVTEn +MCUGA1UEChMeQUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQL +ExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEgMB4GA1UEAxMXR2xvYmFsIENo +YW1iZXJzaWduIFJvb3QwHhcNMDMwOTMwMTYxNDE4WhcNMzcwOTMwMTYxNDE4WjB9 +MQswCQYDVQQGEwJFVTEnMCUGA1UEChMeQUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgy +NzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEgMB4G +A1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwggEgMA0GCSqGSIb3DQEBAQUA +A4IBDQAwggEIAoIBAQCicKLQn0KuWxfH2H3PFIP8T8mhtxOviteePgQKkotgVvq0 +Mi+ITaFgCPS3CU6gSS9J1tPfnZdan5QEcOw/Wdm3zGaLmFIoCQLfxS+EjXqXd7/s +QJ0lcqu1PzKY+7e3/HKE5TWH+VX6ox8Oby4o3Wmg2UIQxvi1RMLQQ3/bvOSiPGpV +eAp3qdjqGTK3L/5cPxvusZjsyq16aUXjlg9V9ubtdepl6DJWk0aJqCWKZQbua795 +B9Dxt6/tLE2Su8CoX6dnfQTyFQhwrJLWfQTSM/tMtgsL+xrJxI0DqX5c8lCrEqWh +z0hQpe/SyBoT+rB/sYIcd2oPX9wLlY/vQ37mRQklAgEDo4IBUDCCAUwwEgYDVR0T +AQH/BAgwBgEB/wIBDDA/BgNVHR8EODA2MDSgMqAwhi5odHRwOi8vY3JsLmNoYW1i +ZXJzaWduLm9yZy9jaGFtYmVyc2lnbnJvb3QuY3JsMB0GA1UdDgQWBBRDnDafsJ4w +TcbOX60Qq+UDpfqpFDAOBgNVHQ8BAf8EBAMCAQYwEQYJYIZIAYb4QgEBBAQDAgAH +MCoGA1UdEQQjMCGBH2NoYW1iZXJzaWducm9vdEBjaGFtYmVyc2lnbi5vcmcwKgYD +VR0SBCMwIYEfY2hhbWJlcnNpZ25yb290QGNoYW1iZXJzaWduLm9yZzBbBgNVHSAE +VDBSMFAGCysGAQQBgYcuCgEBMEEwPwYIKwYBBQUHAgEWM2h0dHA6Ly9jcHMuY2hh +bWJlcnNpZ24ub3JnL2Nwcy9jaGFtYmVyc2lnbnJvb3QuaHRtbDANBgkqhkiG9w0B +AQUFAAOCAQEAPDtwkfkEVCeR4e3t/mh/YV3lQWVPMvEYBZRqHN4fcNs+ezICNLUM +bKGKfKX0j//U2K0X1S0E0T9YgOKBWYi+wONGkyT+kL0mojAt6JcmVzWJdJYY9hXi +ryQZVgICsroPFOrGimbBhkVVi76SvpykBMdJPJ7oKXqJ1/6v/2j1pReQvayZzKWG +VwlnRtvWFsJG8eSpUPWP0ZIV018+xgBJOm5YstHRJw0lyDL4IBHNfTIzSJRUTN3c +ecQwn+uOuFW114hcxWokPbLTBQNRxgfvzBRydD1ucs4YKIxKoHflCStFREest2d/ +AYoFWpO+ocH/+OcOZ6RHSXZddZAa9SaP8A== +-----END CERTIFICATE----- + +NetLock Qualified (Class QA) Root +================================= + +MD5 Fingerprint=D4:80:65:68:24:F9:89:22:28:DB:F5:A4:9A:17:8F:14 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 123 (0x7b) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=HU, L=Budapest, O=NetLock Halozatbiztonsagi Kft., OU=Tanusitvanykiadok, CN=NetLock Minositett Kozjegyzoi (Class QA) Tanusitvanykiado/emailAddress=info@netlock.hu + Validity + Not Before: Mar 30 01:47:11 2003 GMT + Not After : Dec 15 01:47:11 2022 GMT + Subject: C=HU, L=Budapest, O=NetLock Halozatbiztonsagi Kft., OU=Tanusitvanykiadok, CN=NetLock Minositett Kozjegyzoi (Class QA) Tanusitvanykiado/emailAddress=info@netlock.hu + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:c7:52:25:b2:d8:3d:d4:84:55:09:a7:1b:bd:6c: + b9:14:f4:8a:02:db:76:fc:6a:2a:78:ab:e5:77:f0: + 6e:e0:8c:23:67:db:a5:64:99:b9:dd:01:3e:6f:ef: + 2d:9a:3c:22:f0:5d:c9:57:a0:55:41:7f:f2:43:5e: + 58:82:53:31:65:ce:1e:f2:26:ba:00:54:1e:af:b0: + bc:1c:e4:52:8c:a0:32:af:b7:37:b1:53:67:68:74: + 67:50:f6:2d:2e:64:de:ae:26:79:df:df:99:86:ab: + ab:7f:85:ec:a0:fb:80:cc:f4:b8:0c:1e:93:45:63: + b9:dc:b8:5b:9b:ed:5b:39:d4:5f:62:b0:a7:8e:7c: + 66:38:2c:aa:b1:08:63:17:67:7d:cc:bd:b3:f1:c3: + 3f:cf:50:39:ed:d1:19:83:15:db:87:12:27:96:b7: + da:ea:e5:9d:bc:ba:ea:39:4f:8b:ef:74:9a:e7:c5: + d0:d2:ea:86:51:1c:e4:fe:64:08:28:04:79:05:eb: + ca:c5:71:0e:0b:ef:ab:ea:ec:12:11:a1:18:05:32: + 69:d1:0c:2c:1a:3d:25:99:3f:b5:7c:ca:6d:b0:ae: + 99:99:fa:08:60:e7:19:c2:f2:bd:51:d3:cc:d3:02: + ac:c1:11:0c:80:ce:ab:dc:94:9d:6b:a3:39:53:3a: + d6:85 + Exponent: 50557 (0xc57d) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE, pathlen:4 + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + Netscape Comment: + FIGYELEM! Ezen tanusitvany a NetLock Kft. Minositett Szolgaltatasi Szabalyzataban leirt eljarasok alapjan keszult. A minositett elektronikus alairas joghatas ervenyesulesenek, valamint elfogadasanak feltetele a Minositett Szolgaltatasi Szabalyzatban, az Altalanos Szerzodesi Feltetelekben eloirt ellenorzesi eljaras megtetele. A dokumentumok megtalalhatok a https://www.netlock.hu/docs/ cimen vagy kerhetok az info@netlock.net e-mail cimen. WARNING! The issuance and the use of this certificate are subject to the NetLock Qualified CPS available at https://www.netlock.hu/docs/ or by e-mail at info@netlock.net + X509v3 Subject Key Identifier: + 09:6A:62:16:92:B0:5A:BB:55:0E:CB:75:32:3A:32:E5:B2:21:C9:28 + Signature Algorithm: sha1WithRSAEncryption + 91:6a:50:9c:db:78:81:9b:3f:8b:42:e3:3b:fc:a6:c3:ee:43: + e0:cf:f3:e2:80:35:49:45:76:02:e2:e3:2f:05:c5:f1:2a:e7: + c0:41:33:c6:b6:9b:d0:33:39:cd:c0:db:a1:ad:6c:37:02:4c: + 58:41:3b:f2:97:92:c6:48:a8:cd:e5:8a:39:89:61:f9:52:97: + e9:bd:f6:f9:94:74:e8:71:0e:bc:77:86:c3:06:cc:5a:7c:4a: + 7e:34:50:30:2e:fb:7f:32:9a:8d:3d:f3:20:5b:f8:6a:ca:86: + f3:31:4c:2c:59:80:02:7d:fe:38:c9:30:75:1c:b7:55:e3:bc: + 9f:ba:a8:6d:84:28:05:75:b3:8b:0d:c0:91:54:21:e7:a6:0b: + b4:99:f5:51:41:dc:cd:a3:47:22:d9:c7:01:81:c4:dc:47:4f: + 26:ea:1f:ed:db:cd:0d:98:f4:a3:9c:b4:73:32:4a:96:99:fe: + bc:7f:c8:25:58:f8:58:f3:76:66:89:54:a4:a6:3e:c4:50:5c: + ba:89:18:82:75:48:21:d2:4f:13:e8:60:7e:07:76:db:10:b5: + 51:e6:aa:b9:68:aa:cd:f6:9d:90:75:12:ea:38:1a:ca:44:e8: + b7:99:a7:2a:68:95:66:95:ab:ad:ef:89:cb:60:a9:06:12:c6: + 94:47:e9:28 +-----BEGIN CERTIFICATE----- +MIIG0TCCBbmgAwIBAgIBezANBgkqhkiG9w0BAQUFADCByTELMAkGA1UEBhMCSFUx +ETAPBgNVBAcTCEJ1ZGFwZXN0MScwJQYDVQQKEx5OZXRMb2NrIEhhbG96YXRiaXp0 +b25zYWdpIEtmdC4xGjAYBgNVBAsTEVRhbnVzaXR2YW55a2lhZG9rMUIwQAYDVQQD +EzlOZXRMb2NrIE1pbm9zaXRldHQgS296amVneXpvaSAoQ2xhc3MgUUEpIFRhbnVz +aXR2YW55a2lhZG8xHjAcBgkqhkiG9w0BCQEWD2luZm9AbmV0bG9jay5odTAeFw0w +MzAzMzAwMTQ3MTFaFw0yMjEyMTUwMTQ3MTFaMIHJMQswCQYDVQQGEwJIVTERMA8G +A1UEBxMIQnVkYXBlc3QxJzAlBgNVBAoTHk5ldExvY2sgSGFsb3phdGJpenRvbnNh +Z2kgS2Z0LjEaMBgGA1UECxMRVGFudXNpdHZhbnlraWFkb2sxQjBABgNVBAMTOU5l +dExvY2sgTWlub3NpdGV0dCBLb3pqZWd5em9pIChDbGFzcyBRQSkgVGFudXNpdHZh +bnlraWFkbzEeMBwGCSqGSIb3DQEJARYPaW5mb0BuZXRsb2NrLmh1MIIBIjANBgkq +hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx1Ilstg91IRVCacbvWy5FPSKAtt2/Goq +eKvld/Bu4IwjZ9ulZJm53QE+b+8tmjwi8F3JV6BVQX/yQ15YglMxZc4e8ia6AFQe +r7C8HORSjKAyr7c3sVNnaHRnUPYtLmTeriZ539+Zhqurf4XsoPuAzPS4DB6TRWO5 +3Lhbm+1bOdRfYrCnjnxmOCyqsQhjF2d9zL2z8cM/z1A57dEZgxXbhxInlrfa6uWd +vLrqOU+L73Sa58XQ0uqGURzk/mQIKAR5BevKxXEOC++r6uwSEaEYBTJp0QwsGj0l +mT+1fMptsK6ZmfoIYOcZwvK9UdPM0wKswREMgM6r3JSda6M5UzrWhQIDAMV9o4IC +wDCCArwwEgYDVR0TAQH/BAgwBgEB/wIBBDAOBgNVHQ8BAf8EBAMCAQYwggJ1Bglg +hkgBhvhCAQ0EggJmFoICYkZJR1lFTEVNISBFemVuIHRhbnVzaXR2YW55IGEgTmV0 +TG9jayBLZnQuIE1pbm9zaXRldHQgU3pvbGdhbHRhdGFzaSBTemFiYWx5emF0YWJh +biBsZWlydCBlbGphcmFzb2sgYWxhcGphbiBrZXN6dWx0LiBBIG1pbm9zaXRldHQg +ZWxla3Ryb25pa3VzIGFsYWlyYXMgam9naGF0YXMgZXJ2ZW55ZXN1bGVzZW5laywg +dmFsYW1pbnQgZWxmb2dhZGFzYW5hayBmZWx0ZXRlbGUgYSBNaW5vc2l0ZXR0IFN6 +b2xnYWx0YXRhc2kgU3phYmFseXphdGJhbiwgYXogQWx0YWxhbm9zIFN6ZXJ6b2Rl +c2kgRmVsdGV0ZWxla2JlbiBlbG9pcnQgZWxsZW5vcnplc2kgZWxqYXJhcyBtZWd0 +ZXRlbGUuIEEgZG9rdW1lbnR1bW9rIG1lZ3RhbGFsaGF0b2sgYSBodHRwczovL3d3 +dy5uZXRsb2NrLmh1L2RvY3MvIGNpbWVuIHZhZ3kga2VyaGV0b2sgYXogaW5mb0Bu +ZXRsb2NrLm5ldCBlLW1haWwgY2ltZW4uIFdBUk5JTkchIFRoZSBpc3N1YW5jZSBh +bmQgdGhlIHVzZSBvZiB0aGlzIGNlcnRpZmljYXRlIGFyZSBzdWJqZWN0IHRvIHRo +ZSBOZXRMb2NrIFF1YWxpZmllZCBDUFMgYXZhaWxhYmxlIGF0IGh0dHBzOi8vd3d3 +Lm5ldGxvY2suaHUvZG9jcy8gb3IgYnkgZS1tYWlsIGF0IGluZm9AbmV0bG9jay5u +ZXQwHQYDVR0OBBYEFAlqYhaSsFq7VQ7LdTI6MuWyIckoMA0GCSqGSIb3DQEBBQUA +A4IBAQCRalCc23iBmz+LQuM7/KbD7kPgz/PigDVJRXYC4uMvBcXxKufAQTPGtpvQ +MznNwNuhrWw3AkxYQTvyl5LGSKjN5Yo5iWH5Upfpvfb5lHTocQ68d4bDBsxafEp+ +NFAwLvt/MpqNPfMgW/hqyobzMUwsWYACff44yTB1HLdV47yfuqhthCgFdbOLDcCR +VCHnpgu0mfVRQdzNo0ci2ccBgcTcR08m6h/t280NmPSjnLRzMkqWmf68f8glWPhY +83ZmiVSkpj7EUFy6iRiCdUgh0k8T6GB+B3bbELVR5qq5aKrN9p2QdRLqOBrKROi3 +macqaJVmlaut74nLYKkGEsaUR+ko +-----END CERTIFICATE----- + +NetLock Notary (Class A) Root +============================= + +MD5 Fingerprint=86:38:6D:5E:49:63:6C:85:5C:DB:6D:DC:94:B7:D0:F7 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 259 (0x103) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=HU, ST=Hungary, L=Budapest, O=NetLock Halozatbiztonsagi Kft., OU=Tanusitvanykiadok, CN=NetLock Kozjegyzoi (Class A) Tanusitvanykiado + Validity + Not Before: Feb 24 23:14:47 1999 GMT + Not After : Feb 19 23:14:47 2019 GMT + Subject: C=HU, ST=Hungary, L=Budapest, O=NetLock Halozatbiztonsagi Kft., OU=Tanusitvanykiadok, CN=NetLock Kozjegyzoi (Class A) Tanusitvanykiado + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:bc:74:8c:0f:bb:4c:f4:37:1e:a9:05:82:d8:e6: + e1:6c:70:ea:78:b5:6e:d1:38:44:0d:a8:83:ce:5d: + d2:d6:d5:81:c5:d4:4b:e7:5b:94:70:26:db:3b:9d: + 6a:4c:62:f7:71:f3:64:d6:61:3b:3d:eb:73:a3:37: + d9:cf:ea:8c:92:3b:cd:f7:07:dc:66:74:97:f4:45: + 22:dd:f4:5c:e0:bf:6d:f3:be:65:33:e4:15:3a:bf: + db:98:90:55:38:c4:ed:a6:55:63:0b:b0:78:04:f4: + e3:6e:c1:3f:8e:fc:51:78:1f:92:9e:83:c2:fe:d9: + b0:a9:c9:bc:5a:00:ff:a9:a8:98:74:fb:f6:2c:3e: + 15:39:0d:b6:04:55:a8:0e:98:20:42:b3:b1:25:ad: + 7e:9a:6f:5d:53:b1:ab:0c:fc:eb:e0:f3:7a:b3:a8: + b3:ff:46:f6:63:a2:d8:3a:98:7b:b6:ac:85:ff:b0: + 25:4f:74:63:e7:13:07:a5:0a:8f:05:f7:c0:64:6f: + 7e:a7:27:80:96:de:d4:2e:86:60:c7:6b:2b:5e:73: + 7b:17:e7:91:3f:64:0c:d8:4b:22:34:2b:9b:32:f2: + 48:1f:9f:a1:0a:84:7a:e2:c2:ad:97:3d:8e:d5:c1: + f9:56:a3:50:e9:c6:b4:fa:98:a2:ee:95:e6:2a:03: + 8c:df + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE, pathlen:4 + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + Netscape Comment: + FIGYELEM! Ezen tanusitvany a NetLock Kft. Altalanos Szolgaltatasi Felteteleiben leirt eljarasok alapjan keszult. A hitelesites folyamatat a NetLock Kft. termekfelelosseg-biztositasa vedi. A digitalis alairas elfogadasanak feltetele az eloirt ellenorzesi eljaras megtetele. Az eljaras leirasa megtalalhato a NetLock Kft. Internet honlapjan a https://www.netlock.net/docs cimen vagy kerheto az ellenorzes@netlock.net e-mail cimen. IMPORTANT! The issuance and the use of this certificate is subject to the NetLock CPS available at https://www.netlock.net/docs or by e-mail at cps@netlock.net. + Signature Algorithm: md5WithRSAEncryption + 48:24:46:f7:ba:56:6f:fa:c8:28:03:40:4e:e5:31:39:6b:26: + 6b:53:7f:db:df:df:f3:71:3d:26:c0:14:0e:c6:67:7b:23:a8: + 0c:73:dd:01:bb:c6:ca:6e:37:39:55:d5:c7:8c:56:20:0e:28: + 0a:0e:d2:2a:a4:b0:49:52:c6:38:07:fe:be:0a:09:8c:d1:98: + cf:ca:da:14:31:a1:4f:d2:39:fc:0f:11:2c:43:c3:dd:ab:93: + c7:55:3e:47:7c:18:1a:00:dc:f3:7b:d8:f2:7f:52:6c:20:f4: + 0b:5f:69:52:f4:ee:f8:b2:29:60:eb:e3:49:31:21:0d:d6:b5: + 10:41:e2:41:09:6c:e2:1a:9a:56:4b:77:02:f6:a0:9b:9a:27: + 87:e8:55:29:71:c2:90:9f:45:78:1a:e1:15:64:3d:d0:0e:d8: + a0:76:9f:ae:c5:d0:2e:ea:d6:0f:56:ec:64:7f:5a:9b:14:58: + 01:27:7e:13:50:c7:6b:2a:e6:68:3c:bf:5c:a0:0a:1b:e1:0e: + 7a:e9:e2:80:c3:e9:e9:f6:fd:6c:11:9e:d0:e5:28:27:2b:54: + 32:42:14:82:75:e6:4a:f0:2b:66:75:63:8c:a2:fb:04:3e:83: + 0e:9b:36:f0:18:e4:26:20:c3:8c:f0:28:07:ad:3c:17:66:88: + b5:fd:b6:88 +-----BEGIN CERTIFICATE----- +MIIGfTCCBWWgAwIBAgICAQMwDQYJKoZIhvcNAQEEBQAwga8xCzAJBgNVBAYTAkhV +MRAwDgYDVQQIEwdIdW5nYXJ5MREwDwYDVQQHEwhCdWRhcGVzdDEnMCUGA1UEChMe +TmV0TG9jayBIYWxvemF0Yml6dG9uc2FnaSBLZnQuMRowGAYDVQQLExFUYW51c2l0 +dmFueWtpYWRvazE2MDQGA1UEAxMtTmV0TG9jayBLb3pqZWd5em9pIChDbGFzcyBB +KSBUYW51c2l0dmFueWtpYWRvMB4XDTk5MDIyNDIzMTQ0N1oXDTE5MDIxOTIzMTQ0 +N1owga8xCzAJBgNVBAYTAkhVMRAwDgYDVQQIEwdIdW5nYXJ5MREwDwYDVQQHEwhC +dWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6dG9uc2FnaSBLZnQu +MRowGAYDVQQLExFUYW51c2l0dmFueWtpYWRvazE2MDQGA1UEAxMtTmV0TG9jayBL +b3pqZWd5em9pIChDbGFzcyBBKSBUYW51c2l0dmFueWtpYWRvMIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvHSMD7tM9DceqQWC2ObhbHDqeLVu0ThEDaiD +zl3S1tWBxdRL51uUcCbbO51qTGL3cfNk1mE7PetzozfZz+qMkjvN9wfcZnSX9EUi +3fRc4L9t875lM+QVOr/bmJBVOMTtplVjC7B4BPTjbsE/jvxReB+SnoPC/tmwqcm8 +WgD/qaiYdPv2LD4VOQ22BFWoDpggQrOxJa1+mm9dU7GrDPzr4PN6s6iz/0b2Y6LY +Oph7tqyF/7AlT3Rj5xMHpQqPBffAZG9+pyeAlt7ULoZgx2srXnN7F+eRP2QM2Esi +NCubMvJIH5+hCoR64sKtlz2O1cH5VqNQ6ca0+pii7pXmKgOM3wIDAQABo4ICnzCC +ApswDgYDVR0PAQH/BAQDAgAGMBIGA1UdEwEB/wQIMAYBAf8CAQQwEQYJYIZIAYb4 +QgEBBAQDAgAHMIICYAYJYIZIAYb4QgENBIICURaCAk1GSUdZRUxFTSEgRXplbiB0 +YW51c2l0dmFueSBhIE5ldExvY2sgS2Z0LiBBbHRhbGFub3MgU3pvbGdhbHRhdGFz +aSBGZWx0ZXRlbGVpYmVuIGxlaXJ0IGVsamFyYXNvayBhbGFwamFuIGtlc3p1bHQu +IEEgaGl0ZWxlc2l0ZXMgZm9seWFtYXRhdCBhIE5ldExvY2sgS2Z0LiB0ZXJtZWtm +ZWxlbG9zc2VnLWJpenRvc2l0YXNhIHZlZGkuIEEgZGlnaXRhbGlzIGFsYWlyYXMg +ZWxmb2dhZGFzYW5hayBmZWx0ZXRlbGUgYXogZWxvaXJ0IGVsbGVub3J6ZXNpIGVs +amFyYXMgbWVndGV0ZWxlLiBBeiBlbGphcmFzIGxlaXJhc2EgbWVndGFsYWxoYXRv +IGEgTmV0TG9jayBLZnQuIEludGVybmV0IGhvbmxhcGphbiBhIGh0dHBzOi8vd3d3 +Lm5ldGxvY2submV0L2RvY3MgY2ltZW4gdmFneSBrZXJoZXRvIGF6IGVsbGVub3J6 +ZXNAbmV0bG9jay5uZXQgZS1tYWlsIGNpbWVuLiBJTVBPUlRBTlQhIFRoZSBpc3N1 +YW5jZSBhbmQgdGhlIHVzZSBvZiB0aGlzIGNlcnRpZmljYXRlIGlzIHN1YmplY3Qg +dG8gdGhlIE5ldExvY2sgQ1BTIGF2YWlsYWJsZSBhdCBodHRwczovL3d3dy5uZXRs +b2NrLm5ldC9kb2NzIG9yIGJ5IGUtbWFpbCBhdCBjcHNAbmV0bG9jay5uZXQuMA0G +CSqGSIb3DQEBBAUAA4IBAQBIJEb3ulZv+sgoA0BO5TE5ayZrU3/b39/zcT0mwBQO +xmd7I6gMc90Bu8bKbjc5VdXHjFYgDigKDtIqpLBJUsY4B/6+CgmM0ZjPytoUMaFP +0jn8DxEsQ8Pdq5PHVT5HfBgaANzze9jyf1JsIPQLX2lS9O74silg6+NJMSEN1rUQ +QeJBCWziGppWS3cC9qCbmieH6FUpccKQn0V4GuEVZD3QDtigdp+uxdAu6tYPVuxk +f1qbFFgBJ34TUMdrKuZoPL9coAob4Q566eKAw+np9v1sEZ7Q5SgnK1QyQhSCdeZK +8CtmdWOMovsEPoMOmzbwGOQmIMOM8CgHrTwXZoi1/baI +-----END CERTIFICATE----- + +NetLock Business (Class B) Root +=============================== + +MD5 Fingerprint=39:16:AA:B9:6A:41:E1:14:69:DF:9E:6C:3B:72:DC:B6 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 105 (0x69) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=HU, L=Budapest, O=NetLock Halozatbiztonsagi Kft., OU=Tanusitvanykiadok, CN=NetLock Uzleti (Class B) Tanusitvanykiado + Validity + Not Before: Feb 25 14:10:22 1999 GMT + Not After : Feb 20 14:10:22 2019 GMT + Subject: C=HU, L=Budapest, O=NetLock Halozatbiztonsagi Kft., OU=Tanusitvanykiadok, CN=NetLock Uzleti (Class B) Tanusitvanykiado + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:b1:ea:04:ec:20:a0:23:c2:8f:38:60:cf:c7:46: + b3:d5:1b:fe:fb:b9:99:9e:04:dc:1c:7f:8c:4a:81: + 98:ee:a4:d4:ca:8a:17:b9:22:7f:83:0a:75:4c:9b: + c0:69:d8:64:39:a3:ed:92:a3:fd:5b:5c:74:1a:c0: + 47:ca:3a:69:76:9a:ba:e2:44:17:fc:4c:a3:d5:fe: + b8:97:88:af:88:03:89:1f:a4:f2:04:3e:c8:07:0b: + e6:f9:b3:2f:7a:62:14:09:46:14:ca:64:f5:8b:80: + b5:62:a8:d8:6b:d6:71:93:2d:b3:bf:09:54:58:ed: + 06:eb:a8:7b:dc:43:b1:a1:69 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE, pathlen:4 + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + Netscape Comment: + FIGYELEM! Ezen tanusitvany a NetLock Kft. Altalanos Szolgaltatasi Felteteleiben leirt eljarasok alapjan keszult. A hitelesites folyamatat a NetLock Kft. termekfelelosseg-biztositasa vedi. A digitalis alairas elfogadasanak feltetele az eloirt ellenorzesi eljaras megtetele. Az eljaras leirasa megtalalhato a NetLock Kft. Internet honlapjan a https://www.netlock.net/docs cimen vagy kerheto az ellenorzes@netlock.net e-mail cimen. IMPORTANT! The issuance and the use of this certificate is subject to the NetLock CPS available at https://www.netlock.net/docs or by e-mail at cps@netlock.net. + Signature Algorithm: md5WithRSAEncryption + 04:db:ae:8c:17:af:f8:0e:90:31:4e:cd:3e:09:c0:6d:3a:b0: + f8:33:4c:47:4c:e3:75:88:10:97:ac:b0:38:15:91:c6:29:96: + cc:21:c0:6d:3c:a5:74:cf:d8:82:a5:39:c3:65:e3:42:70:bb: + 22:90:e3:7d:db:35:76:e1:a0:b5:da:9f:70:6e:93:1a:30:39: + 1d:30:db:2e:e3:7c:b2:91:b2:d1:37:29:fa:b9:d6:17:5c:47: + 4f:e3:1d:38:eb:9f:d5:7b:95:a8:28:9e:15:4a:d1:d1:d0:2b: + 00:97:a0:e2:92:36:2b:63:ac:58:01:6b:33:29:50:86:83:f1: + 01:48 +-----BEGIN CERTIFICATE----- +MIIFSzCCBLSgAwIBAgIBaTANBgkqhkiG9w0BAQQFADCBmTELMAkGA1UEBhMCSFUx +ETAPBgNVBAcTCEJ1ZGFwZXN0MScwJQYDVQQKEx5OZXRMb2NrIEhhbG96YXRiaXp0 +b25zYWdpIEtmdC4xGjAYBgNVBAsTEVRhbnVzaXR2YW55a2lhZG9rMTIwMAYDVQQD +EylOZXRMb2NrIFV6bGV0aSAoQ2xhc3MgQikgVGFudXNpdHZhbnlraWFkbzAeFw05 +OTAyMjUxNDEwMjJaFw0xOTAyMjAxNDEwMjJaMIGZMQswCQYDVQQGEwJIVTERMA8G +A1UEBxMIQnVkYXBlc3QxJzAlBgNVBAoTHk5ldExvY2sgSGFsb3phdGJpenRvbnNh +Z2kgS2Z0LjEaMBgGA1UECxMRVGFudXNpdHZhbnlraWFkb2sxMjAwBgNVBAMTKU5l +dExvY2sgVXpsZXRpIChDbGFzcyBCKSBUYW51c2l0dmFueWtpYWRvMIGfMA0GCSqG +SIb3DQEBAQUAA4GNADCBiQKBgQCx6gTsIKAjwo84YM/HRrPVG/77uZmeBNwcf4xK +gZjupNTKihe5In+DCnVMm8Bp2GQ5o+2So/1bXHQawEfKOml2mrriRBf8TKPV/riX +iK+IA4kfpPIEPsgHC+b5sy96YhQJRhTKZPWLgLViqNhr1nGTLbO/CVRY7QbrqHvc +Q7GhaQIDAQABo4ICnzCCApswEgYDVR0TAQH/BAgwBgEB/wIBBDAOBgNVHQ8BAf8E +BAMCAAYwEQYJYIZIAYb4QgEBBAQDAgAHMIICYAYJYIZIAYb4QgENBIICURaCAk1G +SUdZRUxFTSEgRXplbiB0YW51c2l0dmFueSBhIE5ldExvY2sgS2Z0LiBBbHRhbGFu +b3MgU3pvbGdhbHRhdGFzaSBGZWx0ZXRlbGVpYmVuIGxlaXJ0IGVsamFyYXNvayBh +bGFwamFuIGtlc3p1bHQuIEEgaGl0ZWxlc2l0ZXMgZm9seWFtYXRhdCBhIE5ldExv +Y2sgS2Z0LiB0ZXJtZWtmZWxlbG9zc2VnLWJpenRvc2l0YXNhIHZlZGkuIEEgZGln +aXRhbGlzIGFsYWlyYXMgZWxmb2dhZGFzYW5hayBmZWx0ZXRlbGUgYXogZWxvaXJ0 +IGVsbGVub3J6ZXNpIGVsamFyYXMgbWVndGV0ZWxlLiBBeiBlbGphcmFzIGxlaXJh +c2EgbWVndGFsYWxoYXRvIGEgTmV0TG9jayBLZnQuIEludGVybmV0IGhvbmxhcGph +biBhIGh0dHBzOi8vd3d3Lm5ldGxvY2submV0L2RvY3MgY2ltZW4gdmFneSBrZXJo +ZXRvIGF6IGVsbGVub3J6ZXNAbmV0bG9jay5uZXQgZS1tYWlsIGNpbWVuLiBJTVBP +UlRBTlQhIFRoZSBpc3N1YW5jZSBhbmQgdGhlIHVzZSBvZiB0aGlzIGNlcnRpZmlj +YXRlIGlzIHN1YmplY3QgdG8gdGhlIE5ldExvY2sgQ1BTIGF2YWlsYWJsZSBhdCBo +dHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIG9yIGJ5IGUtbWFpbCBhdCBjcHNA +bmV0bG9jay5uZXQuMA0GCSqGSIb3DQEBBAUAA4GBAATbrowXr/gOkDFOzT4JwG06 +sPgzTEdM43WIEJessDgVkcYplswhwG08pXTP2IKlOcNl40JwuyKQ433bNXbhoLXa +n3BukxowOR0w2y7jfLKRstE3Kfq51hdcR0/jHTjrn9V7lagonhVK0dHQKwCXoOKS +NitjrFgBazMpUIaD8QFI +-----END CERTIFICATE----- + +NetLock Express (Class C) Root +============================== + +MD5 Fingerprint=4F:EB:F1:F0:70:C2:80:63:5D:58:9F:DA:12:3C:A9:C4 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 104 (0x68) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=HU, L=Budapest, O=NetLock Halozatbiztonsagi Kft., OU=Tanusitvanykiadok, CN=NetLock Expressz (Class C) Tanusitvanykiado + Validity + Not Before: Feb 25 14:08:11 1999 GMT + Not After : Feb 20 14:08:11 2019 GMT + Subject: C=HU, L=Budapest, O=NetLock Halozatbiztonsagi Kft., OU=Tanusitvanykiadok, CN=NetLock Expressz (Class C) Tanusitvanykiado + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:eb:ec:b0:6c:61:8a:23:25:af:60:20:e3:d9:9f: + fc:93:0b:db:5d:8d:b0:a1:b3:40:3a:82:ce:fd:75: + e0:78:32:03:86:5a:86:95:91:ed:53:fa:9d:40:fc: + e6:e8:dd:d9:5b:7a:03:bd:5d:f3:3b:0c:c3:51:79: + 9b:ad:55:a0:e9:d0:03:10:af:0a:ba:14:42:d9:52: + 26:11:22:c7:d2:20:cc:82:a4:9a:a9:fe:b8:81:76: + 9d:6a:b7:d2:36:75:3e:b1:86:09:f6:6e:6d:7e:4e: + b7:7a:ec:ae:71:84:f6:04:33:08:25:32:eb:74:ac: + 16:44:c6:e4:40:93:1d:7f:ad + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE, pathlen:4 + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + Netscape Comment: + FIGYELEM! Ezen tanusitvany a NetLock Kft. Altalanos Szolgaltatasi Felteteleiben leirt eljarasok alapjan keszult. A hitelesites folyamatat a NetLock Kft. termekfelelosseg-biztositasa vedi. A digitalis alairas elfogadasanak feltetele az eloirt ellenorzesi eljaras megtetele. Az eljaras leirasa megtalalhato a NetLock Kft. Internet honlapjan a https://www.netlock.net/docs cimen vagy kerheto az ellenorzes@netlock.net e-mail cimen. IMPORTANT! The issuance and the use of this certificate is subject to the NetLock CPS available at https://www.netlock.net/docs or by e-mail at cps@netlock.net. + Signature Algorithm: md5WithRSAEncryption + 10:ad:7f:d7:0c:32:80:0a:d8:86:f1:79:98:b5:ad:d4:cd:b3: + 36:c4:96:48:c1:5c:cd:9a:d9:05:2e:9f:be:50:eb:f4:26:14: + 10:2d:d4:66:17:f8:9e:c1:27:fd:f1:ed:e4:7b:4b:a0:6c:b5: + ab:9a:57:70:a6:ed:a0:a4:ed:2e:f5:fd:fc:bd:fe:4d:37:08: + 0c:bc:e3:96:83:22:f5:49:1b:7f:4b:2b:b4:54:c1:80:7c:99: + 4e:1d:d0:8c:ee:d0:ac:e5:92:fa:75:56:fe:64:a0:13:8f:b8: + b8:16:9d:61:05:67:80:c8:d0:d8:a5:07:02:34:98:04:8d:33: + 04:d4 +-----BEGIN CERTIFICATE----- +MIIFTzCCBLigAwIBAgIBaDANBgkqhkiG9w0BAQQFADCBmzELMAkGA1UEBhMCSFUx +ETAPBgNVBAcTCEJ1ZGFwZXN0MScwJQYDVQQKEx5OZXRMb2NrIEhhbG96YXRiaXp0 +b25zYWdpIEtmdC4xGjAYBgNVBAsTEVRhbnVzaXR2YW55a2lhZG9rMTQwMgYDVQQD +EytOZXRMb2NrIEV4cHJlc3N6IChDbGFzcyBDKSBUYW51c2l0dmFueWtpYWRvMB4X +DTk5MDIyNTE0MDgxMVoXDTE5MDIyMDE0MDgxMVowgZsxCzAJBgNVBAYTAkhVMREw +DwYDVQQHEwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6dG9u +c2FnaSBLZnQuMRowGAYDVQQLExFUYW51c2l0dmFueWtpYWRvazE0MDIGA1UEAxMr +TmV0TG9jayBFeHByZXNzeiAoQ2xhc3MgQykgVGFudXNpdHZhbnlraWFkbzCBnzAN +BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA6+ywbGGKIyWvYCDj2Z/8kwvbXY2wobNA +OoLO/XXgeDIDhlqGlZHtU/qdQPzm6N3ZW3oDvV3zOwzDUXmbrVWg6dADEK8KuhRC +2VImESLH0iDMgqSaqf64gXadarfSNnU+sYYJ9m5tfk63euyucYT2BDMIJTLrdKwW +RMbkQJMdf60CAwEAAaOCAp8wggKbMBIGA1UdEwEB/wQIMAYBAf8CAQQwDgYDVR0P +AQH/BAQDAgAGMBEGCWCGSAGG+EIBAQQEAwIABzCCAmAGCWCGSAGG+EIBDQSCAlEW +ggJNRklHWUVMRU0hIEV6ZW4gdGFudXNpdHZhbnkgYSBOZXRMb2NrIEtmdC4gQWx0 +YWxhbm9zIFN6b2xnYWx0YXRhc2kgRmVsdGV0ZWxlaWJlbiBsZWlydCBlbGphcmFz +b2sgYWxhcGphbiBrZXN6dWx0LiBBIGhpdGVsZXNpdGVzIGZvbHlhbWF0YXQgYSBO +ZXRMb2NrIEtmdC4gdGVybWVrZmVsZWxvc3NlZy1iaXp0b3NpdGFzYSB2ZWRpLiBB +IGRpZ2l0YWxpcyBhbGFpcmFzIGVsZm9nYWRhc2FuYWsgZmVsdGV0ZWxlIGF6IGVs +b2lydCBlbGxlbm9yemVzaSBlbGphcmFzIG1lZ3RldGVsZS4gQXogZWxqYXJhcyBs +ZWlyYXNhIG1lZ3RhbGFsaGF0byBhIE5ldExvY2sgS2Z0LiBJbnRlcm5ldCBob25s +YXBqYW4gYSBodHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIGNpbWVuIHZhZ3kg +a2VyaGV0byBheiBlbGxlbm9yemVzQG5ldGxvY2submV0IGUtbWFpbCBjaW1lbi4g +SU1QT1JUQU5UISBUaGUgaXNzdWFuY2UgYW5kIHRoZSB1c2Ugb2YgdGhpcyBjZXJ0 +aWZpY2F0ZSBpcyBzdWJqZWN0IHRvIHRoZSBOZXRMb2NrIENQUyBhdmFpbGFibGUg +YXQgaHR0cHM6Ly93d3cubmV0bG9jay5uZXQvZG9jcyBvciBieSBlLW1haWwgYXQg +Y3BzQG5ldGxvY2submV0LjANBgkqhkiG9w0BAQQFAAOBgQAQrX/XDDKACtiG8XmY +ta3UzbM2xJZIwVzNmtkFLp++UOv0JhQQLdRmF/iewSf98e3ke0ugbLWrmldwpu2g +pO0u9f38vf5NNwgMvOOWgyL1SRt/Syu0VMGAfJlOHdCM7tCs5ZL6dVb+ZKATj7i4 +Fp1hBWeAyNDYpQcCNJgEjTME1A== +-----END CERTIFICATE----- + +XRamp Global CA Root +==================== + +MD5 Fingerprint=A1:0B:44:B3:CA:10:D8:00:6E:9D:0F:D8:0F:92:0A:D1 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 50:94:6c:ec:18:ea:d5:9c:4d:d5:97:ef:75:8f:a0:ad + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, OU=www.xrampsecurity.com, O=XRamp Security Services Inc, CN=XRamp Global Certification Authority + Validity + Not Before: Nov 1 17:14:04 2004 GMT + Not After : Jan 1 05:37:19 2035 GMT + Subject: C=US, OU=www.xrampsecurity.com, O=XRamp Security Services Inc, CN=XRamp Global Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:98:24:1e:bd:15:b4:ba:df:c7:8c:a5:27:b6:38: + 0b:69:f3:b6:4e:a8:2c:2e:21:1d:5c:44:df:21:5d: + 7e:23:74:fe:5e:7e:b4:4a:b7:a6:ad:1f:ae:e0:06: + 16:e2:9b:5b:d9:67:74:6b:5d:80:8f:29:9d:86:1b: + d9:9c:0d:98:6d:76:10:28:58:e4:65:b0:7f:4a:98: + 79:9f:e0:c3:31:7e:80:2b:b5:8c:c0:40:3b:11:86: + d0:cb:a2:86:36:60:a4:d5:30:82:6d:d9:6e:d0:0f: + 12:04:33:97:5f:4f:61:5a:f0:e4:f9:91:ab:e7:1d: + 3b:bc:e8:cf:f4:6b:2d:34:7c:e2:48:61:1c:8e:f3: + 61:44:cc:6f:a0:4a:a9:94:b0:4d:da:e7:a9:34:7a: + 72:38:a8:41:cc:3c:94:11:7d:eb:c8:a6:8c:b7:86: + cb:ca:33:3b:d9:3d:37:8b:fb:7a:3e:86:2c:e7:73: + d7:0a:57:ac:64:9b:19:eb:f4:0f:04:08:8a:ac:03: + 17:19:64:f4:5a:25:22:8d:34:2c:b2:f6:68:1d:12: + 6d:d3:8a:1e:14:da:c4:8f:a6:e2:23:85:d5:7a:0d: + bd:6a:e0:e9:ec:ec:17:bb:42:1b:67:aa:25:ed:45: + 83:21:fc:c1:c9:7c:d5:62:3e:fa:f2:c5:2d:d3:fd: + d4:65 + Exponent: 65537 (0x10001) + X509v3 extensions: + 1.3.6.1.4.1.311.20.2: + ...C.A + X509v3 Key Usage: + Digital Signature, Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + C6:4F:A2:3D:06:63:84:09:9C:CE:62:E4:04:AC:8D:5C:B5:E9:B6:1B + X509v3 CRL Distribution Points: + URI:http://crl.xrampsecurity.com/XGCA.crl + + 1.3.6.1.4.1.311.21.1: + ... + Signature Algorithm: sha1WithRSAEncryption + 91:15:39:03:01:1b:67:fb:4a:1c:f9:0a:60:5b:a1:da:4d:97: + 62:f9:24:53:27:d7:82:64:4e:90:2e:c3:49:1b:2b:9a:dc:fc: + a8:78:67:35:f1:1d:f0:11:bd:b7:48:e3:10:f6:0d:df:3f:d2: + c9:b6:aa:55:a4:48:ba:02:db:de:59:2e:15:5b:3b:9d:16:7d: + 47:d7:37:ea:5f:4d:76:12:36:bb:1f:d7:a1:81:04:46:20:a3: + 2c:6d:a9:9e:01:7e:3f:29:ce:00:93:df:fd:c9:92:73:89:89: + 64:9e:e7:2b:e4:1c:91:2c:d2:b9:ce:7d:ce:6f:31:99:d3:e6: + be:d2:1e:90:f0:09:14:79:5c:23:ab:4d:d2:da:21:1f:4d:99: + 79:9d:e1:cf:27:9f:10:9b:1c:88:0d:b0:8a:64:41:31:b8:0e: + 6c:90:24:a4:9b:5c:71:8f:ba:bb:7e:1c:1b:db:6a:80:0f:21: + bc:e9:db:a6:b7:40:f4:b2:8b:a9:b1:e4:ef:9a:1a:d0:3d:69: + 99:ee:a8:28:a3:e1:3c:b3:f0:b2:11:9c:cf:7c:40:e6:dd:e7: + 43:7d:a2:d8:3a:b5:a9:8d:f2:34:99:c4:d4:10:e1:06:fd:09: + 84:10:3b:ee:c4:4c:f4:ec:27:7c:42:c2:74:7c:82:8a:09:c9: + b4:03:25:bc +-----BEGIN CERTIFICATE----- +MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCB +gjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEk +MCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRY +UmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQxMTAxMTcx +NDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3 +dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2Vy +dmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB +dXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS6 +38eMpSe2OAtp87ZOqCwuIR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCP +KZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMxfoArtYzAQDsRhtDLooY2YKTVMIJt2W7Q +DxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FEzG+gSqmUsE3a56k0enI4 +qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqsAxcZZPRa +JSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNVi +PvryxS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0P +BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASs +jVy16bYbMDYGA1UdHwQvMC0wK6ApoCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0 +eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQEwDQYJKoZIhvcNAQEFBQAD +ggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc/Kh4ZzXxHfAR +vbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt +qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLa +IR9NmXmd4c8nnxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSy +i6mx5O+aGtA9aZnuqCij4Tyz8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQ +O+7ETPTsJ3xCwnR8gooJybQDJbw= +-----END CERTIFICATE----- + +Go Daddy Class 2 CA +=================== + +MD5 Fingerprint=91:DE:06:25:AB:DA:FD:32:17:0C:BB:25:17:2A:84:67 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=The Go Daddy Group, Inc., OU=Go Daddy Class 2 Certification Authority + Validity + Not Before: Jun 29 17:06:20 2004 GMT + Not After : Jun 29 17:06:20 2034 GMT + Subject: C=US, O=The Go Daddy Group, Inc., OU=Go Daddy Class 2 Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:de:9d:d7:ea:57:18:49:a1:5b:eb:d7:5f:48:86: + ea:be:dd:ff:e4:ef:67:1c:f4:65:68:b3:57:71:a0: + 5e:77:bb:ed:9b:49:e9:70:80:3d:56:18:63:08:6f: + da:f2:cc:d0:3f:7f:02:54:22:54:10:d8:b2:81:d4: + c0:75:3d:4b:7f:c7:77:c3:3e:78:ab:1a:03:b5:20: + 6b:2f:6a:2b:b1:c5:88:7e:c4:bb:1e:b0:c1:d8:45: + 27:6f:aa:37:58:f7:87:26:d7:d8:2d:f6:a9:17:b7: + 1f:72:36:4e:a6:17:3f:65:98:92:db:2a:6e:5d:a2: + fe:88:e0:0b:de:7f:e5:8d:15:e1:eb:cb:3a:d5:e2: + 12:a2:13:2d:d8:8e:af:5f:12:3d:a0:08:05:08:b6: + 5c:a5:65:38:04:45:99:1e:a3:60:60:74:c5:41:a5: + 72:62:1b:62:c5:1f:6f:5f:1a:42:be:02:51:65:a8: + ae:23:18:6a:fc:78:03:a9:4d:7f:80:c3:fa:ab:5a: + fc:a1:40:a4:ca:19:16:fe:b2:c8:ef:5e:73:0d:ee: + 77:bd:9a:f6:79:98:bc:b1:07:67:a2:15:0d:dd:a0: + 58:c6:44:7b:0a:3e:62:28:5f:ba:41:07:53:58:cf: + 11:7e:38:74:c5:f8:ff:b5:69:90:8f:84:74:ea:97: + 1b:af + Exponent: 3 (0x3) + X509v3 extensions: + X509v3 Subject Key Identifier: + D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3 + X509v3 Authority Key Identifier: + keyid:D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3 + DirName:/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority + serial:00 + + X509v3 Basic Constraints: + CA:TRUE + Signature Algorithm: sha1WithRSAEncryption + 32:4b:f3:b2:ca:3e:91:fc:12:c6:a1:07:8c:8e:77:a0:33:06: + 14:5c:90:1e:18:f7:08:a6:3d:0a:19:f9:87:80:11:6e:69:e4: + 96:17:30:ff:34:91:63:72:38:ee:cc:1c:01:a3:1d:94:28:a4: + 31:f6:7a:c4:54:d7:f6:e5:31:58:03:a2:cc:ce:62:db:94:45: + 73:b5:bf:45:c9:24:b5:d5:82:02:ad:23:79:69:8d:b8:b6:4d: + ce:cf:4c:ca:33:23:e8:1c:88:aa:9d:8b:41:6e:16:c9:20:e5: + 89:9e:cd:3b:da:70:f7:7e:99:26:20:14:54:25:ab:6e:73:85: + e6:9b:21:9d:0a:6c:82:0e:a8:f8:c2:0c:fa:10:1e:6c:96:ef: + 87:0d:c4:0f:61:8b:ad:ee:83:2b:95:f8:8e:92:84:72:39:eb: + 20:ea:83:ed:83:cd:97:6e:08:bc:eb:4e:26:b6:73:2b:e4:d3: + f6:4c:fe:26:71:e2:61:11:74:4a:ff:57:1a:87:0f:75:48:2e: + cf:51:69:17:a0:02:12:61:95:d5:d1:40:b2:10:4c:ee:c4:ac: + 10:43:a6:a5:9e:0a:d5:95:62:9a:0d:cf:88:82:c5:32:0c:e4: + 2b:9f:45:e6:0d:9f:28:9c:b1:b9:2a:5a:57:ad:37:0f:af:1d: + 7f:db:bd:9f +-----BEGIN CERTIFICATE----- +MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEh +MB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBE +YWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3 +MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMxITAfBgNVBAoTGFRo +ZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28gRGFkZHkgQ2xhc3Mg +MiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQADggEN +ADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCA +PVYYYwhv2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6w +wdhFJ2+qN1j3hybX2C32qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXi +EqITLdiOr18SPaAIBQi2XKVlOARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWoriMY +avx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZEewo+ +YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0OBBYEFNLE +sNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h +/t2oatTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5 +IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD +ggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wimPQoZ+YeAEW5p5JYXMP80kWNy +OO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKtI3lpjbi2Tc7P +TMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ +HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mER +dEr/VxqHD3VILs9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5Cuf +ReYNnyicsbkqWletNw+vHX/bvZ8= +-----END CERTIFICATE----- + +Starfield Class 2 CA +==================== + +MD5 Fingerprint=32:4A:4B:BB:C8:63:69:9B:BE:74:9A:C6:DD:1D:46:24 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=Starfield Technologies, Inc., OU=Starfield Class 2 Certification Authority + Validity + Not Before: Jun 29 17:39:16 2004 GMT + Not After : Jun 29 17:39:16 2034 GMT + Subject: C=US, O=Starfield Technologies, Inc., OU=Starfield Class 2 Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b7:32:c8:fe:e9:71:a6:04:85:ad:0c:11:64:df: + ce:4d:ef:c8:03:18:87:3f:a1:ab:fb:3c:a6:9f:f0: + c3:a1:da:d4:d8:6e:2b:53:90:fb:24:a4:3e:84:f0: + 9e:e8:5f:ec:e5:27:44:f5:28:a6:3f:7b:de:e0:2a: + f0:c8:af:53:2f:9e:ca:05:01:93:1e:8f:66:1c:39: + a7:4d:fa:5a:b6:73:04:25:66:eb:77:7f:e7:59:c6: + 4a:99:25:14:54:eb:26:c7:f3:7f:19:d5:30:70:8f: + af:b0:46:2a:ff:ad:eb:29:ed:d7:9f:aa:04:87:a3: + d4:f9:89:a5:34:5f:db:43:91:82:36:d9:66:3c:b1: + b8:b9:82:fd:9c:3a:3e:10:c8:3b:ef:06:65:66:7a: + 9b:19:18:3d:ff:71:51:3c:30:2e:5f:be:3d:77:73: + b2:5d:06:6c:c3:23:56:9a:2b:85:26:92:1c:a7:02: + b3:e4:3f:0d:af:08:79:82:b8:36:3d:ea:9c:d3:35: + b3:bc:69:ca:f5:cc:9d:e8:fd:64:8d:17:80:33:6e: + 5e:4a:5d:99:c9:1e:87:b4:9d:1a:c0:d5:6e:13:35: + 23:5e:df:9b:5f:3d:ef:d6:f7:76:c2:ea:3e:bb:78: + 0d:1c:42:67:6b:04:d8:f8:d6:da:6f:8b:f2:44:a0: + 01:ab + Exponent: 3 (0x3) + X509v3 extensions: + X509v3 Subject Key Identifier: + BF:5F:B7:D1:CE:DD:1F:86:F4:5B:55:AC:DC:D7:10:C2:0E:A9:88:E7 + X509v3 Authority Key Identifier: + keyid:BF:5F:B7:D1:CE:DD:1F:86:F4:5B:55:AC:DC:D7:10:C2:0E:A9:88:E7 + DirName:/C=US/O=Starfield Technologies, Inc./OU=Starfield Class 2 Certification Authority + serial:00 + + X509v3 Basic Constraints: + CA:TRUE + Signature Algorithm: sha1WithRSAEncryption + 05:9d:3f:88:9d:d1:c9:1a:55:a1:ac:69:f3:f3:59:da:9b:01: + 87:1a:4f:57:a9:a1:79:09:2a:db:f7:2f:b2:1e:cc:c7:5e:6a: + d8:83:87:a1:97:ef:49:35:3e:77:06:41:58:62:bf:8e:58:b8: + 0a:67:3f:ec:b3:dd:21:66:1f:c9:54:fa:72:cc:3d:4c:40:d8: + 81:af:77:9e:83:7a:bb:a2:c7:f5:34:17:8e:d9:11:40:f4:fc: + 2c:2a:4d:15:7f:a7:62:5d:2e:25:d3:00:0b:20:1a:1d:68:f9: + 17:b8:f4:bd:8b:ed:28:59:dd:4d:16:8b:17:83:c8:b2:65:c7: + 2d:7a:a5:aa:bc:53:86:6d:dd:57:a4:ca:f8:20:41:0b:68:f0: + f4:fb:74:be:56:5d:7a:79:f5:f9:1d:85:e3:2d:95:be:f5:71: + 90:43:cc:8d:1f:9a:00:0a:87:29:e9:55:22:58:00:23:ea:e3: + 12:43:29:5b:47:08:dd:8c:41:6a:65:06:a8:e5:21:aa:41:b4: + 95:21:95:b9:7d:d1:34:ab:13:d6:ad:bc:dc:e2:3d:39:cd:bd: + 3e:75:70:a1:18:59:03:c9:22:b4:8f:9c:d5:5e:2a:d7:a5:b6: + d4:0a:6d:f8:b7:40:11:46:9a:1f:79:0e:62:bf:0f:97:ec:e0: + 2f:1f:17:94 +-----BEGIN CERTIFICATE----- +MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzEl +MCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMp +U3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQw +NjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBoMQswCQYDVQQGEwJVUzElMCMGA1UE +ChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZp +ZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqGSIb3 +DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf +8MOh2tTYbitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN ++lq2cwQlZut3f+dZxkqZJRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0 +X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVmepsZGD3/cVE8MC5fvj13c7JdBmzDI1aa +K4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSNF4Azbl5KXZnJHoe0nRrA +1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HFMIHCMB0G +A1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fR +zt0fhvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0 +YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBD +bGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8w +DQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGsafPzWdqbAYcaT1epoXkJKtv3 +L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLMPUxA2IGvd56D +eruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl +xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynp +VSJYACPq4xJDKVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEY +WQPJIrSPnNVeKtelttQKbfi3QBFGmh95DmK/D5fs4C8fF5Q= +-----END CERTIFICATE----- + +StartCom Ltd. +============= + +MD5 Fingerprint=08:7C:58:1F:52:2B:44:B4:3B:79:CD:01:F8:C5:C3:C9 +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=IL, ST=Israel, L=Eilat, O=StartCom Ltd., OU=CA Authority Dep., CN=Free SSL Certification Authority/emailAddress=admin@startcom.org + Validity + Not Before: Mar 17 17:37:48 2005 GMT + Not After : Mar 10 17:37:48 2035 GMT + Subject: C=IL, ST=Israel, L=Eilat, O=StartCom Ltd., OU=CA Authority Dep., CN=Free SSL Certification Authority/emailAddress=admin@startcom.org + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:ed:84:60:00:23:9e:c8:4a:51:29:27:de:3a:a1: + 39:b5:69:ab:09:b2:2f:34:fd:61:dc:3d:d3:b0:cf: + b1:d7:c2:c4:c2:b1:e4:96:56:c4:be:aa:14:0e:e7: + cc:3a:50:c8:3a:62:9d:c3:a3:ac:59:7b:8e:ee:55: + 1a:1c:47:be:a3:97:39:b3:b5:ef:23:2c:08:e8:d8: + af:73:2f:b9:c9:83:e8:ed:00:0f:c8:75:a5:2f:34: + 4c:18:e8:76:88:23:49:8a:db:b6:ed:68:da:c3:b5: + 62:29:4c:a5:4b:b7:98:b4:09:14:10:a0:f8:fe:62: + 76:22:15:0b:a4:d6:08:2f:35 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: + Digital Signature, Non Repudiation, Key Encipherment, Certificate Sign, CRL Sign + X509v3 Subject Key Identifier: + 1C:89:C3:96:CC:BD:FE:32:D5:0D:8C:81:31:B6:98:9D:8D:28:64:8D + X509v3 Authority Key Identifier: + keyid:1C:89:C3:96:CC:BD:FE:32:D5:0D:8C:81:31:B6:98:9D:8D:28:64:8D + DirName:/C=IL/ST=Israel/L=Eilat/O=StartCom Ltd./OU=CA Authority Dep./CN=Free SSL Certification Authority/emailAddress=admin@startcom.org + serial:00 + + X509v3 Subject Alternative Name: + email:admin@startcom.org + X509v3 Issuer Alternative Name: + email:admin@startcom.org + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + Netscape Comment: + Free SSL Certification Authority + Netscape CA Revocation Url: + http://cert.startcom.org/ca-crl.crl + Netscape Base Url: + http://cert.startcom.org/ + Netscape CA Policy Url: + http://cert.startcom.org/index.php?app=111 + Signature Algorithm: md5WithRSAEncryption + 6c:71:25:e1:9e:34:91:21:ef:db:6c:bd:01:08:56:8f:88:d8: + 41:3a:53:f5:72:df:27:57:4b:76:84:f7:68:a4:fe:eb:3f:09: + 7e:28:b8:57:ea:1f:c1:aa:e2:ff:96:9f:49:99:e6:b2:95:73: + 96:c6:48:c7:5e:8d:07:72:56:f8:83:8f:9f:77:af:29:d3:45: + 0e:a4:ee:b0:36:74:2d:f0:cd:98:23:7b:37:4b:da:fe:51:98: + c4:1e:34:3c:88:fd:99:3b:50:a7:c1:8b:33:c7:c2:52:16:12: + 95:53:65:22:ef:ba:8b:ce:62:db:70:23:b1:80:df:1a:20:38: + e7:7e +-----BEGIN CERTIFICATE----- +MIIFFjCCBH+gAwIBAgIBADANBgkqhkiG9w0BAQQFADCBsDELMAkGA1UEBhMCSUwx +DzANBgNVBAgTBklzcmFlbDEOMAwGA1UEBxMFRWlsYXQxFjAUBgNVBAoTDVN0YXJ0 +Q29tIEx0ZC4xGjAYBgNVBAsTEUNBIEF1dGhvcml0eSBEZXAuMSkwJwYDVQQDEyBG +cmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJARYS +YWRtaW5Ac3RhcnRjb20ub3JnMB4XDTA1MDMxNzE3Mzc0OFoXDTM1MDMxMDE3Mzc0 +OFowgbAxCzAJBgNVBAYTAklMMQ8wDQYDVQQIEwZJc3JhZWwxDjAMBgNVBAcTBUVp +bGF0MRYwFAYDVQQKEw1TdGFydENvbSBMdGQuMRowGAYDVQQLExFDQSBBdXRob3Jp +dHkgRGVwLjEpMCcGA1UEAxMgRnJlZSBTU0wgQ2VydGlmaWNhdGlvbiBBdXRob3Jp +dHkxITAfBgkqhkiG9w0BCQEWEmFkbWluQHN0YXJ0Y29tLm9yZzCBnzANBgkqhkiG +9w0BAQEFAAOBjQAwgYkCgYEA7YRgACOeyEpRKSfeOqE5tWmrCbIvNP1h3D3TsM+x +18LEwrHkllbEvqoUDufMOlDIOmKdw6OsWXuO7lUaHEe+o5c5s7XvIywI6Nivcy+5 +yYPo7QAPyHWlLzRMGOh2iCNJitu27Wjaw7ViKUylS7eYtAkUEKD4/mJ2IhULpNYI +LzUCAwEAAaOCAjwwggI4MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgHmMB0G +A1UdDgQWBBQcicOWzL3+MtUNjIExtpidjShkjTCB3QYDVR0jBIHVMIHSgBQcicOW +zL3+MtUNjIExtpidjShkjaGBtqSBszCBsDELMAkGA1UEBhMCSUwxDzANBgNVBAgT +BklzcmFlbDEOMAwGA1UEBxMFRWlsYXQxFjAUBgNVBAoTDVN0YXJ0Q29tIEx0ZC4x +GjAYBgNVBAsTEUNBIEF1dGhvcml0eSBEZXAuMSkwJwYDVQQDEyBGcmVlIFNTTCBD +ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJARYSYWRtaW5Ac3Rh +cnRjb20ub3JnggEAMB0GA1UdEQQWMBSBEmFkbWluQHN0YXJ0Y29tLm9yZzAdBgNV +HRIEFjAUgRJhZG1pbkBzdGFydGNvbS5vcmcwEQYJYIZIAYb4QgEBBAQDAgAHMC8G +CWCGSAGG+EIBDQQiFiBGcmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAy +BglghkgBhvhCAQQEJRYjaHR0cDovL2NlcnQuc3RhcnRjb20ub3JnL2NhLWNybC5j +cmwwKAYJYIZIAYb4QgECBBsWGWh0dHA6Ly9jZXJ0LnN0YXJ0Y29tLm9yZy8wOQYJ +YIZIAYb4QgEIBCwWKmh0dHA6Ly9jZXJ0LnN0YXJ0Y29tLm9yZy9pbmRleC5waHA/ +YXBwPTExMTANBgkqhkiG9w0BAQQFAAOBgQBscSXhnjSRIe/bbL0BCFaPiNhBOlP1 +ct8nV0t2hPdopP7rPwl+KLhX6h/BquL/lp9JmeaylXOWxkjHXo0Hclb4g4+fd68p +00UOpO6wNnQt8M2YI3s3S9r+UZjEHjQ8iP2ZO1CnwYszx8JSFhKVU2Ui77qLzmLb +cCOxgN8aIDjnfg== +-----END CERTIFICATE----- diff --git a/extra/openssl/libcrypto/libcrypto.factor b/extra/openssl/libcrypto/libcrypto.factor index 312c7b04b3..80bf3b1772 100755 --- a/extra/openssl/libcrypto/libcrypto.factor +++ b/extra/openssl/libcrypto/libcrypto.factor @@ -10,11 +10,12 @@ USING: alien alien.syntax combinators kernel system ; IN: openssl.libcrypto << -"libcrypto" { - { [ os winnt? ] [ "libeay32.dll" "cdecl" ] } - { [ os macosx? ] [ "libcrypto.dylib" "cdecl" ] } - { [ os unix? ] [ "libcrypto.so" "cdecl" ] } -} cond add-library +{ + { [ os openbsd? ] [ ] } ! VM is linked with it + { [ os winnt? ] [ "libcrypto" "libeay32.dll" "cdecl" add-library ] } + { [ os macosx? ] [ "libcrypto" "libcrypto.dylib" "cdecl" add-library ] } + { [ os unix? ] [ "libcrypto" "libcrypto.so" "cdecl" add-library ] } +} cond >> C-STRUCT: bio-method @@ -88,6 +89,8 @@ FUNCTION: int BIO_puts ( void* bp, char* buf ) ; FUNCTION: ulong ERR_get_error ( ) ; +FUNCTION: void ERR_clear_error ( ) ; + FUNCTION: char* ERR_error_string ( ulong e, void* buf ) ; FUNCTION: void* BIO_f_buffer ( ) ; @@ -96,6 +99,17 @@ FUNCTION: void* BIO_f_buffer ( ) ; ! evp.h ! =============================================== +: EVP_MAX_MD_SIZE 64 ; + +C-STRUCT: EVP_MD_CTX + { "EVP_MD*" "digest" } + { "ENGINE*" "engine" } + { "ulong" "flags" } + { "void*" "md_data" } ; + +TYPEDEF: void* EVP_MD* +TYPEDEF: void* ENGINE* + ! Initialize ciphers and digest tables FUNCTION: void OpenSSL_add_all_ciphers ( ) ; @@ -104,19 +118,35 @@ FUNCTION: void OpenSSL_add_all_digests ( ) ; ! Clean them up before exiting FUNCTION: void EVP_cleanup ( ) ; -FUNCTION: void* EVP_get_digestbyname ( char* name ) ; +FUNCTION: EVP_MD* EVP_get_digestbyname ( char* name ) ; -FUNCTION: void EVP_MD_CTX_init ( void* ctx ) ; +FUNCTION: void EVP_MD_CTX_init ( EVP_MD* ctx ) ; + +FUNCTION: int EVP_MD_CTX_cleanup ( EVP_MD_CTX* ctx ) ; + +FUNCTION: EVP_MD_CTX* EVP_MD_CTX_create ( ) ; + +FUNCTION: void EVP_MD_CTX_destroy ( EVP_MD_CTX* ctx ) ; + +FUNCTION: int EVP_MD_CTX_copy_ex ( EVP_MD_CTX* out, EVP_MD_CTX* in ) ; + +FUNCTION: int EVP_DigestInit_ex ( EVP_MD_CTX* ctx, EVP_MD* type, ENGINE* impl ) ; + +FUNCTION: int EVP_DigestUpdate ( EVP_MD_CTX* ctx, void* d, uint cnt ) ; + +FUNCTION: int EVP_DigestFinal_ex ( EVP_MD_CTX* ctx, void* md, uint* s ) ; + +FUNCTION: int EVP_Digest ( void* data, uint count, void* md, uint* size, EVP_MD* type, ENGINE* impl ) ; + +FUNCTION: int EVP_MD_CTX_copy ( EVP_MD_CTX* out, EVP_MD_CTX* in ) ; + +FUNCTION: int EVP_DigestInit ( EVP_MD_CTX* ctx, EVP_MD* type ) ; + +FUNCTION: int EVP_DigestFinal ( EVP_MD_CTX* ctx, void* md, uint* s ) ; FUNCTION: void* PEM_read_bio_DHparams ( void* bp, void* x, void* cb, void* u ) ; -! =============================================== -! md5.h -! =============================================== - -FUNCTION: uchar* MD5 ( uchar* d, ulong n, uchar* md ) ; - ! =============================================== ! rsa.h ! =============================================== diff --git a/extra/openssl/libssl/libssl.factor b/extra/openssl/libssl/libssl.factor index 0f2e7b3184..3218d67b5c 100755 --- a/extra/openssl/libssl/libssl.factor +++ b/extra/openssl/libssl/libssl.factor @@ -5,15 +5,17 @@ ! ! export LD_LIBRARY_PATH=/opt/local/lib -USING: alien alien.syntax combinators kernel system ; +USING: alien alien.syntax combinators kernel system namespaces +assocs parser sequences words quotations ; IN: openssl.libssl -<< "libssl" { - { [ os winnt? ] [ "ssleay32.dll" "cdecl" ] } - { [ os macosx? ] [ "libssl.dylib" "cdecl" ] } - { [ os unix? ] [ "libssl.so" "cdecl" ] } -} cond add-library >> +<< { + { [ os openbsd? ] [ ] } ! VM is linked with it + { [ os winnt? ] [ "libssl" "ssleay32.dll" "cdecl" add-library ] } + { [ os macosx? ] [ "libssl" "libssl.dylib" "cdecl" add-library ] } + { [ os unix? ] [ "libssl" "libssl.so" "cdecl" add-library ] } +} cond >> : X509_FILETYPE_PEM 1 ; inline : X509_FILETYPE_ASN1 2 ; inline @@ -97,6 +99,7 @@ FUNCTION: ssl-ctx SSL_CTX_new ( ssl-method method ) ; ! Load the certificates and private keys into the SSL_CTX FUNCTION: int SSL_CTX_use_certificate_chain_file ( ssl-ctx ctx, char* file ) ; ! PEM type + FUNCTION: ssl-pointer SSL_new ( ssl-ctx ctx ) ; FUNCTION: int SSL_set_fd ( ssl-pointer ssl, int fd ) ; @@ -117,10 +120,26 @@ FUNCTION: int SSL_write ( ssl-pointer ssl, void* buf, int num ) ; FUNCTION: int SSL_read ( ssl-pointer ssl, void* buf, int num ) ; -FUNCTION: void SSL_shutdown ( ssl-pointer ssl ) ; +FUNCTION: int SSL_shutdown ( ssl-pointer ssl ) ; + +: SSL_SENT_SHUTDOWN 1 ; +: SSL_RECEIVED_SHUTDOWN 2 ; + +FUNCTION: int SSL_get_shutdown ( ssl-pointer ssl ) ; FUNCTION: void SSL_free ( ssl-pointer ssl ) ; +FUNCTION: int SSL_want ( ssl-pointer ssl ) ; + +: SSL_NOTHING 1 ; inline +: SSL_WRITING 2 ; inline +: SSL_READING 3 ; inline +: SSL_X509_LOOKUP 4 ; inline + +FUNCTION: long SSL_get_verify_result ( SSL* ssl ) ; + +FUNCTION: X509* SSL_get_peer_certificate ( SSL* s ) ; + FUNCTION: void SSL_CTX_free ( ssl-ctx ctx ) ; FUNCTION: void RAND_seed ( void* buf, int num ) ; @@ -137,6 +156,15 @@ FUNCTION: int SSL_use_certificate_file ( ssl-pointer ssl, FUNCTION: int SSL_CTX_load_verify_locations ( ssl-ctx ctx, char* CAfile, char* CApath ) ; +FUNCTION: int SSL_CTX_set_default_verify_paths ( ssl-ctx ctx ) ; + +: SSL_VERIFY_NONE 0 ; inline +: SSL_VERIFY_PEER 1 ; inline +: SSL_VERIFY_FAIL_IF_NO_PEER_CERT 2 ; inline +: SSL_VERIFY_CLIENT_ONCE 4 ; inline + +FUNCTION: void SSL_CTX_set_verify ( ssl-ctx ctx, int mode, void* callback ) ; + FUNCTION: void SSL_CTX_set_client_CA_list ( ssl-ctx ctx, ssl-pointer list ) ; FUNCTION: ssl-pointer SSL_load_client_CA_file ( char* file ) ; @@ -164,11 +192,87 @@ FUNCTION: void SSL_CTX_set_tmp_rsa_callback ( ssl-ctx ctx, void* rsa ) ; FUNCTION: void* BIO_f_ssl ( ) ; +: SSL_CTX_set_tmp_rsa ( ctx rsa -- n ) + >r SSL_CTRL_SET_TMP_RSA 0 r> SSL_CTX_ctrl ; + +: SSL_CTX_set_tmp_dh ( ctx dh -- n ) + >r SSL_CTRL_SET_TMP_DH 0 r> SSL_CTX_ctrl ; + ! =============================================== -! sha.h +! x509.h ! =============================================== -! For a high level interface to message digests -! use the EVP digest routines in libcrypto.factor +TYPEDEF: void* X509_NAME* -FUNCTION: uchar* SHA1 ( uchar* d, ulong n, uchar* md ) ; +TYPEDEF: void* X509* + +FUNCTION: int X509_NAME_get_text_by_NID ( X509_NAME* name, int nid, void* buf, int len ) ; +FUNCTION: X509_NAME* X509_get_subject_name ( X509* a ) ; + +! =============================================== +! x509_vfy.h +! =============================================== + +<< + +SYMBOL: verify-messages + +H{ } clone verify-messages set-global + +: verify-message ( n -- word ) verify-messages get-global at ; + +: X509_V_: + scan "X509_V_" prepend create-in + scan-word + [ 1quotation define-inline ] + [ verify-messages get set-at ] 2bi ; parsing + +>> + +X509_V_: OK 0 +X509_V_: ERR_UNABLE_TO_GET_ISSUER_CERT 2 +X509_V_: ERR_UNABLE_TO_GET_CRL 3 +X509_V_: ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE 4 +X509_V_: ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE 5 +X509_V_: ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6 +X509_V_: ERR_CERT_SIGNATURE_FAILURE 7 +X509_V_: ERR_CRL_SIGNATURE_FAILURE 8 +X509_V_: ERR_CERT_NOT_YET_VALID 9 +X509_V_: ERR_CERT_HAS_EXPIRED 10 +X509_V_: ERR_CRL_NOT_YET_VALID 11 +X509_V_: ERR_CRL_HAS_EXPIRED 12 +X509_V_: ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD 13 +X509_V_: ERR_ERROR_IN_CERT_NOT_AFTER_FIELD 14 +X509_V_: ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD 15 +X509_V_: ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD 16 +X509_V_: ERR_OUT_OF_MEM 17 +X509_V_: ERR_DEPTH_ZERO_SELF_SIGNED_CERT 18 +X509_V_: ERR_SELF_SIGNED_CERT_IN_CHAIN 19 +X509_V_: ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY 20 +X509_V_: ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE 21 +X509_V_: ERR_CERT_CHAIN_TOO_LONG 22 +X509_V_: ERR_CERT_REVOKED 23 +X509_V_: ERR_INVALID_CA 24 +X509_V_: ERR_PATH_LENGTH_EXCEEDED 25 +X509_V_: ERR_INVALID_PURPOSE 26 +X509_V_: ERR_CERT_UNTRUSTED 27 +X509_V_: ERR_CERT_REJECTED 28 +X509_V_: ERR_SUBJECT_ISSUER_MISMATCH 29 +X509_V_: ERR_AKID_SKID_MISMATCH 30 +X509_V_: ERR_AKID_ISSUER_SERIAL_MISMATCH 31 +X509_V_: ERR_KEYUSAGE_NO_CERTSIGN 32 +X509_V_: ERR_UNABLE_TO_GET_CRL_ISSUER 33 +X509_V_: ERR_UNHANDLED_CRITICAL_EXTENSION 34 +X509_V_: ERR_KEYUSAGE_NO_CRL_SIGN 35 +X509_V_: ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36 +X509_V_: ERR_INVALID_NON_CA 37 +X509_V_: ERR_PROXY_PATH_LENGTH_EXCEEDED 38 +X509_V_: ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39 +X509_V_: ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40 +X509_V_: ERR_APPLICATION_VERIFICATION 50 + +! =============================================== +! obj_mac.h +! =============================================== + +: NID_commonName 13 ; inline diff --git a/extra/openssl/openssl-docs.factor b/extra/openssl/openssl-docs.factor deleted file mode 100644 index dd31bfd001..0000000000 --- a/extra/openssl/openssl-docs.factor +++ /dev/null @@ -1,10 +0,0 @@ - -USING: help.syntax help.markup ; - -IN: openssl - -ARTICLE: "openssl" "OpenSSL" - -"Factor on Windows has been tested with this version of OpenSSL: " - -{ $url "http://www.openssl.org/related/binaries.html" } ; \ No newline at end of file diff --git a/extra/openssl/openssl-tests.factor b/extra/openssl/openssl-tests.factor index 5825ca7270..5990153073 100755 --- a/extra/openssl/openssl-tests.factor +++ b/extra/openssl/openssl-tests.factor @@ -1,146 +1,21 @@ -USING: alien alien.c-types alien.strings assocs bit-arrays -hashtables io io.files io.encodings.ascii io.sockets kernel -mirrors openssl.libcrypto openssl.libssl namespaces math -math.parser openssl prettyprint sequences tools.test ; +USING: io.sockets.secure io.encodings.ascii alien.strings +openssl namespaces accessors tools.test continuations kernel ; -! ========================================================= -! Some crypto functions (still to be turned into words) -! ========================================================= +openssl secure-socket-backend [ + [ ] [ + + "resource:extra/openssl/test/server.pem" >>key-file + "resource:extra/openssl/test/root.pem" >>ca-file + "resource:extra/openssl/test/dh1024.pem" >>dh-file + "password" >>password + [ ] with-secure-context + ] unit-test -[ - B{ 201 238 222 100 92 200 182 188 138 255 129 163 115 88 240 136 } -] -[ "Hello world from the openssl binding" >md5 ] unit-test - -! Not found on netbsd, windows -- why? -! [ - ! B{ 63 113 237 255 181 5 152 241 136 181 43 95 160 105 44 87 49 - ! 82 115 0 } -! ] -! [ "Hello world from the openssl binding" >sha1 ] unit-test - -! ========================================================= -! Initialize context -! ========================================================= - -[ ] [ init load-error-strings ] unit-test - -[ ] [ ssl-v23 new-ctx ] unit-test - -[ ] [ get-ctx "extra/openssl/test/server.pem" resource-path use-cert-chain ] unit-test - -! TODO: debug 'Memory protection fault at address 6c' -! get-ctx 1024 "char" malloc-array 1024 0 f password-cb set-default-passwd - -[ ] [ get-ctx "password" ascii string>alien set-default-passwd-userdata ] unit-test - -! Enter PEM pass phrase: password -[ ] [ get-ctx "extra/openssl/test/server.pem" resource-path -SSL_FILETYPE_PEM use-private-key ] unit-test - -[ ] [ get-ctx "extra/openssl/test/root.pem" resource-path f -verify-load-locations ] unit-test - -[ ] [ get-ctx 1 set-verify-depth ] unit-test - -! ========================================================= -! Load Diffie-Hellman parameters -! ========================================================= - -[ ] [ "extra/openssl/test/dh1024.pem" resource-path "r" bio-new-file ] unit-test - -[ ] [ get-bio f f f read-pem-dh-params ] unit-test - -[ ] [ get-bio bio-free ] unit-test - -! TODO: debug SSL_CTX_set_tmp_dh 'No such symbol' -[ ] [ get-ctx get-dh set-tmp-dh-callback ] unit-test - -! Workaround (this function should never be called directly) -! [ ] [ get-ctx SSL_CTRL_SET_TMP_DH 0 get-dh set-ctx-ctrl ] unit-test - -! ========================================================= -! Generate ephemeral RSA key -! ========================================================= - -[ ] [ 512 RSA_F4 f f generate-rsa-key ] unit-test - -! TODO: debug SSL_CTX_set_tmp_rsa 'No such symbol' -! get-ctx get-rsa set-tmp-rsa-callback - -! Workaround (this function should never be called directly) -[ ] [ get-ctx SSL_CTRL_SET_TMP_RSA 0 get-rsa set-ctx-ctrl ] unit-test - -[ ] [ get-rsa free-rsa ] unit-test - -! ========================================================= -! Listen and accept on socket -! ========================================================= - -! SYMBOL: sock -! SYMBOL: fdset -! SYMBOL: acset -! SYMBOL: sbio -! SYMBOL: ssl -! -! : is-set ( seq -- newseq ) -! >alist [ nip ] assoc-subset >hashtable keys ; -! -! ! 1234 server-socket sock set -! "127.0.0.1" 1234 SOCK_STREAM server-fd sock set -! -! FD_SETSIZE 8 * fdset set -! -! FD_SETSIZE 8 * t 8 rot [ set-nth ] keep fdset set -! -! fdset get is-set . - -! : loop ( -- ) -! sock get f f accept -! dup -1 = [ drop ] [ -! dup number>string print flush -! ! BIO_NOCLOSE bio-new-socket sbio set -! [ get-ctx new-ssl ssl set ] keep -! ssl get swap set-ssl-fd -! ! ssl get sbio get dup set-ssl-bio -! ! ssl get ssl-accept -! ! dup 0 <= [ -! ! ssl get swap ssl-get-error -! ! ] [ drop ] if -! ] if -! loop ; - -! { } acset set -! -! : loop ( -- ) -! ! FD_SETSIZE fdset get f f f select . flush -! FD_SETSIZE fdset get f f 10000 make-timeval select -! 0 <= [ acset get [ close ] each "timeout" print ] [ -! fdset get is-set sock get swap member? [ -! sock get f f accept dup . flush -! acset get swap add acset set -! ] [ ] if -! loop -! ] if ; -! -! loop -! -! sock get close - -! ========================================================= -! Dump errors to file -! ========================================================= - -[ ] [ "extra/openssl/test/errors.txt" resource-path "w" bio-new-file ] unit-test - -[ 6 ] [ get-bio "Hello\n" bio-print ] unit-test - -[ ] [ get-bio bio-free ] unit-test - -! ========================================================= -! Clean-up -! ========================================================= - -! sock get close - -get-ctx destroy-ctx + [ + + "resource:extra/openssl/test/server.pem" >>key-file + "resource:extra/openssl/test/root.pem" >>ca-file + "wrong password" >>password + [ ] with-secure-context + ] must-fail +] with-variable diff --git a/extra/openssl/openssl.factor b/extra/openssl/openssl.factor index 9b23774598..b2dbda7d2e 100755 --- a/extra/openssl/openssl.factor +++ b/extra/openssl/openssl.factor @@ -1,154 +1,207 @@ -! Copyright (C) 2007 Elie CHAFTARI +! Copyright (C) 2007, 2008, Slava Pestov, Elie CHAFTARI. ! See http://factorcode.org/license.txt for BSD license. -! -! Tested with OpenSSL 0.9.8a_0 on Mac OS X 10.4.9 PowerPC - -USING: alien alien.c-types alien.strings assocs kernel libc -namespaces openssl.libcrypto openssl.libssl sequences -io.encodings.ascii ; - +USING: accessors byte-arrays kernel debugger sequences namespaces math +math.order combinators init alien alien.c-types alien.strings libc +continuations destructors debugger inspector splitting +locals unicode.case +openssl.libcrypto openssl.libssl +io.backend io.ports io.files io.encodings.8-bit io.sockets.secure +io.timeouts ; IN: openssl -SYMBOL: bio -SYMBOL: ssl-bio +! This code is based on http://www.rtfm.com/openssl-examples/ -SYMBOL: ctx -SYMBOL: dh -SYMBOL: rsa +SINGLETON: openssl -! ========================================================= -! Callback routines -! ========================================================= +GENERIC: ssl-method ( symbol -- method ) -: password-cb ( -- alien ) - "int" { "char*" "int" "int" "void*" } "cdecl" - [ 3drop "password" ascii string>alien 1023 memcpy - "password" length ] alien-callback ; +M: SSLv2 ssl-method drop SSLv2_client_method ; +M: SSLv23 ssl-method drop SSLv23_method ; +M: SSLv3 ssl-method drop SSLv3_method ; +M: TLSv1 ssl-method drop TLSv1_method ; -! ========================================================= -! Error-handling routines -! ========================================================= +: (ssl-error-string) ( n -- string ) + ERR_clear_error f ERR_error_string ; -: get-error ( -- num ) - ERR_get_error ; +: ssl-error-string ( -- string ) + ERR_get_error ERR_clear_error f ERR_error_string ; -: error-string ( num -- str ) - f ERR_error_string ; +: (ssl-error) ( -- * ) + ssl-error-string throw ; -: check-result ( result -- ) - 1 = [ ] [ - get-error error-string throw - ] if ; +: ssl-error ( obj -- ) + { f 0 } member? [ (ssl-error) ] when ; -: ssl-get-error ( ssl ret -- ) - SSL_get_error error-messages at throw ; +: init-ssl ( -- ) + SSL_library_init ssl-error + SSL_load_error_strings + OpenSSL_add_all_digests + OpenSSL_add_all_ciphers ; -! Write errors to a file -: bio-new-file ( path mode -- ) - BIO_new_file bio set ; +SYMBOL: ssl-initialized? -: bio-print ( bio str -- n ) - BIO_printf ; +: maybe-init-ssl ( -- ) + ssl-initialized? get-global [ + init-ssl + t ssl-initialized? set-global + ] unless ; -: bio-free ( bio -- ) - BIO_free check-result ; +[ f ssl-initialized? set-global ] "openssl" add-init-hook -! ========================================================= -! Initialization routines -! ========================================================= +TUPLE: openssl-context < secure-context aliens ; -: init ( -- ) - SSL_library_init drop ; ! always returns 1 +: load-certificate-chain ( ctx -- ) + dup config>> key-file>> [ + [ handle>> ] [ config>> key-file>> (normalize-path) ] bi + SSL_CTX_use_certificate_chain_file + ssl-error + ] [ drop ] if ; -: load-error-strings ( -- ) - SSL_load_error_strings ; +: password-callback ( -- alien ) + "int" { "void*" "int" "bool" "void*" } "cdecl" + [| buf size rwflag password! | + password [ B{ 0 } password! ] unless -: ssl-v23 ( -- method ) - SSLv23_method ; + [let | len [ password strlen ] | + buf password len 1+ size min memcpy + len + ] + ] alien-callback ; -: new-ctx ( method -- ) - SSL_CTX_new ctx set ; +: default-pasword ( ctx -- alien ) + [ config>> password>> latin1 malloc-string ] [ aliens>> ] bi + [ push ] [ drop ] 2bi ; -: use-cert-chain ( ctx file -- ) - SSL_CTX_use_certificate_chain_file check-result ; +: set-default-password ( ctx -- ) + [ handle>> password-callback SSL_CTX_set_default_passwd_cb ] + [ + [ handle>> ] [ default-pasword ] bi + SSL_CTX_set_default_passwd_cb_userdata + ] bi ; -: set-default-passwd ( ctx cb -- ) - SSL_CTX_set_default_passwd_cb ; +: use-private-key-file ( ctx -- ) + dup config>> key-file>> [ + [ handle>> ] [ config>> key-file>> (normalize-path) ] bi + SSL_FILETYPE_PEM SSL_CTX_use_PrivateKey_file + ssl-error + ] [ drop ] if ; -: set-default-passwd-userdata ( ctx passwd -- ) - SSL_CTX_set_default_passwd_cb_userdata ; +: load-verify-locations ( ctx -- ) + dup config>> [ ca-file>> ] [ ca-path>> ] bi or [ + [ handle>> ] + [ + config>> + [ ca-file>> dup [ (normalize-path) ] when ] + [ ca-path>> dup [ (normalize-path) ] when ] bi + ] bi + SSL_CTX_load_verify_locations + ] [ handle>> SSL_CTX_set_default_verify_paths ] if ssl-error ; -: use-private-key ( ctx file type -- ) - SSL_CTX_use_PrivateKey_file check-result ; +: set-verify-depth ( ctx -- ) + dup config>> verify-depth>> [ + [ handle>> ] [ config>> verify-depth>> ] bi + SSL_CTX_set_verify_depth + ] [ drop ] if ; -: verify-load-locations ( ctx file path -- ) - SSL_CTX_load_verify_locations check-result ; +TUPLE: bio handle disposed ; -: set-verify-depth ( ctx depth -- ) - SSL_CTX_set_verify_depth ; +: ( handle -- bio ) f bio boa ; -: read-pem-dh-params ( bio x cb u -- ) - PEM_read_bio_DHparams dh set ; +M: bio dispose* handle>> BIO_free ssl-error ; -: set-tmp-dh-callback ( ctx dh -- ) - SSL_CTX_set_tmp_dh_callback ; +: ( path -- bio ) + normalize-path "r" BIO_new_file dup ssl-error ; -: set-ctx-ctrl ( ctx cmd larg parg -- ) - SSL_CTX_ctrl check-result ; +: load-dh-params ( ctx -- ) + dup config>> dh-file>> [ + [ handle>> ] [ config>> dh-file>> ] bi &dispose + handle>> f f f PEM_read_bio_DHparams dup ssl-error + SSL_CTX_set_tmp_dh ssl-error + ] [ drop ] if ; -: generate-rsa-key ( n e cb cbarg -- ) - RSA_generate_key rsa set ; +TUPLE: rsa handle disposed ; -: set-tmp-rsa-callback ( ctx rsa -- ) - SSL_CTX_set_tmp_rsa_callback ; +: ( handle -- rsa ) f rsa boa ; -: free-rsa ( rsa -- ) - RSA_free ; +M: rsa dispose* handle>> RSA_free ; -: bio-new-socket ( fd flag -- sbio ) - BIO_new_socket ; +: generate-eph-rsa-key ( ctx -- ) + [ handle>> ] + [ + config>> ephemeral-key-bits>> RSA_F4 f f RSA_generate_key + dup ssl-error &dispose handle>> + ] bi + SSL_CTX_set_tmp_rsa ssl-error ; -: new-ssl ( ctx -- ssl ) - SSL_new ; +M: openssl ( config -- context ) + maybe-init-ssl + [ + dup method>> ssl-method SSL_CTX_new + dup ssl-error f V{ } clone openssl-context boa |dispose + { + [ load-certificate-chain ] + [ set-default-password ] + [ use-private-key-file ] + [ load-verify-locations ] + [ set-verify-depth ] + [ load-dh-params ] + [ generate-eph-rsa-key ] + [ ] + } cleave + ] with-destructors ; -: set-ssl-bio ( ssl bio bio -- ) - SSL_set_bio ; +M: openssl-context dispose* + [ aliens>> [ free ] each ] + [ handle>> SSL_CTX_free ] + bi ; -: set-ssl-fd ( ssl fd -- ) - SSL_set_fd check-result ; +TUPLE: ssl-handle file handle connected disposed ; -: ssl-accept ( ssl -- result ) - SSL_accept ; +SYMBOL: default-secure-context -! ========================================================= -! Clean-up and termination routines -! ========================================================= +: context-expired? ( context -- ? ) + dup [ handle>> expired? ] [ drop t ] if ; -: destroy-ctx ( ctx -- ) - SSL_CTX_free ; +: current-secure-context ( -- ctx ) + secure-context get [ + default-secure-context get dup context-expired? [ + drop + default-secure-context set-global + current-secure-context + ] when + ] unless* ; -! ========================================================= -! Public routines -! ========================================================= +: ( fd -- ssl ) + current-secure-context handle>> SSL_new dup ssl-error + f f ssl-handle boa ; -: get-bio ( -- bio ) - bio get ; +M: ssl-handle dispose* + [ handle>> SSL_free ] [ file>> dispose ] bi ; -: get-ssl-bio ( -- bio ) - ssl-bio get ; +: check-verify-result ( ssl-handle -- ) + SSL_get_verify_result dup X509_V_OK = + [ drop ] [ verify-message certificate-verify-error ] if ; -: get-ctx ( -- ctx ) - ctx get ; +: common-name ( certificate -- host ) + X509_get_subject_name + NID_commonName 256 + [ 256 X509_NAME_get_text_by_NID ] keep + swap -1 = [ drop f ] [ latin1 alien>string ] if ; -: get-dh ( -- dh ) - dh get ; +: common-names-match? ( expected actual -- ? ) + [ >lower ] bi@ "*." ?head [ tail? ] [ = ] if ; -: get-rsa ( -- rsa ) - rsa get ; +: check-common-name ( host ssl-handle -- ) + SSL_get_peer_certificate common-name + 2dup common-names-match? + [ 2drop ] [ common-name-verify-error ] if ; -: >md5 ( str -- byte-array ) - dup length 16 "uchar" [ MD5 ] keep nip ; - -: >sha1 ( str -- byte-array ) - dup length 20 "uchar" [ SHA1 ] keep nip ; +M: openssl check-certificate ( host ssl -- ) + current-secure-context config>> verify>> [ + handle>> + [ nip check-verify-result ] + [ check-common-name ] + 2bi + ] [ 2drop ] if ; +openssl secure-socket-backend set-global diff --git a/extra/openssl/tags.txt b/extra/openssl/tags.txt index 93e252c19e..59ccdd65e6 100644 --- a/extra/openssl/tags.txt +++ b/extra/openssl/tags.txt @@ -1,3 +1,2 @@ -enterprise network bindings diff --git a/extra/optimizer/debugger/debugger.factor b/extra/optimizer/debugger/debugger.factor index 3ae0c94b12..ac7080d451 100755 --- a/extra/optimizer/debugger/debugger.factor +++ b/extra/optimizer/debugger/debugger.factor @@ -4,7 +4,7 @@ USING: classes inference inference.dataflow io kernel kernel.private math.parser namespaces optimizer prettyprint prettyprint.backend sequences words arrays match macros assocs sequences.private optimizer.specializers generic -combinators sorting math quotations ; +combinators sorting math quotations accessors ; IN: optimizer.debugger ! A simple tool for turning dataflow IR into quotations, for @@ -33,12 +33,12 @@ M: comment pprint* : effect-str ( node -- str ) [ - " " over node-in-d values% - " r: " over node-in-r values% + " " over in-d>> values% + " r: " over in-r>> values% " --" % - " " over node-out-d values% - " r: " swap node-out-r values% - ] "" make 1 tail ; + " " over out-d>> values% + " r: " swap out-r>> values% + ] "" make rest ; MACRO: match-choose ( alist -- ) [ [ ] curry ] assoc-map [ match-cond ] curry ; @@ -63,18 +63,19 @@ MATCH-VARS: ?a ?b ?c ; } match-choose ; M: #shuffle node>quot - dup node-in-d over node-out-d pretty-shuffle + dup [ in-d>> ] [ out-d>> ] bi pretty-shuffle [ , ] [ >r drop t r> ] if* dup effect-str "#shuffle: " prepend comment, ; -: pushed-literals node-out-d [ value-literal literalize ] map ; +: pushed-literals ( node -- seq ) + out-d>> [ value-literal literalize ] map ; M: #push node>quot nip pushed-literals % ; DEFER: dataflow>quot : #call>quot ( ? node -- ) - dup node-param dup , + dup param>> dup , [ dup effect-str ] [ "empty call" ] if comment, ; M: #call node>quot #call>quot ; @@ -83,38 +84,38 @@ M: #call-label node>quot #call>quot ; M: #label node>quot [ - dup node-param literalize , + dup param>> literalize , dup #label-loop? "#loop: " "#label: " ? - over node-param word-name append comment, + over param>> word-name append comment, ] 2keep node-child swap dataflow>quot , \ call , ; M: #if node>quot [ "#if" comment, ] 2keep - node-children swap [ dataflow>quot ] curry map % + children>> swap [ dataflow>quot ] curry map % \ if , ; M: #dispatch node>quot [ "#dispatch" comment, ] 2keep - node-children swap [ dataflow>quot ] curry map , + children>> swap [ dataflow>quot ] curry map , \ dispatch , ; -M: #>r node>quot nip node-in-d length \ >r % ; +M: #>r node>quot nip in-d>> length \ >r % ; -M: #r> node>quot nip node-out-d length \ r> % ; +M: #r> node>quot nip out-d>> length \ r> % ; M: object node>quot [ dup class word-name % " " % - dup node-param unparse % + dup param>> unparse % " " % dup effect-str % ] "" make comment, ; : (dataflow>quot) ( ? node -- ) dup [ - 2dup node>quot node-successor (dataflow>quot) + 2dup node>quot successor>> (dataflow>quot) ] [ 2drop ] if ; @@ -145,7 +146,7 @@ SYMBOL: node-count 0 swap [ >r 1+ r> dup #call? [ - node-param { + param>> { { [ dup "intrinsics" word-prop over "if-intrinsics" word-prop or ] [ intrinsics-called ] } { [ dup generic? ] [ generics-called ] } { [ dup method-body? ] [ methods-called ] } diff --git a/extra/optimizer/report/report.factor b/extra/optimizer/report/report.factor index feaace9808..865ece333c 100755 --- a/extra/optimizer/report/report.factor +++ b/extra/optimizer/report/report.factor @@ -1,26 +1,26 @@ -IN: optimizer.report USING: assocs words sequences arrays compiler tools.time io.styles io prettyprint vocabs kernel sorting generator -optimizer math ; +optimizer math math.order ; +IN: optimizer.report : count-optimization-passes ( nodes n -- n ) >r optimize-1 [ r> 1+ count-optimization-passes ] [ drop r> ] if ; -: results - [ [ second ] swap compose compare ] curry sort 20 tail* +: results ( seq -- ) + [ [ second ] prepose compare ] curry sort 20 tail* print standard-table-style [ [ [ [ pprint-cell ] each ] with-row ] each ] tabular-output ; -: optimizer-report - all-words [ compiled? ] subset +: optimizer-report ( -- ) + all-words [ compiled? ] filter [ dup [ word-dataflow nip 1 count-optimization-passes - ] benchmark nip 2array + ] benchmark 2array ] { } map>assoc [ first ] "Worst number of optimizer passes:" results [ second ] "Worst compile times:" results ; diff --git a/extra/oracle/liboci/liboci.factor b/extra/oracle/liboci/liboci.factor index 7af69a97bb..aa04aef39f 100644 --- a/extra/oracle/liboci/liboci.factor +++ b/extra/oracle/liboci/liboci.factor @@ -124,7 +124,6 @@ TYPEDEF: ushort ub2 TYPEDEF: short sb2 TYPEDEF: uint ub4 TYPEDEF: int sb4 -TYPEDEF: ulong size_t ! =============================================== ! Input data types (ocidfn.h) diff --git a/extra/ori/ori.factor b/extra/ori/ori.factor index 729dcba56a..7a32fdbf50 100644 --- a/extra/ori/ori.factor +++ b/extra/ori/ori.factor @@ -1,7 +1,7 @@ USING: kernel namespaces math math.constants math.functions math.matrices math.vectors - sequences splitting self math.trig ; + sequences splitting grouping self math.trig ; IN: ori diff --git a/extra/pack/pack-tests.factor b/extra/pack/pack-tests.factor index 510e44d34e..d58ccbd0f2 100755 --- a/extra/pack/pack-tests.factor +++ b/extra/pack/pack-tests.factor @@ -38,7 +38,7 @@ USING: io io.streams.string kernel namespaces pack strings tools.test ; [ 2 ] [ [ 2 "int" b, ] B{ } make - [ "int" read-native ] with-stream + [ "int" read-native ] with-input-stream ] unit-test [ "FRAM" ] [ "FRAM\0" [ read-c-string ] with-string-reader ] unit-test diff --git a/extra/pack/pack.factor b/extra/pack/pack.factor index 65912244dd..5320583df0 100755 --- a/extra/pack/pack.factor +++ b/extra/pack/pack.factor @@ -154,13 +154,12 @@ MACRO: (pack) ( seq str -- quot ) MACRO: (unpack) ( str -- quot ) [ - \ , [ [ unpack-table at , \ , , ] each ] [ ] make 1quotation [ { } make ] append 1quotation % - \ with-stream , + \ with-string-reader , ] [ ] make ; : unpack-native ( seq str -- seq ) diff --git a/extra/pango/cairo/cairo.factor b/extra/pango/cairo/cairo.factor new file mode 100644 index 0000000000..1ff5328ee0 --- /dev/null +++ b/extra/pango/cairo/cairo.factor @@ -0,0 +1,118 @@ +! Copyright (C) 2008 Matthew Willis. +! See http://factorcode.org/license.txt for BSD license. +! +! pangocairo bindings, from pango/pangocairo.h +USING: cairo.ffi alien.c-types math +alien.syntax system combinators alien +memoize +arrays pango pango.fonts ; +IN: pango.cairo + +<< "pangocairo" { + { [ os winnt? ] [ "libpangocairo-1.0-0.dll" ] } + { [ os macosx? ] [ "libpangocairo-1.0.0.dylib" ] } + { [ os unix? ] [ "libpangocairo-1.0.so" ] } +} cond "cdecl" add-library >> + +LIBRARY: pangocairo + +FUNCTION: PangoFontMap* +pango_cairo_font_map_new ( ) ; + +FUNCTION: PangoFontMap* +pango_cairo_font_map_new_for_font_type ( cairo_font_type_t fonttype ) ; + +FUNCTION: PangoFontMap* +pango_cairo_font_map_get_default ( ) ; + +FUNCTION: cairo_font_type_t +pango_cairo_font_map_get_font_type ( PangoCairoFontMap* fontmap ) ; + +FUNCTION: void +pango_cairo_font_map_set_resolution ( PangoCairoFontMap* fontmap, double dpi ) ; + +FUNCTION: double +pango_cairo_font_map_get_resolution ( PangoCairoFontMap* fontmap ) ; + +FUNCTION: PangoContext* +pango_cairo_font_map_create_context ( PangoCairoFontMap* fontmap ) ; + +FUNCTION: cairo_scaled_font_t* +pango_cairo_font_get_scaled_font ( PangoCairoFont* font ) ; + +! Update a Pango context for the current state of a cairo context +FUNCTION: void +pango_cairo_update_context ( cairo_t* cr, PangoContext* context ) ; + +FUNCTION: void +pango_cairo_context_set_font_options ( PangoContext* context, cairo_font_options_t* options ) ; + +FUNCTION: cairo_font_options_t* +pango_cairo_context_get_font_options ( PangoContext* context ) ; + +FUNCTION: void +pango_cairo_context_set_resolution ( PangoContext* context, double dpi ) ; + +FUNCTION: double +pango_cairo_context_get_resolution ( PangoContext* context ) ; + +! Convenience +FUNCTION: PangoLayout* +pango_cairo_create_layout ( cairo_t* cr ) ; + +FUNCTION: void +pango_cairo_update_layout ( cairo_t* cr, PangoLayout* layout ) ; + +! Rendering +FUNCTION: void +pango_cairo_show_glyph_string ( cairo_t* cr, PangoFont* font, PangoGlyphString* glyphs ) ; + +FUNCTION: void +pango_cairo_show_layout_line ( cairo_t* cr, PangoLayoutLine* line ) ; + +FUNCTION: void +pango_cairo_show_layout ( cairo_t* cr, PangoLayout* layout ) ; + +FUNCTION: void +pango_cairo_show_error_underline ( cairo_t* cr, double x, double y, double width, double height ) ; + +! Rendering to a path +FUNCTION: void +pango_cairo_glyph_string_path ( cairo_t* cr, PangoFont* font, PangoGlyphString* glyphs ) ; + +FUNCTION: void +pango_cairo_layout_line_path ( cairo_t* cr, PangoLayoutLine* line ) ; + +FUNCTION: void +pango_cairo_layout_path ( cairo_t* cr, PangoLayout* layout ) ; + +FUNCTION: void +pango_cairo_error_underline_path ( cairo_t* cr, double x, double y, double width, double height ) ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! Higher level words and combinators +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +USING: pango.layouts +destructors accessors namespaces kernel cairo ; + +: (with-pango) ( layout quot -- ) + >r alien>> pango-layout r> with-variable ; inline + +: with-pango-cairo ( quot -- ) + cr pango_cairo_create_layout swap with-layout ; inline + +MEMO: dummy-cairo ( -- cr ) + CAIRO_FORMAT_ARGB32 0 0 cairo_image_surface_create cairo_create ; + +: dummy-pango ( quot -- ) + >r dummy-cairo cairo r> [ with-pango-cairo ] curry with-variable ; inline + +: layout-size ( quot -- dim ) + [ layout pango-layout-get-pixel-size 2array ] compose dummy-pango ; inline + +: show-layout ( -- ) + cr layout pango_cairo_show_layout ; + +: families ( -- families ) + pango_cairo_font_map_get_default list-families ; diff --git a/extra/pango/cairo/gadgets/gadgets.factor b/extra/pango/cairo/gadgets/gadgets.factor new file mode 100644 index 0000000000..a21affc364 --- /dev/null +++ b/extra/pango/cairo/gadgets/gadgets.factor @@ -0,0 +1,27 @@ +! Copyright (C) 2008 Matthew Willis. +! See http://factorcode.org/license.txt for BSD license. +USING: pango.cairo pango.gadgets +cairo.gadgets arrays namespaces +fry accessors ui.gadgets +sequences opengl.gadgets +kernel pango.layouts ; + +IN: pango.cairo.gadgets + +TUPLE: pango-cairo-gadget < pango-gadget ; + +SINGLETON: pango-cairo-backend +pango-cairo-backend pango-backend set-global + +M: pango-cairo-backend construct-pango + pango-cairo-gadget construct-gadget ; + +: setup-layout ( gadget -- quot ) + [ font>> ] [ text>> ] bi + '[ , layout-font , layout-text ] ; inline + +M: pango-cairo-gadget render* ( gadget -- ) + setup-layout [ layout-size dup ] + [ + '[ [ @ show-layout ] with-pango-cairo ] + ] bi render-cairo render-bytes* ; diff --git a/extra/pango/cairo/samples/samples.factor b/extra/pango/cairo/samples/samples.factor new file mode 100644 index 0000000000..f081650943 --- /dev/null +++ b/extra/pango/cairo/samples/samples.factor @@ -0,0 +1,18 @@ +! Copyright (C) 2008 Matthew Willis. +! See http://factorcode.org/license.txt for BSD license. +USING: prettyprint sequences ui.gadgets.panes +pango.cairo.gadgets math kernel cairo cairo.ffi +pango.cairo pango.gadgets tools.time namespaces assocs +threads io.backend io.encodings.utf8 io.files ; + +IN: pango.cairo.samples + +: hello-pango ( -- ) + "monospace 10" "resource:extra/pango/cairo/gadgets/gadgets.factor" + normalize-path utf8 file-contents + gadget. ; + +: time-pango ( -- ) + [ hello-pango ] time ; + +MAIN: time-pango diff --git a/extra/pango/fonts/fonts.factor b/extra/pango/fonts/fonts.factor new file mode 100644 index 0000000000..d07c71226a --- /dev/null +++ b/extra/pango/fonts/fonts.factor @@ -0,0 +1,40 @@ +! Copyright (C) 2008 Matthew Willis. +! See http://factorcode.org/license.txt for BSD license +USING: pango alien.syntax alien.c-types +kernel ; +IN: pango.fonts + +LIBRARY: pango + +FUNCTION: void +pango_font_map_list_families ( PangoFontMap* fontmap, PangoFontFamily*** families, int* n_families ) ; + +FUNCTION: char* +pango_font_family_get_name ( PangoFontFamily* family ) ; + +FUNCTION: int +pango_font_family_is_monospace ( PangoFontFamily* family ) ; + +FUNCTION: void +pango_font_family_list_faces ( PangoFontFamily* family, PangoFontFace*** faces, int* n_faces ) ; + +FUNCTION: char* +pango_font_face_get_face_name ( PangoFontFace* face ) ; + +FUNCTION: void +pango_font_face_list_sizes ( PangoFontFace* face, int** sizes, int* n_sizes ) ; + +: list-families ( PangoFontMap* -- PangoFontFamily*-seq ) + 0 0 [ pango_font_map_list_families ] 2keep + *int swap *void* [ swap c-void*-array> ] [ g_free ] bi ; + +: list-faces ( PangoFontFamily* -- PangoFontFace*-seq ) + 0 0 [ pango_font_family_list_faces ] 2keep + *int swap *void* [ swap c-void*-array> ] [ g_free ] bi ; + +: list-sizes ( PangoFontFace* -- ints ) + 0 0 [ pango_font_face_list_sizes ] 2keep + *int swap *void* [ swap c-int-array> ] [ g_free ] bi ; + +: monospace? ( PangoFontFamily* -- ? ) + pango_font_family_is_monospace 1 = ; diff --git a/extra/pango/ft2/ft2.factor b/extra/pango/ft2/ft2.factor new file mode 100644 index 0000000000..5ce59c7095 --- /dev/null +++ b/extra/pango/ft2/ft2.factor @@ -0,0 +1,56 @@ +USING: alien alien.c-types +math kernel byte-arrays freetype +opengl.gadgets accessors pango +ui.gadgets memoize +arrays sequences libc opengl.gl +system combinators alien.syntax +pango.layouts ; +IN: pango.ft2 + +<< "pangoft2" { + { [ os winnt? ] [ "libpangocairo-1.0-0.dll" ] } + { [ os macosx? ] [ "libpangocairo-1.0.0.dylib" ] } + { [ os unix? ] [ "libpangoft2-1.0.so" ] } +} cond "cdecl" add-library >> + +LIBRARY: pangoft2 + +FUNCTION: PangoFontMap* +pango_ft2_font_map_new ( ) ; + +FUNCTION: PangoContext* +pango_ft2_font_map_create_context ( PangoFT2FontMap* fontmap ) ; + +FUNCTION: void +pango_ft2_render_layout ( FT_Bitmap* bitmap, PangoLayout* layout, int x, int y ) ; + +: 4*-ceil ( n -- k*4 ) + 3 + 4 /i 4 * ; + +: ( width height -- ft-bitmap ) + swap dup + 2dup * 4*-ceil + "uchar" malloc-array + 256 + FT_PIXEL_MODE_GRAY + "FT_Bitmap" dup >r + { + set-FT_Bitmap-rows + set-FT_Bitmap-width + set-FT_Bitmap-pitch + set-FT_Bitmap-buffer + set-FT_Bitmap-num_grays + set-FT_Bitmap-pixel_mode + } set-slots r> ; + +: render-layout ( layout -- dims alien ) + [ + pango-layout-get-pixel-size + 2array dup 2^-bounds first2 dup + ] [ 0 0 pango_ft2_render_layout ] bi FT_Bitmap-buffer ; + +MEMO: ft2-context ( -- PangoContext* ) + pango_ft2_font_map_new pango_ft2_font_map_create_context ; + +: with-ft2-layout ( quot -- ) + ft2-context pango_layout_new swap with-layout ; inline diff --git a/extra/pango/ft2/gadgets/gadgets.factor b/extra/pango/ft2/gadgets/gadgets.factor new file mode 100644 index 0000000000..43ddc954ee --- /dev/null +++ b/extra/pango/ft2/gadgets/gadgets.factor @@ -0,0 +1,20 @@ +! Copyright (C) 2008 Matthew Willis. +! See http://factorcode.org/license.txt for BSD license. +USING: pango.ft2 pango.gadgets opengl.gadgets +accessors kernel opengl.gl libc +sequences namespaces ui.gadgets pango.layouts ; +IN: pango.ft2.gadgets + +TUPLE: pango-ft2-gadget < pango-gadget ; + +SINGLETON: pango-ft2-backend +pango-ft2-backend pango-backend set-global + +M: pango-ft2-backend construct-pango + pango-ft2-gadget construct-gadget ; + +M: pango-ft2-gadget render* + [ + [ text>> layout-text ] [ font>> layout-font ] bi + layout render-layout + ] with-ft2-layout [ GL_ALPHA render-bytes* ] keep free ; diff --git a/extra/pango/gadgets/gadgets.factor b/extra/pango/gadgets/gadgets.factor new file mode 100644 index 0000000000..f9442a4613 --- /dev/null +++ b/extra/pango/gadgets/gadgets.factor @@ -0,0 +1,19 @@ +! Copyright (C) 2008 Matthew Willis. +! See http://factorcode.org/license.txt for BSD license. +USING: opengl.gadgets kernel +arrays +accessors ; + +IN: pango.gadgets + +TUPLE: pango-gadget < texture-gadget text font ; + +M: pango-gadget cache-key* [ font>> ] [ text>> ] bi 2array ; + +SYMBOL: pango-backend +HOOK: construct-pango pango-backend ( -- gadget ) + +: ( font text -- gadget ) + construct-pango + swap >>text + swap >>font ; diff --git a/extra/pango/layouts/layouts.factor b/extra/pango/layouts/layouts.factor new file mode 100644 index 0000000000..71317ce552 --- /dev/null +++ b/extra/pango/layouts/layouts.factor @@ -0,0 +1,30 @@ +USING: alien alien.c-types +math +destructors accessors namespaces +pango kernel ; +IN: pango.layouts + +: pango-layout-get-pixel-size ( layout -- width height ) + 0 0 [ pango_layout_get_pixel_size ] 2keep + [ *int ] bi@ ; + +TUPLE: pango-layout alien ; +C: pango-layout +M: pango-layout dispose ( alien -- ) alien>> g_object_unref ; + +: layout ( -- pango-layout ) pango-layout get ; + +: (with-layout) ( pango-layout quot -- ) + >r alien>> pango-layout r> with-variable ; inline + +: with-layout ( layout quot -- ) + >r r> [ (with-layout) ] curry with-disposal ; inline + +: layout-font ( str -- ) + pango_font_description_from_string + dup zero? [ "pango: not a valid font." throw ] when + layout over pango_layout_set_font_description + pango_font_description_free ; + +: layout-text ( str -- ) + layout swap -1 pango_layout_set_text ; diff --git a/extra/pango/pango.factor b/extra/pango/pango.factor new file mode 100644 index 0000000000..be5c257cb0 --- /dev/null +++ b/extra/pango/pango.factor @@ -0,0 +1,62 @@ +! Copyright (C) 2008 Matthew Willis. +! See http://factorcode.org/license.txt for BSD license +USING: system +alien.c-types alien.syntax alien combinators ; +IN: pango + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! Helpful functions from other parts of pango +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +<< "pango" { + { [ os winnt? ] [ "libpango-1.0-0.dll" ] } + { [ os macosx? ] [ "libpango-1.0.0.dylib" ] } + { [ os unix? ] [ "libpango-1.0.so" ] } +} cond "cdecl" add-library >> + +LIBRARY: pango + +: PANGO_SCALE 1024 ; + +FUNCTION: PangoLayout* +pango_layout_new ( PangoContext* context ) ; + +FUNCTION: void +pango_layout_set_text ( PangoLayout* layout, char* text, int length ) ; + +FUNCTION: char* +pango_layout_get_text ( PangoLayout* layout ) ; + +FUNCTION: void +pango_layout_get_size ( PangoLayout* layout, int* width, int* height ) ; + +FUNCTION: PangoFontDescription* +pango_font_description_from_string ( char* str ) ; + +FUNCTION: char* +pango_font_description_to_string ( PangoFontDescription* desc ) ; + +FUNCTION: char* +pango_font_description_to_filename ( PangoFontDescription* desc ) ; + +FUNCTION: void +pango_layout_set_font_description ( PangoLayout* layout, PangoFontDescription* desc ) ; + +FUNCTION: PangoFontDescription* +pango_layout_get_font_description ( PangoLayout* layout ) ; + +FUNCTION: void +pango_layout_get_pixel_size ( PangoLayout* layout, int* width, int* height ) ; + +FUNCTION: void +pango_font_description_free ( PangoFontDescription* desc ) ; + +! glib functions + +TYPEDEF: void* gpointer + +FUNCTION: void +g_object_unref ( gpointer object ) ; + +FUNCTION: void +g_free ( gpointer mem ) ; diff --git a/extra/parser-combinators/parser-combinators-docs.factor b/extra/parser-combinators/parser-combinators-docs.factor index 41171ce822..c08243d17d 100755 --- a/extra/parser-combinators/parser-combinators-docs.factor +++ b/extra/parser-combinators/parser-combinators-docs.factor @@ -23,4 +23,4 @@ HELP: any-char-parser "from the input string. The value consumed is the " "result of the parse." } { $examples -{ $example "USING: lazy-lists parser-combinators prettyprint ;" "\"foo\" any-char-parser parse-1 ." "102" } } ; +{ $example "USING: lists.lazy parser-combinators prettyprint ;" "\"foo\" any-char-parser parse-1 ." "102" } } ; diff --git a/extra/parser-combinators/parser-combinators-tests.factor b/extra/parser-combinators/parser-combinators-tests.factor index 2dd3fd911c..70698daa0b 100755 --- a/extra/parser-combinators/parser-combinators-tests.factor +++ b/extra/parser-combinators/parser-combinators-tests.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2005 Chris Double. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel lazy-lists tools.test strings math +USING: kernel lists.lazy tools.test strings math sequences parser-combinators arrays math.parser unicode.categories ; IN: parser-combinators.tests diff --git a/extra/parser-combinators/parser-combinators.factor b/extra/parser-combinators/parser-combinators.factor index 40620295c6..2414c1ced3 100755 --- a/extra/parser-combinators/parser-combinators.factor +++ b/extra/parser-combinators/parser-combinators.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2004 Chris Double. ! See http://factorcode.org/license.txt for BSD license. -USING: lazy-lists promises kernel sequences strings math +USING: lists lists.lazy promises kernel sequences strings math arrays splitting quotations combinators namespaces unicode.case unicode.categories sequences.deep ; IN: parser-combinators @@ -147,8 +147,8 @@ TUPLE: and-parser parsers ; >r parse-result-parsed r> [ parse-result-parsed 2array ] keep parse-result-unparsed - ] lmap-with - ] lmap-with lconcat ; + ] lazy-map-with + ] lazy-map-with lconcat ; M: and-parser parse ( input parser -- list ) #! Parse 'input' by sequentially combining the @@ -171,13 +171,13 @@ M: or-parser parse ( input parser1 -- list ) #! of parser1 and parser2 being applied to the same #! input. This implements the choice parsing operator. or-parser-parsers 0 swap seq>list - [ parse ] lmap-with lconcat ; + [ parse ] lazy-map-with lconcat ; : left-trim-slice ( string -- string ) #! Return a new string without any leading whitespace #! from the original string. dup empty? [ - dup first blank? [ 1 tail-slice left-trim-slice ] when + dup first blank? [ rest-slice left-trim-slice ] when ] unless ; TUPLE: sp-parser p1 ; @@ -200,7 +200,7 @@ M: just-parser parse ( input parser -- result ) #! from the results anything where the remaining #! input to be parsed is not empty. So ensures a #! fully parsed input string. - just-parser-p1 parse [ parse-result-unparsed empty? ] lsubset ; + just-parser-p1 parse [ parse-result-unparsed empty? ] lfilter ; TUPLE: apply-parser p1 quot ; @@ -216,7 +216,7 @@ M: apply-parser parse ( input parser -- result ) -rot parse [ [ parse-result-parsed swap call ] keep parse-result-unparsed - ] lmap-with ; + ] lazy-map-with ; TUPLE: some-parser p1 ; diff --git a/extra/parser-combinators/simple/simple-docs.factor b/extra/parser-combinators/simple/simple-docs.factor index 78b731f5b0..fdf32bddb1 100755 --- a/extra/parser-combinators/simple/simple-docs.factor +++ b/extra/parser-combinators/simple/simple-docs.factor @@ -11,7 +11,7 @@ HELP: 'digit' "the input string. The numeric value of the digit " " consumed is the result of the parse." } { $examples -{ $example "USING: lazy-lists parser-combinators parser-combinators.simple prettyprint ;" "\"123\" 'digit' parse-1 ." "1" } } ; +{ $example "USING: lists.lazy parser-combinators parser-combinators.simple prettyprint ;" "\"123\" 'digit' parse-1 ." "1" } } ; HELP: 'integer' { $values @@ -21,7 +21,7 @@ HELP: 'integer' "the input string. The numeric value of the integer " " consumed is the result of the parse." } { $examples -{ $example "USING: lazy-lists parser-combinators parser-combinators.simple prettyprint ;" "\"123\" 'integer' parse-1 ." "123" } } ; +{ $example "USING: lists.lazy parser-combinators parser-combinators.simple prettyprint ;" "\"123\" 'integer' parse-1 ." "123" } } ; HELP: 'string' { $values { "parser" "a parser object" } } @@ -30,7 +30,7 @@ HELP: 'string' "quotations from the input string. The string value " " consumed is the result of the parse." } { $examples -{ $example "USING: lazy-lists parser-combinators parser-combinators.simple prettyprint ;" "\"\\\"foo\\\"\" 'string' parse-1 ." "\"foo\"" } } ; +{ $example "USING: lists.lazy parser-combinators parser-combinators.simple prettyprint ;" "\"\\\"foo\\\"\" 'string' parse-1 ." "\"foo\"" } } ; HELP: 'bold' { $values @@ -62,6 +62,6 @@ HELP: comma-list "'element' should be a parser that can parse the elements. The " "result of the parser is a sequence of the parsed elements." } { $examples -{ $example "USING: lazy-lists parser-combinators parser-combinators.simple prettyprint ;" "\"1,2,3,4\" 'integer' comma-list parse-1 ." "{ 1 2 3 4 }" } } ; +{ $example "USING: lists.lazy parser-combinators parser-combinators.simple prettyprint ;" "\"1,2,3,4\" 'integer' comma-list parse-1 ." "{ 1 2 3 4 }" } } ; { $see-also 'digit' 'integer' 'string' 'bold' 'italic' comma-list } related-words diff --git a/extra/parser-combinators/simple/simple.factor b/extra/parser-combinators/simple/simple.factor index 745442610c..f7a696ca35 100755 --- a/extra/parser-combinators/simple/simple.factor +++ b/extra/parser-combinators/simple/simple.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2006 Chris Double. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel strings math sequences lazy-lists words +USING: kernel strings math sequences lists.lazy words math.parser promises parser-combinators unicode.categories ; IN: parser-combinators.simple diff --git a/extra/peg/ebnf/ebnf-tests.factor b/extra/peg/ebnf/ebnf-tests.factor index 0292a88ad9..faaa63f4bd 100644 --- a/extra/peg/ebnf/ebnf-tests.factor +++ b/extra/peg/ebnf/ebnf-tests.factor @@ -1,15 +1,16 @@ ! Copyright (C) 2007 Chris Double. ! See http://factorcode.org/license.txt for BSD license. ! -USING: kernel tools.test peg peg.ebnf words math math.parser sequences ; +USING: kernel tools.test peg peg.ebnf words math math.parser + sequences accessors ; IN: peg.ebnf.tests { T{ ebnf-non-terminal f "abc" } } [ - "abc" 'non-terminal' parse parse-result-ast + "abc" 'non-terminal' parse ast>> ] unit-test { T{ ebnf-terminal f "55" } } [ - "'55'" 'terminal' parse parse-result-ast + "'55'" 'terminal' parse ast>> ] unit-test { @@ -20,7 +21,7 @@ IN: peg.ebnf.tests } } } [ - "digit = '1' | '2'" 'rule' parse parse-result-ast + "digit = '1' | '2'" 'rule' parse ast>> ] unit-test { @@ -31,7 +32,7 @@ IN: peg.ebnf.tests } } } [ - "digit = '1' '2'" 'rule' parse parse-result-ast + "digit = '1' '2'" 'rule' parse ast>> ] unit-test { @@ -44,20 +45,22 @@ IN: peg.ebnf.tests } } } [ - "one two | three" 'choice' parse parse-result-ast + "one two | three" 'choice' parse ast>> ] unit-test { T{ ebnf-sequence f V{ T{ ebnf-non-terminal f "one" } - T{ ebnf-choice f - V{ T{ ebnf-non-terminal f "two" } T{ ebnf-non-terminal f "three" } } + T{ ebnf-whitespace f + T{ ebnf-choice f + V{ T{ ebnf-non-terminal f "two" } T{ ebnf-non-terminal f "three" } } + } } } } } [ - "one (two | three)" 'choice' parse parse-result-ast + "one {two | three}" 'choice' parse ast>> ] unit-test { @@ -77,7 +80,7 @@ IN: peg.ebnf.tests } } } [ - "one ((two | three) four)*" 'choice' parse parse-result-ast + "one ((two | three) four)*" 'choice' parse ast>> ] unit-test { @@ -89,43 +92,43 @@ IN: peg.ebnf.tests } } } [ - "one ( two )? three" 'choice' parse parse-result-ast + "one ( two )? three" 'choice' parse ast>> ] unit-test { "foo" } [ - "\"foo\"" 'identifier' parse parse-result-ast + "\"foo\"" 'identifier' parse ast>> ] unit-test { "foo" } [ - "'foo'" 'identifier' parse parse-result-ast + "'foo'" 'identifier' parse ast>> ] unit-test { "foo" } [ - "foo" 'non-terminal' parse parse-result-ast ebnf-non-terminal-symbol + "foo" 'non-terminal' parse ast>> ebnf-non-terminal-symbol ] unit-test { "foo" } [ - "foo]" 'non-terminal' parse parse-result-ast ebnf-non-terminal-symbol + "foo]" 'non-terminal' parse ast>> ebnf-non-terminal-symbol ] unit-test { V{ "a" "b" } } [ - "ab" [EBNF foo='a' 'b' EBNF] call parse-result-ast + "ab" [EBNF foo='a' 'b' EBNF] call ast>> ] unit-test { V{ 1 "b" } } [ - "ab" [EBNF foo=('a')[[ drop 1 ]] 'b' EBNF] call parse-result-ast + "ab" [EBNF foo=('a')[[ drop 1 ]] 'b' EBNF] call ast>> ] unit-test { V{ 1 2 } } [ - "ab" [EBNF foo=('a') [[ drop 1 ]] ('b') [[ drop 2 ]] EBNF] call parse-result-ast + "ab" [EBNF foo=('a') [[ drop 1 ]] ('b') [[ drop 2 ]] EBNF] call ast>> ] unit-test { CHAR: A } [ - "A" [EBNF foo=[A-Z] EBNF] call parse-result-ast + "A" [EBNF foo=[A-Z] EBNF] call ast>> ] unit-test { CHAR: Z } [ - "Z" [EBNF foo=[A-Z] EBNF] call parse-result-ast + "Z" [EBNF foo=[A-Z] EBNF] call ast>> ] unit-test { f } [ @@ -133,7 +136,7 @@ IN: peg.ebnf.tests ] unit-test { CHAR: 0 } [ - "0" [EBNF foo=[^A-Z] EBNF] call parse-result-ast + "0" [EBNF foo=[^A-Z] EBNF] call ast>> ] unit-test { f } [ @@ -145,31 +148,31 @@ IN: peg.ebnf.tests ] unit-test { V{ "1" "+" "foo" } } [ - "1+1" [EBNF foo='1' '+' '1' [[ drop "foo" ]] EBNF] call parse-result-ast + "1+1" [EBNF foo='1' '+' '1' [[ drop "foo" ]] EBNF] call ast>> ] unit-test { "foo" } [ - "1+1" [EBNF foo='1' '+' '1' => [[ drop "foo" ]] EBNF] call parse-result-ast + "1+1" [EBNF foo='1' '+' '1' => [[ drop "foo" ]] EBNF] call ast>> ] unit-test { "foo" } [ - "1+1" [EBNF foo='1' '+' '1' => [[ drop "foo" ]] | '1' '-' '1' => [[ drop "bar" ]] EBNF] call parse-result-ast + "1+1" [EBNF foo='1' '+' '1' => [[ drop "foo" ]] | '1' '-' '1' => [[ drop "bar" ]] EBNF] call ast>> ] unit-test { "bar" } [ - "1-1" [EBNF foo='1' '+' '1' => [[ drop "foo" ]] | '1' '-' '1' => [[ drop "bar" ]] EBNF] call parse-result-ast + "1-1" [EBNF foo='1' '+' '1' => [[ drop "foo" ]] | '1' '-' '1' => [[ drop "bar" ]] EBNF] call ast>> ] unit-test { 6 } [ - "4+2" [EBNF num=[0-9] => [[ digit> ]] foo=num:x '+' num:y => [[ drop x y + ]] EBNF] call parse-result-ast + "4+2" [EBNF num=[0-9] => [[ digit> ]] foo=num:x '+' num:y => [[ drop x y + ]] EBNF] call ast>> ] unit-test { 6 } [ - "4+2" [EBNF foo=[0-9]:x '+' [0-9]:y => [[ drop x digit> y digit> + ]] EBNF] call parse-result-ast + "4+2" [EBNF foo=[0-9]:x '+' [0-9]:y => [[ drop x digit> y digit> + ]] EBNF] call ast>> ] unit-test { 10 } [ - { 1 2 3 4 } [EBNF num=. ?[ number? ]? list=list:x num:y => [[ drop x y + ]] | num EBNF] call parse-result-ast + { 1 2 3 4 } [EBNF num=. ?[ number? ]? list=list:x num:y => [[ drop x y + ]] | num EBNF] call ast>> ] unit-test { f } [ @@ -177,7 +180,7 @@ IN: peg.ebnf.tests ] unit-test { 3 } [ - { 1 2 "a" 4 } [EBNF num=. ?[ number? ]? list=list:x num:y => [[ drop x y + ]] | num EBNF] call parse-result-ast + { 1 2 "a" 4 } [EBNF num=. ?[ number? ]? list=list:x num:y => [[ drop x y + ]] | num EBNF] call ast>> ] unit-test { f } [ @@ -185,44 +188,44 @@ IN: peg.ebnf.tests ] unit-test { V{ "a" " " "b" } } [ - "a b" [EBNF -=" " | "\t" | "\n" foo="a" - "b" EBNF] call parse-result-ast + "a b" [EBNF -=" " | "\t" | "\n" foo="a" - "b" EBNF] call ast>> ] unit-test { V{ "a" "\t" "b" } } [ - "a\tb" [EBNF -=" " | "\t" | "\n" foo="a" - "b" EBNF] call parse-result-ast + "a\tb" [EBNF -=" " | "\t" | "\n" foo="a" - "b" EBNF] call ast>> ] unit-test { V{ "a" "\n" "b" } } [ - "a\nb" [EBNF -=" " | "\t" | "\n" foo="a" - "b" EBNF] call parse-result-ast + "a\nb" [EBNF -=" " | "\t" | "\n" foo="a" - "b" EBNF] call ast>> ] unit-test { V{ "a" f "b" } } [ - "ab" [EBNF -=" " | "\t" | "\n" foo="a" (-)? "b" EBNF] call parse-result-ast + "ab" [EBNF -=" " | "\t" | "\n" foo="a" (-)? "b" EBNF] call ast>> ] unit-test { V{ "a" " " "b" } } [ - "a b" [EBNF -=" " | "\t" | "\n" foo="a" (-)? "b" EBNF] call parse-result-ast + "a b" [EBNF -=" " | "\t" | "\n" foo="a" (-)? "b" EBNF] call ast>> ] unit-test { V{ "a" "\t" "b" } } [ - "a\tb" [EBNF -=" " | "\t" | "\n" foo="a" (-)? "b" EBNF] call parse-result-ast + "a\tb" [EBNF -=" " | "\t" | "\n" foo="a" (-)? "b" EBNF] call ast>> ] unit-test { V{ "a" "\n" "b" } } [ - "a\nb" [EBNF -=" " | "\t" | "\n" foo="a" (-)? "b" EBNF] call parse-result-ast + "a\nb" [EBNF -=" " | "\t" | "\n" foo="a" (-)? "b" EBNF] call ast>> ] unit-test { V{ "a" "b" } } [ - "ab" [EBNF -=(" " | "\t" | "\n")? => [[ drop ignore ]] foo="a" - "b" EBNF] call parse-result-ast + "ab" [EBNF -=(" " | "\t" | "\n")? => [[ drop ignore ]] foo="a" - "b" EBNF] call ast>> ] unit-test { V{ "a" "b" } } [ - "a\tb" [EBNF -=(" " | "\t" | "\n")? => [[ drop ignore ]] foo="a" - "b" EBNF] call parse-result-ast + "a\tb" [EBNF -=(" " | "\t" | "\n")? => [[ drop ignore ]] foo="a" - "b" EBNF] call ast>> ] unit-test { V{ "a" "b" } } [ - "a\nb" [EBNF -=(" " | "\t" | "\n")? => [[ drop ignore ]] foo="a" - "b" EBNF] call parse-result-ast + "a\nb" [EBNF -=(" " | "\t" | "\n")? => [[ drop ignore ]] foo="a" - "b" EBNF] call ast>> ] unit-test { f } [ @@ -232,19 +235,19 @@ IN: peg.ebnf.tests { V{ V{ 49 } "+" V{ 49 } } } [ #! Test direct left recursion. #! Using packrat, so first part of expr fails, causing 2nd choice to be used - "1+1" [EBNF num=([0-9])+ expr=expr "+" num | num EBNF] call parse-result-ast + "1+1" [EBNF num=([0-9])+ expr=expr "+" num | num EBNF] call ast>> ] unit-test { V{ V{ V{ 49 } "+" V{ 49 } } "+" V{ 49 } } } [ #! Test direct left recursion. #! Using packrat, so first part of expr fails, causing 2nd choice to be used - "1+1+1" [EBNF num=([0-9])+ expr=expr "+" num | num EBNF] call parse-result-ast + "1+1+1" [EBNF num=([0-9])+ expr=expr "+" num | num EBNF] call ast>> ] unit-test { V{ V{ V{ 49 } "+" V{ 49 } } "+" V{ 49 } } } [ #! Test indirect left recursion. #! Using packrat, so first part of expr fails, causing 2nd choice to be used - "1+1+1" [EBNF num=([0-9])+ x=expr expr=x "+" num | num EBNF] call parse-result-ast + "1+1+1" [EBNF num=([0-9])+ x=expr expr=x "+" num | num EBNF] call ast>> ] unit-test { t } [ @@ -277,23 +280,88 @@ main = Primary ;EBNF { "this" } [ - "this" primary parse-result-ast + "this" primary ast>> ] unit-test { V{ "this" "." "x" } } [ - "this.x" primary parse-result-ast + "this.x" primary ast>> ] unit-test { V{ V{ "this" "." "x" } "." "y" } } [ - "this.x.y" primary parse-result-ast + "this.x.y" primary ast>> ] unit-test { V{ V{ "this" "." "x" } "." "m" "(" ")" } } [ - "this.x.m()" primary parse-result-ast + "this.x.m()" primary ast>> ] unit-test { V{ V{ V{ "x" "[" "i" "]" } "[" "j" "]" } "." "y" } } [ - "x[i][j].y" primary parse-result-ast + "x[i][j].y" primary ast>> ] unit-test 'ebnf' compile must-infer + +{ V{ V{ "a" "b" } "c" } } [ + "abc" [EBNF a="a" "b" foo=(a "c") EBNF] call ast>> +] unit-test + +{ V{ V{ "a" "b" } "c" } } [ + "abc" [EBNF a="a" "b" foo={a "c"} EBNF] call ast>> +] unit-test + +{ V{ V{ "a" "b" } "c" } } [ + "abc" [EBNF a="a" "b" foo=a "c" EBNF] call ast>> +] unit-test + +{ f } [ + "a bc" [EBNF a="a" "b" foo=(a "c") EBNF] call +] unit-test + +{ f } [ + "a bc" [EBNF a="a" "b" foo=a "c" EBNF] call +] unit-test + +{ f } [ + "a bc" [EBNF a="a" "b" foo={a "c"} EBNF] call +] unit-test + +{ f } [ + "ab c" [EBNF a="a" "b" foo=a "c" EBNF] call +] unit-test + +{ V{ V{ "a" "b" } "c" } } [ + "ab c" [EBNF a="a" "b" foo={a "c"} EBNF] call ast>> +] unit-test + +{ f } [ + "ab c" [EBNF a="a" "b" foo=(a "c") EBNF] call +] unit-test + +{ f } [ + "a b c" [EBNF a="a" "b" foo=a "c" EBNF] call +] unit-test + +{ f } [ + "a b c" [EBNF a="a" "b" foo=(a "c") EBNF] call +] unit-test + +{ f } [ + "a b c" [EBNF a="a" "b" foo={a "c"} EBNF] call +] unit-test + +{ V{ V{ V{ "a" "b" } "c" } V{ V{ "a" "b" } "c" } } } [ + "ab cab c" [EBNF a="a" "b" foo={a "c"}* EBNF] call ast>> +] unit-test + +{ V{ } } [ + "ab cab c" [EBNF a="a" "b" foo=(a "c")* EBNF] call ast>> +] unit-test + +{ V{ V{ V{ "a" "b" } "c" } V{ V{ "a" "b" } "c" } } } [ + "ab c ab c" [EBNF a="a" "b" foo={a "c"}* EBNF] call ast>> +] unit-test + +{ V{ } } [ + "ab c ab c" [EBNF a="a" "b" foo=(a "c")* EBNF] call ast>> +] unit-test + diff --git a/extra/peg/ebnf/ebnf.factor b/extra/peg/ebnf/ebnf.factor index 8bf0475da5..8a3a06c58d 100644 --- a/extra/peg/ebnf/ebnf.factor +++ b/extra/peg/ebnf/ebnf.factor @@ -17,6 +17,7 @@ TUPLE: ebnf-sequence elements ; TUPLE: ebnf-repeat0 group ; TUPLE: ebnf-repeat1 group ; TUPLE: ebnf-optional group ; +TUPLE: ebnf-whitespace group ; TUPLE: ebnf-rule symbol elements ; TUPLE: ebnf-action parser code ; TUPLE: ebnf-var parser name ; @@ -34,6 +35,7 @@ C: ebnf-sequence C: ebnf-repeat0 C: ebnf-repeat1 C: ebnf-optional +C: ebnf-whitespace C: ebnf-rule C: ebnf-action C: ebnf-var @@ -48,7 +50,7 @@ C: ebnf : syntax-pack ( begin parser end -- parser ) #! Parse 'parser' surrounded by syntax elements #! begin and end. - [ syntax ] dipd syntax pack ; + [ syntax ] 2dip syntax pack ; : 'identifier' ( -- parser ) #! Return a parser that parses an identifer delimited by @@ -84,6 +86,7 @@ C: ebnf [ dup CHAR: + = ] [ dup CHAR: ? = ] [ dup CHAR: : = ] + [ dup CHAR: ~ = ] } || not nip ] satisfy repeat1 [ >string ] action ; @@ -134,9 +137,15 @@ DEFER: 'choice' #! Parse a group of choices, with a suffix indicating #! the type of group (repeat0, repeat1, etc) and #! an quot that is the action that produces the AST. - "(" [ 'choice' sp ] delay ")" syntax-pack - swap 2seq - [ first ] rot compose action ; + 2dup + [ + "(" [ 'choice' sp ] delay ")" syntax-pack + swap 2seq + [ first ] rot compose action , + "{" [ 'choice' sp ] delay "}" syntax-pack + swap 2seq + [ first ] rot compose action , + ] choice* ; : 'group' ( -- parser ) #! A grouping with no suffix. Used for precedence. @@ -238,9 +247,15 @@ GENERIC: (transform) ( ast -- parser ) SYMBOL: parser SYMBOL: main +SYMBOL: ignore-ws : transform ( ast -- object ) - H{ } clone dup dup [ parser set swap (transform) main set ] bind ; + H{ } clone dup dup [ + f ignore-ws set + parser set + swap (transform) + main set + ] bind ; M: ebnf (transform) ( ast -- parser ) rules>> [ (transform) ] map peek ; @@ -252,7 +267,13 @@ M: ebnf-rule (transform) ( ast -- parser ) ] keep ; M: ebnf-sequence (transform) ( ast -- parser ) - elements>> [ (transform) ] map seq [ dup length 1 = [ first ] when ] action ; + #! If ignore-ws is set then each element of the sequence + #! ignores leading whitespace. This is not inherited by + #! subelements of the sequence. + elements>> [ + f ignore-ws [ (transform) ] with-variable + ignore-ws get [ sp ] when + ] map seq [ dup length 1 = [ first ] when ] action ; M: ebnf-choice (transform) ( ast -- parser ) options>> [ (transform) ] map choice ; @@ -282,10 +303,13 @@ M: ebnf-repeat1 (transform) ( ast -- parser ) M: ebnf-optional (transform) ( ast -- parser ) transform-group optional ; +M: ebnf-whitespace (transform) ( ast -- parser ) + t ignore-ws [ transform-group ] with-variable ; + GENERIC: build-locals ( code ast -- code ) M: ebnf-sequence build-locals ( code ast -- code ) - elements>> dup [ ebnf-var? ] subset empty? [ + elements>> dup [ ebnf-var? ] filter empty? [ drop ] [ [ @@ -300,7 +324,7 @@ M: ebnf-sequence build-locals ( code ast -- code ) ] 2each " | " % % - " ] with-locals" % + " ]" % ] "" make ] if ; @@ -310,7 +334,7 @@ M: ebnf-var build-locals ( code ast -- ) name>> % " [ dup ] " % " | " % % - " ] with-locals" % + " ]" % ] "" make ; M: object build-locals ( code ast -- ) diff --git a/extra/peg/expr/expr.factor b/extra/peg/expr/expr.factor index e16d9db0a7..e2df60ea9a 100644 --- a/extra/peg/expr/expr.factor +++ b/extra/peg/expr/expr.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2008 Chris Double. ! See http://factorcode.org/license.txt for BSD license. USING: kernel arrays strings math.parser sequences -peg peg.ebnf peg.parsers memoize math ; +peg peg.ebnf peg.parsers memoize math accessors ; IN: peg.expr EBNF: expr @@ -20,5 +20,5 @@ exp = exp "+" fac => [[ first3 nip + ]] ;EBNF : eval-expr ( string -- number ) - expr parse-result-ast ; + expr ast>> ; diff --git a/extra/peg/parsers/parsers.factor b/extra/peg/parsers/parsers.factor index da7f678f2d..784e6c064c 100755 --- a/extra/peg/parsers/parsers.factor +++ b/extra/peg/parsers/parsers.factor @@ -107,7 +107,7 @@ MEMO: pack ( begin body end -- parser ) #! range of characters from the first to the second, #! inclusive. dup first CHAR: ^ = [ - 1 tail (range-pattern) [ member? not ] curry satisfy + rest (range-pattern) [ member? not ] curry satisfy ] [ (range-pattern) [ member? ] curry satisfy ] if ; diff --git a/extra/peg/peg-tests.factor b/extra/peg/peg-tests.factor index fcec33f7c2..1beeb51678 100644 --- a/extra/peg/peg-tests.factor +++ b/extra/peg/peg-tests.factor @@ -1,7 +1,8 @@ ! Copyright (C) 2007 Chris Double. ! See http://factorcode.org/license.txt for BSD license. ! -USING: kernel tools.test strings namespaces arrays sequences peg peg.private accessors words math ; +USING: kernel tools.test strings namespaces arrays sequences + peg peg.private accessors words math accessors ; IN: peg.tests { f } [ @@ -10,7 +11,7 @@ IN: peg.tests { "begin" "end" } [ "beginend" "begin" token parse - { parse-result-ast parse-result-remaining } get-slots + { ast>> remaining>> } get-slots >string ] unit-test @@ -23,11 +24,11 @@ IN: peg.tests ] unit-test { CHAR: a } [ - "abcd" CHAR: a CHAR: z range parse parse-result-ast + "abcd" CHAR: a CHAR: z range parse ast>> ] unit-test { CHAR: z } [ - "zbcd" CHAR: a CHAR: z range parse parse-result-ast + "zbcd" CHAR: a CHAR: z range parse ast>> ] unit-test { f } [ @@ -35,15 +36,15 @@ IN: peg.tests ] unit-test { V{ "g" "o" } } [ - "good" "g" token "o" token 2array seq parse parse-result-ast + "good" "g" token "o" token 2array seq parse ast>> ] unit-test { "a" } [ - "abcd" "a" token "b" token 2array choice parse parse-result-ast + "abcd" "a" token "b" token 2array choice parse ast>> ] unit-test { "b" } [ - "bbcd" "a" token "b" token 2array choice parse parse-result-ast + "bbcd" "a" token "b" token 2array choice parse ast>> ] unit-test { f } [ @@ -55,15 +56,15 @@ IN: peg.tests ] unit-test { 0 } [ - "" "a" token repeat0 parse parse-result-ast length + "" "a" token repeat0 parse ast>> length ] unit-test { 0 } [ - "b" "a" token repeat0 parse parse-result-ast length + "b" "a" token repeat0 parse ast>> length ] unit-test { V{ "a" "a" "a" } } [ - "aaab" "a" token repeat0 parse parse-result-ast + "aaab" "a" token repeat0 parse ast>> ] unit-test { f } [ @@ -75,15 +76,15 @@ IN: peg.tests ] unit-test { V{ "a" "a" "a" } } [ - "aaab" "a" token repeat1 parse parse-result-ast + "aaab" "a" token repeat1 parse ast>> ] unit-test { V{ "a" "b" } } [ - "ab" "a" token optional "b" token 2array seq parse parse-result-ast + "ab" "a" token optional "b" token 2array seq parse ast>> ] unit-test { V{ f "b" } } [ - "b" "a" token optional "b" token 2array seq parse parse-result-ast + "b" "a" token optional "b" token 2array seq parse ast>> ] unit-test { f } [ @@ -91,7 +92,7 @@ IN: peg.tests ] unit-test { V{ CHAR: a CHAR: b } } [ - "ab" "a" token ensure CHAR: a CHAR: z range dup 3array seq parse parse-result-ast + "ab" "a" token ensure CHAR: a CHAR: z range dup 3array seq parse ast>> ] unit-test { f } [ @@ -123,11 +124,11 @@ IN: peg.tests ] unit-test { 1 } [ - "a" "a" token [ drop 1 ] action parse parse-result-ast + "a" "a" token [ drop 1 ] action parse ast>> ] unit-test { V{ 1 1 } } [ - "aa" "a" token [ drop 1 ] action dup 2array seq parse parse-result-ast + "aa" "a" token [ drop 1 ] action dup 2array seq parse ast>> ] unit-test { f } [ @@ -139,19 +140,19 @@ IN: peg.tests ] unit-test { CHAR: a } [ - "a" [ CHAR: a = ] satisfy parse parse-result-ast + "a" [ CHAR: a = ] satisfy parse ast>> ] unit-test { "a" } [ - " a" "a" token sp parse parse-result-ast + " a" "a" token sp parse ast>> ] unit-test { "a" } [ - "a" "a" token sp parse parse-result-ast + "a" "a" token sp parse ast>> ] unit-test { V{ "a" } } [ - "[a]" "[" token hide "a" token "]" token hide 3array seq parse parse-result-ast + "[a]" "[" token hide "a" token "]" token hide 3array seq parse ast>> ] unit-test { f } [ @@ -164,8 +165,8 @@ IN: peg.tests [ "1" token , "-" token , "1" token , ] seq* , [ "1" token , "+" token , "1" token , ] seq* , ] choice* - "1-1" over parse parse-result-ast swap - "1+1" swap parse parse-result-ast + "1-1" over parse ast>> swap + "1+1" swap parse ast>> ] unit-test : expr ( -- parser ) @@ -174,7 +175,7 @@ IN: peg.tests [ expr ] delay "+" token "1" token 3seq "1" token 2choice ; { V{ V{ "1" "+" "1" } "+" "1" } } [ - "1+1+1" expr parse parse-result-ast + "1+1+1" expr parse ast>> ] unit-test { t } [ @@ -189,6 +190,6 @@ IN: peg.tests ] unit-test { CHAR: B } [ - "B" [ drop t ] satisfy [ 66 >= ] semantic parse parse-result-ast + "B" [ drop t ] satisfy [ 66 >= ] semantic parse ast>> ] unit-test diff --git a/extra/peg/peg.factor b/extra/peg/peg.factor index 858d062c68..b420574a3b 100755 --- a/extra/peg/peg.factor +++ b/extra/peg/peg.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007, 2008 Chris Double. ! See http://factorcode.org/license.txt for BSD license. USING: kernel sequences strings fry namespaces math assocs shuffle - vectors arrays math.parser + vectors arrays math.parser math.order unicode.categories compiler.units parser words quotations effects memoize accessors locals effects splitting ; IN: peg @@ -448,7 +448,7 @@ M: action-parser (compile) ( parser -- quot ) #! Return a new string without any leading whitespace #! from the original string. dup empty? [ - dup first blank? [ 1 tail-slice left-trim-slice ] when + dup first blank? [ rest-slice left-trim-slice ] when ] unless ; TUPLE: sp-parser p1 ; diff --git a/extra/peg/pl0/pl0-tests.factor b/extra/peg/pl0/pl0-tests.factor index 88993c354b..e1d97bdef9 100644 --- a/extra/peg/pl0/pl0-tests.factor +++ b/extra/peg/pl0/pl0-tests.factor @@ -1,43 +1,44 @@ ! Copyright (C) 2007 Chris Double. ! See http://factorcode.org/license.txt for BSD license. ! -USING: kernel tools.test peg peg.ebnf peg.pl0 multiline sequences ; +USING: kernel tools.test peg peg.ebnf peg.pl0 + multiline sequences accessors ; IN: peg.pl0.tests { t } [ - "CONST foo = 1;" "block" \ pl0 rule parse parse-result-remaining empty? + "CONST foo = 1;" "block" \ pl0 rule parse remaining>> empty? ] unit-test { t } [ - "VAR foo;" "block" \ pl0 rule parse parse-result-remaining empty? + "VAR foo;" "block" \ pl0 rule parse remaining>> empty? ] unit-test { t } [ - "VAR foo,bar , baz;" "block" \ pl0 rule parse parse-result-remaining empty? + "VAR foo,bar , baz;" "block" \ pl0 rule parse remaining>> empty? ] unit-test { t } [ - "foo := 5" "statement" \ pl0 rule parse parse-result-remaining empty? + "foo := 5" "statement" \ pl0 rule parse remaining>> empty? ] unit-test { t } [ - "BEGIN foo := 5 END" "statement" \ pl0 rule parse parse-result-remaining empty? + "BEGIN foo := 5 END" "statement" \ pl0 rule parse remaining>> empty? ] unit-test { t } [ - "IF 1=1 THEN foo := 5" "statement" \ pl0 rule parse parse-result-remaining empty? + "IF 1=1 THEN foo := 5" "statement" \ pl0 rule parse remaining>> empty? ] unit-test { t } [ - "WHILE 1=1 DO foo := 5" "statement" \ pl0 rule parse parse-result-remaining empty? + "WHILE 1=1 DO foo := 5" "statement" \ pl0 rule parse remaining>> empty? ] unit-test { t } [ - "WHILE ODD 1 DO foo := 5" "statement" \ pl0 rule parse parse-result-remaining empty? + "WHILE ODD 1 DO foo := 5" "statement" \ pl0 rule parse remaining>> empty? ] unit-test { t } [ - "PROCEDURE square; BEGIN squ:=x*x END" "block" \ pl0 rule parse parse-result-remaining empty? + "PROCEDURE square; BEGIN squ:=x*x END" "block" \ pl0 rule parse remaining>> empty? ] unit-test { t } [ @@ -57,7 +58,7 @@ BEGIN x := x + 1; END END. -"> pl0 parse-result-remaining empty? +"> pl0 remaining>> empty? ] unit-test { f } [ @@ -123,5 +124,5 @@ BEGIN y := 36; CALL gcd; END. - "> pl0 parse-result-remaining empty? + "> pl0 remaining>> empty? ] unit-test \ No newline at end of file diff --git a/extra/peg/pl0/pl0.factor b/extra/peg/pl0/pl0.factor index 1b97814ca7..eff923dc01 100644 --- a/extra/peg/pl0/pl0.factor +++ b/extra/peg/pl0/pl0.factor @@ -7,52 +7,22 @@ IN: peg.pl0 #! Grammar for PL/0 based on http://en.wikipedia.org/wiki/PL/0 EBNF: pl0 -_ = (" " | "\t" | "\n")* => [[ drop ignore ]] -BEGIN = "BEGIN" _ -CALL = "CALL" _ -CONST = "CONST" _ -DO = "DO" _ -END = "END" _ -IF = "IF" _ -THEN = "THEN" _ -ODD = "ODD" _ -PROCEDURE = "PROCEDURE" _ -VAR = "VAR" _ -WHILE = "WHILE" _ -EQ = "=" _ -LTEQ = "<=" _ -LT = "<" _ -GT = ">" _ -GTEQ = ">=" _ -NEQ = "#" _ -COMMA = "," _ -SEMICOLON = ";" _ -ASSIGN = ":=" _ - -ADD = "+" _ -SUBTRACT = "-" _ -MULTIPLY = "*" _ -DIVIDE = "/" _ - -LPAREN = "(" _ -RPAREN = ")" _ - -block = ( CONST ident EQ number ( COMMA ident EQ number )* SEMICOLON )? - ( VAR ident ( COMMA ident )* SEMICOLON )? - ( PROCEDURE ident SEMICOLON ( block SEMICOLON )? )* statement -statement = ( ident ASSIGN expression - | CALL ident - | BEGIN statement ( SEMICOLON statement )* END - | IF condition THEN statement - | WHILE condition DO statement )? -condition = ODD expression - | expression (EQ | NEQ | LTEQ | LT | GTEQ | GT) expression -expression = (ADD | SUBTRACT)? term ( (ADD | SUBTRACT) term )* _ -term = factor ( (MULTIPLY | DIVIDE) factor )* -factor = ident | number | LPAREN expression RPAREN -ident = (([a-zA-Z])+) _ => [[ >string ]] +block = { "CONST" ident "=" number { "," ident "=" number }* ";" }? + { "VAR" ident { "," ident }* ";" }? + { "PROCEDURE" ident ";" { block ";" }? }* statement +statement = { ident ":=" expression + | "CALL" ident + | "BEGIN" statement { ";" statement }* "END" + | "IF" condition "THEN" statement + | "WHILE" condition "DO" statement }? +condition = { "ODD" expression } + | { expression ("=" | "#" | "<=" | "<" | ">=" | ">") expression } +expression = {"+" | "-"}? term { {"+" | "-"} term }* +term = factor { {"*" | "/"} factor }* +factor = ident | number | "(" expression ")" +ident = (([a-zA-Z])+) => [[ >string ]] digit = ([0-9]) => [[ digit> ]] -number = ((digit)+) _ => [[ 10 digits>integer ]] -program = _ block "." +number = (digit)+ => [[ 10 digits>integer ]] +program = { block "." } ;EBNF diff --git a/extra/peg/search/search.factor b/extra/peg/search/search.factor index 21a111f6f7..7ab7e83d12 100755 --- a/extra/peg/search/search.factor +++ b/extra/peg/search/search.factor @@ -17,14 +17,14 @@ MEMO: any-char-parser ( -- parser ) : search ( string parser -- seq ) any-char-parser [ drop f ] action 2array choice repeat0 parse dup [ - parse-result-ast [ ] subset + parse-result-ast sift ] [ drop { } ] if ; : (replace) ( string parser -- seq ) - any-char-parser 2array choice repeat0 parse parse-result-ast [ ] subset ; + any-char-parser 2array choice repeat0 parse parse-result-ast sift ; : replace ( string parser -- result ) [ (replace) [ tree-write ] each ] with-string-writer ; diff --git a/extra/persistent-vectors/authors.txt b/extra/persistent-vectors/authors.txt new file mode 100644 index 0000000000..1901f27a24 --- /dev/null +++ b/extra/persistent-vectors/authors.txt @@ -0,0 +1 @@ +Slava Pestov diff --git a/extra/persistent-vectors/persistent-vectors-docs.factor b/extra/persistent-vectors/persistent-vectors-docs.factor new file mode 100644 index 0000000000..dc9222cedb --- /dev/null +++ b/extra/persistent-vectors/persistent-vectors-docs.factor @@ -0,0 +1,53 @@ +USING: help.markup help.syntax kernel math sequences ; +IN: persistent-vectors + +HELP: new-nth +{ $values { "val" object } { "i" integer } { "seq" sequence } { "seq'" sequence } } +{ $contract "Persistent analogue of " { $link set-nth } ". Outputs a new sequence with the " { $snippet "i" } "th element replaced by " { $snippet "val" } "." } +{ $notes "This operation runs in " { $snippet "O(log_32 n)" } " time on " { $link persistent-vector } " instances and " { $snippet "O(n)" } " time on all other sequences." } ; + +HELP: ppush +{ $values { "val" object } { "seq" sequence } { "seq'" sequence } } +{ $contract "Persistent analogue of " { $link push } ". Outputs a new sequence with all elements of " { $snippet "seq" } " together with " { $snippet "val" } " added at the end." } +{ $notes "This operation runs in amortized " { $snippet "O(1)" } " time on " { $link persistent-vector } " instances and " { $snippet "O(n)" } " time on all other sequences." } ; + +HELP: ppop +{ $values { "seq" sequence } { "seq'" sequence } } +{ $contract "Persistent analogue of " { $link pop* } ". Outputs a new sequence with all elements of " { $snippet "seq" } " except for the final element." } +{ $notes "This operation runs in amortized " { $snippet "O(1)" } " time on " { $link persistent-vector } " instances and " { $snippet "O(n)" } " time on all other sequences." } ; + +HELP: PV{ +{ $syntax "elements... }" } +{ $description "Parses a literal " { $link persistent-vector } "." } ; + +HELP: >persistent-vector +{ $values { "seq" sequence } { "pvec" persistent-vector } } +{ $description "Creates a " { $link persistent-vector } " with the same elements as " { $snippet "seq" } "." } ; + +HELP: persistent-vector +{ $class-description "The class of persistent vectors." } ; + +HELP: pempty +{ $values { "pvec" persistent-vector } } +{ $description "Outputs an empty " { $link persistent-vector } "." } ; + +ARTICLE: "persistent-vectors" "Persistent vectors" +"A " { $emphasis "persistent vector" } " differs from an ordinary vector (" { $link "vectors" } ") in that it is immutable, and all operations yield new persistent vectors instead of modifying inputs. Unlike immutable operations on ordinary sequences, persistent vector operations are efficient and run in sub-linear time." +$nl +"The class of persistent vectors:" +{ $subsection persistent-vector } +"Persistent vectors support the immutable sequence protocol, namely as " { $link length } " and " { $link nth } ", and so can be used with most sequence words (" { $link "sequences" } ")." +$nl +"In addition to standard sequence operations, persistent vectors implement efficient operations specific to them. They run in sub-linear time on persistent vectors, and degrate to linear-time algorithms on ordinary sequences:" +{ $subsection new-nth } +{ $subsection ppush } +{ $subsection ppop } +"The empty persistent vector, used for building up all other persistent vectors:" +{ $subsection pempty } +"Converting a sequence into a persistent vector:" +{ $subsection >persistent-vector } +"Persistent vectors have a literal syntax:" +{ $subsection POSTPONE: PV{ } +"This implementation of persistent vectors is based on the " { $snippet "clojure.lang.PersistentVector" } " class from Rich Hickey's Clojure language for the JVM (" { $url "http://clojure.org" } ")." ; + +ABOUT: "persistent-vectors" diff --git a/extra/persistent-vectors/persistent-vectors-tests.factor b/extra/persistent-vectors/persistent-vectors-tests.factor new file mode 100644 index 0000000000..f871c95e16 --- /dev/null +++ b/extra/persistent-vectors/persistent-vectors-tests.factor @@ -0,0 +1,63 @@ +IN: persistent-vectors.tests +USING: tools.test persistent-vectors sequences kernel arrays +random namespaces vectors math math.order ; + +\ new-nth must-infer +\ ppush must-infer +\ ppop must-infer + +[ 0 ] [ pempty length ] unit-test + +[ 1 ] [ 3 pempty ppush length ] unit-test + +[ 3 ] [ 3 pempty ppush first ] unit-test + +[ PV{ 3 1 3 3 7 } ] [ + pempty { 3 1 3 3 7 } [ swap ppush ] each +] unit-test + +[ { 3 1 3 3 7 } ] [ + pempty { 3 1 3 3 7 } [ swap ppush ] each >array +] unit-test + +{ 100 1060 2000 10000 100000 1000000 } [ + [ t ] swap [ dup >persistent-vector sequence= ] curry unit-test +] each + +[ ] [ 10000 [ drop 16 random-bits ] PV{ } map-as "1" set ] unit-test +[ ] [ "1" get >vector "2" set ] unit-test + +[ t ] [ + 3000 [ + drop + 16 random-bits 10000 random + [ "1" [ new-nth ] change ] + [ "2" [ new-nth ] change ] 2bi + "1" get "2" get sequence= + ] all? +] unit-test + +[ PV{ } ppop ] [ empty-error? ] must-fail-with + +[ t ] [ PV{ 3 } ppop empty? ] unit-test + +[ PV{ 3 7 } ] [ PV{ 3 7 6 } ppop ] unit-test + +[ PV{ 3 7 6 5 } ] [ 5 PV{ 3 7 6 } ppush ] unit-test + +[ ] [ PV{ } "1" set ] unit-test +[ ] [ V{ } clone "2" set ] unit-test + +[ t ] [ + 100 [ + drop + 100 random [ + 16 random-bits [ "1" [ ppush ] change ] [ "2" get push ] bi + ] times + 100 random "1" get length min [ + "1" [ ppop ] change + "2" get pop* + ] times + "1" get "2" get sequence= + ] all? +] unit-test diff --git a/extra/persistent-vectors/persistent-vectors.factor b/extra/persistent-vectors/persistent-vectors.factor new file mode 100644 index 0000000000..f9f4b68933 --- /dev/null +++ b/extra/persistent-vectors/persistent-vectors.factor @@ -0,0 +1,183 @@ +! Based on Clojure's PersistentVector by Rich Hickey. + +USING: math accessors kernel sequences.private sequences arrays +combinators parser prettyprint.backend ; +IN: persistent-vectors + +ERROR: empty-error pvec ; + +GENERIC: ppush ( val seq -- seq' ) + +M: sequence ppush swap suffix ; + +GENERIC: ppop ( seq -- seq' ) + +M: sequence ppop 1 head* ; + +GENERIC: new-nth ( val i seq -- seq' ) + +M: sequence new-nth clone [ set-nth ] keep ; + +TUPLE: persistent-vector count root tail ; + +M: persistent-vector length count>> ; + +> ] bi* nth ; inline + +: body-nth ( i node -- i node' ) + dup level>> [ + dupd [ level>> node-shift ] keep node-nth + ] times ; inline + +: tail-offset ( pvec -- n ) + [ count>> ] [ tail>> children>> length ] bi - ; + +M: persistent-vector nth-unsafe + 2dup tail-offset >= + [ tail>> ] [ root>> body-nth ] if + node-nth ; + +: node-add ( val node -- node' ) + clone [ ppush ] change-children ; + +: ppush-tail ( val pvec -- pvec' ) + [ node-add ] change-tail ; + +: full? ( node -- ? ) + children>> length node-size = ; + +: 1node ( val level -- node ) + node new + swap >>level + swap 1array >>children ; + +: 2node ( first second -- node ) + [ 2array ] [ drop level>> 1+ ] 2bi node boa ; + +: new-child ( new-child node -- node' expansion/f ) + dup full? [ tuck level>> 1node ] [ node-add f ] if ; + +: new-last ( val seq -- seq' ) + [ length 1- ] keep new-nth ; + +: node-set-last ( child node -- node' ) + clone [ new-last ] change-children ; + +: (ppush-new-tail) ( tail node -- node' expansion/f ) + dup level>> 1 = [ + new-child + ] [ + tuck children>> peek (ppush-new-tail) + [ swap new-child ] [ swap node-set-last f ] ?if + ] if ; + +: do-expansion ( pvec root expansion/f -- pvec ) + [ 2node ] when* >>root ; + +: ppush-new-tail ( val pvec -- pvec' ) + [ ] [ tail>> ] [ root>> ] tri + (ppush-new-tail) do-expansion + swap 0 1node >>tail ; + +M: persistent-vector ppush ( val pvec -- pvec' ) + clone + dup tail>> full? + [ ppush-new-tail ] [ ppush-tail ] if + [ 1+ ] change-count ; + +: node-set-nth ( val i node -- node' ) + clone [ new-nth ] change-children ; + +: node-change-nth ( i node quot -- node' ) + [ clone ] dip [ + [ clone ] dip [ change-nth ] 2keep drop + ] curry change-children ; inline + +: (new-nth) ( val i node -- node' ) + dup level>> 0 = [ + [ node-mask ] dip node-set-nth + ] [ + [ dupd level>> node-shift node-mask ] keep + [ (new-nth) ] node-change-nth + ] if ; + +M: persistent-vector new-nth ( obj i pvec -- pvec' ) + 2dup count>> = [ nip ppush ] [ + clone + 2dup tail-offset >= [ + [ node-mask ] dip + [ node-set-nth ] change-tail + ] [ + [ (new-nth) ] change-root + ] if + ] if ; + +: (ppop-contraction) ( node -- node' tail' ) + clone [ unclip-last swap ] change-children swap ; + +: ppop-contraction ( node -- node' tail' ) + [ (ppop-contraction) ] [ level>> 1 = ] bi swap and ; + +: (ppop-new-tail) ( root -- root' tail' ) + dup level>> 1 > [ + dup children>> peek (ppop-new-tail) over children>> empty? + [ 2drop ppop-contraction ] [ [ swap node-set-last ] dip ] if + ] [ + ppop-contraction + ] if ; + +: ppop-tail ( pvec -- pvec' ) + [ clone [ ppop ] change-children ] change-tail ; + +: ppop-new-tail ( pvec -- pvec' ) + dup root>> (ppop-new-tail) + [ + dup [ level>> 1 > ] [ children>> length 1 = ] bi and + [ children>> first ] when + ] dip + [ >>root ] [ >>tail ] bi* ; + +PRIVATE> + +: pempty ( -- pvec ) + T{ persistent-vector f 0 T{ node f { } 1 } T{ node f { } 0 } } ; inline + +M: persistent-vector ppop ( pvec -- pvec' ) + dup count>> { + { 0 [ empty-error ] } + { 1 [ drop pempty ] } + [ + [ + clone + dup tail>> children>> length 1 > + [ ppop-tail ] [ ppop-new-tail ] if + ] dip 1- >>count + ] + } case ; + +M: persistent-vector like + drop pempty [ swap ppush ] reduce ; + +M: persistent-vector equal? + over persistent-vector? [ sequence= ] [ 2drop f ] if ; + +: >persistent-vector ( seq -- pvec ) pempty like ; inline + +: PV{ \ } [ >persistent-vector ] parse-literal ; parsing + +M: persistent-vector pprint-delims drop \ PV{ \ } ; + +M: persistent-vector >pprint-sequence ; + +INSTANCE: persistent-vector immutable-sequence diff --git a/extra/persistent-vectors/summary.txt b/extra/persistent-vectors/summary.txt new file mode 100644 index 0000000000..19f3f66ca3 --- /dev/null +++ b/extra/persistent-vectors/summary.txt @@ -0,0 +1 @@ +Immutable vectors with O(log_32 n) random access and amortized O(1) push/pop diff --git a/extra/persistent-vectors/tags.txt b/extra/persistent-vectors/tags.txt new file mode 100644 index 0000000000..42d711b32b --- /dev/null +++ b/extra/persistent-vectors/tags.txt @@ -0,0 +1 @@ +collections diff --git a/extra/porter-stemmer/porter-stemmer-tests.factor b/extra/porter-stemmer/porter-stemmer-tests.factor index da0658f94d..42c358646b 100644 --- a/extra/porter-stemmer/porter-stemmer-tests.factor +++ b/extra/porter-stemmer/porter-stemmer-tests.factor @@ -56,11 +56,9 @@ io.files io.encodings.utf8 ; [ "hell" ] [ "hell" step5 "" like ] unit-test [ "mate" ] [ "mate" step5 "" like ] unit-test -: resource-lines resource-path utf8 file-lines ; - [ { } ] [ - "extra/porter-stemmer/test/voc.txt" resource-lines + "resource:extra/porter-stemmer/test/voc.txt" utf8 file-lines [ stem ] map - "extra/porter-stemmer/test/output.txt" resource-lines - [ 2array ] 2map [ first2 = not ] subset + "resource:extra/porter-stemmer/test/output.txt" utf8 file-lines + [ 2array ] 2map [ first2 = not ] filter ] unit-test diff --git a/extra/porter-stemmer/porter-stemmer.factor b/extra/porter-stemmer/porter-stemmer.factor index 81820e0152..9a2a08bcbe 100644 --- a/extra/porter-stemmer/porter-stemmer.factor +++ b/extra/porter-stemmer/porter-stemmer.factor @@ -66,8 +66,6 @@ USING: kernel math parser sequences combinators splitting ; : r ( str oldsuffix newsuffix -- str ) pick consonant-seq 0 > [ nip ] [ drop ] if append ; -: butlast ( seq -- seq ) 1 head-slice* ; - : step1a ( str -- newstr ) dup peek CHAR: s = [ { @@ -95,7 +93,7 @@ USING: kernel math parser sequences combinators splitting ; { [ "iz" ?tail ] [ "ize" append ] } { [ dup length 1- over double-consonant? ] - [ dup "lsz" last-is? [ butlast ] unless ] + [ dup "lsz" last-is? [ but-last-slice ] unless ] } { [ t ] @@ -122,7 +120,7 @@ USING: kernel math parser sequences combinators splitting ; } cond ; : step1c ( str -- newstr ) - dup butlast stem-vowel? [ + dup but-last-slice stem-vowel? [ "y" ?tail [ "i" append ] when ] when ; @@ -198,18 +196,18 @@ USING: kernel math parser sequences combinators splitting ; : remove-e? ( str -- ? ) dup consonant-seq dup 1 > [ 2drop t ] - [ 1 = [ butlast cvc? not ] [ drop f ] if ] if ; + [ 1 = [ but-last-slice cvc? not ] [ drop f ] if ] if ; : remove-e ( str -- newstr ) dup peek CHAR: e = [ - dup remove-e? [ butlast ] when + dup remove-e? [ but-last-slice ] when ] when ; : ll->l ( str -- newstr ) { { [ dup peek CHAR: l = not ] [ ] } { [ dup length 1- over double-consonant? not ] [ ] } - { [ dup consonant-seq 1 > ] [ butlast ] } + { [ dup consonant-seq 1 > ] [ but-last-slice ] } [ ] } cond ; diff --git a/extra/present/present.factor b/extra/present/present.factor new file mode 100644 index 0000000000..d3aec20d80 --- /dev/null +++ b/extra/present/present.factor @@ -0,0 +1,17 @@ +USING: math math.parser calendar calendar.format strings words +kernel effects ; +IN: present + +GENERIC: present ( object -- string ) + +M: real present number>string ; + +M: timestamp present timestamp>string ; + +M: string present ; + +M: word present word-name ; + +M: effect present effect>string ; + +M: f present drop "" ; diff --git a/extra/processing/gallery/trails/trails.factor b/extra/processing/gallery/trails/trails.factor index dc191bc439..5abe23bb90 100644 --- a/extra/processing/gallery/trails/trails.factor +++ b/extra/processing/gallery/trails/trails.factor @@ -1,5 +1,5 @@ -USING: kernel arrays sequences math qualified +USING: kernel arrays sequences math math.order qualified sequences.lib circular processing ui newfx ; IN: processing.gallery.trails @@ -44,4 +44,4 @@ IN: processing.gallery.trails : go ( -- ) [ go* ] with-ui ; -MAIN: go \ No newline at end of file +MAIN: go diff --git a/extra/project-euler/001/001.factor b/extra/project-euler/001/001.factor index 7d77e86fec..843f8b87ba 100644 --- a/extra/project-euler/001/001.factor +++ b/extra/project-euler/001/001.factor @@ -30,7 +30,7 @@ IN: project-euler.001 ! ------------------- : euler001a ( -- answer ) - 1000 [ dup 5 mod swap 3 mod [ zero? ] either? ] subset sum ; + 1000 [ dup 5 mod swap 3 mod [ zero? ] either? ] filter sum ; ! [ euler001a ] 100 ave-time ! 0 ms run / 0 ms GC ave time - 100 trials diff --git a/extra/project-euler/002/002.factor b/extra/project-euler/002/002.factor index b660ed0958..108f5c1e94 100644 --- a/extra/project-euler/002/002.factor +++ b/extra/project-euler/002/002.factor @@ -30,7 +30,7 @@ PRIVATE> V{ 0 } clone 1 rot (fib-upto) ; : euler002 ( -- answer ) - 1000000 fib-upto [ even? ] subset sum ; + 1000000 fib-upto [ even? ] filter sum ; ! [ euler002 ] 100 ave-time ! 0 ms run / 0 ms GC ave time - 100 trials @@ -41,10 +41,10 @@ PRIVATE> : fib-upto* ( n -- seq ) 0 1 [ pick over >= ] [ tuck + dup ] [ ] unfold 3nip - 1 head-slice* { 0 1 } prepend ; + but-last-slice { 0 1 } prepend ; : euler002a ( -- answer ) - 1000000 fib-upto* [ even? ] subset sum ; + 1000000 fib-upto* [ even? ] filter sum ; ! [ euler002a ] 100 ave-time ! 0 ms run / 0 ms GC ave time - 100 trials diff --git a/extra/project-euler/004/004.factor b/extra/project-euler/004/004.factor index b2146b4aea..1f268f1500 100644 --- a/extra/project-euler/004/004.factor +++ b/extra/project-euler/004/004.factor @@ -21,7 +21,7 @@ IN: project-euler.004 append ; : abundants-upto ( n -- seq ) - [1,b] [ abundant? ] subset ; + [1,b] [ abundant? ] filter ; : possible-sums ( seq -- seq ) dup { } -rot [ dupd [ + ] curry map - rot append prune swap 1 tail + rot append prune swap rest ] each drop natural-sort ; PRIVATE> : euler023 ( -- answer ) - 20161 abundants-upto possible-sums source-023 diff sum ; + source-023 + 20161 abundants-upto possible-sums diff sum ; ! TODO: solution is still too slow, although it takes under 1 minute diff --git a/extra/project-euler/026/026.factor b/extra/project-euler/026/026.factor index f1f546ec1c..8cbf20d0bf 100644 --- a/extra/project-euler/026/026.factor +++ b/extra/project-euler/026/026.factor @@ -34,7 +34,7 @@ IN: project-euler.026 : euler030 ( -- answer ) - 325537 [ dup sum-fifth-powers = ] subset sum 1- ; + 325537 [ dup sum-fifth-powers = ] filter sum 1- ; ! [ euler030 ] 100 ave-time ! 2537 ms run / 125 ms GC ave time - 100 trials diff --git a/extra/project-euler/032/032.factor b/extra/project-euler/032/032.factor index 7b24004df6..68b42ca442 100755 --- a/extra/project-euler/032/032.factor +++ b/extra/project-euler/032/032.factor @@ -46,7 +46,7 @@ IN: project-euler.032 PRIVATE> : euler032 ( -- answer ) - source-032 [ valid? ] subset products prune sum ; + source-032 [ valid? ] filter products prune sum ; ! [ euler032 ] 10 ave-time ! 23922 ms run / 1505 ms GC ave time - 10 trials @@ -70,7 +70,7 @@ PRIVATE> PRIVATE> : euler032a ( -- answer ) - source-032a [ mmp ] map [ pandigital? ] subset products prune sum ; + source-032a [ mmp ] map [ pandigital? ] filter products prune sum ; ! [ euler032a ] 100 ave-time ! 5978 ms run / 327 ms GC ave time - 100 trials diff --git a/extra/project-euler/033/033.factor b/extra/project-euler/033/033.factor index 35b1c87e7a..8cb0dc45c3 100644 --- a/extra/project-euler/033/033.factor +++ b/extra/project-euler/033/033.factor @@ -30,7 +30,7 @@ IN: project-euler.033 diff --git a/extra/project-euler/034/034.factor b/extra/project-euler/034/034.factor index c15d722266..cf73ee828b 100644 --- a/extra/project-euler/034/034.factor +++ b/extra/project-euler/034/034.factor @@ -39,7 +39,7 @@ IN: project-euler.034 PRIVATE> : euler034 ( -- answer ) - 3 2000000 [a,b] [ factorion? ] subset sum ; + 3 2000000 [a,b] [ factorion? ] filter sum ; ! [ euler034 ] 10 ave-time ! 15089 ms run / 725 ms GC ave time - 10 trials diff --git a/extra/project-euler/035/035.factor b/extra/project-euler/035/035.factor index c362e1e1a5..cec9bc6957 100755 --- a/extra/project-euler/035/035.factor +++ b/extra/project-euler/035/035.factor @@ -28,7 +28,7 @@ IN: project-euler.035 : possible? ( seq -- ? ) dup length 1 > [ - dup { 0 2 4 5 6 8 } swap diff = + dup { 0 2 4 5 6 8 } diff = ] [ drop t ] if ; @@ -50,7 +50,7 @@ IN: project-euler.035 PRIVATE> : euler035 ( -- answer ) - source-035 [ possible? ] subset [ circular? ] count ; + source-035 [ possible? ] filter [ circular? ] count ; ! [ euler035 ] 100 ave-time ! 904 ms run / 86 ms GC ave time - 100 trials diff --git a/extra/project-euler/036/036.factor b/extra/project-euler/036/036.factor index 3ca1c73f39..153901ce6d 100644 --- a/extra/project-euler/036/036.factor +++ b/extra/project-euler/036/036.factor @@ -32,7 +32,7 @@ IN: project-euler.036 PRIVATE> : euler036 ( -- answer ) - 1 1000000 2 [ both-bases? ] subset sum ; + 1 1000000 2 [ both-bases? ] filter sum ; ! [ euler036 ] 100 ave-time ! 3891 ms run / 173 ms GC ave time - 100 trials diff --git a/extra/project-euler/037/037.factor b/extra/project-euler/037/037.factor index 66b1665037..a5bc0581e6 100755 --- a/extra/project-euler/037/037.factor +++ b/extra/project-euler/037/037.factor @@ -44,7 +44,7 @@ IN: project-euler.037 PRIVATE> : euler037 ( -- answer ) - 23 1000000 primes-between [ r-trunc? ] subset [ l-trunc? ] subset sum ; + 23 1000000 primes-between [ r-trunc? ] filter [ l-trunc? ] filter sum ; ! [ euler037 ] 100 ave-time ! 768 ms run / 9 ms GC ave time - 100 trials diff --git a/extra/project-euler/038/038.factor b/extra/project-euler/038/038.factor index 2369db25fb..78e3848a33 100755 --- a/extra/project-euler/038/038.factor +++ b/extra/project-euler/038/038.factor @@ -47,7 +47,7 @@ IN: project-euler.038 PRIVATE> : euler038 ( -- answer ) - 9123 9876 [a,b] [ concat-product ] map [ pandigital? ] subset supremum ; + 9123 9876 [a,b] [ concat-product ] map [ pandigital? ] filter supremum ; ! [ euler038 ] 100 ave-time ! 37 ms run / 1 ms GC ave time - 100 trials diff --git a/extra/project-euler/042/042.factor b/extra/project-euler/042/042.factor index a87722debc..4111fe8009 100644 --- a/extra/project-euler/042/042.factor +++ b/extra/project-euler/042/042.factor @@ -30,8 +30,8 @@ IN: project-euler.042 [ diff --git a/extra/project-euler/043/043.factor b/extra/project-euler/043/043.factor index 0d1eb00bfa..41e378e531 100644 --- a/extra/project-euler/043/043.factor +++ b/extra/project-euler/043/043.factor @@ -53,7 +53,7 @@ PRIVATE> : euler043 ( -- answer ) 1234567890 number>digits all-permutations - [ interesting? ] subset [ 10 digits>integer ] map sum ; + [ interesting? ] filter [ 10 digits>integer ] map sum ; ! [ euler043 ] time ! 125196 ms run / 19548 ms GC time @@ -70,20 +70,20 @@ PRIVATE> [ number>digits 3 0 pad-left ] map [ all-unique? ] subset ; + 1000 over [ number>digits 3 0 pad-left ] map [ all-unique? ] filter ; : overlap? ( seq -- ? ) dup first 2 tail* swap second 2 head = ; : clean ( seq -- seq ) - [ unclip 1 head prefix concat ] map [ all-unique? ] subset ; + [ unclip 1 head prefix concat ] map [ all-unique? ] filter ; : add-missing-digit ( seq -- seq ) - dup natural-sort 10 diff first prefix ; + dup natural-sort 10 swap diff first prefix ; : interesting-pandigitals ( -- seq ) 17 candidates { 13 11 7 5 3 2 } [ - candidates swap cartesian-product [ overlap? ] subset clean + candidates swap cartesian-product [ overlap? ] filter clean ] each [ add-missing-digit ] map ; PRIVATE> diff --git a/extra/project-euler/044/044.factor b/extra/project-euler/044/044.factor index bc8aec8bde..eaa6bf96ef 100644 --- a/extra/project-euler/044/044.factor +++ b/extra/project-euler/044/044.factor @@ -37,7 +37,7 @@ PRIVATE> : euler044 ( -- answer ) 2500 [1,b] [ nth-pentagonal ] map dup cartesian-product - [ first2 sum-and-diff? ] subset [ first2 - abs ] map infimum ; + [ first2 sum-and-diff? ] filter [ first2 - abs ] map infimum ; ! [ euler044 ] 10 ave-time ! 8924 ms run / 2872 ms GC ave time - 10 trials diff --git a/extra/project-euler/047/047.factor b/extra/project-euler/047/047.factor index 98e819a7db..e59ca56f39 100644 --- a/extra/project-euler/047/047.factor +++ b/extra/project-euler/047/047.factor @@ -35,8 +35,8 @@ IN: project-euler.047 pick pick = [ swap - nip ] [ - dup prime? [ [ drop 0 ] dipd ] [ - 2dup unique-factors length = [ [ 1+ ] dipd ] [ [ drop 0 ] dipd ] if + dup prime? [ [ drop 0 ] 2dip ] [ + 2dup unique-factors length = [ [ 1+ ] 2dip ] [ [ drop 0 ] 2dip ] if ] if 1+ (consecutive) ] if ; diff --git a/extra/project-euler/059/059.factor b/extra/project-euler/059/059.factor index bb95ab9024..63a8e3e2c4 100644 --- a/extra/project-euler/059/059.factor +++ b/extra/project-euler/059/059.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: arrays ascii assocs hashtables io.encodings.ascii io.files kernel math math.parser namespaces sequences sequences.lib sequences.private sorting - splitting strings sets ; + splitting grouping strings sets ; IN: project-euler.059 ! http://projecteuler.net/index.php?section=problems&id=59 @@ -52,7 +52,7 @@ IN: project-euler.059 number ] map ; @@ -78,7 +78,7 @@ INSTANCE: rollover immutable-sequence frequency-analysis sort-values keys peek ; : crack-key ( seq key-length -- key ) - [ " " decrypt ] dip group 1 head-slice* + [ " " decrypt ] dip group but-last-slice flip [ most-frequent ] map ; PRIVATE> diff --git a/extra/project-euler/067/067.factor b/extra/project-euler/067/067.factor index 436ccde776..3e16996e04 100644 --- a/extra/project-euler/067/067.factor +++ b/extra/project-euler/067/067.factor @@ -38,7 +38,7 @@ IN: project-euler.067 number ] map ] map ; PRIVATE> diff --git a/extra/project-euler/076/076.factor b/extra/project-euler/076/076.factor index b09a2742c3..782d6d0429 100644 --- a/extra/project-euler/076/076.factor +++ b/extra/project-euler/076/076.factor @@ -1,6 +1,7 @@ ! Copyright (c) 2008 Eric Mertens ! See http://factorcode.org/license.txt for BSD license. -USING: arrays assocs combinators kernel math sequences math.ranges locals ; +USING: arrays assocs combinators kernel math sequences +math.order math.ranges locals ; IN: project-euler.076 ! http://projecteuler.net/index.php?section=problems&id=76 diff --git a/extra/project-euler/079/079.factor b/extra/project-euler/079/079.factor index 452a64af44..cde4dc079b 100644 --- a/extra/project-euler/079/079.factor +++ b/extra/project-euler/079/079.factor @@ -27,7 +27,7 @@ IN: project-euler.079 edges ( seq -- seq ) [ @@ -35,11 +35,11 @@ IN: project-euler.079 ] { } make ; : find-source ( seq -- elt ) - dup values swap keys [ prune ] bi@ diff + [ keys ] [ values ] bi diff prune dup empty? [ "Topological sort failed" throw ] [ first ] if ; : remove-source ( seq elt -- seq ) - [ swap member? not ] curry subset ; + [ swap member? not ] curry filter ; : (topological-sort) ( seq -- ) dup length 1 > [ @@ -52,7 +52,7 @@ PRIVATE> : topological-sort ( seq -- seq ) [ [ (topological-sort) ] { } make ] keep - concat prune dupd diff append ; + concat prune over diff append ; : euler079 ( -- answer ) source-079 >edges topological-sort 10 digits>integer ; diff --git a/extra/project-euler/117/117.factor b/extra/project-euler/117/117.factor index 5056560a85..3a05261710 100644 --- a/extra/project-euler/117/117.factor +++ b/extra/project-euler/117/117.factor @@ -1,6 +1,6 @@ ! Copyright (c) 2008 Eric Mertens ! See http://factorcode.org/license.txt for BSD license. -USING: kernel math splitting sequences ; +USING: kernel math math.order splitting sequences ; IN: project-euler.117 diff --git a/extra/project-euler/134/134.factor b/extra/project-euler/134/134.factor index fb7fdebd51..4e54a18f19 100644 --- a/extra/project-euler/134/134.factor +++ b/extra/project-euler/134/134.factor @@ -1,7 +1,7 @@ ! Copyright (c) 2007 Samuel Tardieu. ! See http://factorcode.org/license.txt for BSD license. -USING: arrays kernel lazy-lists math.algebra math math.functions math.primes - math.ranges project-euler.common sequences ; +USING: arrays kernel lists lists.lazy math.algebra math math.functions + math.order math.primes math.ranges project-euler.common sequences ; IN: project-euler.134 ! http://projecteuler.net/index.php?section=problems&id=134 @@ -39,7 +39,7 @@ IN: project-euler.134 PRIVATE> : euler134 ( -- answer ) - 0 5 lprimes-from uncons [ 1000000 > ] luntil + 0 5 lprimes-from uncons swap [ 1000000 > ] luntil [ [ s + ] keep ] leach drop ; ! [ euler134 ] 10 ave-time diff --git a/extra/project-euler/150/150.factor b/extra/project-euler/150/150.factor index c96c1ebc73..8c93d4f7e6 100644 --- a/extra/project-euler/150/150.factor +++ b/extra/project-euler/150/150.factor @@ -1,6 +1,7 @@ ! Copyright (c) 2008 Eric Mertens ! See http://factorcode.org/license.txt for BSD license. -USING: kernel math sequences sequences.private locals hints ; +USING: kernel math math.order sequences sequences.private +locals hints ; IN: project-euler.150 - : collect-benchmarks ( quot n -- seq ) [ - >r >r datastack r> [ benchmark 2array , ] curry tuck + >r >r datastack r> [ benchmark , ] curry tuck [ with-datastack drop ] 2curry r> swap times call ] { } make ; : ave-time ( quot n -- ) - [ collect-benchmarks ] keep swap ave-benchmarks [ - dup second # " ms run / " % first # " ms GC ave time - " % # " trials" % + [ collect-benchmarks ] keep swap mean round [ + # " ms run time - " % # " trials" % ] "" make print flush ; inline diff --git a/extra/project-euler/common/common.factor b/extra/project-euler/common/common.factor index 5829f66c01..fefb986fe0 100644 --- a/extra/project-euler/common/common.factor +++ b/extra/project-euler/common/common.factor @@ -1,6 +1,6 @@ USING: arrays kernel math math.functions math.miller-rabin math.matrices - math.parser math.primes.factors math.ranges namespaces sequences - sequences.lib sorting unicode.case ; + math.order math.parser math.primes.factors math.ranges namespaces + sequences sequences.lib sorting unicode.case ; IN: project-euler.common ! A collection of words used by more than one Project Euler solution @@ -40,10 +40,10 @@ IN: project-euler.common ! Propagate one row into the upper one : propagate ( bottom top -- newtop ) - [ over 1 tail rot first2 max rot + ] map nip ; + [ over rest rot first2 max rot + ] map nip ; : shift-3rd ( seq obj obj -- seq obj obj ) - rot 1 tail -rot ; + rot rest -rot ; : (sum-divisors) ( n -- sum ) dup sqrt >fixnum [1,b] [ @@ -95,7 +95,7 @@ PRIVATE> ! Not strictly needed, but it is nice to be able to dump the triangle after the ! propagation : propagate-all ( triangle -- newtriangle ) - reverse [ first dup ] keep 1 tail [ propagate dup ] map nip reverse swap suffix ; + reverse [ first dup ] keep rest [ propagate dup ] map nip reverse swap suffix ; : sum-divisors ( n -- sum ) dup 4 < [ { 0 1 3 4 } nth ] [ (sum-divisors) ] if ; diff --git a/extra/promises/promises-docs.factor b/extra/promises/promises-docs.factor index ade3357f34..c482df0d15 100755 --- a/extra/promises/promises-docs.factor +++ b/extra/promises/promises-docs.factor @@ -29,6 +29,6 @@ HELP: LAZY: { $values { "word" "a new word to define" } { "definition" "a word definition" } } { $description "Creates a lazy word in the current vocabulary. When executed the word will return a " { $link promise } " that when forced, executes the word definition. Any values on the stack that are required by the word definition are captured along with the promise." } { $examples - { $example "USING: math prettyprint promises ;" "LAZY: my-add ( a b -- c ) + ;" "1 2 my-add force ." "3" } + { $example "USING: arrays sequences prettyprint promises ;" "IN: scratchpad" "LAZY: zeroes ( -- pair ) 0 zeroes 2array ;" "zeroes force second force first ." "0" } } { $see-also force promise-with promise-with2 } ; diff --git a/extra/qualified/qualified-docs.factor b/extra/qualified/qualified-docs.factor index d336d31114..d62f696a74 100755 --- a/extra/qualified/qualified-docs.factor +++ b/extra/qualified/qualified-docs.factor @@ -8,26 +8,26 @@ HELP: QUALIFIED: "QUALIFIED: math\n1 2 math:+ ! ==> 3" } } ; HELP: QUALIFIED-WITH: -{ $syntax "QUALIFIED-WITH: vocab prefix" } -{ $description "Works like " { $link POSTPONE: QUALIFIED: } " but uses the specified prefix." } +{ $syntax "QUALIFIED-WITH: vocab word-prefix" } +{ $description "Works like " { $link POSTPONE: QUALIFIED: } " but uses " { $snippet "word-prefix" } " as prefix." } { $examples { $code "QUALIFIED-WITH: math m\n1 2 m:+ ! ==> 3" } } ; HELP: FROM: { $syntax "FROM: vocab => words ... ;" } -{ $description "Imports the specified words from vocab." } +{ $description "Imports " { $snippet "words" } " from " { $snippet "vocab" } "." } { $examples { $code "FROM: math.parser => bin> hex> ; ! imports only bin> and hex>" } } ; HELP: EXCLUDE: { $syntax "EXCLUDE: vocab => words ... ;" } -{ $description "Imports everything from vocab excluding the specified words" } +{ $description "Imports everything from " { $snippet "vocab" } " excluding " { $snippet "words" } "." } { $examples { $code - "EXCLUDE: math.parser => bin> hex> ; ! imports everythin but bin> and hex>" } } ; + "EXCLUDE: math.parser => bin> hex> ; ! imports everything but bin> and hex>" } } ; HELP: RENAME: { $syntax "RENAME: word vocab => newname " } -{ $description "Imports word from vocab, but renamed to newname." } +{ $description "Imports " { $snippet "word" } " from " { $snippet "vocab" } ", but renamed to " { $snippet "newname" } "." } { $examples { $code "RENAME: + math => -" "2 3 - ! => 5" } } ; diff --git a/extra/qualified/qualified.factor b/extra/qualified/qualified.factor index 730388ade0..5810a03f80 100644 --- a/extra/qualified/qualified.factor +++ b/extra/qualified/qualified.factor @@ -15,7 +15,7 @@ IN: qualified #! Syntax: QUALIFIED-WITH: vocab prefix scan scan define-qualified ; parsing -: expect=> scan "=>" assert= ; +: expect=> ( -- ) scan "=>" assert= ; : partial-vocab ( words name -- assoc ) dupd [ @@ -23,7 +23,7 @@ IN: qualified ] curry map zip ; : partial-vocab-ignoring ( words name -- assoc ) - [ vocab-words keys diff ] keep partial-vocab ; + [ load-vocab vocab-words keys swap diff ] keep partial-vocab ; : EXCLUDE: #! Syntax: EXCLUDE: vocab => words ... ; @@ -32,12 +32,12 @@ IN: qualified : FROM: #! Syntax: FROM: vocab => words... ; - scan expect=> + scan dup load-vocab drop expect=> ";" parse-tokens swap partial-vocab use get push ; parsing : RENAME: #! Syntax: RENAME: word vocab => newname - scan scan lookup [ "No such word" throw ] unless* + scan scan dup load-vocab drop lookup [ "No such word" throw ] unless* expect=> scan associate use get push ; parsing diff --git a/extra/random-weighted/random-weighted.factor b/extra/random-weighted/random-weighted.factor index 476fc083a7..59cc15cba6 100644 --- a/extra/random-weighted/random-weighted.factor +++ b/extra/random-weighted/random-weighted.factor @@ -7,7 +7,7 @@ IN: random-weighted : probabilities ( weights -- probabilities ) dup sum v/n ; : layers ( probabilities -- layers ) -dup length 1+ [ head ] with map 1 tail [ sum ] map ; +dup length 1+ [ head ] with map rest [ sum ] map ; : random-weighted ( weights -- elt ) probabilities layers [ 1000 * ] map 1000 random [ > ] curry find drop ; diff --git a/extra/random/blum-blum-shub/blum-blum-shub-tests.factor b/extra/random/blum-blum-shub/blum-blum-shub-tests.factor index c882dd2b4d..2a1af53232 100644 --- a/extra/random/blum-blum-shub/blum-blum-shub-tests.factor +++ b/extra/random/blum-blum-shub/blum-blum-shub-tests.factor @@ -1,5 +1,6 @@ USING: kernel math tools.test namespaces random -random.blum-blum-shub alien.c-types sequences splitting ; +random.blum-blum-shub alien.c-types sequences splitting +grouping ; IN: blum-blum-shub.tests [ 887708070 ] [ diff --git a/extra/random/mersenne-twister/mersenne-twister-tests.factor b/extra/random/mersenne-twister/mersenne-twister-tests.factor index 703a0c16e4..d25ceacdb1 100755 --- a/extra/random/mersenne-twister/mersenne-twister-tests.factor +++ b/extra/random/mersenne-twister/mersenne-twister-tests.factor @@ -1,5 +1,5 @@ USING: kernel math random namespaces random.mersenne-twister -sequences tools.test ; +sequences tools.test math.order ; IN: random.mersenne-twister.tests : check-random ( max -- ? ) diff --git a/extra/random/unix/unix.factor b/extra/random/unix/unix.factor index 6016a6e9cb..e534691ecd 100644 --- a/extra/random/unix/unix.factor +++ b/extra/random/unix/unix.factor @@ -1,4 +1,4 @@ -USING: alien.c-types io io.files io.nonblocking kernel +USING: alien.c-types io io.files io.ports kernel namespaces random io.encodings.binary init accessors system ; IN: random.unix @@ -9,7 +9,7 @@ C: unix-random : file-read-unbuffered ( n path -- bytes ) over default-buffer-size [ - binary [ read ] with-stream + binary [ read ] with-file-reader ] with-variable ; M: unix-random random-bytes* ( n tuple -- byte-array ) diff --git a/extra/random/windows/windows.factor b/extra/random/windows/windows.factor index 6f47d3e6bf..a4cf74e1df 100644 --- a/extra/random/windows/windows.factor +++ b/extra/random/windows/windows.factor @@ -1,7 +1,6 @@ USING: accessors alien.c-types byte-arrays continuations kernel windows windows.advapi32 init namespaces random destructors locals ; -USE: tools.walker IN: random.windows TUPLE: windows-rng provider type ; @@ -36,9 +35,8 @@ M: windows-crypto-context dispose ( tuple -- ) M: windows-rng random-bytes* ( n tuple -- bytes ) [ [ provider>> ] [ type>> ] bi - windows-crypto-context - dup add-always-destructor handle>> - swap dup + windows-crypto-context &dispose + handle>> swap dup [ CryptGenRandom win32-error=0/f ] keep ] with-destructors ; diff --git a/extra/regexp/regexp.factor b/extra/regexp/regexp.factor index d517db09fe..99e6b887c8 100755 --- a/extra/regexp/regexp.factor +++ b/extra/regexp/regexp.factor @@ -1,6 +1,6 @@ -USING: arrays combinators kernel lazy-lists math math.parser +USING: arrays combinators kernel lists math math.parser namespaces parser parser-combinators parser-combinators.simple -promises quotations sequences combinators.lib strings +promises quotations sequences combinators.lib strings math.order assocs prettyprint.backend memoize unicode.case unicode.categories ; USE: io IN: regexp @@ -23,9 +23,9 @@ SYMBOL: ignore-case? : or-predicates ( quots -- quot ) [ \ dup prefix ] map [ [ t ] ] f short-circuit \ nip suffix ; -: <@literal [ nip ] curry <@ ; +: <@literal ( parser obj -- action ) [ nip ] curry <@ ; -: <@delay [ curry ] curry <@ ; +: <@delay ( parser quot -- action ) [ curry ] curry <@ ; PRIVATE> @@ -135,10 +135,10 @@ PRIVATE> 'posix-character-class' <|> 'simple-escape' <|> &> ; -: 'any-char' +: 'any-char' ( -- parser ) "." token [ drop t ] <@literal ; -: 'char' +: 'char' ( -- parser ) 'any-char' 'escape' 'ordinary-char' <|> <|> [ satisfy ] <@ ; DEFER: 'regexp' @@ -291,7 +291,7 @@ TUPLE: regexp source parser ignore-case? ; : parse-regexp ( accum end -- accum ) lexer get dup skip-blank - [ [ index* dup 1+ swap ] 2keep swapd subseq swap ] change-lexer-column + [ [ index-from dup 1+ swap ] 2keep swapd subseq swap ] change-lexer-column lexer get dup still-parsing-line? [ (parse-token) parse-options ] [ drop f ] if parsed ; diff --git a/extra/reports/noise/noise.factor b/extra/reports/noise/noise.factor index c3b7311714..3537d2e719 100755 --- a/extra/reports/noise/noise.factor +++ b/extra/reports/noise/noise.factor @@ -1,7 +1,7 @@ USING: assocs math kernel shuffle combinators.lib words quotations arrays combinators sequences math.vectors io.styles prettyprint vocabs sorting io generic locals.private -math.statistics ; +math.statistics math.order ; IN: reports.noise : badness ( word -- n ) @@ -35,7 +35,7 @@ IN: reports.noise { compose 1/2 } { curry 1/3 } { dip 1 } - { dipd 2 } + { 2dip 2 } { drop 1/3 } { dup 1/3 } { if 1/3 } @@ -85,7 +85,7 @@ IN: reports.noise { spread 2 } } at 0 or ; -: vsum { 0 0 } [ v+ ] reduce ; +: vsum ( pairs -- pair ) { 0 0 } [ v+ ] reduce ; GENERIC: noise ( obj -- pair ) @@ -105,7 +105,7 @@ M: quotation noise [ noise ] map vsum { 1/4 1/2 } v+ ; M: array noise [ noise ] map vsum ; -: noise-factor / 100 * >integer ; +: noise-factor ( x y -- z ) / 100 * >integer ; : quot-noise-factor ( quot -- n ) #! For very short words, noise doesn't count so much diff --git a/extra/reports/optimizer/optimizer.factor b/extra/reports/optimizer/optimizer.factor index f38d1d808b..51eae24333 100755 --- a/extra/reports/optimizer/optimizer.factor +++ b/extra/reports/optimizer/optimizer.factor @@ -1,6 +1,6 @@ USING: assocs words sequences arrays compiler tools.time io.styles io prettyprint vocabs kernel sorting generator -optimizer math ; +optimizer math math.order ; IN: report.optimizer : count-optimization-passes ( nodes n -- n ) @@ -8,7 +8,7 @@ IN: report.optimizer [ r> 1+ count-optimization-passes ] [ drop r> ] if ; : results - [ [ second ] swap compose compare ] curry sort 20 tail* + [ [ second ] prepose compare ] curry sort 20 tail* print standard-table-style [ @@ -16,11 +16,11 @@ IN: report.optimizer ] tabular-output ; inline : optimizer-measurements ( -- alist ) - all-words [ compiled? ] subset + all-words [ compiled? ] filter [ dup [ word-dataflow nip 1 count-optimization-passes - ] benchmark nip 2array + ] benchmark 2array ] { } map>assoc ; : optimizer-measurements. ( alist -- ) diff --git a/extra/roman/roman.factor b/extra/roman/roman.factor index 07e43cea8e..71b5d69693 100644 --- a/extra/roman/roman.factor +++ b/extra/roman/roman.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: arrays assocs kernel math math.vectors namespaces +USING: arrays assocs kernel math math.order math.vectors namespaces quotations sequences sequences.lib sequences.private strings unicode.case ; IN: roman diff --git a/extra/rss/rss.factor b/extra/rss/rss.factor deleted file mode 100644 index 5fc688967a..0000000000 --- a/extra/rss/rss.factor +++ /dev/null @@ -1,104 +0,0 @@ -! Copyright (C) 2006 Chris Double, Daniel Ehrenberg. -! See http://factorcode.org/license.txt for BSD license. -IN: rss -USING: xml.utilities kernel assocs xml.generator - strings sequences xml.data xml.writer - io.streams.string combinators xml xml.entities io.files io - http.client namespaces xml.generator hashtables - calendar.format accessors continuations ; - -: any-tag-named ( tag names -- tag-inside ) - f -rot [ tag-named nip dup ] with find 2drop ; - -TUPLE: feed title link entries ; - -C: feed - -TUPLE: entry title link description pub-date ; - -C: entry - -: rss1.0-entry ( tag -- entry ) - [ "title" tag-named children>string ] keep - [ "link" tag-named children>string ] keep - [ "description" tag-named children>string ] keep - f "date" "http://purl.org/dc/elements/1.1/" - tag-named dup [ children>string rfc822>timestamp ] when - ; - -: rss1.0 ( xml -- feed ) - [ - "channel" tag-named - [ "title" tag-named children>string ] keep - "link" tag-named children>string - ] keep - "item" tags-named [ rss1.0-entry ] map ; - -: rss2.0-entry ( tag -- entry ) - [ "title" tag-named children>string ] keep - [ "link" tag-named ] keep - [ "guid" tag-named dupd ? children>string ] keep - [ "description" tag-named children>string ] keep - "pubDate" tag-named children>string rfc822>timestamp ; - -: rss2.0 ( xml -- feed ) - "channel" tag-named - [ "title" tag-named children>string ] keep - [ "link" tag-named children>string ] keep - "item" tags-named [ rss2.0-entry ] map ; - -: atom1.0-entry ( tag -- entry ) - [ "title" tag-named children>string ] keep - [ "link" tag-named "href" swap at ] keep - [ - { "content" "summary" } any-tag-named - dup tag-children [ string? not ] contains? - [ tag-children [ write-chunk ] with-string-writer ] - [ children>string ] if - ] keep - { "published" "updated" "issued" "modified" } any-tag-named - children>string rfc3339>timestamp ; - -: atom1.0 ( xml -- feed ) - [ "title" tag-named children>string ] keep - [ "link" tag-named "href" swap at ] keep - "entry" tags-named [ atom1.0-entry ] map ; - -: xml>feed ( xml -- feed ) - dup name-tag { - { "RDF" [ rss1.0 ] } - { "rss" [ rss2.0 ] } - { "feed" [ atom1.0 ] } - } case ; - -: read-feed ( string -- feed ) - [ string>xml xml>feed ] with-html-entities ; - -: download-feed ( url -- feed ) - #! Retrieve an news syndication file, return as a feed tuple. - http-get read-feed ; - -! Atom generation -: simple-tag, ( content name -- ) - [ , ] tag, ; - -: simple-tag*, ( content name attrs -- ) - [ , ] tag*, ; - -: entry, ( entry -- ) - "entry" [ - dup entry-title "title" { { "type" "html" } } simple-tag*, - "link" over entry-link "href" associate contained*, - dup entry-pub-date timestamp>rfc3339 "published" simple-tag, - entry-description [ "content" { { "type" "html" } } simple-tag*, ] when* - ] tag, ; - -: feed>xml ( feed -- xml ) - "feed" { { "xmlns" "http://www.w3.org/2005/Atom" } } [ - dup feed-title "title" simple-tag, - "link" over feed-link "href" associate contained*, - feed-entries [ entry, ] each - ] make-xml* ; - -: write-feed ( feed -- ) - feed>xml write-xml ; diff --git a/extra/semantic-db/authors.txt b/extra/semantic-db/authors.txt new file mode 100644 index 0000000000..e9c193bac7 --- /dev/null +++ b/extra/semantic-db/authors.txt @@ -0,0 +1 @@ +Alex Chapman diff --git a/extra/semantic-db/context/context.factor b/extra/semantic-db/context/context.factor deleted file mode 100644 index 777c481ebb..0000000000 --- a/extra/semantic-db/context/context.factor +++ /dev/null @@ -1,16 +0,0 @@ -! Copyright (C) 2008 Alex Chapman -! See http://factorcode.org/license.txt for BSD license. -USING: kernel namespaces semantic-db ; -IN: semantic-db.context - -: create-context* ( context-name -- context-id ) create-node* ; -: create-context ( context-name -- ) create-context* drop ; - -: context ( -- context-id ) - \ context get ; - -: set-context ( context-id -- ) - \ context set ; - -: with-context ( context-id quot -- ) - >r \ context r> with-variable ; diff --git a/extra/semantic-db/hierarchy/hierarchy.factor b/extra/semantic-db/hierarchy/hierarchy.factor deleted file mode 100755 index 0b2421c757..0000000000 --- a/extra/semantic-db/hierarchy/hierarchy.factor +++ /dev/null @@ -1,45 +0,0 @@ -! Copyright (C) 2008 Alex Chapman -! See http://factorcode.org/license.txt for BSD license. -USING: accessors db.tuples hashtables kernel sets -semantic-db semantic-db.relations sequences sequences.deep ; -IN: semantic-db.hierarchy - -TUPLE: tree id children ; -C: tree - -: has-parent-relation ( -- relation-id ) - "has parent" relation-id ; - -: parent-child* ( parent child -- arc-id ) - has-parent-relation spin create-arc* ; - -: parent-child ( parent child -- ) - parent-child* drop ; - -: un-parent-child ( parent child -- ) - has-parent-relation spin select-tuples [ id>> delete-arc ] each ; - -: child-arcs ( node-id -- child-arcs ) - has-parent-relation f rot select-tuples ; - -: children ( node-id -- children ) - child-arcs [ subject>> ] map ; - -: parent-arcs ( node-id -- parent-arcs ) - has-parent-relation swap f select-tuples ; - -: parents ( node-id -- parents ) - parent-arcs [ object>> ] map ; - -: get-node-hierarchy ( node-id -- tree ) - dup children [ get-node-hierarchy ] map ; - -: (get-root-nodes) ( node-id -- root-nodes/node-id ) - dup parents dup empty? [ - drop - ] [ - nip [ (get-root-nodes) ] map - ] if ; - -: get-root-nodes ( node-id -- root-nodes ) - (get-root-nodes) flatten prune ; diff --git a/extra/semantic-db/relations/relations.factor b/extra/semantic-db/relations/relations.factor deleted file mode 100644 index 17c335c4ae..0000000000 --- a/extra/semantic-db/relations/relations.factor +++ /dev/null @@ -1,26 +0,0 @@ -! Copyright (C) 2008 Alex Chapman -! See http://factorcode.org/license.txt for BSD license. -USING: db.types kernel namespaces semantic-db semantic-db.context -sequences.lib ; -IN: semantic-db.relations - -! relations: -! - have a context in context 'semantic-db' - -: create-relation* ( context-id relation-name -- relation-id ) - create-node* tuck has-context-relation spin create-arc ; - -: create-relation ( context-id relation-name -- ) - create-relation* drop ; - -: get-relation ( context-id relation-name -- relation-id/f ) - [ - ":name" TEXT param , - ":context" INTEGER param , - has-context-relation ":has_context" INTEGER param , - ] { } make - "select n.id from node n, arc a where n.content = :name and n.id = a.subject and a.relation = :has_context and a.object = :context" - single-int-results ?first ; - -: relation-id ( relation-name -- relation-id ) - context swap [ get-relation ] [ create-relation* ] ensure2 ; diff --git a/extra/semantic-db/semantic-db-tests.factor b/extra/semantic-db/semantic-db-tests.factor index c523053740..484af741aa 100644 --- a/extra/semantic-db/semantic-db-tests.factor +++ b/extra/semantic-db/semantic-db-tests.factor @@ -1,10 +1,10 @@ -USING: accessors arrays continuations db db.sqlite -db.tuples io.files kernel math namespaces semantic-db -semantic-db.context semantic-db.hierarchy -semantic-db.relations sequences sorting tools.test +USING: accessors arrays continuations db db.sqlite db.tuples io.files +kernel math namespaces semantic-db sequences sorting tools.test tools.walker ; IN: semantic-db.tests +SYMBOL: context + : db-path "semantic-db-test.db" temp-file ; : test-db db-path sqlite-db ; : delete-db [ db-path delete-file ] ignore-errors ; @@ -12,61 +12,56 @@ IN: semantic-db.tests delete-db test-db [ - create-node-table create-arc-table - [ 1 ] [ "first node" create-node* ] unit-test - [ 2 ] [ "second node" create-node* ] unit-test - [ 3 ] [ "third node" create-node* ] unit-test - [ 4 ] [ f create-node* ] unit-test - [ 5 ] [ 1 2 3 create-arc* ] unit-test -] with-db + node create-table arc create-table + [ 1 ] [ "first node" create-node id>> ] unit-test + [ 2 ] [ "second node" create-node id>> ] unit-test + [ 3 ] [ "third node" create-node id>> ] unit-test + [ 4 ] [ f create-node id>> ] unit-test + [ ] [ 1 f 2 f 3 f create-arc ] unit-test + [ { 1 2 3 4 } ] [ all-node-ids ] unit-test +] with-db delete-db -delete-db - -test-db [ - init-semantic-db - "test content" create-context* [ - [ 4 ] [ context ] unit-test - [ 5 ] [ context "is test content" create-relation* ] unit-test - [ 5 ] [ context "is test content" get-relation ] unit-test - [ 5 ] [ "is test content" relation-id ] unit-test - [ 7 ] [ "has parent" relation-id ] unit-test - [ 7 ] [ "has parent" relation-id ] unit-test - [ "has parent" ] [ "has parent" relation-id node-content ] unit-test - [ "test content" ] [ context node-content ] unit-test - ] with-context - ! type-type 1array [ "type" ensure-type ] unit-test - ! [ { 1 2 3 } ] [ type-type select-nodes-of-type ] unit-test - ! [ 1 ] [ type-type select-node-of-type ] unit-test - ! [ t ] [ "content" ensure-type integer? ] unit-test - ! [ t ] [ "content" ensure-type "content" ensure-type = ] unit-test - ! [ t ] [ "content" ensure-type "first content" create-node-of-type integer? ] unit-test - ! [ t ] [ "content" ensure-type select-node-of-type integer? ] unit-test - ! [ t ] [ "content" ensure-type "first content" select-node-of-type-with-content integer? ] unit-test - ! [ t ] [ "content" ensure-type "first content" ensure-node-of-type integer? ] unit-test - ! [ t ] [ "content" ensure-type "second content" ensure-node-of-type integer? ] unit-test - ! [ 2 ] [ "content" ensure-type select-nodes-of-type length ] unit-test -] with-db - -delete-db - -! test hierarchy -test-db [ - init-semantic-db - "family tree" create-context* [ - "adam" create-node* "adam" set - "eve" create-node* "eve" set - "bob" create-node* "bob" set - "fran" create-node* "fran" set - "charlie" create-node* "charlie" set - "gertrude" create-node* "gertrude" set - [ t ] [ "adam" get "bob" get parent-child* integer? ] unit-test - { { "eve" "bob" } { "eve" "fran" } { "bob" "gertrude" } { "bob" "fran" } { "fran" "charlie" } } [ first2 [ get ] bi@ parent-child ] each - [ { "bob" "fran" } ] [ "eve" get children [ node-content ] map ] unit-test - [ { "adam" "eve" } ] [ "bob" get parents [ node-content ] map ] unit-test - [ "fran" { "charlie" } ] [ "fran" get get-node-hierarchy dup tree-id node-content swap tree-children [ tree-id node-content ] map ] unit-test - [ { "adam" "eve" } ] [ "charlie" get get-root-nodes [ node-content ] map natural-sort >array ] unit-test - [ { } ] [ "fran" get "charlie" get tuck un-parent-child parents [ node-content ] map ] unit-test - ] with-context -] with-db - -delete-db + test-db [ + init-semantic-db + "test content" create-context context set + [ T{ node f 3 "test content" } ] [ context get ] unit-test + [ T{ node f 4 "is test content" } ] [ "is test content" context get create-relation ] unit-test + [ T{ node f 4 "is test content" } ] [ "is test content" context get get-relation ] unit-test + [ T{ node f 4 "is test content" } ] [ "is test content" context get ensure-relation ] unit-test + [ T{ node f 5 "has parent" } ] [ "has parent" context get ensure-relation ] unit-test + [ T{ node f 5 "has parent" } ] [ "has parent" context get ensure-relation ] unit-test + [ "has parent" ] [ "has parent" context get ensure-relation node-content ] unit-test + [ "test content" ] [ context get node-content ] unit-test + ] with-db delete-db + + ! "test1" "test1-relation-id-word" f f f f define-relation + ! "test2" t t t t t define-relation + RELATION: test3 + test-db [ + init-semantic-db + ! [ T{ node f 3 "test1" } ] [ test1-relation-id-word ] unit-test + ! [ T{ node f 4 "test2" } ] [ test2-relation ] unit-test + [ T{ node f 4 "test3" } ] [ test3-relation ] unit-test + ] with-db delete-db + + ! test hierarchy + RELATION: has-parent + test-db [ + init-semantic-db + "adam" create-node "adam" set + "eve" create-node "eve" set + "bob" create-node "bob" set + "fran" create-node "fran" set + "charlie" create-node "charlie" set + "gertrude" create-node "gertrude" set + [ ] [ "bob" get "adam" get has-parent ] unit-test + { { "bob" "eve" } { "fran" "eve" } { "gertrude" "bob" } { "fran" "bob" } { "charlie" "fran" } } [ first2 [ get ] bi@ has-parent ] each + [ { "bob" "fran" } ] [ "eve" get has-parent-relation children [ node-content ] map ] unit-test + [ { "adam" "eve" } ] [ "bob" get has-parent-relation parents [ node-content ] map ] unit-test + [ "fran" { "charlie" } ] [ "fran" get has-parent-relation get-node-tree-s dup node>> node-content swap children>> [ node>> node-content ] map ] unit-test + [ { "adam" "eve" } ] [ "charlie" get has-parent-relation get-root-nodes [ node-content ] map natural-sort >array ] unit-test + [ { } ] [ "charlie" get dup "fran" get !has-parent has-parent-relation parents [ node-content ] map ] unit-test + [ { "adam" "eve" } ] [ has-parent-relation ultimate-objects node-results [ node-content ] map ] unit-test + [ { "fran" "gertrude" } ] [ has-parent-relation ultimate-subjects node-results [ node-content ] map ] unit-test + ] with-db delete-db + diff --git a/extra/semantic-db/semantic-db.factor b/extra/semantic-db/semantic-db.factor index 279ebcf922..7d50d384e2 100755 --- a/extra/semantic-db/semantic-db.factor +++ b/extra/semantic-db/semantic-db.factor @@ -1,89 +1,285 @@ ! Copyright (C) 2008 Alex Chapman ! See http://factorcode.org/license.txt for BSD license. -USING: accessors arrays continuations db db.tuples db.types db.sqlite kernel math math.parser sequences ; +USING: accessors arrays combinators combinators.cleave combinators.lib +continuations db db.tuples db.types db.sqlite kernel math +math.parser namespaces parser sets sequences sequences.deep +sequences.lib strings words destructors ; IN: semantic-db TUPLE: node id content ; -: ( content -- node ) - node new swap >>content ; - -: ( id -- node ) - node new swap >>id ; +C: node node "node" { - { "id" "id" +native-id+ +autoincrement+ } + { "id" "id" +db-assigned-id+ +autoincrement+ } { "content" "content" TEXT } } define-persistent -: create-node-table ( -- ) - node create-table ; +: delete-node ( node -- ) delete-tuples ; +: create-node ( content -- node ) f swap dup insert-tuple ; +: load-node ( id -- node ) f select-tuple ; -: delete-node ( node-id -- ) - delete-tuple ; +: node-content ( node -- content ) + dup content>> [ nip ] [ select-tuple content>> ] if* ; -: create-node* ( str -- node-id ) - dup insert-tuple id>> ; +: node= ( node node -- ? ) [ id>> ] bi@ = ; -: create-node ( str -- ) - create-node* drop ; +! TODO: get rid of arc id and write our own sql +TUPLE: arc id subject object relation ; -: node-content ( id -- str ) - f swap >>id select-tuple content>> ; - -TUPLE: arc id relation subject object ; - -: ( relation subject object -- arc ) - arc new swap >>object swap >>subject swap >>relation ; +: ( subject object relation -- arc ) + arc new swap >>relation swap >>object swap >>subject ; : ( id -- arc ) arc new swap >>id ; -: insert-arc ( arc -- ) - f dup insert-tuple id>> >>id insert-tuple ; +: delete-arc ( arc -- ) delete-tuples ; -: delete-arc ( arc-id -- ) - dup delete-node delete-tuple ; +: create-arc ( subject object relation -- ) + [ id>> ] 3apply insert-tuple ; -: create-arc* ( relation subject object -- arc-id ) - dup insert-arc id>> ; +: nodes>arc ( subject object relation -- arc ) + [ [ id>> ] [ f ] if* ] 3apply ; -: create-arc ( relation subject object -- ) - create-arc* drop ; +: select-arcs ( subject object relation -- arcs ) + nodes>arc select-tuples ; + +: has-arc? ( subject object relation -- ? ) + select-arcs length 0 > ; + +: select-arc-subjects ( subject object relation -- subjects ) + select-arcs [ subject>> f ] map ; + +: select-arc-subject ( subject object relation -- subject ) + select-arcs ?first [ subject>> f ] [ f ] if* ; + +: select-subjects ( object relation -- subjects ) + f -rot select-arc-subjects ; + +: select-subject ( object relation -- subject ) + f -rot select-arc-subject ; + +: select-arc-objects ( subject object relation -- objects ) + select-arcs [ object>> f ] map ; + +: select-arc-object ( subject object relation -- object ) + select-arcs ?first [ object>> f ] [ f ] if* ; + +: select-objects ( subject relation -- objects ) + f swap select-arc-objects ; + +: select-object ( subject relation -- object ) + f swap select-arc-object ; + +: delete-arcs ( subject object relation -- ) + select-arcs [ delete-arc ] each ; arc "arc" { - { "id" "id" INTEGER +assigned-id+ } ! foreign key to node table? + { "id" "id" +db-assigned-id+ +autoincrement+ } { "relation" "relation" INTEGER +not-null+ } { "subject" "subject" INTEGER +not-null+ } { "object" "object" INTEGER +not-null+ } } define-persistent -: create-arc-table ( -- ) - arc create-table ; - : create-bootstrap-nodes ( -- ) - "semantic-db" create-node - "has context" create-node ; + "semantic-db" create-node drop + "has-context" create-node drop ; -: semantic-db-context 1 ; -: has-context-relation 2 ; +: semantic-db-context T{ node f 1 "semantic-db" } ; +: has-context-relation T{ node f 2 "has-context" } ; : create-bootstrap-arcs ( -- ) - has-context-relation has-context-relation semantic-db-context create-arc ; + has-context-relation semantic-db-context has-context-relation create-arc ; : init-semantic-db ( -- ) - create-node-table create-arc-table create-bootstrap-nodes create-bootstrap-arcs ; + node create-table arc create-table + create-bootstrap-nodes create-bootstrap-arcs ; + +! db utilities +: results ( bindings sql -- array ) + f f [ do-bound-query ] with-disposal ; + +: node-result ( result -- node ) + dup first string>number swap second ; + +: ?1node-result ( results -- node ) + ?first [ node-result ] [ f ] if* ; + +: node-results ( results -- nodes ) + [ node-result ] map ; : param ( value key type -- param ) swapd ; -: single-int-results ( bindings sql -- array ) - f f [ do-bound-query ] with-disposal - [ first string>number ] map ; +: all-node-ids ( -- seq ) + f "select n.id from node n" results [ first string>number ] map ; -: ensure2 ( x y quot1 quot2 -- z ) - #! quot1 ( x y -- z/f ) finds an existing z - #! quot2 ( x y -- z ) creates a new z if quot1 returns f - >r >r 2dup r> call [ 2nip ] r> if* ; +: subjects-with-cor ( content object relation -- sql-results ) + [ id>> ] bi@ + [ + ":relation" INTEGER param , + ":object" INTEGER param , + ":content" TEXT param , + ] { } make + "select n.id, n.content from node n, arc a where n.content = :content and n.id = a.subject and a.relation = :relation and a.object = :object" results ; + +: objects-with-csr ( content subject relation -- sql-results ) + [ id>> ] bi@ + [ + ":relation" INTEGER param , + ":subject" INTEGER param , + ":content" TEXT param , + ] { } make + "select n.id, n.content from node n, arc a where n.content = :content and n.id = a.object and a.relation = :relation and a.subject = :subject" results ; + +: (with-relation) ( content relation -- bindings sql ) + id>> [ ":relation" INTEGER param , ":content" TEXT param , ] { } make + "select distinct n.id, n.content from node n, arc a where n.content = :content and a.relation = :relation" ; + +: subjects-with-relation ( content relation -- sql-results ) + (with-relation) " and a.object = n.id" append results ; + +: objects-with-relation ( content relation -- sql-results ) + (with-relation) " and a.subject = n.id" append results ; + +: (ultimate) ( relation b a -- sql-results ) + [ + "select distinct n.id, n.content from node n, arc a where a.relation = :relation and n.id = a." % % " and n.id not in (select b." % % " from arc b where b.relation = :relation)" % + ] "" make [ id>> ":relation" INTEGER param 1array ] dip results ; + +: ultimate-objects ( relation -- sql-results ) + "subject" "object" (ultimate) ; + +: ultimate-subjects ( relation -- sql-results ) + "object" "subject" (ultimate) ; + +! contexts: +! - a node n is a context iff there exists a relation r such that r has context n +: create-context ( context-name -- context ) create-node ; + +: get-context ( context-name -- context/f ) + has-context-relation subjects-with-relation ?1node-result ; + +: ensure-context ( context-name -- context ) + dup get-context [ + nip + ] [ + create-context + ] if* ; + +! relations: +! - have a context in context 'semantic-db' + +: create-relation ( relation-name context -- relation ) + [ create-node dup ] dip has-context-relation create-arc ; + +: get-relation ( relation-name context -- relation/f ) + has-context-relation subjects-with-cor ?1node-result ; + +: ensure-relation ( relation-name context -- relation ) + 2dup get-relation [ + 2nip + ] [ + create-relation + ] if* ; + +TUPLE: relation-definition relate id-word unrelate related? subjects objects ; +C: relation-definition + +> ] dip default-word-name + ] if ; + +: (define-relation-word) ( id-word word-name definition -- id-word ) + >r create-in over [ execute ] curry r> compose define ; + +: define-relation-word ( relation-definition id-word given-word-name word-type definition -- relation-definition id-word ) + >r >r [ + pick swap r> choose-word-name r> (define-relation-word) + ] [ + r> r> 2drop + ] if* ; + +: define-relation-words ( relation-definition id-word -- ) + over relate>> "relate" [ create-arc ] define-relation-word + over unrelate>> "unrelate" [ delete-arcs ] define-relation-word + over related?>> "related?" [ has-arc? ] define-relation-word + over subjects>> "subjects" [ select-subjects ] define-relation-word + over objects>> "objects" [ select-objects ] define-relation-word + 2drop ; + +: define-id-word ( relation-definition id-word -- ) + [ relate>> ] dip tuck word-vocabulary + [ ensure-context ensure-relation ] 2curry define ; + +: create-id-word ( relation-definition -- id-word ) + dup id-word>> "id-word" choose-word-name create-in ; + +PRIVATE> + +: define-relation ( relation-definition -- ) + dup create-id-word 2dup define-id-word define-relation-words ; + +: RELATION: + scan t t t t t define-relation ; parsing + +! hierarchy +TUPLE: node-tree node children ; +C: node-tree + +: children ( node has-parent-relation -- children ) select-subjects ; +: parents ( node has-parent-relation -- parents ) select-objects ; + +: get-node-tree ( node child-selector -- node-tree ) + 2dup call >r [ get-node-tree ] curry r> swap map ; + +! : get-node-tree ( node has-parent-relation -- node-tree ) +! 2dup children >r [ get-node-tree ] curry r> swap map ; +: get-node-tree-s ( node has-parent-relation -- tree ) + [ select-subjects ] curry get-node-tree ; + +: get-node-tree-o ( node has-child-relation -- tree ) + [ select-objects ] curry get-node-tree ; + +: (get-node-chain) ( node next-selector seq -- seq ) + pick [ + over push >r [ call ] keep r> (get-node-chain) + ] [ + 2nip + ] if* ; + +: get-node-chain ( node next-selector -- seq ) + V{ } clone (get-node-chain) ; + +: get-node-chain-o ( node relation -- seq ) + [ select-object ] curry get-node-chain ; + +: get-node-chain-s ( node relation -- seq ) + [ select-subject ] curry get-node-chain ; + +: (get-root-nodes) ( node has-parent-relation -- root-nodes/node ) + 2dup parents dup empty? [ + 2drop + ] [ + >r nip [ (get-root-nodes) ] curry r> swap map + ] if ; + +: get-root-nodes ( node has-parent-relation -- root-nodes ) + (get-root-nodes) flatten prune ; diff --git a/extra/sequences/deep/deep-docs.factor b/extra/sequences/deep/deep-docs.factor index b98dbfc50f..3dc560f46d 100644 --- a/extra/sequences/deep/deep-docs.factor +++ b/extra/sequences/deep/deep-docs.factor @@ -9,7 +9,7 @@ HELP: deep-map { $values { "obj" "an object" } { "quot" "a quotation ( elt -- newelt )" } { "newobj" "the mapped object" } } { $description "Execute a quotation on each nested element of an object and its children, in preorder. That is, the result of the execution of the quotation on the outer is used to map the inner elements." } ; -HELP: deep-subset +HELP: deep-filter { $values { "obj" "an object" } { "quot" "a quotation ( elt -- ? )" } { "seq" "a sequence" } } { $description "Creates a sequence of sub-nodes in the object which satisfy the given quotation, in preorder. This includes the object itself, if it passes the quotation." } ; diff --git a/extra/sequences/deep/deep-tests.factor b/extra/sequences/deep/deep-tests.factor index 9629d569cb..395086e202 100755 --- a/extra/sequences/deep/deep-tests.factor +++ b/extra/sequences/deep/deep-tests.factor @@ -4,11 +4,11 @@ IN: sequences.deep.tests [ [ "hello" 3 4 swap ] ] [ [ { "hello" V{ 3 4 } } swap ] flatten ] unit-test -[ "foo" t ] [ { { "foo" } "bar" } [ string? ] deep-find* ] unit-test +[ "foo" t ] [ { { "foo" } "bar" } [ string? ] deep-find-from ] unit-test -[ f f ] [ { { "foo" } "bar" } [ number? ] deep-find* ] unit-test +[ f f ] [ { { "foo" } "bar" } [ number? ] deep-find-from ] unit-test -[ { { "foo" } "bar" } t ] [ { { "foo" } "bar" } [ array? ] deep-find* ] unit-test +[ { { "foo" } "bar" } t ] [ { { "foo" } "bar" } [ array? ] deep-find-from ] unit-test : change-something ( seq -- newseq ) dup array? [ "hi" suffix ] [ "hello" append ] if ; diff --git a/extra/sequences/deep/deep.factor b/extra/sequences/deep/deep.factor index 27b875bd8f..c0e516e471 100644 --- a/extra/sequences/deep/deep.factor +++ b/extra/sequences/deep/deep.factor @@ -18,21 +18,21 @@ IN: sequences.deep [ call ] keep over branch? [ [ deep-map ] curry map ] [ drop ] if ; inline -: deep-subset ( obj quot -- seq ) +: deep-filter ( obj quot -- seq ) over >r pusher >r deep-each r> r> dup branch? [ like ] [ drop ] if ; inline -: deep-find* ( obj quot -- elt ? ) +: deep-find-from ( obj quot -- elt ? ) [ call ] 2keep rot [ drop t ] [ over branch? [ - f -rot [ >r nip r> deep-find* ] curry find drop >boolean + f -rot [ >r nip r> deep-find-from ] curry find drop >boolean ] [ 2drop f f ] if ] if ; inline -: deep-find ( obj quot -- elt ) deep-find* drop ; inline +: deep-find ( obj quot -- elt ) deep-find-from drop ; inline -: deep-contains? ( obj quot -- ? ) deep-find* nip ; inline +: deep-contains? ( obj quot -- ? ) deep-find-from nip ; inline : deep-all? ( obj quot -- ? ) [ not ] compose deep-contains? not ; inline @@ -43,4 +43,4 @@ IN: sequences.deep ] curry change-each ] [ 2drop ] if ; inline : flatten ( obj -- seq ) - [ branch? not ] deep-subset ; + [ branch? not ] deep-filter ; diff --git a/extra/sequences/lib/lib-docs.factor b/extra/sequences/lib/lib-docs.factor index 6f4a173874..14fb6eaebf 100755 --- a/extra/sequences/lib/lib-docs.factor +++ b/extra/sequences/lib/lib-docs.factor @@ -37,3 +37,23 @@ HELP: count "100 [1,b] [ even? ] count ." "50" } ; + +HELP: if-seq +{ $values { "seq" sequence } { "quot1" quotation } { "quot2" quotation } } +{ $description "Makes an implicit check if the sequence is empty. If the sequence has any elements, " { $snippet "quot1" } " is called on it. Otherwise, the empty sequence is dropped and " { $snippet "quot2" } " is called." } +{ $example + "USING: kernel prettyprint sequences sequences.lib ;" + "{ 1 2 3 } [ sum ] [ \"empty sequence\" throw ] if-seq ." + "6" +} ; + +HELP: if-empty +{ $values { "seq" sequence } { "quot1" quotation } { "quot2" quotation } } +{ $description "Makes an implicit check if the sequence is empty. An empty sequence is dropped and " { $snippet "quot1" } " is called. Otherwise, if the sequence has any elements, " { $snippet "quot2" } " is called on it." } +{ $example + "USING: kernel prettyprint sequences sequences.lib ;" + "{ 1 2 3 } [ \"empty sequence\" ] [ sum ] if-empty ." + "6" +} ; + +{ if-seq if-empty } related-words diff --git a/extra/sequences/lib/lib-tests.factor b/extra/sequences/lib/lib-tests.factor index 99565e966c..ee447decdf 100755 --- a/extra/sequences/lib/lib-tests.factor +++ b/extra/sequences/lib/lib-tests.factor @@ -79,3 +79,10 @@ IN: sequences.lib.tests [ ] [ { } 0 firstn ] unit-test [ "a" ] [ { "a" } 1 firstn ] unit-test + +[ { { 1 1 } { 1 2 } { 2 0 } } ] [ { { 2 0 } { 1 1 } { 1 2 } } dup [ first ] insertion-sort ] unit-test +[ "empty" ] [ { } [ "not empty" ] [ "empty" ] if-seq ] unit-test +[ { 1 } "not empty" ] [ { 1 } [ "not empty" ] [ "empty" ] if-seq ] unit-test + +[ "empty" ] [ { } [ "empty" ] [ "not empty" ] if-empty ] unit-test +[ { 1 } "not empty" ] [ { 1 } [ "empty" ] [ "not empty" ] if-empty ] unit-test diff --git a/extra/sequences/lib/lib.factor b/extra/sequences/lib/lib.factor index fe2c660d54..265cd5b592 100755 --- a/extra/sequences/lib/lib.factor +++ b/extra/sequences/lib/lib.factor @@ -4,7 +4,7 @@ USING: combinators.lib kernel sequences math namespaces assocs random sequences.private shuffle math.functions mirrors arrays math.parser math.private sorting strings ascii macros -assocs.lib quotations hashtables ; +assocs.lib quotations hashtables math.order locals ; IN: sequences.lib : each-withn ( seq quot n -- ) nwith each ; inline @@ -45,7 +45,7 @@ MACRO: firstn ( n -- ) >r dup length dup [ / ] curry - [ 1+ ] swap compose + [ 1+ ] prepose r> compose 2each ; inline @@ -66,9 +66,9 @@ MACRO: firstn ( n -- ) ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -: higher ( a b quot -- c ) [ compare 0 > ] curry most ; inline +: higher ( a b quot -- c ) [ compare +gt+ eq? ] curry most ; inline -: lower ( a b quot -- c ) [ compare 0 < ] curry most ; inline +: lower ( a b quot -- c ) [ compare +lt+ eq? ] curry most ; inline ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -102,9 +102,9 @@ MACRO: firstn ( n -- ) ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -: ,, building get peek push ; -: v, V{ } clone , ; -: ,v building get dup peek empty? [ dup pop* ] when drop ; +: ,, ( obj -- ) building get peek push ; +: v, ( -- ) V{ } clone , ; +: ,v ( -- ) building get dup peek empty? [ dup pop* ] when drop ; : monotonic-split ( seq quot -- newseq ) [ @@ -117,7 +117,7 @@ MACRO: firstn ( n -- ) : split-around ( seq quot -- before elem after ) dupd find over [ "Element not found" throw ] unless - >r cut 1 tail r> swap ; inline + >r cut rest r> swap ; inline : (map-until) ( quot pred -- quot ) [ dup ] swap 3compose @@ -129,11 +129,11 @@ MACRO: firstn ( n -- ) : take-while ( seq quot -- newseq ) [ not ] compose [ find drop [ head-slice ] when* ] curry - [ dup ] swap compose keep like ; + [ dup ] prepose keep like ; : replicate ( seq quot -- newseq ) #! quot: ( -- obj ) - [ drop ] swap compose map ; + [ drop ] prepose map ; inline ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -159,7 +159,7 @@ PRIVATE> : switches ( seq1 seq -- subseq ) ! seq1 is a sequence of ones and zeroes - >r [ length ] keep [ nth 1 = ] curry subset r> + >r [ length ] keep [ nth 1 = ] curry filter r> [ nth ] curry { } map-as ; : power-set ( seq -- subsets ) @@ -216,7 +216,7 @@ USE: continuations >r dup length swap r> [ = [ ] [ drop f ] if ] curry 2map - [ ] subset ; + sift ; zip >hashtable substitute ; : remove-nth ( seq n -- seq' ) - cut-slice 1 tail-slice append ; + cut-slice rest-slice append ; : short ( seq n -- seq n' ) over length min ; inline + += [ + n n 1- seq exchange + seq quot n 1- insert + ] unless + ] unless ; inline +PRIVATE> + +: insertion-sort ( seq quot -- ) + ! quot is a transformation on elements + over length [ insert ] 2with each ; inline + +: if-seq ( seq quot1 quot2 -- ) + [ f like ] 2dip if* ; inline + +: if-empty ( seq quot1 quot2 -- ) + swap if-seq ; inline diff --git a/extra/sequences/merged/authors.txt b/extra/sequences/merged/authors.txt new file mode 100644 index 0000000000..e9c193bac7 --- /dev/null +++ b/extra/sequences/merged/authors.txt @@ -0,0 +1 @@ +Alex Chapman diff --git a/extra/sequences/merged/merged-docs.factor b/extra/sequences/merged/merged-docs.factor new file mode 100644 index 0000000000..ca68a9030b --- /dev/null +++ b/extra/sequences/merged/merged-docs.factor @@ -0,0 +1,51 @@ +USING: help.markup help.syntax sequences ; +IN: sequences.merged + +ARTICLE: "sequences-merge" "Merging sequences" +"When multiple sequences are merged into one sequence, the new sequence takes an element from each input sequence in turn. For example, if we merge " { $code "{ 1 2 3 }" } "and" { $code "{ \"a\" \"b\" \"c\" }" } "we get:" { $code "{ 1 \"a\" 2 \"b\" 3 \"c\" }" } "." +{ $subsection merge } +{ $subsection 2merge } +{ $subsection 3merge } +{ $subsection } +{ $subsection <2merged> } +{ $subsection <3merged> } ; + +ABOUT: "sequences-merge" + +HELP: merged +{ $class-description "A virtual sequence which presents a merged view of its underlying elements. New instances are created by calling one of " { $link } ", " { $link <2merged> } ", or " { $link <3merged> } "." } +{ $see-also merge } ; + +HELP: ( seqs -- merged ) +{ $values { "seqs" "a sequence of sequences to merge" } { "merged" "a virtual sequence" } } +{ $description "Creates an instance of the " { $link merged } " virtual sequence." } +{ $see-also <2merged> <3merged> merge } ; + +HELP: <2merged> ( seq1 seq2 -- merged ) +{ $values { "seq1" sequence } { "seq2" sequence } { "merged" "a virtual sequence" } } +{ $description "Creates an instance of the " { $link merged } " virtual sequence which merges the two input sequences." } +{ $see-also <3merged> 2merge } ; + +HELP: <3merged> ( seq1 seq2 seq3 -- merged ) +{ $values { "seq1" sequence } { "seq2" sequence } { "seq3" sequence } { "merged" "a virtual sequence" } } +{ $description "Creates an instance of the " { $link merged } " virtual sequence which merges the three input sequences." } +{ $see-also <2merged> 3merge } ; + +HELP: merge ( seqs -- seq ) +{ $values { "seqs" "a sequence of sequences to merge" } { "seq" "a new sequence" } } +{ $description "Outputs a new sequence which merges the elements of each sequence in " { $snippet "seqs" } "." } +{ $examples + { $example "USING: prettyprint sequences.merged ;" "{ { 1 2 } { 3 4 } { 5 6 } } merge ." "{ 1 3 5 2 4 6 }" } + { $example "USING: prettyprint sequences.merged ;" "{ \"abc\" \"def\" } merge ." "\"adbecf\"" } +} +{ $see-also 2merge 3merge } ; + +HELP: 2merge ( seq1 seq2 -- seq ) +{ $values { "seq1" sequence } { "seq2" sequence } { "seq" "a new sequence" } } +{ $description "Creates a new sequence of the same type as " { $snippet "seq1" } " which merges the elements of " { $snippet "seq1" } " and " { $snippet "seq2" } } +{ $see-also merge 3merge <2merged> } ; + +HELP: 3merge ( seq1 seq2 seq3 -- seq ) +{ $values { "seq1" sequence } { "seq2" sequence } { "seq3" sequence } { "seq" "a new sequence" } } +{ $description "Creates a new sequence of the same type as " { $snippet "seq1" } " which merges the elements of all three sequences" } +{ $see-also merge 2merge <3merged> } ; diff --git a/extra/sequences/merged/merged-tests.factor b/extra/sequences/merged/merged-tests.factor new file mode 100644 index 0000000000..13a46f0b72 --- /dev/null +++ b/extra/sequences/merged/merged-tests.factor @@ -0,0 +1,17 @@ +USING: sequences sequences.merged tools.test ; +IN: sequences.merged.tests + +[ 0 { 1 2 } ] [ 0 T{ merged f { { 1 2 } { 3 4 } } } virtual@ ] unit-test +[ 0 { 3 4 } ] [ 1 T{ merged f { { 1 2 } { 3 4 } } } virtual@ ] unit-test +[ 1 { 1 2 } ] [ 2 T{ merged f { { 1 2 } { 3 4 } } } virtual@ ] unit-test +[ 4 ] [ 3 { { 1 2 3 4 } } nth ] unit-test +[ 4 { { 1 2 3 4 } } nth ] must-fail + +[ 1 ] [ 0 { 1 2 3 } { 4 5 6 } <2merged> nth ] unit-test +[ 4 ] [ 1 { 1 2 3 } { 4 5 6 } <2merged> nth ] unit-test +[ 2 ] [ 2 { 1 2 3 } { 4 5 6 } <2merged> nth ] unit-test +[ 5 ] [ 3 { 1 2 3 } { 4 5 6 } <2merged> nth ] unit-test +[ 3 ] [ 4 { 1 2 3 } { 4 5 6 } <2merged> nth ] unit-test +[ 6 ] [ 5 { 1 2 3 } { 4 5 6 } <2merged> nth ] unit-test + +[ 4 ] [ 4 { 1 2 } { 3 4 } { 5 6 } 3merge nth ] unit-test diff --git a/extra/sequences/merged/merged.factor b/extra/sequences/merged/merged.factor new file mode 100644 index 0000000000..829555cfb1 --- /dev/null +++ b/extra/sequences/merged/merged.factor @@ -0,0 +1,28 @@ +! Copyright (C) 2008 Alex Chapman +! See http://factorcode.org/license.txt for BSD license. +USING: accessors arrays kernel math sequences ; +IN: sequences.merged + +TUPLE: merged seqs ; +C: merged + +: <2merged> ( seq1 seq2 -- merged ) 2array ; +: <3merged> ( seq1 seq2 seq3 -- merged ) 3array ; + +: merge ( seqs -- seq ) + dup swap first like ; + +: 2merge ( seq1 seq2 -- seq ) + dupd <2merged> swap like ; + +: 3merge ( seq1 seq2 seq3 -- seq ) + pick >r <3merged> r> like ; + +M: merged length seqs>> [ length ] map sum ; + +M: merged virtual@ ( n seq -- n' seq' ) + seqs>> [ length /mod ] [ nth ] bi ; + +M: merged virtual-seq ( merged -- seq ) [ ] { } map-as ; + +INSTANCE: merged virtual-sequence diff --git a/extra/sequences/merged/summary.txt b/extra/sequences/merged/summary.txt new file mode 100644 index 0000000000..1a514df4e2 --- /dev/null +++ b/extra/sequences/merged/summary.txt @@ -0,0 +1 @@ +A virtual sequence which merges (interleaves) other sequences. diff --git a/extra/sequences/merged/tags.txt b/extra/sequences/merged/tags.txt new file mode 100644 index 0000000000..42d711b32b --- /dev/null +++ b/extra/sequences/merged/tags.txt @@ -0,0 +1 @@ +collections diff --git a/extra/sequences/modified/modified-tests.factor b/extra/sequences/modified/modified-tests.factor new file mode 100644 index 0000000000..4bcbb29da6 --- /dev/null +++ b/extra/sequences/modified/modified-tests.factor @@ -0,0 +1,15 @@ +USING: accessors arrays kernel sequences sequences.modified tools.test ; +IN: sequences.modified.tests + +[ { 2 4 6 } ] [ { 1 2 3 } 2 scale ] unit-test +[ { 1 4 3 } ] [ { 1 2 3 } 2 8 1 pick set-nth seq>> ] unit-test +[ { 2 8 6 } ] [ { 1 2 3 } 2 8 1 pick set-nth >array ] unit-test + +[ { 2 3 4 } ] [ { 1 2 3 } 1 seq-offset ] unit-test +[ { 1 5 3 } ] [ { 1 2 3 } 1 6 1 pick set-nth seq>> ] unit-test +[ { 2 6 4 } ] [ { 1 2 3 } 1 6 1 pick set-nth >array ] unit-test + +[ 4 ] [ { { 1 2 } { 3 4 } } 0 swap nth ] unit-test +[ 6 ] [ { { 1 2 } { 3 4 } } 1 swap nth ] unit-test +[ 2 ] [ { { 1 2 } { 3 4 } } length ] unit-test +[ { 4 6 } ] [ { { 1 2 } { 3 4 } } >array ] unit-test diff --git a/extra/sequences/modified/modified.factor b/extra/sequences/modified/modified.factor new file mode 100644 index 0000000000..3e4c1b1bdc --- /dev/null +++ b/extra/sequences/modified/modified.factor @@ -0,0 +1,76 @@ +! Copyright (C) 2008 Alex Chapman +! See http://factorcode.org/license.txt for BSD license. +USING: accessors arrays kernel math sequences sequences.private shuffle ; +IN: sequences.modified + +TUPLE: modified ; + +GENERIC: modified-nth ( n seq -- elt ) +M: modified nth modified-nth ; +M: modified nth-unsafe modified-nth ; + +GENERIC: modified-set-nth ( elt n seq -- ) +M: modified set-nth modified-set-nth ; +M: modified set-nth-unsafe modified-set-nth ; + +INSTANCE: modified virtual-sequence + +TUPLE: 1modified < modified seq ; + +M: modified length seq>> length ; +M: modified set-length seq>> set-length ; + +M: 1modified virtual-seq seq>> ; + +TUPLE: scaled < 1modified c ; +C: scaled + +: scale ( seq c -- new-seq ) + dupd swap like ; + +M: scaled modified-nth ( n seq -- elt ) + [ seq>> nth ] [ c>> * ] bi ; + +M: scaled modified-set-nth ( elt n seq -- elt ) + ! don't set c to 0! + tuck [ c>> / ] 2dip seq>> set-nth ; + +TUPLE: offset < 1modified n ; +C: offset + +: seq-offset ( seq n -- new-seq ) + dupd swap like ; + +M: offset modified-nth ( n seq -- elt ) + [ seq>> nth ] [ n>> + ] bi ; + +M: offset modified-set-nth ( elt n seq -- ) + tuck [ n>> - ] 2dip seq>> set-nth ; + +TUPLE: summed < modified seqs ; +C: summed + +M: summed length seqs>> [ length ] map supremum ; + + + +M: summed modified-nth ( n seq -- ) + seqs>> [ ?nth ?+ ] with 0 swap reduce ; + +M: summed modified-set-nth ( elt n seq -- ) immutable ; + +M: summed set-length ( n seq -- ) + seqs>> [ set-length ] with each ; + +M: summed virtual-seq ( summed -- seq ) [ ] { } map-as ; + +: <2summed> ( seq seq -- summed-seq ) 2array ; +: <3summed> ( seq seq seq -- summed-seq ) 3array ; diff --git a/extra/sequences/repeating/authors.txt b/extra/sequences/repeating/authors.txt new file mode 100644 index 0000000000..e9c193bac7 --- /dev/null +++ b/extra/sequences/repeating/authors.txt @@ -0,0 +1 @@ +Alex Chapman diff --git a/extra/sequences/repeating/repeating-tests.factor b/extra/sequences/repeating/repeating-tests.factor new file mode 100644 index 0000000000..15b7ef444b --- /dev/null +++ b/extra/sequences/repeating/repeating-tests.factor @@ -0,0 +1,5 @@ +USING: sequences.repeating tools.test ; +IN: sequences.repeating.tests + +[ { 1 2 3 1 2 } ] [ { 1 2 3 } 5 repeated ] unit-test +[ { 1 2 3 1 2 3 1 2 3 } ] [ { 1 2 3 } 9 repeated ] unit-test diff --git a/extra/sequences/repeating/repeating.factor b/extra/sequences/repeating/repeating.factor new file mode 100644 index 0000000000..92b0925907 --- /dev/null +++ b/extra/sequences/repeating/repeating.factor @@ -0,0 +1,21 @@ +! Copyright (C) 2008 Alex Chapman +! See http;//factorcode.org/license.txt for BSD license +USING: accessors circular kernel sequences ; +IN: sequences.repeating + +TUPLE: repeating circular len ; + +: ( seq length -- repeating ) + [ ] dip repeating boa ; + +: repeated ( seq length -- new-seq ) + dupd swap like ; + +M: repeating length repeating-len ; +M: repeating set-length (>>len) ; + +M: repeating virtual@ ( n seq -- n' seq' ) circular>> ; + +M: repeating virtual-seq circular>> ; + +INSTANCE: repeating virtual-sequence diff --git a/extra/serialize/serialize.factor b/extra/serialize/serialize.factor index bb69a8a41c..fcf57714d6 100755 --- a/extra/serialize/serialize.factor +++ b/extra/serialize/serialize.factor @@ -111,7 +111,7 @@ M: tuple (serialize) ( obj -- ) CHAR: T write1 [ class (serialize) ] [ add-object ] - [ tuple>array 1 tail (serialize) ] + [ tuple>array rest (serialize) ] tri ] serialize-shared ; @@ -230,6 +230,7 @@ SYMBOL: deserialized : deserialize-word ( -- word ) (deserialize) (deserialize) 2dup lookup dup [ 2nip ] [ + drop "Unknown word: " -rot 2array unparse append throw ] if ; diff --git a/extra/shell/parser/parser.factor b/extra/shell/parser/parser.factor index 46548bb34f..2ecca6199c 100644 --- a/extra/shell/parser/parser.factor +++ b/extra/shell/parser/parser.factor @@ -23,8 +23,8 @@ TUPLE: factor-expr expr ; pipeline-expr new over [ 1st ] [ 4th [ 1st ] map ] [ 5th ] tri suffix prefix-on >>commands over 2nd >>stdin - over 5th >>stdout - swap 6th >>background ; + over 6th >>stdout + swap 7th >>background ; : ast>single-quoted-expr ( ast -- obj ) 2nd >string single-quoted-expr boa ; diff --git a/extra/shell/shell.factor b/extra/shell/shell.factor index 7f30104e21..8ba5b66d5a 100644 --- a/extra/shell/shell.factor +++ b/extra/shell/shell.factor @@ -1,7 +1,7 @@ USING: kernel parser words continuations namespaces debugger sequences combinators splitting prettyprint - system io io.files io.launcher io.encodings.utf8 sequences.deep + system io io.files io.launcher io.encodings.utf8 io.pipes sequences.deep accessors multi-methods newfx shell.parser ; IN: shell @@ -95,8 +95,7 @@ METHOD: expand { object } ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -: pipeline-chant ( pipeline-chant -- ) - drop "ix: pipelines not supported" print ; +: pipeline-chant ( pipeline-chant -- ) commands>> run-pipeline drop ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/extra/shuffle/shuffle.factor b/extra/shuffle/shuffle.factor index 33587bb7fa..2366d15cff 100644 --- a/extra/shuffle/shuffle.factor +++ b/extra/shuffle/shuffle.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007 Chris Double, Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: kernel sequences namespaces math inference.transforms - combinators macros quotations math.ranges bake ; + combinators macros quotations math.ranges fry ; IN: shuffle @@ -17,7 +17,7 @@ MACRO: ndrop ( n -- ) [ drop ] n*quot ; : nnip ( n -- ) swap >r ndrop r> ; inline -MACRO: ntuck ( n -- ) 2 + [ dup , -nrot ] bake ; +MACRO: ntuck ( n -- ) 2 + '[ dup , -nrot ] ; : 2swap ( x y z t -- z t x y ) rot >r rot r> ; inline diff --git a/extra/size-of/size-of.factor b/extra/size-of/size-of.factor index 5b6f26acea..a2b47fc0aa 100644 --- a/extra/size-of/size-of.factor +++ b/extra/size-of/size-of.factor @@ -36,4 +36,4 @@ VAR: headers { "gcc" c-file "-o" exe } to-strings [ "Error compiling generated C program" print ] run-or-bail - exe ascii contents string>number ; \ No newline at end of file + exe ascii contents string>number ; \ No newline at end of file diff --git a/extra/slides/slides.factor b/extra/slides/slides.factor index b58253381c..1c8b4fcbb3 100755 --- a/extra/slides/slides.factor +++ b/extra/slides/slides.factor @@ -53,7 +53,7 @@ IN: slides gadget. ] ($block) ; -: page-theme +: page-theme ( gadget -- ) T{ gradient f { { 0.8 0.8 1.0 1.0 } { 0.8 1.0 1.0 1.0 } } } swap set-gadget-interior ; diff --git a/extra/smtp/server/server.factor b/extra/smtp/server/server.factor index 737a887f9f..824651030d 100755 --- a/extra/smtp/server/server.factor +++ b/extra/smtp/server/server.factor @@ -1,7 +1,8 @@ ! Copyright (C) 2007 Elie CHAFTARI ! See http://factorcode.org/license.txt for BSD license. USING: combinators kernel prettyprint io io.timeouts io.server -sequences namespaces io.sockets continuations calendar io.encodings.ascii ; +sequences namespaces io.sockets continuations calendar +io.encodings.ascii io.streams.duplex destructors ; IN: smtp.server ! Mock SMTP server for testing purposes. @@ -65,7 +66,7 @@ SYMBOL: data-mode "Starting SMTP server on port " write dup . flush "127.0.0.1" swap ascii [ accept drop [ - 1 minutes stdio get set-timeout + 1 minutes timeouts "220 hello\r\n" write flush process global [ flush ] bind diff --git a/extra/smtp/smtp-tests.factor b/extra/smtp/smtp-tests.factor index 1d22ed731a..5d350d80c4 100755 --- a/extra/smtp/smtp-tests.factor +++ b/extra/smtp/smtp-tests.factor @@ -63,12 +63,14 @@ IN: smtp.tests prepare dup headers>> >alist sort-keys [ drop { "Date" "Message-Id" } member? not - ] assoc-subset + ] assoc-filter over to>> rot from>> ] unit-test -[ ] [ [ 4321 mock-smtp-server ] in-thread ] unit-test +[ ] [ [ 4321 mock-smtp-server ] "SMTP server" spawn drop ] unit-test + +[ ] [ yield ] unit-test [ ] [ [ @@ -85,3 +87,5 @@ IN: smtp.tests send-email ] with-scope ] unit-test + +[ ] [ yield ] unit-test diff --git a/extra/smtp/smtp.factor b/extra/smtp/smtp.factor index d565117e5f..16a13eafe8 100755 --- a/extra/smtp/smtp.factor +++ b/extra/smtp/smtp.factor @@ -17,13 +17,13 @@ LOG: log-smtp-connection NOTICE ( addrspec -- ) : with-smtp-connection ( quot -- ) smtp-server get dup log-smtp-connection - ascii [ + ascii [ smtp-domain [ host-name or ] change - read-timeout get stdio get set-timeout + read-timeout get timeouts call - ] with-stream ; inline + ] with-client ; inline -: crlf "\r\n" write ; +: crlf ( -- ) "\r\n" write ; : command ( string -- ) write crlf flush ; @@ -131,7 +131,7 @@ M: email clone "-" % millis # "@" % - smtp-domain get % + smtp-domain get [ host-name ] unless* % ">" % ] "" make ; diff --git a/extra/space-invaders/space-invaders.factor b/extra/space-invaders/space-invaders.factor index 200257b31c..d3ca3673f4 100755 --- a/extra/space-invaders/space-invaders.factor +++ b/extra/space-invaders/space-invaders.factor @@ -22,9 +22,9 @@ TUPLE: space-invaders port1 port2i port2o port3o port4lo port4hi port5o bitmap s : set-bitmap-pixel ( color point array -- ) #! 'color' is a {r g b}. Point is {x y}. [ bitmap-index ] dip ! color index array - [ [ first ] dipd set-uchar-nth ] 3keep - [ [ second ] dipd [ 1 + ] dip set-uchar-nth ] 3keep - [ third ] dipd [ 2 + ] dip set-uchar-nth ; + [ [ first ] 2dip set-uchar-nth ] 3keep + [ [ second ] 2dip [ 1 + ] dip set-uchar-nth ] 3keep + [ third ] 2dip [ 2 + ] dip set-uchar-nth ; : get-bitmap-pixel ( point array -- color ) #! Point is a {x y}. color is a {r g b} @@ -45,21 +45,21 @@ TUPLE: space-invaders port1 port2i port2o port3o port4lo port4hi port5o bitmap s : init-sound ( index cpu filename -- ) swapd >r space-invaders-sounds nth AL_BUFFER r> - resource-path create-buffer-from-wav set-source-param ; + create-buffer-from-wav set-source-param ; : init-sounds ( cpu -- ) init-openal [ 9 gen-sources swap set-space-invaders-sounds ] keep - [ SOUND-SHOT "extra/space-invaders/resources/Shot.wav" init-sound ] keep - [ SOUND-UFO "extra/space-invaders/resources/Ufo.wav" init-sound ] keep + [ SOUND-SHOT "resource:extra/space-invaders/resources/Shot.wav" init-sound ] keep + [ SOUND-UFO "resource:extra/space-invaders/resources/Ufo.wav" init-sound ] keep [ space-invaders-sounds SOUND-UFO swap nth AL_LOOPING AL_TRUE set-source-param ] keep - [ SOUND-BASE-HIT "extra/space-invaders/resources/BaseHit.wav" init-sound ] keep - [ SOUND-INVADER-HIT "extra/space-invaders/resources/InvHit.wav" init-sound ] keep - [ SOUND-WALK1 "extra/space-invaders/resources/Walk1.wav" init-sound ] keep - [ SOUND-WALK2 "extra/space-invaders/resources/Walk2.wav" init-sound ] keep - [ SOUND-WALK3 "extra/space-invaders/resources/Walk3.wav" init-sound ] keep - [ SOUND-WALK4 "extra/space-invaders/resources/Walk4.wav" init-sound ] keep - [ SOUND-UFO-HIT "extra/space-invaders/resources/UfoHit.wav" init-sound ] keep + [ SOUND-BASE-HIT "resource:extra/space-invaders/resources/BaseHit.wav" init-sound ] keep + [ SOUND-INVADER-HIT "resource:extra/space-invaders/resources/InvHit.wav" init-sound ] keep + [ SOUND-WALK1 "resource:extra/space-invaders/resources/Walk1.wav" init-sound ] keep + [ SOUND-WALK2 "resource:extra/space-invaders/resources/Walk2.wav" init-sound ] keep + [ SOUND-WALK3 "resource:extra/space-invaders/resources/Walk3.wav" init-sound ] keep + [ SOUND-WALK4 "resource:extra/space-invaders/resources/Walk4.wav" init-sound ] keep + [ SOUND-UFO-HIT "resource:extra/space-invaders/resources/UfoHit.wav" init-sound ] keep f swap set-space-invaders-looping? ; : ( -- cpu ) @@ -311,7 +311,7 @@ M: invaders-gadget draw-gadget* ( gadget -- ) : plot-bitmap-bits ( bitmap point byte bit -- ) #! point is a {x y}. - [ first2 ] dipd + [ first2 ] 2dip dup swapd -1 * shift 1 bitand 0 = [ - 2array ] dip [ black ] [ dup get-point-color ] if diff --git a/extra/spheres/authors.txt b/extra/spheres/authors.txt new file mode 100644 index 0000000000..f13c9c1e77 --- /dev/null +++ b/extra/spheres/authors.txt @@ -0,0 +1 @@ +Joe Groff diff --git a/extra/spheres/spheres.factor b/extra/spheres/spheres.factor new file mode 100644 index 0000000000..9d06987bcd --- /dev/null +++ b/extra/spheres/spheres.factor @@ -0,0 +1,284 @@ +USING: kernel opengl.demo-support opengl.gl opengl.shaders opengl.framebuffers +opengl multiline ui.gadgets accessors sequences ui.render ui math +arrays arrays.lib combinators ; +IN: spheres + +STRING: plane-vertex-shader +varying vec3 object_position; +void +main() +{ + object_position = gl_Vertex.xyz; + gl_Position = ftransform(); +} +; + +STRING: plane-fragment-shader +varying vec3 object_position; +void +main() +{ + float distance_factor = (gl_FragCoord.z * 0.5 + 0.5); + distance_factor = pow(distance_factor, 500.0)*0.5; + + gl_FragColor = fract((floor(0.125*object_position.x)+floor(0.125*object_position.z)) * 0.5) == 0.0 + ? vec4(1.0, 1.0 - distance_factor, 1.0 - distance_factor, 1.0) + : vec4(1.0, distance_factor, distance_factor, 1.0); +} +; + +STRING: sphere-vertex-shader +attribute vec3 center; +attribute float radius; +attribute vec4 surface_color; +varying float vradius; +varying vec3 sphere_position; +varying vec4 world_position, vcolor; + +void +main() +{ + world_position = gl_ModelViewMatrix * vec4(center, 1); + sphere_position = gl_Vertex.xyz; + + gl_Position = gl_ProjectionMatrix * (world_position + vec4(sphere_position * radius, 0)); + + vcolor = surface_color; + vradius = radius; +} +; + +STRING: sphere-solid-color-fragment-shader +uniform vec3 light_position; +varying vec4 vcolor; + +const vec4 ambient = vec4(0.25, 0.2, 0.25, 1.0); +const vec4 diffuse = vec4(0.75, 0.8, 0.75, 1.0); + +vec4 +sphere_color(vec3 point, vec3 normal) +{ + vec3 transformed_light_position = (gl_ModelViewMatrix * vec4(light_position, 1)).xyz; + vec3 direction = normalize(transformed_light_position - point); + float d = max(0.0, dot(normal, direction)); + + return ambient * vcolor + diffuse * vec4(d * vcolor.rgb, vcolor.a); +} +; + +STRING: sphere-texture-fragment-shader +uniform samplerCube surface_texture; + +vec4 +sphere_color(vec3 point, vec3 normal) +{ + vec3 reflect = reflect(normalize(point), normal); + return textureCube(surface_texture, reflect * gl_NormalMatrix); +} +; + +STRING: sphere-main-fragment-shader +varying float vradius; +varying vec3 sphere_position; +varying vec4 world_position; + +vec4 sphere_color(vec3 point, vec3 normal); + +void +main() +{ + float radius = length(sphere_position); + if(radius > 1.0) discard; + + vec3 surface = sphere_position + vec3(0.0, 0.0, sqrt(1.0 - radius*radius)); + vec4 world_surface = world_position + vec4(surface * vradius, 0); + vec4 transformed_surface = gl_ProjectionMatrix * world_surface; + + gl_FragDepth = (transformed_surface.z/transformed_surface.w + 1.0) * 0.5; + gl_FragColor = sphere_color(world_surface.xyz, surface); +} +; + +TUPLE: spheres-gadget + plane-program solid-sphere-program texture-sphere-program + reflection-framebuffer reflection-depthbuffer + reflection-texture ; + +: ( -- gadget ) + 20.0 10.0 20.0 + { set-delegate } spheres-gadget construct ; + +M: spheres-gadget near-plane ( gadget -- z ) + drop 1.0 ; +M: spheres-gadget far-plane ( gadget -- z ) + drop 512.0 ; +M: spheres-gadget distance-step ( gadget -- dz ) + drop 0.5 ; + +: (reflection-dim) ( -- w h ) + 512 512 ; + +: (make-reflection-texture) ( -- texture ) + gen-texture [ + GL_TEXTURE_CUBE_MAP swap glBindTexture + GL_TEXTURE_CUBE_MAP GL_TEXTURE_MAG_FILTER GL_LINEAR glTexParameteri + GL_TEXTURE_CUBE_MAP GL_TEXTURE_MIN_FILTER GL_LINEAR glTexParameteri + GL_TEXTURE_CUBE_MAP GL_TEXTURE_WRAP_S GL_CLAMP glTexParameteri + GL_TEXTURE_CUBE_MAP GL_TEXTURE_WRAP_T GL_CLAMP glTexParameteri + GL_TEXTURE_CUBE_MAP GL_TEXTURE_WRAP_R GL_CLAMP glTexParameteri + GL_TEXTURE_CUBE_MAP_POSITIVE_X + GL_TEXTURE_CUBE_MAP_POSITIVE_Y + GL_TEXTURE_CUBE_MAP_POSITIVE_Z + GL_TEXTURE_CUBE_MAP_NEGATIVE_X + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 6 narray + [ 0 GL_RGBA8 (reflection-dim) 0 GL_RGBA GL_UNSIGNED_BYTE f glTexImage2D ] + each + ] keep ; + +: (make-reflection-depthbuffer) ( -- depthbuffer ) + gen-renderbuffer [ + GL_RENDERBUFFER_EXT swap glBindRenderbufferEXT + GL_RENDERBUFFER_EXT GL_DEPTH_COMPONENT32 (reflection-dim) glRenderbufferStorageEXT + ] keep ; + +: (make-reflection-framebuffer) ( depthbuffer -- framebuffer ) + gen-framebuffer dup [ + swap >r + GL_FRAMEBUFFER_EXT GL_DEPTH_ATTACHMENT_EXT GL_RENDERBUFFER_EXT r> + glFramebufferRenderbufferEXT + ] with-framebuffer ; + +: (plane-program) ( -- program ) + plane-vertex-shader plane-fragment-shader ; +: (solid-sphere-program) ( -- program ) + sphere-vertex-shader check-gl-shader + sphere-solid-color-fragment-shader check-gl-shader + sphere-main-fragment-shader check-gl-shader + 3array check-gl-program ; +: (texture-sphere-program) ( -- program ) + sphere-vertex-shader check-gl-shader + sphere-texture-fragment-shader check-gl-shader + sphere-main-fragment-shader check-gl-shader + 3array check-gl-program ; + +M: spheres-gadget graft* ( gadget -- ) + (plane-program) >>plane-program + (solid-sphere-program) >>solid-sphere-program + (texture-sphere-program) >>texture-sphere-program + (make-reflection-texture) >>reflection-texture + (make-reflection-depthbuffer) [ >>reflection-depthbuffer ] keep + (make-reflection-framebuffer) >>reflection-framebuffer + drop ; + +M: spheres-gadget ungraft* ( gadget -- ) + { + [ reflection-framebuffer>> [ delete-framebuffer ] when* ] + [ reflection-depthbuffer>> [ delete-renderbuffer ] when* ] + [ reflection-texture>> [ delete-texture ] when* ] + [ solid-sphere-program>> [ delete-gl-program ] when* ] + [ texture-sphere-program>> [ delete-gl-program ] when* ] + [ plane-program>> [ delete-gl-program ] when* ] + } cleave ; + +M: spheres-gadget pref-dim* ( gadget -- dim ) + drop { 640 480 } ; + +: (draw-sphere) ( program center radius surfacecolor -- ) + roll + [ [ "center" glGetAttribLocation swap first3 glVertexAttrib3f ] curry ] + [ [ "radius" glGetAttribLocation swap glVertexAttrib1f ] curry ] + [ [ "surface_color" glGetAttribLocation swap first4 glVertexAttrib4f ] curry ] + tri tri* + { -1.0 -1.0 } { 1.0 1.0 } rect-vertices ; + +: sphere-scene ( gadget -- ) + GL_DEPTH_BUFFER_BIT GL_COLOR_BUFFER_BIT bitor glClear + [ + solid-sphere-program>> dup { + { "light_position" [ 0.0 0.0 100.0 glUniform3f ] } + } [ + { + [ { 7.0 0.0 0.0 } 1.0 { 1.0 0.0 0.0 1.0 } (draw-sphere) ] + [ { -7.0 0.0 0.0 } 1.0 { 0.0 1.0 0.0 1.0 } (draw-sphere) ] + [ { 0.0 0.0 7.0 } 1.0 { 0.0 0.0 1.0 1.0 } (draw-sphere) ] + [ { 0.0 0.0 -7.0 } 1.0 { 1.0 1.0 0.0 1.0 } (draw-sphere) ] + [ { 0.0 7.0 0.0 } 1.0 { 1.0 0.0 1.0 1.0 } (draw-sphere) ] + [ { 0.0 -7.0 0.0 } 1.0 { 0.0 1.0 1.0 1.0 } (draw-sphere) ] + } cleave + ] with-gl-program + ] [ + plane-program>> { } [ + GL_QUADS [ + -1000.0 -30.0 1000.0 glVertex3f + -1000.0 -30.0 -1000.0 glVertex3f + 1000.0 -30.0 -1000.0 glVertex3f + 1000.0 -30.0 1000.0 glVertex3f + ] do-state + ] with-gl-program + ] bi ; + +: reflection-frustum ( gadget -- -x x -y y near far ) + [ near-plane ] [ far-plane ] bi [ + drop dup [ -+ ] bi@ + ] 2keep ; + +: (reflection-face) ( gadget face -- ) + swap reflection-texture>> >r >r + GL_FRAMEBUFFER_EXT + GL_COLOR_ATTACHMENT0_EXT + r> r> 0 glFramebufferTexture2DEXT + check-framebuffer ; + +: (draw-reflection-texture) ( gadget -- ) + dup reflection-framebuffer>> [ { + [ drop 0 0 (reflection-dim) glViewport ] + [ + GL_PROJECTION glMatrixMode + glLoadIdentity + reflection-frustum glFrustum + GL_MODELVIEW glMatrixMode + glLoadIdentity + 180.0 0.0 0.0 1.0 glRotatef + ] + [ GL_TEXTURE_CUBE_MAP_NEGATIVE_Z (reflection-face) ] + [ sphere-scene ] + [ GL_TEXTURE_CUBE_MAP_POSITIVE_X (reflection-face) + 90.0 0.0 1.0 0.0 glRotatef ] + [ sphere-scene ] + [ GL_TEXTURE_CUBE_MAP_POSITIVE_Z (reflection-face) + 90.0 0.0 1.0 0.0 glRotatef glPushMatrix ] + [ sphere-scene ] + [ GL_TEXTURE_CUBE_MAP_NEGATIVE_X (reflection-face) + 90.0 0.0 1.0 0.0 glRotatef ] + [ sphere-scene ] + [ GL_TEXTURE_CUBE_MAP_NEGATIVE_Y (reflection-face) + glPopMatrix glPushMatrix -90.0 1.0 0.0 0.0 glRotatef ] + [ sphere-scene ] + [ GL_TEXTURE_CUBE_MAP_POSITIVE_Y (reflection-face) + glPopMatrix 90.0 1.0 0.0 0.0 glRotatef ] + [ sphere-scene ] + [ dim>> 0 0 rot first2 glViewport ] + } cleave ] with-framebuffer ; + +M: spheres-gadget draw-gadget* ( gadget -- ) + GL_DEPTH_TEST glEnable + GL_SCISSOR_TEST glDisable + 0.15 0.15 1.0 1.0 glClearColor { + [ (draw-reflection-texture) ] + [ demo-gadget-set-matrices ] + [ sphere-scene ] + [ reflection-texture>> GL_TEXTURE_CUBE_MAP GL_TEXTURE0 bind-texture-unit ] + [ + texture-sphere-program>> dup { + { "surface_texture" [ 0 glUniform1i ] } + } [ + { 0.0 0.0 0.0 } 4.0 { 1.0 0.0 0.0 1.0 } (draw-sphere) + ] with-gl-program + ] + } cleave ; + +: spheres-window ( -- ) + [ "Spheres" open-window ] with-ui ; + +MAIN: spheres-window diff --git a/extra/spheres/summary.txt b/extra/spheres/summary.txt new file mode 100644 index 0000000000..fd97091e33 --- /dev/null +++ b/extra/spheres/summary.txt @@ -0,0 +1 @@ +Draw pixel-perfect spheres using GLSL shaders \ No newline at end of file diff --git a/extra/spheres/tags.txt b/extra/spheres/tags.txt new file mode 100644 index 0000000000..2e6040bd16 --- /dev/null +++ b/extra/spheres/tags.txt @@ -0,0 +1,2 @@ +opengl +glsl diff --git a/extra/state-machine/state-machine.factor b/extra/state-machine/state-machine.factor index 3f1d91d84c..4c83c64641 100755 --- a/extra/state-machine/state-machine.factor +++ b/extra/state-machine/state-machine.factor @@ -11,8 +11,8 @@ IN: state-machine TUPLE: state place data ; -TUPLE: missing-state ; -: missing-state \ missing-state new throw ; +ERROR: missing-state ; + M: missing-state error. drop "Missing state" print ; diff --git a/extra/state-parser/state-parser-docs.factor b/extra/state-parser/state-parser-docs.factor index 7ef2869452..3027c01c19 100644 --- a/extra/state-parser/state-parser-docs.factor +++ b/extra/state-parser/state-parser-docs.factor @@ -13,7 +13,7 @@ ARTICLE: { "state-parser" "main" } "State-based parsing" { $subsection next } { $subsection state-parse } { $subsection get-char } - { $subsection rest } + { $subsection take-rest } { $subsection string-parse } { $subsection expect } { $subsection expect-string } @@ -23,7 +23,7 @@ HELP: get-char { $values { "char" "the current character" } } { $description "Accesses the current character of the stream that is being parsed" } ; -HELP: rest +HELP: take-rest { $values { "string" "the rest of the parser input" } } { $description "Exausts the stream of the parser input and returns a string representing the rest of the input" } ; @@ -69,4 +69,4 @@ HELP: next { $description "originally written as " { $code "spot inc" } ", code that would no longer run, this word moves the state of the XML parser to the next place in the source file, keeping track of appropriate debugging information." } ; HELP: parsing-error -{ $class-description "class to which parsing errors delegate, containing information about which line and column the error occured on, and what the line was. Contains three slots, line, an integer, column, another integer, and line-str, a string" } ; +{ $class-description "class from which parsing errors inherit, containing information about which line and column the error occured on, and what the line was. Contains three slots, line, an integer, column, another integer, and line-str, a string" } ; diff --git a/extra/state-parser/state-parser-tests.factor b/extra/state-parser/state-parser-tests.factor index 4e1ecaddfc..e0b274b3e6 100755 --- a/extra/state-parser/state-parser-tests.factor +++ b/extra/state-parser/state-parser-tests.factor @@ -1,8 +1,8 @@ USING: tools.test state-parser kernel io strings ascii ; -[ "hello" ] [ "hello" [ rest ] string-parse ] unit-test -[ 2 4 ] [ "12\n123" [ rest drop get-line get-column ] string-parse ] unit-test -[ "hi" " how are you?" ] [ "hi how are you?" [ [ get-char blank? ] take-until rest ] string-parse ] unit-test -[ "foo" ";bar" ] [ "foo;bar" [ CHAR: ; take-char rest ] string-parse ] unit-test -[ "foo " " bar" ] [ "foo and bar" [ "and" take-string rest ] string-parse ] unit-test -[ "baz" ] [ " \n\t baz" [ pass-blank rest ] string-parse ] unit-test +[ "hello" ] [ "hello" [ take-rest ] string-parse ] unit-test +[ 2 4 ] [ "12\n123" [ take-rest drop get-line get-column ] string-parse ] unit-test +[ "hi" " how are you?" ] [ "hi how are you?" [ [ get-char blank? ] take-until take-rest ] string-parse ] unit-test +[ "foo" ";bar" ] [ "foo;bar" [ CHAR: ; take-char take-rest ] string-parse ] unit-test +[ "foo " " bar" ] [ "foo and bar" [ "and" take-string take-rest ] string-parse ] unit-test +[ "baz" ] [ " \n\t baz" [ pass-blank take-rest ] string-parse ] unit-test diff --git a/extra/state-parser/state-parser.factor b/extra/state-parser/state-parser.factor index 6a3bf1d552..af005b4abe 100644 --- a/extra/state-parser/state-parser.factor +++ b/extra/state-parser/state-parser.factor @@ -1,7 +1,8 @@ ! Copyright (C) 2005, 2006 Daniel Ehrenberg ! See http://factorcode.org/license.txt for BSD license. USING: io io.streams.string kernel math namespaces sequences -strings circular prettyprint debugger ascii ; +strings circular prettyprint debugger ascii sbufs fry inspector +accessors sequences.lib ; IN: state-parser ! * Basic underlying words @@ -11,50 +12,56 @@ TUPLE: spot char line column next ; C: spot -: get-char ( -- char ) spot get spot-char ; -: set-char ( char -- ) spot get set-spot-char ; -: get-line ( -- line ) spot get spot-line ; -: set-line ( line -- ) spot get set-spot-line ; -: get-column ( -- column ) spot get spot-column ; -: set-column ( column -- ) spot get set-spot-column ; -: get-next ( -- char ) spot get spot-next ; -: set-next ( char -- ) spot get set-spot-next ; +: get-char ( -- char ) spot get char>> ; +: set-char ( char -- ) spot get swap >>char drop ; +: get-line ( -- line ) spot get line>> ; +: set-line ( line -- ) spot get swap >>line drop ; +: get-column ( -- column ) spot get column>> ; +: set-column ( column -- ) spot get swap >>column drop ; +: get-next ( -- char ) spot get next>> ; +: set-next ( char -- ) spot get swap >>next drop ; ! * Errors TUPLE: parsing-error line column ; -: ( -- parsing-error ) - get-line get-column parsing-error boa ; -: construct-parsing-error ( ... slots class -- error ) - construct over set-delegate ; inline +: parsing-error ( class -- obj ) + new + get-line >>line + get-column >>column ; +M: parsing-error summary ( obj -- str ) + [ + "Parsing error" print + "Line: " write dup line>> . + "Column: " write column>> . + ] with-string-writer ; -: parsing-error. ( parsing-error -- ) - "Parsing error" print - "Line: " write dup parsing-error-line . - "Column: " write parsing-error-column . ; +TUPLE: expected < parsing-error should-be was ; +: expected ( should-be was -- * ) + \ expected parsing-error + swap >>was + swap >>should-be throw ; +M: expected summary ( obj -- str ) + [ + dup call-next-method write + "Token expected: " write dup should-be>> print + "Token present: " write was>> print + ] with-string-writer ; -TUPLE: expected should-be was ; -: ( should-be was -- error ) - { set-expected-should-be set-expected-was } - expected construct-parsing-error ; -M: expected error. - dup parsing-error. - "Token expected: " write dup expected-should-be print - "Token present: " write expected-was print ; +TUPLE: unexpected-end < parsing-error ; +: unexpected-end ( -- * ) \ unexpected-end parsing-error throw ; +M: unexpected-end summary ( obj -- str ) + [ + call-next-method write + "File unexpectedly ended." print + ] with-string-writer ; -TUPLE: unexpected-end ; -: ( -- unexpected-end ) - { } unexpected-end construct-parsing-error ; -M: unexpected-end error. - parsing-error. - "File unexpectedly ended." print ; - -TUPLE: missing-close ; -: ( -- missing-close ) - { } missing-close construct-parsing-error ; -M: missing-close error. - parsing-error. - "Missing closing token." print ; +TUPLE: missing-close < parsing-error ; +: missing-close ( -- * ) \ missing-close parsing-error throw ; +M: missing-close summary ( obj -- str ) + [ + call-next-method write + "Missing closing token." print + ] with-string-writer ; SYMBOL: prolog-data @@ -65,7 +72,8 @@ SYMBOL: prolog-data [ 0 get-line 1+ set-line ] [ get-column 1+ ] if set-column ; -: (next) ( -- char ) ! this normalizes \r\n and \r +! (next) normalizes \r\n and \r +: (next) ( -- char ) get-next read1 2dup swap CHAR: \r = [ CHAR: \n = @@ -75,10 +83,7 @@ SYMBOL: prolog-data : next ( -- ) #! Increment spot. - get-char [ - throw - ] unless - (next) record ; + get-char [ unexpected-end ] unless (next) record ; : next* ( -- ) get-char [ (next) record ] when ; @@ -95,16 +100,30 @@ SYMBOL: prolog-data #! Take the substring of a string starting at spot #! from code until the quotation given is true and #! advance spot to after the substring. - [ [ - dup slip swap dup [ get-char , ] unless - ] skip-until ] "" make nip ; inline + 10 [ + '[ @ [ t ] [ get-char , push f ] if ] skip-until + ] keep >string ; inline -: rest ( -- string ) +: take-rest ( -- string ) [ f ] take-until ; : take-char ( ch -- string ) [ dup get-char = ] take-until nip ; +TUPLE: not-enough-characters < parsing-error ; +: not-enough-characters ( -- * ) + \ not-enough-characters parsing-error throw ; +M: not-enough-characters summary ( obj -- str ) + [ + call-next-method write + "Not enough characters" print + ] with-string-writer ; + +: take ( n -- string ) + [ 1- ] [ ] bi [ + '[ drop get-char [ next , push f ] [ t ] if* ] attempt-each drop + ] keep get-char [ over push ] when* >string ; + : pass-blank ( -- ) #! Advance code past any whitespace, including newlines [ get-char blank? not ] skip-until ; @@ -117,24 +136,24 @@ SYMBOL: prolog-data dup length [ 2dup string-matches? ] take-until nip dup length rot length 1- - head - get-char [ throw ] unless next ; + get-char [ missing-close ] unless next ; : expect ( ch -- ) get-char 2dup = [ 2drop ] [ - >r 1string r> 1string throw + >r 1string r> 1string expected ] if next ; : expect-string ( string -- ) dup [ drop get-char next ] map 2dup = - [ 2drop ] [ throw ] if ; + [ 2drop ] [ expected ] if ; : init-parser ( -- ) 0 1 0 f spot set read1 set-next next ; : state-parse ( stream quot -- ) - ! with-stream implicitly creates a new scope which we use - swap [ init-parser call ] with-stream ; inline + ! with-input-stream implicitly creates a new scope which we use + swap [ init-parser call ] with-input-stream ; inline : string-parse ( input quot -- ) >r r> state-parse ; inline diff --git a/extra/state-tables/authors.txt b/extra/state-tables/authors.txt new file mode 100644 index 0000000000..7c1b2f2279 --- /dev/null +++ b/extra/state-tables/authors.txt @@ -0,0 +1 @@ +Doug Coleman diff --git a/extra/state-tables/state-tables-tests.factor b/extra/state-tables/state-tables-tests.factor new file mode 100644 index 0000000000..b86c4f57d9 --- /dev/null +++ b/extra/state-tables/state-tables-tests.factor @@ -0,0 +1,56 @@ +USING: kernel state-tables tools.test ; +IN: state-tables.tests + +: test-table + + "a" "c" "z" over set-entry + "a" "o" "y" over set-entry + "a" "l" "x" over set-entry + "b" "o" "y" over set-entry + "b" "l" "x" over set-entry + "b" "s" "u" over set-entry ; + +[ + T{ + table + f + H{ + { "a" H{ { "l" "x" } { "c" "z" } { "o" "y" } } } + { "b" H{ { "l" "x" } { "s" "u" } { "o" "y" } } } + } + H{ { "l" t } { "s" t } { "c" t } { "o" t } } + f + H{ } + } +] [ test-table ] unit-test + +[ "x" t ] [ "a" "l" test-table get-entry ] unit-test +[ "har" t ] [ + "a" "z" "har" test-table [ set-entry ] keep + >r "a" "z" r> get-entry +] unit-test + +: vector-test-table + + "a" "c" "z" over add-entry + "a" "c" "r" over add-entry + "a" "o" "y" over add-entry + "a" "l" "x" over add-entry + "b" "o" "y" over add-entry + "b" "l" "x" over add-entry + "b" "s" "u" over add-entry ; + +[ +T{ vector-table f + H{ + { "a" + H{ { "l" "x" } { "c" V{ "z" "r" } } { "o" "y" } } } + { "b" + H{ { "l" "x" } { "s" "u" } { "o" "y" } } } + } + H{ { "l" t } { "s" t } { "c" t } { "o" t } } + f + H{ } +} +] [ vector-test-table ] unit-test + diff --git a/extra/state-tables/state-tables.factor b/extra/state-tables/state-tables.factor new file mode 100644 index 0000000000..9a04a5b74a --- /dev/null +++ b/extra/state-tables/state-tables.factor @@ -0,0 +1,123 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: kernel namespaces sequences vectors assocs accessors ; +IN: state-tables + +TUPLE: table rows columns start-state final-states ; +TUPLE: entry row-key column-key value ; + +GENERIC: add-entry ( entry table -- ) + +: make-table ( class -- obj ) + new + H{ } clone >>rows + H{ } clone >>columns + H{ } clone >>final-states ; + +:
    ( -- obj ) + table make-table ; + +C: entry + +: (add-row) ( row-key table -- row ) + 2dup rows>> at* [ + 2nip + ] [ + drop H{ } clone [ -rot rows>> set-at ] keep + ] if ; + +: add-row ( row-key table -- ) + (add-row) drop ; + +: add-column ( column-key table -- ) + t -rot columns>> set-at ; + +: set-row ( row row-key table -- ) + rows>> set-at ; + +: lookup-row ( row-key table -- row/f ? ) + rows>> at* ; + +: row-exists? ( row-key table -- ? ) + lookup-row nip ; + +: lookup-column ( column-key table -- column/f ? ) + columns>> at* ; + +: column-exists? ( column-key table -- ? ) + lookup-column nip ; + +ERROR: no-row key ; +ERROR: no-column key ; + +: get-row ( row-key table -- row ) + dupd lookup-row [ + nip + ] [ + drop no-row + ] if ; + +: get-column ( column-key table -- column ) + dupd lookup-column [ + nip + ] [ + drop no-column + ] if ; + +: get-entry ( row-key column-key table -- obj ? ) + swapd lookup-row [ + at* + ] [ + 2drop f f + ] if ; + +: (set-entry) ( entry table -- value column-key row ) + [ >r column-key>> r> add-column ] 2keep + dupd >r row-key>> r> (add-row) + >r [ value>> ] keep column-key>> r> ; + +: set-entry ( entry table -- ) + (set-entry) set-at ; + +: delete-entry ( entry table -- ) + >r [ column-key>> ] [ row-key>> ] bi r> + lookup-row [ delete-at ] [ 2drop ] if ; + +: swap-rows ( row-key1 row-key2 table -- ) + [ tuck get-row >r get-row r> ] 3keep + >r >r rot r> r> [ set-row ] keep set-row ; + +: member?* ( obj obj -- bool ) + 2dup = [ 2drop t ] [ member? ] if ; + +: find-by-column ( column-key data table -- seq ) + swapd 2dup lookup-column 2drop + [ + rows>> [ + pick swap at* [ + >r pick r> member?* [ , ] [ drop ] if + ] [ + 2drop + ] if + ] assoc-each + ] { } make 2nip ; + + +TUPLE: vector-table < table ; +: ( -- obj ) + vector-table make-table ; + +: add-hash-vector ( value key hash -- ) + 2dup at* [ + dup vector? [ + 2nip push + ] [ + V{ } clone [ push ] keep + -rot >r >r [ push ] keep r> r> set-at + ] if + ] [ + drop set-at + ] if ; + +M: vector-table add-entry ( entry table -- ) + (set-entry) add-hash-vector ; diff --git a/extra/strings/lib/lib.factor b/extra/strings/lib/lib.factor index c6299e6b08..e1d88e479d 100644 --- a/extra/strings/lib/lib.factor +++ b/extra/strings/lib/lib.factor @@ -1,26 +1,21 @@ -USING: math arrays sequences kernel random splitting strings unicode.case ; +USING: math math.ranges arrays sequences kernel random splitting +strings unicode.case ; IN: strings.lib -: char>digit ( c -- i ) 48 - ; - -: string>digits ( s -- seq ) [ char>digit ] { } map-as ; - : >Upper ( str -- str ) - dup empty? [ - unclip ch>upper 1string prepend - ] unless ; + dup empty? [ unclip ch>upper prefix ] unless ; : >Upper-dashes ( str -- str ) "-" split [ >Upper ] map "-" join ; : lower-alpha-chars ( -- seq ) - 26 [ CHAR: a + ] map ; + CHAR: a CHAR: z [a,b] ; : upper-alpha-chars ( -- seq ) - 26 [ CHAR: A + ] map ; + CHAR: A CHAR: Z [a,b] ; : numeric-chars ( -- seq ) - 10 [ CHAR: 0 + ] map ; + CHAR: 0 CHAR: 9 [a,b] ; : alpha-chars ( -- seq ) lower-alpha-chars upper-alpha-chars append ; diff --git a/extra/sudoku/sudoku.factor b/extra/sudoku/sudoku.factor index 1cb82253b1..93b1804e36 100644 --- a/extra/sudoku/sudoku.factor +++ b/extra/sudoku/sudoku.factor @@ -6,12 +6,12 @@ IN: sudoku SYMBOL: solutions SYMBOL: board -: pair+ swapd + >r + r> ; +: pair+ ( a b c d -- a+b c+d ) swapd + >r + r> ; -: row board get nth ; -: board> row nth ; -: >board row set-nth ; -: f>board f -rot >board ; +: row ( n -- row ) board get nth ; +: board> ( m n -- x ) row nth ; +: >board ( row m n -- ) row set-nth ; +: f>board ( m n -- ) f -rot >board ; : row-contains? ( n y -- ? ) row member? ; : col-contains? ( n x -- ? ) board get swap member? ; diff --git a/extra/symbols/symbols-docs.factor b/extra/symbols/symbols-docs.factor index f542948970..9f79b71365 100644 --- a/extra/symbols/symbols-docs.factor +++ b/extra/symbols/symbols-docs.factor @@ -5,5 +5,5 @@ HELP: SYMBOLS: { $syntax "SYMBOLS: words... ;" } { $values { "words" "a sequence of new words to define" } } { $description "Creates a new word for every token until the ';'." } -{ $examples { $example "USING: prettyprint symbols ;" "SYMBOLS: foo bar baz ;\nfoo . bar . baz ." "foo\nbar\nbaz" } } +{ $examples { $example "USING: prettyprint symbols ;" "IN: scratchpad" "SYMBOLS: foo bar baz ;\nfoo . bar . baz ." "foo\nbar\nbaz" } } { $see-also POSTPONE: SYMBOL: } ; diff --git a/extra/symbols/symbols-tests.factor b/extra/symbols/symbols-tests.factor index 0eacbbfd38..1ae4a38cb7 100755 --- a/extra/symbols/symbols-tests.factor +++ b/extra/symbols/symbols-tests.factor @@ -1,4 +1,4 @@ -USING: kernel symbols tools.test parser generic words ; +USING: kernel symbols tools.test parser generic words accessors ; IN: symbols.tests [ ] [ SYMBOLS: a b c ; ] unit-test @@ -13,3 +13,8 @@ DEFER: blah [ f ] [ \ blah generic? ] unit-test [ t ] [ \ blah symbol? ] unit-test + +[ "IN: symbols.tests USE: symbols SINGLETONS: blah blah blah ;" eval ] +[ error>> error>> def>> \ blah eq? ] +must-fail-with + diff --git a/extra/symbols/symbols.factor b/extra/symbols/symbols.factor index f6254f19de..20cf16e640 100755 --- a/extra/symbols/symbols.factor +++ b/extra/symbols/symbols.factor @@ -1,9 +1,14 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: parser sequences words kernel ; +USING: parser sequences words kernel classes.singleton ; IN: symbols : SYMBOLS: ";" parse-tokens [ create-in dup reset-generic define-symbol ] each ; parsing + +: SINGLETONS: + ";" parse-tokens + [ create-class-in define-singleton-class ] each ; + parsing diff --git a/extra/syndication/authors.txt b/extra/syndication/authors.txt new file mode 100755 index 0000000000..89b32cecee --- /dev/null +++ b/extra/syndication/authors.txt @@ -0,0 +1,3 @@ +Daniel Ehrenberg +Chris Double +Slava Pestov diff --git a/extra/rss/readme.txt b/extra/syndication/readme.txt similarity index 100% rename from extra/rss/readme.txt rename to extra/syndication/readme.txt diff --git a/extra/rss/summary.txt b/extra/syndication/summary.txt similarity index 100% rename from extra/rss/summary.txt rename to extra/syndication/summary.txt diff --git a/extra/rss/rss-tests.factor b/extra/syndication/syndication-tests.factor similarity index 63% rename from extra/rss/rss-tests.factor rename to extra/syndication/syndication-tests.factor index 252defe99b..73541e7908 100755 --- a/extra/rss/rss-tests.factor +++ b/extra/syndication/syndication-tests.factor @@ -1,6 +1,9 @@ -USING: rss io kernel io.files tools.test io.encodings.utf8 -calendar ; -IN: rss.tests +USING: syndication io kernel io.files tools.test io.encodings.utf8 +calendar urls ; +IN: syndication.tests + +\ download-feed must-infer +\ feed>xml must-infer : load-news-file ( filename -- feed ) #! Load an news syndication file and process it, returning @@ -11,32 +14,32 @@ IN: rss.tests feed f "Meerkat" - "http://meerkat.oreillynet.com" + URL" http://meerkat.oreillynet.com" { T{ entry f "XML: A Disruptive Technology" - "http://c.moreover.com/click/here.pl?r123" + URL" http://c.moreover.com/click/here.pl?r123" "\n XML is placing increasingly heavy loads on the existing technical\n infrastructure of the Internet.\n " f } } -} ] [ "extra/rss/rss1.xml" resource-path load-news-file ] unit-test +} ] [ "resource:extra/syndication/test/rss1.xml" load-news-file ] unit-test [ T{ feed f "dive into mark" - "http://example.org/" + URL" http://example.org/" { T{ entry f "Atom draft-07 snapshot" - "http://example.org/2005/04/02/atom" + URL" http://example.org/2005/04/02/atom" "\n
    \n

    [Update: The Atom draft is finished.]

    \n
    \n " T{ timestamp f 2003 12 13 8 29 29 T{ duration f 0 0 0 -4 0 0 } } } } -} ] [ "extra/rss/atom.xml" resource-path load-news-file ] unit-test +} ] [ "resource:extra/syndication/test/atom.xml" load-news-file ] unit-test diff --git a/extra/syndication/syndication.factor b/extra/syndication/syndication.factor new file mode 100644 index 0000000000..12beaf4cd7 --- /dev/null +++ b/extra/syndication/syndication.factor @@ -0,0 +1,135 @@ +! Copyright (C) 2006 Chris Double, Daniel Ehrenberg. +! Portions copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: xml.utilities kernel assocs xml.generator math.order + strings sequences xml.data xml.writer + io.streams.string combinators xml xml.entities io.files io + http.client namespaces xml.generator hashtables + calendar.format accessors continuations urls present ; +IN: syndication + +: any-tag-named ( tag names -- tag-inside ) + f -rot [ tag-named nip dup ] with find 2drop ; + +TUPLE: feed title url entries ; + +: ( -- feed ) feed new ; + +TUPLE: entry title url description date ; + +: set-entries ( feed entries -- feed ) + [ dup url>> ] dip + [ [ derive-url ] change-url ] with map + >>entries ; + +: ( -- entry ) entry new ; + +: try-parsing-timestamp ( string -- timestamp ) + [ rfc822>timestamp ] [ drop rfc3339>timestamp ] recover ; + +: rss1.0-entry ( tag -- entry ) + entry new + swap { + [ "title" tag-named children>string >>title ] + [ "link" tag-named children>string >url >>url ] + [ "description" tag-named children>string >>description ] + [ + f "date" "http://purl.org/dc/elements/1.1/" + tag-named dup [ children>string try-parsing-timestamp ] when + >>date + ] + } cleave ; + +: rss1.0 ( xml -- feed ) + feed new + swap [ + "channel" tag-named + [ "title" tag-named children>string >>title ] + [ "link" tag-named children>string >url >>url ] bi + ] [ "item" tags-named [ rss1.0-entry ] map set-entries ] bi ; + +: rss2.0-entry ( tag -- entry ) + entry new + swap { + [ "title" tag-named children>string >>title ] + [ { "link" "guid" } any-tag-named children>string >url >>url ] + [ "description" tag-named children>string >>description ] + [ + { "date" "pubDate" } any-tag-named + children>string try-parsing-timestamp >>date + ] + } cleave ; + +: rss2.0 ( xml -- feed ) + feed new + swap + "channel" tag-named + [ "title" tag-named children>string >>title ] + [ "link" tag-named children>string >url >>url ] + [ "item" tags-named [ rss2.0-entry ] map set-entries ] + tri ; + +: atom1.0-entry ( tag -- entry ) + entry new + swap { + [ "title" tag-named children>string >>title ] + [ "link" tag-named "href" swap at >url >>url ] + [ + { "content" "summary" } any-tag-named + dup tag-children [ string? not ] contains? + [ tag-children [ write-chunk ] with-string-writer ] + [ children>string ] if >>description + ] + [ + { "published" "updated" "issued" "modified" } + any-tag-named children>string try-parsing-timestamp + >>date + ] + } cleave ; + +: atom1.0 ( xml -- feed ) + feed new + swap + [ "title" tag-named children>string >>title ] + [ "link" tag-named "href" swap at >url >>url ] + [ "entry" tags-named [ atom1.0-entry ] map set-entries ] + tri ; + +: xml>feed ( xml -- feed ) + dup name-tag { + { "RDF" [ rss1.0 ] } + { "rss" [ rss2.0 ] } + { "feed" [ atom1.0 ] } + } case ; + +: read-feed ( string -- feed ) + [ string>xml xml>feed ] with-html-entities ; + +: download-feed ( url -- feed ) + #! Retrieve an news syndication file, return as a feed tuple. + http-get read-feed ; + +! Atom generation +: simple-tag, ( content name -- ) + [ , ] tag, ; + +: simple-tag*, ( content name attrs -- ) + [ , ] tag*, ; + +: entry, ( entry -- ) + "entry" [ + { + [ title>> "title" { { "type" "html" } } simple-tag*, ] + [ url>> present "href" associate "link" swap contained*, ] + [ date>> timestamp>rfc3339 "published" simple-tag, ] + [ description>> [ "content" { { "type" "html" } } simple-tag*, ] when* ] + } cleave + ] tag, ; + +: feed>xml ( feed -- xml ) + "feed" { { "xmlns" "http://www.w3.org/2005/Atom" } } [ + [ title>> "title" simple-tag, ] + [ url>> present "href" associate "link" swap contained*, ] + [ entries>> [ entry, ] each ] + tri + ] make-xml* ; diff --git a/extra/syndication/tags.txt b/extra/syndication/tags.txt new file mode 100644 index 0000000000..c0772185a0 --- /dev/null +++ b/extra/syndication/tags.txt @@ -0,0 +1 @@ +web diff --git a/extra/rss/atom.xml b/extra/syndication/test/atom.xml similarity index 100% rename from extra/rss/atom.xml rename to extra/syndication/test/atom.xml diff --git a/extra/rss/rss1.xml b/extra/syndication/test/rss1.xml similarity index 100% rename from extra/rss/rss1.xml rename to extra/syndication/test/rss1.xml diff --git a/extra/synth/authors.txt b/extra/synth/authors.txt new file mode 100644 index 0000000000..e9c193bac7 --- /dev/null +++ b/extra/synth/authors.txt @@ -0,0 +1 @@ +Alex Chapman diff --git a/extra/synth/buffers/authors.txt b/extra/synth/buffers/authors.txt new file mode 100644 index 0000000000..e9c193bac7 --- /dev/null +++ b/extra/synth/buffers/authors.txt @@ -0,0 +1 @@ +Alex Chapman diff --git a/extra/synth/buffers/buffers.factor b/extra/synth/buffers/buffers.factor new file mode 100644 index 0000000000..faff19d8fd --- /dev/null +++ b/extra/synth/buffers/buffers.factor @@ -0,0 +1,76 @@ +! Copyright (C) 2008 Alex Chapman +! See http://factorcode.org/license.txt for BSD license. +USING: accessors alien.c-types combinators kernel locals math math.ranges openal sequences sequences.merged ; +IN: synth.buffers + +TUPLE: buffer sample-freq 8bit? id ; + +: ( sample-freq 8bit? -- buffer ) + f buffer boa ; + +TUPLE: mono-buffer < buffer data ; + +: ( sample-freq 8bit? -- buffer ) + f f mono-buffer boa ; + +: <8bit-mono-buffer> ( sample-freq -- buffer ) t ; +: <16bit-mono-buffer> ( sample-freq -- buffer ) f ; + +TUPLE: stereo-buffer < buffer left-data right-data ; + +: ( sample-freq 8bit? -- buffer ) + f f f stereo-buffer boa ; + +: <8bit-stereo-buffer> ( sample-freq -- buffer ) t ; +: <16bit-stereo-buffer> ( sample-freq -- buffer ) f ; + +PREDICATE: 8bit-buffer < buffer 8bit?>> ; +PREDICATE: 16bit-buffer < buffer 8bit?>> not ; +INTERSECTION: 8bit-mono-buffer 8bit-buffer mono-buffer ; +INTERSECTION: 16bit-mono-buffer 16bit-buffer mono-buffer ; +INTERSECTION: 8bit-stereo-buffer 8bit-buffer stereo-buffer ; +INTERSECTION: 16bit-stereo-buffer 16bit-buffer stereo-buffer ; + +GENERIC: buffer-format ( buffer -- format ) +M: 8bit-mono-buffer buffer-format drop AL_FORMAT_MONO8 ; +M: 16bit-mono-buffer buffer-format drop AL_FORMAT_MONO16 ; +M: 8bit-stereo-buffer buffer-format drop AL_FORMAT_STEREO8 ; +M: 16bit-stereo-buffer buffer-format drop AL_FORMAT_STEREO16 ; + +: 8bit-buffer-data ( seq -- data size ) + [ 128 * >integer 128 + ] map [ >c-uchar-array ] [ length ] bi ; + +: 16bit-buffer-data ( seq -- data size ) + [ 32768 * >integer ] map [ >c-short-array ] [ length 2 * ] bi ; + +: stereo-data ( stereo-buffer -- left right ) + [ left-data>> ] [ right-data>> ] bi@ ; + +: interleaved-stereo-data ( stereo-buffer -- data ) + stereo-data <2merged> ; + +GENERIC: buffer-data ( buffer -- data size ) +M: 8bit-mono-buffer buffer-data data>> 8bit-buffer-data ; +M: 16bit-mono-buffer buffer-data data>> 16bit-buffer-data ; +M: 8bit-stereo-buffer buffer-data + interleaved-stereo-data 8bit-buffer-data ; +M: 16bit-stereo-buffer buffer-data + interleaved-stereo-data 16bit-buffer-data ; + +: telephone-sample-freq 8000 ; +: half-sample-freq 22050 ; +: cd-sample-freq 44100 ; +: digital-sample-freq 48000 ; +: professional-sample-freq 88200 ; + +: send-buffer ( buffer -- buffer ) + { + [ gen-buffer dup [ >>id ] dip ] + [ buffer-format ] + [ buffer-data ] + [ sample-freq>> alBufferData ] + } cleave ; + +: ?send-buffer ( buffer -- buffer ) + dup id>> [ send-buffer ] unless ; + diff --git a/extra/synth/example/authors.txt b/extra/synth/example/authors.txt new file mode 100644 index 0000000000..e9c193bac7 --- /dev/null +++ b/extra/synth/example/authors.txt @@ -0,0 +1 @@ +Alex Chapman diff --git a/extra/synth/example/example.factor b/extra/synth/example/example.factor new file mode 100644 index 0000000000..3357c103ad --- /dev/null +++ b/extra/synth/example/example.factor @@ -0,0 +1,37 @@ +! Copyright (C) 2008 Alex Chapman +! See http://factorcode.org/license.txt for BSD license. +USING: accessors arrays kernel namespaces openal sequences synth synth.buffers ; +IN: synth.example + +: play-sine-wave ( freq seconds sample-freq -- ) + init-openal + <16bit-mono-buffer> >sine-wave-buffer send-buffer id>> + 1 gen-sources first + [ AL_BUFFER rot set-source-param ] [ source-play ] bi + check-error ; + +: test-instrument1 ( -- harmonics ) + [ + 1 0.5 , + 2 0.125 , + 3 0.0625 , + 4 0.03125 , + ] { } make ; + +: test-instrument2 ( -- harmonics ) + [ + 1 0.25 , + 2 0.25 , + 3 0.25 , + 4 0.25 , + ] { } make ; + +: sine-instrument ( -- harmonics ) + 1 1 1array ; + +: test-note-buffer ( note -- ) + init-openal + test-instrument2 swap cd-sample-freq <16bit-mono-buffer> + >note send-buffer id>> + 1 gen-sources first [ swap queue-buffer ] [ source-play ] bi + check-error ; diff --git a/extra/synth/summary.txt b/extra/synth/summary.txt new file mode 100644 index 0000000000..ece589350d --- /dev/null +++ b/extra/synth/summary.txt @@ -0,0 +1 @@ +Simple sound synthesis using OpenAL. diff --git a/extra/synth/synth.factor b/extra/synth/synth.factor new file mode 100644 index 0000000000..be1e5943af --- /dev/null +++ b/extra/synth/synth.factor @@ -0,0 +1,36 @@ +! Copyright (C) 2008 Alex Chapman +! See http://factorcode.org/license.txt for BSD license. +USING: accessors kernel locals math math.constants math.functions memoize openal synth.buffers sequences sequences.modified sequences.repeating ; +IN: synth + +MEMO: single-sine-wave ( samples/wave -- seq ) + pi 2 * over / [ * sin ] curry map ; + +: (sine-wave) ( samples/wave n-samples -- seq ) + [ single-sine-wave ] dip ; + +: sine-wave ( sample-freq freq seconds -- seq ) + pick * >integer [ /i ] dip (sine-wave) ; + +: >sine-wave-buffer ( freq seconds buffer -- buffer ) + [ sample-freq>> -rot sine-wave ] keep swap >>data ; + +: >silent-buffer ( seconds buffer -- buffer ) + tuck sample-freq>> * >integer 0 >>data ; + +TUPLE: harmonic n amplitude ; +C: harmonic + +TUPLE: note hz secs ; +C: note + +: harmonic-freq ( note harmonic -- freq ) + n>> swap hz>> * ; + +:: note-harmonic-data ( harmonic note buffer -- data ) + buffer sample-freq>> note harmonic harmonic-freq note secs>> sine-wave + harmonic amplitude>> ; + +: >note ( harmonics note buffer -- buffer ) + dup -roll [ note-harmonic-data ] 2curry map >>data ; + diff --git a/extra/tangle/authors.txt b/extra/tangle/authors.txt new file mode 100644 index 0000000000..e9c193bac7 --- /dev/null +++ b/extra/tangle/authors.txt @@ -0,0 +1 @@ +Alex Chapman diff --git a/extra/tangle/html/html-tests.factor b/extra/tangle/html/html-tests.factor new file mode 100644 index 0000000000..88ad748400 --- /dev/null +++ b/extra/tangle/html/html-tests.factor @@ -0,0 +1,7 @@ +USING: kernel semantic-db tangle.html tools.test ; +IN: tangle.html.tests + +[ "test" ] [ "test" >html ] unit-test +[ "
    • An Item
    " ] [ { "An Item" } >html ] unit-test +[ "
    • One
    • Two
    • Three, ah ah ah
    " ] [ { "One" "Two" "Three, ah ah ah" } >html ] unit-test +[ "some link" ] [ "foo/bar" "some link" >html ] unit-test diff --git a/extra/tangle/html/html.factor b/extra/tangle/html/html.factor new file mode 100644 index 0000000000..2ec6b52609 --- /dev/null +++ b/extra/tangle/html/html.factor @@ -0,0 +1,33 @@ +! Copyright (C) 2008 Alex Chapman +! See http://factorcode.org/license.txt for BSD license. +USING: accessors html.elements io io.streams.string kernel namespaces semantic-db sequences strings tangle.path ; +IN: tangle.html + +TUPLE: element attributes ; + +TUPLE: ulist < element items ; +: ( items -- element ) + H{ } clone swap ulist boa ; + +TUPLE: link < element href text ; +: ( href text -- element ) + H{ } clone -rot link boa ; + +GENERIC: >html ( element -- str ) + +M: string >html ( str -- str ) ; + +M: link >html ( link -- str ) + [ > =href a> text>> write ] with-string-writer ; + +M: node >html ( node -- str ) + dup node>path [ + swap node-content >html + ] [ + node-content + ] if* ; + +M: ulist >html ( ulist -- str ) + [ +
      items>> [
    • >html write
    • ] each
    + ] with-string-writer ; diff --git a/extra/tangle/menu/menu.factor b/extra/tangle/menu/menu.factor new file mode 100644 index 0000000000..9740acee1c --- /dev/null +++ b/extra/tangle/menu/menu.factor @@ -0,0 +1,22 @@ +! Copyright (C) 2008 Alex Chapman +! See http://factorcode.org/license.txt for BSD license. +USING: accessors kernel semantic-db sequences tangle.html ; +IN: tangle.menu + +RELATION: subitem-of +RELATION: before + +: get-menus ( -- nodes ) + subitem-of-relation ultimate-objects node-results ; + +: get-menu ( name -- node ) + get-menus [ node-content = ] with find nip ; + +: ensure-menu ( name -- node ) + dup get-menu [ nip ] [ create-node ] if* ; + +: load-menu ( name -- menu ) + get-menu subitem-of-relation get-node-tree-s ; + +: menu>ulist ( menu -- str ) children>> ; +: menu>html ( menu -- str ) menu>ulist >html ; diff --git a/extra/tangle/page/page.factor b/extra/tangle/page/page.factor new file mode 100644 index 0000000000..db3d58d5f3 --- /dev/null +++ b/extra/tangle/page/page.factor @@ -0,0 +1,23 @@ +! Copyright (C) 2008 Alex Chapman +! See http://factorcode.org/license.txt for BSD license. +USING: accessors kernel semantic-db sequences sequences.lib ; +IN: tangle.page + +RELATION: has-abbreviation +RELATION: has-content +RELATION: has-subsection +RELATION: before +RELATION: authored-by +RELATION: authored-on + +TUPLE: page name abbreviation author created content ; +C: page + +: load-page-content ( node -- content ) + has-content-objects [ node-content ] map concat ; + +: load-page ( node -- page ) + dup [ has-abbreviation-objects ?first ] keep + [ authored-by-objects ?first ] keep + [ authored-on-objects ?first ] keep + load-page-content ; diff --git a/extra/tangle/path/path.factor b/extra/tangle/path/path.factor new file mode 100644 index 0000000000..b4151ce1c2 --- /dev/null +++ b/extra/tangle/path/path.factor @@ -0,0 +1,56 @@ +! Copyright (C) 2008 Alex Chapman +! See http://factorcode.org/license.txt for BSD license. +USING: kernel semantic-db sequences sequences.lib splitting ; +IN: tangle.path + +RELATION: has-filename +RELATION: in-directory + +: create-root ( -- node ) "" create-node ; + +: get-root ( -- node ) + in-directory-relation ultimate-objects ?1node-result ; + +: ensure-root ( -- node ) get-root [ create-root ] unless* ; + +: create-file ( parent name -- node ) + create-node swap dupd in-directory ; + +: files-in-directory ( node -- nodes ) in-directory-subjects ; + +: file-in-directory ( name node -- node ) + in-directory-relation subjects-with-cor ?1node-result ; + +: parent-directory ( file-node -- dir-node ) + in-directory-objects ?first ; + +: (path>node) ( node name -- node ) + swap [ file-in-directory ] [ drop f ] if* ; + +: path>node ( path -- node ) + ensure-root swap [ (path>node) ] each ; + +: path>file ( path -- file ) + path>node [ has-filename-subjects ?first ] [ f ] if* ; + +: (node>path) ( root seq node -- seq ) + pick over node= [ + drop nip + ] [ + dup node-content pick push + parent-directory [ + (node>path) + ] [ + 2drop f + ] if* + ] if ; + +: node>path* ( root node -- path ) + V{ } clone swap (node>path) dup empty? + [ drop f ] [ ] if ; + +: node>path ( node -- path ) + ensure-root swap node>path* ; + +: file>path ( node -- path ) + has-filename-objects ?first [ node>path ] [ f ] if* ; diff --git a/extra/tangle/resources/jquery-1.2.3.min.js b/extra/tangle/resources/jquery-1.2.3.min.js new file mode 100644 index 0000000000..3747929d8b --- /dev/null +++ b/extra/tangle/resources/jquery-1.2.3.min.js @@ -0,0 +1,32 @@ +/* + * jQuery 1.2.3 - New Wave Javascript + * + * Copyright (c) 2008 John Resig (jquery.com) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * $Date: 2008-02-06 00:21:25 -0500 (Wed, 06 Feb 2008) $ + * $Rev: 4663 $ + */ +(function(){if(window.jQuery)var _jQuery=window.jQuery;var jQuery=window.jQuery=function(selector,context){return new jQuery.prototype.init(selector,context);};if(window.$)var _$=window.$;window.$=jQuery;var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;var isSimple=/^.[^:#\[\.]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}else if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem)if(elem.id!=match[3])return jQuery().find(selector);else{this[0]=elem;this.length=1;return this;}else +selector=[];}}else +return new jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return new jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(selector.constructor==Array&&selector||(selector.jquery||selector.length&&selector!=window&&!selector.nodeType&&selector[0]!=undefined&&selector[0].nodeType)&&jQuery.makeArray(selector)||[selector]);},jquery:"1.2.3",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;this.each(function(i){if(this==elem)ret=i;});return ret;},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value==undefined)return this.length&&jQuery[type||"attr"](this[0],name)||undefined;else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else +return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else +selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return!selector?this:this.pushStack(jQuery.merge(this.get(),selector.constructor==String?jQuery(selector).get():selector.length!=undefined&&(!selector.nodeName||jQuery.nodeName(selector,"form"))?selector:[selector]));},is:function(selector){return selector?jQuery.multiFilter(selector,this).length>0:false;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=value.constructor==Array?value:[value];jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else +this.value=value;});},html:function(value){return value==undefined?(this.length?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value==null){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data==undefined&&this.length)data=jQuery.data(this[0],key);return data==null&&parts[1]?this.data(parts[0]):data;}else +return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script")){scripts=scripts.add(elem);}else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.prototype.init.prototype=jQuery.prototype;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else +jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==1){target=this;i=0;}for(;i-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else +jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret;function color(elem){if(!jQuery.browser.safari)return false;var ret=document.defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(elem.style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=elem.style.outline;elem.style.outline="0 solid black";elem.style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&elem.style&&elem.style[name])ret=elem.style[name];else if(document.defaultView&&document.defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var getComputedStyle=document.defaultView.getComputedStyle(elem,null);if(getComputedStyle&&!color(elem))ret=getComputedStyle.getPropertyValue(name);else{var swap=[],stack=[];for(var a=elem;a&&color(a);a=a.parentNode)stack.unshift(a);for(var i=0;i]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("",""]||!tags.indexOf("",""]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"
    ","
    "]||!tags.indexOf("",""]||(!tags.indexOf("",""]||!tags.indexOf("",""]||jQuery.browser.msie&&[1,"div
    ","
    "]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf(""&&tags.indexOf("=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else +ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var fix=jQuery.isXMLDoc(elem)?{}:jQuery.props;if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(fix[name]){if(value!=undefined)elem[fix[name]]=value;return elem[fix[name]];}else if(jQuery.browser.msie&&name=="style")return jQuery.attr(elem.style,"cssText",value);else if(value==undefined&&jQuery.browser.msie&&jQuery.nodeName(elem,"form")&&(name=="action"||name=="method"))return elem.getAttributeNode(name).nodeValue;else if(elem.tagName){if(value!=undefined){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem.setAttribute(name,""+value);}if(jQuery.browser.msie&&/href|src/.test(name)&&!jQuery.isXMLDoc(elem))return elem.getAttribute(name,2);return elem.getAttribute(name);}else{if(name=="opacity"&&jQuery.browser.msie){if(value!=undefined){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseFloat(value).toString()=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100).toString():"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(value!=undefined)elem[name]=value;return elem[name];}},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(typeof array!="array")for(var i=0,length=array.length;i*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return im[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false;var re=quickChild;var m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[];var cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&(!elem||n!=elem))r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval!=undefined)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=function(){return fn.apply(this,arguments);};handler.data=data;handler.guid=fn.guid;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){var val;if(typeof jQuery=="undefined"||jQuery.event.triggered)return val;val=jQuery.event.handle.apply(arguments.callee.elem,arguments);return val;});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else +for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data||[]);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event)data.unshift(this.fix({type:type,target:elem}));data[0].type=type;if(exclusive)data[0].exclusive=true;if(jQuery.isFunction(jQuery.data(elem,"handle")))val=jQuery.data(elem,"handle").apply(elem,data);if(!fn&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val;event=jQuery.event.fix(event||window.event||{});var parts=event.type.split(".");event.type=parts[0];var handlers=jQuery.data(this,"events")&&jQuery.data(this,"events")[event.type],args=Array.prototype.slice.call(arguments,1);args.unshift(event);for(var j in handlers){var handler=handlers[j];args[0].handler=handler;args[0].data=handler.data;if(!parts[1]&&!event.exclusive||handler.type==parts[1]){var ret=handler.apply(this,args);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}if(jQuery.browser.msie)event.target=event.preventDefault=event.stopPropagation=event.handler=event.data=null;return val;},fix:function(event){var originalEvent=event;event=jQuery.extend({},originalEvent);event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=originalEvent.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){return this.each(function(){jQuery.event.add(this,type,function(event){jQuery(this).unbind(event);return(fn||data).apply(this,arguments);},fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){if(this[0])return jQuery.event.trigger(type,data,this[0],false,fn);return undefined;},toggle:function(){var args=arguments;return this.click(function(event){this.lastToggle=0==this.lastToggle?1:0;event.preventDefault();return args[this.lastToggle].apply(this,arguments)||false;});},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else +jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.apply(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("
    ").append(res.responseText.replace(//g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=(new Date).getTime();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){var jsonp,jsre=/=\?(&|$)/g,status,data;s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(s.type.toLowerCase()=="get"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&s.type.toLowerCase()=="get"){var ts=(new Date()).getTime();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&s.type.toLowerCase()=="get"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");if((!s.url.indexOf("http")||!s.url.indexOf("//"))&&s.dataType=="script"&&s.type.toLowerCase()=="get"){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xml=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();xml.open(s.type,s.url,s.async,s.username,s.password);try{if(s.data)xml.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xml.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xml.setRequestHeader("X-Requested-With","XMLHttpRequest");xml.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend)s.beforeSend(xml);if(s.global)jQuery.event.trigger("ajaxSend",[xml,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xml&&(xml.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xml)&&"error"||s.ifModified&&jQuery.httpNotModified(xml,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xml,s.dataType);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xml.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else +jQuery.handleError(s,xml,status);complete();if(s.async)xml=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xml){xml.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xml.send(s.data);}catch(e){jQuery.handleError(s,xml,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xml,s]);}function complete(){if(s.complete)s.complete(xml,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xml,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xml;},handleError:function(s,xml,status,e){if(s.error)s.error(xml,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xml,s,e]);},active:0,httpSuccess:function(r){try{return!r.status&&location.protocol=="file:"||(r.status>=200&&r.status<300)||r.status==304||r.status==1223||jQuery.browser.safari&&r.status==undefined;}catch(e){}return false;},httpNotModified:function(xml,url){try{var xmlRes=xml.getResponseHeader("Last-Modified");return xml.status==304||xmlRes==jQuery.lastModified[url]||jQuery.browser.safari&&xml.status==undefined;}catch(e){}return false;},httpData:function(r,type){var ct=r.getResponseHeader("content-type");var xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0;var data=xml?r.responseXML:r.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else +for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else +s.push(encodeURIComponent(j)+"="+encodeURIComponent(a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle(fn,fn2):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall);var hidden=jQuery(this).is(":hidden"),self=this;for(var p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return jQuery.isFunction(opt.complete)&&opt.complete.apply(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else +e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.apply(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(!elem)return undefined;type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",array?jQuery.makeArray(array):[]);return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].apply(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:{slow:600,fast:200}[opt.duration])||400;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.apply(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.apply(this.elem,[this.now,this]);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=(new Date()).getTime();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;ithis.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done&&jQuery.isFunction(this.options.complete))this.options.complete.apply(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.fx.step={scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}};jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),fixed=jQuery.css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&jQuery.css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(jQuery.css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&jQuery.css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||jQuery.css(offsetChild,"position")=="absolute"))||(mozilla&&jQuery.css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l)||0;top+=parseInt(t)||0;}return results;};})(); \ No newline at end of file diff --git a/extra/tangle/resources/weave.html b/extra/tangle/resources/weave.html new file mode 100644 index 0000000000..6f9296e31f --- /dev/null +++ b/extra/tangle/resources/weave.html @@ -0,0 +1,18 @@ + + + + + + +
    + + +
    + + +
    +
    + + diff --git a/extra/tangle/resources/weave.js b/extra/tangle/resources/weave.js new file mode 100644 index 0000000000..2b36982451 --- /dev/null +++ b/extra/tangle/resources/weave.js @@ -0,0 +1,27 @@ +$(function() { $.getJSON("/all", false, function(json) { + var nodes = $('#nodes'); + for (node in json) { + nodes.append(""); + } + nodes.change(function(){ + if (this.value == 'new') { + $('#node-content').hide(); + $('#edit-wrapper').show(); + } else { + $('#node-content').show(); + $('#edit-wrapper').hide(); + $.get('/node', { node_id: this.value }, function(data){ + $('#node-content').text(data); + }); + } + }); + $('#node-submit').click(function(){ + $.post('/node', { node_content: $('#node-content-edit').val() }, function(data){ + nodes.append(""); + var option = nodes.get(0).options[data]; + option.selected = true; + nodes.change(); + }); + return false; + }); +});}) diff --git a/extra/tangle/sandbox/sandbox.factor b/extra/tangle/sandbox/sandbox.factor new file mode 100644 index 0000000000..b6e110ada5 --- /dev/null +++ b/extra/tangle/sandbox/sandbox.factor @@ -0,0 +1,18 @@ +USING: continuations db db.sqlite http.server io.files kernel namespaces semantic-db tangle tangle.path ; +IN: tangle.sandbox + +: db-path "tangle-sandbox.db" temp-file ; +: sandbox-db db-path sqlite-db ; +: delete-db [ db-path delete-file ] ignore-errors ; + +: make-sandbox ( tangle -- ) + [ + init-semantic-db + ensure-root "foo" create-file "First Page" create-node swap has-filename + ] with-tangle ; + +: new-sandbox ( -- ) + development-mode on + delete-db sandbox-db f + [ make-sandbox ] [ ] bi + main-responder set ; diff --git a/extra/tangle/summary.txt b/extra/tangle/summary.txt new file mode 100644 index 0000000000..26f0a3e9af --- /dev/null +++ b/extra/tangle/summary.txt @@ -0,0 +1 @@ +A web framework using semantic-db as a backend diff --git a/extra/tangle/tangle-tests.factor b/extra/tangle/tangle-tests.factor new file mode 100644 index 0000000000..c7e9f2d79a --- /dev/null +++ b/extra/tangle/tangle-tests.factor @@ -0,0 +1,26 @@ +USING: accessors arrays continuations db db.sqlite io.files kernel semantic-db sequences tangle tangle.html tangle.menu tangle.page tangle.path tools.test tools.walker tuple-syntax ; +IN: tangle.tests + +: db-path "tangle-test.db" temp-file ; +: test-db db-path sqlite-db ; +: delete-db [ db-path delete-file ] ignore-errors ; + +: test-tangle ( -- ) + ensure-root "foo" create-file "bar" create-file "pluck_eggs" create-file + "How to Pluck Eggs" create-node swap has-filename + "Main Menu" ensure-menu "home" create-node swap subitem-of ; + +test-db [ + init-semantic-db test-tangle + [ "pluck_eggs" ] [ { "foo" "bar" "pluck_eggs" } path>node [ node-content ] when* ] unit-test + [ "How to Pluck Eggs" ] [ { "foo" "bar" "pluck_eggs" } path>node [ has-filename-subjects first node-content ] when* ] unit-test + [ { "foo" "bar" "pluck_eggs" } ] [ { "foo" "bar" "pluck_eggs" } path>node node>path >array ] unit-test + [ f ] [ TUPLE{ node id: 666 content: "some content" } parent-directory ] unit-test + [ f ] [ TUPLE{ node id: 666 content: "some content" } node>path ] unit-test + [ "Main Menu" ] [ "Main Menu" ensure-menu node-content ] unit-test + [ t ] [ "Main Menu" ensure-menu "Main Menu" ensure-menu node= ] unit-test + [ "Main Menu" { "home" } ] [ "Main Menu" load-menu dup node>> node-content swap children>> [ node>> node-content ] map >array ] unit-test + [ { "home" } ] [ "Main Menu" load-menu menu>ulist items>> [ node>> node-content ] map >array ] unit-test + [ f ] [ TUPLE{ node id: 666 content: "node text" } node>path ] unit-test + [ "node text" ] [ TUPLE{ node id: 666 content: "node text" } >html ] unit-test +] with-db delete-db diff --git a/extra/tangle/tangle.factor b/extra/tangle/tangle.factor new file mode 100644 index 0000000000..1f567a5f0d --- /dev/null +++ b/extra/tangle/tangle.factor @@ -0,0 +1,73 @@ +! Copyright (C) 2008 Alex Chapman +! See http://factorcode.org/license.txt for BSD license. +USING: accessors assocs db db.sqlite db.postgresql +http http.server http.server.dispatchers http.server.responses +http.server.static furnace.actions furnace.json +io io.files json.writer kernel math.parser namespaces +semantic-db sequences strings tangle.path ; +IN: tangle + +GENERIC: render* ( content templater -- output ) +GENERIC: render ( content templater -- ) + +TUPLE: echo-template ; +C: echo-template + +M: echo-template render* drop ; +! METHOD: render* { string echo-template } drop ; +M: object render render* write ; + +TUPLE: tangle db seq templater ; +C: tangle + +: with-tangle ( tangle quot -- ) + [ [ db>> ] [ seq>> ] bi ] dip with-db ; + +: node-response ( id -- response ) + load-node [ node-content "text/plain" ] [ <404> ] if* ; + +: display-node ( params -- response ) + [ + "node_id" swap at* [ + string>number node-response + ] [ + drop <400> + ] if + ] [ + <400> + ] if* ; + +: submit-node ( params -- response ) + [ + "node_content" swap at* [ + create-node id>> number>string "text/plain" + ] [ + drop <400> + ] if + ] [ + <400> + ] if* ; + +: ( -- responder ) + [ params get display-node ] >>display + [ params get submit-node ] >>submit ; + +TUPLE: path-responder ; +C: path-responder + +M: path-responder call-responder* ( path responder -- response ) + drop path>file [ node-content "text/plain" ] [ <404> ] if* ; + +TUPLE: tangle-dispatcher < dispatcher tangle ; + +: ( tangle -- dispatcher ) + tangle-dispatcher new-dispatcher swap >>tangle + >>default + "resource:extra/tangle/resources" "resources" add-responder + "node" add-responder + [ all-node-ids ] >>display "all" add-responder ; + +M: tangle-dispatcher call-responder* ( path dispatcher -- response ) + dup tangle>> [ + find-responder call-responder + ] with-tangle ; diff --git a/extra/tar/tar.factor b/extra/tar/tar.factor index 9b3d2ae79f..644cf9aa72 100755 --- a/extra/tar/tar.factor +++ b/extra/tar/tar.factor @@ -1,102 +1,92 @@ -USING: combinators io io.files io.streams.duplex -io.streams.string kernel math math.parser continuations -namespaces pack prettyprint sequences strings system -hexdump io.encodings.binary inspector accessors ; +USING: combinators io io.files io.streams.string kernel math +math.parser continuations namespaces pack prettyprint sequences +strings system hexdump io.encodings.binary inspector accessors +io.backend symbols byte-arrays ; IN: tar -: zero-checksum 256 ; +: zero-checksum 256 ; inline +: block-size 512 ; inline TUPLE: tar-header name mode uid gid size mtime checksum typeflag linkname magic version uname gname devmajor devminor prefix ; +ERROR: checksum-error ; -: ( -- obj ) tar-header new ; +SYMBOLS: base-dir filename ; -: tar-trim ( seq -- newseq ) - [ "\0 " member? ] trim ; +: tar-trim ( seq -- newseq ) [ "\0 " member? ] trim ; : read-tar-header ( -- obj ) - - 100 read-c-string* over set-tar-header-name - 8 read-c-string* tar-trim oct> over set-tar-header-mode - 8 read-c-string* tar-trim oct> over set-tar-header-uid - 8 read-c-string* tar-trim oct> over set-tar-header-gid - 12 read-c-string* tar-trim oct> over set-tar-header-size - 12 read-c-string* tar-trim oct> over set-tar-header-mtime - 8 read-c-string* tar-trim oct> over set-tar-header-checksum - read1 over set-tar-header-typeflag - 100 read-c-string* over set-tar-header-linkname - 6 read over set-tar-header-magic - 2 read over set-tar-header-version - 32 read-c-string* over set-tar-header-uname - 32 read-c-string* over set-tar-header-gname - 8 read tar-trim oct> over set-tar-header-devmajor - 8 read tar-trim oct> over set-tar-header-devminor - 155 read-c-string* over set-tar-header-prefix ; + \ tar-header new + 100 read-c-string* >>name + 8 read-c-string* tar-trim oct> >>mode + 8 read-c-string* tar-trim oct> >>uid + 8 read-c-string* tar-trim oct> >>gid + 12 read-c-string* tar-trim oct> >>size + 12 read-c-string* tar-trim oct> >>mtime + 8 read-c-string* tar-trim oct> >>checksum + read1 >>typeflag + 100 read-c-string* >>linkname + 6 read >>magic + 2 read >>version + 32 read-c-string* >>uname + 32 read-c-string* >>gname + 8 read tar-trim oct> >>devmajor + 8 read tar-trim oct> >>devminor + 155 read-c-string* >>prefix ; : header-checksum ( seq -- x ) 148 cut-slice 8 tail-slice [ sum ] bi@ + 256 + ; -TUPLE: checksum-error ; -TUPLE: malformed-block-error ; - -SYMBOL: base-dir -SYMBOL: out-stream -SYMBOL: filename - -: (read-data-blocks) ( tar-header -- ) - 512 read [ - over tar-header-size dup 512 <= [ - head-slice - >string write - drop +: read-data-blocks ( tar-header -- ) + dup size>> 0 > [ + block-size read [ + over size>> dup block-size <= [ + head-slice >byte-array write drop + ] [ + drop write + [ block-size - ] change-size + read-data-blocks + ] if ] [ drop - >string write - dup tar-header-size 512 - over set-tar-header-size - (read-data-blocks) - ] if + ] if* ] [ drop - ] if* ; - -: read-data-blocks ( tar-header out -- ) - >r stdio get r> [ - (read-data-blocks) - ] with-stream* ; + ] if ; : parse-tar-header ( seq -- obj ) [ header-checksum ] keep over zero-checksum = [ 2drop \ tar-header new - 0 over set-tar-header-size - 0 over set-tar-header-checksum + 0 >>size + 0 >>checksum ] [ [ read-tar-header ] with-string-reader - [ tar-header-checksum = [ - \ checksum-error new throw - ] unless - ] keep + [ checksum>> = [ checksum-error ] unless ] keep ] if ; ERROR: unknown-typeflag ch ; M: unknown-typeflag summary ( obj -- str ) - ch>> 1string - "Unknown typeflag: " prepend ; + ch>> 1string "Unknown typeflag: " prepend ; -: tar-append-path ( path -- newpath ) +: tar-prepend-path ( path -- newpath ) base-dir get prepend-path ; +: read/write-blocks ( tar-header path -- ) + binary [ read-data-blocks ] with-file-writer ; + ! Normal file -: typeflag-0 - name>> tar-append-path binary - [ read-data-blocks ] keep dispose ; +: typeflag-0 ( header -- ) + dup name>> tar-prepend-path read/write-blocks ; ! Hard link : typeflag-1 ( header -- ) unknown-typeflag ; ! Symlink -: typeflag-2 ( header -- ) unknown-typeflag ; +: typeflag-2 ( header -- ) + [ name>> ] [ linkname>> ] bi + [ make-link ] 2curry ignore-errors ; ! character special : typeflag-3 ( header -- ) unknown-typeflag ; @@ -106,7 +96,7 @@ M: unknown-typeflag summary ( obj -- str ) ! Directory : typeflag-5 ( header -- ) - tar-header-name tar-append-path make-directories ; + name>> tar-prepend-path make-directories ; ! FIFO : typeflag-6 ( header -- ) unknown-typeflag ; @@ -121,7 +111,7 @@ M: unknown-typeflag summary ( obj -- str ) : typeflag-9 ( header -- ) unknown-typeflag ; ! Global POSIX header -: typeflag-g ( header -- ) unknown-typeflag ; +: typeflag-g ( header -- ) typeflag-0 ; ! Extended POSIX header : typeflag-x ( header -- ) unknown-typeflag ; @@ -143,10 +133,10 @@ M: unknown-typeflag summary ( obj -- str ) ! Long file name : typeflag-L ( header -- ) - [ read-data-blocks ] keep - >string [ zero? ] right-trim filename set - global [ "long filename: " write filename get . flush ] bind - filename get tar-append-path make-directories ; + drop ; + ! [ read-data-blocks ] keep + ! >string [ zero? ] right-trim filename set + ! filename get tar-prepend-path make-directories ; ! Multi volume continuation entry : typeflag-M ( header -- ) unknown-typeflag ; @@ -164,56 +154,39 @@ M: unknown-typeflag summary ( obj -- str ) : typeflag-X ( header -- ) unknown-typeflag ; : (parse-tar) ( -- ) - 512 read - global [ dup hexdump. flush ] bind - [ + block-size read dup length 512 = [ parse-tar-header - ! global [ dup tar-header-name [ print flush ] when* ] bind - dup tar-header-typeflag + dup typeflag>> { { 0 [ typeflag-0 ] } { CHAR: 0 [ typeflag-0 ] } - { CHAR: 1 [ typeflag-1 ] } + ! { CHAR: 1 [ typeflag-1 ] } { CHAR: 2 [ typeflag-2 ] } - { CHAR: 3 [ typeflag-3 ] } - { CHAR: 4 [ typeflag-4 ] } + ! { CHAR: 3 [ typeflag-3 ] } + ! { CHAR: 4 [ typeflag-4 ] } { CHAR: 5 [ typeflag-5 ] } - { CHAR: 6 [ typeflag-6 ] } - { CHAR: 7 [ typeflag-7 ] } + ! { CHAR: 6 [ typeflag-6 ] } + ! { CHAR: 7 [ typeflag-7 ] } { CHAR: g [ typeflag-g ] } - { CHAR: x [ typeflag-x ] } - { CHAR: A [ typeflag-A ] } - { CHAR: D [ typeflag-D ] } - { CHAR: E [ typeflag-E ] } - { CHAR: I [ typeflag-I ] } - { CHAR: K [ typeflag-K ] } - { CHAR: L [ typeflag-L ] } - { CHAR: M [ typeflag-M ] } - { CHAR: N [ typeflag-N ] } - { CHAR: S [ typeflag-S ] } - { CHAR: V [ typeflag-V ] } - { CHAR: X [ typeflag-X ] } - [ unknown-typeflag ] - } case - ! dup tar-header-size zero? [ - ! out-stream get [ dispose ] when - ! out-stream off - ! drop - ! ] [ - ! dup tar-header-name - ! dup parent-dir base-dir prepend-path - ! global [ dup [ . flush ] when* ] bind - ! make-directories - ! out-stream set - ! read-tar-blocks - ! ] if - (parse-tar) - ] when* ; + ! { CHAR: x [ typeflag-x ] } + ! { CHAR: A [ typeflag-A ] } + ! { CHAR: D [ typeflag-D ] } + ! { CHAR: E [ typeflag-E ] } + ! { CHAR: I [ typeflag-I ] } + ! { CHAR: K [ typeflag-K ] } + ! { CHAR: L [ typeflag-L ] } + ! { CHAR: M [ typeflag-M ] } + ! { CHAR: N [ typeflag-N ] } + ! { CHAR: S [ typeflag-S ] } + ! { CHAR: V [ typeflag-V ] } + ! { CHAR: X [ typeflag-X ] } + { f [ drop ] } + } case (parse-tar) + ] [ + drop + ] if ; -: parse-tar ( path -- obj ) - binary [ - "resource:tar-test" base-dir set - global [ nl nl nl "Starting to parse .tar..." print flush ] bind - global [ "Expanding to: " write base-dir get . flush ] bind - (parse-tar) - ] with-file-writer ; +: parse-tar ( path -- ) + normalize-path dup parent-directory base-dir [ + binary [ (parse-tar) ] with-file-reader + ] with-variable ; diff --git a/extra/taxes/taxes-tests.factor b/extra/taxes/taxes-tests.factor index 6aeb5aa098..17d1998f67 100644 --- a/extra/taxes/taxes-tests.factor +++ b/extra/taxes/taxes-tests.factor @@ -96,3 +96,21 @@ IN: taxes.tests 1000000 2008 3 t net dollars/cents ] unit-test + + +[ 30 97 ] [ + 24000 2008 2 f withholding biweekly dollars/cents +] unit-test + +[ 173 66 ] [ + 78250 2008 2 f withholding biweekly dollars/cents +] unit-test + + +[ 138 69 ] [ + 24000 2008 2 f withholding biweekly dollars/cents +] unit-test + +[ 754 72 ] [ + 78250 2008 2 f withholding biweekly dollars/cents +] unit-test diff --git a/extra/taxes/taxes.factor b/extra/taxes/taxes.factor index f1f3868ec8..5522dd9bcb 100644 --- a/extra/taxes/taxes.factor +++ b/extra/taxes/taxes.factor @@ -1,5 +1,5 @@ USING: arrays assocs kernel math math.intervals namespaces -sequences combinators.lib money ; +sequences combinators.lib money math.order ; IN: taxes : monthly ( x -- y ) 12 / ; @@ -33,6 +33,13 @@ TUPLE: fica-base-unknown ; ! Employer tax only, not withheld : futa-tax-rate ( -- x ) DECIMAL: .062 ; inline +: futa-base-rate ( -- x ) 7000 ; inline +: futa-tax-offset-credit ( -- x ) DECIMAL: .054 ; inline + +: futa-tax ( salary w4 -- x ) + drop futa-base-rate min + futa-tax-rate futa-tax-offset-credit - + * ; ! No base rate for medicare; all wages subject : medicare-tax-rate ( -- x ) DECIMAL: .0145 ; inline @@ -47,7 +54,7 @@ TUPLE: tax-table single married ; : ( single married class -- obj ) >r tax-table boa r> construct-delegate ; -: tax-bracket-range dup second swap first - ; +: tax-bracket-range ( pair -- n ) dup second swap first - ; : tax-bracket ( tax salary triples -- tax salary ) [ [ tax-bracket-range min ] keep third * + ] 2keep diff --git a/extra/tetris/board/board.factor b/extra/tetris/board/board.factor index 532978e359..3e4548078c 100644 --- a/extra/tetris/board/board.factor +++ b/extra/tetris/board/board.factor @@ -47,7 +47,7 @@ TUPLE: board width height rows ; ] if ; : remove-full-rows ( board -- ) - dup board-rows [ row-not-full? ] subset swap set-board-rows ; + dup board-rows [ row-not-full? ] filter swap set-board-rows ; : check-rows ( board -- n ) #! remove full rows, then add blank ones at the top, returning the number diff --git a/extra/tetris/game/game.factor b/extra/tetris/game/game.factor index 644a9be1b5..90df619ff7 100644 --- a/extra/tetris/game/game.factor +++ b/extra/tetris/game/game.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2006, 2007 Alex Chapman ! See http://factorcode.org/license.txt for BSD license. USING: kernel sequences math math.functions tetris.board -tetris.piece tetris.tetromino lazy-lists combinators system ; +tetris.piece tetris.tetromino lists combinators system ; IN: tetris.game TUPLE: tetris pieces last-update update-interval rows score game-state paused? running? ; diff --git a/extra/tetris/piece/piece.factor b/extra/tetris/piece/piece.factor index 981b509bfa..55215dbf6a 100644 --- a/extra/tetris/piece/piece.factor +++ b/extra/tetris/piece/piece.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2006, 2007 Alex Chapman ! See http://factorcode.org/license.txt for BSD license. USING: kernel arrays tetris.tetromino math math.vectors -sequences quotations lazy-lists ; +sequences quotations lists.lazy ; IN: tetris.piece #! A piece adds state to the tetromino that is the piece's delegate. The diff --git a/extra/tools/annotations/annotations.factor b/extra/tools/annotations/annotations.factor index ef710ea57d..d6016f280c 100755 --- a/extra/tools/annotations/annotations.factor +++ b/extra/tools/annotations/annotations.factor @@ -61,7 +61,7 @@ M: word reset "--- Entering: " write swap . "--- Variable values:" print [ dup get ] H{ } map>assoc describe - ] 2curry swap compose ; + ] 2curry prepose ; : watch-vars ( word vars -- ) dupd [ (watch-vars) ] 2curry annotate ; diff --git a/extra/tools/completion/completion.factor b/extra/tools/completion/completion.factor index b9c37c0656..4bb6d6142f 100755 --- a/extra/tools/completion/completion.factor +++ b/extra/tools/completion/completion.factor @@ -1,12 +1,12 @@ ! Copyright (C) 2005, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -IN: tools.completion USING: kernel arrays sequences math namespaces strings io vectors words assocs combinators sorting unicode.case -unicode.categories ; +unicode.categories math.order ; +IN: tools.completion : (fuzzy) ( accum ch i full -- accum i ? ) - index* + index-from [ [ swap push ] 2keep 1+ t ] [ @@ -52,7 +52,7 @@ unicode.categories ; : rank-completions ( results -- newresults ) sort-keys [ 0 [ first max ] reduce 3 /f ] keep - [ first < ] with subset + [ first < ] with filter [ second ] map ; : complete ( full short -- score ) diff --git a/extra/tools/crossref/crossref.factor b/extra/tools/crossref/crossref.factor index f4515a9ebe..3ff22cb0c6 100755 --- a/extra/tools/crossref/crossref.factor +++ b/extra/tools/crossref/crossref.factor @@ -7,7 +7,7 @@ sorting hashtables vocabs parser source-files ; IN: tools.crossref : usage. ( word -- ) - usage sorted-definitions. ; + smart-usage sorted-definitions. ; : words-matching ( str -- seq ) all-words [ dup word-name ] { } map>assoc completions ; diff --git a/extra/tools/deploy/backend/backend.factor b/extra/tools/deploy/backend/backend.factor index d4fbf1de78..8973b2ea2a 100755 --- a/extra/tools/deploy/backend/backend.factor +++ b/extra/tools/deploy/backend/backend.factor @@ -4,18 +4,18 @@ USING: namespaces continuations.private kernel.private init assocs kernel vocabs words sequences memory io system arrays continuations math definitions mirrors splitting parser classes inspector layouts vocabs.loader prettyprint.config prettyprint -debugger io.streams.c io.streams.duplex io.files io.backend +debugger io.streams.c io.files io.backend quotations io.launcher words.private tools.deploy.config -bootstrap.image io.encodings.utf8 accessors ; +bootstrap.image io.encodings.utf8 destructors accessors ; IN: tools.deploy.backend - + : copy-vm ( executable bundle-name extension -- vm ) [ prepend-path ] dip append vm over copy-file ; - -: copy-fonts ( name dir -- ) - append-path "fonts/" resource-path swap copy-tree-into ; - -: image-name ( vocab bundle-name -- str ) + +: copy-fonts ( name dir -- ) + append-path "resource:fonts/" swap copy-tree-into ; + +: image-name ( vocab bundle-name -- str ) prepend-path ".image" append ; : (copy-lines) ( stream -- ) @@ -31,26 +31,23 @@ IN: tools.deploy.backend +stdout+ >>stderr +closed+ >>stdin +low-priority+ >>priority - utf8 - >r copy-lines r> wait-for-process zero? [ - "Deployment failed" throw - ] unless ; + utf8 + copy-lines + wait-for-process zero? [ "Deployment failed" throw ] unless ; : make-boot-image ( -- ) #! If stage1 image doesn't exist, create one. my-boot-image-name resource-path exists? [ my-arch make-image ] unless ; -: ?, [ , ] [ drop ] if ; - : bootstrap-profile ( -- profile ) - [ - "math" deploy-math? get ?, - "compiler" deploy-compiler? get ?, - "ui" deploy-ui? get ?, - "io" native-io? ?, - "random" deploy-random? get ?, - ] { } make ; + { + { "math" deploy-math? } + { "compiler" deploy-compiler? } + { "ui" deploy-ui? } + { "random" deploy-random? } + } [ nip get ] assoc-filter keys + native-io? [ "io" suffix ] when ; : staging-image-name ( profile -- name ) "staging." @@ -64,11 +61,11 @@ DEFER: ?make-staging-image dup empty? [ "-i=" my-boot-image-name append , ] [ - dup 1 head* ?make-staging-image + dup but-last ?make-staging-image "-resource-path=" "" resource-path append , - "-i=" over 1 head* staging-image-name append , + "-i=" over but-last staging-image-name append , "-run=tools.deploy.restage" , ] if diff --git a/extra/tools/deploy/config/config-docs.factor b/extra/tools/deploy/config/config-docs.factor index 4af1219daf..2960cf452d 100755 --- a/extra/tools/deploy/config/config-docs.factor +++ b/extra/tools/deploy/config/config-docs.factor @@ -96,7 +96,7 @@ HELP: deploy-io { "2" "Basic ANSI C streams" } { "3" "Non-blocking streams and networking" } } -"The default value is 1, basic ANSI C streams. This enables basic console and file I/O, however more advanced features such are not available." } ; +"The default value is 2, basic ANSI C streams. This enables basic console and file I/O, however more advanced features such as networking are not available." } ; HELP: deploy-reflection { $description "The level of reflection support required by the deployed image." diff --git a/extra/tools/deploy/config/config.factor b/extra/tools/deploy/config/config.factor index 589d6c613b..065db4d8c1 100755 --- a/extra/tools/deploy/config/config.factor +++ b/extra/tools/deploy/config/config.factor @@ -22,9 +22,9 @@ SYMBOL: deploy-io { 3 "Level 3 - Non-blocking streams and networking" } } ; -: strip-io? deploy-io get 1 = ; +: strip-io? ( -- ? ) deploy-io get 1 = ; -: native-io? deploy-io get 3 = ; +: native-io? ( -- ? ) deploy-io get 3 = ; SYMBOL: deploy-reflection @@ -38,11 +38,11 @@ SYMBOL: deploy-reflection { 6 "Level 6 - Full environment" } } ; -: strip-word-names? deploy-reflection get 2 < ; -: strip-prettyprint? deploy-reflection get 3 < ; -: strip-debugger? deploy-reflection get 4 < ; -: strip-dictionary? deploy-reflection get 5 < ; -: strip-globals? deploy-reflection get 6 < ; +: strip-word-names? ( -- ? ) deploy-reflection get 2 < ; +: strip-prettyprint? ( -- ? ) deploy-reflection get 3 < ; +: strip-debugger? ( -- ? ) deploy-reflection get 4 < ; +: strip-dictionary? ( -- ? ) deploy-reflection get 5 < ; +: strip-globals? ( -- ? ) deploy-reflection get 6 < ; SYMBOL: deploy-word-props? SYMBOL: deploy-word-defs? diff --git a/extra/tools/deploy/deploy-tests.factor b/extra/tools/deploy/deploy-tests.factor index 37689f749f..8ff22fb1ad 100755 --- a/extra/tools/deploy/deploy-tests.factor +++ b/extra/tools/deploy/deploy-tests.factor @@ -23,7 +23,7 @@ namespaces continuations layouts accessors ; [ ] [ "sudoku" shake-and-bake ] unit-test [ t ] [ - cell 8 = 30 15 ? 100000 * small-enough? + cell 8 = 20 10 ? 100000 * small-enough? ] unit-test [ ] [ "hello-ui" shake-and-bake ] unit-test @@ -37,6 +37,12 @@ namespaces continuations layouts accessors ; cell 8 = 40 20 ? 100000 * small-enough? ] unit-test +[ ] [ "maze" shake-and-bake ] unit-test + +[ t ] [ + cell 8 = 30 15 ? 100000 * small-enough? +] unit-test + [ ] [ "bunny" shake-and-bake ] unit-test [ t ] [ diff --git a/extra/tools/deploy/shaker/shaker.factor b/extra/tools/deploy/shaker/shaker.factor index 82e2652c01..e8675f5891 100755 --- a/extra/tools/deploy/shaker/shaker.factor +++ b/extra/tools/deploy/shaker/shaker.factor @@ -73,7 +73,7 @@ IN: tools.deploy.shaker [ [ word-props swap - '[ , nip member? ] assoc-subset + '[ , nip member? ] assoc-filter f assoc-like ] keep set-word-props ] with each ; @@ -104,24 +104,27 @@ IN: tools.deploy.shaker set-global ; : strip-vocab-globals ( except names -- words ) - [ child-vocabs [ words ] map concat ] map concat diff ; + [ child-vocabs [ words ] map concat ] map concat swap diff ; : stripped-globals ( -- seq ) [ + "callbacks" "alien.compiler" lookup , + { bootstrap.stage2:bootstrap-time continuations:error continuations:error-continuation continuations:error-thread continuations:restarts - error-hook + listener:error-hook init:init-hooks inspector:inspector-hook io.thread:io-thread libc.private:mallocs source-files:source-files - stderr - stdio + input-stream + output-stream + error-stream } % deploy-threads? [ @@ -132,7 +135,7 @@ IN: tools.deploy.shaker [ io.backend:io-backend , - "default-buffer-size" "io.nonblocking" lookup , + "default-buffer-size" "io.ports" lookup , ] { } make { "alarms" "io" "tools" } strip-vocab-globals % @@ -141,10 +144,11 @@ IN: tools.deploy.shaker { gensym + name>char-hook classes:class-and-cache classes:class-not-cache classes:class-or-cache - classes:class<-cache + classes:class<=-cache classes:classes-intersect-cache classes:update-map command-line:main-vocab-hook @@ -166,6 +170,8 @@ IN: tools.deploy.shaker vocabs:load-vocab-hook word } % + + { } { "optimizer.math.partial" } strip-vocab-globals % ] when strip-prettyprint? [ @@ -201,8 +207,8 @@ IN: tools.deploy.shaker strip-globals? [ "Stripping globals" show global swap - '[ drop , member? not ] assoc-subset - [ drop string? not ] assoc-subset ! strip CLI args + '[ drop , member? not ] assoc-filter + [ drop string? not ] assoc-filter ! strip CLI args dup keys unparse show 21 setenv ] [ drop ] if ; diff --git a/extra/tools/deploy/shaker/strip-cocoa.factor b/extra/tools/deploy/shaker/strip-cocoa.factor index 038bfde70d..0c77a52f94 100755 --- a/extra/tools/deploy/shaker/strip-cocoa.factor +++ b/extra/tools/deploy/shaker/strip-cocoa.factor @@ -1,6 +1,6 @@ USING: cocoa cocoa.messages cocoa.application cocoa.nibs assocs namespaces kernel words compiler.units sequences -ui.cocoa ; +ui ui.cocoa ; "stop-after-last-window?" get global [ diff --git a/extra/tools/deploy/test/1/1.factor b/extra/tools/deploy/test/1/1.factor index 0bf8b10d0c..0ca85bca8c 100755 --- a/extra/tools/deploy/test/1/1.factor +++ b/extra/tools/deploy/test/1/1.factor @@ -1,6 +1,6 @@ IN: tools.deploy.test.1 USING: threads ; -: deploy-test-1 1000 sleep ; +: deploy-test-1 ( -- ) 1000 sleep ; MAIN: deploy-test-1 diff --git a/extra/tools/deploy/test/2/2.factor b/extra/tools/deploy/test/2/2.factor index e029e3050a..afd83f510e 100755 --- a/extra/tools/deploy/test/2/2.factor +++ b/extra/tools/deploy/test/2/2.factor @@ -1,6 +1,6 @@ IN: tools.deploy.test.2 USING: calendar calendar.format ; -: deploy-test-2 now (timestamp>string) ; +: deploy-test-2 ( -- ) now (timestamp>string) ; MAIN: deploy-test-2 diff --git a/extra/tools/deploy/test/3/3.factor b/extra/tools/deploy/test/3/3.factor index 2f07f4ede5..69287db4e2 100755 --- a/extra/tools/deploy/test/3/3.factor +++ b/extra/tools/deploy/test/3/3.factor @@ -1,7 +1,7 @@ IN: tools.deploy.test.3 USING: io.encodings.ascii io.files kernel ; -: deploy-test-3 +: deploy-test-3 ( -- ) "resource:extra/tools/deploy/test/3/3.factor" ascii file-contents drop ; diff --git a/extra/tools/deploy/windows/windows-tests.factor b/extra/tools/deploy/windows/windows-tests.factor new file mode 100755 index 0000000000..cfc9f6af90 --- /dev/null +++ b/extra/tools/deploy/windows/windows-tests.factor @@ -0,0 +1,7 @@ +IN: tools.deploy.windows.tests +USING: tools.deploy.windows tools.test sequences ; + +[ t ] [ + "foo" "resource:temp/test-copy-files" create-exe-dir + ".exe" tail? +] unit-test diff --git a/extra/tools/deploy/windows/windows.factor b/extra/tools/deploy/windows/windows.factor index 5af3062e39..e0ce2c268a 100755 --- a/extra/tools/deploy/windows/windows.factor +++ b/extra/tools/deploy/windows/windows.factor @@ -2,12 +2,15 @@ ! See http://factorcode.org/license.txt for BSD license. USING: io io.files kernel namespaces sequences system tools.deploy.backend tools.deploy.config assocs hashtables -prettyprint windows.shell32 windows.user32 ; +prettyprint combinators windows.shell32 windows.user32 ; IN: tools.deploy.windows : copy-dlls ( bundle-name -- ) - { "resource:freetype6.dll" "resource:zlib1.dll" "resource:factor.dll" } - swap copy-files-into ; + { + "resource:freetype6.dll" + "resource:zlib1.dll" + "resource:factor.dll" + } swap copy-files-into ; : create-exe-dir ( vocab bundle-name -- vm ) dup copy-dlls @@ -15,11 +18,15 @@ IN: tools.deploy.windows ".exe" copy-vm ; M: winnt deploy* - "." resource-path [ - dup deploy-config [ - [ deploy-name get create-exe-dir ] keep - [ deploy-name get image-name ] keep - [ namespace make-deploy-image ] keep - open-in-explorer - ] bind + "resource:" [ + deploy-name over deploy-config at + [ + { + [ create-exe-dir ] + [ image-name ] + [ drop ] + [ drop deploy-config ] + } 2cleave make-deploy-image + ] + [ nip open-in-explorer ] 2bi ] with-directory ; diff --git a/extra/tools/disassembler/disassembler.factor b/extra/tools/disassembler/disassembler.factor index 39ee85b07a..a7d9da4840 100755 --- a/extra/tools/disassembler/disassembler.factor +++ b/extra/tools/disassembler/disassembler.factor @@ -6,9 +6,9 @@ system math generator.fixup io.encodings.ascii accessors generic ; IN: tools.disassembler -: in-file "gdb-in.txt" temp-file ; +: in-file ( -- path ) "gdb-in.txt" temp-file ; -: out-file "gdb-out.txt" temp-file ; +: out-file ( -- path ) "gdb-out.txt" temp-file ; GENERIC: make-disassemble-cmd ( obj -- ) diff --git a/extra/tools/memory/memory-docs.factor b/extra/tools/memory/memory-docs.factor index 28c219ee4d..821a6ca7f5 100755 --- a/extra/tools/memory/memory-docs.factor +++ b/extra/tools/memory/memory-docs.factor @@ -9,7 +9,7 @@ ARTICLE: "tools.memory" "Object memory tools" "You can query memory status:" { $subsection data-room } { $subsection code-room } -"There are a pair of combinators, analogous to " { $link each } " and " { $link subset } ", which operate on the entire collection of objects in the object heap:" +"There are a pair of combinators, analogous to " { $link each } " and " { $link filter } ", which operate on the entire collection of objects in the object heap:" { $subsection each-object } { $subsection instances } "You can check an object's the heap memory usage:" diff --git a/extra/tools/memory/memory.factor b/extra/tools/memory/memory.factor index b8fdcab280..83da7f22a8 100644 --- a/extra/tools/memory/memory.factor +++ b/extra/tools/memory/memory.factor @@ -2,7 +2,8 @@ ! See http://factorcode.org/license.txt for BSD license. USING: kernel sequences vectors arrays generic assocs io math namespaces parser prettyprint strings io.styles vectors words -system sorting splitting math.parser classes memory combinators ; +system sorting splitting grouping math.parser classes memory +combinators ; IN: tools.memory string "Generation " prepend ] bi* write-total/used/free ] 2each + "Decks" write-total "Cards" write-total ; : write-labelled-size ( n string -- ) diff --git a/extra/tools/profiler/profiler-docs.factor b/extra/tools/profiler/profiler-docs.factor index 89e84bbc86..69edf1a7e0 100755 --- a/extra/tools/profiler/profiler-docs.factor +++ b/extra/tools/profiler/profiler-docs.factor @@ -27,7 +27,7 @@ HELP: counters HELP: counters. { $values { "assoc" "an association list mapping words to integers" } } -{ $description "Prints an association list of call counts to the " { $link stdio } " stream." } ; +{ $description "Prints an association list of call counts to " { $link output-stream } "." } ; HELP: profile { $values { "quot" quotation } } @@ -44,7 +44,7 @@ HELP: vocab-profile. HELP: usage-profile. { $values { "word" word } } { $description "Prints a table of call counts from the most recent invocation of " { $link profile } ", for words which directly call " { $snippet "word" } " only." } -{ $notes "This word obtains the list of static usages with the " { $link usage } " word, and is not aware of dynamic call history. Consider the following scenario. A word " { $snippet "X" } " can execute word " { $snippet "Y" } " in a conditional branch, and " { $snippet "X" } " is executed many times during the profiling run, but this particular branch executing " { $snippet "Y" } " is never taken. However, some other word does execute " { $snippet "Y" } " multiple times. Then " { $snippet "\\ Y usage-profile." } " will list a number of calls to " { $snippet "X" } ", even though " { $snippet "Y" } " was never executed " { $emphasis "from" } " " { $snippet "X" } "." } +{ $notes "This word obtains the list of static usages with the " { $link smart-usage } " word, and is not aware of dynamic call history. Consider the following scenario. A word " { $snippet "X" } " can execute word " { $snippet "Y" } " in a conditional branch, and " { $snippet "X" } " is executed many times during the profiling run, but this particular branch executing " { $snippet "Y" } " is never taken. However, some other word does execute " { $snippet "Y" } " multiple times. Then " { $snippet "\\ Y usage-profile." } " will list a number of calls to " { $snippet "X" } ", even though " { $snippet "Y" } " was never executed " { $emphasis "from" } " " { $snippet "X" } "." } { $examples { $code "\\ + usage-profile." } } ; HELP: vocabs-profile. diff --git a/extra/tools/profiler/profiler-tests.factor b/extra/tools/profiler/profiler-tests.factor index 450a024a1e..335733d109 100755 --- a/extra/tools/profiler/profiler-tests.factor +++ b/extra/tools/profiler/profiler-tests.factor @@ -20,9 +20,9 @@ alien tools.profiler.private sequences ; [ ] [ \ + usage-profile. ] unit-test -: callback-test "void" { } "cdecl" [ ] alien-callback ; +: callback-test ( -- callback ) "void" { } "cdecl" [ ] alien-callback ; -: indirect-test "void" { } "cdecl" alien-indirect ; +: indirect-test ( callback -- ) "void" { } "cdecl" alien-indirect ; : foobar ; diff --git a/extra/tools/profiler/profiler.factor b/extra/tools/profiler/profiler.factor index 467fcc14f4..4ae3666829 100755 --- a/extra/tools/profiler/profiler.factor +++ b/extra/tools/profiler/profiler.factor @@ -39,7 +39,7 @@ M: method-body (profile.) ] with-row ; : counters. ( assoc -- ) - [ second 0 > ] subset sort-values + [ second 0 > ] filter sort-values standard-table-style [ [ counter. ] assoc-each ] tabular-output ; @@ -58,13 +58,13 @@ M: method-body (profile.) "Call counts for words which call " write dup pprint ":" print - usage [ word? ] subset counters counters. ; + smart-usage [ word? ] filter counters counters. ; : vocabs-profile. ( -- ) "Call counts for all vocabularies:" print vocabs [ dup words - [ "predicating" word-prop not ] subset + [ "predicating" word-prop not ] filter [ profile-counter ] map sum ] { } map>assoc counters. ; diff --git a/extra/tools/test/test-docs.factor b/extra/tools/test/test-docs.factor index a605543bda..4b2521d19c 100755 --- a/extra/tools/test/test-docs.factor +++ b/extra/tools/test/test-docs.factor @@ -91,4 +91,4 @@ HELP: run-all-tests HELP: test-failures. { $values { "assoc" "an association list of unit test failures" } } -{ $description "Prints unit test failures output by " { $link run-tests } " or " { $link run-all-tests } " to the " { $link stdio } " stream." } ; +{ $description "Prints unit test failures output by " { $link run-tests } " or " { $link run-all-tests } " to " { $link output-stream } "." } ; diff --git a/extra/tools/test/test.factor b/extra/tools/test/test.factor index 031b3c3af8..8ef80c6add 100755 --- a/extra/tools/test/test.factor +++ b/extra/tools/test/test.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: namespaces arrays prettyprint sequences kernel vectors quotations words parser assocs combinators -continuations debugger io io.files vocabs tools.time +continuations debugger io io.files vocabs vocabs.loader source-files compiler.units inspector inference effects tools.vocabs ; IN: tools.test @@ -19,7 +19,7 @@ SYMBOL: this-test : (unit-test) ( what quot -- ) swap dup . flush this-test set - [ time ] curry failures get [ + failures get [ [ this-test get failure ] recover ] [ call @@ -85,7 +85,7 @@ SYMBOL: this-test : run-tests ( prefix -- failures ) child-vocabs dup empty? [ drop f ] [ [ dup run-test ] { } map>assoc - [ second empty? not ] subset + [ second empty? not ] filter ] if ; : test ( prefix -- ) diff --git a/extra/tools/test/ui/ui.factor b/extra/tools/test/ui/ui.factor index 9b32bc9e10..666a7d24d9 100755 --- a/extra/tools/test/ui/ui.factor +++ b/extra/tools/test/ui/ui.factor @@ -2,7 +2,7 @@ USING: dlists ui.gadgets kernel ui namespaces io.streams.string io ; IN: tools.test.ui -! We can't print to stdio here because that might be a pane +! We can't print to output-stream here because that might be a pane ! stream, and our graft-queue rebinding here would be captured ! by code adding children to the pane... : with-grafted-gadget ( gadget quot -- ) @@ -10,7 +10,7 @@ IN: tools.test.ui \ graft-queue [ over graft notify-queued - swap slip + dip ungraft notify-queued ] with-variable ] with-string-writer print ; diff --git a/extra/tools/threads/threads.factor b/extra/tools/threads/threads.factor index 060377d127..2bd38cf304 100755 --- a/extra/tools/threads/threads.factor +++ b/extra/tools/threads/threads.factor @@ -1,9 +1,9 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -IN: tools.threads USING: threads kernel prettyprint prettyprint.config io io.styles sequences assocs namespaces sorting boxes -heaps.private system math math.parser ; +heaps.private system math math.parser math.order ; +IN: tools.threads : thread. ( thread -- ) dup thread-id pprint-cell diff --git a/extra/tools/time/time-docs.factor b/extra/tools/time/time-docs.factor old mode 100644 new mode 100755 index 36ab3c01d4..fe3d709f78 --- a/extra/tools/time/time-docs.factor +++ b/extra/tools/time/time-docs.factor @@ -6,28 +6,21 @@ ARTICLE: "timing" "Timing code" { $subsection time } "A lower-level word puts timings on the stack, intead of printing:" { $subsection benchmark } -"You can also read the system clock and total garbage collection time directly:" +"You can also read the system clock and garbage collection statistics directly:" { $subsection millis } -{ $subsection gc-time } +{ $subsection gc-stats } { $see-also "profiling" } ; ABOUT: "timing" HELP: benchmark -{ $values { "quot" "a quotation" } { "gctime" "an integer denoting milliseconds" } { "runtime" "an integer denoting milliseconds" } } -{ $description "Runs a quotation, measuring the total wall clock time and the total time spent in the garbage collector." } +{ $values { "quot" "a quotation" } + { "runtime" "an integer denoting milliseconds" } } + { $description "Runs a quotation, measuring the total wall clock time." } { $notes "A nicer word for interactive use is " { $link time } "." } ; HELP: time { $values { "quot" "a quotation" } } -{ $description "Runs a quotation and then prints the total run time and time spent in the garbage collector." } -{ $examples - "This word can be used to compare performance of the non-optimizing and optimizing compilers." - $nl - "First, we time a quotation directly; quotations are compiled by the non-optimizing quotation compiler:" - { $unchecked-example "[ 1000000 0 [ + ] reduce drop ] time" "1116 ms run / 6 ms GC time" } - "Now we define a word and compile it with the optimizing word compiler. This results is faster execution:" - { $unchecked-example ": foo 1000000 0 [ + ] reduce ;" "\\ foo compile" "[ foo drop ] time" "202 ms run / 13 ms GC time" } -} ; +{ $description "Runs a quotation and then prints the total run time and some garbage collection statistics." } ; -{ gc-time benchmark millis time } related-words +{ benchmark millis time } related-words diff --git a/extra/tools/time/time.factor b/extra/tools/time/time.factor index 4862cc2b27..3078f40e1a 100644 --- a/extra/tools/time/time.factor +++ b/extra/tools/time/time.factor @@ -1,14 +1,54 @@ -! Copyright (C) 2003, 2007 Slava Pestov. +! Copyright (C) 2003, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel math memory io namespaces system -math.parser ; +USING: kernel math math.vectors memory io io.styles prettyprint +namespaces system sequences splitting grouping assocs strings ; IN: tools.time -: benchmark ( quot -- gctime runtime ) - millis >r gc-time >r call gc-time r> - millis r> - ; - inline +: benchmark ( quot -- runtime ) + millis >r call millis r> - ; inline + +: simple-table. ( values -- ) + standard-table-style [ + [ + [ + [ + dup string? + [ [ write ] with-cell ] + [ pprint-cell ] + if + ] each + ] with-row + ] each + ] tabular-output ; + +: time. ( data -- ) + unclip + "==== RUNNING TIME" print nl pprint " ms" print nl + 4 cut* + "==== GARBAGE COLLECTION" print nl + [ + 6 group + { + "GC count:" + "Cumulative GC time (ms):" + "Longest GC pause (ms):" + "Average GC pause (ms):" + "Objects copied:" + "Bytes copied:" + } prefix + flip + { "" "Nursery" "Aging" "Tenured" } prefix + simple-table. + ] + [ + nl + { + "Total GC time (ms):" + "Cards scanned:" + "Decks scanned:" + "Code heap literal scans:" + } swap zip simple-table. + ] bi* ; : time ( quot -- ) - benchmark - [ # " ms run / " % # " ms GC time" % ] "" make print flush ; - inline + gc-reset millis >r call gc-stats millis r> - prefix time. ; inline diff --git a/extra/tools/vocabs/browser/browser.factor b/extra/tools/vocabs/browser/browser.factor index db1edbeb61..86035ae1a4 100755 --- a/extra/tools/vocabs/browser/browser.factor +++ b/extra/tools/vocabs/browser/browser.factor @@ -105,8 +105,8 @@ C: vocab-author : vocab-xref ( vocab quot -- vocabs ) >r dup vocab-name swap words r> map - [ [ word? ] subset [ word-vocabulary ] map ] map>set - remove [ ] subset [ vocab ] map ; inline + [ [ word? ] filter [ word-vocabulary ] map ] map>set + remove sift [ vocab ] map ; inline : vocab-uses ( vocab -- vocabs ) [ uses ] vocab-xref ; @@ -143,7 +143,7 @@ C: vocab-author : keyed-vocabs ( str quot -- seq ) all-vocabs [ swap >r - [ >r 2dup r> swap call member? ] subset + [ >r 2dup r> swap call member? ] filter r> swap ] assoc-map 2nip ; inline diff --git a/extra/tools/vocabs/monitor/monitor.factor b/extra/tools/vocabs/monitor/monitor.factor index ab5e8c66b7..ee5198a8f4 100755 --- a/extra/tools/vocabs/monitor/monitor.factor +++ b/extra/tools/vocabs/monitor/monitor.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: threads io.files io.monitors init kernel vocabs vocabs.loader tools.vocabs namespaces continuations -sequences splitting assocs command-line ; +sequences splitting assocs command-line concurrency.messaging io.backend sets ; IN: tools.vocabs.monitor : vocab-dir>vocab-name ( path -- vocab ) @@ -13,30 +13,33 @@ IN: tools.vocabs.monitor dup ".factor" tail? [ parent-directory ] when ; : chop-vocab-root ( path -- path' ) - "resource:" prepend-path (normalize-path) + "resource:" prepend-path normalize-path dup vocab-roots get - [ (normalize-path) ] map + [ normalize-path ] map [ head? ] with find nip ?head drop ; : path>vocab ( path -- vocab ) chop-vocab-root path>vocab-name vocab-dir>vocab-name ; -: monitor-loop ( monitor -- ) +: monitor-loop ( -- ) #! On OS X, monitors give us the full path, so we chop it #! off if its there. - dup next-change drop path>vocab changed-vocab + receive first path>vocab changed-vocab reset-cache monitor-loop ; +: add-monitor-for-path ( path -- ) + dup exists? [ t my-mailbox (monitor) ] when drop ; + : monitor-thread ( -- ) [ [ - "" resource-path t - + vocab-roots get prune [ add-monitor-for-path ] each + H{ } clone changed-vocabs set-global vocabs [ changed-vocab ] each - + monitor-loop ] with-monitors ] ignore-errors ; diff --git a/extra/tools/vocabs/vocabs.factor b/extra/tools/vocabs/vocabs.factor index 40e79ee014..effa17c179 100755 --- a/extra/tools/vocabs/vocabs.factor +++ b/extra/tools/vocabs/vocabs.factor @@ -3,8 +3,8 @@ USING: io.files kernel io.encodings.utf8 vocabs.loader vocabs sequences namespaces math.parser arrays hashtables assocs memoize inspector sorting splitting combinators source-files -io debugger continuations compiler.errors init io.crc32 -sets ; +io debugger continuations compiler.errors init +checksums checksums.crc32 sets ; IN: tools.vocabs : vocab-tests-file ( vocab -- path ) @@ -15,7 +15,7 @@ IN: tools.vocabs dup vocab-dir "tests" append-path vocab-append-path dup [ dup exists? [ dup directory keys - [ ".factor" tail? ] subset + [ ".factor" tail? ] filter [ append-path ] with map ] [ drop f ] if ] [ drop f ] if ; @@ -63,7 +63,7 @@ SYMBOL: failures dup source-files get at [ dup source-file-path dup exists? [ - utf8 file-lines lines-crc32 + utf8 file-lines crc32 checksum-lines swap source-file-checksum = not ] [ 2drop f @@ -90,7 +90,7 @@ SYMBOL: changed-vocabs changed-vocabs get dup [ key? ] [ 2drop t ] if ; : filter-changed ( vocabs -- vocabs' ) - [ changed-vocab? ] subset ; + [ changed-vocab? ] filter ; SYMBOL: modified-sources SYMBOL: modified-docs @@ -127,7 +127,7 @@ SYMBOL: modified-docs modified-sources get modified-docs get ] - [ modified-sources get modified-docs get append swap diff ] bi + [ modified-docs get modified-sources get append diff ] bi ] with-scope ; : do-refresh ( modified-sources modified-docs unchanged -- ) @@ -208,7 +208,7 @@ M: vocab-link summary vocab-summary ; dup vocab-authors-path set-vocab-file-contents ; : subdirs ( dir -- dirs ) - directory [ second ] subset keys natural-sort ; + directory [ second ] filter keys natural-sort ; : (all-child-vocabs) ( root name -- vocabs ) [ vocab-dir append-path subdirs ] keep @@ -260,7 +260,7 @@ MEMO: all-vocabs-seq ( -- seq ) } cond nip ; : filter-dangerous ( seq -- seq' ) - [ vocab-name dangerous? not ] subset ; + [ vocab-name dangerous? not ] filter ; : try-everything ( -- failures ) all-vocabs-seq @@ -273,10 +273,10 @@ MEMO: all-vocabs-seq ( -- seq ) : unrooted-child-vocabs ( prefix -- seq ) dup empty? [ CHAR: . suffix ] unless vocabs - [ find-vocab-root not ] subset + [ find-vocab-root not ] filter [ vocab-name swap ?head CHAR: . rot member? not and - ] with subset + ] with filter [ vocab ] map ; : all-child-vocabs ( prefix -- assoc ) @@ -288,7 +288,7 @@ MEMO: all-vocabs-seq ( -- seq ) : all-child-vocabs-seq ( prefix -- assoc ) vocab-roots get swap [ dupd (all-child-vocabs) - [ vocab-dir? ] with subset + [ vocab-dir? ] with filter ] curry map concat ; : map>set ( seq quot -- ) diff --git a/extra/tools/walker/walker.factor b/extra/tools/walker/walker.factor index 6bf3c53768..41f9f8066d 100755 --- a/extra/tools/walker/walker.factor +++ b/extra/tools/walker/walker.factor @@ -4,7 +4,7 @@ USING: threads kernel namespaces continuations combinators sequences math namespaces.private continuations.private concurrency.messaging quotations kernel.private words sequences.private assocs models arrays accessors -generic generic.standard ; +generic generic.standard definitions ; IN: tools.walker SYMBOL: show-walker-hook ! ( status continuation thread -- ) @@ -64,22 +64,23 @@ M: object add-breakpoint ; : (step-into-quot) ( quot -- ) add-breakpoint call ; -: (step-into-if) ? (step-into-quot) ; +: (step-into-if) ( true false ? -- ) ? (step-into-quot) ; -: (step-into-dispatch) nth (step-into-quot) ; +: (step-into-dispatch) ( array n -- ) nth (step-into-quot) ; : (step-into-execute) ( word -- ) { { [ dup "step-into" word-prop ] [ "step-into" word-prop call ] } { [ dup standard-generic? ] [ effective-method (step-into-execute) ] } { [ dup hook-generic? ] [ effective-method (step-into-execute) ] } + { [ dup uses \ suspend swap member? ] [ execute break ] } { [ dup primitive? ] [ execute break ] } [ word-def (step-into-quot) ] } cond ; \ (step-into-execute) t "step-into?" set-word-prop -: (step-into-continuation) +: (step-into-continuation) ( -- ) continuation callstack >>call break ; ! Messages sent to walker thread @@ -89,7 +90,6 @@ SYMBOL: step-into SYMBOL: step-all SYMBOL: step-into-all SYMBOL: step-back -SYMBOL: detach SYMBOL: abandon SYMBOL: call-in @@ -137,7 +137,7 @@ SYMBOL: +stopped+ { >n ndrop >c c> continue continue-with - stop yield suspend sleep (spawn) + stop suspend (spawn) } [ dup [ execute break ] curry "step-into" set-word-prop @@ -168,10 +168,7 @@ SYMBOL: +stopped+ +running+ set-status ; : walker-stopped ( -- ) - +stopped+ set-status - [ status +stopped+ eq? ] - [ [ drop f ] handle-synchronous ] - [ ] while ; + +stopped+ set-status ; : step-into-all-loop ( -- ) +running+ set-status @@ -259,3 +256,8 @@ SYMBOL: +stopped+ ] 3curry "Walker on " self thread-name append spawn [ associate-thread ] keep ; + +! For convenience +IN: syntax + +: B ( -- ) break ; diff --git a/extra/trees/avl/avl-tests.factor b/extra/trees/avl/avl-tests.factor old mode 100644 new mode 100755 index 570125cb45..5cb6606ce4 --- a/extra/trees/avl/avl-tests.factor +++ b/extra/trees/avl/avl-tests.factor @@ -2,85 +2,79 @@ USING: kernel tools.test trees trees.avl math random sequences assocs ; IN: trees.avl.tests [ "key1" 0 "key2" 0 ] [ - T{ avl-node T{ node f "key1" f f T{ avl-node T{ node f "key2" } 1 } } 2 } + T{ avl-node f "key1" f f T{ avl-node f "key2" f f 1 } 2 } [ single-rotate ] go-left [ node-left dup node-key swap avl-node-balance ] keep dup node-key swap avl-node-balance ] unit-test [ "key1" 0 "key2" 0 ] [ - T{ avl-node T{ node f "key1" f f T{ avl-node T{ node f "key2" } 1 } } 2 } + T{ avl-node f "key1" f f T{ avl-node f "key2" f f f 1 } 2 } [ select-rotate ] go-left [ node-left dup node-key swap avl-node-balance ] keep dup node-key swap avl-node-balance ] unit-test [ "key1" 0 "key2" 0 ] [ - T{ avl-node T{ node f "key1" f T{ avl-node T{ node f "key2" } -1 } } -2 } + T{ avl-node f "key1" f T{ avl-node f "key2" f f f -1 } f -2 } [ single-rotate ] go-right [ node-right dup node-key swap avl-node-balance ] keep dup node-key swap avl-node-balance ] unit-test [ "key1" 0 "key2" 0 ] [ - T{ avl-node T{ node f "key1" f T{ avl-node T{ node f "key2" } -1 } } -2 } + T{ avl-node f "key1" f T{ avl-node f "key2" f f f -1 } f -2 } [ select-rotate ] go-right [ node-right dup node-key swap avl-node-balance ] keep dup node-key swap avl-node-balance ] unit-test [ "key1" -1 "key2" 0 "key3" 0 ] -[ T{ avl-node T{ node f "key1" f f - T{ avl-node T{ node f "key2" f - T{ avl-node T{ node f "key3" } 1 } } - -1 } } - 2 } [ double-rotate ] go-left +[ T{ avl-node f "key1" f f + T{ avl-node f "key2" f + T{ avl-node f "key3" f f f 1 } f -1 } 2 } + [ double-rotate ] go-left [ node-left dup node-key swap avl-node-balance ] keep [ node-right dup node-key swap avl-node-balance ] keep dup node-key swap avl-node-balance ] unit-test [ "key1" 0 "key2" 0 "key3" 0 ] -[ T{ avl-node T{ node f "key1" f f - T{ avl-node T{ node f "key2" f - T{ avl-node T{ node f "key3" } 0 } } - -1 } } - 2 } [ double-rotate ] go-left +[ T{ avl-node f "key1" f f + T{ avl-node f "key2" f + T{ avl-node f "key3" f f f 0 } f -1 } 2 } + [ double-rotate ] go-left [ node-left dup node-key swap avl-node-balance ] keep [ node-right dup node-key swap avl-node-balance ] keep dup node-key swap avl-node-balance ] unit-test [ "key1" 0 "key2" 1 "key3" 0 ] -[ T{ avl-node T{ node f "key1" f f - T{ avl-node T{ node f "key2" f - T{ avl-node T{ node f "key3" } -1 } } - -1 } } - 2 } [ double-rotate ] go-left +[ T{ avl-node f "key1" f f + T{ avl-node f "key2" f + T{ avl-node f "key3" f f f -1 } f -1 } 2 } + [ double-rotate ] go-left [ node-left dup node-key swap avl-node-balance ] keep [ node-right dup node-key swap avl-node-balance ] keep dup node-key swap avl-node-balance ] unit-test [ "key1" 1 "key2" 0 "key3" 0 ] -[ T{ avl-node T{ node f "key1" f - T{ avl-node T{ node f "key2" f f - T{ avl-node T{ node f "key3" } -1 } } - 1 } } - -2 } [ double-rotate ] go-right +[ T{ avl-node f "key1" f + T{ avl-node f "key2" f f + T{ avl-node f "key3" f f f -1 } 1 } f -2 } + [ double-rotate ] go-right [ node-right dup node-key swap avl-node-balance ] keep [ node-left dup node-key swap avl-node-balance ] keep dup node-key swap avl-node-balance ] unit-test [ "key1" 0 "key2" 0 "key3" 0 ] -[ T{ avl-node T{ node f "key1" f - T{ avl-node T{ node f "key2" f f - T{ avl-node T{ node f "key3" } 0 } } - 1 } } - -2 } [ double-rotate ] go-right +[ T{ avl-node f "key1" f + T{ avl-node f "key2" f f + T{ avl-node f "key3" f f f 0 } 1 } f -2 } + [ double-rotate ] go-right [ node-right dup node-key swap avl-node-balance ] keep [ node-left dup node-key swap avl-node-balance ] keep dup node-key swap avl-node-balance ] unit-test [ "key1" 0 "key2" -1 "key3" 0 ] -[ T{ avl-node T{ node f "key1" f - T{ avl-node T{ node f "key2" f f - T{ avl-node T{ node f "key3" } 1 } } - 1 } } - -2 } [ double-rotate ] go-right +[ T{ avl-node f "key1" f + T{ avl-node f "key2" f f + T{ avl-node f "key3" f f f 1 } 1 } f -2 } + [ double-rotate ] go-right [ node-right dup node-key swap avl-node-balance ] keep [ node-left dup node-key swap avl-node-balance ] keep dup node-key swap avl-node-balance ] unit-test diff --git a/extra/trees/avl/avl.factor b/extra/trees/avl/avl.factor index 5c88187c6c..866e035a21 100755 --- a/extra/trees/avl/avl.factor +++ b/extra/trees/avl/avl.factor @@ -1,32 +1,34 @@ ! Copyright (C) 2007 Alex Chapman ! See http://factorcode.org/license.txt for BSD license. -USING: combinators kernel generic math math.functions math.parser -namespaces io prettyprint.backend sequences trees assocs parser ; +USING: combinators kernel generic math math.functions +math.parser namespaces io prettyprint.backend sequences trees +assocs parser accessors math.order ; IN: trees.avl -TUPLE: avl ; - -INSTANCE: avl tree-mixin +TUPLE: avl < tree ; : ( -- tree ) - avl construct-tree ; + avl new-tree ; -TUPLE: avl-node balance ; +TUPLE: avl-node < node balance ; : ( key value -- node ) - swap 0 avl-node boa tuck set-delegate ; + avl-node new-node + 0 >>balance ; -: change-balance ( node amount -- ) - over avl-node-balance + swap set-avl-node-balance ; +: increase-balance ( node amount -- ) + swap [ + ] change-balance drop ; : rotate ( node -- node ) - dup node+link dup node-link pick set-node+link tuck set-node-link ; + dup node+link dup node-link pick set-node+link + tuck set-node-link ; : single-rotate ( node -- node ) - 0 over set-avl-node-balance 0 over node+link set-avl-node-balance rotate ; + 0 over (>>balance) 0 over node+link + (>>balance) rotate ; : pick-balances ( a node -- balance balance ) - avl-node-balance { + balance>> { { [ dup zero? ] [ 2drop 0 0 ] } { [ over = ] [ neg 0 ] } [ 0 swap ] @@ -35,18 +37,22 @@ TUPLE: avl-node balance ; : double-rotate ( node -- node ) [ node+link [ - node-link current-side get neg over pick-balances rot 0 swap set-avl-node-balance - ] keep set-avl-node-balance - ] keep tuck set-avl-node-balance - dup node+link [ rotate ] with-other-side over set-node+link rotate ; + node-link current-side get neg + over pick-balances rot 0 swap (>>balance) + ] keep (>>balance) + ] keep swap >>balance + dup node+link [ rotate ] with-other-side + over set-node+link rotate ; : select-rotate ( node -- node ) - dup node+link avl-node-balance current-side get = [ double-rotate ] [ single-rotate ] if ; + dup node+link balance>> current-side get = + [ double-rotate ] [ single-rotate ] if ; : balance-insert ( node -- node taller? ) dup avl-node-balance { { [ dup zero? ] [ drop f ] } - { [ dup abs 2 = ] [ sgn neg [ select-rotate ] with-side f ] } + { [ dup abs 2 = ] + [ sgn neg [ select-rotate ] with-side f ] } { [ drop t ] [ t ] } ! balance is -1 or 1, tree is taller } cond ; @@ -56,7 +62,8 @@ DEFER: avl-set 2dup node-key before? left right ? [ [ node-link avl-set ] keep swap >r tuck set-node-link r> - [ dup current-side get change-balance balance-insert ] [ f ] if + [ dup current-side get increase-balance balance-insert ] + [ f ] if ] with-side ; : (avl-set) ( value key node -- node taller? ) @@ -65,10 +72,10 @@ DEFER: avl-set ] [ avl-insert ] if ; : avl-set ( value key node -- node taller? ) - [ (avl-set) ] [ t ] if* ; + [ (avl-set) ] [ swap t ] if* ; M: avl set-at ( value key node -- node ) - [ avl-set drop ] change-root ; + [ avl-set drop ] change-root drop ; : delete-select-rotate ( node -- node shorter? ) dup node+link avl-node-balance zero? [ @@ -86,10 +93,10 @@ M: avl set-at ( value key node -- node ) } cond ; : balance-delete ( node -- node shorter? ) - current-side get over avl-node-balance { + current-side get over balance>> { { [ dup zero? ] [ drop neg over set-avl-node-balance f ] } - { [ dupd = ] [ drop 0 over set-avl-node-balance t ] } - [ dupd neg change-balance rebalance-delete ] + { [ dupd = ] [ drop 0 >>balance t ] } + [ dupd neg increase-balance rebalance-delete ] } cond ; : avl-replace-with-extremity ( to-replace node -- node shorter? ) @@ -134,12 +141,12 @@ M: avl-node avl-delete ( key node -- node shorter? deleted? ) ] if ; M: avl delete-at ( key node -- ) - [ avl-delete 2drop ] change-root ; + [ avl-delete 2drop ] change-root drop ; M: avl new-assoc 2drop ; : >avl ( assoc -- avl ) - T{ avl T{ tree f f 0 } } assoc-clone-like ; + T{ avl f f 0 } assoc-clone-like ; M: avl assoc-like drop dup avl? [ >avl ] unless ; diff --git a/extra/trees/splay/splay-tests.factor b/extra/trees/splay/splay-tests.factor index 29ea2eee2d..e54e3cd538 100644 --- a/extra/trees/splay/splay-tests.factor +++ b/extra/trees/splay/splay-tests.factor @@ -1,14 +1,14 @@ ! Copyright (c) 2005 Mackenzie Straight. ! See http://factorcode.org/license.txt for BSD license. USING: kernel tools.test trees.splay math namespaces assocs -sequences random ; +sequences random sets ; IN: trees.splay.tests : randomize-numeric-splay-tree ( splay-tree -- ) 100 [ drop 100 random swap at drop ] with each ; : make-numeric-splay-tree ( n -- splay-tree ) - [ [ dupd set-at ] curry each ] keep ; + [ [ conjoin ] curry each ] keep ; [ t ] [ 100 make-numeric-splay-tree dup randomize-numeric-splay-tree diff --git a/extra/trees/splay/splay.factor b/extra/trees/splay/splay.factor old mode 100644 new mode 100755 index 4b82f86a57..923df4b6e3 --- a/extra/trees/splay/splay.factor +++ b/extra/trees/splay/splay.factor @@ -1,15 +1,13 @@ ! Copyright (c) 2005 Mackenzie Straight. ! See http://factorcode.org/license.txt for BSD license. USING: arrays kernel math namespaces sequences assocs parser -prettyprint.backend trees generic ; +prettyprint.backend trees generic math.order ; IN: trees.splay -TUPLE: splay ; +TUPLE: splay < tree ; : ( -- tree ) - \ splay construct-tree ; - -INSTANCE: splay tree-mixin + \ splay new-tree ; : rotate-right ( node -- node ) dup node-left @@ -30,13 +28,13 @@ INSTANCE: splay tree-mixin drop dup node-right swapd r> swap ; : cmp ( key node -- obj node -1/0/1 ) - 2dup node-key <=> ; + 2dup node-key key-side ; : lcmp ( key node -- obj node -1/0/1 ) - 2dup node-left node-key <=> ; + 2dup node-left node-key key-side ; : rcmp ( key node -- obj node -1/0/1 ) - 2dup node-right node-key <=> ; + 2dup node-right node-key key-side ; DEFER: (splay) @@ -86,7 +84,7 @@ DEFER: (splay) : get-largest ( node -- node ) dup [ dup node-right [ nip get-largest ] when* ] when ; -: splay-largest +: splay-largest ( node -- node ) dup [ dup get-largest node-key swap splay-at ] when ; : splay-join ( n2 n1 -- node ) @@ -131,7 +129,7 @@ M: splay new-assoc 2drop ; : >splay ( assoc -- tree ) - T{ splay T{ tree f f 0 } } assoc-clone-like ; + T{ splay f f 0 } assoc-clone-like ; : SPLAY{ \ } [ >splay ] parse-literal ; parsing diff --git a/extra/trees/trees.factor b/extra/trees/trees.factor index 07497b2098..d22dfdb7f1 100755 --- a/extra/trees/trees.factor +++ b/extra/trees/trees.factor @@ -2,42 +2,49 @@ ! See http://factorcode.org/license.txt for BSD license. USING: kernel generic math sequences arrays io namespaces prettyprint.private kernel.private assocs random combinators -parser prettyprint.backend ; +parser prettyprint.backend math.order accessors ; IN: trees -MIXIN: tree-mixin - TUPLE: tree root count ; +: new-tree ( class -- tree ) + new + f >>root + 0 >>count ; inline + : ( -- tree ) - f 0 tree boa ; + tree new-tree ; -: construct-tree ( class -- tree ) - new over set-delegate ; inline - -INSTANCE: tree tree-mixin - -INSTANCE: tree-mixin assoc +INSTANCE: tree assoc TUPLE: node key value left right ; + +: new-node ( key value class -- node ) + new swap >>value swap >>key ; + : ( key value -- node ) - f f node boa ; + node new-node ; SYMBOL: current-side -: left -1 ; inline -: right 1 ; inline +: left ( -- symbol ) -1 ; inline +: right ( -- symbol ) 1 ; inline -: go-left? ( -- ? ) current-side get left = ; +: key-side ( k1 k2 -- n ) + <=> { + { +lt+ [ -1 ] } + { +eq+ [ 0 ] } + { +gt+ [ 1 ] } + } case ; -: inc-count ( tree -- ) - dup tree-count 1+ swap set-tree-count ; +: go-left? ( -- ? ) current-side get left eq? ; -: dec-count ( tree -- ) - dup tree-count 1- swap set-tree-count ; +: inc-count ( tree -- ) [ 1+ ] change-count drop ; + +: dec-count ( tree -- ) [ 1- ] change-count drop ; : node-link@ ( node ? -- node ) - go-left? xor [ node-left ] [ node-right ] if ; + go-left? xor [ left>> ] [ right>> ] if ; : set-node-link@ ( left parent ? -- ) go-left? xor [ set-node-left ] [ set-node-right ] if ; @@ -47,19 +54,13 @@ SYMBOL: current-side : set-node+link ( child node -- ) t set-node-link@ ; : with-side ( side quot -- ) [ swap current-side set call ] with-scope ; inline -: with-other-side ( quot -- ) current-side get neg swap with-side ; inline +: with-other-side ( quot -- ) + current-side get neg swap with-side ; inline : go-left ( quot -- ) left swap with-side ; inline : go-right ( quot -- ) right swap with-side ; inline -: change-root ( tree quot -- ) - swap [ tree-root swap call ] keep set-tree-root ; inline - : leaf? ( node -- ? ) - dup node-left swap node-right or not ; - -: key-side ( k1 k2 -- side ) - #! side is -1 if k1 < k2, 0 if they are equal, or 1 if k1 > k2 - <=> sgn ; + [ left>> ] [ right>> ] bi or not ; : random-side ( -- side ) left right 2array random ; @@ -76,11 +77,11 @@ SYMBOL: current-side ] [ drop f f ] if* ; M: tree at* ( key tree -- value ? ) - tree-root node-at* ; + root>> node-at* ; : node-set ( value key node -- node ) - 2dup node-key key-side dup zero? [ - drop nip [ set-node-value ] keep + 2dup key>> key-side dup 0 eq? [ + drop nip swap >>value ] [ [ [ node-link [ node-set ] [ swap ] if* ] keep @@ -89,38 +90,30 @@ M: tree at* ( key tree -- value ? ) ] if ; M: tree set-at ( value key tree -- ) - [ [ node-set ] [ swap ] if* ] change-root ; + [ [ node-set ] [ swap ] if* ] change-root drop ; : valid-node? ( node -- ? ) [ - dup dup node-left [ node-key swap node-key before? ] when* >r - dup dup node-right [ node-key swap node-key after? ] when* r> and swap - dup node-left valid-node? swap node-right valid-node? and and + dup dup left>> [ node-key swap node-key before? ] when* >r + dup dup right>> [ node-key swap node-key after? ] when* r> and swap + dup left>> valid-node? swap right>> valid-node? and and ] [ t ] if* ; -: valid-tree? ( tree -- ? ) tree-root valid-node? ; +: valid-tree? ( tree -- ? ) root>> valid-node? ; -: tree-call ( node call -- ) - >r [ node-key ] keep node-value r> call ; inline - -: find-node ( node quot -- key value ? ) - { - { [ over not ] [ 2drop f f f ] } - { [ [ - >r node-left r> find-node - ] 2keep rot ] - [ 2drop t ] } - { [ >r 2nip r> [ tree-call ] 2keep rot ] - [ drop [ node-key ] keep node-value t ] } - [ >r node-right r> find-node ] - } cond ; inline +: (node>alist) ( node -- ) + [ + [ left>> (node>alist) ] + [ [ node-key ] [ node-value ] bi 2array , ] + [ right>> (node>alist) ] + tri + ] when* ; -M: tree-mixin assoc-find ( tree quot -- key value ? ) - >r tree-root r> find-node ; +M: tree >alist [ root>> (node>alist) ] { } make ; -M: tree-mixin clear-assoc - 0 over set-tree-count - f swap set-tree-root ; +M: tree clear-assoc + 0 >>count + f >>root drop ; : copy-node-contents ( new old -- ) dup node-key pick set-node-key node-value swap set-node-value ; @@ -158,29 +151,29 @@ DEFER: delete-node : delete-node ( node -- node ) #! delete this node, returning its replacement - dup node-left [ - dup node-right [ + dup left>> [ + dup right>> [ delete-node-with-two-children ] [ - node-left ! left but no right + left>> ! left but no right ] if ] [ - dup node-right [ - node-right ! right but not left + dup right>> [ + right>> ! right but not left ] [ drop f ! no children ] if ] if ; : delete-bst-node ( key node -- node ) - 2dup node-key key-side dup zero? [ + 2dup node-key key-side dup 0 eq? [ drop nip delete-node ] [ [ tuck node-link delete-bst-node over set-node-link ] with-side ] if ; M: tree delete-at - [ delete-bst-node ] change-root ; + [ delete-bst-node ] change-root drop ; M: tree new-assoc 2drop ; @@ -190,14 +183,12 @@ M: tree clone dup assoc-clone-like ; : >tree ( assoc -- tree ) T{ tree f f 0 } assoc-clone-like ; -M: tree-mixin assoc-like drop dup tree? [ >tree ] unless ; +M: tree assoc-like drop dup tree? [ >tree ] unless ; : TREE{ \ } [ >tree ] parse-literal ; parsing - + M: tree pprint-delims drop \ TREE{ \ } ; - -M: tree-mixin assoc-size tree-count ; -M: tree-mixin clone dup assoc-clone-like ; -M: tree-mixin >pprint-sequence >alist ; -M: tree-mixin pprint-narrow? drop t ; +M: tree assoc-size count>> ; +M: tree >pprint-sequence >alist ; +M: tree pprint-narrow? drop t ; diff --git a/extra/tty-server/tty-server.factor b/extra/tty-server/tty-server.factor index 2936c39070..d4b1a34e76 100644 --- a/extra/tty-server/tty-server.factor +++ b/extra/tty-server/tty-server.factor @@ -6,6 +6,6 @@ IN: tty-server "tty-server" utf8 [ listener ] with-server ; -: default-tty-server 9999 tty-server ; +: default-tty-server ( -- ) 9999 tty-server ; MAIN: default-tty-server diff --git a/extra/tuple-arrays/tuple-arrays-docs.factor b/extra/tuple-arrays/tuple-arrays-docs.factor index d6949eaeac..d0c86986fd 100644 --- a/extra/tuple-arrays/tuple-arrays-docs.factor +++ b/extra/tuple-arrays/tuple-arrays-docs.factor @@ -2,8 +2,8 @@ USING: help.syntax help.markup splitting kernel ; IN: tuple-arrays HELP: tuple-array -{ $description "The class of packed homogeneous tuple arrays. They are created with " { $link } ". All elements are of the same tuple class. Mutations done to an element are not copied back to the packed array unless it is explicitly written back. Packed follows the sequence protocol and is implemented using the " { $link groups } " class." } ; +{ $description "The class of packed homogeneous tuple arrays. They are created with " { $link } ". All elements are of the same tuple class. Mutations done to an element are not copied back to the packed array unless it is explicitly written back.." } ; HELP: { $values { "example" tuple } { "length" "a non-negative integer" } { "tuple-array" tuple-array } } -{ $description "Creates an instance of the " { $link } " class with the given length and containing the given tuple class. The tuple class is specified in the form of an example tuple. If the example tuple has a delegate, the tuple array will store a delegate for each element. Otherwise, the delegate will be assumed to be f." } ; +{ $description "Creates an instance of the " { $link } " class with the given length and containing the given tuple class. The tuple class is specified in the form of an example tuple. If the example tuple has a delegate, the tuple array will store a delegate for each element. Otherwise, the delegate will be assumed to be " { $link f } "." } ; diff --git a/extra/tuple-arrays/tuple-arrays.factor b/extra/tuple-arrays/tuple-arrays.factor index 680610fbce..6a31dac808 100644 --- a/extra/tuple-arrays/tuple-arrays.factor +++ b/extra/tuple-arrays/tuple-arrays.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007 Daniel Ehrenberg. ! See http://factorcode.org/license.txt for BSD license. -USING: splitting classes.tuple classes math kernel sequences -arrays ; +USING: splitting grouping classes.tuple classes math kernel +sequences arrays ; IN: tuple-arrays TUPLE: tuple-array example ; diff --git a/extra/tuple-syntax/tuple-syntax.factor b/extra/tuple-syntax/tuple-syntax.factor index 219df5197c..cf439f6407 100755 --- a/extra/tuple-syntax/tuple-syntax.factor +++ b/extra/tuple-syntax/tuple-syntax.factor @@ -7,7 +7,7 @@ IN: tuple-syntax : parse-slot-writer ( tuple -- slot# ) scan dup "}" = [ 2drop f ] [ - 1 head* swap object-slots slot-named slot-spec-offset + but-last swap object-slots slot-named slot-spec-offset ] if ; : parse-slots ( accum tuple -- accum tuple ) diff --git a/extra/turing/turing.factor b/extra/turing/turing.factor index 0dc90d8cf5..f5b510237b 100644 --- a/extra/turing/turing.factor +++ b/extra/turing/turing.factor @@ -59,12 +59,12 @@ SYMBOL: tape dup state-dir position [ + ] change state-next state set ; -: c +: c ( -- ) #! Print current turing machine state. state get . tape get . 2 position get 2 * + CHAR: \s write "^" print ; -: n +: n ( -- ) #! Do one step and print new state. turing-step c ; diff --git a/extra/ui/backend/backend.factor b/extra/ui/backend/backend.factor index d95cbd69ed..7ca09b89b4 100755 --- a/extra/ui/backend/backend.factor +++ b/extra/ui/backend/backend.factor @@ -5,6 +5,8 @@ IN: ui.backend SYMBOL: ui-backend +HOOK: do-events ui-backend ( -- ) + HOOK: set-title ui-backend ( string world -- ) HOOK: set-fullscreen* ui-backend ( ? world -- ) diff --git a/extra/ui/clipboards/clipboards.factor b/extra/ui/clipboards/clipboards.factor index ab6cc35d8c..4ee54cd833 100644 --- a/extra/ui/clipboards/clipboards.factor +++ b/extra/ui/clipboards/clipboards.factor @@ -5,7 +5,7 @@ IN: ui.clipboards ! Two text transfer buffers TUPLE: clipboard contents ; -: "" clipboard boa ; +: ( -- clipboard ) "" clipboard boa ; GENERIC: paste-clipboard ( gadget clipboard -- ) @@ -26,6 +26,6 @@ SYMBOL: selection 2drop ] if ; -: com-copy clipboard get gadget-copy ; +: com-copy ( gadget -- ) clipboard get gadget-copy ; -: com-copy-selection selection get gadget-copy ; +: com-copy-selection ( gadget -- ) selection get gadget-copy ; diff --git a/extra/ui/cocoa/cocoa.factor b/extra/ui/cocoa/cocoa.factor index 59adcf9af1..d1b7f22b41 100755 --- a/extra/ui/cocoa/cocoa.factor +++ b/extra/ui/cocoa/cocoa.factor @@ -14,18 +14,13 @@ C: handle SINGLETON: cocoa-ui-backend -SYMBOL: stop-after-last-window? - -: event-loop? ( -- ? ) - stop-after-last-window? get-global - [ windows get-global empty? not ] [ t ] if ; - -: event-loop ( -- ) - event-loop? [ +M: cocoa-ui-backend do-events ( -- ) + [ [ - [ NSApp do-events ui-wait ] ui-try - ] with-autorelease-pool event-loop - ] when ; + NSApp [ dup do-event ] [ ] [ ] while drop + ui-wait + ] ui-try + ] with-autorelease-pool ; TUPLE: pasteboard handle ; @@ -112,6 +107,7 @@ M: cocoa-ui-backend ui "UI" assert.app [ [ init-clipboard + stop-after-last-window? off cocoa-init-hook get [ call ] when* start-ui finish-launching diff --git a/extra/ui/cocoa/views/views.factor b/extra/ui/cocoa/views/views.factor index 83890788e3..20e6e19de5 100755 --- a/extra/ui/cocoa/views/views.factor +++ b/extra/ui/cocoa/views/views.factor @@ -1,10 +1,9 @@ ! Copyright (C) 2006, 2008 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. -USING: alien arrays assocs cocoa kernel math cocoa.messages +USING: alien alien.c-types arrays assocs cocoa kernel math cocoa.messages cocoa.subclassing cocoa.classes cocoa.views cocoa.application -cocoa.pasteboard cocoa.types cocoa.windows sequences ui -ui.gadgets ui.gadgets.worlds ui.gestures core-foundation -threads combinators ; +cocoa.pasteboard cocoa.types cocoa.windows sequences ui ui.gadgets +ui.gadgets.worlds ui.gestures core-foundation threads combinators ; IN: ui.cocoa.views : send-mouse-moved ( view event -- ) @@ -360,8 +359,14 @@ CLASS: { ] } ; +: sync-refresh-to-screen ( GLView -- ) + -> openGLContext -> CGLContextObj NSOpenGLCPSwapInterval 1 + CGLSetParameter drop ; + : ( world -- view ) - FactorView over rect-dim [ register-window ] keep ; + FactorView over rect-dim + [ sync-refresh-to-screen ] keep + [ register-window ] keep ; CLASS: { { +superclass+ "NSObject" } diff --git a/extra/ui/commands/commands-docs.factor b/extra/ui/commands/commands-docs.factor index ed524148e3..83628cc171 100644 --- a/extra/ui/commands/commands-docs.factor +++ b/extra/ui/commands/commands-docs.factor @@ -3,13 +3,17 @@ hashtables quotations words classes sequences namespaces arrays assocs ; IN: ui.commands -: command-map-row +: command-map-row ( children -- seq ) [ - dup first gesture>string , - second dup command-name , - dup command-word \ $link swap 2array , - command-description , - ] [ ] make ; + [ first gesture>string , ] + [ + second + [ command-name , ] + [ command-word \ $link swap 2array , ] + [ command-description , ] + tri + ] bi + ] { } make ; : command-map. ( command-map -- ) [ command-map-row ] map @@ -18,10 +22,11 @@ IN: ui.commands $table ; : $command-map ( element -- ) - first2 - dup (command-name) " commands" append $heading - swap command-map - dup command-map-blurb print-element command-map. ; + [ second (command-name) " commands" append $heading ] + [ + first2 swap command-map + [ command-map-blurb print-element ] [ command-map. ] bi + ] bi ; : $command ( element -- ) reverse first3 command-map value-at gesture>string $snippet ; @@ -47,6 +52,7 @@ HELP: command-name { $examples { $example "USING: io ui.commands ;" + "IN: scratchpad" ": com-my-command ;" "\\ com-my-command command-name write" "My Command" @@ -105,6 +111,7 @@ HELP: command-string { $examples { $example "USING: io ui.commands ui.gestures ;" + "IN: scratchpad" ": com-my-command ;" "T{ key-down f { C+ } \"s\" } \\ com-my-command command-string write" "My Command (C+s)" diff --git a/extra/ui/commands/commands.factor b/extra/ui/commands/commands.factor index c7db687dc3..f341595969 100755 --- a/extra/ui/commands/commands.factor +++ b/extra/ui/commands/commands.factor @@ -37,7 +37,7 @@ GENERIC: command-word ( command -- word ) : command-gestures ( class -- hash ) commands values [ [ - [ first ] subset + [ first ] filter [ [ invoke-command ] curry swap set ] assoc-each ] each ] H{ } make-assoc ; @@ -56,7 +56,7 @@ GENERIC: command-word ( command -- word ) M: word command-name ( word -- str ) word-name "com-" ?head drop - dup first Letter? [ 1 tail ] unless + dup first Letter? [ rest ] unless (command-name) ; M: word command-description ( word -- str ) diff --git a/extra/ui/freetype/freetype-docs.factor b/extra/ui/freetype/freetype-docs.factor index f463a7c0e7..855df9f564 100755 --- a/extra/ui/freetype/freetype-docs.factor +++ b/extra/ui/freetype/freetype-docs.factor @@ -38,7 +38,7 @@ HELP: render-glyph { $description "Renders a character and outputs a pointer to the bitmap." } ; HELP: -{ $values { "font" font } { "char" "a non-negative integer" } { "sprite" sprite } } +{ $values { "open-font" font } { "char" "a non-negative integer" } { "sprite" sprite } } { $description "Renders a character to an OpenGL texture and records a display list which draws a quad with this texture. This word allocates native resources which must be freed by " { $link free-sprites } "." } ; HELP: (draw-string) diff --git a/extra/ui/freetype/freetype.factor b/extra/ui/freetype/freetype.factor index 1c83bc9713..3512bbf670 100755 --- a/extra/ui/freetype/freetype.factor +++ b/extra/ui/freetype/freetype.factor @@ -3,7 +3,8 @@ USING: alien alien.accessors alien.c-types arrays io kernel libc math math.vectors namespaces opengl opengl.gl prettyprint assocs sequences io.files io.styles continuations freetype -ui.gadgets.worlds ui.render ui.backend byte-arrays ; +ui.gadgets.worlds ui.render ui.backend byte-arrays accessors +locals ; IN: ui.freetype @@ -41,8 +42,8 @@ M: font hashcode* drop font hashcode* ; ] bind ; M: freetype-renderer free-fonts ( world -- ) - dup world-handle select-gl-context - world-fonts [ nip second free-sprites ] assoc-each ; + [ handle>> select-gl-context ] + [ fonts>> [ nip second free-sprites ] assoc-each ] bi ; : ttf-name ( font style -- name ) 2array H{ @@ -67,7 +68,7 @@ M: freetype-renderer free-fonts ( world -- ) #! We use FT_New_Memory_Face, not FT_New_Face, since #! FT_New_Face only takes an ASCII path name and causes #! problems on localized versions of Windows - freetype -rot 0 f [ + [ freetype ] 2dip 0 f [ FT_New_Memory_Face freetype-error ] keep *void* ; @@ -85,29 +86,29 @@ SYMBOL: dpi : font-units>pixels ( n font -- n ) face-size face-size-y-scale FT_MulFix ; -: init-ascent ( font face -- ) - dup face-y-max swap font-units>pixels swap set-font-ascent ; +: init-ascent ( font face -- font ) + dup face-y-max swap font-units>pixels >>ascent ; inline -: init-descent ( font face -- ) - dup face-y-min swap font-units>pixels swap set-font-descent ; +: init-descent ( font face -- font ) + dup face-y-min swap font-units>pixels >>descent ; inline -: init-font ( font -- ) - dup font-handle 2dup init-ascent dupd init-descent - dup font-ascent over font-descent - ft-ceil - swap set-font-height ; +: init-font ( font -- font ) + dup handle>> init-ascent + dup handle>> init-descent + dup [ ascent>> ] [ descent>> ] bi - ft-ceil >>height ; inline + +: set-char-size ( handle size -- ) + 0 swap 6 shift dpi get-global dup FT_Set_Char_Size freetype-error ; : ( handle -- font ) - H{ } clone - { set-font-handle set-font-widths } font construct - dup init-font ; - -: (open-font) ( font -- open-font ) - first3 >r open-face dup 0 r> 6 shift - dpi get-global dpi get-global FT_Set_Char_Size - freetype-error ; + font new + H{ } clone >>widths + over first2 open-face >>handle + dup handle>> rot third set-char-size + init-font ; M: freetype-renderer open-font ( font -- open-font ) - freetype drop open-fonts get [ (open-font) ] cache ; + freetype drop open-fonts get [ ] cache ; : load-glyph ( font char -- glyph ) >r font-handle dup r> 0 FT_Load_Char @@ -132,30 +133,35 @@ M: freetype-renderer string-height ( open-font string -- h ) load-glyph dup FT_RENDER_MODE_NORMAL FT_Render_Glyph freetype-error ; -: copy-pixel ( bit tex -- bit tex ) - 255 f pick set-alien-unsigned-1 1+ - f pick alien-unsigned-1 - f pick set-alien-unsigned-1 >r 1+ r> 1+ ; +:: copy-pixel ( i j bitmap texture -- i j ) + 255 j texture set-char-nth + i bitmap char-nth j 1 + texture set-char-nth + i 1 + j 2 + ; inline -: (copy-row) ( bit tex bitend texend -- bitend texend ) - >r pick over >= [ - 2nip r> - ] [ - >r copy-pixel r> r> (copy-row) - ] if ; +:: (copy-row) ( i j bitmap texture end -- ) + i end < [ + i j bitmap texture copy-pixel + bitmap texture end (copy-row) + ] when ; inline -: copy-row ( bit tex width width2 -- bitend texend width width2 ) - [ pick + >r pick + r> (copy-row) ] 2keep ; +:: copy-row ( i j bitmap texture width width2 -- i j ) + i j bitmap texture i width + (copy-row) + i width + + j width2 + ; inline -: copy-bitmap ( glyph texture -- ) - over glyph-bitmap-rows >r - over glyph-bitmap-width dup next-power-of-2 2 * - >r >r >r glyph-bitmap-buffer alien-address r> r> r> r> - [ copy-row ] times 2drop 2drop ; +:: copy-bitmap ( glyph texture -- ) + [let* | bitmap [ glyph glyph-bitmap-buffer ] + rows [ glyph glyph-bitmap-rows ] + width [ glyph glyph-bitmap-width ] + width2 [ width next-power-of-2 2 * ] | + 0 0 + rows [ bitmap texture width width2 copy-row ] times + 2drop + ] ; : bitmap>texture ( glyph sprite -- id ) tuck sprite-size2 * 2 * [ - alien-address [ copy-bitmap ] keep gray-texture + [ copy-bitmap ] keep gray-texture ] with-malloc ; : glyph-texture-loc ( glyph font -- loc ) @@ -163,34 +169,47 @@ M: freetype-renderer string-height ( open-font string -- h ) font-ascent swap glyph-hori-bearing-y - ft-floor 2array ; : glyph-texture-size ( glyph -- dim ) - dup glyph-bitmap-width next-power-of-2 - swap glyph-bitmap-rows next-power-of-2 2array ; + [ glyph-bitmap-width next-power-of-2 ] + [ glyph-bitmap-rows next-power-of-2 ] + bi 2array ; -: ( font char -- sprite ) +: ( open-font char -- sprite ) over >r render-glyph dup r> glyph-texture-loc over glyph-size pick glyph-texture-size [ bitmap>texture ] keep [ init-sprite ] keep ; -: draw-char ( open-font char sprites -- ) - [ dupd ] cache nip - sprite-dlist glCallList ; +:: char-sprite ( open-font sprites char -- sprite ) + char sprites [ open-font swap ] cache ; -: (draw-string) ( open-font sprites string loc -- ) +: draw-char ( open-font sprites char loc -- ) + GL_MODELVIEW [ + 0 0 glTranslated + char-sprite sprite-dlist glCallList + ] do-matrix ; + +: char-widths ( open-font string -- widths ) + [ char-width ] with { } map-as ; + +: scan-sums ( seq -- seq' ) + 0 [ + ] accumulate nip ; + +:: (draw-string) ( open-font sprites string loc -- ) GL_TEXTURE_2D [ - [ - [ >r 2dup r> swap draw-char ] each 2drop + loc [ + string open-font string char-widths scan-sums [ + [ open-font sprites ] 2dip draw-char + ] 2each ] with-translation ] do-enabled ; -: font-sprites ( open-font world -- pair ) - world-fonts [ open-font H{ } clone 2array ] cache ; +: font-sprites ( font world -- open-font sprites ) + world-fonts [ open-font H{ } clone 2array ] cache first2 ; M: freetype-renderer draw-string ( font string loc -- ) - >r >r world get font-sprites first2 r> r> (draw-string) ; + >r >r world get font-sprites r> r> (draw-string) ; : run-char-widths ( open-font string -- widths ) - [ char-width ] with { } map-as - dup 0 [ + ] accumulate nip swap 2 v/n v+ ; + char-widths [ scan-sums ] [ 2 v/n ] bi v+ ; M: freetype-renderer x>offset ( x open-font string -- n ) dup >r run-char-widths [ <= ] with find drop diff --git a/extra/ui/gadgets/buttons/buttons.factor b/extra/ui/gadgets/buttons/buttons.factor index 9910082ebf..e452e6c455 100755 --- a/extra/ui/gadgets/buttons/buttons.factor +++ b/extra/ui/gadgets/buttons/buttons.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2005, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: arrays ui.commands ui.gadgets ui.gadgets.borders +USING: accessors arrays ui.commands ui.gadgets ui.gadgets.borders ui.gadgets.labels ui.gadgets.theme ui.gadgets.tracks ui.gadgets.packs ui.gadgets.worlds ui.gestures ui.render kernel math models namespaces sequences strings @@ -48,7 +48,8 @@ TUPLE: button-paint plain rollover pressed selected ; C: button-paint -: find-button [ [ button? ] is? ] find-parent ; +: find-button ( gadget -- button ) + [ [ button? ] is? ] find-parent ; : button-paint ( button paint -- button paint ) over find-button { @@ -126,10 +127,11 @@ M: checkmark-paint draw-interior : toggle-model ( model -- ) [ not ] change-model ; -: checkbox-theme - f over set-gadget-interior - { 5 5 } over set-pack-gap - 1/2 swap set-pack-align ; +: checkbox-theme ( gadget -- ) + f >>interior + { 5 5 } >>gap + 1/2 >>align + drop ; TUPLE: checkbox ; @@ -187,16 +189,18 @@ M: radio-control model-changed #! quot has stack effect ( value model label -- ) swapd [ swapd call gadget, ] 2curry assoc-each ; inline -: radio-button-theme - { 5 5 } over set-pack-gap 1/2 swap set-pack-align ; +: radio-button-theme ( gadget -- ) + { 5 5 } >>gap + 1/2 >>align + drop ; : ( value model label -- gadget ) label-on-right [