diff --git a/basis/tools/hexdump/hexdump.factor b/basis/tools/hexdump/hexdump.factor index 529cf5c5c5..b227a0df33 100644 --- a/basis/tools/hexdump/hexdump.factor +++ b/basis/tools/hexdump/hexdump.factor @@ -1,11 +1,10 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. - USING: accessors ascii byte-arrays byte-vectors combinators -command-line destructors fry io io.encodings io.encodings.binary -io.files io.streams.string kernel literals locals math -math.parser namespaces sequences sequences.private strings typed ; - +command-line destructors io io.encodings io.encodings.binary +io.encodings.string io.encodings.utf8 io.files io.streams.string +kernel literals math math.parser namespaces sequences +sequences.private strings ; IN: tools.hexdump > hexdump-bytes ; +M: string hexdump. utf8 encode hexdump. ; + + : hexdump ( byte-array -- str ) [ hexdump. ] with-string-writer ; diff --git a/basis/urls/encoding/encoding.factor b/basis/urls/encoding/encoding.factor index 22c2dd427d..efb3993809 100644 --- a/basis/urls/encoding/encoding.factor +++ b/basis/urls/encoding/encoding.factor @@ -43,7 +43,7 @@ IN: urls.encoding : (url-encode) ( str quot: ( ch -- ? ) -- encoded ) [ - over byte-array? [ + over byte-sequence? [ '[ dup @ [ , ] [ hex% ] if ] each ] [ [ present ] dip diff --git a/core/byte-arrays/byte-arrays.factor b/core/byte-arrays/byte-arrays.factor index 36a54b9515..ee7f5d660e 100644 --- a/core/byte-arrays/byte-arrays.factor +++ b/core/byte-arrays/byte-arrays.factor @@ -7,6 +7,8 @@ IN: byte-arrays BUILTIN: byte-array { length array-capacity read-only initial: 0 } ; +MIXIN: byte-sequence + PRIMITIVE: (byte-array) ( n -- byte-array ) PRIMITIVE: ( n -- byte-array ) PRIMITIVE: resize-byte-array ( n byte-array -- new-byte-array ) @@ -27,6 +29,7 @@ M: byte-array resize resize-byte-array ; inline INSTANCE: byte-array sequence +INSTANCE: byte-array byte-sequence : 1byte-array ( x -- byte-array ) B{ } 1sequence ; inline diff --git a/core/byte-vectors/byte-vectors.factor b/core/byte-vectors/byte-vectors.factor index b53fd3866d..faf2c0c0d8 100644 --- a/core/byte-vectors/byte-vectors.factor +++ b/core/byte-vectors/byte-vectors.factor @@ -46,3 +46,4 @@ M: byte-array new-resizable drop ; inline M: byte-vector new-resizable drop ; inline INSTANCE: byte-vector growable +INSTANCE: byte-vector byte-sequence