|
|
BSD 4.3
n� �*.KB� P edit edit ;in;iv0;iv1;iv2
numc { '0123456789 ,'
lc { 1
in { ' ', �
nlc { ^\in E numc
ic { 1
}(0=iv0{1Y( V/1Unlc ),`1)/ 10
lc { 1S(1YRtx)D 1+1Yic { ,E nlc/in
ic { ((1YRtx)+1-lc)D1S(`1Yic)+2-lc
}(|Miv0)/ 6+0<iv0{iv0-1
}(0=iv0{1Y( 's'Ein ),`1)/ 21
s { (t { inI's')Uin
}(0=iv1{1Y( t#Rin ),`1)/ 20
in { (t+V/~,sEg { 1Ys)Yin
}(0=iv2{1Y( 's'Ein ),`1)/ 19
s { 1�s
s1 { ,(^\~sEg)/s
s { (Rs1)U(~sEg)/s
}(|Miv2)/ 14+0<iv2{iv2-1
}(|Miv1)/ 12+0<iv1{iv1-1
}(|Miv0)/ 10+0<iv0{iv0-1
}(0=iv0{1Y( - `1<ic { ic-1 ),`1)/ 45
}(0=iv1{1Y( ('p'Ein)V^/nlc ),`1)/ 31
}(0=iv2{1Y( t_V/ in find 'pp' ),`1)/ 26
L _ (lnums 1YRtx),tx
}(|Miv2)/ 23+0<iv2{iv2-1
}(0=iv2{1Y( ~t ),`1)/ 30
lc { (lc+1=Rin)D1YRtx
L _ '[',(,Blc-1),' ] ' ,,tx[lc;]
}(|Miv2)/ 26+0<iv2{iv2-1
}(|Miv1)/ 22+0<iv1{iv1-1
}(0=iv1{1Y( 'dc'Ein ),`1)/ 35
tx { (lc#I1YRtx)/[1]tx
lc { 1Slc-1
}(|Miv1)/ 31+0<iv1{iv1-1
}(0=iv1{1Y( 's'Ein ),`1)/ 43
ln { drops,tx[lc;]
}(0=iv2{1Y( V/t{ln find s1 ),`1)/ 42
t{tI1
ln { ((t-1)Yln),s,(`1+t+Rs1)Uln
putln lc
}(|Miv2)/ 37+0<iv2{iv2-1
}(|Miv1)/ 35+0<iv1{iv1-1
lc { lc+Xic
}(|Miv0)/ 21+0<iv0{iv0-1
}(0=iv0{1Y( V/'cia'Ein ),`1)/ 53
lc { lc +'a'Ein
}(0=iv1{1Y( - 1<R' ',ln { � ),`1)/ 52
tx { (lc#I1+1YRtx)\[1]tx
putln lc
lc { lc+1
}(|Miv1)/ 47+0<iv1{iv1-1
}(|Miv0)/ 45+0<iv0{iv0-1
lc { lc D 1YRtx
}(0=iv0{1Y( 'e'Ein ),`1)/ 58
L_ 'object?'
tx_L
}(|Miv0)/ +0<iv0{iv0-1
}0 XI 'q'Ein
} 3
tx ~ f : This workspace contains a function called edit which willperform text editing in a similar way to UNIX ned. The commands s,i,a,c,d,p,pp,e,q and null are supported. All commands may be preceeded by one or two line numbers as in ned. Text may be input by the e command or by setting the variable tx to the text. On exiting from edit the new text is in tx. Unlike ned none of the characters input in strings have special significance. Also, new text input for a, c, and i commands is terminated by a blank line. Edit calls the following functions: putln, drops find and lnums. In this preliminary version all variables used by edit are global to aid debugging. lnums r _ lnums n
r _ ((n,1)R'['),(B(n,1)R((In)-1)),((n,3)R' ] ')
drops y { drops x
CJ drops any trailing spaces
y { (~O|^\O|xE' ')/x
putln putln j;t
CJ puts a new line into the text
}((I0)R0$t { (1URtx)-Rln)/ 5
tx { tx,((1YRtx),-t)R' '
t { 0
tx[j;] { ln,tR' '
cs � ce � lv iv s1 tons atm 8 $ $ 0123456789abcdefghijklmnopqrstuvwxyz
find rr_aa find bb
CJ finds occurences of bb in aa
CJ convert to num for apl\11
aa _ 1U0,aa
bb _ 1U0,bb
rr_bb ^.= (`1+IRbb)O| ((Rbb),Raa)Raa
rr[(Raa)+1-I`1+Rbb]_0
in 11 ln E 1 1 Edit calls the following functions: putln, drops i pB t iv0 4 6 iv1 )fns iv2 �� numc 0123456789 , lc @B nlc $ �@ ic �� s tions g aa describe ~ f : This workspace contains a function called edit which willperform text editing in a similar way to UNIX ned. The commands s,i,a,c,d,p,pp,e,q and null are supported. All commands may be preceeded by one or two line numbers as in ned. Text may be input by the e command or by setting the variable tx to the text. On exiting from edit the new text is in tx. Unlike ned none of the characters input in strings have special significance. Also, new text input for a, c, and i commands is terminated by a blank line. Edit calls the following functons: putln, drops find and lnums. In this preliminary version all variables used by edit are global to aid debugging. Llx 7 # # L{ 'type ''describe '' for details'
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.