home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
norge.freeshell.org (192.94.73.8)
/
192.94.73.8.tar
/
192.94.73.8
/
pub
/
computers
/
cpm
/
alphatronic
/
TINY_C.ZIP
/
PPSLF.TC
< prev
next >
Wrap
Text File
|
1999-03-05
|
6KB
|
401 lines
putchar char c
[if(c==0)c='"'
return MC c,1
]
getchar
[return MC 2
]
chrdy[return MC 12]
pft char f(0),t(0)[MC f,t,13]
gs char b(0)
[int l
while((b(l)=MC(2))!=13)[
if(b(l)==21)[l=0;pl">"]
else if(b(l)==127)[if(l>0)l=l-1;]
else if(b(l)==18)[MC(13,1);pft b,b+l-1]
else l=l+1
]
b(l)=0
return l
]
ps char b(0)[
int k(0);k(0)=1
pft(b,b-1+scann(b,b+30000,0,k))
]
pl char b(0)
[MC 13,1
ps b
]
alpha char a
[
if((a>='a')*(a<='z'))return 1
if((a>='A')*(a<='Z'))return 1
]
num char b(5)
int v(0)
[int k
v(0)=0
while(k<5)
[if((b(k)<'0')+(b(k)>'9'))return k
v(0)=10*v(0)+b(k)-'0'
k=k+1
]
return k
]
atoi char b(0)
int v(0)
[int k,s
char c
s=1
c=b(0)
while((c==' ')+(c=='-')+(c=='+'))
[if(c=='-')s=-1
c=b(k=k+1)
]
k=k+num(b+k,v)
v(0)=s*v(0)
return k
]
pn int n
[
MC ' ',1
MC n,14
]
gn
[char b(20)
int v(0)
while(1)
[gs b
if(atoi b,v)return v(0)
ps"number required "
]
]
ceqn char a(0),b(0)
int n
[int k
k=-1
while((k=k+1)<n)if(a(k)!=b(k))return 0
return 1
]
index char i(0)
int l
char f(0)
int n
[
if(n<=0)return 1
if(l<=0)return 0
int a,d(0)
while(a+n<=l)[
d(0)=1
a=a+1+scann(i+a,i+l-n,f(0),d)
if(d(0))return 0
if(ceqn(i+a,f+1,n-1))return a
]
]
move char a(0),b(0)
[int k
k=-1
while(a(k=k+1)!=0)b(k)=a(k)
b(k)=0
return k
]
gc
[char f
f=MC 2
while(MC(2)!=13)[]
return f
]
movebl char a(0),b(0);int n
[MC(a,b,n,7)]
countch char a(0),b(0),c
[return MC(a,b,c,8)]
scann char a(0),b(0),c;int n(0)
[return MC(a,b,c,n,9)]
readfile char n(0),w(0),l(0)
int u
[int k,t
MC(1,n,0,u,3)
while(1)
[
k=MC(w,u,4)
if(k<0)MC(u,6)
if(k== -1)return t
if(k< -1)return k
t=t+k
if((w=w+k)>l)
[pl"Too big"
return -2
]
]
]
writefile char n(0),b(0),e(0)
int u
[int k,t,l
MC(2,n,e-b+1,u,3)
while(b<=e)
[
l=e-b
if(l>127)l=127
k=MC(b,b+l,u,5)
if(k<0)return k
if(k>0)return -k
t=t+l+1
b=b+l+1
]
k=MC(u,6)
if(k<0)return k
if(k>0)return -k
return t
]
fopen int m;char n(0);int s,u[return MC m,n,s,u,3]
fread char a(0);int u[return MC a,u,4]
fwrite char f(0),t(0); int u[return MC f,t,u,5]
fclose int u[MC u,6]
fdos int f,a[return MC f,a,1001]
sefcb char f(0),e(0)[return MC f,e,1002]
prefcb char e(0)[MC e,1003]
endlibrary
int er(0),cu,lo,pe,lp
int ll,la
char ft(40),tt(40)
int fl,tl
char ln(120),pr( 5200)
main
[char c
int v(1)
lp= 5200
pr(0)=13
while(1)
[ps ">