add unicode control-picturizer and docs

factor-shell
Pi 2017-10-22 12:04:48 -07:00 committed by John Benediktsson
parent 4cb04165db
commit 949b391f02
3 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1 @@
Pi

View File

@ -0,0 +1,16 @@
! Copyright (C) 2017 Pi.
! See http://factorcode.org/license.txt for BSD license.
USING: help.markup help.syntax help.topics 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 ASCII C0 block to their representations in the Control Pictures block. It has no effect on any other characters."
;
ABOUT: "unicode.control-pictures"

View File

@ -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
<PRIVATE
: char>control-picture ( char -- char' )
{
{ [ dup 0x20 < ] [ 0x2400 bitor ] }
{ [ dup 0x7f = ] [ drop 0x2421 ] }
[ ]
} cond ;
PRIVATE>
: control-pictures ( string -- string )
[ char>control-picture ] map ;