docs/api-2.1/stack_8h.html

Tue, 05 Oct 2021 12:19:19 +0200

author
Mike Becker <universe@uap-core.de>
date
Tue, 05 Oct 2021 12:19:19 +0200
changeset 463
92721c8f9db3
parent 390
d345541018fa
permissions
-rw-r--r--

change src dir of Doxygen to only include header files

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>ucx: /home/mike/workspace/c/ucx/src/ucx/stack.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="uaplogo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">ucx
   </div>
   <div id="projectbrief">UAP Common Extensions</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_69f4ea29401808fe6229564976cde3ce.html">ucx</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">stack.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Default stack memory allocation implementation.  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;<a class="el" href="ucx_8h_source.html">ucx.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="allocator_8h_source.html">allocator.h</a>&quot;</code><br />
</div>
<p><a href="stack_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structUcxStack.html">UcxStack</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">UCX stack structure.  <a href="structUcxStack.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structucx__stack__metadata.html">ucx_stack_metadata</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Metadata for each UCX stack element.  <a href="structucx__stack__metadata.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a030197051a803e87d5eeac5adb80b15a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="stack_8h.html#a030197051a803e87d5eeac5adb80b15a">ucx_stack_topsize</a>(stack)</td></tr>
<tr class="memdesc:a030197051a803e87d5eeac5adb80b15a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the size of the top most element.  <a href="#a030197051a803e87d5eeac5adb80b15a">More...</a><br /></td></tr>
<tr class="separator:a030197051a803e87d5eeac5adb80b15a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a506b82374734ec476d086ddfb561174d"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="stack_8h.html#a506b82374734ec476d086ddfb561174d">ucx_stack_pop</a>(stack,  dest)&#160;&#160;&#160;<a class="el" href="stack_8h.html#a07ea48f28eab474dcfefbb86fa66ef81">ucx_stack_popn</a>(stack, dest, (size_t)-1)</td></tr>
<tr class="memdesc:a506b82374734ec476d086ddfb561174d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Removes the top most element from the stack and copies the content to <code> dest</code>, if specified.  <a href="#a506b82374734ec476d086ddfb561174d">More...</a><br /></td></tr>
<tr class="separator:a506b82374734ec476d086ddfb561174d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4f7239dbd6c032c56812e370b71c1985"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="stack_8h.html#a4f7239dbd6c032c56812e370b71c1985">ucx_stack_empty</a>(stack)&#160;&#160;&#160;(!(stack)-&gt;top)</td></tr>
<tr class="memdesc:a4f7239dbd6c032c56812e370b71c1985"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks, if the stack is empty.  <a href="#a4f7239dbd6c032c56812e370b71c1985">More...</a><br /></td></tr>
<tr class="separator:a4f7239dbd6c032c56812e370b71c1985"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3b761343c6491222604341ebfa443226"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="stack_8h.html#a3b761343c6491222604341ebfa443226">ucx_stack_dim</a>(size,  elems)</td></tr>
<tr class="memdesc:a3b761343c6491222604341ebfa443226"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes a recommended size for the stack memory area.  <a href="#a3b761343c6491222604341ebfa443226">More...</a><br /></td></tr>
<tr class="separator:a3b761343c6491222604341ebfa443226"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:abaef685df4e7ef95cd7218984a0618fe"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="stack_8h.html#abaef685df4e7ef95cd7218984a0618fe">ucx_stack_init</a> (<a class="el" href="structUcxStack.html">UcxStack</a> *stack, char *space, size_t size)</td></tr>
<tr class="memdesc:abaef685df4e7ef95cd7218984a0618fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes <a class="el" href="structUcxStack.html" title="UCX stack structure. ">UcxStack</a> structure with memory.  <a href="#abaef685df4e7ef95cd7218984a0618fe">More...</a><br /></td></tr>
<tr class="separator:abaef685df4e7ef95cd7218984a0618fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af865b416802140f6b6e8ab3626d7d1ac"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="stack_8h.html#af865b416802140f6b6e8ab3626d7d1ac">ucx_stack_malloc</a> (<a class="el" href="structUcxStack.html">UcxStack</a> *stack, size_t n)</td></tr>
<tr class="memdesc:af865b416802140f6b6e8ab3626d7d1ac"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocates stack memory.  <a href="#af865b416802140f6b6e8ab3626d7d1ac">More...</a><br /></td></tr>
<tr class="separator:af865b416802140f6b6e8ab3626d7d1ac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af85e6f77a8341beb6188f9ae1a8e9f92"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="stack_8h.html#af85e6f77a8341beb6188f9ae1a8e9f92">ucx_stack_push</a> (<a class="el" href="structUcxStack.html">UcxStack</a> *stack, size_t n, const void *data)</td></tr>
<tr class="memdesc:af85e6f77a8341beb6188f9ae1a8e9f92"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocates memory with <a class="el" href="stack_8h.html#af865b416802140f6b6e8ab3626d7d1ac" title="Allocates stack memory. ">ucx_stack_malloc()</a> and copies the specified data if the allocation was successful.  <a href="#af85e6f77a8341beb6188f9ae1a8e9f92">More...</a><br /></td></tr>
<tr class="separator:af85e6f77a8341beb6188f9ae1a8e9f92"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afdc467524b5e19a9a777c6bc03e17174"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="stack_8h.html#afdc467524b5e19a9a777c6bc03e17174">ucx_stack_calloc</a> (<a class="el" href="structUcxStack.html">UcxStack</a> *stack, size_t nelem, size_t elsize)</td></tr>
<tr class="memdesc:afdc467524b5e19a9a777c6bc03e17174"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocates an array of stack memory.  <a href="#afdc467524b5e19a9a777c6bc03e17174">More...</a><br /></td></tr>
<tr class="separator:afdc467524b5e19a9a777c6bc03e17174"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7bb138979191bba138e76ea37488fae2"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="stack_8h.html#a7bb138979191bba138e76ea37488fae2">ucx_stack_pusharr</a> (<a class="el" href="structUcxStack.html">UcxStack</a> *stack, size_t nelem, size_t elsize, const void *data)</td></tr>
<tr class="memdesc:a7bb138979191bba138e76ea37488fae2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocates memory with <a class="el" href="stack_8h.html#afdc467524b5e19a9a777c6bc03e17174" title="Allocates an array of stack memory. ">ucx_stack_calloc()</a> and copies the specified data if the allocation was successful.  <a href="#a7bb138979191bba138e76ea37488fae2">More...</a><br /></td></tr>
<tr class="separator:a7bb138979191bba138e76ea37488fae2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0c678f96f6fabab49b2b034a1fe91c3a"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="stack_8h.html#a0c678f96f6fabab49b2b034a1fe91c3a">ucx_stack_realloc</a> (<a class="el" href="structUcxStack.html">UcxStack</a> *stack, void *ptr, size_t n)</td></tr>
<tr class="memdesc:a0c678f96f6fabab49b2b034a1fe91c3a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reallocates memory on the stack.  <a href="#a0c678f96f6fabab49b2b034a1fe91c3a">More...</a><br /></td></tr>
<tr class="separator:a0c678f96f6fabab49b2b034a1fe91c3a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aabd55c14a3866b3782ba324f4d8b4c41"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="stack_8h.html#aabd55c14a3866b3782ba324f4d8b4c41">ucx_stack_free</a> (<a class="el" href="structUcxStack.html">UcxStack</a> *stack, void *ptr)</td></tr>
<tr class="memdesc:aabd55c14a3866b3782ba324f4d8b4c41"><td class="mdescLeft">&#160;</td><td class="mdescRight">Frees memory on the stack.  <a href="#aabd55c14a3866b3782ba324f4d8b4c41">More...</a><br /></td></tr>
<tr class="separator:aabd55c14a3866b3782ba324f4d8b4c41"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a07ea48f28eab474dcfefbb86fa66ef81"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="stack_8h.html#a07ea48f28eab474dcfefbb86fa66ef81">ucx_stack_popn</a> (<a class="el" href="structUcxStack.html">UcxStack</a> *stack, void *dest, size_t n)</td></tr>
<tr class="memdesc:a07ea48f28eab474dcfefbb86fa66ef81"><td class="mdescLeft">&#160;</td><td class="mdescRight">Removes the top most element from the stack and copies the content to <code> dest</code>.  <a href="#a07ea48f28eab474dcfefbb86fa66ef81">More...</a><br /></td></tr>
<tr class="separator:a07ea48f28eab474dcfefbb86fa66ef81"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a53cd2c7743dc8ad9cbd35ade0b4873e7"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="stack_8h.html#a53cd2c7743dc8ad9cbd35ade0b4873e7">ucx_stack_avail</a> (<a class="el" href="structUcxStack.html">UcxStack</a> *stack)</td></tr>
<tr class="memdesc:a53cd2c7743dc8ad9cbd35ade0b4873e7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the remaining available memory on the specified stack.  <a href="#a53cd2c7743dc8ad9cbd35ade0b4873e7">More...</a><br /></td></tr>
<tr class="separator:a53cd2c7743dc8ad9cbd35ade0b4873e7"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Default stack memory allocation implementation. </p>
<dl class="section author"><dt>Author</dt><dd>Mike Becker </dd>
<dd>
Olaf Wintermann </dd></dl>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a3b761343c6491222604341ebfa443226"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3b761343c6491222604341ebfa443226">&#9670;&nbsp;</a></span>ucx_stack_dim</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ucx_stack_dim</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">size, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">elems&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line">(size+<span class="keyword">sizeof</span>(<span class="keyword">struct </span><a class="code" href="structucx__stack__metadata.html">ucx_stack_metadata</a>) * \</div><div class="line">                                    (elems + 1))</div><div class="ttc" id="structucx__stack__metadata_html"><div class="ttname"><a href="structucx__stack__metadata.html">ucx_stack_metadata</a></div><div class="ttdoc">Metadata for each UCX stack element. </div><div class="ttdef"><b>Definition:</b> stack.h:69</div></div>
</div><!-- fragment -->
<p>Computes a recommended size for the stack memory area. </p>
<p>Note, that reallocations have not been taken into account, so you might need to reserve twice as much memory to allow many reallocations.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">size</td><td>the approximate payload </td></tr>
    <tr><td class="paramname">elems</td><td>the approximate count of element allocations </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a recommended size for the stack space based on the information provided </dd></dl>

