Skip to content

Commit

Permalink
Update manuals
Browse files Browse the repository at this point in the history
  • Loading branch information
Blake-Madden committed Mar 24, 2024
1 parent fe20045 commit dabbff4
Show file tree
Hide file tree
Showing 15 changed files with 333 additions and 60 deletions.
Binary file modified docs/TinyExpr++ReferenceManual.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/building.html
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ <h1 class="title"><span class="chapter-number">6</span>&nbsp; <span class="chapt
<pre><code>doxygen docs/Doxyfile</code></pre>
<section id="requirements" class="level2 unnumbered">
<h2 class="unnumbered anchored" data-anchor-id="requirements">Requirements</h2>
<p><em>TinyExpr++</em> must be compiled as C++17.</p>
<p><em>TinyExpr++</em> must be compiled as C++17. (Some additional features require C++20.)</p>
<p>MSVC, GCC, and Clang compilers are supported.</p>


Expand Down
4 changes: 2 additions & 2 deletions docs/comments.html
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,11 @@ <h1 class="title"><span class="chapter-number">5</span>&nbsp; <span class="chapt
<dl class="code-annotation-container-grid">
<dt data-target-cell="annotated-cell-1" data-target-annotation="1">1</dt>
<dd>
<span data-code-cell="annotated-cell-1" data-code-lines="4" data-code-annotation="1">Comment that can span multiple lines.</span>
<span data-code-annotation="1" data-code-lines="4" data-code-cell="annotated-cell-1">Comment that can span multiple lines.</span>
</dd>
<dt data-target-cell="annotated-cell-1" data-target-annotation="2">2</dt>
<dd>
<span data-code-cell="annotated-cell-1" data-code-lines="9" data-code-annotation="2">Single line comment.</span>
<span data-code-annotation="2" data-code-lines="9" data-code-cell="annotated-cell-1">Single line comment.</span>
</dd>
</dl>

Expand Down
46 changes: 45 additions & 1 deletion docs/compile-time-options.html
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,12 @@ <h2 id="toc-title">Table of contents</h2>

