MTXAllocStack

Syntax

#include <revolution/mtx.h>

#define MTXAllocStack( sPtr, numMtx ) \

( ((MtxStackPtr)(sPtr))->stackBase = (MtxPtr)OSAlloc( ( (numMtx) * sizeof(Mtx)) ) )

Arguments

sPtr Pointer to a MtxStack structure requiring matrix stack memory allocation
numMtx Number of matrices to allocate to sPtr's stackBase member

Return Values

None.

Description

This macro, defined in mtx.h, allocates memory to a MtxStack. The MTXAllocStack function uses the OSAlloc OS function to allocate enough memory for numMtx matrices to sPtr->stackBase.

The MTXAllocStack function is defined as a macro in mtx.h in order to make its OSAlloc function call visible. This insulates mtx.lib from changes to the OS memory allocation routines. If the OSAlloc function is changed or replaced, it is necessary only to redefine the MTXAllocStack function and re-compile mtx.h.

After calling the MTXAllocStack function, you must call the MTXInitStack function to initialize the rest of sPtr's members.

See Also

Mtx, MtxPtr, MtxStack, MtxStackPtr, MTXFreeStack, MTXInitStack, OSAlloc, OSFree

Revision History

2006/03/01 Initial version.


CONFIDENTIAL