From 2e84d5f9ac8c133d423801ceedd394bca800fabb Mon Sep 17 00:00:00 2001 From: crc Date: Tue, 5 Mar 2019 23:46:43 +0000 Subject: [PATCH] rx: use d:add-header as the label name instead of addheader, add Retro versions of the prefixes for contrast. FossilOrigin-Name: 7635ca2d64136f3727a4eaea4429b6c730b175b57f6eb46789a859c4c564c075 --- literate/Rx.md | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/literate/Rx.md b/literate/Rx.md index 6e82f71..e0155eb 100644 --- a/literate/Rx.md +++ b/literate/Rx.md @@ -688,7 +688,7 @@ d 3 ~~~ A traditional Forth has `create` to make a new dictionary entry -pointing to the next free location in `Heap`. Rx has `newentry` +pointing to the next free location in `Heap`. Rx has `d:add-header` which serves as a slightly more flexible base. You provide a string for the name, a pointer to the class handler, and a pointer to the start of the function. Rx does the rest. @@ -696,10 +696,10 @@ pointer to the start of the function. Rx does the rest. In actual practice, I never use this outside of Rx. New words are made using the `:` prefix, or `d:create` (once defined in the standard library). At some point I may simplify this by -moving `d:create` into Rx and using it in place of `newentry`. +moving `d:create` into Rx and using it in place of `d:add-header`. ~~~ -: newentry +: d:add-header i lifepuli r Heap r Dictionary @@ -892,25 +892,43 @@ obtaining pointers (prefix with `&`), and defining functions | : | definitions | :foo | | ( | Comments | (n-) | + + :prefix:( (s-) drop ; + ~~~ : prefix:( i drre.... +~~~ + :prefix:# (s-n) s:to-number class:data ; + +~~~ : prefix:# i lica.... r s:to-number i liju.... r class:data +~~~ + :prefix:$ (s-c) fetch class:data ; + +~~~ : prefix:$ i feliju.. r class:data +~~~ + :prefix:: (s-) + &class:word &Heap fetch d:add-header + &Heap fetch &Dictionary d:xt store + #-1 &Compiler store ; + +~~~ : prefix:: i lilifeli r class:word r Heap -r newentry +r d:add-header i ca...... i lifelife r Heap @@ -921,7 +939,11 @@ i stlilist d -1 r Compiler i re...... +~~~ + :prefix:& (s-a) d:lookup d:xt fetch class:data ; + +~~~ : prefix:& i lica.... r d:lookup @@ -1355,7 +1377,7 @@ r class:word s class:data : 0045 r 0044 -r newentry +r d:add-header r class:word s d:add-header : 0046