<ul class="collapse">
<li><a href="#te-float" id="toc-te-float" class="nav-link active" data-scroll-target="#te-float"><code>TE_FLOAT</code></a></li>
<li><a href="#te_long_double" id="toc-te_long_double" class="nav-link" data-scroll-target="#te_long_double"><code>TE_LONG_DOUBLE</code></a></li>
<li><a href="#te-bitwise-ops" id="toc-te-bitwise-ops" class="nav-link" data-scroll-target="#te-bitwise-ops"><code>TE_BITWISE_OPERATORS</code></a></li>
<li><a href="#te_brackets_as_parens" id="toc-te_brackets_as_parens" class="nav-link" data-scroll-target="#te_brackets_as_parens"><code>TE_BRACKETS_AS_PARENS</code></a></li>
<li><a href="#te_no_bookkeeping" id="toc-te_no_bookkeeping" class="nav-link" data-scroll-target="#te_no_bookkeeping"><code>TE_NO_BOOKKEEPING</code></a></li>
<li><a href="#te_pow_from_right" id="toc-te_pow_from_right" class="nav-link" data-scroll-target="#te_pow_from_right"><code>TE_POW_FROM_RIGHT</code></a></li>
<li><a href="#c20-features" id="toc-c20-features" class="nav-link" data-scroll-target="#c20-features">C++20 Features</a></li>
</ul>
</nav>
</div>
Expand Down Expand Up @@ -285,6 +290,27 @@ <h1 class="title"><span class="chapter-number">12</span>&nbsp; <span class="chap
<h2 class="unnumbered anchored" data-anchor-id="te-float"><code>TE_FLOAT</code></h2>
<p><code>double</code> is the default data type used for the parser’s variable types, parameters, and return types. Compile with <code>TE_FLOAT</code> defined to use <code>float</code> instead.</p>
<p>Refer to <a href="embedded-programming.html#fp-numbers">floating-point numbers</a> for more information.</p>
<div class="warningsection">
<p>This flag will also disable all bitwise functions and operators.</p>
</div>
</section>
<section id="te_long_double" class="level2 unnumbered">
<h2 class="unnumbered anchored" data-anchor-id="te_long_double"><code>TE_LONG_DOUBLE</code></h2>
<p>Compile with <code>TE_LONG_DOUBLE</code> defined to use <code>long double</code> as the default data type.</p>
<p>Depending on the compiler, this may provide support for handling <code>uint64_t</code> values. Call <code>te_parser::supports_64bit()</code> (or <code>SUPPORTS64BIT()</code> in an expression at runtime) to confirm this.</p>
</section>
<section id="te-bitwise-ops" class="level2 unnumbered">
<h2 class="unnumbered anchored" data-anchor-id="te-bitwise-ops"><code>TE_BITWISE_OPERATORS</code></h2>
<p>By default, the operators <code>&amp;</code>, <code>|</code>, and <code>^</code> represent logical AND, logical OR, and exponentiation. If <code>TE_BITWISE_OPERATORS</code> is defined, then they will represent bitwise AND, OR, and XOR.</p>
</section>
<section id="te_brackets_as_parens" class="level2 unnumbered">
<h2 class="unnumbered anchored" data-anchor-id="te_brackets_as_parens"><code>TE_BRACKETS_AS_PARENS</code></h2>
<p>Define this flag to treat <code>[]</code> pairs the same as <code>()</code>. This can be useful if using the parser for a debugger’s watch window. For example, an expression such as <code>[rsp+1000]</code> would be evaluated as <code>1000</code> being added with the variable <code>rsp</code>. In this context, <code>rsp</code> could represent a memory address in the debugger.</p>
</section>
<section id="te_no_bookkeeping" class="level2 unnumbered">
<h2 class="unnumbered anchored" data-anchor-id="te_no_bookkeeping"><code>TE_NO_BOOKKEEPING</code></h2>
<p>By default, the parser will keep track of all functions and variables used in the last expression it evaluated. From this, the presence of a function or variable in the expression can be verified via <code>is_function_used()</code> and <code>is_variable_used()</code>.</p>
<p>Turning this option off can provide a small optimization, as it will result in less heap allocations and search operations. Defining <code>TE_NO_BOOKKEEPING</code> will disable this feature.</p>
</section>
<section id="te_pow_from_right" class="level2 unnumbered">
<h2 class="unnumbered anchored" data-anchor-id="te_pow_from_right"><code>TE_POW_FROM_RIGHT</code></h2>
Expand All @@ -294,7 +320,25 @@ <h2 class="unnumbered anchored" data-anchor-id="te_pow_from_right"><code>TE_POW_
<p>If you would rather have exponentiation work from right to left, you need to define <code>TE_POW_FROM_RIGHT</code> when compiling. With <code>TE_POW_FROM_RIGHT</code> defined, the behavior is:</p>
<p><code>a^b^c == a^(b^c)</code> and <code>-a^b == -(a^b)</code></p>
<p>That will match how many scripting languages do it (e.g., Python, Ruby).</p>
<p>Note that symbols can be defined by passing them to your compiler’s command line (or in a Cmake configuration) as such: <code>-DTE_POW_FROM_RIGHT</code></p>
<p>Note that symbols can be defined by passing them to your compiler’s command line (or in a CMake configuration) as such: <code>-DTE_POW_FROM_RIGHT</code></p>
</section>
<section id="c20-features" class="level2 unnumbered">
<h2 class="unnumbered anchored" data-anchor-id="c20-features">C++20 Features</h2>
<p>If compiling as C++20 (and <code>TE_FLOAT</code> is not defined), then the following functions and operators will be available:</p>
<ul>
<li><code>BITLROTATE8</code></li>
<li><code>BITLROTATE16</code></li>
<li><code>BITLROTATE32</code></li>
<li><code>BITLROTATE64</code></li>
<li><code>BITLROTATE</code></li>
<li><code>BITRROTATE8</code></li>
<li><code>BITRROTATE16</code></li>
<li><code>BITRROTATE32</code></li>
<li><code>BITRROTATE64</code></li>
<li><code>BITRROTATE</code></li>
<li><code>&lt;&lt;&lt;</code> (unsigned 64-bit left rotation)</li>
<li><code>&gt;&gt;&gt;</code> (unsigned 64-bit right rotation)</li>
</ul>


