aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/examples/forward-declarations.frt
diff options
context:
space:
mode:
Diffstat (limited to 'amforth-6.5/examples/forward-declarations.frt')
-rw-r--r--amforth-6.5/examples/forward-declarations.frt23
1 files changed, 23 insertions, 0 deletions
diff --git a/amforth-6.5/examples/forward-declarations.frt b/amforth-6.5/examples/forward-declarations.frt
new file mode 100644
index 0000000..274edf4
--- /dev/null
+++ b/amforth-6.5/examples/forward-declarations.frt
@@ -0,0 +1,23 @@
+: forward:
+ dp
+ create
+ ,
+ \ save more information?
+ does>
+ \ get the current name and
+ \ lookup the dictionary. get the
+ \ XT and replace the dictionary entry in the
+ \ *caller* with it. After that execute it too
+ \ next code is executed only once if successful
+ dup 1- swap @i here iplace here count ( copy to temporary ram)
+ find-name if \ unless some wordlist voodoo is in place...
+ swap over = abort" found only forward declaration."
+ dup r@ 1- !i execute
+ else
+ \ can only happen if search wordlist has changed
+ true abort" unresolved forward declaration"
+ then
+;
+
+
+