previous next top contents index framed top this page unframed
Figure 42–13. newUpperBound (GENERIC)
| SPECIAL PROCEDURE newUpperBound (MODIFIES ARRAY(*) a; INTEGER n; OPTIONAL POINTER($area) area); SPECIAL PROCEDURE newUpperBound (MODIFIES ARRAY(*) a; LONG INTEGER n; OPTIONAL POINTER($area) area); |
newUpperBound adjusts the upper bound of a one-dimensional dynamic ARRAY.
A new ARRAY object is allocated with lower bound the same as a's lower bound and upper bound given by n. newUpperBound then copies as many elements from a as will fit into the new ARRAY; if the new ARRAY is larger, the extra elements are initialized to Zero. The old ARRAY object to which a points is disposed, and a is made to point to the newly allocated ARRAY object.
It is an error if a is NULLARRAY, if n is less than a's lower bound, or if a was declared with a constant upper bound.
area specifies the area in which the new (copied) ARRAY is put, which need not be the same as the area in which the ARRAY was originally located. If area is not specified, the copied ARRAY is allocated in the same area as the old one.
Example 42–14. Use of newUpperBound
| IF i > currentBound THEN newUpperBound(a,currentBound := i) |
MAINSAIL Language Manual, Section 42.10