Updating documentation
This commit is contained in:
1 parent
4c16cae56d
commit
e37cf42c12
37 files changed
+2291
-21
No files matched your search
+87
-1
@@ -83,7 +83,7 @@
|
||||
|
||||
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
|
||||
<div id="sidebar-scrollbox" class="sidebar-scrollbox">
|
||||
<ol class="chapter"><li class="expanded "><a href="Introduction/introduction.html"><strong aria-hidden="true">1.</strong> Introduction</a></li><li><ol class="section"><li class="expanded "><a href="Introduction/why_this_library.html"><strong aria-hidden="true">1.1.</strong> Why this library</a></li><li class="expanded "><a href="Introduction/how_to_install.html"><strong aria-hidden="true">1.2.</strong> How to install</a></li><li class="expanded "><a href="Introduction/library_structure.html"><strong aria-hidden="true">1.3.</strong> Library structure</a></li><li class="expanded "><a href="Introduction/understanding_the_library.html"><strong aria-hidden="true">1.4.</strong> Understanding the library</a></li><li class="expanded "><a href="Introduction/how_to_use_the_library.html"><strong aria-hidden="true">1.5.</strong> How to use the library</a></li></ol></li><li class="expanded "><a href="Features/features.html"><strong aria-hidden="true">2.</strong> Features</a></li><li><ol class="section"><li class="expanded "><a href="Features/two_way_iterators.html"><strong aria-hidden="true">2.1.</strong> Two way iterators</a></li><li class="expanded "><a href="Features/custom_allocation.html"><strong aria-hidden="true">2.2.</strong> Custom allocation</a></li><li class="expanded "><a href="Features/callbacks.html"><strong aria-hidden="true">2.3.</strong> Callbacks</a></li><li class="expanded "><a href="Features/functions_table.html"><strong aria-hidden="true">2.4.</strong> Functions Table</a></li></ol></li><li class="expanded "><a href="Overview/overview.html"><strong aria-hidden="true">3.</strong> Collections Overview</a></li><li class="expanded "><a href="Examples/examples.html"><strong aria-hidden="true">4.</strong> Examples</a></li></ol>
|
||||
<ol class="chapter"><li class="expanded "><a href="Introduction/introduction.html"><strong aria-hidden="true">1.</strong> Introduction</a></li><li><ol class="section"><li class="expanded "><a href="Introduction/why_this_library.html"><strong aria-hidden="true">1.1.</strong> Why this library</a></li><li class="expanded "><a href="Introduction/how_to_install.html"><strong aria-hidden="true">1.2.</strong> How to install</a></li><li class="expanded "><a href="Introduction/library_structure.html"><strong aria-hidden="true">1.3.</strong> Library structure</a></li><li class="expanded "><a href="Introduction/understanding_the_library.html"><strong aria-hidden="true">1.4.</strong> Understanding the library</a></li><li class="expanded "><a href="Introduction/how_to_use_the_library.html"><strong aria-hidden="true">1.5.</strong> How to use the library</a></li></ol></li><li class="expanded "><a href="Features/features.html"><strong aria-hidden="true">2.</strong> Features</a></li><li><ol class="section"><li class="expanded "><a href="Features/two_way_iterators.html"><strong aria-hidden="true">2.1.</strong> Two way iterators</a></li><li class="expanded "><a href="Features/custom_allocation.html"><strong aria-hidden="true">2.2.</strong> Custom allocation</a></li><li class="expanded "><a href="Features/callbacks.html"><strong aria-hidden="true">2.3.</strong> Callbacks</a></li><li class="expanded "><a href="Features/functions_table.html"><strong aria-hidden="true">2.4.</strong> Functions Table</a></li></ol></li><li class="expanded "><a href="Overview/overview.html"><strong aria-hidden="true">3.</strong> Collections Overview</a></li><li class="expanded "><a href="utl/utl.html"><strong aria-hidden="true">4.</strong> utl</a></li><li><ol class="section"><li class="expanded "><a href="utl/assert.h/index.html"><strong aria-hidden="true">4.1.</strong> assert.h</a></li><li><ol class="section"><li class="expanded "><a href="utl/assert.h/overview.html"><strong aria-hidden="true">4.1.1.</strong> Overview</a></li><li class="expanded "><a href="utl/assert.h/single_value_assertion.html"><strong aria-hidden="true">4.1.2.</strong> Single Value Assertion</a></li><li class="expanded "><a href="utl/assert.h/array_assertion.html"><strong aria-hidden="true">4.1.3.</strong> Array Assertion</a></li></ol></li><li class="expanded "><a href="utl/foreach.html"><strong aria-hidden="true">4.2.</strong> foreach.h</a></li><li class="expanded "><a href="utl/log.html"><strong aria-hidden="true">4.3.</strong> log.h</a></li><li class="expanded "><a href="utl/test.html"><strong aria-hidden="true">4.4.</strong> test.h</a></li><li class="expanded "><a href="utl/timer.html"><strong aria-hidden="true">4.5.</strong> timer.h</a></li></ol></li><li class="expanded "><a href="Examples/examples.html"><strong aria-hidden="true">5.</strong> Examples</a></li></ol>
|
||||
</div>
|
||||
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
|
||||
</nav>
|
||||
@@ -336,6 +336,92 @@ struct SNAME##_iter *PFX##_iter_new(struct SNAME *target);
|
||||
<tr><td align="center">TreeMap <br> <em>treemap.h</em></td><td align="center">Sorted Map</td><td align="center">AVL Tree</td><td align="center">A unique set of keys associated with a value <code>K -> V</code> using an AVL tree with <code>log(n)</code> look up and sorted iteration</td></tr>
|
||||
<tr><td align="center">TreeSet <br> <em>treeset.h</em></td><td align="center">Sorted Set</td><td align="center">AVL Tree</td><td align="center">A unique set of keys using an AVL tree with <code>log(n)</code> look up and sorted iteration</td></tr>
|
||||
</tbody></table>
|
||||
<h1><a class="header" href="#utl-1" id="utl-1">UTL</a></h1>
|
||||
<p>Inside the <code>./utl/</code> folder there are many utility functions and macros that can be extensively used with the C Macro Collections library. Most of these utilities can be used without the main library.</p>
|
||||
<h1><a class="header" href="#asserth" id="asserth">assert.h</a></h1>
|
||||
<p>Definition of many typed non-abortive assertions. Every assertion that fails will print a message to <code>stderr</code> but will not abort the program execution. The macro parameters are first assigned to a temporary variable of the specified <code>dtype</code> in order to generate warnings from the compiler in case of type mismatch.</p>
|
||||
<p>The advantage of these typed macros is that when an assertion fails, it is possible to print to <code>stderr</code> the actual value that was passed to the function and check the expected result(s) all in one message.</p>
|
||||
<p>There are assertions that work with a single value to be tested and others that work with arrays. Single value assertions work with a selected list of <code>dtype</code>, while the assertion with arrays work with any <code>dtype</code> that is a valid data type.</p>
|
||||
<p>The macro parameters can be an lvalue or an rvalue.</p>
|
||||
<h1><a class="header" href="#overview" id="overview">Overview</a></h1>
|
||||
<h2><a class="header" href="#single-value-assertion-macros" id="single-value-assertion-macros">Single Value Assertion Macros</a></h2>
|
||||
<ul>
|
||||
<li>cmc_assert</li>
|
||||
<li>cmc_assert_equals</li>
|
||||
<li>cmc_assert_not_equals</li>
|
||||
<li>cmc_assert_greater</li>
|
||||
<li>cmc_assert_greater_equals</li>
|
||||
<li>cmc_assert_lesser</li>
|
||||
<li>cmc_assert_lesser_equals</li>
|
||||
<li>cmc_assert_in_range</li>
|
||||
<li>cmc_assert_not_in_range</li>
|
||||
</ul>
|
||||
<h2><a class="header" href="#array-assertion-macros" id="array-assertion-macros">Array Assertion Macros</a></h2>
|
||||
<ul>
|
||||
<li>cmc_assert_array_equals_any</li>
|
||||
<li>cmc_assert_array_within_any</li>
|
||||
<li>cmc_assert_array_outside_any</li>
|
||||
<li>cmc_assert_array_sorted_any</li>
|
||||
</ul>
|
||||
<h2><a class="header" href="#dtype" id="dtype">dtype</a></h2>
|
||||
<p>These are the data types supported by the single value assertion macros:</p>
|
||||
<ul>
|
||||
<li>int8_t</li>
|
||||
<li>int16_t</li>
|
||||
<li>int32_t</li>
|
||||
<li>int64_t</li>
|
||||
<li>uint8_t</li>
|
||||
<li>uint16_t</li>
|
||||
<li>uint32_t</li>
|
||||
<li>uint64_t</li>
|
||||
<li>intmax_t</li>
|
||||
<li>uintmax_t</li>
|
||||
<li>size_t</li>
|
||||
<li>float</li>
|
||||
<li>double</li>
|
||||
</ul>
|
||||
<p>The following two are only accepted by <code>cmc_assert_equals</code> and <code>cmc_assert_not_equals</code>:</p>
|
||||
<ul>
|
||||
<li>ptr</li>
|
||||
<li>bool</li>
|
||||
</ul>
|
||||
<p>Note that <code>ptr</code> is used for any pointers. They are first casted to <code>void *</code> and then their address is compared.</p>
|
||||
<h1><a class="header" href="#single-value-assertion-macros-1" id="single-value-assertion-macros-1">Single Value Assertion Macros</a></h1>
|
||||
<h2><a class="header" href="#cmc_assert_state" id="cmc_assert_state">cmc_assert_state</a></h2>
|
||||
<p>This is a global variable that can be used to test if all assertions passed. If a single assertion fails, this variable will be set to <code>false</code>. If an assertion passes this variable will not be set back to <code>true</code>.</p>
|
||||
<pre><code class="language-c">static bool cmc_assert_state = true;
|
||||
</code></pre>
|
||||
<p>This variable is used in <a href="utl/assert.h/./test.html">test.h</a> utility to automatically pass or fail a unit test. Once the unit test finishes, this variable is set back to <code>true</code> so that another unit test may follow.</p>
|
||||
<h2><a class="header" href="#cmc_assert" id="cmc_assert">cmc_assert</a></h2>
|
||||
<p>Asserts that an expression evaluates to <code>true</code>.</p>
|
||||
<pre><code class="language-c">#define cmc_assert(expression)
|
||||
</code></pre>
|
||||
<h3><a class="header" href="#parameters" id="parameters">Parameters</a></h3>
|
||||
<ul>
|
||||
<li><code>expression</code> - An expression that needs to be evaluated to true.</li>
|
||||
</ul>
|
||||
<h2><a class="header" href="#cmc_assert_equals" id="cmc_assert_equals">cmc_assert_equals</a></h2>
|
||||
<p>Asserts that a</p>
|
||||
<h1><a class="header" href="#array-assertion" id="array-assertion">Array Assertion</a></h1>
|
||||
<h1><a class="header" href="#foreachmd" id="foreachmd">foreach.md</a></h1>
|
||||
<p>For-Each macros. Since doing a for loop with iterators can be a lot to write, these macros solve that problem. There are two of them:</p>
|
||||
<ul>
|
||||
<li><code>CMC_FOREACH</code> - Goes from the beginning of a Collection to the end</li>
|
||||
<li><code>CMC_FOREAC_REV</code> - Goes from the end of a Collection to the beginning</li>
|
||||
</ul>
|
||||
<h2><a class="header" href="#parameters-1" id="parameters-1">Parameters</a></h2>
|
||||
<ul>
|
||||
<li><code>PFX</code> - Functions prefix</li>
|
||||
<li><code>SNAME</code> - Struct name</li>
|
||||
<li><code>ITERNAME</code> - Iterator variable name</li>
|
||||
<li><code>TARGET</code> - Target variable</li>
|
||||
</ul>
|
||||
<h1><a class="header" href="#logh" id="logh">log.h</a></h1>
|
||||
<p>Logging utility.</p>
|
||||
<h1><a class="header" href="#testh" id="testh">test.h</a></h1>
|
||||
<p>Simple unit test utility.</p>
|
||||
<h1><a class="header" href="#timerh" id="timerh">timer.h</a></h1>
|
||||
<p>Simple code execution utility.</p>
|
||||
<h1><a class="header" href="#minimal-example" id="minimal-example">Minimal Example</a></h1>
|
||||
<p>(TODO this example is currently outdated)</p>
|
||||
<p>Lets create a list of type <code>int</code>, add some elements to it and get the sum of all the elements printed on the screen.</p>
|
||||
|
||||
Reference in new issue
Block a user