aboutsummaryrefslogtreecommitdiff
path: root/forth/forth/ct.fs
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2018-09-29 01:02:00 +0200
committerDimitri Sokolyuk <demon@dim13.org>2018-09-29 01:02:00 +0200
commit79cabd5b1c8bcd9f50dc49e77776e713a57dff48 (patch)
tree6eb73857e9c174610839291cf05a02d77fc82b8c /forth/forth/ct.fs
parent247df3bb9d4c89d4e5ff18dcc23ba1c9532f28c0 (diff)
parent110a6411bae421260476eacf6173897c1d1f4b8a (diff)
Merge branch 'master' of dim13.org:elegoo
Diffstat (limited to 'forth/forth/ct.fs')
-rw-r--r--forth/forth/ct.fs40
1 files changed, 40 insertions, 0 deletions
diff --git a/forth/forth/ct.fs b/forth/forth/ct.fs
new file mode 100644
index 0000000..1e3ef04
--- /dev/null
+++ b/forth/forth/ct.fs
@@ -0,0 +1,40 @@
+\ *********************************************************************
+\ *
+\ Filename: ct.txt *
+\ Date: 06.01.2014 *
+\ File Version: 5.0 *
+\ Copyright: Mikael Nordman *
+\ Author: Mikael Nordman *
+\ *********************************************************************
+\ FlashForth is licensed acording to the GNU General Public License*
+\ *********************************************************************
+\ create an condition table with n entries
+\ each entry consists of a comparison word
+\ and an execution word, which is executed if
+\ the comparison word leaves a true value on the stack.
+-ct
+marker -ct
+hex ram
+: ct ( ew cw n -- ) \ compile a condition table
+ ( m -- m ) \ execute aword corresponding to m.
+ \ m may consist of several stack cells
+ \ it is upto the condition word to
+ \ preserve m on the stack
+ create
+ dup , \ store the condition table size
+ for
+ , , \ store an entry
+ next
+ does> \ m addr
+ dup @ \ m addr n
+ for
+ cell+ dup \ m addr addr
+ cell+ >r \ m addr
+ @ex \ m flag
+ if \ m
+ r> @ex rdrop exit \ m a match was found
+ then
+ r>
+ next
+ drop
+;