41 lines
1.1 KiB
Text
41 lines
1.1 KiB
Text
PROC Squeeze(CHAR ARRAY in,out CHAR a)
|
|
BYTE i,j
|
|
CHAR c
|
|
|
|
j=1 c=0
|
|
FOR i=1 TO in(0)
|
|
DO
|
|
IF in(i)#c OR in(i)#a THEN
|
|
c=in(i)
|
|
out(j)=c
|
|
j==+1
|
|
FI
|
|
OD
|
|
out(0)=j-1
|
|
RETURN
|
|
|
|
PROC Test(CHAR ARRAY s CHAR a)
|
|
CHAR ARRAY c(100)
|
|
BYTE CH=$02FC ;Internal hardware value for last key pressed
|
|
|
|
Squeeze(s,c,a)
|
|
PrintF("Character to squeeze: ""%C""%E",a)
|
|
PrintF("<<<%S>>> (len=%B)%E",s,s(0))
|
|
PrintF("<<<%S>>> (len=%B)%E",c,c(0))
|
|
PutE()
|
|
PrintE("Press any key to continue")
|
|
PutE()
|
|
|
|
DO UNTIL CH#$FF OD
|
|
CH=$FF
|
|
RETURN
|
|
|
|
PROC Main()
|
|
Test("",' )
|
|
Test("""If I were two-faced, would I be wearing this one?"" --- Abraham Lincoln ",'-)
|
|
Test("..1111111111111111111111111111111111111111111111111111111111111117777888",'7)
|
|
Test("I never give 'em hell, I just tell the truth, and they think it's hell. ",'.)
|
|
Test(" --- Harry S Truman ",' )
|
|
Test(" --- Harry S Truman ",'-)
|
|
Test(" --- Harry S Truman ",'r)
|
|
RETURN
|