HP Pascal/iX Reference Manual (31502-90022)

9- 4
VAR
p : ptr;
BEGIN
.
.
new(p); { Allocates largest variant. }
.
.
dispose(p); { Deallocates record with largest variant. }
.
.
new(p,engaged); { Allocates record with variant engaged. }
.
.
dispose(p,engaged); { Deallocates record with variant engaged. }
.
.
new(p,married,false); { Allocates record with variants married and false.}
.
dispose(p,married,true); { Error, case constants don't match new. }
.
.
END.
mark
Usage
mark
(p)
Parameter
p
A pointer variable.
Description
The procedure mark
(p)
marks the allocation state of the heap and sets the
value of
p
to specify that state. In other words, mark saves the
allocation state of the heap in
p
, which must not subsequently be altered
by assignment. If altered, the corresponding release cannot be
performed. mark is used with release.
Example
PROGRAM show_markrelease;
VAR
w,x,y: ^integer;
BEGIN
.
mark(w);
.
release(w); { Returns heap to state marked by w. }
.
mark(x);
.
mark(y);
.
release(x); { Returns heap to state marked by x. The }
. { pointer y no longer marks a heap state. }
END. { Release(y) is now an error. }