</div>
</div>
<a id="a4f7239dbd6c032c56812e370b71c1985"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4f7239dbd6c032c56812e370b71c1985">&#9670;&nbsp;</a></span>ucx_stack_empty</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ucx_stack_empty</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">stack</td><td>)</td>
          <td>&#160;&#160;&#160;(!(stack)-&gt;top)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Checks, if the stack is empty. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stack</td><td>a pointer to the stack </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>nonzero, if the stack is empty, zero otherwise </dd></dl>

</div>
</div>
<a id="a506b82374734ec476d086ddfb561174d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a506b82374734ec476d086ddfb561174d">&#9670;&nbsp;</a></span>ucx_stack_pop</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ucx_stack_pop</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">stack, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">dest&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;<a class="el" href="stack_8h.html#a07ea48f28eab474dcfefbb86fa66ef81">ucx_stack_popn</a>(stack, dest, (size_t)-1)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Removes the top most element from the stack and copies the content to <code> dest</code>, if specified. </p>
<p>Use <a class="el" href="stack_8h.html#a030197051a803e87d5eeac5adb80b15a" title="Returns the size of the top most element. ">ucx_stack_topsize()</a># to get the amount of memory that must be available at the location of <code>dest</code>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stack</td><td>a pointer to the stack </td></tr>
    <tr><td class="paramname">dest</td><td>the location where the contents shall be written to, or <code> NULL</code>, if the element shall only be removed. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="stack_8h.html#aabd55c14a3866b3782ba324f4d8b4c41" title="Frees memory on the stack. ">ucx_stack_free</a> </dd>
