Differences From Artifact [9d8b9f0bdde89142]:
File user/crc/comp.lang.forth/plainstruct.retro part of check-in [be937afc34] - Start adding ported code snippits from comp.lang.forth newsgroup. by crc on 2010-06-14 20:40:24. [annotate] [view]
To Artifact [196c4023a5d2cdd9]:
File user/crc/comp.lang.forth/plainstruct.retro part of check-in [eeb149692a] - c.l.f, fixes to plainstruct by crc on 2010-06-15 18:42:21. [annotate] [view]
@@ -9,11 +9,11 @@
)
decimal
: struct ( -- 0 ) 0 ;
-: /struct: ( <"sizename"> u -- ) aligned constant ;
+: /struct: ( <"sizename"> u -- ) constant ;
: +field ( offset size <"name"> -- offset+size )
- ` : over .data + ` .data ` + ` ; ;
+ over ` : .data ` + ` ; + ;
: cfield: ( offset <"name"> -- offset+1char )
1 +field ;
: field: ( offset <"name"> -- offset+1cell )
1 +field ;
@@ -42,4 +42,12 @@
pop >plotchar @
/point ;
+0
+ 1 +field foo
+ 1 +field bar
+constant /rec
+create test /rec allot
+4 test foo .s !
+8 test bar .s !
+: p test bar @ .data ; immediate