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>MTXAllocStack</H1>
12
13<H2>Syntax</H2>
14<dl><dd><pre class="construction">
15#include &lt;revolution/mtx.h&gt;
16
17#define MTXAllocStack( sPtr, numMtx ) \
18
19( ((MtxStackPtr)(sPtr))-&gt;stackBase = (MtxPtr)OSAlloc( ( (numMtx) * sizeof(Mtx)) ) )
20</pre></dd></dl>
21
22<H2>Arguments</H2>
23<TABLE class="arguments" border="1" >
24  <TBODY>
25    <TR>
26<TH>sPtr</TH>
27<TD>Pointer to a <A href="../structures/MtxStack_MtxStackPtr.html"><CODE>MtxStack</CODE></A> structure requiring matrix stack memory allocation</TD>
28    </TR>
29    <TR>
30<TH><STRONG><EM><CODE>numMtx</CODE></EM></STRONG></TH>
31<TD>Number of matrices to allocate to <SPAN class="argument">sPtr</SPAN>'s <STRONG>stackBase</STRONG> member</TD>
32    </TR>
33  </TBODY>
34</TABLE>
35
36<H2>Return Values</H2>
37<P>None.</P>
38
39<H2>Description</H2>
40<P>This macro, defined in <CODE>mtx.h</CODE>, allocates memory to a <A href="../structures/MtxStack_MtxStackPtr.html"><CODE>MtxStack</CODE></A>. The <CODE>MTXAllocStack</CODE> function uses the <A href="../../os/Alloc/OSAlloc.html"><CODE>OSAlloc</CODE></A> OS function to allocate enough memory for <SPAN class="argument">numMtx</SPAN> matrices to <SPAN class="argument">sPtr</SPAN><CODE><STRONG>-&gt;stackBase</STRONG></CODE>.</P>
41<P>The <CODE>MTXAllocStack</CODE> function is defined as a macro in <CODE>mtx.h</CODE> in order to make its <A href="../../os/Alloc/OSAlloc.html"><CODE>OSAlloc</CODE></A> function call visible. This insulates <CODE>mtx.lib</CODE> from changes to the OS memory allocation routines. If the <A href="../../os/Alloc/OSAlloc.html"><CODE>OSAlloc</CODE></A> function is changed or replaced, it is necessary only to redefine the <CODE>MTXAllocStack</CODE> function and re-compile <CODE>mtx.h</CODE>.</P>
42<P>After calling the <CODE>MTXAllocStack</CODE> function, you must call the <A href="MTXInitStack.html"><CODE>MTXInitStack</CODE></A> function to initialize the rest of <SPAN class="argument">sPtr</SPAN>'s members.</P>
43
44<H2>See Also</H2>
45<P class="reference">
46<A href="../structures/Mtx_MtxPtr.html">Mtx, MtxPtr</A>,
47<A href="../structures/MtxStack_MtxStackPtr.html">MtxStack, MtxStackPtr</A>,
48<A href="MTXFreeStack.html">MTXFreeStack</A>,
49<A href="MTXInitStack.html">MTXInitStack</A>,
50<A href="../../os/Alloc/OSAlloc.html">OSAlloc</A>,
51<A href="../../os/Alloc/OSFree.html">OSFree</A>
52</P>
53
54<H2>Revision History</H2>
55<P>
562006/03/01 Initial version.<BR>
57</P>
58
59<hr><p>CONFIDENTIAL</p></body>
60</HTML>