<dd>
<a class="el" href="stack_8h.html#a07ea48f28eab474dcfefbb86fa66ef81" title="Removes the top most element from the stack and copies the content to  dest. ">ucx_stack_popn</a> </dd></dl>

</div>
</div>
<a id="a030197051a803e87d5eeac5adb80b15a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a030197051a803e87d5eeac5adb80b15a">&#9670;&nbsp;</a></span>ucx_stack_topsize</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ucx_stack_topsize</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">stack</td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line">((stack)-&gt;top ? ((<span class="keyword">struct</span> <a class="code" href="structucx__stack__metadata.html">ucx_stack_metadata</a>*)\</div><div class="line">                                  (stack)-&gt;top - 1)-&gt;size : 0)</div><div class="ttc" id="structucx__stack__metadata_html"><div class="ttname"><a href="structucx__stack__metadata.html">ucx_stack_metadata</a></div><div class="ttdoc">Metadata for each UCX stack element. </div><div class="ttdef"><b>Definition:</b> stack.h:69</div></div>
</div><!-- fragment -->
<p>Returns the size of the top most element. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stack</td><td>a pointer to the stack </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the size of the top most element </dd></dl>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a53cd2c7743dc8ad9cbd35ade0b4873e7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a53cd2c7743dc8ad9cbd35ade0b4873e7">&#9670;&nbsp;</a></span>ucx_stack_avail()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t ucx_stack_avail </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structUcxStack.html">UcxStack</a> *&#160;</td>
          <td class="paramname"><em>stack</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the remaining available memory on the specified stack. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stack</td><td>a pointer to the stack </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the remaining available memory </dd></dl>

