1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META name="GENERATOR" content="Microsoft FrontPage 5.0">
6<META http-equiv="Content-Style-Type" content="text/css">
7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
8<TITLE>MTXAllocStack</TITLE>
9</HEAD>
10<BODY>
11<H1 align="left">MTXAllocStack</H1>
12<H2 align="left">C Specification</H2>
13<P align="left"><CODE><CODE>&nbsp;&nbsp;&nbsp; #include &lt;revolution/mtx.h&gt;</CODE></CODE></P>
14<P align="left"><CODE><CODE>&nbsp;&nbsp;&nbsp; #define MTXAllocStack( sPtr, numMtx ) \</CODE></CODE></P>
15<P align="left"><CODE><CODE>( ((MtxStackPtr)(sPtr))-&gt;stackBase = (MtxPtr)OSAlloc( ( (numMtx) * sizeof(Mtx) ) ) )<BR></CODE></CODE></P>
16<H2 align="left">Arguments</H2>
17<DIV align="left">
18<TABLE border="1" cellpadding="3" cellspacing="0.1">
19  <TBODY>
20    <TR>
21<TD width="120" valign="top" align="left" bgcolor="#ffffe8"><CODE><STRONG><EM>sPtr</EM></STRONG></CODE></TD>
22<TD width="520" valign="top" align="left">Pointer to a <A href="../structures/MtxStack_MtxStackPtr.html"><CODE>MtxStack</CODE></A> structure requiring matrix stack memory allocation.</TD>
23    </TR>
24    <TR>
25<TD width="120" valign="top" align="left" bgcolor="#ffffe8"><CODE><STRONG><EM>numMtx</EM></STRONG></CODE></TD>
26<TD width="520">Number of matrices to allocate to <code><em><strong>sPtr</strong></em></code>'s <strong>stackBase</strong> member.</TD>
27    </TR>
28  </TBODY>
29</TABLE>
30</DIV>
31<H2 align="left">Return Values</H2>
32<P align="left">None.</P>
33<H2 align="left">Description</H2>
34<P>This macro, defined in <code>mtx.h</code>,&nbsp; allocates memory to a <A href="../structures/MtxStack_MtxStackPtr.html"><CODE>MtxStack</CODE></A>. <CODE>MTXAllocStack</CODE> uses the OS function <A href="../../os/Alloc/OSAlloc.html"><CODE>OSAlloc</CODE></A> to allocate enough memory for <code><em><strong>numMtx</strong></em></code> matrices to <code><strong><em>sPtr</em>-&gt;stackBase</strong></code>.</P>
35<P><code>MTXAllocStack</code> is defined as a macro in order to make its <A href="../../os/Alloc/OSAlloc.html"><CODE>OSAlloc</CODE></A> call visible in the <code>mtx.h</code> file.&nbsp; This insulates <code>mtx.lib</code> from changes to the OS memory allocation routines.&nbsp;If <A href="../../os/Alloc/OSAlloc.html"><code>OSAlloc</code></a> is changed or replaced, it is necessary only to redefine <code>MTXAllocStack</code> and re-compile <code>mtx.h</code>.</P>
36<P>After calling <code>MTXAllocStack</code>, you must call <a href="MTXInitStack.html"><code>MTXInitStack</code></a> to initialize the rest of <code><em><strong>sPtr</strong></em></code>'s members.</P>
37
38
39<H2 align="left">See Also</H2>
40<P align="left"><A href="../structures/Mtx_MtxPtr.html"><CODE>Mtx, MtxPtr</CODE></A>, <A href="../structures/MtxStack_MtxStackPtr.html"><CODE>MtxStack, MtxStackPtr</CODE></A>, <A href="MTXFreeStack.html"><CODE>MTXFreeStack</CODE></A>, <A href="MTXInitStack.html"><CODE>MTXInitStack</CODE></A>, <A href="../../os/Alloc/OSAlloc.html"><CODE>OSAlloc</CODE></A>, <A href="../../os/Alloc/OSFree.html"><CODE>OSFree</CODE></A></P>
41<H2>Revision History</H2>
42<P>03/01/2006 Initial version.</P>
43</BODY>
44</HTML>