MAINSAIL Language Manual, Section 42.4

previous   next   top   contents   index   framed top   this page unframed


42.4. newPage

Figure 42–5. newPage (GENERIC)
ADDRESS
PROCEDURE   newPage     (OPTIONAL LONG INTEGER numPages;
                         
OPTIONAL INTEGER pageCode;
                         
OPTIONAL BITS ctrlBits);

ADDRESS
PROCEDURE   newPage     (OPTIONAL INTEGER numPages;
                         
OPTIONAL INTEGER pageCode;
                         
OPTIONAL BITS ctrlBits);

MAINSAIL divides memory into fixed-sized pages. newPage allocates and returns the ADDRESS of a page for a program's use.

newPage returns the ADDRESS of the first of numPages consecutive free pages after marking them as no longer free. If numPages is less than or equal to zero, one page is allocated. pageCode should be 0; other values are for system use, and the effect of their use in a user program is undefined.

The size of a page is the machine-dependent value $pageSize, which is the number of storage units in a page.

The only valid ctrlBits are errorOK and $doNotClear. If the pages cannot be allocated, an error occurs unless ctrlBits has errorOK set, in which case NULLADDRESS is returned. The pages are cleared unless $doNotClear is set (for efficiency), in which case their contents are initially unspecified.

pageDispose is used to release pages.

Example 42–6. Use of newPage
ADDRESS a;
a := newPage;
... 
use the allocated space...
pageDispose(a)


previous   next   top   contents   index   framed top   this page unframed

MAINSAIL Language Manual, Section 42.4