aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/common/lib/forth2012/facility/structures.frt
blob: 65f8e5e78ff4b1568c8e4b5fe9b964b7fe7e0491 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
\ structures according to http://www.forth200x.org/structures.html
\ and http://www.forth200x.org/structures2.html
\ the reference implementation does not work since amforth uses
\ not the unified memory model for dictionary and data

: +field: ( n1 "<spaces>name" -- n2 )
    create over , +
    does> @i +
;

: begin-structure 
    create dp 0 -1 , \ -1 saves a flash erase when end-structure is executed
  does>
    @i
;

: end-structure
    swap !i
;

: cfield: 1 +field: ;
:  field: 2 +field: ;
\ 2field is not standard, but why not?
: 2field: 4 +field: ;