]> gitweb.factorcode.org Git - factor.git/commitdiff
better base64 docs
authorDoug Coleman <doug.coleman@gmail.com>
Fri, 12 Sep 2008 17:30:42 +0000 (12:30 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Fri, 12 Sep 2008 17:30:42 +0000 (12:30 -0500)
basis/ascii/ascii-docs.factor
basis/base64/base64-docs.factor
basis/base64/base64.factor

index 1f7a56bed9bcff18899d95f15f83f7c842a8b25e..75af8a7102431d74b867feb2c64a04accb710d46 100755 (executable)
@@ -38,7 +38,7 @@ HELP: quotable?
 { $description "Tests for characters which may appear in a Factor string literal without escaping." } ;\r
 \r
 ARTICLE: "ascii" "ASCII character classes"\r
-"Traditional ASCII character classes:"\r
+"The " { $vocab-link "ascii" } " vocabulary implements traditional ASCII character classes:"\r
 { $subsection blank? }\r
 { $subsection letter? }\r
 { $subsection LETTER? }\r
index fe948bf66725156a87d81af31917e006d0e9ad53..ed92a19577737b89bfc536dda894fb41e5a1a413 100644 (file)
@@ -1,20 +1,28 @@
-USING: help.markup help.syntax kernel math ;
+USING: help.markup help.syntax kernel math sequences ;
 IN: base64
 
 HELP: >base64
-{ $values { "seq" "a sequence" } { "base64" "a string of base64 characters" } }
+{ $values { "seq" sequence } { "base64" "a string of base64 characters" } }
 { $description "Converts a sequence to its base64 representation by taking six bits at a time as an index into a lookup table containing alphanumerics, '+', and '/'.  The result is padded with '=' if the input was not a multiple of six bits." }
 { $examples
-    { $unchecked-example "\"The monorail is a free service.\" >base64 ." "VGhlIG1vbm9yYWlsIGlzIGEgZnJlZSBzZXJ2aWNlLg==" }
+    { $example "USING: prettyprint base64 strings ;" "\"The monorail is a free service.\" >base64 >string ." "\"VGhlIG1vbm9yYWlsIGlzIGEgZnJlZSBzZXJ2aWNlLg==\"" }
 }
 { $see-also base64> } ;
 
 HELP: base64>
-{ $values { "base64" "a string of base64 characters" } { "str" "a string" } }
+{ $values { "base64" "a string of base64 characters" } { "seq" sequence } }
 { $description "Converts a string in base64 encoding back into its binary representation." }
 { $examples
-    { $unchecked-example "\"VGhlIG1vbm9yYWlsIGlzIGEgZnJlZSBzZXJ2aWNlLg==\" base64> ." "\"The monorail is a free service.\"" }
+    { $example "USING: prettyprint base64 strings ;" "\"VGhlIG1vbm9yYWlsIGlzIGEgZnJlZSBzZXJ2aWNlLg==\" base64> >string ." "\"The monorail is a free service.\"" }
 }
 { $notes "This word will throw if the input string contains characters other than those allowed in base64 encodings." }
 { $see-also >base64 } ;
 
+ARTICLE: "base64" "Base 64 conversions"
+"The " { $vocab-link "base64" } " vocabulary implements conversions of sequences to printable characters in base 64. These plain-text representations of binary data may be passed around and converted back to binary data later." $nl
+"Converting to base 64:"
+{ $subsection >base64 }
+"Converting back to binary:"
+{ $subsection base64> } ;
+
+ABOUT: "base64"
index 7097de6c6e68d5f9b1c43ddd973f900a8d1cc17d..e3033a2bde3e111c7cc233c81374ca76b4587108 100644 (file)
@@ -43,7 +43,7 @@ PRIVATE>
     [ [ "" ] [ >base64-rem ] if-empty ]
     bi* append ;
 
-: base64> ( base64 -- str )
+: base64> ( base64 -- seq )
     #! input length must be a multiple of 4
     [ 4 <groups> [ decode4 ] map concat ]
     [ [ CHAR: = = ] count-end ]