Hardware manual
If an error is detected, the call MalFormedRoutine(zone, errCode) is executed. Values of the error code
are:
ecOutOfSpace 1801 Not enough space to satisfy a request.
ecZoneAdditionError 1802 Too large or too small addition to zone.
ecBlockNotAllocated 1803 Free has been called with a bad block.
ecIllFormed 1804 The consistency-checker has found some
error in the zone. Consult Alloc.Bcpl.
Free-Standing Zones
It is often desirable to use a single 16-bit quantity to describe an entire free-space pool, together with its
allocating and freeing procedures. For example, one can pass to the operating system such a quantity; the
system can thereafter acquire and release space without knowing the details of how the operations are
done. The zones constructed by Alloc have this property:
zone>>ZN.Allocate(zone, Length) will allocate a block
zone>>ZN.Free(zone, Block) will free a block
By convention, these entries are at the beginning of a zone. Thus, all you need to know about the ZN data
structure is:
structure ZN[
Allocate word //Allocation procedure
Free word //Free procedure
...rest of zone...
]
Example
The following terrible implementation of the factorial function illustrates the use of Alloc:
static [ Spare
SpareIsAvail
FactZone
]
let Factorial(n) = valof
[ let FactZoneV = vec 256
let MySpare = vec 37
Spare = MySpare
SpareIsAvail = true
FactZone = InitializeZone(FactZoneV, 256, StkOvfl)
let FactVal = InnerFact(n)
resultis FactVal
]
and InnerFact(n) = valof
[ structure STKENT:
[ link word
value word
]
manifest [ empty = -1;
wordsize = 16
]
Alloc February 19, 1979 7:23 PM 49
For Xerox Internal Use Only -- December 15, 1980










