MTXAllocStack

C Specification

    #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. MTXAllocStack uses the OS function OSAlloc to allocate enough memory for numMtx matrices to sPtr->stackBase.

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

After calling MTXAllocStack, you must call MTXInitStack 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