</div>
</div>
<a id="afdc467524b5e19a9a777c6bc03e17174"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afdc467524b5e19a9a777c6bc03e17174">&#9670;&nbsp;</a></span>ucx_stack_calloc()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void* ucx_stack_calloc </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structUcxStack.html">UcxStack</a> *&#160;</td>
          <td class="paramname"><em>stack</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>nelem</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>elsize</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Allocates an array of stack memory. </p>
<p>The content of the allocated memory is set to zero.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stack</td><td>a pointer to the stack </td></tr>
    <tr><td class="paramname">nelem</td><td>amount of elements to allocate </td></tr>
    <tr><td class="paramname">elsize</td><td>amount of memory per element </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer to the allocated memory </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="allocator_8h.html#a2c0aba4221c1ac6801f03ed799f15b12" title="A function pointer to the allocators calloc() function. ">ucx_allocator_calloc()</a> </dd></dl>

</div>
</div>
<a id="aabd55c14a3866b3782ba324f4d8b4c41"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aabd55c14a3866b3782ba324f4d8b4c41">&#9670;&nbsp;</a></span>ucx_stack_free()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ucx_stack_free </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structUcxStack.html">UcxStack</a> *&#160;</td>
          <td class="paramname"><em>stack</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>ptr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Frees memory on the stack. </p>
<p>Freeing stack memory behaves in a special way.</p>
<p>If the element, that should be freed, is the top most element of the stack, it is removed from the stack. Otherwise it is marked as freed. Marked elements are removed, when they become the top most elements of the stack.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stack</td><td>a pointer to the stack </td></tr>
    <tr><td class="paramname">ptr</td><td>a pointer to the memory that shall be freed </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="abaef685df4e7ef95cd7218984a0618fe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abaef685df4e7ef95cd7218984a0618fe">&#9670;&nbsp;</a></span>ucx_stack_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ucx_stack_init </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structUcxStack.html">UcxStack</a> *&#160;</td>
          <td class="paramname"><em>stack</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>space</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initializes <a class="el" href="structUcxStack.html" title="UCX stack structure. ">UcxStack</a> structure with memory. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stack</td><td>a pointer to an uninitialized stack structure </td></tr>
    <tr><td class="paramname">space</td><td>the memory area that shall be managed </td></tr>
    <tr><td class="paramname">size</td><td>size of the memory area </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a new <a class="el" href="structUcxStack.html" title="UCX stack structure. ">UcxStack</a> structure </dd></dl>

</div>
</div>
<a id="af865b416802140f6b6e8ab3626d7d1ac"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af865b416802140f6b6e8ab3626d7d1ac">&#9670;&nbsp;</a></span>ucx_stack_malloc()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void* ucx_stack_malloc </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structUcxStack.html">UcxStack</a> *&#160;</td>
          <td class="paramname"><em>stack</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>n</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Allocates stack memory. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stack</td><td>a pointer to the stack </td></tr>
    <tr><td class="paramname">n</td><td>amount of memory to allocate </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer to the allocated memory or <code>NULL</code> on stack overflow </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="allocator_8h.html#a29f0f6a23a70db3b60635cd6dc384473" title="A function pointer to the allocators malloc() function. ">ucx_allocator_malloc()</a> </dd></dl>

