Skip to content

Commit

Permalink
Two further notations for unicode character literals
Browse files Browse the repository at this point in the history
  • Loading branch information
ganelson committed May 12, 2024
1 parent c69f65b commit 35fe42e
Show file tree
Hide file tree
Showing 28 changed files with 267 additions and 201 deletions.
10 changes: 9 additions & 1 deletion docs/BasicInformKit/S-chr.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ <h1><a href="../index.html">
<ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../extensions.html">Kits</a></li><li><a href="index.html">BasicInformKit</a></li><li><b>Char Template</b></li></ul></div>
<p class="purpose">To decide whether letters are upper or lower case, and convert between the two.</p>

<ul class="toc"><li><a href="S-chr.html#SP1">&#167;1. Char Is Of Case</a></li><li><a href="S-chr.html#SP2">&#167;2. Char To Case</a></li><li><a href="S-chr.html#SP3">&#167;3. DigitToValue</a></li><li><a href="S-chr.html#SP4">&#167;4. Testing</a></li></ul><hr class="tocbar">
<ul class="toc"><li><a href="S-chr.html#SP1">&#167;1. Char Is Of Case</a></li><li><a href="S-chr.html#SP2">&#167;2. Char To Case</a></li><li><a href="S-chr.html#SP3">&#167;3. DigitToValue</a></li><li><a href="S-chr.html#SP4">&#167;4. Testing</a></li><li><a href="S-chr.html#SP5">&#167;5. Unicode</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Char Is Of Case. </b>The following decides whether a character <span class="extract"><span class="extract-syntax">c</span></span> belongs to case <span class="extract"><span class="extract-syntax">case</span></span>, where
0 means lower case and 1 means upper. <span class="extract"><span class="extract-syntax">c</span></span> is interpreted according to the
Expand Down Expand Up @@ -170,6 +170,14 @@ <h1><a href="../index.html">
<span class="plain-syntax"> }</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. Unicode. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">UNICODE_CHARACTER_TY_Say</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"unicode U+"</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">PrintInBase</span><span class="plain-syntax">(</span><span class="identifier-syntax">c</span><span class="plain-syntax">, </span><span class="constant-syntax">16</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">);</span>
<span class="plain-syntax">];</span>
</pre>
<nav role="progress"><div class="progresscontainer">
<ul class="progressbar"><li class="progressprev"><a href="S-txt.html">&#10094;</a></li><li class="progresssection"><a href="S-dfn.html">dfn</a></li><li class="progresssection"><a href="S-str.html">str</a></li><li class="progresssection"><a href="S-utl.html">utl</a></li><li class="progresssection"><a href="S-prg.html">prg</a></li><li class="progresssection"><a href="S-mth.html">mth</a></li><li class="progresssection"><a href="S-srt.html">srt</a></li><li class="progresssection"><a href="S-tbl.html">tbl</a></li><li class="progresssection"><a href="S-mst.html">mst</a></li><li class="progresssection"><a href="S-rlb.html">rlb</a></li><li class="progresssection"><a href="S-act.html">act</a></li><li class="progresssection"><a href="S-prn.html">prn</a></li><li class="progresssection"><a href="S-flx.html">flx</a></li><li class="progresssection"><a href="S-blc.html">blc</a></li><li class="progresssection"><a href="S-knd.html">knd</a></li><li class="progresssection"><a href="S-txt.html">txt</a></li><li class="progresscurrent">chr</li><li class="progresssection"><a href="S-rgx.html">rgx</a></li><li class="progresssection"><a href="S-lst.html">lst</a></li><li class="progresssection"><a href="S-cmb.html">cmb</a></li><li class="progresssection"><a href="S-rlt.html">rlt</a></li><li class="progresssection"><a href="S-rlt2.html">rlt2</a></li><li class="progresssection"><a href="S-prp.html">prp</a></li><li class="progresssection"><a href="S-rtp.html">rtp</a></li><li class="progressnext"><a href="S-rgx.html">&#10095;</a></li></ul></div>
</nav><!--End of weave-->
Expand Down
27 changes: 23 additions & 4 deletions docs/values-module/3-ul.html
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,29 @@ <h1><a href="../index.html">

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">UnicodeLiterals::parse</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">UnicodeLiterals::parse</span></span>:<br/><a href="3-ul.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">N</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><a href="3-ul.html#SP4" class="function-link"><span class="function-syntax">UnicodeLiterals::ensure_data</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Dictionaries::find</span><span class="plain-syntax">(</span><span class="identifier-syntax">UnicodeData_lookup</span><span class="plain-syntax">, </span><span class="identifier-syntax">N</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">unicode_lookup_value</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ulv</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Dictionaries::read_value</span><span class="plain-syntax">(</span><span class="identifier-syntax">UnicodeData_lookup</span><span class="plain-syntax">, </span><span class="identifier-syntax">N</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">ulv</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">code_point</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Str::get_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">N</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">) == </span><span class="character-syntax">'U'</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Str::get_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">N</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">) == </span><span class="character-syntax">'+'</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">pos</span><span class="plain-syntax"> = </span><span class="constant-syntax">2</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::get_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">N</span><span class="plain-syntax">, </span><span class="identifier-syntax">pos</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pos</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">7</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">inchar32_t</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::get_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">N</span><span class="plain-syntax">, </span><span class="identifier-syntax">pos</span><span class="plain-syntax">), </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &gt;= </span><span class="character-syntax">'0'</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &lt;= </span><span class="character-syntax">'9'</span><span class="plain-syntax">)) </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c</span><span class="plain-syntax"> - </span><span class="character-syntax">'0'</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &gt;= </span><span class="character-syntax">'a'</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &lt;= </span><span class="character-syntax">'f'</span><span class="plain-syntax">)) </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c</span><span class="plain-syntax"> - </span><span class="character-syntax">'a'</span><span class="plain-syntax"> + </span><span class="constant-syntax">10</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &gt;= </span><span class="character-syntax">'A'</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &lt;= </span><span class="character-syntax">'F'</span><span class="plain-syntax">)) </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c</span><span class="plain-syntax"> - </span><span class="character-syntax">'A'</span><span class="plain-syntax"> + </span><span class="constant-syntax">10</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">d</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">16</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax"> = </span><span class="identifier-syntax">t</span><span class="plain-syntax">*16 + (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) </span><span class="identifier-syntax">d</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">pos</span><span class="plain-syntax">++;</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">N</span><span class="plain-syntax">) == </span><span class="constant-syntax">3</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Str::get_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">N</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">) == </span><span class="character-syntax">'"'</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Str::get_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">N</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">) == </span><span class="character-syntax">'"'</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) </span><span class="identifier-syntax">Str::get_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">N</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax"> </span><a href="3-ul.html#SP4" class="function-link"><span class="function-syntax">UnicodeLiterals::ensure_data</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Dictionaries::find</span><span class="plain-syntax">(</span><span class="identifier-syntax">UnicodeData_lookup</span><span class="plain-syntax">, </span><span class="identifier-syntax">N</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">unicode_lookup_value</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ulv</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Dictionaries::read_value</span><span class="plain-syntax">(</span><span class="identifier-syntax">UnicodeData_lookup</span><span class="plain-syntax">, </span><span class="identifier-syntax">N</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">ulv</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">code_point</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1;</span>
<span class="plain-syntax">}</span>
Expand Down
18 changes: 9 additions & 9 deletions inblorb/Tests/Test Cases/_Blurb_Ideal/Audiovisual.blurb
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ placeholder [BLURB] = "A work of interactive fiction."

