~crc_/retro-ilo

42b6158083fee3663e4c083d107e8a0b907aa2c0 — crc 1 year, 1 month ago 2639eb6
system blocks: leave room for extended instruction set for pali (for napia & arks); add (tools/words)

FossilOrigin-Name: eeb0d13703c69b6a3b43c288bbed4bf8dab49a930947b2a73e15d67ea4e19787
M blocks/19 => blocks/19 +0 -0
M blocks/20 => blocks/20 +0 -0
M blocks/21 => blocks/21 +0 -0
M blocks/22 => blocks/22 +0 -0
M blocks/23 => blocks/23 +0 -0
M blocks/24 => blocks/24 +0 -0
M blocks/25 => blocks/25 +0 -0
M blocks/26 => blocks/26 +0 -0
M blocks/27 => blocks/27 +0 -0
M blocks/28 => blocks/28 +0 -0
M blocks/50 => blocks/50 +0 -0
M blocks/51 => blocks/51 +0 -0
M blocks/52 => blocks/52 +0 -0
M blocks/53 => blocks/53 +0 -0
M blocks/54 => blocks/54 +0 -0
M blocks/55 => blocks/55 +0 -0
M blocks/56 => blocks/56 +0 -0
M blocks/gemtext/19.gmi => blocks/gemtext/19.gmi +1 -1
@@ 13,6 13,6 @@
  #5863980 comma #5863812 comma #5863818 comma                  
  #5863288 comma #5863297 comma #5863485 comma                  
                                                                
:inst s:hash &Instructions swap a:index ;                       
                                                                
                                                                
```

M blocks/gemtext/20.gmi => blocks/gemtext/20.gmi +11 -11
@@ 1,18 1,18 @@
```
(std) (pali) (assembler)                                        
                                                                
:pack (nnnn-n)                                                  
 #24 shift-left swap         #16 shift-left n:add swap          
  #8 shift-left n:add swap   n:add ;                            
                                                                
:split (s-nnnn)                                                 
 dup #2 s:left      inst swap   dup #2 #2 s:middle inst swap    
 dup #4 #2 s:middle inst swap       #2 s:right inst ;           
                                                                
:assemble:opcode (s-n) split pack ;                             
                                                                
:i (s-) assemble:opcode comma ;                                 
&comma \d (n-)                                                  
&comma \r (n-)                                                  
:s (s-) dup s:length comma &comma s:for-each ;                  
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
```

M blocks/gemtext/21.gmi => blocks/gemtext/21.gmi +11 -11
@@ 1,18 1,18 @@
```
(std) (reorder) (restructuring-the-stack)                       
(std) (pali) (assembler)                                        
                                                                
{{                                                              
  'values d:create #27 allot                                    
  :from s:length dup [ [ &values n:add store ] sip n:dec ] times
        drop ;                                                  
  :to [ n:inc ] [ s:length ] bi                                 
      [ fetch-next $a n:sub n:inc &values n:add fetch swap ]    
      times drop ;                                              
---reveal---                                                    
  :reorder (...ss-?) &from dip to ;                             
}}                                                              
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
:inst s:hash &Instructions swap a:index ;                       
```

M blocks/gemtext/22.gmi => blocks/gemtext/22.gmi +12 -12
@@ 1,18 1,18 @@
```
(std) (debug/reset) (quickly-empty-the-stack)                   
                                                                
