]> gitweb.factorcode.org Git - factor.git/commitdiff
Document byte-array>T-array word
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Wed, 3 Dec 2008 03:51:07 +0000 (21:51 -0600)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Wed, 3 Dec 2008 03:51:07 +0000 (21:51 -0600)
basis/specialized-arrays/specialized-arrays-docs.factor

index 54cb5d1cf56a8a6ea4a9d85620304a9e9a135fbd..1c1b3dbc599a86ed38a6c5daa94971e18c84e69c 100644 (file)
@@ -4,11 +4,12 @@ IN: specialized-arrays
 ARTICLE: "specialized-arrays" "Specialized arrays"
 "The " { $vocab-link "specialized-arrays" } " vocabulary implements fixed-length sequence types for storing machine values in a space-efficient manner without boxing."
 $nl
-"For each primitive C type " { $snippet "T" } ", a set of words are defined:"
+"For each primitive C type " { $snippet "T" } ", a set of words are defined in the vocabulary named " { $snippet "specialized-arrays.T" } ":"
 { $table
     { { $snippet "T-array" } { "The class of arrays with elements of type " { $snippet "T" } } }
     { { $snippet "<T-array>" } { "Constructor for arrays with elements of type " { $snippet "T" } "; stack effect " { $snippet "( len -- array )" } } }
     { { $snippet ">T-array" } { "Converts a sequence into a specialized array of type " { $snippet "T" } "; stack effect " { $snippet "( seq -- array )" } } }
+    { { $snippet "byte-array>T-array" } { "Converts a byte array into a specialized array by interpreting the bytes in as machine-specific values. Code which uses this word is unportable" } }
     { { $snippet "T-array{" } { "Literal syntax, consists of a series of values terminated by " { $snippet "}" } } }
 }
 "Each specialized array has a " { $slot "underlying" } " slot holding a " { $link byte-array } " with the raw data. This data can be passed to C functions."
@@ -30,6 +31,8 @@ $nl
     { $snippet "void*" }
     { $snippet "bool" }
 }
+"Note that " { $vocab-link "specialized-arrays.bool" } " behaves like a C " { $snippet "bool[]" } " array, and each element takes up 8 bits of space. For a more space-efficient boolean array, see " { $link "bit-arrays" } "."
+$nl
 "Specialized arrays are generated with a functor in the " { $vocab-link "specialized-arrays.functor" } " vocabulary."
 $nl
 "The " { $vocab-link "specialized-vectors" } " vocabulary provides resizable versions of the above." ;