</div>
</div>
<a id="a07ea48f28eab474dcfefbb86fa66ef81"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a07ea48f28eab474dcfefbb86fa66ef81">&#9670;&nbsp;</a></span>ucx_stack_popn()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ucx_stack_popn </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structUcxStack.html">UcxStack</a> *&#160;</td>
          <td class="paramname"><em>stack</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>dest</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>n</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Removes the top most element from the stack and copies the content to <code> dest</code>. </p>
<p>This function copies at most <code>n</code> bytes to the destination, but the element is always freed as a whole. If the element was larger than <code>n</code>, the remaining data is lost.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stack</td><td>a pointer to the stack </td></tr>
    <tr><td class="paramname">dest</td><td>the location where the contents shall be written to </td></tr>
    <tr><td class="paramname">n</td><td>copies at most n bytes to <code>dest</code> </td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="stack_8h.html#a506b82374734ec476d086ddfb561174d" title="Removes the top most element from the stack and copies the content to  dest, if specified. ">ucx_stack_pop</a> </dd></dl>

</div>
</div>
<a id="af85e6f77a8341beb6188f9ae1a8e9f92"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af85e6f77a8341beb6188f9ae1a8e9f92">&#9670;&nbsp;</a></span>ucx_stack_push()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void* ucx_stack_push </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structUcxStack.html">UcxStack</a> *&#160;</td>
          <td class="paramname"><em>stack</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>n</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>data</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Allocates memory with <a class="el" href="stack_8h.html#af865b416802140f6b6e8ab3626d7d1ac" title="Allocates stack memory. ">ucx_stack_malloc()</a> and copies the specified data if the allocation was successful. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stack</td><td>a pointer to the stack </td></tr>
    <tr><td class="paramname">n</td><td>amount of memory to allocate </td></tr>
    <tr><td class="paramname">data</td><td>a pointer to the data to copy </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer to the allocated memory </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="stack_8h.html#af865b416802140f6b6e8ab3626d7d1ac" title="Allocates stack memory. ">ucx_stack_malloc</a> </dd></dl>

</div>
</div>
<a id="a7bb138979191bba138e76ea37488fae2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7bb138979191bba138e76ea37488fae2">&#9670;&nbsp;</a></span>ucx_stack_pusharr()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void* ucx_stack_pusharr </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structUcxStack.html">UcxStack</a> *&#160;</td>
          <td class="paramname"><em>stack</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>nelem</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>elsize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>data</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Allocates memory with <a class="el" href="stack_8h.html#afdc467524b5e19a9a777c6bc03e17174" title="Allocates an array of stack memory. ">ucx_stack_calloc()</a> and copies the specified data if the allocation was successful. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stack</td><td>a pointer to the stack </td></tr>
    <tr><td class="paramname">nelem</td><td>amount of elements to allocate </td></tr>
    <tr><td class="paramname">elsize</td><td>amount of memory per element </td></tr>
    <tr><td class="paramname">data</td><td>a pointer to the data </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer to the allocated memory </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="stack_8h.html#afdc467524b5e19a9a777c6bc03e17174" title="Allocates an array of stack memory. ">ucx_stack_calloc</a> </dd></dl>

</div>
</div>
<a id="a0c678f96f6fabab49b2b034a1fe91c3a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0c678f96f6fabab49b2b034a1fe91c3a">&#9670;&nbsp;</a></span>ucx_stack_realloc()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void* ucx_stack_realloc </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structUcxStack.html">UcxStack</a> *&#160;</td>
          <td class="paramname"><em>stack</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>ptr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>n</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reallocates memory on the stack. </p>
<p>Shrinking memory is always safe. Extending memory can be very expensive.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stack</td><td>the stack </td></tr>
    <tr><td class="paramname">ptr</td><td>a pointer to the memory that shall be reallocated </td></tr>
    <tr><td class="paramname">n</td><td>the new size of the memory </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer to the new location of the memory </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="allocator_8h.html#a6d7cf038a806e327c5da37321d04e426" title="A function pointer to the allocators realloc() function. ">ucx_allocator_realloc()</a> </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Dec 19 2019 19:58:24 for ucx by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>

mercurial