]> gitweb.factorcode.org Git - factor.git/blob - basis/specialized-arrays/specialized-arrays-docs.factor
Merge branch 'master' into specialized-arrays
[factor.git] / basis / specialized-arrays / specialized-arrays-docs.factor
1 USING: help.markup help.syntax byte-arrays ;
2 IN: specialized-arrays
3
4 ARTICLE: "specialized-arrays" "Specialized arrays"
5 "The " { $vocab-link "specialized-arrays" } " vocabulary implements fixed-length sequence types for storing machine values in a space-efficient manner without boxing."
6 $nl
7 "For each primitive C type " { $snippet "T" } ", a set of words are defined:"
8 { $table
9     { { $snippet "T-array" } { "The class of arrays with elements of type " { $snippet "T" } } }
10     { { $snippet "<T-array>" } { "Constructor for arrays with elements of type " { $snippet "T" } "; stack effect " { $snippet "( len -- array )" } } }
11     { { $snippet ">T-array" } { "Converts a sequence into a specialized array of type " { $snippet "T" } "; stack effect " { $snippet "( seq -- array )" } } }
12     { { $snippet "T-array{" } { "Literal syntax, consists of a series of values terminated by " { $snippet "}" } } }
13 }
14 "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."
15 $nl
16 "The primitive C types for which specialized arrays exist:"
17 { $list
18     { $snippet "char" }
19     { $snippet "uchar" }
20     { $snippet "short" }
21     { $snippet "ushort" }
22     { $snippet "int" }
23     { $snippet "uint" }
24     { $snippet "long" }
25     { $snippet "ulong" }
26     { $snippet "longlong" }
27     { $snippet "ulonglong" }
28     { $snippet "float" }
29     { $snippet "double" }
30     { $snippet "void*" }
31     { $snippet "bool" }
32 }
33 "Specialized arrays are generated with a functor in the " { $vocab-link "specialized-arrays.functor" } " vocabulary."
34 $nl
35 "The " { $vocab-link "specialized-vectors" } " vocabulary provides resizable versions of the above." ;
36
37 ABOUT: "specialized-arrays"