! Other material to release

status alternative ||Using 'Release along with cover art', to provide something more distinctive than the default artwork above&nbsp;<a href=inform:/wi_26_8.html><img border=0 src=inform:/doc_images/help.png></a>||
status alternative ||Using 'Release along with a website'&nbsp;<a href=inform:/wi_26_10.html><img border=0 src=inform:/doc_images/help.png></a>||
status alternative ||Using 'Release along with an interpreter', for in-browser play on your website&nbsp;<a href=inform:/wi_26_11.html><img border=0 src=inform:/doc_images/help.png></a>||
status alternative ||Using 'Release along with a file of "Such-and-Such" called "whatever.pdf"', perhaps to add a manual, or a welcoming note&nbsp;<a href=inform:/wi_26_6.html><img border=0 src=inform:/doc_images/help.png></a>||
status alternative ||Using 'Release along with the source text'&nbsp;<a href=inform:/wi_26_17.html><img border=0 src=inform:/doc_images/help.png></a>||
status alternative ||Using 'Release along with a solution'&nbsp;<a href=inform:/wi_26_16.html><img border=0 src=inform:/doc_images/help.png></a>||
status alternative ||Using 'Release along with the library card'&nbsp;<a href=inform:/wi_26_17.html><img border=0 src=inform:/doc_images/help.png></a>||
status alternative ||Using 'Release along with the introductory booklet'&nbsp;<a href=inform:/wi_26_9.html><img border=0 src=inform:/doc_images/help.png></a>||
status alternative ||Using 'Release along with the introductory postcard'&nbsp;<a href=inform:/wi_26_9.html><img border=0 src=inform:/doc_images/help.png></a>||
status alternative ||Using 'Release along with cover art', to provide something more distinctive than the default artwork above&nbsp;<a href=inform:/wi_27_8.html><img border=0 src=inform:/doc_images/help.png></a>||
status alternative ||Using 'Release along with a website'&nbsp;<a href=inform:/wi_27_10.html><img border=0 src=inform:/doc_images/help.png></a>||
status alternative ||Using 'Release along with an interpreter', for in-browser play on your website&nbsp;<a href=inform:/wi_27_11.html><img border=0 src=inform:/doc_images/help.png></a>||
status alternative ||Using 'Release along with a file of "Such-and-Such" called "whatever.pdf"', perhaps to add a manual, or a welcoming note&nbsp;<a href=inform:/wi_27_6.html><img border=0 src=inform:/doc_images/help.png></a>||
status alternative ||Using 'Release along with the source text'&nbsp;<a href=inform:/wi_27_17.html><img border=0 src=inform:/doc_images/help.png></a>||
status alternative ||Using 'Release along with a solution'&nbsp;<a href=inform:/wi_27_16.html><img border=0 src=inform:/doc_images/help.png></a>||
status alternative ||Using 'Release along with the library card'&nbsp;<a href=inform:/wi_27_17.html><img border=0 src=inform:/doc_images/help.png></a>||
status alternative ||Using 'Release along with the introductory booklet'&nbsp;<a href=inform:/wi_27_9.html><img border=0 src=inform:/doc_images/help.png></a>||
status alternative ||Using 'Release along with the introductory postcard'&nbsp;<a href=inform:/wi_27_9.html><img border=0 src=inform:/doc_images/help.png></a>||
Loading

0 comments on commit 35fe42e

Please sign in to comment.