rx: use d:add-header as the label name instead of addheader, add Retro versions of the prefixes for contrast.
FossilOrigin-Name: 7635ca2d64136f3727a4eaea4429b6c730b175b57f6eb46789a859c4c564c075
This commit is contained in:
parent
472eb63cad
commit
2e84d5f9ac
1 changed files with 27 additions and 5 deletions
|
@ -688,7 +688,7 @@ d 3
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
A traditional Forth has `create` to make a new dictionary entry
|
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
|
which serves as a slightly more flexible base. You provide a
|
||||||
string for the name, a pointer to the class handler, and a
|
string for the name, a pointer to the class handler, and a
|
||||||
pointer to the start of the function. Rx does the rest.
|
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
|
In actual practice, I never use this outside of Rx. New words
|
||||||
are made using the `:` prefix, or `d:create` (once defined in
|
are made using the `:` prefix, or `d:create` (once defined in
|
||||||
the standard library). At some point I may simplify this by
|
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
|
i lifepuli
|
||||||
r Heap
|
r Heap
|
||||||
r Dictionary
|
r Dictionary
|
||||||
|
@ -892,25 +892,43 @@ obtaining pointers (prefix with `&`), and defining functions
|
||||||
| : | definitions | :foo |
|
| : | definitions | :foo |
|
||||||
| ( | Comments | (n-) |
|
| ( | Comments | (n-) |
|
||||||
|
|
||||||
|
|
||||||
|
:prefix:( (s-) drop ;
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
: prefix:(
|
: prefix:(
|
||||||
i drre....
|
i drre....
|
||||||
|
~~~
|
||||||
|
|
||||||
|
:prefix:# (s-n) s:to-number class:data ;
|
||||||
|
|
||||||
|
~~~
|
||||||
: prefix:#
|
: prefix:#
|
||||||
i lica....
|
i lica....
|
||||||
r s:to-number
|
r s:to-number
|
||||||
i liju....
|
i liju....
|
||||||
r class:data
|
r class:data
|
||||||
|
~~~
|
||||||
|
|
||||||
|
:prefix:$ (s-c) fetch class:data ;
|
||||||
|
|
||||||
|
~~~
|
||||||
: prefix:$
|
: prefix:$
|
||||||
i feliju..
|
i feliju..
|
||||||
r class:data
|
r class:data
|
||||||
|
~~~
|
||||||
|
|
||||||
|
:prefix:: (s-)
|
||||||
|
&class:word &Heap fetch d:add-header
|
||||||
|
&Heap fetch &Dictionary d:xt store
|
||||||
|
#-1 &Compiler store ;
|
||||||
|
|
||||||
|
~~~
|
||||||
: prefix::
|
: prefix::
|
||||||
i lilifeli
|
i lilifeli
|
||||||
r class:word
|
r class:word
|
||||||
r Heap
|
r Heap
|
||||||
r newentry
|
r d:add-header
|
||||||
i ca......
|
i ca......
|
||||||
i lifelife
|
i lifelife
|
||||||
r Heap
|
r Heap
|
||||||
|
@ -921,7 +939,11 @@ i stlilist
|
||||||
d -1
|
d -1
|
||||||
r Compiler
|
r Compiler
|
||||||
i re......
|
i re......
|
||||||
|
~~~
|
||||||
|
|
||||||
|
:prefix:& (s-a) d:lookup d:xt fetch class:data ;
|
||||||
|
|
||||||
|
~~~
|
||||||
: prefix:&
|
: prefix:&
|
||||||
i lica....
|
i lica....
|
||||||
r d:lookup
|
r d:lookup
|
||||||
|
@ -1355,7 +1377,7 @@ r class:word
|
||||||
s class:data
|
s class:data
|
||||||
: 0045
|
: 0045
|
||||||
r 0044
|
r 0044
|
||||||
r newentry
|
r d:add-header
|
||||||
r class:word
|
r class:word
|
||||||
s d:add-header
|
s d:add-header
|
||||||
: 0046
|
: 0046
|
||||||
|
|
Loading…
Reference in a new issue