diff --git a/core/byte-vectors/byte-vectors-docs.factor b/core/byte-vectors/byte-vectors-docs.factor deleted file mode 100644 index 3873f73bfe..0000000000 --- a/core/byte-vectors/byte-vectors-docs.factor +++ /dev/null @@ -1,37 +0,0 @@ -USING: arrays byte-arrays help.markup help.syntax kernel -byte-vectors.private combinators ; -IN: byte-vectors - -ARTICLE: "byte-vectors" "Byte vectors" -"A byte vector is a resizable mutable sequence of unsigned bytes. Byte vector words are found in the " { $vocab-link "byte-vectors" } " vocabulary." -$nl -"Byte vectors form a class:" -{ $subsection byte-vector } -{ $subsection byte-vector? } -"Creating byte vectors:" -{ $subsection >byte-vector } -{ $subsection } -"Literal syntax:" -{ $subsection POSTPONE: BV{ } -"If you don't care about initial capacity, a more elegant way to create a new byte vector is to write:" -{ $code "BV{ } clone" } ; - -ABOUT: "byte-vectors" - -HELP: byte-vector -{ $description "The class of resizable byte vectors. See " { $link "byte-vectors" } " for information." } ; - -HELP: -{ $values { "n" "a positive integer specifying initial capacity" } { "byte-vector" byte-vector } } -{ $description "Creates a new byte vector that can hold " { $snippet "n" } " bytes before resizing." } ; - -HELP: >byte-vector -{ $values { "seq" "a sequence" } { "byte-vector" byte-vector } } -{ $description "Outputs a freshly-allocated byte vector with the same elements as a given sequence." } -{ $errors "Throws an error if the sequence contains elements other than integers." } ; - -HELP: BV{ -{ $syntax "BV{ elements... }" } -{ $values { "elements" "a list of bytes" } } -{ $description "Marks the beginning of a literal byte vector. Literal byte vectors are terminated by " { $link POSTPONE: } } "." } -{ $examples { $code "BV{ 1 2 3 12 }" } } ; diff --git a/core/byte-vectors/byte-vectors-tests.factor b/core/byte-vectors/byte-vectors-tests.factor deleted file mode 100644 index 9a100d9795..0000000000 --- a/core/byte-vectors/byte-vectors-tests.factor +++ /dev/null @@ -1,17 +0,0 @@ -IN: byte-vectors.tests -USING: tools.test byte-vectors vectors sequences kernel -prettyprint ; - -[ 0 ] [ 123 length ] unit-test - -: do-it - 123 [ over push ] each ; - -[ t ] [ - 3 do-it - 3 do-it sequence= -] unit-test - -[ t ] [ BV{ } byte-vector? ] unit-test - -[ "BV{ }" ] [ BV{ } unparse ] unit-test diff --git a/core/byte-vectors/byte-vectors.factor b/core/byte-vectors/byte-vectors.factor deleted file mode 100644 index 6938d02b2f..0000000000 --- a/core/byte-vectors/byte-vectors.factor +++ /dev/null @@ -1,44 +0,0 @@ -! 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 accessors ; -IN: byte-vectors - -TUPLE: byte-vector -{ underlying byte-array } -{ length array-capacity } ; - -: ( n -- byte-vector ) - 0 byte-vector boa ; inline - -: >byte-vector ( seq -- byte-vector ) - T{ byte-vector f B{ } 0 } clone-like ; - -M: byte-vector like - drop dup byte-vector? [ - dup byte-array? - [ dup length byte-vector boa ] [ >byte-vector ] if - ] unless ; - -M: byte-vector new-sequence - drop [ ] [ >fixnum ] bi byte-vector boa ; - -M: byte-vector equal? - over byte-vector? [ sequence= ] [ 2drop f ] if ; - -M: byte-array like - #! If we have an byte-array, we're done. - #! If we have a byte-vector, and it's at full capacity, - #! we're done. Otherwise, call resize-byte-array, which is a - #! relatively fast primitive. - drop dup byte-array? [ - dup byte-vector? [ - [ length ] [ underlying>> ] bi - 2dup length eq? - [ nip ] [ resize-byte-array ] if - ] [ >byte-array ] if - ] unless ; - -M: byte-array new-resizable drop ; - -INSTANCE: byte-vector growable diff --git a/core/byte-vectors/summary.txt b/core/byte-vectors/summary.txt deleted file mode 100644 index e914ebb319..0000000000 --- a/core/byte-vectors/summary.txt +++ /dev/null @@ -1 +0,0 @@ -Growable byte arrays diff --git a/core/byte-vectors/tags.txt b/core/byte-vectors/tags.txt deleted file mode 100644 index 42d711b32b..0000000000 --- a/core/byte-vectors/tags.txt +++ /dev/null @@ -1 +0,0 @@ -collections diff --git a/core/io/streams/byte-array/byte-array-docs.factor b/core/io/streams/byte-array/byte-array-docs.factor deleted file mode 100644 index 7b27621343..0000000000 --- a/core/io/streams/byte-array/byte-array-docs.factor +++ /dev/null @@ -1,34 +0,0 @@ -USING: help.syntax help.markup io byte-arrays quotations ; -IN: io.streams.byte-array - -ABOUT: "io.streams.byte-array" - -ARTICLE: "io.streams.byte-array" "Byte-array streams" -"Byte array streams:" -{ $subsection } -{ $subsection } -"Utility combinators:" -{ $subsection with-byte-reader } -{ $subsection with-byte-writer } ; - -HELP: -{ $values { "byte-array" byte-array } - { "encoding" "an encoding descriptor" } - { "stream" "a new byte reader" } } -{ $description "Creates an input stream reading from a byte array using an encoding." } ; - -HELP: -{ $values { "encoding" "an encoding descriptor" } - { "stream" "a new byte writer" } } -{ $description "Creates an output stream writing data to a byte array using an encoding." } ; - -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 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 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-tests.factor b/core/io/streams/byte-array/byte-array-tests.factor deleted file mode 100644 index 77a9126740..0000000000 --- a/core/io/streams/byte-array/byte-array-tests.factor +++ /dev/null @@ -1,9 +0,0 @@ -USING: tools.test io.streams.byte-array io.encodings.binary -io.encodings.utf8 io kernel arrays strings ; - -[ B{ 1 2 3 } ] [ binary [ { 1 2 3 } write ] with-byte-writer ] unit-test -[ B{ 1 2 3 } ] [ { 1 2 3 } binary [ 3 read ] with-byte-reader ] unit-test - -[ B{ BIN: 11110101 BIN: 10111111 BIN: 10000000 BIN: 10111111 BIN: 11101111 BIN: 10000000 BIN: 10111111 BIN: 11011111 BIN: 10000000 CHAR: x } ] -[ { BIN: 101111111000000111111 BIN: 1111000000111111 BIN: 11111000000 CHAR: x } utf8 [ write ] with-byte-writer ] unit-test -[ { BIN: 101111111000000111111 } t ] [ { BIN: 11110101 BIN: 10111111 BIN: 10000000 BIN: 10111111 } utf8 contents dup >array swap string? ] unit-test diff --git a/core/io/streams/byte-array/byte-array.factor b/core/io/streams/byte-array/byte-array.factor deleted file mode 100644 index 9d89c3d814..0000000000 --- a/core/io/streams/byte-array/byte-array.factor +++ /dev/null @@ -1,16 +0,0 @@ -USING: byte-arrays byte-vectors kernel io.encodings io.streams.string -sequences io namespaces io.encodings.private accessors ; -IN: io.streams.byte-array - -: ( encoding -- stream ) - 512 swap ; - -: with-byte-writer ( encoding quot -- byte-array ) - [ ] dip [ output-stream get ] compose with-output-stream* - dup encoder? [ stream>> ] when >byte-array ; inline - -: ( byte-array encoding -- stream ) - [ >byte-vector dup reverse-here ] dip ; - -: with-byte-reader ( byte-array encoding quot -- ) - [ ] dip with-input-stream* ; inline