10.6.2.0135 +FIELD plus-field FACILITY EXT
( n1 n2 "<spaces>name" -- n3 )
Skip leading space delimiters. Parse name delimited by a space. Create a definition for name with the execution semantics defined below. Return n3 = n1 + n2 where n1 is the offset in the data structure before +FIELD executes, and n2 is the size of the data to be added to the data structure. n1 and n2 are in address units.
name Execution:
( addr1 -- addr2 )
Add n1 to addr1 giving addr2.
See:
10.6.2.0763 BEGIN-STRUCTURE,
10.6.2.1336 END-STRUCTURE,
10.6.2.0893 CFIELD:, 10.6.2.1518 FIELD:, 12.6.2.1517 FFIELD:,
12.6.2.2206.40 SFFIELD:, 12.6.2.1207.40 DFFIELD:, A.10.6.2.0135 +FIELD.
10.6.2.0893 CFIELD:, 10.6.2.1518 FIELD:, 12.6.2.1517 FFIELD:,
12.6.2.2206.40 SFFIELD:, 12.6.2.1207.40 DFFIELD:, A.10.6.2.0135 +FIELD.
Rationale:
+FIELD is not required to align items. This is
deliberate and allows the construction of unaligned data
structures for communication with external elements such
as a hardware register map or protocol packet.
Field alignment has been left to the appropriate
x
FIELD:
definition.
Implementation:
Create a new field within a structure definition
of size n bytes.
: +FIELD \ n <"name"> -- ; Exec: addr -- 'addr
CREATE OVER , +
DOES> @ +
;