From: Alex Maestas Date: Thu, 29 Sep 2022 20:38:14 +0000 (+0000) Subject: Promote this to basis X-Git-Tag: 0.99~1064 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=888bf03204cc30ea1066a3e1af4edd49509c5ad1 Promote this to basis --- diff --git a/basis/unicode/control-pictures/authors.txt b/basis/unicode/control-pictures/authors.txt new file mode 100644 index 0000000000..1137f8eed6 --- /dev/null +++ b/basis/unicode/control-pictures/authors.txt @@ -0,0 +1 @@ +Pi diff --git a/basis/unicode/control-pictures/control-pictures-docs.factor b/basis/unicode/control-pictures/control-pictures-docs.factor new file mode 100644 index 0000000000..feeca10270 --- /dev/null +++ b/basis/unicode/control-pictures/control-pictures-docs.factor @@ -0,0 +1,16 @@ +! Copyright (C) 2017 Pi. +! See http://factorcode.org/license.txt for BSD license. +USING: help.markup help.syntax strings ; +IN: unicode.control-pictures + +HELP: control-pictures +{ $values + { "string" string } +} +{ $description "Transforms C0 control characters into their corresponding Control Picture block codepoints." } ; + +ARTICLE: "unicode.control-pictures" "Control Pictures" +"The " { $vocab-link "unicode.control-pictures" } " vocabulary provides a utility word " { $link control-pictures } " for transforming characters in the nonprintable " { $url "http://www.unicode.org/charts/PDF/U0000.pdf" "ASCII C0 block" } " to their representations in the " { $url "http://www.unicode.org/charts/PDF/U2400.pdf" "Control Pictures" } " block. It has no effect on any other characters." +; + +ABOUT: "unicode.control-pictures" diff --git a/basis/unicode/control-pictures/control-pictures-tests.factor b/basis/unicode/control-pictures/control-pictures-tests.factor new file mode 100644 index 0000000000..fb19622cee --- /dev/null +++ b/basis/unicode/control-pictures/control-pictures-tests.factor @@ -0,0 +1,5 @@ +USING: sequences strings tools.test unicode.control-pictures ; + +{ "␀␁␂␃␄␅␆␇␈␉␊␋␌␍␎␏␐␑␒␓␔␕␖␗␘␙␚␛␜␝␞␟ !\"#$%&'()*+,-./" } [ + 48 >string control-pictures +] unit-test diff --git a/basis/unicode/control-pictures/control-pictures.factor b/basis/unicode/control-pictures/control-pictures.factor new file mode 100644 index 0000000000..94a439c58c --- /dev/null +++ b/basis/unicode/control-pictures/control-pictures.factor @@ -0,0 +1,18 @@ +! Copyright (C) 2017 Pi. +! See http://factorcode.org/license.txt for BSD license. +USING: combinators kernel math sequences ; +IN: unicode.control-pictures + +control-picture ( char -- char' ) + { + { [ dup 0x20 < ] [ 0x2400 bitor ] } + { [ dup 0x7f = ] [ drop 0x2421 ] } + [ ] + } cond ; + +PRIVATE> + +: control-pictures ( string -- string ) + [ char>control-picture ] map ; diff --git a/extra/unicode/control-pictures/authors.txt b/extra/unicode/control-pictures/authors.txt deleted file mode 100644 index 1137f8eed6..0000000000 --- a/extra/unicode/control-pictures/authors.txt +++ /dev/null @@ -1 +0,0 @@ -Pi diff --git a/extra/unicode/control-pictures/control-pictures-docs.factor b/extra/unicode/control-pictures/control-pictures-docs.factor deleted file mode 100644 index feeca10270..0000000000 --- a/extra/unicode/control-pictures/control-pictures-docs.factor +++ /dev/null @@ -1,16 +0,0 @@ -! Copyright (C) 2017 Pi. -! See http://factorcode.org/license.txt for BSD license. -USING: help.markup help.syntax strings ; -IN: unicode.control-pictures - -HELP: control-pictures -{ $values - { "string" string } -} -{ $description "Transforms C0 control characters into their corresponding Control Picture block codepoints." } ; - -ARTICLE: "unicode.control-pictures" "Control Pictures" -"The " { $vocab-link "unicode.control-pictures" } " vocabulary provides a utility word " { $link control-pictures } " for transforming characters in the nonprintable " { $url "http://www.unicode.org/charts/PDF/U0000.pdf" "ASCII C0 block" } " to their representations in the " { $url "http://www.unicode.org/charts/PDF/U2400.pdf" "Control Pictures" } " block. It has no effect on any other characters." -; - -ABOUT: "unicode.control-pictures" diff --git a/extra/unicode/control-pictures/control-pictures-tests.factor b/extra/unicode/control-pictures/control-pictures-tests.factor deleted file mode 100644 index fb19622cee..0000000000 --- a/extra/unicode/control-pictures/control-pictures-tests.factor +++ /dev/null @@ -1,5 +0,0 @@ -USING: sequences strings tools.test unicode.control-pictures ; - -{ "␀␁␂␃␄␅␆␇␈␉␊␋␌␍␎␏␐␑␒␓␔␕␖␗␘␙␚␛␜␝␞␟ !\"#$%&'()*+,-./" } [ - 48 >string control-pictures -] unit-test diff --git a/extra/unicode/control-pictures/control-pictures.factor b/extra/unicode/control-pictures/control-pictures.factor deleted file mode 100644 index 94a439c58c..0000000000 --- a/extra/unicode/control-pictures/control-pictures.factor +++ /dev/null @@ -1,18 +0,0 @@ -! Copyright (C) 2017 Pi. -! See http://factorcode.org/license.txt for BSD license. -USING: combinators kernel math sequences ; -IN: unicode.control-pictures - -control-picture ( char -- char' ) - { - { [ dup 0x20 < ] [ 0x2400 bitor ] } - { [ dup 0x7f = ] [ drop 0x2421 ] } - [ ] - } cond ; - -PRIVATE> - -: control-pictures ( string -- string ) - [ char>control-picture ] map ;