aboutsummaryrefslogtreecommitdiffstats
path: root/core.fth
diff options
context:
space:
mode:
Diffstat (limited to 'core.fth')
-rw-r--r--core.fth12
1 files changed, 10 insertions, 2 deletions
diff --git a/core.fth b/core.fth
index 768f195..fcd4375 100644
--- a/core.fth
+++ b/core.fth
@@ -17,13 +17,13 @@
: repeat ['] _jmp , , if postpone then then ; immediate
: until ['] _jmp0 , , drop ; immediate
-: do ['] _lit , here 0 , ['] >r , postpone 2>r here ; immediate
+: do ['] literal , here 0 , ['] >r , postpone 2>r here ; immediate
: unloop postpone 2r> ['] 2drop , ['] r> , ['] drop , ; immediate
: leave postpone 2r> ['] 2drop , postpone exit ; immediate
: +loop ['] r> , ['] 2dup , ['] + ,
postpone r@ ['] swap , ['] >r ,
['] - , ['] 2dup , ['] + , ['] over , ['] xor ,
- ['] rot , ['] rot , ['] xor , ['] and , ['] _lit , 0 ,
+ ['] rot , ['] rot , ['] xor , ['] and , ['] literal , 0 ,
['] < , ['] _jmp0 , ,
postpone unloop here 1 cells - swap ! ; immediate
: loop postpone 2r> ['] 1+ , ['] 2dup ,
@@ -82,3 +82,11 @@
>r 2dup c! char+ r> 1- repeat
2drop drop ;
+: >name 2 cells + dup begin 1+ dup c@ bl <= until over - ;
+: 'name latest begin 2dup >xt <> over 0<> and while
+ @ dup 0= if 2drop 0 0 exit then repeat
+ nip >name ;
+: words latest begin dup >name type space @ dup 0= until drop ;
+: see ' cell+ begin dup @ ?dup while
+ 'name ?dup 0= if drop dup @ . else type then
+ space cell+ repeat drop ;