io.encodings.iana no longer throws errors for name>encoding/encoding>name
parent
4aec9d2c46
commit
68a81675c0
|
@ -9,24 +9,15 @@ ARTICLE: "io.encodings.iana" "IANA-registered encoding names"
|
|||
{ $subsection name>encoding }
|
||||
{ $subsection encoding>name }
|
||||
"To let a new encoding be used with the above words, use the following:"
|
||||
{ $subsection register-encoding }
|
||||
"Exceptions when encodings or names are not found:"
|
||||
{ $subsection missing-encoding }
|
||||
{ $subsection missing-name } ;
|
||||
|
||||
HELP: missing-encoding
|
||||
{ $error-description "The error called from " { $link name>encoding } " when there is no encoding descriptor registered corresponding to the given name." } ;
|
||||
|
||||
HELP: missing-name
|
||||
{ $error-description "The error called from " { $link encoding>name } " when there is no name registered corresponding to the given encoding." } ;
|
||||
{ $subsection register-encoding } ;
|
||||
|
||||
HELP: name>encoding
|
||||
{ $values { "name" "an encoding name" } { "encoding" "an encoding descriptor" } }
|
||||
{ $description "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)." } ;
|
||||
{ $description "Given an IANA-registered encoding name, find the encoding descriptor that represents it, or " { $snippet "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" } }
|
||||
{ $description "Given an encoding descriptor, return the preferred IANA name." } ;
|
||||
{ $description "Given an encoding descriptor, return the preferred IANA name. If no name is found, returns " { $snippet "f" } "." } ;
|
||||
|
||||
{ name>encoding encoding>name } related-words
|
||||
|
||||
|
|
|
@ -19,10 +19,10 @@ ebcdic-fisea "EBCDIC-FI-SE-A" register-encoding
|
|||
"csEBCDICFISEA" n>e-table get delete-at
|
||||
ebcdic-fisea e>n-table get delete-at
|
||||
] unit-test
|
||||
[ "EBCDIC-FI-SE-A" name>encoding ] must-fail
|
||||
[ "csEBCDICFISEA" name>encoding ] must-fail
|
||||
[ ebcdic-fisea encoding>name ] must-fail
|
||||
[ f ] [ "EBCDIC-FI-SE-A" name>encoding ] unit-test
|
||||
[ f ] [ "csEBCDICFISEA" name>encoding ] unit-test
|
||||
[ f ] [ ebcdic-fisea encoding>name ] unit-test
|
||||
|
||||
[ ebcdic-fisea "foobar" register-encoding ] must-fail
|
||||
[ "foobar" name>encoding ] must-fail
|
||||
[ ebcdic-fisea encoding>name ] must-fail
|
||||
[ f ] [ "foobar" name>encoding ] unit-test
|
||||
[ f ] [ ebcdic-fisea encoding>name ] unit-test
|
||||
|
|
|
@ -10,15 +10,11 @@ SYMBOL: e>n-table
|
|||
SYMBOL: aliases
|
||||
PRIVATE>
|
||||
|
||||
ERROR: missing-encoding name ;
|
||||
: name>encoding ( name -- encoding/f )
|
||||
n>e-table get-global at ;
|
||||
|
||||
: name>encoding ( name -- encoding )
|
||||
dup n>e-table get-global at [ ] [ missing-encoding ] ?if ;
|
||||
|
||||
ERROR: missing-name encoding ;
|
||||
|
||||
: encoding>name ( encoding -- name )
|
||||
dup e>n-table get-global at [ ] [ missing-name ] ?if ;
|
||||
: encoding>name ( encoding -- name/f )
|
||||
e>n-table get-global at ;
|
||||
|
||||
<PRIVATE
|
||||
: parse-iana ( file -- synonym-set )
|
||||
|
|
Loading…
Reference in New Issue