<div id="refs" class="references csl-bib-body hanging-indent" data-line-spacing="2" role="list" style="display: none">
Expand Down
14 changes: 13 additions & 1 deletion docs/constants.html
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ <h1 class="title"><span class="chapter-number">4</span>&nbsp; <span class="chapt
<div class="minipage">
<table class="table">
<caption>Number Formats</caption>
<colgroup>
<col style="width: 51%">
<col style="width: 48%">
</colgroup>
<thead>
<tr class="header">
<th style="text-align: left;">Format</th>
Expand All @@ -336,8 +340,16 @@ <h1 class="title"><span class="chapter-number">4</span>&nbsp; <span class="chapt
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">Decimal</td>
<td style="text-align: left;"><code>5754615</code> or <code>3.14</code></td>
</tr>
<tr class="even">
<td style="text-align: left;">Hexadecimal</td>
<td style="text-align: left;"><code>0x57CEF7</code>, which yields <code>5754615</code></td>
</tr>
<tr class="odd">
<td style="text-align: left;">Scientific notation</td>
<td style="text-align: left;"><code>1e3</code> for <code>1000</code></td>
<td style="text-align: left;"><code>1e3</code>, which yields <code>1000</code></td>
</tr>
</tbody>
</table>
Expand Down
5 changes: 3 additions & 2 deletions docs/embedded-programming.html
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ <h1 class="title"><span class="chapter-number">13</span>&nbsp; <span class="chap
<p>The following section discusses topics related to using <em>TinyExpr++</em> in an embedded environment.</p>
<section id="performance" class="level2 unnumbered">
<h2 class="unnumbered anchored" data-anchor-id="performance">Performance</h2>
<p><em>TinyExpr++</em> is fairly fast compared to compiled C when the expression is short, when the expression does hard calculations (e.g., exponentiation), and when some of the work can be simplified by <code>evaluate()</code>. <em>TinyExpr++</em> is slower compared to C when the expression is long and involves only basic arithmetic.</p>
<p><em>TinyExpr++</em> is fairly fast compared to compiled C when the expression is short or does hard calculations (e.g., exponentiation). <em>TinyExpr++</em> is slower compared to C when the expression is long and involves only basic arithmetic.</p>
<p>Here are some example benchmarks:</p>
<table class="table">
<thead>
Expand Down Expand Up @@ -353,7 +353,8 @@ <h2 class="unnumbered anchored" data-anchor-id="performance">Performance</h2>
</tr>
</tbody>
</table>
<p>Note that <em>TinyExpr++</em> is slower compared to <em>TinyExpr</em> because of additional type safety checks (e.g., the use of <code>std::variant</code> instead of unions).</p>
<p>Note that <em>TinyExpr++</em> is slower compared to <em>TinyExpr</em> because of additional type safety checks (e.g., the use of <code>std::variant</code> instead of unions), case insensitivity, and bookkeeping operations.</p>
<p>Refer to <a href="#compile-time-options">compile-time options</a> for flags that can provide optimization.</p>
</section>
<section id="volatility" class="level2 unnumbered">
<h2 class="unnumbered anchored" data-anchor-id="volatility">Volatility</h2>
Expand Down
8 changes: 4 additions & 4 deletions docs/end-user-usage.html
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,11 @@ <h1 class="title"><span class="chapter-number">1</span>&nbsp; <span class="chapt
<dl class="code-annotation-container-grid">
<dt data-target-cell="annotated-cell-4" data-target-annotation="1">1</dt>
<dd>
<span data-code-annotation="1" data-code-cell="annotated-cell-4" data-code-lines="2">First logical check failed, so now check another scenario and return false if it meets our criteria.</span>
<span data-code-cell="annotated-cell-4" data-code-lines="2" data-code-annotation="1">First logical check failed, so now check another scenario and return false if it meets our criteria.</span>
</dd>
<dt data-target-cell="annotated-cell-4" data-target-annotation="2">2</dt>
<dd>
<span data-code-annotation="2" data-code-cell="annotated-cell-4" data-code-lines="3">Neither scenario passed; return NaN because the values are in an unaccounted for scenario.</span>
<span data-code-cell="annotated-cell-4" data-code-lines="3" data-code-annotation="2">Neither scenario passed; return NaN because the values are in an unaccounted for scenario.</span>
</dd>
</dl>
<p>The same can be accomplished using the <code>IFS()</code> function:</p>
Expand All @@ -337,11 +337,11 @@ <h1 class="title"><span class="chapter-number">1</span>&nbsp; <span class="chapt
<dl class="code-annotation-container-grid">
<dt data-target-cell="annotated-cell-5" data-target-annotation="1">1</dt>
<dd>
<span data-code-annotation="1" data-code-cell="annotated-cell-5" data-code-lines="2">First logical check failed, so now check another scenario and return false if it meets our criteria.</span>
<span data-code-cell="annotated-cell-5" data-code-lines="2" data-code-annotation="1">First logical check failed, so now check another scenario and return false if it meets our criteria.</span>
</dd>
<dt data-target-cell="annotated-cell-5" data-target-annotation="2">2</dt>
<dd>
<span data-code-annotation="2" data-code-cell="annotated-cell-5" data-code-lines="3">Neither scenario passed; return NaN because the values are in an unaccounted for scenario.</span>
<span data-code-cell="annotated-cell-5" data-code-lines="3" data-code-annotation="2">Neither scenario passed; return NaN because the values are in an unaccounted for scenario.</span>
</dd>
</dl>
<div class="notesection">
Expand Down
Loading

0 comments on commit dabbff4

Please sign in to comment.