1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-23 13:08:06 +11:00

ed: rename I to i

Shadowing core "I" is too messy. As soon as ed is loaded in memory,
nothing else that isn't "i-aware" can be loaded anymore.

I guess that's why "contexts" exist in Starting Forth, but adding
this concept just for allowing the shadowing of core words seems
overkill to me. Renaming I to i in ed seems better.
This commit is contained in:
Virgil Dupras 2020-06-23 07:08:21 -04:00
parent af339d8c6a
commit 9ab5cda397
6 changed files with 10 additions and 11 deletions

View File

@ -10,7 +10,7 @@ P xxx: put typed IBUF on selected line.
U xxx: insert typed IBUF on selected line.
F xxx: find typed FBUF in block, starting from current
position+1. If not found, don't move.
I xxx: insert typed IBUF at cursor. "I" shadows core word. Use
"i" to access it.
i xxx: insert typed IBUF at cursor. "i" is to avoid shadowing
core word "I".
Y: Copy n characters after cursor into IBUF, n being length of
FBUF. (cont.)

View File

@ -2,12 +2,11 @@
DUP BEGIN C@+ 0x20 < UNTIL -^ 1- ;
: _rbufsz ( size of linebuf to the right of curpos )
EDPOS @ 64 MOD 63 -^ ;
: i COMPILE I ; IMMEDIATE ( save overshadowed )
: _I ( I without _pln and _type. used in VE )
: _i ( i without _pln and _type. used in VE )
_rbufsz IBUF _blen 2DUP > IF
TUCK - ( ilen chars-to-move )
SWAP EDPOS @ _cpos 2DUP + ( ctm ilen a a+ilen )
3 PICK MOVE- ( ctm ilen ) NIP ( ilen )
ELSE DROP 1+ ( ilen becomes rbuffsize+1 ) THEN
DUP IBUF EDPOS @ _cpos ROT MOVE ( ilen ) EDPOS +! BLK!! ;
: I IBUF _type _I EDPOS @ 64 / _pln ;
: i IBUF _type _i EDPOS @ 64 / _pln ;

View File

@ -4,10 +4,10 @@ CREATE PREVPOS 0 , CREATE PREVBLK 0 ,
: num ACC @ SWAP _pdacc IF DROP ELSE ACC ! THEN ;
: nspcs ( n -- , spit n space ) 0 DO SPC LOOP ;
: aty 0 SWAP AT-XY ;
: clrscr LINES 0 DO i aty COLS nspcs LOOP ;
: gutter ( ln n ) OVER + SWAP DO 67 i AT-XY '|' EMIT LOOP ;
: clrscr LINES 0 DO I aty COLS nspcs LOOP ;
: gutter ( ln n ) OVER + SWAP DO 67 I AT-XY '|' EMIT LOOP ;
: status 0 aty ." BLK" SPC BLK> ? SPC ACC ?
SPC EDPOS @ 64 /MOD . ',' EMIT . SPC
SPC EDPOS @ 64 /MOD . ',' EMIT . SPC
BLKDTY @ IF '*' EMIT THEN 10 nspcs ;
: contents 3 aty BLK> @ LIST 3 16 gutter ;
: selblk BLK> @ PREVBLK ! BLK@ contents ;

View File

@ -2,7 +2,7 @@
: $[ BLK> @ acc@ - selblk ;
: $] BLK> @ acc@ + selblk ;
: $t PREVBLK @ selblk ;
: $I mode! 'I' EMIT IBUF 1 buftype _I contents mode! SPC ;
: $I mode! 'I' EMIT IBUF 1 buftype _i contents mode! SPC ;
: $F mode! 'F' EMIT FBUF 2 buftype _F setpos mode! SPC ;
: $Y Y ;
: $E E contents ;

View File

@ -12,5 +12,5 @@
_U EDPOS @ 0x3c0 AND DUP pos! _cpos _zbuf BLK!! contents ;
: $o EDPOS @ 64 < IF EXIT THEN EDPOS @ 64 + EDPOS ! $O ;
: $D $H 64 icpy
acc@ 0 DO 16 EDPOS @ 64 / DO i _mvln- LOOP LOOP
acc@ 0 DO 16 EDPOS @ 64 / DO I _mvln- LOOP LOOP
BLK!! contents ;

View File

@ -3,7 +3,7 @@
DUP CMD 2+ C! CMD FIND IF EXECUTE ELSE DROP THEN
0 ACC ! UPPER 'Q' = ;
: bufp ( buf -- )
DUP 64 + SWAP DO i C@ 0x20 MAX EMIT LOOP ;
DUP 64 + SWAP DO I C@ 0x20 MAX EMIT LOOP ;
: bufs
1 aty ." I: " IBUF bufp
2 aty ." F: " FBUF bufp 0 3 gutter ;