Previous: Structure Glossary, Up: Structures
The Forth 200x standard defines a slightly less convenient form of
structures. In general (when using field+, you have to perform
the alignment yourself, but there are a number of convenience words
(e.g., field: that perform the alignment for you.
A typical usage example is:
0
field: s-a
faligned 2 floats +field s-b
constant s-struct
An alternative way of writing this structure is:
begin-structure s-struct
field: s-a
faligned 2 floats +field s-b
end-structure
begin-structure "name" – struct-sys 0 X:structures “begin-structure”
end-structure struct-sys +n – X:structures “end-structure”
+field n1 n2 "name" – n3 X:structures “plus-field”
cfield: u1 "name" – u2 X:structures “cfield:”
field: u1 "name" – u2 X:structures “field:”
2field: u1 "name" – u2 gforth “2field:”
ffield: u1 "name" – u2 X:structures “ffield:”
sffield: u1 "name" – u2 X:structures “sffield:”
dffield: u1 "name" – u2 X:structures “dffield:”