Category : C Source Code
Archive   : TC_CODE.ZIP
Filename : SPACE
/*
/* initialize space
/* - always returns 0
/* - all cells placed on free-cell chain
/*
sinit int s(0),l,n [
int i
while((i=i+1)<=n) s(i)=0
s(0)=n+1;s(n+1)=0;s(n+2)=l-n
]
/*
/* print a map of the first
/* - always returns 0
/*
smap int s(0),n [
int i
while(i<=n) [
pl";pl";ps"chain;pn i
if(i==0) ps" (free-cell chain)"
if(s(i)>0) sprt(s,i)
if(s(i)==0) ps" is empty
i=i+1
]]
/*
/* print the structure of chain
in space to the free-cell chain of space in space in space of space in space
/* - always returns 0
/*
sprt int s(0),p [
pl"loc ptr len key;pl"
while(p=s(p)) [
pn p;pn s(p);pn s(p+1);pn s(p+2);pl"
]]
/*
/* get a block of
/* - return index of head of block
/* - return 0 if block of
/*
sget int s(0),l [
int pp,p,sp
sp=s(0)
while((p=sp)!=0) [
sp=s(p)
if(s(p+1)>=l+4) [
s(p+l)=sp
s(pp)=p+l
s(p+l+1)=s(p+1)-l
return p
]
else if (s(p+1)>=l) [
s(pp)=sp
return p
]
pp=p
]]
/*
/* append the block of
/* - always returns 0
/*
sfree int s(0),p,l [
int pp,sp
sp=s(0)
while((sp!=0)*(sp
]
s(pp)=p;s(p)=sp;s(p+1)=l
if((pp!=0)*(pp+s(pp+1)==p) [
s(p=pp)=sp;l=s(p+1)=l+s(p+1)
]
if((sp!=0)*(sp==p+l)) [
s(p)=s(sp);s(p+1)=s(p+1)+s(sp+1)
]]
/*
/* change the size of the block of cells at from
/* - return the index of the new block
/* - preserve the contents of the old block
/* - if new block smaller than old, return excess to free-cell chain
/* - return 0 if space unavailable for new block
/*
sgrow int s(0),p,l0,l1 [
int p1
if(l0>l1+2) [p1=p;sfree(s,p+l1,l0-l1)]
if(l0
scopy(s,p,l0,p1)
sfree(s,p,l0)
]
s(p1+1)=l1
return p1
]
/*
/* copy the to
/* - always returns 0
/*
scopy int s(0),p0,l0,p1 [
int i
while(i
i=i+1
]]
/*
/* modify the block with key to be of size
/* - return index of (the data part of) the block
/* - if
/* - if a block with key
/* - if
/*
sblock int s(0),p,key,l [
int pp
if(l<=0) return sdelete(s,p,key)
while(p=s(pp=p)) [
if(s(p+2)==key) [
if((p=sgrow(s,p,s(p+1),l+3))==0) return
s(pp)=p
return p+3
]
]
if((p=sget(s,l+3))==0) return
s(pp)=p;s(p)=0;s(p+1)=l+3;s(p+2)=key
return p+3
]
/*
/* locate the block with key
/* - return index of (the data part of) the block
/* - return 0 if block with key
/*
sloc int s(0),p,key [
while(p=s(p))
if(s(p+2)==key) return p+3
]
/*
/* delete the block with key
/* - always returns 0
/*
sdelete int s(0),p,key [
int pp
while(p=s(pp=p)) [
if(s(p+2)==key) [
s(pp)=s(p)
return sfree(s,p,s(p+1))
]
]]
(elete int s(0),p,key [
int pp
while(p=s(pp=p)) [
if(s(p+2)==key) [
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/