:reset (...-)                                                   
  depth/data dup n:negative?                                    
  [ n:abs [ #0 ] ]                                              
  [ &drop ] choose times ;                                      
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
(std) (pali) (assembler)                                        
                                                                
:pack (nnnn-n)                                                  
 #24 shift-left swap         #16 shift-left n:add swap          
  #8 shift-left n:add swap   n:add ;                            
                                                                
:split (s-nnnn)                                                 
 dup #2 s:left      inst swap   dup #2 #2 s:middle inst swap    
 dup #4 #2 s:middle inst swap       #2 s:right inst ;           
                                                                
:assemble:opcode (s-n) split pack ;                             
                                                                
:i (s-) assemble:opcode comma ;                                 
&comma \d (n-)                                                  
&comma \r (n-)                                                  
:s (s-) dup s:length comma &comma s:for-each ;                  
```

M blocks/gemtext/23.gmi => blocks/gemtext/23.gmi +8 -8
@@ 1,18 1,18 @@
```
(std) (.s) (display-stack)                                      
(std) (reorder) (restructuring-the-stack)                       
                                                                
{{                                                              
  'Data d:create #33 allot                                      
  :gather depth/data dup &Data store-next swap                  
          [ store-next ] times drop ;                           
  :display &Data a:reverse [ n:put sp ] a:for-each nl ;         
  :restore &Data a:reverse [ ] a:for-each ;                     
  'values d:create #27 allot                                    
  :from s:length dup [ [ &values n:add store ] sip n:dec ] times
        drop ;                                                  
  :to [ n:inc ] [ s:length ] bi                                 
      [ fetch-next $a n:sub n:inc &values n:add fetch swap ]    
      times drop ;                                              
---reveal---                                                    
  :.s (-) gather display restore ;                              
  :reorder (...ss-?) &from dip to ;                             
}}                                                              
                                                                
                                                                
                                                                
                                                                
                                                                
```

M blocks/gemtext/24.gmi => blocks/gemtext/24.gmi +12 -12
@@ 1,16 1,16 @@
```
(std) (debug/dump)                                              
                                                                
{{                                                              
  :digits   (-s)   '0123456789ABCDEF ;                          
  :to-digit (n-c)  digits swap s:fetch ;                        
  :h.       (n-)   #16 n:divmod swap [ to-digit c:put ] bi@ sp ;
  :order    'abcd 'dcba reorder ;                               
  :bytes    (n-n)  dup b:unpack order #4 &h. times ;            
  :display  (nn-n) bytes sp n:put nl ;                          
---reveal---                                                    
  :dump (an-) [ dup n:put tab fetch-next display ] times drop ; 
}}                                                              
(std) (debug/reset) (quickly-empty-the-stack)                   
                                                                
:reset (...-)                                                   
  depth/data dup n:negative?                                    
  [ n:abs [ #0 ] ]                                              
  [ &drop ] choose times ;                                      
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                

M blocks/gemtext/25.gmi => blocks/gemtext/25.gmi +10 -10
@@ 1,17 1,17 @@
```
(std) (random-number-generator) (xorshift)                      
(std) (.s) (display-stack)                                      
                                                                
#1 'seed var-n                                                  
{{                                                              
  'Data d:create #33 allot                                      
  :gather depth/data dup &Data store-next swap                  
          [ store-next ] times drop ;                           
  :display &Data a:reverse [ n:put sp ] a:for-each nl ;         
  :restore &Data a:reverse [ ] a:for-each ;                     
---reveal---                                                    
  :.s (-) gather display restore ;                              
}}                                                              
                                                                
:n:random (-n)                                                  
  @seed                                                         
  dup #13 shift-left  xor                                       
  dup #17 shift-right xor                                       
  dup #5  shift-left  xor                                       
  dup !seed ;                                                   
                                                                
:n:random-mod (n-n)                                             
  n:random n:abs swap n:mod ;                                   
                                                                
                                                                
                                                                

M blocks/gemtext/26.gmi => blocks/gemtext/26.gmi +12 -12
@@ 1,16 1,16 @@
```
(std) (block-tools)                                             
                                                                
:block:empty? (n-f)                                             
  @Block [ set load block:buffer n:dec s:hash #-967633659       
           eq? ] dip !Block load ;                              
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
(std) (debug/dump)                                              
                                                                
{{                                                              
  :digits   (-s)   '0123456789ABCDEF ;                          
  :to-digit (n-c)  digits swap s:fetch ;                        
  :h.       (n-)   #16 n:divmod swap [ to-digit c:put ] bi@ sp ;
  :order    'abcd 'dcba reorder ;                               
  :bytes    (n-n)  dup b:unpack order #4 &h. times ;            
  :display  (nn-n) bytes sp n:put nl ;                          
---reveal---                                                    
  :dump (an-) [ dup n:put tab fetch-next display ] times drop ; 
}}                                                              
                                                                
                                                                
                                                                

M blocks/gemtext/27.gmi => blocks/gemtext/27.gmi +10 -10
@@ 1,17 1,17 @@
```
(std) (random-number-generator) (xorshift)                      
                                                                
#1 'seed var-n                                                  
                                                                
:n:random (-n)                                                  
  @seed                                                         
  dup #13 shift-left  xor                                       
  dup #17 shift-right xor                                       
  dup #5  shift-left  xor                                       
  dup !seed ;                                                   
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
:n:random-mod (n-n)                                             
  n:random n:abs swap n:mod ;                                   
                                                                
                                                                
                                                                

M blocks/gemtext/28.gmi => blocks/gemtext/28.gmi +4 -4
@@ 1,9 1,9 @@
```
(std) (block-tools)                                             
                                                                
                                                                
                                                                
                                                                
                                                                
:block:empty? (n-f)                                             
  @Block [ set load block:buffer n:dec s:hash #-967633659       
           eq? ] dip !Block load ;                              
                                                                
                                                                
                                                                

M blocks/gemtext/50.gmi => blocks/gemtext/50.gmi +16 -16
@@ 1,18 1,18 @@
```
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
(editor-ext)                                                    
                                                                
:e:copy/block (src,dest) swap set load set save ;               
                                                                
'Line d:create #64 allot                                        
:e:copy/line (n-) e:to-line &Line #64 copy ;                    
:e:paste/line (n-) e:to-line &Line swap #64 copy ;              
                                                                
{{                                                              
  :get '_ s:temp #64 over store [ n:inc #64 copy ] sip ;        
  :update n:inc swap #64 copy ;                                 
  :at     e:to-line dup get ;                                   
---reveal---                                                    
  :e:indent at #62 s:left '__ s:prepend update ;                
  :e:unindent at #62 s:right '__ s:append update ;              
}}                                                              
```

M blocks/gemtext/51.gmi => blocks/gemtext/51.gmi +12 -12
@@ 1,18 1,18 @@
```
(editor-ext)                                                    
                                                                
:e:copy/block (src,dest) swap set load set save ;               
:e:move/block (src,dest)                                        
  dup-pair e:copy/block swap set new save set load ;            
                                                                
:e:erase/block (n-) set new save ;                              
                                                                
:e:for-each-line (q-)                                           
  #16 [ block:buffer n:dec                                      
        I #64 n:mul #64 s:middle swap &call sip ]               
  indexed-times drop ;                                          
                                                                
:n (-) next list ;                                              
:p (-) prev list ;                                              
                                                                
'Line d:create #64 allot                                        
:e:copy/line (n-) e:to-line &Line #64 copy ;                    
:e:paste/line (n-) e:to-line &Line swap #64 copy ;              
                                                                
{{                                                              
  :get '_ s:temp #64 over store [ n:inc #64 copy ] sip ;        
  :update n:inc swap #64 copy ;                                 
  :at     e:to-line dup get ;                                   
---reveal---                                                    
  :e:indent at #62 s:left '__ s:prepend update ;                
  :e:unindent at #62 s:right '__ s:append update ;              
}}                                                              
```

M blocks/gemtext/52.gmi => blocks/gemtext/52.gmi +10 -10
@@ 1,18 1,18 @@
```
(editor-ext)                                                    
                                                                
:e:move/block (src,dest)                                        
  dup-pair e:copy/block swap set new save set load ;            
                                                                
:e:erase/block (n-) set new save ;                              
                                                                
:e:for-each-line (q-)                                           
  #16 [ block:buffer n:dec                                      
        I #64 n:mul #64 s:middle swap &call sip ]               
  indexed-times drop ;                                          
                                                                
:n (-) next list ;                                              
:p (-) prev list ;                                              
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
```

M blocks/gemtext/53.gmi => blocks/gemtext/53.gmi +11 -11
@@ 1,18 1,18 @@
```
tools/describe                                                  
                                                                
This adds a word, `describe`, that scans the blocks for glossary
data. It takes a word name from the input stream, and looks for 
a block with a title of `Glossary: wordname`                    
                                                                
In example, to display the glossary data for `s:put`, you would 
run:                                                            
                                                                
    describe s:put                                              
                                                                
The output strips blank lines.                                  
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
Note that as this requires one block per word it is not a space 
efficient tool. You will need around 250 blocks to cover the    
core language, and many more to cover everything.               
```

M blocks/gemtext/54.gmi => blocks/gemtext/54.gmi +16 -16
@@ 1,18 1,18 @@
```
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
(tools/describe) (glossary-lookups)                             
                                                                
{{                                                              
  :empty? (-f)                                                  
    #-1 I #2 n:add e:to-line                                    
    #64 [ fetch-next #32 eq? swap &and dip ] times drop ;       
---reveal---                                                    
  :describe:line (-) empty? [ I #2 n:add e:line ] -if ;         
  :describe:word (s-)  @Block swap                              
     [ 'Glossary:_ s:prepend '_ s:append s:keep @Blocks         
       [ I set load block:buffer n:dec over                     
         dup s:length &swap dip s:left &s:hash bi@ eq?          
         [ nl #13 &describe:line indexed-times nl ] if          
     ] indexed-times drop ] gc !Block load ;                    
  :describe ('-) s:get/token s:temp describe:word ;             
}}                                                              
```

M blocks/gemtext/55.gmi => blocks/gemtext/55.gmi +11 -11
@@ 1,18 1,18 @@
```
tools/describe                                                  
                                                                
This adds a word, `describe`, that scans the blocks for glossary
data. It takes a word name from the input stream, and looks for 
a block with a title of `Glossary: wordname`                    
                                                                
In example, to display the glossary data for `s:put`, you would 
run:                                                            
                                                                
    describe s:put                                              
                                                                
The output strips blank lines.                                  
                                                                
Note that as this requires one block per word it is not a space 
efficient tool. You will need around 250 blocks to cover the    
core language, and many more to cover everything.               
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
```

M blocks/gemtext/56.gmi => blocks/gemtext/56.gmi +15 -15
@@ 1,18 1,18 @@
```
(tools/describe) (glossary-lookups)                             
(tools/words) (list-words-in-the-glossary)                      
                                                                
:block:title (-s) block:buffer n:dec #64 over store ;           
:glossary? (-f)   block:title 'Glossary:_ s:begins-with? ;      
:more?     (c-cf) dup #32 -eq? ;                                
:title:put (ac-)  [ c:put fetch-next more? ] while drop-pair ;  
:.title    (-)  block:title #11 n:add fetch-next title:put sp ; 
:words                                                          
  @Block @Blocks                                                
  [ I set load glossary? &.title if ] indexed-times !Block ;    
                                                                
. Konilo does not store word names, so we can't simply walk     
. through the dictionary to get the names. Instead, this        
. scans the *blocks*, displaying the names of any words in      
. the *Glossary:* blocks.                                       
                                                                
{{                                                              
  :empty? (-f)                                                  
    #-1 I #2 n:add e:to-line                                    
    #64 [ fetch-next #32 eq? swap &and dip ] times drop ;       
---reveal---                                                    
  :describe:line (-) empty? [ I #2 n:add e:line ] -if ;         
  :describe:word (s-)  @Block swap                              
     [ 'Glossary:_ s:prepend '_ s:append s:keep @Blocks         
       [ I set load block:buffer n:dec over                     
         dup s:length &swap dip s:left &s:hash bi@ eq?          
         [ nl #13 &describe:line indexed-times nl ] if          
     ] indexed-times drop ] gc !Block load ;                    
  :describe ('-) s:get/token s:temp describe:word ;             
}}                                                              
```

M blocks/text/19.txt => blocks/text/19.txt +1 -1
@@ 12,5 12,5 @@
  #5863980 comma #5863812 comma #5863818 comma                  
  #5863288 comma #5863297 comma #5863485 comma                  
                                                                
:inst s:hash &Instructions swap a:index ;                       
                                                                
                                                                
\ No newline at end of file

M blocks/text/20.txt => blocks/text/20.txt +11 -11
@@ 1,16 1,16 @@
(std) (pali) (assembler)                                        
                                                                
:pack (nnnn-n)                                                  
 #24 shift-left swap         #16 shift-left n:add swap          
  #8 shift-left n:add swap   n:add ;                            
                                                                
:split (s-nnnn)                                                 
 dup #2 s:left      inst swap   dup #2 #2 s:middle inst swap    
 dup #4 #2 s:middle inst swap       #2 s:right inst ;           
                                                                
:assemble:opcode (s-n) split pack ;                             
                                                                
:i (s-) assemble:opcode comma ;                                 
&comma \d (n-)                                                  
&comma \r (n-)                                                  
:s (s-) dup s:length comma &comma s:for-each ;                  
\ No newline at end of file
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
\ No newline at end of file

M blocks/text/21.txt => blocks/text/21.txt +12 -12
@@ 1,16 1,16 @@
(std) (reorder) (restructuring-the-stack)                       
(std) (pali) (assembler)                                        
                                                                
{{                                                              
  'values d:create #27 allot                                    
  :from s:length dup [ [ &values n:add store ] sip n:dec ] times
        drop ;                                                  
  :to [ n:inc ] [ s:length ] bi                                 
      [ fetch-next $a n:sub n:inc &values n:add fetch swap ]    
      times drop ;                                              
---reveal---                                                    
  :reorder (...ss-?) &from dip to ;                             
}}                                                              
                                                                
                                                                
                                                                
                                                                
\ No newline at end of file
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
:inst s:hash &Instructions swap a:index ;                       
\ No newline at end of file

M blocks/text/22.txt => blocks/text/22.txt +12 -12
@@ 1,16 1,16 @@
(std) (debug/reset) (quickly-empty-the-stack)                   
(std) (pali) (assembler)                                        
                                                                
:reset (...-)                                                   
  depth/data dup n:negative?                                    
  [ n:abs [ #0 ] ]                                              
  [ &drop ] choose times ;                                      
:pack (nnnn-n)                                                  
 #24 shift-left swap         #16 shift-left n:add swap          
  #8 shift-left n:add swap   n:add ;                            
                                                                
:split (s-nnnn)                                                 
 dup #2 s:left      inst swap   dup #2 #2 s:middle inst swap    
 dup #4 #2 s:middle inst swap       #2 s:right inst ;           
                                                                
:assemble:opcode (s-n) split pack ;                             
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
\ No newline at end of file
:i (s-) assemble:opcode comma ;                                 
&comma \d (n-)                                                  
&comma \r (n-)                                                  
:s (s-) dup s:length comma &comma s:for-each ;                  
\ No newline at end of file

M blocks/text/23.txt => blocks/text/23.txt +8 -8
@@ 1,16 1,16 @@
(std) (.s) (display-stack)                                      
(std) (reorder) (restructuring-the-stack)                       
                                                                
{{                                                              
  'Data d:create #33 allot                                      
  :gather depth/data dup &Data store-next swap                  
          [ store-next ] times drop ;                           
  :display &Data a:reverse [ n:put sp ] a:for-each nl ;         
  :restore &Data a:reverse [ ] a:for-each ;                     
  'values d:create #27 allot                                    
  :from s:length dup [ [ &values n:add store ] sip n:dec ] times
        drop ;                                                  
  :to [ n:inc ] [ s:length ] bi                                 
      [ fetch-next $a n:sub n:inc &values n:add fetch swap ]    
      times drop ;                                              
---reveal---                                                    
  :.s (-) gather display restore ;                              
  :reorder (...ss-?) &from dip to ;                             
}}                                                              
                                                                
                                                                
                                                                
                                                                
                                                                
\ No newline at end of file

M blocks/text/24.txt => blocks/text/24.txt +12 -12
@@ 1,15 1,15 @@
(std) (debug/dump)                                              
                                                                
{{                                                              
  :digits   (-s)   '0123456789ABCDEF ;                          
  :to-digit (n-c)  digits swap s:fetch ;                        
  :h.       (n-)   #16 n:divmod swap [ to-digit c:put ] bi@ sp ;
  :order    'abcd 'dcba reorder ;                               
  :bytes    (n-n)  dup b:unpack order #4 &h. times ;            
  :display  (nn-n) bytes sp n:put nl ;                          
---reveal---                                                    
  :dump (an-) [ dup n:put tab fetch-next display ] times drop ; 
}}                                                              
(std) (debug/reset) (quickly-empty-the-stack)                   
                                                                
:reset (...-)                                                   
  depth/data dup n:negative?                                    
  [ n:abs [ #0 ] ]                                              
  [ &drop ] choose times ;                                      
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                

M blocks/text/25.txt => blocks/text/25.txt +10 -10
@@ 1,16 1,16 @@
(std) (random-number-generator) (xorshift)                      
(std) (.s) (display-stack)                                      
                                                                
#1 'seed var-n                                                  
{{                                                              
  'Data d:create #33 allot                                      
  :gather depth/data dup &Data store-next swap                  
          [ store-next ] times drop ;                           
  :display &Data a:reverse [ n:put sp ] a:for-each nl ;         
  :restore &Data a:reverse [ ] a:for-each ;                     
---reveal---                                                    
  :.s (-) gather display restore ;                              
}}                                                              
                                                                
:n:random (-n)                                                  
  @seed                                                         
  dup #13 shift-left  xor                                       
  dup #17 shift-right xor                                       
  dup #5  shift-left  xor                                       
  dup !seed ;                                                   
                                                                
:n:random-mod (n-n)                                             
  n:random n:abs swap n:mod ;                                   
                                                                
                                                                
                                                                
\ No newline at end of file

M blocks/text/26.txt => blocks/text/26.txt +12 -12
@@ 1,15 1,15 @@
(std) (block-tools)                                             
                                                                
:block:empty? (n-f)                                             
  @Block [ set load block:buffer n:dec s:hash #-967633659       
           eq? ] dip !Block load ;                              
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
(std) (debug/dump)                                              
                                                                
{{                                                              
  :digits   (-s)   '0123456789ABCDEF ;                          
  :to-digit (n-c)  digits swap s:fetch ;                        
  :h.       (n-)   #16 n:divmod swap [ to-digit c:put ] bi@ sp ;
  :order    'abcd 'dcba reorder ;                               
  :bytes    (n-n)  dup b:unpack order #4 &h. times ;            
  :display  (nn-n) bytes sp n:put nl ;                          
---reveal---                                                    
  :dump (an-) [ dup n:put tab fetch-next display ] times drop ; 
}}                                                              
                                                                
                                                                
                                                                

M blocks/text/27.txt => blocks/text/27.txt +10 -10
@@ 1,16 1,16 @@
(std) (random-number-generator) (xorshift)                      
                                                                
#1 'seed var-n                                                  
                                                                
:n:random (-n)                                                  
  @seed                                                         
  dup #13 shift-left  xor                                       
  dup #17 shift-right xor                                       
  dup #5  shift-left  xor                                       
  dup !seed ;                                                   
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
:n:random-mod (n-n)                                             
  n:random n:abs swap n:mod ;                                   
                                                                
                                                                
                                                                
\ No newline at end of file

M blocks/text/28.txt => blocks/text/28.txt +4 -4
@@ 1,8 1,8 @@
(std) (block-tools)                                             
                                                                
                                                                
                                                                
                                                                
                                                                
:block:empty? (n-f)                                             
  @Block [ set load block:buffer n:dec s:hash #-967633659       
           eq? ] dip !Block load ;                              
                                                                
                                                                
                                                                

M blocks/text/50.txt => blocks/text/50.txt +16 -16
@@ 1,16 1,16 @@
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
\ No newline at end of file
(editor-ext)                                                    
                                                                
:e:copy/block (src,dest) swap set load set save ;               
                                                                
'Line d:create #64 allot                                        
:e:copy/line (n-) e:to-line &Line #64 copy ;                    
:e:paste/line (n-) e:to-line &Line swap #64 copy ;              
                                                                
{{                                                              
  :get '_ s:temp #64 over store [ n:inc #64 copy ] sip ;        
  :update n:inc swap #64 copy ;                                 
  :at     e:to-line dup get ;                                   
---reveal---                                                    
  :e:indent at #62 s:left '__ s:prepend update ;                
  :e:unindent at #62 s:right '__ s:append update ;              
}}                                                              
\ No newline at end of file

M blocks/text/51.txt => blocks/text/51.txt +12 -12
@@ 1,16 1,16 @@
(editor-ext)                                                    
                                                                
:e:copy/block (src,dest) swap set load set save ;               
:e:move/block (src,dest)                                        
  dup-pair e:copy/block swap set new save set load ;            
                                                                
'Line d:create #64 allot                                        
:e:copy/line (n-) e:to-line &Line #64 copy ;                    
:e:paste/line (n-) e:to-line &Line swap #64 copy ;              
:e:erase/block (n-) set new save ;                              
                                                                
{{                                                              
  :get '_ s:temp #64 over store [ n:inc #64 copy ] sip ;        
  :update n:inc swap #64 copy ;                                 
  :at     e:to-line dup get ;                                   
---reveal---                                                    
  :e:indent at #62 s:left '__ s:prepend update ;                
  :e:unindent at #62 s:right '__ s:append update ;              
}}                                                              
\ No newline at end of file
:e:for-each-line (q-)                                           
  #16 [ block:buffer n:dec                                      
        I #64 n:mul #64 s:middle swap &call sip ]               
  indexed-times drop ;                                          
                                                                
:n (-) next list ;                                              
:p (-) prev list ;                                              
                                                                
                                                                
\ No newline at end of file

M blocks/text/52.txt => blocks/text/52.txt +10 -10
@@ 1,16 1,16 @@
(editor-ext)                                                    
                                                                
:e:move/block (src,dest)                                        
  dup-pair e:copy/block swap set new save set load ;            
                                                                
:e:erase/block (n-) set new save ;                              
                                                                
:e:for-each-line (q-)                                           
  #16 [ block:buffer n:dec                                      
        I #64 n:mul #64 s:middle swap &call sip ]               
  indexed-times drop ;                                          
                                                                
:n (-) next list ;                                              
:p (-) prev list ;                                              
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
\ No newline at end of file

M blocks/text/53.txt => blocks/text/53.txt +11 -11
@@ 1,16 1,16 @@
tools/describe                                                  
                                                                
This adds a word, `describe`, that scans the blocks for glossary
data. It takes a word name from the input stream, and looks for 
a block with a title of `Glossary: wordname`                    
                                                                
In example, to display the glossary data for `s:put`, you would 
run:                                                            
                                                                
    describe s:put                                              
                                                                
The output strips blank lines.                                  
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
\ No newline at end of file
Note that as this requires one block per word it is not a space 
efficient tool. You will need around 250 blocks to cover the    
core language, and many more to cover everything.               
\ No newline at end of file

M blocks/text/54.txt => blocks/text/54.txt +16 -16
@@ 1,16 1,16 @@
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
\ No newline at end of file
(tools/describe) (glossary-lookups)                             
                                                                
{{                                                              
  :empty? (-f)                                                  
    #-1 I #2 n:add e:to-line                                    
    #64 [ fetch-next #32 eq? swap &and dip ] times drop ;       
---reveal---                                                    
  :describe:line (-) empty? [ I #2 n:add e:line ] -if ;         
  :describe:word (s-)  @Block swap                              
     [ 'Glossary:_ s:prepend '_ s:append s:keep @Blocks         
       [ I set load block:buffer n:dec over                     
         dup s:length &swap dip s:left &s:hash bi@ eq?          
         [ nl #13 &describe:line indexed-times nl ] if          
     ] indexed-times drop ] gc !Block load ;                    
  :describe ('-) s:get/token s:temp describe:word ;             
}}                                                              
\ No newline at end of file

M blocks/text/55.txt => blocks/text/55.txt +11 -11
@@ 1,16 1,16 @@
tools/describe                                                  
                                                                
This adds a word, `describe`, that scans the blocks for glossary
data. It takes a word name from the input stream, and looks for 
a block with a title of `Glossary: wordname`                    
                                                                
In example, to display the glossary data for `s:put`, you would 
run:                                                            
                                                                
    describe s:put                                              
                                                                
The output strips blank lines.                                  
                                                                
Note that as this requires one block per word it is not a space 
efficient tool. You will need around 250 blocks to cover the    
core language, and many more to cover everything.               
\ No newline at end of file
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
\ No newline at end of file

M blocks/text/56.txt => blocks/text/56.txt +15 -15
@@ 1,16 1,16 @@
(tools/describe) (glossary-lookups)                             
(tools/words) (list-words-in-the-glossary)                      
                                                                
{{                                                              
  :empty? (-f)                                                  
    #-1 I #2 n:add e:to-line                                    
    #64 [ fetch-next #32 eq? swap &and dip ] times drop ;       
---reveal---                                                    
  :describe:line (-) empty? [ I #2 n:add e:line ] -if ;         
  :describe:word (s-)  @Block swap                              
     [ 'Glossary:_ s:prepend '_ s:append s:keep @Blocks         
       [ I set load block:buffer n:dec over                     
         dup s:length &swap dip s:left &s:hash bi@ eq?          
         [ nl #13 &describe:line indexed-times nl ] if          
     ] indexed-times drop ] gc !Block load ;                    
  :describe ('-) s:get/token s:temp describe:word ;             
}}                                                              
\ No newline at end of file
:block:title (-s) block:buffer n:dec #64 over store ;           
:glossary? (-f)   block:title 'Glossary:_ s:begins-with? ;      
:more?     (c-cf) dup #32 -eq? ;                                
:title:put (ac-)  [ c:put fetch-next more? ] while drop-pair ;  
:.title    (-)  block:title #11 n:add fetch-next title:put sp ; 
:words                                                          
  @Block @Blocks                                                
  [ I set load glossary? &.title if ] indexed-times !Block ;    
                                                                
. Konilo does not store word names, so we can't simply walk     
. through the dictionary to get the names. Instead, this        
. scans the *blocks*, displaying the names of any words in      
. the *Glossary:* blocks.                                       
                                                                
\ No newline at end of file

M ilo.blocks => ilo.blocks +0 -0