aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/common/lib/forth2012/facility/structures.frt
diff options
context:
space:
mode:
Diffstat (limited to 'amforth-6.5/common/lib/forth2012/facility/structures.frt')
-rw-r--r--amforth-6.5/common/lib/forth2012/facility/structures.frt24
1 files changed, 24 insertions, 0 deletions
diff --git a/amforth-6.5/common/lib/forth2012/facility/structures.frt b/amforth-6.5/common/lib/forth2012/facility/structures.frt
new file mode 100644
index 0000000..65f8e5e
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/facility/structures.frt
@@ -0,0 +1,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: ;