home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 4
/
FreshFish_May-June1994.bin
/
new
/
amigalibdisks
/
d977
/
forth
/
editor
< prev
next >
Wrap
Text File
|
1994-04-03
|
20KB
|
1 lines
\ editor <list> l ll lll -text load screen 910515jb ) decimal : --editor-- ; warning @ 0 warning ! : <list> dup scr ! 13 emit eeol colm 13 emit 3 .r 16 0 do cr i 4 .r space i scr @ .line pause ?terminal if leave then loop space quit ; : l scr @ <list> ; : ll 1 scr +! l ; : lll -1 scr +! l ; : -text ( addr count addr --- flag ) swap ?dup if over + swap do dup c@ i c@ - if 0= leave else 1+ then loop else drop 0= then ; 2 18 thru \ load rest of editor file \ match : match ( cursor addr-4, bytes left-3, string addr-2 ) ( string count-1, --- flag-2, cursor offset-1 ) >r >r 2dup r> r> 2swap over + swap ( caddr-6, bleft-5, $addr-4, $len-3, caddr+bleft-2, caddr-1 ) do 2dup i -text if >r 2drop r> - i swap - 0 swap 0 0 leave ( cadr, bleft, $addr, $len or 0, offset, 0, 0 ) then loop 2drop ( caddr-2, bleft-1 or 0-2, offset-1 ) swap 0= swap ; \ line wipe hex : line ( relative to scr, leave address of line ) dup fff0 and abort" not on current editing screen" scr @ <line> drop ; : wipe scr @ clear ; \ editor #locate hex vocabulary editor immediate editor definitions : #locate ( --- cursor offset-2, line-1 ) r# @ c/l /mod ; \ #lead #lag -move buf-move : #lead ( --- cursor addr-2, offset to cursor-1 ) #locate line swap ; : #lag ( --- cursor addr-2, count after cursor-1 ) #lead dup >r + c/l r> - ; : -move ( move from addr-2, to line-1 --- ) line c/l cmove update ; : buf-move ( move text to buffer-1, if any --- ) here c@ if pad swap c/l 1+ cmove else drop then ; ( >line# find-buf insert-buf mvp-forth) : >line# ( convert current cursor position to line# ) #locate swap drop ; : find-buf ( buffer used for all searches ) pad 50 + ; : insert-buf ( buffer used for all insertions ) find-buf 50 + ; ( hold- <kill> <spread> x mvp-forth) : <hold> ( move line-1 from block to insert buffer ) line insert-buf 1+ c/l dup insert-buf c! cmove ; : <kill> ( erase line-1 with blanks ) line c/l blank update ; : <spread> ( spread, making line# blank ) >line# dup 0e do i line i 1+ -move -1 +loop <kill> ; : x ( delete line# from block, put in insert buffer) >line# dup <hold> 0f dup rot do i 1+ line i -move loop <kill> ;