Previous: , Up: Structures   [Contents][Index]


5.22.6 Forth200x Structures

The Forth 2012 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 ( unknown  ) unknown “+field”
cfield: ( u1 "name" – u2  ) X:structures “cfield:”
field: ( u1 "name" – u2  ) X:structures “field:”
2field: ( u1 "name" – u2  ) gforth-0.7 “2field:”
ffield: ( u1 "name" – u2  ) X:structures “ffield:”
sffield: ( u1 "name" – u2  ) X:structures “sffield:”
dffield: ( u1 "name" – u2  ) X:structures “dffield:”