etherforth_logo

Node 112

Words defined here provide access to earlier words to navigator and perform cursor movement by whole lines.

Source code

editor node 113 node 111 node 112
112 lines
s 00 a-s @p !b !b . @p !b @b !p @b ;
+s 03 -s 12028 +s s ; -s 05 -s 1202A -s s ;
cu 07 12004 cu @p !b . @p !b .. !b ;
+x 0B 12004 +x !b ; -x 0D 12006 -x !b ;
home 0F 12010 home !b ;
sym 11 -s 12008 sym !b @p . !p .. !b @b ;
fl! 15 @p !b !b ; @p ..
bck 17 n 49 for -s over or ..
while drop next home pop ; then pop ;
-l 20 39 eol bck drop drop bck
flag 24 +x sym 3E and 30 or ..
if dup or fl! ; then - fl! +x ;
+l 2F 39 eol sym 49 for over or ..
while drop +s next ; then pop flag ;
+w 39 12034 +w !b ; -w 3B 1202E -w !b ;
ptr 3D 1200C ptr !b ; 3F

init left a! right b! --l- ; 44

5 d 3 r 0 ether

Definitions

s
Is a common factor for
+s, -s
Call +s and -s in 213 and get symbol back.
cu
Call cu in 213.
+x, -x
Call +x and -x in 113.
home
Set pointer to zero by calling home in 113.
sym
Call sym in 113 and get symbol back.
fl!
Set flag f in 113.
bck
Move pointer left by at most 50 symbols until the current symbol is n. If not found (happens if we are at the top line) move cursor to home position (not necessary as we are there anyway) and return from the caller (i.e. we leave word ‑l).
-l
Move cursor to the beginning of the preceding line. First move to the end of the preceding line with bck using eol (39) as n, then call bck again to move to the end of the line before, and finally fall through to
flag
Move one symbol right (presumably to the first symbol of a line because we call it when at eol) and if at string tag we set flag in 113 as zero. If token tag we set flag in 113 as -1 and move one symbol right so the cursor points to the first token. However, we cannot move this way to the top line if it is empty. This "bug" cannot be solved.
+l
Move one line down. Scan at most 50 symbols looking for eol. If found jump to flag. If not found (shouldn't happen) we leave cursor pointer where it is and set flag in 113 as zero with fl!.
+w, -w
Call +w and -w in 113.
ptr
Call ptr in 113 and leave pointer p on stack there (this word is called by ptr in node 111 which gets the pointer p via port execution; there's no space to implement full ptr word in node 112).
init
Set registers A and B, and jump to LEFT.

Description