]> gitweb.factorcode.org Git - factor.git/commitdiff
io.encodings.iana no longer throws errors for name>encoding/encoding>name
authorDaniel Ehrenberg <littledan@Macintosh-122.(none)>
Wed, 18 Mar 2009 23:13:11 +0000 (18:13 -0500)
committerDaniel Ehrenberg <littledan@Macintosh-122.(none)>
Wed, 18 Mar 2009 23:13:11 +0000 (18:13 -0500)
basis/io/encodings/iana/iana-docs.factor
basis/io/encodings/iana/iana-tests.factor
basis/io/encodings/iana/iana.factor

index c565d79ef5d58294780b4a48c72ee8d3ccf66d2e..628bceac6290e445b840a0c42748e07d7c641f67 100644 (file)
@@ -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
 
index 3175e624cea2f95d7e5686a0d7191f0d1dae1ea9..67b849b2b24a3b4f9dadc67a23b9b3f86f10db2d 100644 (file)
@@ -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
index a8555ac3393bc74d70d633eed2765e04d69e263a..b504bf854a29a224f0ceaaf107b42fb9cd965a29 100644 (file)
@@ -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 )