$Header: /home/radek/cvs/forth-book/sec-forth_inc_editor.xml,v 1.1 2003/12/28 18:21:56 radek Exp $
FIXME: obsah
SCR # 69
1 ( FORTH INC.'S EDITOR ) ( This editor was written by S.H. Daniel, in FORTH DIMENSIONS, ( Volume III, number 3. 5 ( The only changes was to make the cursor a "block" for higher ( visibility. P. Mullarky 9/29/81 -->
SCR # 70
1 ( FORTH INC.'S EDITOR ) BASE @ FORTH DEFINITIONS HEX 5 : TEXT HERE C/L 1+ BLANKS WORD HERE PAD C/L 1+ CMOVE ; : LINE DUP FFF0 AND 17 ?ERROR SCR @ (LINE) DROP ; VOCABULARY EDITOR IMMEDIATE : WHERE DUP B/SCR / DUP SCR ! ." SCR # " DECIMAL . SWAP C/L /MOD C/L * ROT BLOCK + CR C/L TYPE [COMPILE] EDITOR QUIT ; 10 EDITOR DEFINITIONS : #LOCATE R# @ C/L /MOD ; : #LEAD #LOCATE LINE SWAP ; : #LAG #LEAD DUP >R + C/L R> - ; : -MOVE LINE C/L CMOVE UPDATE ; 15 : BUF-MOVE PAD 1+ C@ IF PAD SWAP C/L 1+ CMOVE ELSE DROP THEN ; : >LINE# #LOCATE SWAP DROP ; -->
SCR # 71
1 ( FORTH INC.'S EDITOR ) : FIND-BUF PAD 50 + ; : INSERT-BUF FIND-BUF 50 + ; 5 : (HOLD) LINE INSERT-BUF 1+ C/L DUP INSERT-BUF C! CMOVE ; : (KILL) LINE C/L BLANKS UPDATE ; : (SPREAD) >LINE# DUP 1 - E DO I LINE I 1+ - MOVE -1 +LOOP (KILL) ; : X >LINE# DUP (HOLD) F DUP ROT DO I 1+ LINE I -MOVE 10 LOOP (KILL) ; : DISPLAY-CURSOR CR SPACE #LEAD TYPE A0 EMIT #LAG TYPE #LOCATE . DROP ; : T C/L * R# ! 0 DISPLAY-CURSOR ; : L SCR @ LIST ; 15 : N 1 SCR +! ; : B -1 SCR +! ; -->
SCR # 72
1 ( FORTH INC.'S EDITOR ) : (TOP) 0 R# ! ; : SEEK-ERROR (TOP) FIND-BUF HERE C/L 1+ CMOVE HERE COUNT TYPE 5 ." None" QUIT ; : (R) >LINE# INSERT-BUF 1+ SWAP -MOVE ; : P 5E TEXT INSERT-BUF BUF-MOVE (R) ; : WIPE 10 0 DO I (KILL) LOOP ; : COPY B/SCR * OFFSET @ + SWAP B/SCR * B/SCR OVER + SWAP DO DUP 10 FORTH I BLOCK 2 - ! 1+ UPDATE LOOP DROP FLUSH ; : 1LINE #LAG FIND-BUF COUNT MATCH R# +! ; : (SEEK) BEGIN 3FF R# @ < IF SEEK-ERROR THEN 1LINE UNTIL ; : (DELETE) >R #LAG + R - #LAG R MINUS R# +! #LEAD + SWAP CMOVE R> BLANKS UPDATE ; 15 : (F) 5E TEXT FIND-BUF BUF-MOVE (SEEK) ; : F (F) DISPLAY-CURSOR ; -->
SCR # 73
1 ( FORTH INC.'S EDITOR ) : E (E) DISPLAY-CURSOR ; : D (F) E ; 5 : TILL #LEAD + 5E TEXT FIND-BUF BUF-MOVE 1LINE 0= IF SEEK-ERROR THEN #LEAD + SWAP - (DELETE) DISPLAY-CURSOR ; 0 VARIABLE COUNTER : BUMP 1 COUNTER 1+ COUNTER @ 38 > IF 0 COUNTER ! CR CR F MESSAGE C EMIT THEN ; 10 : S C EMIT 5E TEXT 0 COUNTER ! FIND-BUF BUF-MOVE SCR @ DUP >R DO I SCR ! (TOP) BEGIN 1LINE IF DISPLAY-CURSOR SCR ? BUMP THEN 3FF R# @ < UNTIL LOOP R> SCR ! ; : I 5E TEXT INSERT-BUF BUF-MOVE INSERT-BUF COUNT #LAG ROT OVER MIN >R R R# +! R - >R DUP HERE R CMOVE HERE #LEAD + R> 15 CMOVE R> CMOVE UPDATE DISPLAY-CURSOR ; -->
SCR # 74
1 ( FORTH INC.'S EDITOR ) : U C/L R# +! (SPREAD) P ; : R (E) I ; 5 : M SCR @ >R R# @ >R >LINE# (HOLD) SWAP SCR ! 1+ C/L * R# (SPREAD) (R) R> C/L + R# R> SCR ! ; DECIMAL 10 LATEST 12 +ORIGIN ! HERE 28 +ORIGIN ! HERE 30 +ORIGIN ! ' EDITOR 6 + 32 +ORIGIN ! HERE FENCE ! 15 FORTH DEFINITIONS BASE ! FORTH ;S