From c676b8379368917af5fc2997dcba46aaf9960213 Mon Sep 17 00:00:00 2001 From: crc Date: Wed, 30 Sep 2020 23:02:23 +0000 Subject: [PATCH] fix many uses of deprecated names (thanks john_cephalopoda) [first of a few patched related to this] FossilOrigin-Name: faa0b6ed0fa09b4307285cfc8a6172762636285bb7864e64cff2995e4d9ba324 --- doc/Cross-Reference.md | 2 +- doc/Hyperstatic.md | 4 ++-- doc/book/techniques/loops | 10 +++++----- doc/book/techniques/using-combinators | 4 ++-- example/Block-Editor.retro | 8 ++++---- example/iOS/GopherClient.forth | 3 ++- example/retro-tags.retro | 2 +- vm/nga-c-native-x86/x86/Block-Editor.retro | 2 +- 8 files changed, 18 insertions(+), 17 deletions(-) diff --git a/doc/Cross-Reference.md b/doc/Cross-Reference.md index a6d21b7..fcecfed 100644 --- a/doc/Cross-Reference.md +++ b/doc/Cross-Reference.md @@ -16,7 +16,7 @@ and traditional Forth. | Conditionals #2 | `NOT IF 1 THEN` | `[ #1 ] -if` | | Conditionals #3 | `IF 1 ELSE 2 THEN` | `[ #1 ] [ #2 ] choose` | | Counted Loops | `10 0 DO LOOP` | `#10 [ ] times` | -| Counted Loops w/Index | `10 0 DO I LOOP` | `#10 [ I ] times` | +| Counted Loops w/Index | `10 0 DO I LOOP` | `#10 [ I ] indexed-times` | | Unconditional Loops | `BEGIN AGAIN` | `repeat again` | | Return Stack | `10 >R ... R>` | `#10 push ... pop` | diff --git a/doc/Hyperstatic.md b/doc/Hyperstatic.md index 8ed07b7..877eae8 100644 --- a/doc/Hyperstatic.md +++ b/doc/Hyperstatic.md @@ -5,14 +5,14 @@ static global environment.* This can be difficult to explain, so let's take a quick look at how it works: ~~~ - #1000 'a var + #1000 'a var-n :scale (x-y) @a * ; #3 scale n:put >>> 3000 #100 !a #3 scale n:put >>> 300 - #5 'a var + #5 'a var-n #3 scale n:put >>> 300 @a n:put diff --git a/doc/book/techniques/loops b/doc/book/techniques/loops index dca85f3..21dbf20 100644 --- a/doc/book/techniques/loops +++ b/doc/book/techniques/loops @@ -39,19 +39,19 @@ when to stop running. ## Counted Loops There are two combinators for counted loops. These are `times` and -`times`. +`indexed-times`. #0 #10 [ dup n:put sp n:inc ] times nl - #10 [ I n:put sp ] times + #10 [ I n:put sp ] indexed-times -The `times` provides an index via the `I`, `J`, and +The `indexed-times` provides an index via the `I`, `J`, and `K` words. `I` will be the index of the current loop, with `J` and `K` being the indexes of the next two older loops. The loop indexes can be accessed outside the loop body: :display I n:square n:put sp ; - :squares [ display ] times nl ; + :squares [ display ] indexed-times nl ; #100 squares ## Tradeoffs @@ -59,5 +59,5 @@ The loop indexes can be accessed outside the loop body: The unconditional loop form is more efficient as it's just a simple jump operation. The `times` counted loops are a little slower, but can be cleaner and more readable in many cases. The -`times` form is significantly slower than the other +`indexed-times` form is significantly slower than the other two forms. diff --git a/doc/book/techniques/using-combinators b/doc/book/techniques/using-combinators index 0b92cf4..4afe726 100644 --- a/doc/book/techniques/using-combinators +++ b/doc/book/techniques/using-combinators @@ -121,12 +121,12 @@ to the stack. #1 #10 [ dup n:put sp n:inc ] times drop ``` -There is also a `times` variation that provides +There is also a `indexed-times` variation that provides access to the loop index (via `I`) and parent loop indexes (via `J` and `K`). ``` -#10 [ I n:put sp ] times +#10 [ I n:put sp ] indexed-times ``` ## Data Flow diff --git a/example/Block-Editor.retro b/example/Block-Editor.retro index 3151d1f..24f4f1f 100755 --- a/example/Block-Editor.retro +++ b/example/Block-Editor.retro @@ -184,7 +184,7 @@ It should be pretty straightforward though. | pos | 'Stack:_ s:put dump-stack ; :format | call | nl ; :line [ #64 [ fetch-next c:put ] times ] format ; - :code &Block #16 [ line ] times drop ; + :code &Block #16 [ line ] indexed-times drop ; :tob &TOB #4 [ line ] times drop ; ---reveal--- :block:display (-) hook @@ -366,7 +366,7 @@ These are helpful to quickly navigate through a block. ## Code Sharing ~~~ -TRUE 'UseSprunge var +TRUE 'UseSprunge var-n {{ '/home/crc/public 'PASTEBIN-PATH s:const @@ -376,8 +376,8 @@ TRUE 'UseSprunge var :c:put @FID file:write ; :line# I dup #10 lt? &sp if n:put ':_ s:put ; :line line# #64 [ fetch-next c:put ] times nl ; - :generate &Block #16 [ line ] times drop ; - :export TEMPFILE file:open !FID + :generate &Block #16 [ line ] indexed-times drop ; + :export TEMPFILE file:open-for-writing !FID &c:put &c:put set-hook generate &c:put unhook @FID file:close ; 'MD5 var diff --git a/example/iOS/GopherClient.forth b/example/iOS/GopherClient.forth index 298accb..b1579a8 100644 --- a/example/iOS/GopherClient.forth +++ b/example/iOS/GopherClient.forth @@ -11,7 +11,8 @@ It's intentionally kept minimal, handling only text files and directories. The i There is also a `Results` variable which will point to the data set being displayed. ~~~ -#34 'WrapPoint var +#34 'WrapPoint var-n + 'Results var 'TARGET d:create #1024 #64 * allot ~~~ diff --git a/example/retro-tags.retro b/example/retro-tags.retro index 6a1bd4c..fb5aefd 100755 --- a/example/retro-tags.retro +++ b/example/retro-tags.retro @@ -85,7 +85,7 @@ Then variables. ~~~ :variable? - dup 'var s:ends-with? over 'var s:ends-with? or ; + dup 'var s:ends-with? over 'var-n s:ends-with? or ; :output-name ASCII:SPACE s:tokenize dup a:length #2 - a:fetch n:inc s:put ; diff --git a/vm/nga-c-native-x86/x86/Block-Editor.retro b/vm/nga-c-native-x86/x86/Block-Editor.retro index 0a123d0..e1d161a 100755 --- a/vm/nga-c-native-x86/x86/Block-Editor.retro +++ b/vm/nga-c-native-x86/x86/Block-Editor.retro @@ -177,7 +177,7 @@ It should be pretty straightforward though. :status block# sp pos '_::_ s:put dump-stack ; :format '_|_ s:put call '_| s:put nl ; :line [ #64 [ fetch-next c:put ] times ] format ; - :code &Block #16 [ line ] times drop ; + :code &Block #16 [ line ] indexed-times drop ; :format '_|_ s:put call '_| s:put nl ; :tob &TOB #4 [ line ] times drop ; ---reveal---