Tue, 26 Nov 2024 21:53:06 +0100
cxBufferFree() now calls cxBufferDestroy()
390 | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
2 | <html xmlns="http://www.w3.org/1999/xhtml"> | |
3 | <head> | |
4 | <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> | |
5 | <meta http-equiv="X-UA-Compatible" content="IE=9"/> | |
6 | <meta name="generator" content="Doxygen 1.8.13"/> | |
7 | <meta name="viewport" content="width=device-width, initial-scale=1"/> | |
8 | <title>ucx: /home/mike/workspace/c/ucx/src/ucx/stack.h File Reference</title> | |
9 | <link href="tabs.css" rel="stylesheet" type="text/css"/> | |
10 | <script type="text/javascript" src="jquery.js"></script> | |
11 | <script type="text/javascript" src="dynsections.js"></script> | |
12 | <link href="search/search.css" rel="stylesheet" type="text/css"/> | |
13 | <script type="text/javascript" src="search/searchdata.js"></script> | |
14 | <script type="text/javascript" src="search/search.js"></script> | |
15 | <link href="doxygen.css" rel="stylesheet" type="text/css" /> | |
16 | </head> | |
17 | <body> | |
18 | <div id="top"><!-- do not remove this div, it is closed by doxygen! --> | |
19 | <div id="titlearea"> | |
20 | <table cellspacing="0" cellpadding="0"> | |
21 | <tbody> | |
22 | <tr style="height: 56px;"> | |
23 | <td id="projectlogo"><img alt="Logo" src="uaplogo.png"/></td> | |
24 | <td id="projectalign" style="padding-left: 0.5em;"> | |
25 | <div id="projectname">ucx | |
26 | </div> | |
27 | <div id="projectbrief">UAP Common Extensions</div> | |
28 | </td> | |
29 | </tr> | |
30 | </tbody> | |
31 | </table> | |
32 | </div> | |
33 | <!-- end header part --> | |
34 | <!-- Generated by Doxygen 1.8.13 --> | |
35 | <script type="text/javascript"> | |
36 | var searchBox = new SearchBox("searchBox", "search",false,'Search'); | |
37 | </script> | |
38 | <script type="text/javascript" src="menudata.js"></script> | |
39 | <script type="text/javascript" src="menu.js"></script> | |
40 | <script type="text/javascript"> | |
41 | $(function() { | |
42 | initMenu('',true,false,'search.php','Search'); | |
43 | $(document).ready(function() { init_search(); }); | |
44 | }); | |
45 | </script> | |
46 | <div id="main-nav"></div> | |
47 | <!-- window showing the filter options --> | |
48 | <div id="MSearchSelectWindow" | |
49 | onmouseover="return searchBox.OnSearchSelectShow()" | |
50 | onmouseout="return searchBox.OnSearchSelectHide()" | |
51 | onkeydown="return searchBox.OnSearchSelectKey(event)"> | |
52 | </div> | |
53 | ||
54 | <!-- iframe showing the search results (closed by default) --> | |
55 | <div id="MSearchResultsWindow"> | |
56 | <iframe src="javascript:void(0)" frameborder="0" | |
57 | name="MSearchResults" id="MSearchResults"> | |
58 | </iframe> | |
59 | </div> | |
60 | ||
61 | <div id="nav-path" class="navpath"> | |
62 | <ul> | |
63 | <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> | |
64 | </div> | |
65 | </div><!-- top --> | |
66 | <div class="header"> | |
67 | <div class="summary"> | |
68 | <a href="#nested-classes">Data Structures</a> | | |
69 | <a href="#define-members">Macros</a> | | |
70 | <a href="#func-members">Functions</a> </div> | |
71 | <div class="headertitle"> | |
72 | <div class="title">stack.h File Reference</div> </div> | |
73 | </div><!--header--> | |
74 | <div class="contents"> | |
75 | ||
76 | <p>Default stack memory allocation implementation. | |
77 | <a href="#details">More...</a></p> | |
78 | <div class="textblock"><code>#include "<a class="el" href="ucx_8h_source.html">ucx.h</a>"</code><br /> | |
79 | <code>#include "<a class="el" href="allocator_8h_source.html">allocator.h</a>"</code><br /> | |
80 | </div> | |
81 | <p><a href="stack_8h_source.html">Go to the source code of this file.</a></p> | |
82 | <table class="memberdecls"> | |
83 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a> | |
84 | Data Structures</h2></td></tr> | |
85 | <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structUcxStack.html">UcxStack</a></td></tr> | |
86 | <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">UCX stack structure. <a href="structUcxStack.html#details">More...</a><br /></td></tr> | |
87 | <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> | |
88 | <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structucx__stack__metadata.html">ucx_stack_metadata</a></td></tr> | |
89 | <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Metadata for each UCX stack element. <a href="structucx__stack__metadata.html#details">More...</a><br /></td></tr> | |
90 | <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> | |
91 | </table><table class="memberdecls"> | |
92 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a> | |
93 | Macros</h2></td></tr> | |
94 | <tr class="memitem:a030197051a803e87d5eeac5adb80b15a"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="stack_8h.html#a030197051a803e87d5eeac5adb80b15a">ucx_stack_topsize</a>(stack)</td></tr> | |
95 | <tr class="memdesc:a030197051a803e87d5eeac5adb80b15a"><td class="mdescLeft"> </td><td class="mdescRight">Returns the size of the top most element. <a href="#a030197051a803e87d5eeac5adb80b15a">More...</a><br /></td></tr> | |
96 | <tr class="separator:a030197051a803e87d5eeac5adb80b15a"><td class="memSeparator" colspan="2"> </td></tr> | |
97 | <tr class="memitem:a506b82374734ec476d086ddfb561174d"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="stack_8h.html#a506b82374734ec476d086ddfb561174d">ucx_stack_pop</a>(stack, dest)   <a class="el" href="stack_8h.html#a07ea48f28eab474dcfefbb86fa66ef81">ucx_stack_popn</a>(stack, dest, (size_t)-1)</td></tr> | |
98 | <tr class="memdesc:a506b82374734ec476d086ddfb561174d"><td class="mdescLeft"> </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> | |
99 | <tr class="separator:a506b82374734ec476d086ddfb561174d"><td class="memSeparator" colspan="2"> </td></tr> | |
100 | <tr class="memitem:a4f7239dbd6c032c56812e370b71c1985"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="stack_8h.html#a4f7239dbd6c032c56812e370b71c1985">ucx_stack_empty</a>(stack)   (!(stack)->top)</td></tr> | |
101 | <tr class="memdesc:a4f7239dbd6c032c56812e370b71c1985"><td class="mdescLeft"> </td><td class="mdescRight">Checks, if the stack is empty. <a href="#a4f7239dbd6c032c56812e370b71c1985">More...</a><br /></td></tr> | |
102 | <tr class="separator:a4f7239dbd6c032c56812e370b71c1985"><td class="memSeparator" colspan="2"> </td></tr> | |
103 | <tr class="memitem:a3b761343c6491222604341ebfa443226"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="stack_8h.html#a3b761343c6491222604341ebfa443226">ucx_stack_dim</a>(size, elems)</td></tr> | |
104 | <tr class="memdesc:a3b761343c6491222604341ebfa443226"><td class="mdescLeft"> </td><td class="mdescRight">Computes a recommended size for the stack memory area. <a href="#a3b761343c6491222604341ebfa443226">More...</a><br /></td></tr> | |
105 | <tr class="separator:a3b761343c6491222604341ebfa443226"><td class="memSeparator" colspan="2"> </td></tr> | |
106 | </table><table class="memberdecls"> | |
107 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> | |
108 | Functions</h2></td></tr> | |
109 | <tr class="memitem:abaef685df4e7ef95cd7218984a0618fe"><td class="memItemLeft" align="right" valign="top">void </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> | |
110 | <tr class="memdesc:abaef685df4e7ef95cd7218984a0618fe"><td class="mdescLeft"> </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> | |
111 | <tr class="separator:abaef685df4e7ef95cd7218984a0618fe"><td class="memSeparator" colspan="2"> </td></tr> | |
112 | <tr class="memitem:af865b416802140f6b6e8ab3626d7d1ac"><td class="memItemLeft" align="right" valign="top">void * </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> | |
113 | <tr class="memdesc:af865b416802140f6b6e8ab3626d7d1ac"><td class="mdescLeft"> </td><td class="mdescRight">Allocates stack memory. <a href="#af865b416802140f6b6e8ab3626d7d1ac">More...</a><br /></td></tr> | |
114 | <tr class="separator:af865b416802140f6b6e8ab3626d7d1ac"><td class="memSeparator" colspan="2"> </td></tr> | |
115 | <tr class="memitem:af85e6f77a8341beb6188f9ae1a8e9f92"><td class="memItemLeft" align="right" valign="top">void * </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> | |
116 | <tr class="memdesc:af85e6f77a8341beb6188f9ae1a8e9f92"><td class="mdescLeft"> </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> | |
117 | <tr class="separator:af85e6f77a8341beb6188f9ae1a8e9f92"><td class="memSeparator" colspan="2"> </td></tr> | |
118 | <tr class="memitem:afdc467524b5e19a9a777c6bc03e17174"><td class="memItemLeft" align="right" valign="top">void * </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> | |
119 | <tr class="memdesc:afdc467524b5e19a9a777c6bc03e17174"><td class="mdescLeft"> </td><td class="mdescRight">Allocates an array of stack memory. <a href="#afdc467524b5e19a9a777c6bc03e17174">More...</a><br /></td></tr> | |
120 | <tr class="separator:afdc467524b5e19a9a777c6bc03e17174"><td class="memSeparator" colspan="2"> </td></tr> | |
121 | <tr class="memitem:a7bb138979191bba138e76ea37488fae2"><td class="memItemLeft" align="right" valign="top">void * </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> | |
122 | <tr class="memdesc:a7bb138979191bba138e76ea37488fae2"><td class="mdescLeft"> </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> | |
123 | <tr class="separator:a7bb138979191bba138e76ea37488fae2"><td class="memSeparator" colspan="2"> </td></tr> | |
124 | <tr class="memitem:a0c678f96f6fabab49b2b034a1fe91c3a"><td class="memItemLeft" align="right" valign="top">void * </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> | |
125 | <tr class="memdesc:a0c678f96f6fabab49b2b034a1fe91c3a"><td class="mdescLeft"> </td><td class="mdescRight">Reallocates memory on the stack. <a href="#a0c678f96f6fabab49b2b034a1fe91c3a">More...</a><br /></td></tr> | |
126 | <tr class="separator:a0c678f96f6fabab49b2b034a1fe91c3a"><td class="memSeparator" colspan="2"> </td></tr> | |
127 | <tr class="memitem:aabd55c14a3866b3782ba324f4d8b4c41"><td class="memItemLeft" align="right" valign="top">void </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> | |
128 | <tr class="memdesc:aabd55c14a3866b3782ba324f4d8b4c41"><td class="mdescLeft"> </td><td class="mdescRight">Frees memory on the stack. <a href="#aabd55c14a3866b3782ba324f4d8b4c41">More...</a><br /></td></tr> | |
129 | <tr class="separator:aabd55c14a3866b3782ba324f4d8b4c41"><td class="memSeparator" colspan="2"> </td></tr> | |
130 | <tr class="memitem:a07ea48f28eab474dcfefbb86fa66ef81"><td class="memItemLeft" align="right" valign="top">void </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> | |
131 | <tr class="memdesc:a07ea48f28eab474dcfefbb86fa66ef81"><td class="mdescLeft"> </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> | |
132 | <tr class="separator:a07ea48f28eab474dcfefbb86fa66ef81"><td class="memSeparator" colspan="2"> </td></tr> | |
133 | <tr class="memitem:a53cd2c7743dc8ad9cbd35ade0b4873e7"><td class="memItemLeft" align="right" valign="top">size_t </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> | |
134 | <tr class="memdesc:a53cd2c7743dc8ad9cbd35ade0b4873e7"><td class="mdescLeft"> </td><td class="mdescRight">Returns the remaining available memory on the specified stack. <a href="#a53cd2c7743dc8ad9cbd35ade0b4873e7">More...</a><br /></td></tr> | |
135 | <tr class="separator:a53cd2c7743dc8ad9cbd35ade0b4873e7"><td class="memSeparator" colspan="2"> </td></tr> | |
136 | </table> | |
137 | <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> | |
138 | <div class="textblock"><p>Default stack memory allocation implementation. </p> | |
139 | <dl class="section author"><dt>Author</dt><dd>Mike Becker </dd> | |
140 | <dd> | |
141 | Olaf Wintermann </dd></dl> | |
142 | </div><h2 class="groupheader">Macro Definition Documentation</h2> | |
143 | <a id="a3b761343c6491222604341ebfa443226"></a> | |
144 | <h2 class="memtitle"><span class="permalink"><a href="#a3b761343c6491222604341ebfa443226">◆ </a></span>ucx_stack_dim</h2> | |
145 | ||
146 | <div class="memitem"> | |
147 | <div class="memproto"> | |
148 | <table class="memname"> | |
149 | <tr> | |
150 | <td class="memname">#define ucx_stack_dim</td> | |
151 | <td>(</td> | |
152 | <td class="paramtype"> </td> | |
153 | <td class="paramname">size, </td> | |
154 | </tr> | |
155 | <tr> | |
156 | <td class="paramkey"></td> | |
157 | <td></td> | |
158 | <td class="paramtype"> </td> | |
159 | <td class="paramname">elems </td> | |
160 | </tr> | |
161 | <tr> | |
162 | <td></td> | |
163 | <td>)</td> | |
164 | <td></td><td></td> | |
165 | </tr> | |
166 | </table> | |
167 | </div><div class="memdoc"> | |
168 | <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> | |
169 | </div><!-- fragment --> | |
170 | <p>Computes a recommended size for the stack memory area. </p> | |
171 | <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> | |
172 | <dl class="params"><dt>Parameters</dt><dd> | |
173 | <table class="params"> | |
174 | <tr><td class="paramname">size</td><td>the approximate payload </td></tr> | |
175 | <tr><td class="paramname">elems</td><td>the approximate count of element allocations </td></tr> | |
176 | </table> | |
177 | </dd> | |
178 | </dl> | |
179 | <dl class="section return"><dt>Returns</dt><dd>a recommended size for the stack space based on the information provided </dd></dl> | |
180 | ||
181 | </div> | |
182 | </div> | |
183 | <a id="a4f7239dbd6c032c56812e370b71c1985"></a> | |
184 | <h2 class="memtitle"><span class="permalink"><a href="#a4f7239dbd6c032c56812e370b71c1985">◆ </a></span>ucx_stack_empty</h2> | |
185 | ||
186 | <div class="memitem"> | |
187 | <div class="memproto"> | |
188 | <table class="memname"> | |
189 | <tr> | |
190 | <td class="memname">#define ucx_stack_empty</td> | |
191 | <td>(</td> | |
192 | <td class="paramtype"> </td> | |
193 | <td class="paramname">stack</td><td>)</td> | |
194 | <td>   (!(stack)->top)</td> | |
195 | </tr> | |
196 | </table> | |
197 | </div><div class="memdoc"> | |
198 | ||
199 | <p>Checks, if the stack is empty. </p> | |
200 | <dl class="params"><dt>Parameters</dt><dd> | |
201 | <table class="params"> | |
202 | <tr><td class="paramname">stack</td><td>a pointer to the stack </td></tr> | |
203 | </table> | |
204 | </dd> | |
205 | </dl> | |
206 | <dl class="section return"><dt>Returns</dt><dd>nonzero, if the stack is empty, zero otherwise </dd></dl> | |
207 | ||
208 | </div> | |
209 | </div> | |
210 | <a id="a506b82374734ec476d086ddfb561174d"></a> | |
211 | <h2 class="memtitle"><span class="permalink"><a href="#a506b82374734ec476d086ddfb561174d">◆ </a></span>ucx_stack_pop</h2> | |
212 | ||
213 | <div class="memitem"> | |
214 | <div class="memproto"> | |
215 | <table class="memname"> | |
216 | <tr> | |
217 | <td class="memname">#define ucx_stack_pop</td> | |
218 | <td>(</td> | |
219 | <td class="paramtype"> </td> | |
220 | <td class="paramname">stack, </td> | |
221 | </tr> | |
222 | <tr> | |
223 | <td class="paramkey"></td> | |
224 | <td></td> | |
225 | <td class="paramtype"> </td> | |
226 | <td class="paramname">dest </td> | |
227 | </tr> | |
228 | <tr> | |
229 | <td></td> | |
230 | <td>)</td> | |
231 | <td></td><td>   <a class="el" href="stack_8h.html#a07ea48f28eab474dcfefbb86fa66ef81">ucx_stack_popn</a>(stack, dest, (size_t)-1)</td> | |
232 | </tr> | |
233 | </table> | |
234 | </div><div class="memdoc"> | |
235 | ||
236 | <p>Removes the top most element from the stack and copies the content to <code> dest</code>, if specified. </p> | |
237 | <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> | |
238 | <dl class="params"><dt>Parameters</dt><dd> | |
239 | <table class="params"> | |
240 | <tr><td class="paramname">stack</td><td>a pointer to the stack </td></tr> | |
241 | <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> | |
242 | </table> | |
243 | </dd> | |
244 | </dl> | |
245 | <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> | |
246 | <dd> | |
247 | <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> | |
248 | ||
249 | </div> | |
250 | </div> | |
251 | <a id="a030197051a803e87d5eeac5adb80b15a"></a> | |
252 | <h2 class="memtitle"><span class="permalink"><a href="#a030197051a803e87d5eeac5adb80b15a">◆ </a></span>ucx_stack_topsize</h2> | |
253 | ||
254 | <div class="memitem"> | |
255 | <div class="memproto"> | |
256 | <table class="memname"> | |
257 | <tr> | |
258 | <td class="memname">#define ucx_stack_topsize</td> | |
259 | <td>(</td> | |
260 | <td class="paramtype"> </td> | |
261 | <td class="paramname">stack</td><td>)</td> | |
262 | <td></td> | |
263 | </tr> | |
264 | </table> | |
265 | </div><div class="memdoc"> | |
266 | <b>Value:</b><div class="fragment"><div class="line">((stack)->top ? ((<span class="keyword">struct</span> <a class="code" href="structucx__stack__metadata.html">ucx_stack_metadata</a>*)\</div><div class="line"> (stack)->top - 1)->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> | |
267 | </div><!-- fragment --> | |
268 | <p>Returns the size of the top most element. </p> | |
269 | <dl class="params"><dt>Parameters</dt><dd> | |
270 | <table class="params"> | |
271 | <tr><td class="paramname">stack</td><td>a pointer to the stack </td></tr> | |
272 | </table> | |
273 | </dd> | |
274 | </dl> | |
275 | <dl class="section return"><dt>Returns</dt><dd>the size of the top most element </dd></dl> | |
276 | ||
277 | </div> | |
278 | </div> | |
279 | <h2 class="groupheader">Function Documentation</h2> | |
280 | <a id="a53cd2c7743dc8ad9cbd35ade0b4873e7"></a> | |
281 | <h2 class="memtitle"><span class="permalink"><a href="#a53cd2c7743dc8ad9cbd35ade0b4873e7">◆ </a></span>ucx_stack_avail()</h2> | |
282 | ||
283 | <div class="memitem"> | |
284 | <div class="memproto"> | |
285 | <table class="memname"> | |
286 | <tr> | |
287 | <td class="memname">size_t ucx_stack_avail </td> | |
288 | <td>(</td> | |
289 | <td class="paramtype"><a class="el" href="structUcxStack.html">UcxStack</a> * </td> | |
290 | <td class="paramname"><em>stack</em></td><td>)</td> | |
291 | <td></td> | |
292 | </tr> | |
293 | </table> | |
294 | </div><div class="memdoc"> | |
295 | ||
296 | <p>Returns the remaining available memory on the specified stack. </p> | |
297 | <dl class="params"><dt>Parameters</dt><dd> | |
298 | <table class="params"> | |
299 | <tr><td class="paramname">stack</td><td>a pointer to the stack </td></tr> | |
300 | </table> | |
301 | </dd> | |
302 | </dl> | |
303 | <dl class="section return"><dt>Returns</dt><dd>the remaining available memory </dd></dl> | |
304 | ||
305 | </div> | |
306 | </div> | |
307 | <a id="afdc467524b5e19a9a777c6bc03e17174"></a> | |
308 | <h2 class="memtitle"><span class="permalink"><a href="#afdc467524b5e19a9a777c6bc03e17174">◆ </a></span>ucx_stack_calloc()</h2> | |
309 | ||
310 | <div class="memitem"> | |
311 | <div class="memproto"> | |
312 | <table class="memname"> | |
313 | <tr> | |
314 | <td class="memname">void* ucx_stack_calloc </td> | |
315 | <td>(</td> | |
316 | <td class="paramtype"><a class="el" href="structUcxStack.html">UcxStack</a> * </td> | |
317 | <td class="paramname"><em>stack</em>, </td> | |
318 | </tr> | |
319 | <tr> | |
320 | <td class="paramkey"></td> | |
321 | <td></td> | |
322 | <td class="paramtype">size_t </td> | |
323 | <td class="paramname"><em>nelem</em>, </td> | |
324 | </tr> | |
325 | <tr> | |
326 | <td class="paramkey"></td> | |
327 | <td></td> | |
328 | <td class="paramtype">size_t </td> | |
329 | <td class="paramname"><em>elsize</em> </td> | |
330 | </tr> | |
331 | <tr> | |
332 | <td></td> | |
333 | <td>)</td> | |
334 | <td></td><td></td> | |
335 | </tr> | |
336 | </table> | |
337 | </div><div class="memdoc"> | |
338 | ||
339 | <p>Allocates an array of stack memory. </p> | |
340 | <p>The content of the allocated memory is set to zero.</p> | |
341 | <dl class="params"><dt>Parameters</dt><dd> | |
342 | <table class="params"> | |
343 | <tr><td class="paramname">stack</td><td>a pointer to the stack </td></tr> | |
344 | <tr><td class="paramname">nelem</td><td>amount of elements to allocate </td></tr> | |
345 | <tr><td class="paramname">elsize</td><td>amount of memory per element </td></tr> | |
346 | </table> | |
347 | </dd> | |
348 | </dl> | |
349 | <dl class="section return"><dt>Returns</dt><dd>a pointer to the allocated memory </dd></dl> | |
350 | <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> | |
351 | ||
352 | </div> | |
353 | </div> | |
354 | <a id="aabd55c14a3866b3782ba324f4d8b4c41"></a> | |
355 | <h2 class="memtitle"><span class="permalink"><a href="#aabd55c14a3866b3782ba324f4d8b4c41">◆ </a></span>ucx_stack_free()</h2> | |
356 | ||
357 | <div class="memitem"> | |
358 | <div class="memproto"> | |
359 | <table class="memname"> | |
360 | <tr> | |
361 | <td class="memname">void ucx_stack_free </td> | |
362 | <td>(</td> | |
363 | <td class="paramtype"><a class="el" href="structUcxStack.html">UcxStack</a> * </td> | |
364 | <td class="paramname"><em>stack</em>, </td> | |
365 | </tr> | |
366 | <tr> | |
367 | <td class="paramkey"></td> | |
368 | <td></td> | |
369 | <td class="paramtype">void * </td> | |
370 | <td class="paramname"><em>ptr</em> </td> | |
371 | </tr> | |
372 | <tr> | |
373 | <td></td> | |
374 | <td>)</td> | |
375 | <td></td><td></td> | |
376 | </tr> | |
377 | </table> | |
378 | </div><div class="memdoc"> | |
379 | ||
380 | <p>Frees memory on the stack. </p> | |
381 | <p>Freeing stack memory behaves in a special way.</p> | |
382 | <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> | |
383 | <dl class="params"><dt>Parameters</dt><dd> | |
384 | <table class="params"> | |
385 | <tr><td class="paramname">stack</td><td>a pointer to the stack </td></tr> | |
386 | <tr><td class="paramname">ptr</td><td>a pointer to the memory that shall be freed </td></tr> | |
387 | </table> | |
388 | </dd> | |
389 | </dl> | |
390 | ||
391 | </div> | |
392 | </div> | |
393 | <a id="abaef685df4e7ef95cd7218984a0618fe"></a> | |
394 | <h2 class="memtitle"><span class="permalink"><a href="#abaef685df4e7ef95cd7218984a0618fe">◆ </a></span>ucx_stack_init()</h2> | |
395 | ||
396 | <div class="memitem"> | |
397 | <div class="memproto"> | |
398 | <table class="memname"> | |
399 | <tr> | |
400 | <td class="memname">void ucx_stack_init </td> | |
401 | <td>(</td> | |
402 | <td class="paramtype"><a class="el" href="structUcxStack.html">UcxStack</a> * </td> | |
403 | <td class="paramname"><em>stack</em>, </td> | |
404 | </tr> | |
405 | <tr> | |
406 | <td class="paramkey"></td> | |
407 | <td></td> | |
408 | <td class="paramtype">char * </td> | |
409 | <td class="paramname"><em>space</em>, </td> | |
410 | </tr> | |
411 | <tr> | |
412 | <td class="paramkey"></td> | |
413 | <td></td> | |
414 | <td class="paramtype">size_t </td> | |
415 | <td class="paramname"><em>size</em> </td> | |
416 | </tr> | |
417 | <tr> | |
418 | <td></td> | |
419 | <td>)</td> | |
420 | <td></td><td></td> | |
421 | </tr> | |
422 | </table> | |
423 | </div><div class="memdoc"> | |
424 | ||
425 | <p>Initializes <a class="el" href="structUcxStack.html" title="UCX stack structure. ">UcxStack</a> structure with memory. </p> | |
426 | <dl class="params"><dt>Parameters</dt><dd> | |
427 | <table class="params"> | |
428 | <tr><td class="paramname">stack</td><td>a pointer to an uninitialized stack structure </td></tr> | |
429 | <tr><td class="paramname">space</td><td>the memory area that shall be managed </td></tr> | |
430 | <tr><td class="paramname">size</td><td>size of the memory area </td></tr> | |
431 | </table> | |
432 | </dd> | |
433 | </dl> | |
434 | <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> | |
435 | ||
436 | </div> | |
437 | </div> | |
438 | <a id="af865b416802140f6b6e8ab3626d7d1ac"></a> | |
439 | <h2 class="memtitle"><span class="permalink"><a href="#af865b416802140f6b6e8ab3626d7d1ac">◆ </a></span>ucx_stack_malloc()</h2> | |
440 | ||
441 | <div class="memitem"> | |
442 | <div class="memproto"> | |
443 | <table class="memname"> | |
444 | <tr> | |
445 | <td class="memname">void* ucx_stack_malloc </td> | |
446 | <td>(</td> | |
447 | <td class="paramtype"><a class="el" href="structUcxStack.html">UcxStack</a> * </td> | |
448 | <td class="paramname"><em>stack</em>, </td> | |
449 | </tr> | |
450 | <tr> | |
451 | <td class="paramkey"></td> | |
452 | <td></td> | |
453 | <td class="paramtype">size_t </td> | |
454 | <td class="paramname"><em>n</em> </td> | |
455 | </tr> | |
456 | <tr> | |
457 | <td></td> | |
458 | <td>)</td> | |
459 | <td></td><td></td> | |
460 | </tr> | |
461 | </table> | |
462 | </div><div class="memdoc"> | |
463 | ||
464 | <p>Allocates stack memory. </p> | |
465 | <dl class="params"><dt>Parameters</dt><dd> | |
466 | <table class="params"> | |
467 | <tr><td class="paramname">stack</td><td>a pointer to the stack </td></tr> | |
468 | <tr><td class="paramname">n</td><td>amount of memory to allocate </td></tr> | |
469 | </table> | |
470 | </dd> | |
471 | </dl> | |
472 | <dl class="section return"><dt>Returns</dt><dd>a pointer to the allocated memory or <code>NULL</code> on stack overflow </dd></dl> | |
473 | <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> | |
474 | ||
475 | </div> | |
476 | </div> | |
477 | <a id="a07ea48f28eab474dcfefbb86fa66ef81"></a> | |
478 | <h2 class="memtitle"><span class="permalink"><a href="#a07ea48f28eab474dcfefbb86fa66ef81">◆ </a></span>ucx_stack_popn()</h2> | |
479 | ||
480 | <div class="memitem"> | |
481 | <div class="memproto"> | |
482 | <table class="memname"> | |
483 | <tr> | |
484 | <td class="memname">void ucx_stack_popn </td> | |
485 | <td>(</td> | |
486 | <td class="paramtype"><a class="el" href="structUcxStack.html">UcxStack</a> * </td> | |
487 | <td class="paramname"><em>stack</em>, </td> | |
488 | </tr> | |
489 | <tr> | |
490 | <td class="paramkey"></td> | |
491 | <td></td> | |
492 | <td class="paramtype">void * </td> | |
493 | <td class="paramname"><em>dest</em>, </td> | |
494 | </tr> | |
495 | <tr> | |
496 | <td class="paramkey"></td> | |
497 | <td></td> | |
498 | <td class="paramtype">size_t </td> | |
499 | <td class="paramname"><em>n</em> </td> | |
500 | </tr> | |
501 | <tr> | |
502 | <td></td> | |
503 | <td>)</td> | |
504 | <td></td><td></td> | |
505 | </tr> | |
506 | </table> | |
507 | </div><div class="memdoc"> | |
508 | ||
509 | <p>Removes the top most element from the stack and copies the content to <code> dest</code>. </p> | |
510 | <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> | |
511 | <dl class="params"><dt>Parameters</dt><dd> | |
512 | <table class="params"> | |
513 | <tr><td class="paramname">stack</td><td>a pointer to the stack </td></tr> | |
514 | <tr><td class="paramname">dest</td><td>the location where the contents shall be written to </td></tr> | |
515 | <tr><td class="paramname">n</td><td>copies at most n bytes to <code>dest</code> </td></tr> | |
516 | </table> | |
517 | </dd> | |
518 | </dl> | |
519 | <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> | |
520 | ||
521 | </div> | |
522 | </div> | |
523 | <a id="af85e6f77a8341beb6188f9ae1a8e9f92"></a> | |
524 | <h2 class="memtitle"><span class="permalink"><a href="#af85e6f77a8341beb6188f9ae1a8e9f92">◆ </a></span>ucx_stack_push()</h2> | |
525 | ||
526 | <div class="memitem"> | |
527 | <div class="memproto"> | |
528 | <table class="memname"> | |
529 | <tr> | |
530 | <td class="memname">void* ucx_stack_push </td> | |
531 | <td>(</td> | |
532 | <td class="paramtype"><a class="el" href="structUcxStack.html">UcxStack</a> * </td> | |
533 | <td class="paramname"><em>stack</em>, </td> | |
534 | </tr> | |
535 | <tr> | |
536 | <td class="paramkey"></td> | |
537 | <td></td> | |
538 | <td class="paramtype">size_t </td> | |
539 | <td class="paramname"><em>n</em>, </td> | |
540 | </tr> | |
541 | <tr> | |
542 | <td class="paramkey"></td> | |
543 | <td></td> | |
544 | <td class="paramtype">const void * </td> | |
545 | <td class="paramname"><em>data</em> </td> | |
546 | </tr> | |
547 | <tr> | |
548 | <td></td> | |
549 | <td>)</td> | |
550 | <td></td><td></td> | |
551 | </tr> | |
552 | </table> | |
553 | </div><div class="memdoc"> | |
554 | ||
555 | <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> | |
556 | <dl class="params"><dt>Parameters</dt><dd> | |
557 | <table class="params"> | |
558 | <tr><td class="paramname">stack</td><td>a pointer to the stack </td></tr> | |
559 | <tr><td class="paramname">n</td><td>amount of memory to allocate </td></tr> | |
560 | <tr><td class="paramname">data</td><td>a pointer to the data to copy </td></tr> | |
561 | </table> | |
562 | </dd> | |
563 | </dl> | |
564 | <dl class="section return"><dt>Returns</dt><dd>a pointer to the allocated memory </dd></dl> | |
565 | <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> | |
566 | ||
567 | </div> | |
568 | </div> | |
569 | <a id="a7bb138979191bba138e76ea37488fae2"></a> | |
570 | <h2 class="memtitle"><span class="permalink"><a href="#a7bb138979191bba138e76ea37488fae2">◆ </a></span>ucx_stack_pusharr()</h2> | |
571 | ||
572 | <div class="memitem"> | |
573 | <div class="memproto"> | |
574 | <table class="memname"> | |
575 | <tr> | |
576 | <td class="memname">void* ucx_stack_pusharr </td> | |
577 | <td>(</td> | |
578 | <td class="paramtype"><a class="el" href="structUcxStack.html">UcxStack</a> * </td> | |
579 | <td class="paramname"><em>stack</em>, </td> | |
580 | </tr> | |
581 | <tr> | |
582 | <td class="paramkey"></td> | |
583 | <td></td> | |
584 | <td class="paramtype">size_t </td> | |
585 | <td class="paramname"><em>nelem</em>, </td> | |
586 | </tr> | |
587 | <tr> | |
588 | <td class="paramkey"></td> | |
589 | <td></td> | |
590 | <td class="paramtype">size_t </td> | |
591 | <td class="paramname"><em>elsize</em>, </td> | |
592 | </tr> | |
593 | <tr> | |
594 | <td class="paramkey"></td> | |
595 | <td></td> | |
596 | <td class="paramtype">const void * </td> | |
597 | <td class="paramname"><em>data</em> </td> | |
598 | </tr> | |
599 | <tr> | |
600 | <td></td> | |
601 | <td>)</td> | |
602 | <td></td><td></td> | |
603 | </tr> | |
604 | </table> | |
605 | </div><div class="memdoc"> | |
606 | ||
607 | <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> | |
608 | <dl class="params"><dt>Parameters</dt><dd> | |
609 | <table class="params"> | |
610 | <tr><td class="paramname">stack</td><td>a pointer to the stack </td></tr> | |
611 | <tr><td class="paramname">nelem</td><td>amount of elements to allocate </td></tr> | |
612 | <tr><td class="paramname">elsize</td><td>amount of memory per element </td></tr> | |
613 | <tr><td class="paramname">data</td><td>a pointer to the data </td></tr> | |
614 | </table> | |
615 | </dd> | |
616 | </dl> | |
617 | <dl class="section return"><dt>Returns</dt><dd>a pointer to the allocated memory </dd></dl> | |
618 | <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> | |
619 | ||
620 | </div> | |
621 | </div> | |
622 | <a id="a0c678f96f6fabab49b2b034a1fe91c3a"></a> | |
623 | <h2 class="memtitle"><span class="permalink"><a href="#a0c678f96f6fabab49b2b034a1fe91c3a">◆ </a></span>ucx_stack_realloc()</h2> | |
624 | ||
625 | <div class="memitem"> | |
626 | <div class="memproto"> | |
627 | <table class="memname"> | |
628 | <tr> | |
629 | <td class="memname">void* ucx_stack_realloc </td> | |
630 | <td>(</td> | |
631 | <td class="paramtype"><a class="el" href="structUcxStack.html">UcxStack</a> * </td> | |
632 | <td class="paramname"><em>stack</em>, </td> | |
633 | </tr> | |
634 | <tr> | |
635 | <td class="paramkey"></td> | |
636 | <td></td> | |
637 | <td class="paramtype">void * </td> | |
638 | <td class="paramname"><em>ptr</em>, </td> | |
639 | </tr> | |
640 | <tr> | |
641 | <td class="paramkey"></td> | |
642 | <td></td> | |
643 | <td class="paramtype">size_t </td> | |
644 | <td class="paramname"><em>n</em> </td> | |
645 | </tr> | |
646 | <tr> | |
647 | <td></td> | |
648 | <td>)</td> | |
649 | <td></td><td></td> | |
650 | </tr> | |
651 | </table> | |
652 | </div><div class="memdoc"> | |
653 | ||
654 | <p>Reallocates memory on the stack. </p> | |
655 | <p>Shrinking memory is always safe. Extending memory can be very expensive.</p> | |
656 | <dl class="params"><dt>Parameters</dt><dd> | |
657 | <table class="params"> | |
658 | <tr><td class="paramname">stack</td><td>the stack </td></tr> | |
659 | <tr><td class="paramname">ptr</td><td>a pointer to the memory that shall be reallocated </td></tr> | |
660 | <tr><td class="paramname">n</td><td>the new size of the memory </td></tr> | |
661 | </table> | |
662 | </dd> | |
663 | </dl> | |
664 | <dl class="section return"><dt>Returns</dt><dd>a pointer to the new location of the memory </dd></dl> | |
665 | <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> | |
666 | ||
667 | </div> | |
668 | </div> | |
669 | </div><!-- contents --> | |
670 | <!-- start footer part --> | |
671 | <hr class="footer"/><address class="footer"><small> | |
672 | Generated on Thu Dec 19 2019 19:58:24 for ucx by  <a href="http://www.doxygen.org/index.html"> | |
673 | <img class="footer" src="doxygen.png" alt="doxygen"/> | |
674 | </a> 1.8.13 | |
675 | </small></address> | |
676 | </body> | |
677 | </html> |