force use of pandoc version >= 3.1.12.2

The `bin/pandoc-wrapper.sh` tool will verify that the ssytem
has a recent enough version of `pandoc(1)`.

We explain why we insist on `pandoc(1)`. version >= 3.1.12.2
in comments where the $PANDOC_MIN_VERSION is set.

Added `--wrap=preserve` as a default argument to `pandoc(1)`.
While this change will impact every HTML file generated,
we believe this will improve the ability of someone to look
at the generated HTML and correlate with the original markdown.

Changed `bin/pandoc-wrapper.sh` VERSION from "1.4.2 2024-03-17"
to "1.4.3 2024-03-18".

Performed `make www` to achieve all of the above and to generate
HTML using the new  `--wrap=preserve` `pandoc(1)` mode.
This commit is contained in:
Landon Curt Noll committed 2024-03-18 01:26:39 -07:00
1 parent 9eb7a54e9f
commit b0b212acb1
402 files changed
+37061 -55132

No files matched your search

+97 -134
View File
@@ -130,8 +130,8 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Anton_Algmyr">Anton Älgmyr</a><br>
Location: <a href="../../location.html#SE">SE</a> - <em>Kingdom of
Sweden</em> (<em>Sweden</em>) <br><br></li>
Location: <a href="../../location.html#SE">SE</a> - <em>Kingdom of Sweden</em> (<em>Sweden</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -141,15 +141,13 @@ Sweden</em> (<em>Sweden</em>) <br><br></li>
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<p>To use this entry requires, in some invocations, a sound processing
program. This can be ALSA or SoX but we recommend the latter. See <a
href="../../faq.html#sox">FAQ 3.10 - How do I compile and use an IOCCC
entry that requires sound?</a>.</p>
<p>To use this entry requires, in some invocations, a sound processing program.
This can be ALSA or SoX but we recommend the latter. See <a href="../../faq.html#sox">FAQ 3.10 - How do I
compile and use an IOCCC entry that requires sound?</a>.</p>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a
href="../../bugs.html#2018_algmyr">2018 algmyr bugs</a>.</p>
<p>For more detailed information see <a href="../../bugs.html#2018_algmyr">2018 algmyr bugs</a>.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">&lt;</span> prog.c <span class="co"># Print garbage: might mess up your terminal</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">&lt;</span>file1<span class="op">&gt;</span> <span class="op">&lt;</span>file2<span class="op">&gt;</span> <span class="op">&gt;</span> out.raw</span>
@@ -157,169 +155,134 @@ href="../../bugs.html#2018_algmyr">2018 algmyr bugs</a>.</p>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Be warned, this is not your garden variety text-to-speech program!
Earplugs are advised, or at least a handy and well-tested volume
knob.</p>
<p>Be warned, this is not your garden variety text-to-speech program! Earplugs are advised,
or at least a handy and well-tested volume knob.</p>
<p>Pixels are numbered, amplitudes are weighed, frequencies are divided,
and the message can be displayed in fiery letters, but don’t be
alarmed.</p>
<p>How does decoding of the waveform work? Can you encode an arbitrary
text in a sound sample?</p>
and the message can be displayed in fiery letters, but don’t be alarmed.</p>
<p>How does decoding of the waveform work? Can you encode an arbitrary text in a
sound sample?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="what-is-this">What is this?</h3>
<p>To put it brief, this entry is akin to a sound based cat. It takes
characters as input and outputs them into frequency space as audio. The
entry also supports decoding the produced waveforms using the
<code>-d</code> flag. Usage instructions is output if run with the
<code>-h</code> flag, albeit not in an immediately legible format.</p>
<p>To put it brief, this entry is akin to a sound based cat. It takes characters as
input and outputs them into frequency space as audio. The entry also supports
decoding the produced waveforms using the <code>-d</code> flag. Usage instructions is
output if run with the <code>-h</code> flag, albeit not in an immediately legible format.</p>
<h3 id="details">Details</h3>
<p>In normal operation, the entry reads characters from one or more
sources. If the <code>-h</code> flag is given, usage instructions is
used as a source. Else if file paths are present as arguments those will
be used. Else <code>stdin</code> is used.</p>
<p>If a character is part of the supported subset of ASCII
<code>{10, 32-126}</code> then that character is output into frequency
space of an audio signal (44.1 kHz single precision float, endianness
should depend on system endianness) through <code>stdout</code>. Any
other character will be interpreted and outputted as a space.</p>
<p>Characters are printed using a (slightly modified) pixel font based
on <a href="https://github.com/hchargois/gohufont">gohufont</a>. Pixels
are drawn using crosses in frequency space, achieved by simultaneous up
<p>In normal operation, the entry reads characters from one or more sources. If the
<code>-h</code> flag is given, usage instructions is used as a source. Else if file paths
are present as arguments those will be used. Else <code>stdin</code> is used.</p>
<p>If a character is part of the supported subset of ASCII <code>{10, 32-126}</code> then that
character is output into frequency space of an audio signal (44.1 kHz single
precision float, endianness should depend on system endianness) through <code>stdout</code>.
Any other character will be interpreted and outputted as a space.</p>
<p>Characters are printed using a (slightly modified) pixel font based on
<a href="https://github.com/hchargois/gohufont">gohufont</a>.
Pixels are drawn using crosses in frequency space, achieved by simultaneous up
and down chirps.</p>
<p>Each input source is designated its own channel in the output (one
float per channel per time step in the output) so if you have a surround
sound system you could listen to a cacophony of chirpy characters.</p>
<p>Interestingly, with training you might actually be able to tell
characters just from hearing. But even without training you can easily
read along with the printed characters and have the sound make sense
with the look of the characters.</p>
<p>See image <a href="spoilers.png">spoiler.png</a> for an example
spectrogram.</p>
<p>Each input source is designated its own channel in the output (one float per
channel per time step in the output) so if you have a surround sound system you
could listen to a cacophony of chirpy characters.</p>
<p>Interestingly, with training you might actually be able to tell characters just
from hearing. But even without training you can easily read along with the
printed characters and have the sound make sense with the look of the
characters.</p>
<p>See image <a href="spoilers.png">spoiler.png</a> for an example spectrogram.</p>
<h3 id="limitations">Limitations</h3>
<p>There is no error checking done when opening files, so expect
segfaults if you provide the wrong path to a file.</p>
<p>This program is bound to misbehave if <code>int</code> is less than
32 bits.</p>
<p>Flags will only be interpreted correctly if they are the first
argument. Reading a file named <code>-d</code> or <code>-h</code> is
fully possible if it is not the first file provided, even though I am
not sure why you would want to do that.</p>
<p>Providing invalid/unexpected arguments to the decode flag will result
in odd behavior. Some erroneous arguments cause segfaults (negative
number of channels, channel id outside valid range). One argument in
particular causes an infinite loop printing whitespace.</p>
<p>There is no error checking done when opening files, so expect segfaults if you
provide the wrong path to a file.</p>
<p>This program is bound to misbehave if <code>int</code> is less than 32 bits.</p>
<p>Flags will only be interpreted correctly if they are the first argument. Reading
a file named <code>-d</code> or <code>-h</code> is fully possible if it is not the first file
provided, even though I am not sure why you would want to do that.</p>
<p>Providing invalid/unexpected arguments to the decode flag will result in odd
behavior. Some erroneous arguments cause segfaults (negative number of channels,
channel id outside valid range). One argument in particular causes an infinite
loop printing whitespace.</p>
<h3 id="obfuscation">Obfuscation:</h3>
<p>A lot of the obfuscations done came naturally from trying to appease
the size tool. To name some:</p>
<p>A lot of the obfuscations done came naturally from trying to appease the size
tool. To name some:</p>
<ul>
<li>One character names.</li>
<li>Merging of related (and not so related) arithmetic operations.</li>
<li>Short circuiting for flow control to replace some
<code>if</code>s.</li>
<li>Short circuiting for flow control to replace some <code>if</code>s.</li>
<li>Some <code>#defines</code>, sadly.</li>
</ul>
<p>On the intersection of size and obfuscation is the data encoding,
which was quite fun to design.</p>
<p>Some additional obfuscation was done to mathematical formulas.
Somewhat known expressions were transformed into equivalent but less
recognizable counterparts.</p>
<p>I have tried to avoid intentional red herrings in the code, although
fishy statements are plentiful.</p>
<p>On the intersection of size and obfuscation is the data encoding, which was
quite fun to design.</p>
<p>Some additional obfuscation was done to mathematical formulas. Somewhat known
expressions were transformed into equivalent but less recognizable counterparts.</p>
<p>I have tried to avoid intentional red herrings in the code, although fishy
statements are plentiful.</p>
<h3 id="data-encoding">Data encoding:</h3>
<p>The large string in the beginning of the source file contains font
data, encoded in base64 using characters in the range <code>' '</code>
to <code>'_'</code>. The space was chosen as zero because the data
contains a lot of zeroes, and quite helpfully the size tool ignores
whitespace even in strings. Without this fact the program would have
been too large and the decoding feature would have had to go.
Fortunately this hole in the size spec was readily available. :)</p>
<p>Characters in the font (5x8 pixels, 40 bits) are packed into 7 base64
digits (which was a pain to decode in minimal code).</p>
<p>The large string in the beginning of the source file contains font data, encoded
in base64 using characters in the range <code>' '</code> to <code>'_'</code>. The space was chosen as
zero because the data contains a lot of zeroes, and quite helpfully the size
tool ignores whitespace even in strings. Without this fact the program would
have been too large and the decoding feature would have had to go. Fortunately
this hole in the size spec was readily available. :)</p>
<p>Characters in the font (5x8 pixels, 40 bits) are packed into 7 base64 digits
(which was a pain to decode in minimal code).</p>
<h3 id="math">Math:</h3>
<p>Note that even though <code>float</code>s are used for the waveforms,
the standard math library is not used at all! Most arithmetic is done
purely on integers. The only major exception is generating a table of
sine values which are interpolated to give high resolution waveforms.
Can you see when the generation is triggered, and how it is done?</p>
<p>A critical issue encountered was that having abrupt starts and ends
of signals cause a lot of problems with spectral leakage which makes
spectrograms hard to read and audio painful to listen to. To reduce
spectral leakage a windowing function was used. Although the one used is
quite well known, it is not in a form that should be familiar to anyone.
What looks like a polynomial and quacks like a polynomial might not
actually be a polynomial, at least not deep inside.</p>
<p>Note that even though <code>float</code>s are used for the waveforms, the standard math
library is not used at all! Most arithmetic is done purely on integers. The only
major exception is generating a table of sine values which are interpolated to
give high resolution waveforms. Can you see when the generation is triggered,
and how it is done?</p>
<p>A critical issue encountered was that having abrupt starts and ends of signals
cause a lot of problems with spectral leakage which makes spectrograms hard to
read and audio painful to listen to. To reduce spectral leakage a windowing
function was used. Although the one used is quite well known, it is not in a
form that should be familiar to anyone. What looks like a polynomial and quacks
like a polynomial might not actually be a polynomial, at least not deep inside.</p>
<h3 id="printing-a-string">Printing a string:</h3>
<p>The program was written to deal exclusively with file descriptors, so
how would one go about printing a <code>char</code> array not from a
file descriptor without adding additional logic? Answer:
<code>ungetc(3)</code> into <code>stdin</code>, one <code>char</code> at
a time (to be standards compliant). This is used to print the usage
instructions.</p>
<p>The program was written to deal exclusively with file descriptors, so how would
one go about printing a <code>char</code> array not from a file descriptor without adding
additional logic? Answer: <code>ungetc(3)</code> into <code>stdin</code>, one <code>char</code> at a time (to be
standards compliant). This is used to print the usage instructions.</p>
<h3 id="compilation-warnings">Compilation warnings</h3>
<p>Compiling using</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">gcc</span> <span class="at">-Wall</span> <span class="at">-Wextra</span> <span class="at">-pedantic</span></span></code></pre></div>
<p>gives only <code>-Wmisleading-indentation</code> which is sensible
considering the source code. While</p>
<p>gives only <code>-Wmisleading-indentation</code> which is sensible considering the source code. While</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">clang</span> <span class="at">-Wall</span> <span class="at">-Wextra</span> <span class="at">-pedantic</span></span></code></pre></div>
<p>is a bit more pessimistic and gives <code>-Wempty-body</code> (I like
loops without bodies), <code>-Wstring-plus-int</code> (since apparently
some people think string+<code>int</code> is a concatenation) and one of
the weirder warnings I have seen from me splitting a negative constant
with whitespace. Compiling using</p>
<p>is a bit more pessimistic and gives <code>-Wempty-body</code> (I like loops without
bodies), <code>-Wstring-plus-int</code> (since apparently some people think string+<code>int</code> is a
concatenation) and one of the weirder warnings I have seen from me splitting a
negative constant with whitespace. Compiling using</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="fu">clang</span> <span class="at">-Wall</span> <span class="at">-Wextra</span> <span class="at">-pedantic</span> <span class="at">-Weverything</span></span></code></pre></div>
<p>produces a few page faults of warnings and makes me feel generally
bad about myself. :(</p>
<p>produces a few page faults of warnings and makes me feel generally bad about
myself. :(</p>
<h3 id="misc">Misc</h3>
<p>The reported size of the source code using the size tool is very
intentionally 2018.</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
Reserved. You are free to share and adapt this file under the terms of
this license:</p>
<p>The reported size of the source code using the size tool is very intentionally
2018.</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:</p>
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
<p>For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/</p>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2018algmyr"><a name="inventory"></a>Inventory for
2018/algmyr</h1>
<h1 id="inventory-for-2018algmyr"><a name="inventory"></a>Inventory for 2018/algmyr</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/algmyr/prog.c">prog.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/algmyr/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/algmyr/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/algmyr/try.sh">try.sh</a>
- how to run</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/algmyr/prog.c">prog.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/algmyr/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/algmyr/prog.orig.c">prog.orig.c</a> - original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/algmyr/try.sh">try.sh</a> - how to run</li>
<li><a href="spoiler.png">spoiler.png</a> - SPOILER WARNING</li>
<li><a href="2018_algmyr.tar.bz2">2018_algmyr.tar.bz2</a> - download
entry source</li>
<li><a href="2018_algmyr.tar.bz2">2018_algmyr.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/algmyr/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/algmyr/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/algmyr/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/algmyr/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/algmyr/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/algmyr/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+51 -81
View File
@@ -129,9 +129,9 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Derek_Anderson">Derek
Anderson</a><br> Location: <a href="../../location.html#US">US</a> -
<em>United States of America</em> (<em>United States</em>) <br><br></li>
<li>Name: <a href="../../authors.html#Derek_Anderson">Derek Anderson</a><br>
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -141,18 +141,16 @@ Anderson</a><br> Location: <a href="../../location.html#US">US</a> -
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<p>There is an alternate version of this entry. See <a
href="#alternate-code">Alternate code</a> below for more details.</p>
<p>There is an alternate version of this entry. See <a href="#alternate-code">Alternate
code</a> below for more details.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">&lt;</span> textfile</span></code></pre></div>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<h2 id="alternate-code">Alternate code:</h2>
<p>Compare <a href="prog.c">prog.c</a> and <a
href="prog.alt.c">prog.alt.c</a> and find out why we had to modify the
entry, and what confused the author (see the author’s remarks). No, it
was not the shape of the Roman V that we, or the compiler, didn’t
like.</p>
<p>Compare <a href="prog.c">prog.c</a> and <a href="prog.alt.c">prog.alt.c</a> and find out why we had to
modify the entry, and what confused the author (see the author’s remarks). No,
it was not the shape of the Roman V that we, or the compiler, didn’t like.</p>
<h3 id="alternate-build">Alternate build:</h3>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</h3>
@@ -160,98 +158,70 @@ like.</p>
<h3 id="alternate-try">Alternate try:</h3>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.alt.sh</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>With this entry, you won’t need to turn your monitor <a
href="http://en.wikipedia.org/wiki/River_%28typography%29">upside
<p>With this entry, you won’t need to turn your monitor <a href="http://en.wikipedia.org/wiki/River_%28typography%29">upside
down</a>!</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="compiling-the-program">Compiling the program:</h3>
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> <span class="at">-Wall</span> <span class="at">-Wextra</span> <span class="at">-Wpedantic</span> <span class="at">-O3</span> <span class="at">-std</span><span class="op">=</span>c11 prog.c <span class="at">-o</span> prog</span></code></pre></div>
<p>Also works with a standard of C99, but C90/C89 will not compile due
to <code>for</code> loop initial declarations, along with additional
warnings about variable length arrays and lack of a <code>return</code>
statement.</p>
<p>Also works with a standard of C99, but C90/C89 will not compile due to
<code>for</code> loop initial declarations, along with additional warnings about
variable length arrays and lack of a <code>return</code> statement.</p>
<h3 id="additional-info">Additional info:</h3>
<p>This small program, when given text on <code>stdin</code>, will
produce a pattern of squiggly lines. This pattern is deterministic, and
it shouldn’t be too difficult to determine from whence they come. There
is even a comment that describes the highlighted phenomena in the
source, for those that require a small nudge. With denser text blocks,
such as an essay or similar prose, the output can be rather pretty, in
an chaotic emergence sort of way. Try using this file, or the source
file as inputs.</p>
<p>This small program, when given text on <code>stdin</code>, will produce a pattern of
squiggly lines. This pattern is deterministic, and it shouldn’t be too
difficult to determine from whence they come. There is even a comment
that describes the highlighted phenomena in the source, for those that
require a small nudge. With denser text blocks, such as an essay or
similar prose, the output can be rather pretty, in an chaotic emergence
sort of way. Try using this file, or the source file as inputs.</p>
<p>In its current form, this program can handle lines of length 255; to
adjust this limit, change the variable <code>a</code> at the top of the
source. Other adjustments, such as the exact printed characters, are
rather easy, once sufficient reverse engineering has occurred.
Improvements such as proper handling of tabs are left as an exercise to
the reader.</p>
<p>In developing this program, the author found a potentially
interesting bug. If the expression <code>(j=k,j)</code> (near the middle
of the source) is changed to <code>(j=k,k)</code>, the program produces
different output. The author used gcc 5.4.0, compiled for
<code>x86_64-linux-gnu</code>. Enabling or disabling optimization
produces the same results. The author is not sure who is the culprit,
but instead shrugged and moved on with life. Of course, YMMV with your
own environment.</p>
<p>The structure of this program, as you may have deduced, is two
<code>for</code> loops, one nested in the other. There are also a bunch
of direct variable assignments, such as <code>j=k</code>. There is some
filler fluff, such as <code>0-0+0</code>, but all that sort should be
rather easy to spot. It was mostly added for the purpose of making
certain things line up right, and only secondarily to obfuscate.</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
Reserved. You are free to share and adapt this file under the terms of
this license:</p>
adjust this limit, change the variable <code>a</code> at the top of the source.
Other adjustments, such as the exact printed characters, are rather
easy, once sufficient reverse engineering has occurred. Improvements
such as proper handling of tabs are left as an exercise to the reader.</p>
<p>In developing this program, the author found a potentially interesting
bug. If the expression <code>(j=k,j)</code> (near the middle of the source) is
changed to <code>(j=k,k)</code>, the program produces different output. The author
used gcc 5.4.0, compiled for <code>x86_64-linux-gnu</code>. Enabling or
disabling optimization produces the same results. The author is not
sure who is the culprit, but instead shrugged and moved on with life.
Of course, YMMV with your own environment.</p>
<p>The structure of this program, as you may have deduced, is two <code>for</code>
loops, one nested in the other. There are also a bunch of direct
variable assignments, such as <code>j=k</code>. There is some filler fluff, such as
<code>0-0+0</code>, but all that sort should be rather easy to spot. It was mostly
added for the purpose of making certain things line up right, and only
secondarily to obfuscate.</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:</p>
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
<p>For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/</p>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2018anderson"><a name="inventory"></a>Inventory
for 2018/anderson</h1>
<h1 id="inventory-for-2018anderson"><a name="inventory"></a>Inventory for 2018/anderson</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/anderson/prog.c">prog.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/anderson/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/anderson/prog.alt.c">prog.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/anderson/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/anderson/try.alt.sh">try.alt.sh</a>
- how to run alternate code</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/anderson/try.sh">try.sh</a>
- how to run</li>
<li><a href="2018_anderson.tar.bz2">2018_anderson.tar.bz2</a> - download
entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/anderson/prog.c">prog.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/anderson/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/anderson/prog.alt.c">prog.alt.c</a> - alternative source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/anderson/prog.orig.c">prog.orig.c</a> - original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/anderson/try.alt.sh">try.alt.sh</a> - how to run alternate code</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/anderson/try.sh">try.sh</a> - how to run</li>
<li><a href="2018_anderson.tar.bz2">2018_anderson.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/anderson/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/anderson/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/anderson/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/anderson/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/anderson/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/anderson/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+57 -89
View File
@@ -129,9 +129,9 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Fabrice_Bellard">Fabrice
Bellard</a><br> Location: <a href="../../location.html#FR">FR</a> -
<em>French Republic</em> (<em>France</em>) <br><br></li>
<li>Name: <a href="../../authors.html#Fabrice_Bellard">Fabrice Bellard</a><br>
Location: <a href="../../location.html#FR">FR</a> - <em>French Republic</em> (<em>France</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -141,138 +141,106 @@ Bellard</a><br> Location: <a href="../../location.html#FR">FR</a> -
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<p>There is an alternate version that should work with Windows. See <a
href="#alternate-code">Alternate code</a> below.</p>
<p>There is an alternate version that should work with Windows. See <a href="#alternate-code">Alternate
code</a> below.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">&gt;</span> lena.ppm</span></code></pre></div>
<h2 id="try">Try:</h2>
<p>First open <a href="Lenna.png">Lenna.png</a> in your graphics viewer
of choice. Next, after running the above command
(<code>./prog &gt; lena.ppm</code>), open <code>lena.ppm</code> in your
<p>First open <a href="Lenna.png">Lenna.png</a> in your graphics viewer of choice. Next, after
running the above command (<code>./prog &gt; lena.ppm</code>), open <code>lena.ppm</code> in your
graphics viewer of choice. After that try:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<p>NOTE: the script uses the tools <code>pngtopam(1)</code> (or
<code>pngtopnm(1)</code> for older versions) and <code>pnmscale</code>
come from the netpbm project and <code>cjpeg(1)</code> comes from
<code>libjpeg-turbo</code>. If you don’t have these tools already see <a
href="../../faq.html#netpbm">FAQ 3.15 - How do I compile and install
netpbm for entries that require it?</a> and <a
href="../../faq.html#libjpeg">FAQ 3.16 - How do I compile and install
libjpeg-turbo for entries that require it?</a>.</p>
<p>NOTE: <a href="Lenna.png">Lenna.png</a> is from <a
href="https://upload.wikimedia.org/wikipedia/en/7/7d/Lenna_%28test_image%29.png"
class="uri">https://upload.wikimedia.org/wikipedia/en/7/7d/Lenna_%28test_image%29.png</a>.</p>
<p>NOTE: the script uses the tools <code>pngtopam(1)</code> (or <code>pngtopnm(1)</code> for older
versions) and <code>pnmscale</code> come from the netpbm project and <code>cjpeg(1)</code> comes from
<code>libjpeg-turbo</code>. If you don’t have these tools already see <a href="../../faq.html#netpbm">FAQ 3.15 - How do I
compile and install netpbm for entries that require it?</a> and
<a href="../../faq.html#libjpeg">FAQ 3.16 - How do I compile and install libjpeg-turbo for entries that require
it?</a>.</p>
<p>NOTE: <a href="Lenna.png">Lenna.png</a> is from
<a href="https://upload.wikimedia.org/wikipedia/en/7/7d/Lenna_%28test_image%29.png" class="uri">https://upload.wikimedia.org/wikipedia/en/7/7d/Lenna_%28test_image%29.png</a>.</p>
<h2 id="alternate-code">Alternate code:</h2>
<p>The <a href="prog.alt.c">prog.alt.c</a> is based on the author’s
remarks and it should work for Windows.</p>
<p>The <a href="prog.alt.c">prog.alt.c</a> is based on the author’s remarks and it should work
for Windows.</p>
<h3 id="alternate-build">Alternate build:</h3>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>prog.alt</code> as you would <code>prog</code>.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>The file <code>small.jpg</code> will be approximately of the same
size as the raw image data in the program. Compare the level of the
detail and the artifacts of <code>small.jpg</code> and
<code>lena.ppm</code>.</p>
<p>Compressing images is just a matter of simple arithmetic and some
magic, isn’t it?</p>
<p>The file <code>small.jpg</code> will be approximately of the same size as the raw image
data in the program. Compare the level of the detail and the artifacts of
<code>small.jpg</code> and <code>lena.ppm</code>.</p>
<p>Compressing images is just a matter of simple arithmetic and some magic, isn’t
it?</p>
<p>We could understand some of the arithmetic but none of the magic.</p>
<p>Deciphering the mechanism used for data encoding to make use of
whitespace, braces and semicolons should be a slightly easier task.</p>
<p>Deciphering the mechanism used for data encoding to make use of whitespace,
braces and semicolons should be a slightly easier task.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>Warning: the program is not protected against invalid input.</p>
<p>This program outputs a 128x128 RGB image file to the standard output
using the portable pixmap file format (PPM). It contains the famous
“Lena” image which is used in many image compression tests.</p>
<p>This program outputs a 128x128 RGB image file to the standard output using the
portable pixmap file format (PPM). It contains the famous “Lena” image which is
used in many image compression tests.</p>
<p>The uncompressed image is 12 times larger than the source code of the
program which includes the image data and the complete decoder. The
actual image data is 1220 byte long, which gives a compression ratio of
40. Using a JPEG-like algorithm would not be enough to reach this level
of compression (the Lena image would be barely recognizable). So the
algorithm is based on the latest advances in image compression. It
actual image data is 1220 byte long, which gives a compression ratio
of 40. Using a JPEG-like algorithm would not be enough to reach this
level of compression (the Lena image would be barely recognizable). So
the algorithm is based on the latest advances in image compression. It
includes the following features:</p>
<ul>
<li>DCT transform with variable block size (4x4, 8x8, 16x16 and
32x32)</li>
<li>DCT transform with variable block size (4x4, 8x8, 16x16 and 32x32)</li>
<li>DC and directional predictors</li>
<li>arithmetic coding</li>
<li>YCgCo color space.</li>
</ul>
<p>The image data is encoded to a C string with some tricks to make the
best use of the IOCCC size constraints. The identifiers were shortened
to a single letter to save space. No specific obfuscation was needed as
the algorithms already have a significant complexity.</p>
to a single letter to save space. No specific obfuscation was needed
as the algorithms already have a significant complexity.</p>
<p>Although the program was optimized to decompress its built-in image,
it accepts to decompress image files from its standard input.
Examples:</p>
it accepts to decompress image files from its standard
input. Examples:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> d <span class="op">&lt;</span> lena512.bin <span class="op">&gt;</span> lena512.ppm</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> d <span class="op">&lt;</span> fruits.bin <span class="op">&gt;</span> fruits.ppm</span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> d <span class="op">&lt;</span> vintage_cars.bin <span class="op">&gt;</span> vintage_cars.ppm</span></code></pre></div>
<p>The original images for <a
href="https://commons.wikimedia.org/wiki/File%3AFruits_oranges%2C_jardin_japonais_2.JPG">fruits</a>
and <a
href="https://commons.wikimedia.org/wiki/File%3ARed_Bull_Jungfrau_Stafette%2C_10th_stage_-_vintage_cars_%282%29.jpg">vintage
cars</a> come from Wikipedia and were resized to a width of 1024
pixels.</p>
<p>The program should be portable on any Unix system. On Windows the
line <code>_setmode(0, 32768); _setmode(1, 32768);</code> must be added
at the start of the main() function to avoid unwanted carriage return
characters in the output.</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
Reserved. You are free to share and adapt this file under the terms of
this license:</p>
<p>The original images for <a href="https://commons.wikimedia.org/wiki/File%3AFruits_oranges%2C_jardin_japonais_2.JPG">fruits</a> and <a href="https://commons.wikimedia.org/wiki/File%3ARed_Bull_Jungfrau_Stafette%2C_10th_stage_-_vintage_cars_%282%29.jpg">vintage cars</a> come from
Wikipedia and were resized to a width of 1024 pixels.</p>
<p>The program should be portable on any Unix system. On Windows the line
<code>_setmode(0, 32768); _setmode(1, 32768);</code> must be added at the start of
the main() function to avoid unwanted carriage return characters in
the output.</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:</p>
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
<p>For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/</p>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2018bellard"><a name="inventory"></a>Inventory for
2018/bellard</h1>
<h1 id="inventory-for-2018bellard"><a name="inventory"></a>Inventory for 2018/bellard</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/bellard/prog.c">prog.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/bellard/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/bellard/prog.alt.c">prog.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/bellard/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/bellard/prog.c">prog.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/bellard/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/bellard/prog.alt.c">prog.alt.c</a> - alternative source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/bellard/prog.orig.c">prog.orig.c</a> - original source</li>
<li><a href="Lenna.png">Lenna.png</a> - sample image data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/bellard/try.sh">try.sh</a>
- how to run</li>
<li><a href="2018_bellard.tar.bz2">2018_bellard.tar.bz2</a> - download
entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/bellard/try.sh">try.sh</a> - how to run</li>
<li><a href="2018_bellard.tar.bz2">2018_bellard.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/bellard/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/bellard/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/bellard/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/bellard/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/bellard/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/bellard/README.md">README.md</a> - markdown source for index.html</li>
<li><a href="fruits.bin">fruits.bin</a> - binary support file</li>
<li><a href="lena512.bin">lena512.bin</a> - binary support file</li>
<li><a href="vintage_cars.bin">vintage_cars.bin</a> - binary support
file</li>
<li><a href="vintage_cars.bin">vintage_cars.bin</a> - binary support file</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+113 -168
View File
@@ -130,8 +130,8 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Dave_Burton">Dave Burton</a><br>
Location: <a href="../../location.html#US">US</a> - <em>United States of
America</em> (<em>United States</em>) <br><br></li>
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -141,64 +141,58 @@ America</em> (<em>United States</em>) <br><br></li>
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<p>There is an alternate version of this entry. See <a
href="#alternate-code">Alternate code</a> below.</p>
<p>There is an alternate version of this entry. See <a href="#alternate-code">Alternate
code</a> below.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">&lt;</span> any-file</span></code></pre></div>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<h2 id="alternate-code">Alternate code:</h2>
<p>An alternate version of this entry, <a
href="prog.alt.c">prog.alt.c</a>, is provided This alternate code was
supposed to compile without warnings, however with modern compilers this
is no longer the case so it will only cleanly compile with
<code>-Wno-</code> options.</p>
<p>An alternate version of this entry, <a href="prog.alt.c">prog.alt.c</a>, is provided
This alternate code was supposed to compile without warnings, however
with modern compilers this is no longer the case so it will only cleanly compile
with <code>-Wno-</code> options.</p>
<h3 id="alternate-build">Alternate build:</h3>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>prog.alt</code> as you would <code>prog</code>.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>One line, one array, one loop and one statement but it prints many
bytes. It won.</p>
<p>One line, one array, one loop and one statement but it prints many bytes. It won.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>Feed this anything on <code>stdin</code>.</p>
<p>The <a href="scripthd.sh">included script.sh</a> may be used as a
driver program for this entry. It adds several nice-to-have features,
and allows salt-to-taste customizability.</p>
<p>The <a href="scripthd.sh">included script.sh</a> may be used as a driver program for this entry.
It adds several nice-to-have features, and allows salt-to-taste customizability.</p>
<p>This code has been compiled and tested on:</p>
<ul>
<li>OSX-10.11, gcc 4.2.1 and clang 3.0, -O0 and -O3</li>
<li>X86-Linux, gcc 4.1.2 and 4.8.4, -O0 and -O3</li>
<li>ARM-QEMU, gcc 4.8.4, -O0 and -O3</li>
<li>X86-FreeBSD 10.3, clang 3.4.1, -O0 and -O3</li>
<li>TCC 0.9.26 (x86-64) (used as a proxy for <a
href="../../years.html#2001_bellard">2001/bellard</a>)</li>
<li>UNIX V7 pcc (Johnson’s C compiler) on a <a
href="http://simh.trailing-edge.com/">simulated PDP-11/45</a> (see
spoiler for further detail)</li>
<li>TCC 0.9.26 (x86-64) (used as a proxy for <a href="../../years.html#2001_bellard">2001/bellard</a>)</li>
<li>UNIX V7 pcc (Johnson’s C compiler) on a <a href="http://simh.trailing-edge.com/">simulated PDP-11/45</a>
(see spoiler for further detail)</li>
</ul>
<div style="margin-bottom:60em;margin-top:4em">
<strong>Spoiler below; scroll down.</strong>
</div>
<h3 id="spoiler">SPOILER:</h3>
<p>This started life as a personal challenge: write the shortest hex
dump utility in C.</p>
<p>This started life as a personal challenge: write the shortest hex dump utility
in C.</p>
<p>The self-imposed ground rules in the hunt for shortest:</p>
<ul>
<li>The code has to output correctly.</li>
<li>No extraneous newlines, the code must be portable, and without
bypassing the solution using <code>execve(2)</code>, or functions built
upon it (<code>system(3)</code>, <code>popen(3)</code>, etc).</li>
<li>No extraneous newlines, the code must be portable,
and without bypassing the solution using <code>execve(2)</code>, or functions built upon it
(<code>system(3)</code>, <code>popen(3)</code>, etc).</li>
</ul>
<p>E.g:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>main<span class="op">(){</span>system<span class="op">(</span><span class="st">&quot;hd&quot;</span><span class="op">);}</span> <span class="co">// it&#39;s turtles all the way down!</span></span></code></pre></div>
<p>is not acceptable.</p>
<p>And, “output correctly” is the output format of this entry. QED.</p>
<p>Early attempts ended up at a reasonably short 157 characters. This
was too long for a one-liner, so it had to be formatted as something
more interesting. This solution is pleasing, but a true one-liner was
the hoped-for goal. Here is the 157 character version in it’s
entirety:</p>
<p>Early attempts ended up at a reasonably short 157 characters.
This was too long for a one-liner, so it had to be formatted as something more interesting.
This solution is pleasing, but a true one-liner was the hoped-for goal.
Here is the 157 character version in it’s entirety:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="dt">char</span> O<span class="op">,</span>o<span class="op">[</span> <span class="dv">20</span><span class="op">];</span>L<span class="op">(</span>O<span class="op">){</span></span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a>putchar <span class="op">(</span> O<span class="op">+</span> <span class="dv">48</span><span class="op">+</span><span class="dv">39</span> <span class="op">*(</span><span class="dv">9</span><span class="op">&lt;</span></span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a>O<span class="op">));}</span> I<span class="op">(</span>O<span class="op">)</span> <span class="op">{</span>L<span class="op">(~</span> <span class="dv">15</span><span class="op">);</span></span>
@@ -208,12 +202,12 @@ entirety:</p>
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a><span class="op">(</span><span class="dv">4</span><span class="op">^</span>l <span class="op">&gt;&gt;</span><span class="dv">5</span><span class="op">)</span> <span class="op">?</span>l<span class="op">:</span> <span class="dv">46</span><span class="op">,</span>L</span>
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a><span class="op">(</span>l<span class="op">&gt;&gt;</span> <span class="dv">4</span><span class="op">),</span>L <span class="op">(</span>l<span class="op">&amp;</span><span class="dv">15</span><span class="op">);</span>O<span class="op">&amp;&amp;</span></span>
<span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a>I<span class="op">(</span>o<span class="op">[</span> O<span class="op">]=</span><span class="dv">0</span> <span class="op">);}</span><span class="co">//157c</span></span></code></pre></div>
<p>While thinking about this in the shower (you are not the only one
that does this!) came the idea which reduced the code to just 119 chars.
This dramatic reduction started to feel close to minimal, and the hunt
resumed. The progression to the present size is interesting, and it is
interesting that the same algorithm can be expressed so differently by
slight rearrangement of its parts.</p>
<p>While thinking about this in the shower (you are not the only one that does this!)
came the idea which reduced the code to just 119 chars.
This dramatic reduction started to feel close to minimal, and the hunt resumed.
The progression to the present size is interesting,
and it is interesting that the same algorithm can be expressed so differently
by slight rearrangement of its parts.</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="co">// 119</span></span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="dt">char</span> O<span class="op">,</span>o<span class="op">[</span><span class="dv">20</span><span class="op">];</span>main<span class="op">(</span>l<span class="op">){</span><span class="cf">for</span><span class="op">(;~(</span>l<span class="op">=</span>getchar<span class="op">());</span>O<span class="op">||</span>puts<span class="op">(</span>o<span class="op">))</span>o<span class="op">[</span>O<span class="op">++]=</span>isprint<span class="op">(</span>l<span class="op">)?</span>l<span class="op">:</span><span class="dv">46</span><span class="op">,</span>O<span class="op">&amp;=</span><span class="dv">15</span><span class="op">,</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%02x</span><span class="st"> &quot;</span><span class="op">,</span>l<span class="op">);</span>O<span class="op">[</span>o<span class="op">]=</span><span class="dv">0</span><span class="op">;</span>O<span class="op">&amp;&amp;</span>puts<span class="op">(</span>o<span class="op">);}</span></span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a><span class="co">// 116</span></span>
@@ -230,11 +224,10 @@ slight rearrangement of its parts.</p>
<span id="cb7-14"><a href="#cb7-14" aria-hidden="true" tabindex="-1"></a><span class="dt">char</span> O<span class="op">,</span>o<span class="op">[</span><span class="dv">0</span><span class="op">];</span>main<span class="op">(</span>l<span class="op">){</span><span class="cf">for</span><span class="op">(;~</span>l<span class="op">;</span>O<span class="op">||</span>puts<span class="op">(</span>o<span class="op">))</span>O<span class="op">=(</span>O<span class="op">[</span>o<span class="op">]=~(</span>l<span class="op">=</span>getchar<span class="op">())?</span><span class="dv">4</span><span class="op">&lt;(</span><span class="dv">4</span><span class="op">^</span>l<span class="op">&gt;&gt;</span><span class="dv">5</span><span class="op">)?</span>l<span class="op">:</span><span class="dv">46</span><span class="op">:</span><span class="dv">0</span><span class="op">)?-~</span>O<span class="op">&amp;</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%02x</span><span class="st"> &quot;</span><span class="op">,</span>l<span class="op">)*</span><span class="dv">5</span><span class="op">:!</span>O<span class="op">;}</span></span>
<span id="cb7-15"><a href="#cb7-15" aria-hidden="true" tabindex="-1"></a><span class="co">// 109</span></span>
<span id="cb7-16"><a href="#cb7-16" aria-hidden="true" tabindex="-1"></a><span class="dt">char</span> O<span class="op">,</span>o<span class="op">[];</span>main<span class="op">(</span>l<span class="op">){</span><span class="cf">for</span><span class="op">(;~</span>l<span class="op">;</span>O<span class="op">||</span>puts<span class="op">(</span>o<span class="op">))</span>O<span class="op">=(</span>O<span class="op">[</span>o<span class="op">]=~(</span>l<span class="op">=</span>getchar<span class="op">())?</span><span class="dv">4</span><span class="op">&lt;(</span><span class="dv">4</span><span class="op">^</span>l<span class="op">&gt;&gt;</span><span class="dv">5</span><span class="op">)?</span>l<span class="op">:</span><span class="dv">46</span><span class="op">:</span><span class="dv">0</span><span class="op">)?-~</span>O<span class="op">&amp;</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%02x</span><span class="st"> &quot;</span><span class="op">,</span>l<span class="op">)*</span><span class="dv">5</span><span class="op">:!</span>O<span class="op">;}</span></span></code></pre></div>
<p>There are solutions without the ASCII sidebar that are significantly
shorter. These do not compete in the same category, since their output
is materially different. They are derived from the solutions above, but
are still fascinating as concise utilities, so here is their
progression, for the curious:</p>
<p>There are solutions without the ASCII sidebar that are significantly shorter.
These do not compete in the same category, since their output is materially different.
They are derived from the solutions above, but are still fascinating as concise utilities,
so here is their progression, for the curious:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="co">// 102</span></span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a>I<span class="op">;</span>O<span class="op">(</span>O<span class="op">){</span>putchar<span class="op">(</span>O<span class="op">+</span><span class="dv">48</span><span class="op">+</span><span class="dv">39</span><span class="op">*(</span><span class="dv">9</span><span class="op">&lt;</span>O<span class="op">));}</span>main<span class="op">(</span>l<span class="op">){</span><span class="cf">for</span><span class="op">(;~(</span>l<span class="op">=</span>getchar<span class="op">());</span>O<span class="op">(++</span>I<span class="op">&amp;</span><span class="dv">15</span><span class="op">?~</span><span class="dv">15</span><span class="op">:~</span><span class="dv">37</span><span class="op">))</span>O<span class="op">(</span>l<span class="op">&gt;&gt;</span><span class="dv">4</span><span class="op">),</span>O<span class="op">(</span>l<span class="op">&amp;</span><span class="dv">15</span><span class="op">);</span>O<span class="op">(-</span><span class="dv">38</span><span class="op">);}</span></span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a><span class="co">// 80</span></span>
@@ -245,10 +238,9 @@ progression, for the curious:</p>
<span id="cb8-8"><a href="#cb8-8" aria-hidden="true" tabindex="-1"></a>O<span class="op">;</span>main<span class="op">(</span>l<span class="op">){</span><span class="cf">for</span><span class="op">(;~</span>l<span class="op">;(</span>O<span class="op">=~(</span>l<span class="op">=</span>getchar<span class="op">())?-~</span>O<span class="op">&amp;</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%02x</span><span class="st"> &quot;</span><span class="op">,</span>l<span class="op">)*</span><span class="dv">5</span><span class="op">:!</span>O<span class="op">)||</span>puts<span class="op">(</span><span class="st">&quot;&quot;</span><span class="op">));}</span></span>
<span id="cb8-9"><a href="#cb8-9" aria-hidden="true" tabindex="-1"></a><span class="co">// 76</span></span>
<span id="cb8-10"><a href="#cb8-10" aria-hidden="true" tabindex="-1"></a>O<span class="op">;</span>main<span class="op">(</span>l<span class="op">){</span><span class="cf">for</span><span class="op">(;~</span>l<span class="op">;</span>O<span class="op">||</span>puts<span class="op">(&amp;</span>O<span class="op">))</span>O<span class="op">=~(</span>l<span class="op">=</span>getchar<span class="op">())?-~</span>O<span class="op">&amp;</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%02x</span><span class="st"> &quot;</span><span class="op">,</span>l<span class="op">)*</span><span class="dv">5</span><span class="op">:!</span>O<span class="op">;}</span></span></code></pre></div>
<p>It is possible to reduce the size of each of these by one by eliding
the trailing newline. This was not reported above since the newline kept
getting appended by processing software, and it is more interesting to
remove characters by changing code than by filtering:</p>
<p>It is possible to reduce the size of each of these by one by eliding the trailing newline.
This was not reported above since the newline kept getting appended by processing software,
and it is more interesting to remove characters by changing code than by filtering:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> tr <span class="at">-d</span> <span class="st">&#39;\012&#39;</span> <span class="op">&lt;</span> 109.c <span class="kw">|</span> <span class="fu">wc</span> <span class="at">-c</span></span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="ex">108</span></span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> tr <span class="at">-d</span> <span class="st">&#39;\012&#39;</span> <span class="op">&lt;</span> 76.c <span class="kw">|</span> <span class="fu">wc</span> <span class="at">-c</span></span>
@@ -256,159 +248,112 @@ remove characters by changing code than by filtering:</p>
<span id="cb9-5"><a href="#cb9-5" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> tr <span class="at">-d</span> <span class="st">&#39;\012&#39;</span> <span class="op">&lt;</span> 109.c <span class="kw">|</span> <span class="fu">cc</span> <span class="at">-o</span> 108 <span class="at">-xc</span> <span class="at">-</span></span>
<span id="cb9-6"><a href="#cb9-6" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> verify 108</span>
<span id="cb9-7"><a href="#cb9-7" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span></span></code></pre></div>
<p>An obfuscated hex dump has been done before: <a
href="../../1986/bright/index.html">1986/bright</a> is similar in
function, but it uses more characters in just setting up its obfuscation
than this entire solution!</p>
<p>An obfuscated hex dump has been done before:
<a href="../../1986/bright/index.html">1986/bright</a> is similar in function,
but it uses more characters in just setting up its obfuscation than this entire
solution!</p>
<h3 id="bigger-spoiler">BIGGER SPOILER:</h3>
<p>If you are unhappy with the way DEL (character 127) is handled,
replace the cryptic expression <code>4&lt;(4^l&gt;&gt;5)?l:46</code>
with <code>32&gt;l|l&gt;126?46:l</code>. Both take the same number of
characters, but the former is a bit more interesting. Bonus question:
how does the first expression work?</p>
<h3 id="biggest-spoiler-and-some-history">BIGGEST SPOILER (and some
history):</h3>
<p>Technically, <code>char o[0];</code> is illegal (SS 6.7.6.2)
according to ISO (N1570). And <code>char o[];</code> is a conditionally
supported feature (SS 6.7.6.2, 6.10.8.3). However, it works in modern C
implementations as an extension, including GCC, Clang and TCC, for X86
and ARM, on multiple operating systems (Linux, OSX/macOS, FreeBSD), so
it is <em>functionally</em> correct. MicroSoft Visual C++ does not allow
<code>char o[]</code> or <code>char o[0]</code>, and implements its
close relative <code>char o[1]</code> such that writing more than a
single char will cause a fault, which is <em>technically</em>
replace the cryptic expression <code>4&lt;(4^l&gt;&gt;5)?l:46</code> with <code>32&gt;l|l&gt;126?46:l</code>.
Both take the same number of characters, but the former is a bit more interesting.
Bonus question: how does the first expression work?</p>
<h3 id="biggest-spoiler-and-some-history">BIGGEST SPOILER (and some history):</h3>
<p>Technically, <code>char o[0];</code> is illegal (SS 6.7.6.2) according to ISO (N1570). And
<code>char o[];</code> is a conditionally supported feature (SS 6.7.6.2, 6.10.8.3).
However, it works in modern C implementations as an extension, including GCC,
Clang and TCC, for X86 and ARM, on multiple operating systems (Linux, OSX/macOS,
FreeBSD), so it is <em>functionally</em> correct. MicroSoft Visual C++ does not allow
<code>char o[]</code> or <code>char o[0]</code>, and implements its close relative <code>char o[1]</code> such
that writing more than a single char will cause a fault, which is <em>technically</em>
correct.</p>
<p>But how does this work at all, even as an extension? <code>o[]</code>
allocates one(!) byte in a zero-filled data area (formerly <a
href="https://en.wikipedia.org/wiki/.bss">BSS</a>). The UNIX-derived
systems this code was run upon all place the storage of <code>O</code>
and <code>o</code> into a zero-filled VM page with nothing following:
thus, there are plenty of available and unused zero bytes following
<code>O</code>, addressed via <code>o</code>, and this code only needs
17. This is <em>undefined</em> behavior, but as shown, it is widely
available.</p>
<p>The <a href="http://minnie.tuhs.org/cgi-bin/utree.pl">1979 Seventh
Edition UNIX</a> (v7) system pre-dates the IOCCC by several years, and
the source code to <code>sh</code>(1) was a <a
href="../../faq.html#ioccc_start">significant inspiration for this
contest</a>. There are two C compilers present: <code>cc</code> written
by Dennis Ritchie, and <code>pcc</code> written by Steven Johnson. The
nested conditional expressions in 116 and smaller are too complex for
<code>cc</code> (“Illegal conditional”) but <code>pcc</code> handles
them correctly, and neither compiler accepts <code>char o[]</code> or
<code>char o[0]</code> and neither put the bytes in a zero-filled page
(as a paged VM was not yet written for UNIX).</p>
<p>More significant is that v7 <code>printf(3)</code> does not report
the number of characters written, and therefore 111 compiles but does
not work correctly; 113 is the shortest code that compiles and runs
correctly in Ancient UNIX.</p>
<p>Interesting digression: v7 <code>printf</code> (<code>_doprnt</code>)
was written in PDP-11 assembly. It pre-dates <code>varargs.h</code>, and
assembly was the only way to gain access to the variable argument types.
The first edition <em>The C Programming Language</em>, 1978, page 71,
remarks:</p>
<p>But how does this work at all, even as an extension? <code>o[]</code> allocates one(!)
byte in a zero-filled data area (formerly
<a href="https://en.wikipedia.org/wiki/.bss">BSS</a>). The UNIX-derived systems this code
was run upon all place the storage of <code>O</code> and <code>o</code> into a zero-filled VM page
with nothing following: thus, there are plenty of available and unused zero
bytes following <code>O</code>, addressed via <code>o</code>, and this code only needs 17. This is
<em>undefined</em> behavior, but as shown, it is widely available.</p>
<p>The <a href="http://minnie.tuhs.org/cgi-bin/utree.pl">1979 Seventh Edition UNIX</a> (v7) system pre-dates the IOCCC by several years,
and the source code to <code>sh</code>(1) was a <a href="../../faq.html#ioccc_start">significant inspiration for this contest</a>.
There are two C compilers present: <code>cc</code> written by Dennis Ritchie, and <code>pcc</code> written by Steven Johnson.
The nested conditional expressions in 116 and smaller are too complex for <code>cc</code> (“Illegal conditional”)
but <code>pcc</code> handles them correctly, and neither compiler accepts <code>char o[]</code> or
<code>char o[0]</code> and neither put the bytes in a zero-filled page (as a paged VM was
not yet written for UNIX).</p>
<p>More significant is that v7 <code>printf(3)</code> does not report the number of characters
written, and therefore 111 compiles but does not work correctly; 113 is the
shortest code that compiles and runs correctly in Ancient UNIX.</p>
<p>Interesting digression: v7 <code>printf</code> (<code>_doprnt</code>) was written in PDP-11 assembly.
It pre-dates <code>varargs.h</code>, and assembly was the only way to gain access to the
variable argument types. The first edition <em>The C Programming Language</em>, 1978,
page 71, remarks:</p>
<blockquote>
<p>By the way, there is no entirely satisfactory way to write a portable
function that accepts a variable number of arguments, because there is
no portable way for the called function to determine how many arguments
where actually passed to it in a given call. …<br />
<code>printf</code>, the most common C function with a variable number
of arguments, … is also non-portable and must be modified for different
environments.</p>
<p>By the way, there is no entirely satisfactory way to write a portable function
that accepts a variable number of arguments, because there is no portable way
for the called function to determine how many arguments where actually passed
to it in a given call.
…<br />
<code>printf</code>, the most common C function with a variable number of arguments,
… is also non-portable and must be modified for different environments.</p>
</blockquote>
<p>It is fascinating to explore the roots of C through the history of
the operating system it was birthed within. C is often criticized as a
difficult, inscrutable language, but as this contest demonstrates, this
is in parody. <em>Shell-gol</em> is one of those instances where someone
<a
href="https://web.archive.org/web/20180521074522/http://www.computerworld.com.au/article/279011/a-z_programming_languages_bourne_shell_sh/?pp=4">preferred
a different language</a>, and (ab)used the preprocessor to re-mold C
into something they found comfortable. Most of the rest of the system,
especially in the kernel, are models of clarity and efficient
expression.</p>
<p>It is fascinating to explore the roots of C through the history of the operating
system it was birthed within. C is often criticized as a difficult, inscrutable
language, but as this contest demonstrates, this is in parody. <em>Shell-gol</em> is
one of those instances where someone <a href="https://web.archive.org/web/20180521074522/http://www.computerworld.com.au/article/279011/a-z_programming_languages_bourne_shell_sh/?pp=4">preferred a different language</a>, and
(ab)used the preprocessor to re-mold C into something they found comfortable.
Most of the rest of the system, especially in the kernel, are models of clarity
and efficient expression.</p>
<h3 id="tldr">TL;DR:</h3>
<p>So which version is the shortest, portable hex dump?</p>
<ul>
<li>109 works with (most?) modern Unix-like systems and compilers, see
example list above.</li>
<li>111 works adds Microsoft, is standards-approved, and does not
exploit undefined behavior.</li>
<li>109 works with (most?) modern Unix-like systems and compilers, see example list above.</li>
<li>111 works adds Microsoft, is standards-approved, and does not exploit undefined behavior.</li>
<li>113 works on Ancient UNIX and the portable C compiler.</li>
<li>119 works on all platforms, including the original Ritchie PDP-11 C
compiler.</li>
<li>119 works on all platforms, including the original Ritchie PDP-11 C compiler.</li>
</ul>
<h3 id="coda">Coda:</h3>
<p>Clearly, the smallest possible program violates modern best practice.
It is not even possible to compile cleanly, but it will compile
correctly.</p>
<p>Included is <a href="prog.alt.c">prog.alt.c</a>, a modern C
implementation that is – perhaps – the smallest, clean-compiling version
using <code>clang</code> or <code>gcc</code> with
<code>-Wall -pedantic</code>. Note that while this is larger than all
but the original attempt, it will <em>not</em> work with the original
Ritchie PDP-11 C compiler, since the expression within the ternary
remains too complex.</p>
It is not even possible to compile cleanly, but it will compile correctly.</p>
<p>Included is <a href="prog.alt.c">prog.alt.c</a>, a modern C implementation that is –
perhaps – the smallest, clean-compiling version using <code>clang</code> or <code>gcc</code> with
<code>-Wall -pedantic</code>. Note that while this is larger than all but the original
attempt, it will <em>not</em> work with the original Ritchie PDP-11 C compiler, since
the expression within the ternary remains too complex.</p>
<p>Try:</p>
<div class="sourceCode" id="cb10"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> prog.c prog.alt.c</span></code></pre></div>
<div class="sourceCode" id="cb10"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> prog.c prog.alt.c</span></code></pre></div>
<p>or</p>
<div class="sourceCode" id="cb11"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cmp</span> <span class="at">-b</span> prog.c prog.alt.c</span></code></pre></div>
<p>to compare the differences (<code>diff</code> is not helpful on a
one-liner).</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
Reserved. You are free to share and adapt this file under the terms of
this license:</p>
<div class="sourceCode" id="cb11"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cmp</span> <span class="at">-b</span> prog.c prog.alt.c</span></code></pre></div>
<p>to compare the differences (<code>diff</code> is not helpful on a one-liner).</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:</p>
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
<p>For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/</p>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2018burton1"><a name="inventory"></a>Inventory for
2018/burton1</h1>
<h1 id="inventory-for-2018burton1"><a name="inventory"></a>Inventory for 2018/burton1</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/prog.c">prog.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/prog.alt.c">prog.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/scripthd.sh">scripthd.sh</a>
- driver program - adds several nice-to-have features</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/try.sh">try.sh</a>
- how to run</li>
<li><a href="2018_burton1.tar.bz2">2018_burton1.tar.bz2</a> - download
entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/prog.c">prog.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/prog.alt.c">prog.alt.c</a> - alternative source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/prog.orig.c">prog.orig.c</a> - original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/scripthd.sh">scripthd.sh</a> - driver program - adds several nice-to-have features</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/try.sh">try.sh</a> - how to run</li>
<li><a href="2018_burton1.tar.bz2">2018_burton1.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+20 -29
View File
@@ -120,19 +120,15 @@
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<p>The values below are the field-by-field difference
<code>iocccsize - ioc</code>. (<code>&gt;0</code> means
<code>iocccsize</code> counted more than <code>ioc</code>,
<code>&lt;0</code> <code>ioc</code> counted more)</p>
<p>The values below are the field-by-field difference <code>iocccsize - ioc</code>.
(<code>&gt;0</code> means <code>iocccsize</code> counted more than <code>ioc</code>, <code>&lt;0</code> <code>ioc</code> counted more)</p>
<pre><code>cl: lines, cw: words, cc: chars, ci: rule2, ts: saved, kw: keywords, ks: kw_saved
cl 0 cw -4 cc 0 ci 0 ts 0 kw 0 ks 0 src/obc/1986/pawka.c
cl -45 cw -55 cc -617 ci -463 ts -85 kw -26 ks -69 src/obc/1990/theorem/theorem.c</code></pre>
<p><code>ioc</code> is correct; cl is correct even in compat (91) due to
comments eating newlines <code>iocccsize</code> fails at
<code>z;/*/</code>, eating everything until the following
<code>/**/main(</code> looks to be due to mis-identification of a
comment closing block as opening block</p>
<p><code>ioc</code> is correct; cl is correct even in compat (91) due to comments eating newlines
<code>iocccsize</code> fails at <code>z;/*/</code>, eating everything until the following <code>/**/main(</code>
looks to be due to mis-identification of a comment closing block as opening block</p>
<pre><code>cl 0 cw -2 cc 0 ci 0 ts 0 kw 0 ks 0 src/obc/1991/westley/westley.c
cl 0 cw -3 cc 0 ci 0 ts 0 kw 0 ks 0 src/obc/1992/gmariano/gmariano.c
cl 0 cw -3 cc 0 ci 0 ts 0 kw 0 ks 0 src/obc/1992/gmariano/gmariano.orig.c
@@ -140,40 +136,36 @@ cl 0 cw -1 cc 0 ci 0 ts 0 kw 0 ks 0 src/obc/1994/shapiro/shapiro.
cl 0 cw -2 cc 0 ci 0 ts 0 kw 0 ks 0 src/obc/1996/gandalf/gandalf.c
cl 0 cw -1 cc 0 ci 0 ts 0 kw 0 ks 0 src/obc/1996/schweikh1/schweikh1.c
cl 0 cw -2 cc 0 ci -2 ts 0 kw 1 ks 2 src/obc/1998/df/df.c</code></pre>
<p><code>iocccsize</code> counts as keyword <code>__##int##__</code>,
and saving two characters but int is not a plausible keyword</p>
<p><code>iocccsize</code> counts as keyword <code>__##int##__</code>, and saving two characters but int
is not a plausible keyword</p>
<pre><code>cl 0 cw -1 cc 3 ci 2 ts 1 kw 0 ks 0 src/obc/2001/herrmann1/herrmann1.c</code></pre>
<p>the text:</p>
<pre><code> d M Y(O)/* state to */
d</code></pre>
<p>counts as cw 3 in iocccsize, but this is clearly 4 and the cc,ci,ts
is due entirely to:</p>
<p>counts as cw 3 in iocccsize, but this is clearly 4
and the cc,ci,ts is due entirely to:</p>
<pre><code> /*/*/*/*/*/ /*/*/
E E /*/*/*/*/*/,/) F</code></pre>
<p>which reduces to:</p>
<pre><code> * E E * ,/) F</code></pre>
<p>but iocccsize counts this as <code>* E E *,/) F</code>, whereas ANSI
C says comments are replaced with a single space equivalent
(non-portable token-paste with comments)</p>
<p>but iocccsize counts this as <code>* E E *,/) F</code>, whereas ANSI C says comments are
replaced with a single space equivalent (non-portable token-paste with comments)</p>
<pre><code>cl 0 cw -2 cc 0 ci 0 ts 0 kw 0 ks 0 src/obc/2004/arachnid/arachnid.c
cl 0 cw -2 cc 0 ci 0 ts 0 kw 0 ks 0 src/obc/2004/arachnid/arachnid.orig.c
cl 0 cw 0 cc 0 ci -4 ts 0 kw 2 ks 4 src/obc/2004/hoyle/hoyle.c
cl 0 cw 0 cc 0 ci -4 ts 0 kw 2 ks 4 src/obc/2004/hoyle/hoyle.orig.c</code></pre>
<p><code>iocccsize</code> counts as two keywords the token-pasted
<code>int##if</code>(e.g int1) thus the <code>kw 2</code>, and another
bug in <code>iocccsize</code> counts <code>#if</code> as a keyword to 1
thus saving 2 bytes on int, and 2 more on <code>#if</code>, when neither
is a plausible keyword</p>
<p><code>iocccsize</code> counts as two keywords the token-pasted <code>int##if</code>(e.g int1)
thus the <code>kw 2</code>, and another bug in <code>iocccsize</code> counts <code>#if</code> as a keyword to 1
thus saving 2 bytes on int, and 2 more on <code>#if</code>, when neither is a plausible keyword</p>
<pre><code>cl 0 cw -1 cc 0 ci 0 ts 0 kw 0 ks 0 src/obc/2004/omoikane/omoikane.c
cl 0 cw -1 cc 0 ci 0 ts 0 kw 0 ks 0 src/obc/2005/chia/chia.c
cl 0 cw -1 cc 0 ci 0 ts 0 kw 0 ks 0 src/obc/2005/mikeash/mikeash.c
cl 0 cw 0 cc 0 ci 1 ts 1 kw 0 ks 0 src/obc/2005/toledo/toledo.c
cl 0 cw 0 cc 0 ci 1 ts 1 kw 0 ks 0 src/obc/2005/toledo/toledo2.c
cl 0 cw 0 cc 0 ci 1 ts 1 kw 0 ks 0 src/obc/2005/toledo/toledo3.c</code></pre>
<p>these three discrepancies are due to backslash-newline of
<code>longjm\p</code> – at exactly the 521 byte line length boundary
(which is arbitrary) <code>ioc</code> is correct, because it has no line
length limit</p>
<p>these three discrepancies are due to backslash-newline of <code>longjm\p</code> –
at exactly the 521 byte line length boundary (which is arbitrary)
<code>ioc</code> is correct, because it has no line length limit</p>
<pre><code>cl 0 cw -4 cc 0 ci 0 ts 0 kw 0 ks 0 src/obc/2011/akari/akari.c
cl 0 cw -7 cc 0 ci 0 ts 0 kw 0 ks 0 src/obc/2011/hamaji/hamaji.c
cl 0 cw -4 cc 0 ci 0 ts 0 kw 0 ks 0 src/obc/2012/endoh1/endoh1.c
@@ -181,10 +173,9 @@ cl 0 cw -3 cc 0 ci 0 ts 0 kw 0 ks 0 src/obc/2012/endoh1/endoh1_co
cl 0 cw -1 cc 0 ci 0 ts 0 kw 0 ks 0 src/obc/2012/endoh1/endoh1_deobfuscate.c
cl 0 cw -2 cc 0 ci 0 ts 0 kw 0 ks 0 src/obc/2012/omoikane/nyaruko.c
cl 0 cw 0 cc 0 ci -3 ts 0 kw 1 ks 3 src/obc/2013/cable2/cable2.c</code></pre>
<p>this is due to token-pasting of <code>_##char</code>;
<code>iocccsize</code> counts this as a keyword but it is a
pre-processor token-pasted string of the arg to <code>Y()</code> and
char rendering this not a keyword, even in disguise</p>
<p>this is due to token-pasting of <code>_##char</code>; <code>iocccsize</code> counts this as a keyword
but it is a pre-processor token-pasted string of the arg to <code>Y()</code> and char
rendering this not a keyword, even in disguise</p>
<pre><code>cl 0 cw -2 cc 0 ci 0 ts 0 kw 0 ks 0 src/obc/2013/endoh4/endoh4.c
cl 0 cw -2 cc 0 ci 0 ts 0 kw 0 ks 0 src/obc/2013/misaka/misaka.c
cl 0 cw -1 cc 0 ci 0 ts 0 kw 0 ks 0 src/obc/2014/endoh2/prog.c
+220 -416
View File
@@ -130,8 +130,8 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Dave_Burton">Dave Burton</a><br>
Location: <a href="../../location.html#US">US</a> - <em>United States of
America</em> (<em>United States</em>) <br><br></li>
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -148,12 +148,11 @@ America</em> (<em>United States</em>) <br><br></li>
<p>If you get really stuck, try:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">man</span> ./tac.1</span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>They say size isn’t everything, and in the case of IOCCC <a
href="../../2018/iocccsize.c">iocccsize.c</a> that is saying something!
<p>They say size isn’t everything, and in the case of IOCCC
<a href="../../2018/iocccsize.c">iocccsize.c</a> that is saying something!
What is this program weighing and how much does it weigh?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="tac---tokenize-and-count-c-and-derivative-languages">tac -
tokenize and count C and derivative languages:</h3>
<h3 id="tac---tokenize-and-count-c-and-derivative-languages">tac - tokenize and count C and derivative languages:</h3>
<p><code>tac</code> computes C program size<br />
(obfuscated / otherwise)<br />
by splitting code as tokens small,<br />
@@ -195,107 +194,84 @@ a public place for all to see<br />
how badly I can butcher C!<br />
</p>
<h3 id="said-another-way.">Said another way….</h3>
<p><code>tac</code> is the inverse of <code>cat</code>(1): it
un-concatenates its input into C tokens, writing the token stream to
<code>stdout</code>. There are options to suppress the token ids,
summarize the token counts, and several options to allow it to be
<p><code>tac</code> is the inverse of <code>cat</code>(1): it un-concatenates its input into C tokens,
writing the token stream to <code>stdout</code>. There are options to suppress the token
ids, summarize the token counts, and several options to allow it to be
compatible with <code>iocccsize</code>.</p>
<p>The token-based output is quite useful in analyzing source code (see
below), and the counter is more accurate than <code>iocccsize</code>
(see below); but this can be fixed by using the <code>-c</code>
compatibility flag, restoring the following problems as in the official
tool:</p>
<p>The token-based output is quite useful in analyzing source code (see below),
and the counter is more accurate than <code>iocccsize</code> (see below); but this can be
fixed by using the <code>-c</code> compatibility flag, restoring the following problems as
in the official tool:</p>
<ul>
<li>Whitespace <strong>within</strong> a string is <strong>not</strong>
counted; this seems wrong, as these chars <strong>are</strong>
significant.</li>
<li>“<code>{;}</code>” is not counted within a double-quoted
string.</li>
<li>Whitespace preceding a comment is <code>char</code>-counted, unless
the comment starts a line.</li>
<li><code>-k</code> processes the reserved words within <code>//</code>
comments(!), but not <code>/*</code>, changing the counts.</li>
<li>Whitespace <strong>within</strong> a string is <strong>not</strong> counted;
this seems wrong, as these chars <strong>are</strong> significant.</li>
<li>“<code>{;}</code>” is not counted within a double-quoted string.</li>
<li>Whitespace preceding a comment is <code>char</code>-counted, unless the comment starts a
line.</li>
<li><code>-k</code> processes the reserved words within <code>//</code> comments(!), but not <code>/*</code>,
changing the counts.</li>
</ul>
<p>The following bugs are always corrected:</p>
<ul>
<li>Treats <code>/*/</code> as a complete comment
(<code>/*/int if for/*/</code> has three keywords)</li>
<li><code>-k</code> enables <code>//*</code> or within a line comment
<code>/*</code> to initiate a comment block until following
<code>*/</code></li>
<li><code>-k</code> processes double quote characters in <code>//</code>
comments - thus a solitary quote consumes everything until the next
quote</li>
<li>Single quotes are not handled correctly (<code>'"'</code> starts a
double quote in <code>iocccsize</code>)</li>
<li><code>#ifndef</code> is omitted as a keyword (but
<code>#ifdef</code> is allowed?)</li>
<li>Treats <code>/*/</code> as a complete comment (<code>/*/int if for/*/</code> has three keywords)</li>
<li><code>-k</code> enables <code>//*</code> or within a line comment <code>/*</code> to initiate a comment block until following <code>*/</code></li>
<li><code>-k</code> processes double quote characters in <code>//</code> comments - thus a solitary
quote consumes everything until the next quote</li>
<li>Single quotes are not handled correctly (<code>'"'</code> starts a double quote in <code>iocccsize</code>)</li>
<li><code>#ifndef</code> is omitted as a keyword (but <code>#ifdef</code> is allowed?)</li>
<li><code>I</code> is not a reserved word.</li>
<li><code>tac</code> correctly penetrates <a
href="../../2014/birken/index.html" title="Best use of port 1701">23rd
century cloaking technology</a>. ;-)</li>
<li><code>tac</code> correctly penetrates <a href="../../2014/birken/index.html" title="Best use of port 1701">23rd century cloaking technology</a>. ;-)</li>
</ul>
<p>There is one (known) remaining problem with detection:</p>
<ul>
<li>Comments between preprocessor hash and keyword are not replaced with
whitespace; the following counts #include as two tokens, <code>#</code>
and <code>include</code> (not as a reserved word):</li>
<li>Comments between preprocessor hash and keyword are not replaced with whitespace;
the following counts #include as two tokens, <code>#</code> and <code>include</code> (not as a reserved word):</li>
</ul>
<div class="sourceCode" id="cb5"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="pp">#</span><span class="er">/*this will not be counted*/include/*correctly*/&lt;stdio.h&gt;</span></span></code></pre></div>
<p>Fixing this properly hampers backwards compatibility in counting.
This requires eliding comments during the translation phases (ISO
5.1.1.2, phase 3), and yet still counting words correctly absent
<code>-k</code>.</p>
<p>Fixing this properly hampers backwards compatibility in counting. This requires
eliding comments during the translation phases (ISO 5.1.1.2, phase 3), and yet still
counting words correctly absent <code>-k</code>.</p>
<h3 id="backwards-compatibility">Backwards Compatibility:</h3>
<p><code>tac</code> was run over all 366 previous IOCCC winning
entries:</p>
<p><code>tac</code> was run over all 366 previous IOCCC winning entries:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">find</span> ~/src/obc <span class="at">-type</span> f <span class="at">-name</span> <span class="dt">\*</span>.c <span class="kw">|</span> <span class="fu">wc</span></span></code></pre></div>
<p>The discrepancies found are documented and explained in the file <a
href="discrepancies.html">discrepancies.html</a>.</p>
<p>The discrepancies found are documented and explained in the file
<a href="discrepancies.html">discrepancies.html</a>.</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="fu">find</span> ~/src/obc <span class="at">-type</span> f <span class="at">-a</span> <span class="at">-name</span> <span class="st">&quot;*.c&quot;</span> <span class="kw">|</span> <span class="fu">xargs</span> ./spotcheck.sh ./prog <span class="kw">|</span> <span class="ex">./spotdiff.sh</span> <span class="kw">|</span></span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">grep</span> <span class="at">-v</span> keep <span class="kw">|</span> <span class="fu">diff</span> <span class="at">-bw</span> <span class="at">-</span> discrep<span class="pp">*</span> <span class="kw">|</span> <span class="fu">grep</span> <span class="st">&quot;[&lt;&gt;] cl &quot;</span></span></code></pre></div>
<p>In summary, there are only 6 unique entries out of 366 that have any
variation in Rule 2 counts; in all cases, the differences are due to
bugs within <code>iocccsize</code>, described in detail in the file <a
href="discrepancies.html">discrepancies.html</a>. There are only 40
files (40/366, ~11%, including originals and variations) that differ at
all, 31 only in word count; most word count differences appear related
to comment block detection, weighted more towards recent entries (2011
and onward = 20/40 ~50%).</p>
<p>This (minor) variation in word count values has not been addressed
since it is not a qualifying metric, nor is it very useful in a
programming context: whitespace surrounds English words, not necessarily
C tokens, as in <code>a+=1;</code>.</p>
<p>Accuracy (versus compatibility) is demonstrated through a series of
small test cases designed to allow exhaustive, hand-counted values for
comparison with the tool values. These test cases were vital in
debugging and regression testing, and provided a way to determine which
tool was correct when there were differences.</p>
<p>In summary, there are only 6 unique entries out of 366 that have any variation
in Rule 2 counts; in all cases, the differences are due to bugs within
<code>iocccsize</code>, described in detail in the file
<a href="discrepancies.html">discrepancies.html</a>. There are only 40
files (40/366, ~11%, including originals and variations) that differ at all, 31
only in word count; most word count differences appear related to comment block
detection, weighted more towards recent entries (2011 and onward = 20/40 ~50%).</p>
<p>This (minor) variation in word count values has not been addressed since
it is not a qualifying metric, nor is it very useful in a programming context:
whitespace surrounds English words, not necessarily C tokens, as in <code>a+=1;</code>.</p>
<p>Accuracy (versus compatibility) is demonstrated through a series of small test cases
designed to allow exhaustive, hand-counted values for comparison with the tool values.
These test cases were vital in debugging and regression testing, and provided a way to
determine which tool was correct when there were differences.</p>
<blockquote>
<p>A version of this tool in more clearly written C (<a
href="tac.c">tac.c</a>) is presented for the Judge’s consideration as a
more accurate replacement for <code>iocccsize</code>. This obfuscated
entry is derived from (and compatible with) that code, but due to
obfuscation, has had some significant, deep changes for the contest.
Nevertheless, the more clearly written code remains a spoiler for this
entry.</p>
<p>A version of this tool in more clearly written C (<a href="tac.c">tac.c</a>)
is presented for the Judge’s consideration as a more accurate replacement for <code>iocccsize</code>.
This obfuscated entry is derived from (and compatible with) that code,
but due to obfuscation, has had some significant, deep changes for the contest.
Nevertheless, the more clearly written code remains a spoiler for this entry.</p>
</blockquote>
<p>NB: <code>iocccsize</code> gets a different answer from
<code>tac</code> on its own (<a
href="../../2018/iocccsize.c">iocccsize.c</a>) source code;
<code>tac</code> gets the correct answer. This is due to the
aforementioned bugs within <code>iocccsize</code>, proved by fixing <a
href="../../2018/iocccsize.c">iocccsize.c</a> with the included patch,
so <code>iocccsize</code> reports the correct answer for itself.</p>
<p>NB: <code>iocccsize</code> gets a different answer from <code>tac</code> on its own
(<a href="../../2018/iocccsize.c">iocccsize.c</a>) source code;
<code>tac</code> gets the correct answer. This is due to the aforementioned bugs within <code>iocccsize</code>,
proved by fixing
<a href="../../2018/iocccsize.c">iocccsize.c</a> with the included patch, so <code>iocccsize</code> reports
the correct answer for itself.</p>
<h3 id="but-wait-theres-more">But wait… There’s More!</h3>
<p>There is no limit on line length, file length, comment length, or
identifier length.</p>
<p><code>tac</code> features an accurate tokenizer; which presents each
C token on a line by itself. This feature enables interesting analyses
of C (and C++) code that’s hard to get any other way.</p>
<p>For instance, here is a simple token counter, useful in finding
repeated long tokens, or operator frequency, or counting the references
to identifiers, constants, or breadth of use of the language:</p>
<p>There is no limit on line length, file length, comment length, or identifier length.</p>
<p><code>tac</code> features an accurate tokenizer; which presents each C token on a line by itself.
This feature enables interesting analyses of C (and C++) code that’s hard to get any other way.</p>
<p>For instance, here is a simple token counter, useful in finding repeated long tokens, or operator
frequency, or counting the references to identifiers, constants, or breadth of use of the
language:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="co">#!/usr/bin/env bash</span></span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> <span class="va">$*</span> <span class="kw">|</span> <span class="ex">./prog</span> <span class="at">-t</span> <span class="kw">|</span> <span class="fu">sort</span> <span class="kw">|</span> <span class="fu">uniq</span> <span class="at">-c</span> <span class="kw">|</span> <span class="fu">sort</span> <span class="at">-k1nr</span></span></code></pre></div>
<p>And here is a C keyword frequency counter:</p>
@@ -304,11 +280,10 @@ to identifiers, constants, or breadth of use of the language:</p>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">awk</span> <span class="st">&#39;BEGIN{f=&quot;c11&quot;;while(getline&lt;f)k[$1]=0} {if($1 in k)k[$1]++}END{for(i in k)print k[i],i}&#39;</span></span>
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true" tabindex="-1"></a><span class="kw">}</span></span>
<span id="cb9-5"><a href="#cb9-5" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> <span class="va">$*</span> <span class="kw">|</span> <span class="ex">./prog</span> <span class="at">-t</span> <span class="kw">|</span> <span class="ex">iskeyword</span> <span class="kw">|</span> <span class="fu">sort</span> <span class="at">-k1nr</span></span></code></pre></div>
<p>This script was used to “optimize” the reserved word order so the
most frequent IOCCC winning entry keywords are checked first.</p>
<p>An interesting aside: as might be expected, obfuscation has changed
the frequency of keyword distribution over time. The top five for the
decades:</p>
<p>This script was used to “optimize” the reserved word order so the most frequent IOCCC
winning entry keywords are checked first.</p>
<p>An interesting aside: as might be expected, obfuscation has changed the frequency of
keyword distribution over time. The top five for the decades:</p>
<pre><code>1980s 1990s 2000s 2010s
----- ----- ----- -----
94 if 532 char 375 if 254 int
@@ -316,17 +291,14 @@ decades:</p>
59 while 417 int 332 int 198 if
48 char 223 for 184 for 121 return
43 int 223 void 165 return 104 char</code></pre>
<p>The keyword list is external to the program, and is easily changed,
sorted, checked, verified. This allows such additional programs in
concert with the tool’s primary operation.</p>
<p>A poor-man’s de-obfuscator can be based upon the output of
<code>tac -t</code> and a handful of simple rules (and another use of
the external keyword file). A more refined version of this is included
in the file <a href="unob.sh">unob.sh</a>, but the simple code below is
a serviceable obfuscated C de-obfuscator in a <em>scripting
<p>The keyword list is external to the program, and is easily changed, sorted, checked, verified.
This allows such additional programs in concert with the tool’s primary operation.</p>
<p>A poor-man’s de-obfuscator can be based upon the output of <code>tac -t</code> and a
handful of simple rules (and another use of the external keyword file). A more
refined version of this is included in the file <a href="unob.sh">unob.sh</a>, but the
simple code below is a serviceable obfuscated C de-obfuscator in a <em>scripting
language</em>. It really is this easy with <code>tac</code>:</p>
<div class="sourceCode" id="cb11"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="co">#!/usr/bin/env bash</span></span>
<div class="sourceCode" id="cb11"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="co">#!/usr/bin/env bash</span></span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a><span class="va">script</span><span class="op">=</span><span class="st">&#39;</span></span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a><span class="st">BEGIN {</span></span>
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a><span class="st"> last=nl=&quot;\n&quot;;</span></span>
@@ -367,363 +339,195 @@ class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#
<span id="cb11-39"><a href="#cb11-39" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> <span class="va">$*</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">&#39;s/#include/##include/&#39;</span> <span class="kw">|</span> <span class="fu">cpp</span> <span class="at">-E</span> <span class="at">-trigraphs</span> <span class="kw">|</span></span>
<span id="cb11-40"><a href="#cb11-40" aria-hidden="true" tabindex="-1"></a><span class="fu">sed</span> <span class="st">&#39;s/^# .*$//&#39;</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">&#39;s/^#//&#39;</span> <span class="kw">|</span></span>
<span id="cb11-41"><a href="#cb11-41" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="at">-t</span> <span class="kw">|</span> <span class="fu">awk</span> <span class="st">&quot;</span><span class="va">$script</span><span class="st">&quot;</span></span></code></pre></div>
<h3 id="on-the-question-of-obfuscation">On the question of
obfuscation:</h3>
<h3 id="on-the-question-of-obfuscation">On the question of obfuscation:</h3>
<ul>
<li><p>I assume you noticed the <a
href="https://www.youtube.com/watch?v=fUspLVStPbk&amp;start=53"
title="Meaning of Life">braces</a>?</p>
<li><p>I assume you noticed the <a href="https://www.youtube.com/watch?v=fUspLVStPbk&amp;start=53" title="Meaning of Life">braces</a>?</p>
<p><em>Every brace is sacred,<br />
Every brace is great.<br />
If a brace is wasted,<br />
Clang gets quite irate</em>.</p></li>
<li><p>Keywords follow the 2010s top five, without the <code>if</code>,
for interesting flow control.</p></li>
<li><p>Sometimes a <code>for</code> can be an <code>else</code> - <a
href="https://www.youtube.com/watch?v=OHVjs4aobqs"
title="Inconceivable">inconceivable</a>!</p></li>
<li><p>I see the <code>getopt(3)</code>. But “<a
href="https://www.youtube.com/watch?v=Ug75diEyiA0"
title="Where&#39;s the beef?">where’s the beef?</a>”</p></li>
<li><p>No character constants, several <code>int</code> constants, and
one string (hint: which does not encode letters) – how does this code
parse code?</p>
<li><p>Keywords follow the 2010s top five, without the <code>if</code>, for interesting flow control.</p></li>
<li><p>Sometimes a <code>for</code> can be an <code>else</code> - <a href="https://www.youtube.com/watch?v=OHVjs4aobqs" title="Inconceivable">inconceivable</a>!</p></li>
<li><p>I see the <code>getopt(3)</code>. But “<a href="https://www.youtube.com/watch?v=Ug75diEyiA0" title="Where&#39;s the beef?">where’s the beef?</a>”</p></li>
<li><p>No character constants, several <code>int</code> constants, and one string
(hint: which does not encode letters) – how does this code parse code?</p>
<ul>
<li><p>Interesting aside: how many is “several <code>int</code>
constants”?</p>
<p>./prog &lt; prog.c 2&gt;/dev/null | awk ‘$1~/260/{a[$2]++}END{for(i
in a)print i,a[i]}’ … | wc</p></li>
<li><p>Interesting aside: how many is “several <code>int</code> constants”?</p>
<p>./prog &lt; prog.c 2&gt;/dev/null | awk ‘$1~/260/{a[$2]++}END{for(i in a)print i,a[i]}’
… | wc</p></li>
</ul>
<p>Which numbers are most often used?</p>
<pre><code> ... | sort -k2nr | sed 5q</code></pre></li>
<li><p>The code describes its function by careful arrangement of
variables up front…</p></li>
<li><p>…coupled with a description of the typical IOCCC contestant, or
at least the author</p></li>
<li><p>The code describes its function by careful arrangement of variables up front…</p></li>
<li><p>…coupled with a description of the typical IOCCC contestant, or at least the author</p></li>
<li><p>Why shouldn’t trigraph parsing be written in trigraph?</p></li>
<li><p>Where <a href="../../2018/iocccsize.c">iocccsize.c</a> mocks,
this code flaunts: “<em>no matter how well you may think you understand
this code, you don’t, so don’t mess with it. :-)</em>”</p></li>
<li><p><code>O,0,l,1</code> are used to confusing effect, local names
obscure global names.</p></li>
<li><p>Globals are used to pass information between routines: don’t
reorder “unrelated” statements….</p></li>
<li><p>How does the compatibility mode account for the fundamentally
different manner of computation?</p></li>
<li><p>The algorithm is quite efficient; reserved word detection and
trigraph parsing particularly so.</p></li>
<li><p>This may be the first obfuscated submission that provides the
means for its own de-obfuscation.</p></li>
<li><p>Where <a href="../../2018/iocccsize.c">iocccsize.c</a> mocks, this code flaunts:
“<em>no matter how well you may think you understand this code, you don’t, so don’t mess with it. :-)</em>”</p></li>
<li><p><code>O,0,l,1</code> are used to confusing effect, local names obscure global names.</p></li>
<li><p>Globals are used to pass information between routines: don’t reorder “unrelated” statements….</p></li>
<li><p>How does the compatibility mode account for the fundamentally different manner of computation?</p></li>
<li><p>The algorithm is quite efficient; reserved word detection and trigraph parsing particularly so.</p></li>
<li><p>This may be the first obfuscated submission that provides the means for its own de-obfuscation.</p></li>
</ul>
<h3 id="rule-2">Rule 2:</h3>
<p>The keyword list is externalized as an include file. This presents a
useful feature for the source code: not only can the reserved word
script above be produced, but the tool can be rebuilt with any set of
reserved words, just by using a different list. For instance: removing
all the secondary keywords; removing all the C11 keywords; trying just
K&amp;R C. Since C++ and Java share the same operators as C, just change
the keyword list and <code>tac</code> will correctly tokenize both of
these; the tokens <code>&gt;&gt;&gt;</code> and <code>::</code> can be
handled with a short post-filter (<a href="tokenfix.sh">tokenfix.sh</a>,
included).</p>
<p>I believe this entry may also satisfy the request for gratuitous use
of all the C11 keywords? Whether this context satisfies “intended C
language context” is a matter of interpretation. ;-) And
<code>tac</code> is ready for the IOCCC++ contest. And the IOJCC trash
can.</p>
<p>The keyword list is externalized as an include file. This presents a useful
feature for the source code: not only can the reserved word script above be
produced, but the tool can be rebuilt with any set of reserved words, just by
using a different list. For instance: removing all the secondary keywords;
removing all the C11 keywords; trying just K&amp;R C. Since C++ and Java share the
same operators as C, just change the keyword list and <code>tac</code> will correctly
tokenize both of these; the tokens <code>&gt;&gt;&gt;</code> and <code>::</code> can be handled with a short
post-filter (<a href="tokenfix.sh">tokenfix.sh</a>, included).</p>
<p>I believe this entry may also satisfy the request for gratuitous use of all the
C11 keywords? Whether this context satisfies “intended C language context” is a
matter of interpretation. ;-) And <code>tac</code> is ready for the IOCCC++ contest. And
the IOJCC trash can.</p>
<p>The following reserved word files are included:</p>
<ul>
<li><a href="kandr">kandr</a> from my venerable 1978 18th printing “The
C Programming Language”</li>
<li><a href="v7unix">v7unix</a> 7th edition Unix source code, extracted
from c00.c</li>
<li><a href="kandr2">kandr2</a> from my 1988 1st printing “The C
Programming Language”, 2e</li>
<li><a href="kandr">kandr</a> from my venerable 1978 18th printing “The C Programming Language”</li>
<li><a href="v7unix">v7unix</a> 7th edition Unix source code, extracted from c00.c</li>
<li><a href="kandr2">kandr2</a> from my 1988 1st printing “The C Programming Language”, 2e</li>
<li><a href="ansi">ansi</a> ANSI X3.159-1989</li>
<li><a href="c99">c99</a> ISO/IEC 9899:1999(E)</li>
<li><a href="c11">c11</a> ISO/IEC 9899:201x(E) N1570</li>
<li><a href="c++98">c++98</a>
http://en.cppreference.com/w/cpp/keyword</li>
<li><a href="c++11">c++11</a> ISO/IEC 14882:2011(E) N3337
2012-01-16</li>
<li><a href="c++14">c++14</a> ISO/IEC 14882:2014(E) N4296
2014-11-09</li>
<li><a href="java8">java8</a> <a
href="http://docs.oracle.com/javase/specs/index.html"
class="uri">http://docs.oracle.com/javase/specs/index.html</a></li>
<li><a href="ioccc.kw.freq">ioccc.kw.freq</a> c11 + additional words,
sorted on frequency of occurrence in IOCCC entries</li>
<li><a href="c++98">c++98</a> http://en.cppreference.com/w/cpp/keyword</li>
<li><a href="c++11">c++11</a> ISO/IEC 14882:2011(E) N3337 2012-01-16</li>
<li><a href="c++14">c++14</a> ISO/IEC 14882:2014(E) N4296 2014-11-09</li>
<li><a href="java8">java8</a> <a href="http://docs.oracle.com/javase/specs/index.html" class="uri">http://docs.oracle.com/javase/specs/index.html</a></li>
<li><a href="ioccc.kw.freq">ioccc.kw.freq</a> c11 + additional words, sorted on frequency of occurrence in IOCCC entries</li>
</ul>
<p>NB: The keyword file used in this code is derived from the list in <a
href="../../2018/iocccsize.c">iocccsize.c</a>, which is neither complete
(<code>#define</code>, <code>#ifndef</code>, <code>#undef</code> are
missing – yes, Virginia knows about <code>#define</code> omitted on
purpose), nor correct (many more are added: <code>I</code>,
<code>true</code>, <code>bool</code>, <code>compl</code>, …):</p>
<div class="sourceCode" id="cb13"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="kw">(</span><span class="fu">sed</span> <span class="at">-n</span> <span class="st">&#39;1p&#39;</span> c11<span class="kw">;</span> <span class="fu">sed</span> <span class="at">-n</span> <span class="st">&#39;2,$p&#39;</span> ioccc.kw.freq <span class="kw">|</span> <span class="fu">sort</span><span class="kw">)</span> <span class="kw">|</span> <span class="fu">comm</span> <span class="at">-3</span> <span class="at">-</span> c11</span></code></pre></div>
<p>That is an obfuscated way to say “diff”. But it also more clearly
shows the, um, diffs.</p>
<p>The usage string is similarly externalized, providing a better
usability string than the limits would otherwise allow. If this is
considered bending the rules too far, just <code>-DU=O</code> to get a
passible, if cryptic, usage message using no additional octets than
without the define. This also allows the builder to configure the amount
of help a utility should provide (<a
href="https://www.youtube.com/watch?v=VU0GYSA1POs" title="Ants">you want
a manpage? Because that’s how you get a manpage.</a>) – a rather
<p>NB: The keyword file used in this code is derived from the list in <a href="../../2018/iocccsize.c">iocccsize.c</a>,
which is neither complete (<code>#define</code>, <code>#ifndef</code>, <code>#undef</code> are missing
– yes, Virginia knows about <code>#define</code> omitted on purpose),
nor correct (many more are added: <code>I</code>, <code>true</code>, <code>bool</code>, <code>compl</code>, …):</p>
<div class="sourceCode" id="cb13"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="kw">(</span><span class="fu">sed</span> <span class="at">-n</span> <span class="st">&#39;1p&#39;</span> c11<span class="kw">;</span> <span class="fu">sed</span> <span class="at">-n</span> <span class="st">&#39;2,$p&#39;</span> ioccc.kw.freq <span class="kw">|</span> <span class="fu">sort</span><span class="kw">)</span> <span class="kw">|</span> <span class="fu">comm</span> <span class="at">-3</span> <span class="at">-</span> c11</span></code></pre></div>
<p>That is an obfuscated way to say “diff”. But it also more clearly shows the, um, diffs.</p>
<p>The usage string is similarly externalized, providing a better usability string than
the limits would otherwise allow. If this is considered bending the rules too far,
just <code>-DU=O</code> to get a passible, if cryptic, usage message using no additional octets
than without the define.
This also allows the builder to configure the amount of help a utility should provide
(<a href="https://www.youtube.com/watch?v=VU0GYSA1POs" title="Ants">you want a manpage? Because that’s how you get a manpage.</a>) – a rather
significant point of contention made moot.</p>
<p>There is definitely abuse of the Rule2 counter, exploiting a
“feature” of <code>iocccsize</code>: <code>iocccsize</code> does not
Rule2 count <code>{</code>, <code>}</code> and <code>;</code> when
followed by whitespace – even within a string! Thus: Freecode, a simple,
uncounted, highly obfuscated encoding of a central part of this program.
(The reserved word list is not Freecoded, both because it is useful
apart from the program, and because Freecode is not entirely free.)</p>
<p>There is definitely abuse of the Rule2 counter, exploiting a “feature” of
<code>iocccsize</code>: <code>iocccsize</code> does not Rule2 count <code>{</code>, <code>}</code> and <code>;</code> when followed by
whitespace – even within a string! Thus: Freecode, a simple, uncounted, highly
obfuscated encoding of a central part of this program. (The reserved word list
is not Freecoded, both because it is useful apart from the program, and because
Freecode is not entirely free.)</p>
<ul>
<li>Some restrictions apply. Not approved for all uses. Some assembly
required.</li>
<li>Some restrictions apply. Not approved for all uses. Some assembly required.</li>
</ul>
<h3 id="compilation">Compilation:</h3>
<p>The code is ANSI compliant, but it does have a string longer than 509
characters. It has been tested on OSX and Linux, Clang and GCC.</p>
<p>The code uses trigraphs, ironically: it parses trigraphs with
trigraph code. Because that’s funny. And it remains obscure after, so
trigraphs are not used for obfuscation. Thus
<code>-trigraphs -Wno-trigraphs</code> (which is also humorous).</p>
<p>It’s obfuscated C. Thus
<code>-Wno-parentheses -Wno-empty-body -Wno-char-subscripts</code>.</p>
<p>The code uses <code>unsigned char</code>s, but C strings are
<code>signed</code>. Thus <code>-Wno-pointer-sign</code>. NB: This is
<em>not</em> a portability concern, the one string holds only printable
ASCII characters.</p>
<p>The code is ANSI compliant, but it does have a string longer than 509 characters.
It has been tested on OSX and Linux, Clang and GCC.</p>
<p>The code uses trigraphs, ironically: it parses trigraphs with trigraph code.
Because that’s funny. And it remains obscure after, so trigraphs are not used
for obfuscation. Thus <code>-trigraphs -Wno-trigraphs</code> (which is also humorous).</p>
<p>It’s obfuscated C. Thus <code>-Wno-parentheses -Wno-empty-body -Wno-char-subscripts</code>.</p>
<p>The code uses <code>unsigned char</code>s, but C strings are <code>signed</code>. Thus <code>-Wno-pointer-sign</code>.
NB: This is <em>not</em> a portability concern, the one string holds only printable ASCII characters.</p>
<p>Thus:</p>
<div class="sourceCode" id="cb14"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> <span class="at">-ansi</span> <span class="at">-Wall</span> <span class="at">-trigraphs</span> <span class="at">-Wno-trigraphs</span> <span class="at">-Wno-parentheses</span> <span class="at">-Wno-empty-body</span> <span class="at">-Wno-char-subscripts</span> <span class="at">-Wno-pointer-sign</span> <span class="at">-DU</span><span class="op">=</span>O <span class="at">-DW</span><span class="op">=</span><span class="dt">\&quot;</span>keywords<span class="dt">\&quot;</span> <span class="at">-o</span> prog prog.c</span></code></pre></div>
<div class="sourceCode" id="cb14"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> <span class="at">-ansi</span> <span class="at">-Wall</span> <span class="at">-trigraphs</span> <span class="at">-Wno-trigraphs</span> <span class="at">-Wno-parentheses</span> <span class="at">-Wno-empty-body</span> <span class="at">-Wno-char-subscripts</span> <span class="at">-Wno-pointer-sign</span> <span class="at">-DU</span><span class="op">=</span>O <span class="at">-DW</span><span class="op">=</span><span class="dt">\&quot;</span>keywords<span class="dt">\&quot;</span> <span class="at">-o</span> prog prog.c</span></code></pre></div>
<h3 id="coda">Coda:</h3>
<p><a href="../../authors.html#Cody_Boone_Ferguson">Cody Boone
Ferguson</a> was relentless in his pursuit of bugs. Thanks to his
reports, the version of <a href="unob.sh">unob.sh</a> is stronger,
<code>tac</code> groks digraphs, <a href="tokenfix.sh">tokenfix.sh</a>
corrects for missing digraphs in <a href="prog.c">prog.c</a>, and the
program <a href="manpage.sh">manpage.sh</a> was added to the corpus.</p>
<p><a href="manpage.sh">manpage.sh</a> is a useful program that turns
ASCII versions of man pages (e.g. <a href="tac.man">tac.man</a>) into
real man pages. It works for C and C-like languages, command lines, and
was designed to handle man page sections 1-8. It works well on most
inputs, but tends to need some raw nroff for more fancy constructions,
such as combined arguments (e.g. the <code>-r</code> and <code>-s</code>
arguments to tac are not recognised when written as <code>-rs</code> in
prose).</p>
<p><a href="../../authors.html#Cody_Boone_Ferguson">Cody Boone Ferguson</a> was relentless in his pursuit of bugs.
Thanks to his reports, the version of <a href="unob.sh">unob.sh</a> is stronger,
<code>tac</code> groks digraphs, <a href="tokenfix.sh">tokenfix.sh</a> corrects for missing digraphs
in <a href="prog.c">prog.c</a>, and the program <a href="manpage.sh">manpage.sh</a> was added to the corpus.</p>
<p><a href="manpage.sh">manpage.sh</a> is a useful program that turns ASCII versions of man
pages (e.g. <a href="tac.man">tac.man</a>) into real man pages. It works for C and C-like
languages, command lines, and was designed to handle man page sections 1-8. It
works well on most inputs, but tends to need some raw nroff for more fancy
constructions, such as combined arguments (e.g. the <code>-r</code> and <code>-s</code> arguments to tac
are not recognised when written as <code>-rs</code> in prose).</p>
<p>Try:</p>
<div class="sourceCode" id="cb15"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./manpage.sh</span> tac</span>
<div class="sourceCode" id="cb15"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./manpage.sh</span> tac</span>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-3"><a href="#cb15-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./manpage.sh</span> <span class="at">-h</span></span>
<span id="cb15-4"><a href="#cb15-4" aria-hidden="true" tabindex="-1"></a><span class="ex">./manpage.sh</span> <span class="at">-h</span> <span class="kw">|</span> <span class="ex">./manpage.sh</span></span>
<span id="cb15-5"><a href="#cb15-5" aria-hidden="true" tabindex="-1"></a><span class="ex">./manpage.sh</span> <span class="at">-h</span> <span class="kw">|</span> <span class="ex">./manpage.sh</span> <span class="at">-R</span> <span class="kw">|</span> <span class="fu">less</span></span>
<span id="cb15-6"><a href="#cb15-6" aria-hidden="true" tabindex="-1"></a><span class="ex">./manpage.sh</span> <span class="at">-h</span> <span class="kw">|</span> <span class="ex">./manpage.sh</span> <span class="at">-P</span> <span class="kw">|</span> <span class="fu">lpr</span></span></code></pre></div>
<p>NOTE: in 2023 the <code>tac.man</code> was updated to proper man
format and renamed <a href="tac.1">tac.1</a>.</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
Reserved. You are free to share and adapt this file under the terms of
this license:</p>
<p>NOTE: in 2023 the <code>tac.man</code> was updated to proper man format and renamed
<a href="tac.1">tac.1</a>.</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:</p>
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
<p>For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/</p>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2018burton2"><a name="inventory"></a>Inventory for
2018/burton2</h1>
<h1 id="inventory-for-2018burton2"><a name="inventory"></a>Inventory for 2018/burton2</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/prog.c">prog.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a href="discrepancies.html">discrepancies.html</a> - field-by-field
difference between iocccsize and ion</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/freqcount.sh">freqcount.sh</a>
- frequency count utility</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/tac.1">tac.1</a>
- tokenize and count man page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/tokcount.sh">tokcount.sh</a>
- count the tokens produced by prog -t</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/try.sh">try.sh</a>
- how to run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/fixed_iocccsize.c">fixed_iocccsize.c</a>
- iocccsize with patch applied</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/ioc_without_quote">ioc_without_quote</a>
- test suite data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/ioccc.kw.freq">ioccc.kw.freq</a>
- iocccsize keywords: sorted by 201x frequency</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/iocccbug01.c">iocccbug01.c</a>
- test cases demonstrating problems with iocccsize</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/iocccbug02.c">iocccbug02.c</a>
- test cases demonstrating problems with iocccsize</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/iocccbug03.c">iocccbug03.c</a>
- test cases demonstrating problems with iocccsize</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/iocccbug04.c">iocccbug04.c</a>
- test cases demonstrating problems with iocccsize</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/iocccbug05.c">iocccbug05.c</a>
- test cases demonstrating problems with iocccsize</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/iocccbug06.c">iocccbug06.c</a>
- test cases demonstrating problems with iocccsize</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/manpage.sh">manpage.sh</a>
- turns ASCII versions of man into real man pages</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/mkkeywords.sh">mkkeywords.sh</a>
- reads a file from variations produces string for prog.c</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/results.k">results.k</a>
- results with -k</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/tac.c">tac.c</a>
- tokenize and count C-like languages</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test01.c">test01.c</a>
- test case source code</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test02.c">test02.c</a>
- test case source code</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test03.c">test03.c</a>
- test case source code</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test04.c">test04.c</a>
- test case source code</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test05.c">test05.c</a>
- test case source code</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test06.c">test06.c</a>
- test case source code</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test07.c">test07.c</a>
- test case source code</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test08.c">test08.c</a>
- test case source code</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test09.c">test09.c</a>
- test case source code</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test10.c">test10.c</a>
- test case source code</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test11.c">test11.c</a>
- test case source code</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test12.c">test12.c</a>
- test case source code</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test13.c">test13.c</a>
- test case source code</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test14.c">test14.c</a>
- test case source code</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/tokenfix.sh">tokenfix.sh</a>
- short post-filter</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/unob.sh">unob.sh</a>
- refined version of de-obfuscator</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/ansi">ansi</a>
- reserved words for a given C standard</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/author-README.txt">author-README.txt</a>
- author supplied README</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/c++11">c++11</a>
- reserved words for a given C standard</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/c++14">c++14</a>
- reserved words for a given C standard</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/c++98">c++98</a>
- reserved words for a given C standard</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/c11">c11</a>
- reserved words for a given C standard</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/c99">c99</a>
- reserved words for a given C standard</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/java8">java8</a>
- reserved words for a Java v8</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/kandr2">kandr2</a>
- reserved words for a given C standard</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/kandr">kandr</a>
- reserved words for a given C standard</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/patch">patch</a>
- patch to fix iocccsize source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/results">results</a>
- results without -k</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/runtest.sh">runtest.sh</a>
- test suite</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/spotcheck.sh">spotcheck.sh</a>
- script to test a lot of files vs iocccsize</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/v7unix">v7unix</a>
- reserved words for a given C standard</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/spotdiff.sh">spotdiff.sh</a>
- summarize the results of spotcheck</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/src.doc.txt">src.doc.txt</a>
- SPOILER WARNING hints about the source</li>
<li><a href="2018_burton2.tar.bz2">2018_burton2.tar.bz2</a> - download
entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/prog.c">prog.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/prog.orig.c">prog.orig.c</a> - original source</li>
<li><a href="discrepancies.html">discrepancies.html</a> - field-by-field difference between iocccsize and ion</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/freqcount.sh">freqcount.sh</a> - frequency count utility</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/tac.1">tac.1</a> - tokenize and count man page</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/tokcount.sh">tokcount.sh</a> - count the tokens produced by prog -t</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/try.sh">try.sh</a> - how to run</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/fixed_iocccsize.c">fixed_iocccsize.c</a> - iocccsize with patch applied</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/ioc_without_quote">ioc_without_quote</a> - test suite data</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/ioccc.kw.freq">ioccc.kw.freq</a> - iocccsize keywords: sorted by 201x frequency</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/iocccbug01.c">iocccbug01.c</a> - test cases demonstrating problems with iocccsize</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/iocccbug02.c">iocccbug02.c</a> - test cases demonstrating problems with iocccsize</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/iocccbug03.c">iocccbug03.c</a> - test cases demonstrating problems with iocccsize</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/iocccbug04.c">iocccbug04.c</a> - test cases demonstrating problems with iocccsize</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/iocccbug05.c">iocccbug05.c</a> - test cases demonstrating problems with iocccsize</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/iocccbug06.c">iocccbug06.c</a> - test cases demonstrating problems with iocccsize</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/manpage.sh">manpage.sh</a> - turns ASCII versions of man into real man pages</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/mkkeywords.sh">mkkeywords.sh</a> - reads a file from variations produces string for prog.c</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/results.k">results.k</a> - results with -k</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/tac.c">tac.c</a> - tokenize and count C-like languages</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test01.c">test01.c</a> - test case source code</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test02.c">test02.c</a> - test case source code</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test03.c">test03.c</a> - test case source code</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test04.c">test04.c</a> - test case source code</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test05.c">test05.c</a> - test case source code</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test06.c">test06.c</a> - test case source code</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test07.c">test07.c</a> - test case source code</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test08.c">test08.c</a> - test case source code</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test09.c">test09.c</a> - test case source code</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test10.c">test10.c</a> - test case source code</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test11.c">test11.c</a> - test case source code</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test12.c">test12.c</a> - test case source code</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test13.c">test13.c</a> - test case source code</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/test14.c">test14.c</a> - test case source code</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/tokenfix.sh">tokenfix.sh</a> - short post-filter</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/unob.sh">unob.sh</a> - refined version of de-obfuscator</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/ansi">ansi</a> - reserved words for a given C standard</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/author-README.txt">author-README.txt</a> - author supplied README</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/c++11">c++11</a> - reserved words for a given C standard</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/c++14">c++14</a> - reserved words for a given C standard</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/c++98">c++98</a> - reserved words for a given C standard</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/c11">c11</a> - reserved words for a given C standard</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/c99">c99</a> - reserved words for a given C standard</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/java8">java8</a> - reserved words for a Java v8</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/kandr2">kandr2</a> - reserved words for a given C standard</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/kandr">kandr</a> - reserved words for a given C standard</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/patch">patch</a> - patch to fix iocccsize source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/results">results</a> - results without -k</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/runtest.sh">runtest.sh</a> - test suite</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/spotcheck.sh">spotcheck.sh</a> - script to test a lot of files vs iocccsize</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/v7unix">v7unix</a> - reserved words for a given C standard</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/spotdiff.sh">spotdiff.sh</a> - summarize the results of spotcheck</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/src.doc.txt">src.doc.txt</a> - SPOILER WARNING hints about the source</li>
<li><a href="2018_burton2.tar.bz2">2018_burton2.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/README.md">README.md</a>
- markdown source for index.html</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/discrepancies.md">discrepancies.md</a>
- markdown source for discrepancies.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/README.md">README.md</a> - markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/discrepancies.md">discrepancies.md</a> - markdown source for discrepancies.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+109 -172
View File
@@ -130,8 +130,8 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Marcin_Ciura">Marcin Ciura</a><br>
Location: <a href="../../location.html#PL">PL</a> - <em>Republic of
Poland</em> (<em>Poland</em>) <br><br></li>
Location: <a href="../../location.html#PL">PL</a> - <em>Republic of Poland</em> (<em>Poland</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -141,17 +141,16 @@ Poland</em> (<em>Poland</em>) <br><br></li>
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<p>There is an alternate version that lacks a useful bug fix. See <a
href="#alternate-code">Alternate code</a> and the author’s remarks (<a
href="#remarks">remarks section</a>) below for more details.</p>
<p>There is an alternate version that lacks a useful bug fix. See <a href="#alternate-code">Alternate
code</a> and the author’s remarks (<a href="#remarks">remarks section</a>)
below for more details.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">&lt;</span> text</span></code></pre></div>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<h2 id="alternate-code">Alternate code:</h2>
<p>An alternate version of this entry, <a
href="prog.alt.c">prog.alt.c</a>, is provided. As mentioned in the
author’s <a href="#remarks">remarks</a>, the alternate version lacks a
<p>An alternate version of this entry, <a href="prog.alt.c">prog.alt.c</a>, is provided. As
mentioned in the author’s <a href="#remarks">remarks</a>, the alternate version lacks a
useful bug fix.</p>
<h3 id="alternate-build">Alternate build:</h3>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
@@ -162,65 +161,60 @@ useful bug fix.</p>
<p>Do you spot the fix by running both <a href="try.sh">try.sh</a> and
<a href="try.alt.sh">try.alt.sh</a>?</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This text was processed by <code>prog</code>. You may get confused.
We’re not really sure: <a href="prog.c">prog.c</a> wasn’t commented. Who
has been thoroughly puzzled by <code>prog</code>? Also how obfuscated is
<code>prog</code>? Having been written in C, how large of a vocabulary
has it?</p>
<p>This text was processed by <code>prog</code>. You may get confused. We’re not really sure:
<a href="prog.c">prog.c</a> wasn’t commented. Who has been thoroughly puzzled by <code>prog</code>?
Also how obfuscated is <code>prog</code>? Having been written in C, how large of a
vocabulary has it?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="the-program">The Program:</h3>
<p>“The Elements of Style” by Prof. William Strunk, Jr. and E. B. White
is well known for its dislike of the passive voice. Direct, vigorous,
active constructions were instead recommended by the authors. The
development of this program has been driven by this tenet.</p>
<p>Only passive sentences from the standard input are output. The
offending part(s) of each sentence will be highlighted. Several kinds of
passive constructions are recognized:</p>
active constructions were instead recommended by the authors.
The development of this program has been driven by this tenet.</p>
<p>Only passive sentences from the standard input are output. The offending
part(s) of each sentence will be highlighted. Several kinds of passive
constructions are recognized:</p>
<ul>
<li>Plain passive voice. Foo was bazzed by bar.</li>
<li>Passive voice with “get”. I got almost quuxed.</li>
<li>Contractions. I’m not really quuxed: foo wasn’t bazzed.</li>
<li>Questions. Who has been quuxed? Was foo indeed bazzed? How was it
bazzed?</li>
<li>Clause-initial inversion. Also bazzed is bar.</li>
<li>Plain passive voice.
Foo was bazzed by bar.</li>
<li>Passive voice with “get”.
I got almost quuxed.</li>
<li>Contractions.
I’m not really quuxed: foo wasn’t bazzed.</li>
<li>Questions.
Who has been quuxed? Was foo indeed bazzed? How was it bazzed?</li>
<li>Clause-initial inversion.
Also bazzed is bar.</li>
</ul>
<p>Sentences are never broken by periods that follow abbreviations and
initials. Both regular and irregular past participles are properly dealt
with. Note that some words are red herrings: even though their ending is
<code>-ed</code>, they are not past participles.</p>
initials. Both regular and irregular past participles are properly
dealt with. Note that some words are red herrings: even though their
ending is <code>-ed</code>, they are not past participles.</p>
<h3 id="the-big-string">The Big String:</h3>
<p>Here is the purpose of every byte inside the <code>c[]</code>
string:</p>
<p>Here is the purpose of every byte inside the <code>c[]</code> string:</p>
<ul>
<li><code>0-9</code>: highlighting passive constructions in the
output.</li>
<li><code>10-50</code>: classifying characters - called by
<code>V(4)</code>.</li>
<li><code>0-9</code>: highlighting passive constructions in the output.</li>
<li><code>10-50</code>: classifying characters - called by <code>V(4)</code>.</li>
<li><code>52</code>: outputting the newline character.</li>
<li><code>51-187</code>: tokenizing text and detecting passive
constructions - two type A state machines, called by <code>V(2)</code>
and <code>V(3)</code>.</li>
<li><code>186-2786</code>: determining word categories (past
participles, present simple and past simple forms of “to be”, other
forms of “to be”, adverbs, wh-words, and other words) and recognizing
abbreviations - two type B state machines, called by <code>V(808)</code>
and <code>V(205)</code>.</li>
<li><code>51-187</code>: tokenizing text and detecting passive constructions - two type A
state machines, called by <code>V(2)</code> and <code>V(3)</code>.</li>
<li><code>186-2786</code>: determining word categories (past participles, present simple and
past simple forms of “to be”, other forms of “to be”, adverbs, wh-words, and
other words) and recognizing abbreviations - two type B state machines, called
by <code>V(808)</code> and <code>V(205)</code>.</li>
</ul>
<h3 id="the-state-machines">The State Machines:</h3>
<p>I heard you don’t like state machines so I put a state machine in
your state machine so you can reject this entry while you reject this
entry.</p>
<p>Both types of state machines in the program are Mealy machines: we
can think of their transitions as triples
(<code>transition_label</code>, <code>next_state</code>,
<code>output</code>).</p>
<p>I heard you don’t like state machines so I put a state machine in your
state machine so you can reject this entry while you reject this entry.</p>
<p>Both types of state machines in the program are Mealy machines: we can
think of their transitions as triples (<code>transition_label</code>,
<code>next_state</code>, <code>output</code>).</p>
<h3 id="type-a">Type A:</h3>
<p>A state of type A state machine consists of eight transitions whose
representations occupy consecutive bytes. The byte
<code>c[3 + 8*state + transition_label]</code> contains
<code>(unsigned char)(30 + 5*next_state + output)</code>.</p>
<p>The <code>transition_label</code> is either one of character
classes:</p>
<p>The <code>transition_label</code> is either one of character classes:</p>
<ul>
<li><code>nil</code> = 0,</li>
<li><code>space</code> = 1,</li>
@@ -238,8 +232,7 @@ classes:</p>
<li><code>past_participle</code> = 3,</li>
<li><code>to_be</code> = 4,</li>
<li><code>are_were</code> = 5,</li>
<li><code>wh_word</code> = 6 (cf. the <code>output</code> of type B
state machines).</li>
<li><code>wh_word</code> = 6 (cf. the <code>output</code> of type B state machines).</li>
</ul>
<p>The <code>output</code> is either one of:</p>
<ul>
@@ -258,40 +251,27 @@ state machines).</li>
<p>Type A state machines run continuously. Their state is kept in
<code>k[2]</code> and <code>k[3]</code>.</p>
<p>Below are sample steps of scanning a sequence of characters with
classes <code>uppercase</code>, <code>lowercase</code>,
<code>period</code>, <code>space</code>, and <code>uppercase</code>.</p>
classes <code>uppercase</code>, <code>lowercase</code>, <code>period</code>, <code>space</code>,
and <code>uppercase</code>.</p>
<ul>
<li><code>state</code> = 7, <code>transition_label</code> = 3
(<code>uppercase</code>), <code>output</code> =
<code>sentence_start</code></li>
<li><code>state</code> = 14, <code>transition_label</code> = 4
(<code>lowercase</code>), <code>output</code> = <code>ignore</code></li>
<li><code>state</code> = 15, <code>transition_label</code> = 5
(<code>period</code>), <code>output</code> = <code>token_end</code></li>
<li><code>state</code> = 13, <code>transition_label</code> = 1
(<code>space</code>), <code>output</code> = <code>token_end</code></li>
<li><code>state</code> = 18, <code>transition_label</code> = 3
(<code>uppercase</code>), <code>output</code> =
<code>sentence_end</code></li>
<li><code>state</code> = 7, <code>transition_label</code> = 3 (<code>uppercase</code>), <code>output</code> = <code>sentence_start</code></li>
<li><code>state</code> = 14, <code>transition_label</code> = 4 (<code>lowercase</code>), <code>output</code> = <code>ignore</code></li>
<li><code>state</code> = 15, <code>transition_label</code> = 5 (<code>period</code>), <code>output</code> = <code>token_end</code></li>
<li><code>state</code> = 13, <code>transition_label</code> = 1 (<code>space</code>), <code>output</code> = <code>token_end</code></li>
<li><code>state</code> = 18, <code>transition_label</code> = 3 (<code>uppercase</code>), <code>output</code> = <code>sentence_end</code></li>
</ul>
<p>And here are sample steps of scanning tokens with classes
<code>to_be</code>, <code>adverb</code>,
<code>past_participle</code>.</p>
<p>And here are sample steps of scanning tokens with classes <code>to_be</code>,
<code>adverb</code>, <code>past_participle</code>.</p>
<ul>
<li><code>state</code> = 8, <code>transition_label</code> = 4
(<code>to_be</code>), <code>output</code> =
<code>passive_construction_start</code></li>
<li><code>state</code> = 22, <code>transition_label</code> = 0
(<code>adverb</code>), <code>output</code> = <code>ignore</code></li>
<li><code>state</code> = 22, <code>transition_label</code> = 3
(<code>past_participle</code>), <code>output</code> =
<code>passive_construction_end</code></li>
<li><code>state</code> = 8, <code>transition_label</code> = 4 (<code>to_be</code>), <code>output</code> = <code>passive_construction_start</code></li>
<li><code>state</code> = 22, <code>transition_label</code> = 0 (<code>adverb</code>), <code>output</code> = <code>ignore</code></li>
<li><code>state</code> = 22, <code>transition_label</code> = 3 (<code>past_participle</code>), <code>output</code> = <code>passive_construction_end</code></li>
</ul>
<h3 id="type-b">Type B:</h3>
<p>Type B state machines are built by a variant of the algorithm
described in the paper <a href="lexicon.pdf">How to squeeze a lexicon
(PDF)</a>. Their states are represented as interlaced sparse arrays of
transitions.</p>
<p>Type B state machines are built by a variant of the algorithm described
in the paper
<a href="lexicon.pdf">How to squeeze a lexicon (PDF)</a>.
Their states are represented as interlaced sparse arrays of transitions.</p>
<p>The <code>transition_label</code> is one of:</p>
<ul>
<li><code>word_start</code> = 0,</li>
@@ -313,8 +293,7 @@ transitions.</p>
<li><code>ignore</code> = 1,</li>
<li><code>abbreviation</code> = 2.</li>
</ul>
<p>The byte <code>c[186 + (state + transition_label)]</code> =
<code>(unsigned char)(2 + transition_label + 28 * output)</code>.</p>
<p>The byte <code>c[186 + (state + transition_label)]</code> = <code>(unsigned char)(2 + transition_label + 28 * output)</code>.</p>
<p>The byte <code>c[836 + 2*(state + transition_label)]</code> =</p>
<ul>
<li><code>' '</code> when <code>next_state / 376 == 0</code>,</li>
@@ -327,128 +306,86 @@ transitions.</p>
<li><code>'{'</code> when <code>next_state / 94 % 4 == 2</code>,</li>
<li><code>'}'</code> when <code>next_state / 94 % 4 == 3</code>.</li>
</ul>
<p>The byte <code>c[2136 + (state + transition_label)]</code> =
<code>(unsigned char)(32 + next_state % 94)</code>.</p>
<p>A type B state machine starts in a given <code>state</code> with
<code>output</code> set to <code>ignore</code>. It scans a word
backwards, converting character by character to
<code>transition_label</code>. When it meets <code>word_start</code>, it
returns, leaving the most recently stored <code>output</code> in
<code>v</code>.</p>
<p>The byte <code>c[2136 + (state + transition_label)]</code> = <code>(unsigned char)(32 + next_state % 94)</code>.</p>
<p>A type B state machine starts in a given <code>state</code> with <code>output</code>
set to <code>ignore</code>. It scans a word backwards, converting character by
character to <code>transition_label</code>. When it meets <code>word_start</code>, it
returns, leaving the most recently stored <code>output</code> in <code>v</code>.</p>
<p>It also returns when
<code>c[186 + (state + transition_label)] != (unsigned char)(2 + transition_label + 28 * output)</code>,
i.e. when the <code>transition_label</code> in the byte mismatches the
<code>transition_label</code> used to compute the index. Otherwise, if
the <code>output</code> in this byte differs from <code>ignore</code>,
the state machine stores it in <code>v</code>. Regardless of the value
of the <code>output</code>, it also assigns <code>next_state</code> to
<code>state</code> and proceeds to scan the previous character. The
state machine that determines the word class is set up so that it never
returns <code>ignore</code>.</p>
<code>transition_label</code> used to compute the index. Otherwise, if the
<code>output</code> in this byte differs from <code>ignore</code>, the state machine
stores it in <code>v</code>. Regardless of the value of the <code>output</code>,
it also assigns <code>next_state</code> to <code>state</code> and proceeds to scan
the previous character. The state machine that determines the word
class is set up so that it never returns <code>ignore</code>.</p>
<p>Below are sample steps of scanning the word “chiefly”.</p>
<ul>
<li><code>state</code> = 623, <code>transition_label</code> = 26
(<code>'y'</code>), <code>output</code> = <code>other</code></li>
<li><code>state</code> = 602, <code>transition_label</code> = 13
(<code>'l'</code>), <code>output</code> = <code>adverb</code></li>
<li><code>state</code> = 594, <code>transition_label</code> = 7
(<code>'f'</code>), <code>output</code> = <code>other</code></li>
<li><code>state</code> = 549, <code>transition_label</code> = 6
(<code>'e'</code>), <code>output</code> = <code>ignore</code></li>
<li><code>state</code> = 543, <code>transition_label</code> = 10
(<code>'i'</code>), <code>output</code> = <code>adverb</code></li>
<li><code>state</code> = 0, <code>transition_label</code> = 9
(<code>'h'</code>) mismatches the value stored in the byte. Return
<code>adverb</code>.</li>
<li><code>state</code> = 623, <code>transition_label</code> = 26 (<code>'y'</code>), <code>output</code> = <code>other</code></li>
<li><code>state</code> = 602, <code>transition_label</code> = 13 (<code>'l'</code>), <code>output</code> = <code>adverb</code></li>
<li><code>state</code> = 594, <code>transition_label</code> = 7 (<code>'f'</code>), <code>output</code> = <code>other</code></li>
<li><code>state</code> = 549, <code>transition_label</code> = 6 (<code>'e'</code>), <code>output</code> = <code>ignore</code></li>
<li><code>state</code> = 543, <code>transition_label</code> = 10 (<code>'i'</code>), <code>output</code> = <code>adverb</code></li>
<li><code>state</code> = 0, <code>transition_label</code> = 9 (<code>'h'</code>) mismatches the value stored
in the byte. Return <code>adverb</code>.</li>
</ul>
<p>And here are sample steps of scanning the string “i.e.”:</p>
<ul>
<li><code>state</code> = 19, <code>transition_label</code> = 1
(<code>'.'</code>), <code>output</code> = <code>ignore</code></li>
<li><code>state</code> = 24, <code>transition_label</code> = 6
(<code>'e'</code>), <code>output</code> = <code>ignore</code></li>
<li><code>state</code> = 3, <code>transition_label</code> = 1
(<code>'.'</code>), <code>output</code> = <code>ignore</code></li>
<li><code>state</code> = 2, <code>transition_label</code> = 10
(<code>'i'</code>), <code>output</code> = <code>ignore</code></li>
<li><code>state</code> = 1, <code>transition_label</code> = 0
(<code>'\0'</code>), <code>output</code> = <code>abbreviation</code>.
<li><code>state</code> = 19, <code>transition_label</code> = 1 (<code>'.'</code>), <code>output</code> = <code>ignore</code></li>
<li><code>state</code> = 24, <code>transition_label</code> = 6 (<code>'e'</code>), <code>output</code> = <code>ignore</code></li>
<li><code>state</code> = 3, <code>transition_label</code> = 1 (<code>'.'</code>), <code>output</code> = <code>ignore</code></li>
<li><code>state</code> = 2, <code>transition_label</code> = 10 (<code>'i'</code>), <code>output</code> = <code>ignore</code></li>
<li><code>state</code> = 1, <code>transition_label</code> = 0 (<code>'\0'</code>), <code>output</code> = <code>abbreviation</code>.
Return <code>abbreviation</code>.</li>
</ul>
<h3 id="remarks">Remarks:</h3>
<p>The judges found a bug in the handling of contractions: <a
href="prog.alt.c">prog.alt.c</a> outputs “foo wasn’<strong>[t
bazzed]</strong>”. I fixed the bug in <a href="prog.c">prog.c</a>,
making it output “foo <strong>[wasn’t bazzed]</strong>” instead, and
took the liberty to merge one statement into a <code>for</code> loop
inside its <code>main()</code> function.</p>
<p>The judges found a bug in the handling of contractions: <a href="prog.alt.c">prog.alt.c</a>
outputs “foo wasn’<strong>[t bazzed]</strong>”. I fixed the bug in <a href="prog.c">prog.c</a>, making
it output “foo <strong>[wasn’t bazzed]</strong>” instead, and took the liberty to merge
one statement into a <code>for</code> loop inside its <code>main()</code> function.</p>
<p>The program uses a 9,437,187-byte buffer so it probably will not run
on 16-bit and smaller machines without changing the size of array
<code>C[]</code> and the expression <code>9&lt;&lt;20</code> inside the
call to <code>read(2)</code>.</p>
on 16-bit and smaller machines without changing the size of array <code>C[]</code>
and the expression <code>9&lt;&lt;20</code> inside the call to <code>read(2)</code>.</p>
<p>I have tested it on:</p>
<ul>
<li>Linux with gcc version 5.4.0 20160609,</li>
<li>Linux with clang version 3.4-1ubuntu3,</li>
<li>OS/X with Apple LLVM version 6.0 (clang-600.0.57).</li>
</ul>
<p>For a clean compile under C89 and C90, add
<code>-Woverlength-strings</code> to <code>CSILENCE</code>.</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
Reserved. You are free to share and adapt this file under the terms of
this license:</p>
<p>For a clean compile under C89 and C90, add <code>-Woverlength-strings</code>
to <code>CSILENCE</code>.</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:</p>
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
<p>For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/</p>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2018ciura"><a name="inventory"></a>Inventory for
2018/ciura</h1>
<h1 id="inventory-for-2018ciura"><a name="inventory"></a>Inventory for 2018/ciura</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/ciura/prog.c">prog.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/ciura/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/ciura/prog.alt.c">prog.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/ciura/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a href="lexicon.pdf">lexicon.pdf</a> - How to squeeze a lexicon
paper</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/ciura/try.alt.sh">try.alt.sh</a>
- how to run alternate code</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/ciura/try.sh">try.sh</a>
- how to run</li>
<li><a href="2018_ciura.tar.bz2">2018_ciura.tar.bz2</a> - download entry
source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/ciura/prog.c">prog.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/ciura/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/ciura/prog.alt.c">prog.alt.c</a> - alternative source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/ciura/prog.orig.c">prog.orig.c</a> - original source</li>
<li><a href="lexicon.pdf">lexicon.pdf</a> - How to squeeze a lexicon paper</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/ciura/try.alt.sh">try.alt.sh</a> - how to run alternate code</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/ciura/try.sh">try.sh</a> - how to run</li>
<li><a href="2018_ciura.tar.bz2">2018_ciura.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/ciura/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/ciura/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/ciura/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/ciura/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/ciura/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/ciura/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+27 -55
View File
@@ -144,88 +144,60 @@ Location: <a href="../../location.html#JP">JP</a> - <em>Japan</em>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">&lt;</span> textfile <span class="op">&gt;</span> output.gif</span></code></pre></div>
<h2 id="try">Try:</h2>
<p>To see the input files and feed them to the program, redirecting to
GIF files:</p>
<p>To see the input files and feed them to the program, redirecting to GIF files:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>To get the best experience, use a GIF viewer that can handle animated
GIFs. With macOS you can use Safari using
<code>open -a Safari smily.gif</code>.</p>
<p>Some things to consider are that this 2.5KiB gem encodes a 96
character 8x8 font (naively this could already take 6144 bytes) and a
GIF encoder. But how does it know which characters are closed?</p>
<p>To get the best experience, use a GIF viewer that can handle animated GIFs.
With macOS you can use Safari using <code>open -a Safari smily.gif</code>.</p>
<p>Some things to consider are that this 2.5KiB gem encodes a 96 character 8x8
font (naively this could already take 6144 bytes) and a GIF encoder. But
how does it know which characters are closed?</p>
<p>You should only give this program printable ASCII characters.</p>
<p>Unfortunately this won’t run on your PDP8, if you had one, as it
needs at least 2MiB of memory to run in.</p>
<p>Unfortunately this won’t run on your PDP8, if you had one, as it needs at
least 2MiB of memory to run in.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>This program generates an animated GIF from a plain text. Run:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> <span class="at">-o</span> prog prog.c</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">&lt;</span> invisible.txt <span class="op">&gt;</span> invisible.gif</span></code></pre></div>
<p>Open <code>invisible.gif</code> with a GIF viewer that can show
animated GIFs and then wait a minute. You will see a hidden message. Can
you tell the difference between letters that leave the mark and ones
that do not?</p>
<p>Open <code>invisible.gif</code> with a GIF viewer that can show animated GIFs and then wait
a minute. You will see a hidden message. Can you tell the difference between
letters that leave the mark and ones that do not?</p>
<p>Other examples:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">&lt;</span> golem.txt <span class="op">&gt;</span> golem.gif</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">&lt;</span> smily.txt <span class="op">&gt;</span> smily.gif</span></code></pre></div>
<p>The program itself has a hidden message.</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">&lt;</span> prog.c <span class="op">&gt;</span> prog.gif</span></code></pre></div>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
Reserved. You are free to share and adapt this file under the terms of
this license:</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:</p>
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
<p>For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/</p>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2018endoh1"><a name="inventory"></a>Inventory for
2018/endoh1</h1>
<h1 id="inventory-for-2018endoh1"><a name="inventory"></a>Inventory for 2018/endoh1</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/prog.c">prog.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/golem.txt">golem.txt</a>
- input data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/invisible.txt">invisible.txt</a>
- input data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/smily.txt">smily.txt</a>
- input data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/try.sh">try.sh</a>
- how to run</li>
<li><a href="2018_endoh1.tar.bz2">2018_endoh1.tar.bz2</a> - download
entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/prog.c">prog.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/prog.orig.c">prog.orig.c</a> - original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/golem.txt">golem.txt</a> - input data</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/invisible.txt">invisible.txt</a> - input data</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/smily.txt">smily.txt</a> - input data</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/try.sh">try.sh</a> - how to run</li>
<li><a href="2018_endoh1.tar.bz2">2018_endoh1.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+42 -76
View File
@@ -148,42 +148,33 @@ Location: <a href="../../location.html#JP">JP</a> - <em>Japan</em>
<p>NOTE: to interrupt the loops send intr (typically ctrl-C).</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>And now for something completely different: A program whose metabolic
processes are a matter of interest only to historians. It has kicked the
bucket and departed to that mysterious country from whose bourne no
traveller returns! This is an EX-tremely obfuscated program!</p>
processes are a matter of interest only to historians. It has kicked the bucket
and departed to that mysterious country from whose bourne no traveller returns!
This is an EX-tremely obfuscated program!</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>A high-context work that combines parrots that new hackers like and
parrots that old hackers like. One is an internet meme called <a
href="https://cultofthepartyparrot.com">Party Parrot</a> (WARNING: has
flashing lights). The other is a sketch <a
href="https://en.wikipedia.org/wiki/Comté_cheese">comté</a> called <a
href="https://en.wikipedia.org/wiki/Dead_Parrot_sketch">“Dead
Parrot”</a> from the British sitcom <a
href="https://en.wikipedia.org/wiki/Monty_Python%27s_Flying_Circus">“Monty
Python’s Flying Circus”</a> The “<em>Python</em>” in the award name
refers to Monty Python, <strong>not</strong> the [programming language
Python](https://en.wikipedia.org/wiki/Python_(programming_language) (the
name of the programming language Python is derived from Monty
Python).</p>
<p>The shape of <a href="prog.c">prog.c</a> is “Undead Parrot” based on
“dead parrot”. The message that appears in the bottom line of the output
source code is the subject of the dialogue that appears in “Dead Parrot”
and explains in various expressions that the parrot died. Also, the
second **__&lt;-_Source_of_Parrots__** line from the bottom of <a
href="http://cultofthepartyparrot.com/"
class="uri">http://cultofthepartyparrot.com/</a> (WARNING: has flashing
lights) has a hidden URL (hidden by the parrot’s body).</p>
<p>Although it is a boring Quine story, it is quite difficult to have 10
parrot pictures and 10 lines of data. Only the outline data of the
parrot picture is saved, and the body is filled in at runtime. These
data are probably compressed with <a
href="https://en.wikipedia.org/wiki/Byte_pair_encoding">byte pair
encoding</a>.</p>
<p>The parrot ASCII art below is the opening line of the Monty Python
show. The judge’s comment <a
href="https://en.wikipedia.org/wiki/And_Now_for_Something_Completely_Different">“And
now for something completely different”</a> is also used in the
opening.</p>
<p>A high-context work that combines parrots that new hackers like and parrots that
old hackers like. One is an internet meme called <a href="https://cultofthepartyparrot.com">Party
Parrot</a> (WARNING: has flashing lights). The other is a
sketch <a href="https://en.wikipedia.org/wiki/Comté_cheese">comté</a> called <a href="https://en.wikipedia.org/wiki/Dead_Parrot_sketch">“Dead
Parrot”</a> from the British
sitcom <a href="https://en.wikipedia.org/wiki/Monty_Python%27s_Flying_Circus">“Monty Python’s Flying Circus”</a>
The “<em>Python</em>” in the award name refers to Monty Python, <strong>not</strong> the
[programming language Python](https://en.wikipedia.org/wiki/Python_(programming_language)
(the name of the programming language Python is derived from Monty Python).</p>
<p>The shape of <a href="prog.c">prog.c</a> is “Undead Parrot” based on “dead parrot”. The
message that appears in the bottom line of the output source code is the subject
of the dialogue that appears in “Dead Parrot” and explains in various
expressions that the parrot died. Also, the second **__&lt;-_Source_of_Parrots__**
line from the bottom of <a href="http://cultofthepartyparrot.com/" class="uri">http://cultofthepartyparrot.com/</a> (WARNING: has
flashing lights) has a hidden URL (hidden by the parrot’s body).</p>
<p>Although it is a boring Quine story, it is quite difficult to have 10 parrot
pictures and 10 lines of data. Only the outline data of the parrot picture is
saved, and the body is filled in at runtime. These data are probably compressed
with <a href="https://en.wikipedia.org/wiki/Byte_pair_encoding">byte pair encoding</a>.</p>
<p>The parrot ASCII art below is the opening line of the Monty Python show. The
judge’s comment <a href="https://en.wikipedia.org/wiki/And_Now_for_Something_Completely_Different">“And now for something completely
different”</a>
is also used in the opening.</p>
<pre><code> ___-----__
_-- --__
_- _--_ \
@@ -201,62 +192,37 @@ opening.</p>
_- |
/ |
| |</code></pre>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
Reserved. You are free to share and adapt this file under the terms of
this license:</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:</p>
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
<p>For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/</p>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2018endoh2"><a name="inventory"></a>Inventory for
2018/endoh2</h1>
<h1 id="inventory-for-2018endoh2"><a name="inventory"></a>Inventory for 2018/endoh2</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/prog.c">prog.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/run.sh">run.sh</a>
- how to run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/try.sh">try.sh</a>
- how to run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/python.sh">python.sh</a>
- python rule script</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/python3.sh">python3.sh</a>
- python3 rule script</li>
<li><a href="2018_endoh2.tar.bz2">2018_endoh2.tar.bz2</a> - download
entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/prog.c">prog.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/prog.orig.c">prog.orig.c</a> - original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/run.sh">run.sh</a> - how to run</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/try.sh">try.sh</a> - how to run</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/python.sh">python.sh</a> - python rule script</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/python3.sh">python3.sh</a> - python3 rule script</li>
<li><a href="2018_endoh2.tar.bz2">2018_endoh2.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+700 -917
View File
File diff suppressed because it is too large. Load diff
+33 -39
View File
@@ -120,46 +120,40 @@
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<h2 id="an-rpm-what-kind-of-absolute-madness-is-this">An RPM: what kind
of absolute MADNESS is this ?</h2>
<p>What kind of crazy idea is this? Install an IOCCC entry? I realise it
seems odd (at best) so why did I make a rpm spec file and why did I hint
at building RPMs for others? I can’t say precisely; <strong>certainly
I’m under no impression that anyone else will want to use it</strong>
<em>but the entry was fun enough for me that I actually will</em> (a
number of my programs over the years are programs I actually install and
I already have done so with this entry).</p>
<p>I already have my own RPM repository and initially after having won I
set it up so that I could host the weasel rpm (binary and source) there.
At the same time though I feel the entry belongs on the IOCCC website;
that is to say the only place the raw files should be downloadable from
is the IOCCC website itself. Simon Cooper (the judge who at the time
dealt with setting up the entries on the IOCCC website) asked me if
there is any real attachment in having the RPM built as part of the
entry and the answer is ‘no’. He did suggest too that if I were to have
the RPM hosted on the IOCCC website not only would it place a burden on
me to keep it up to date (not that it ever needed to be updated) but it
would place a burden on the judges. This is no longer true with GitHub
but anyway since this was for personal reasons I decided that:</p>
<h2 id="an-rpm-what-kind-of-absolute-madness-is-this">An RPM: what kind of absolute MADNESS is this ?</h2>
<p>What kind of crazy idea is this? Install an IOCCC entry? I realise it seems odd
(at best) so why did I make a rpm spec file and why did I hint at building RPMs
for others? I can’t say precisely; <strong>certainly I’m under no impression that
anyone else will want to use it</strong> <em>but the entry was fun enough for me that I
actually will</em> (a number of my programs over the years are programs I actually
install and I already have done so with this entry).</p>
<p>I already have my own RPM repository and initially after having won I set it up
so that I could host the weasel rpm (binary and source) there. At the same time
though I feel the entry belongs on the IOCCC website; that is to say the only
place the raw files should be downloadable from is the IOCCC website itself.
Simon Cooper (the judge who at the time dealt with setting up the entries on the
IOCCC website) asked me if there is any real attachment in having the RPM built
as part of the entry and the answer is ‘no’. He did suggest too that if I were
to have the RPM hosted on the IOCCC website not only would it place a burden on
me to keep it up to date (not that it ever needed to be updated) but it would
place a burden on the judges. This is no longer true with GitHub but anyway
since this was for personal reasons I decided that:</p>
<ul>
<li><p>I would not host the actual source code or scripts on my website;
they will remain on the IOCCC website. This will most likely never
change; instead I would link to the entry directory so that they remain
where they belong: the IOCCC website itself. I have set up an <a
href="https://ioccc.xexyl.net/2018/weasel/errata">errata page</a>
however should there be anything requiring a fix.</p></li>
<li><p>I am keeping the weasel.spec file in the entry as it was part of
my submission but I do not explain here how to set up the build
environment or how to build a RPM: if you know how to use
<strong><code>rpmbuild</code></strong> then you should be able to work
it out. Again that’s a crazy idea but again it was there and it was part
of the judges’ comments (which I liked a lot) which is yet another
reason I kept it.</p></li>
<li><p>Because I strongly suspect (in other words since I know) I am the
only one who has any desire for actually installing an IOCCC entry I did
not do anything further. Nevertheless more information on my entry can
be found at <a
href="https://ioccc.xexyl.net/2018/weasel">https://ioccc.xexyl.net/2018/weasel</a>.</p></li>
<li><p>I would not host the actual source code or scripts on my website; they will
remain on the IOCCC website. This will most likely never change; instead I would
link to the entry directory so that they remain where they belong: the IOCCC
website itself. I have set up an <a href="https://ioccc.xexyl.net/2018/weasel/errata">errata page</a> however should there be anything
requiring a fix.</p></li>
<li><p>I am keeping the weasel.spec file in the entry as it was part of my
submission but I do not explain here how to set up the build environment or how
to build a RPM: if you know how to use <strong><code>rpmbuild</code></strong> then you should be able to
work it out. Again that’s a crazy idea but again it was there and it was part of
the judges’ comments (which I liked a lot) which is yet another reason I kept
it.</p></li>
<li><p>Because I strongly suspect (in other words since I know) I am the only one
who has any desire for actually installing an IOCCC entry I did not do anything
further. Nevertheless more information on my entry can be found at
<a href="https://ioccc.xexyl.net/2018/weasel">https://ioccc.xexyl.net/2018/weasel</a>.</p></li>
</ul>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
+41 -72
View File
@@ -130,8 +130,8 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Edward_Giles">Edward Giles</a><br>
Location: <a href="../../location.html#AU">AU</a> - <em>Commonwealth of
Australia</em> (<em>Australia</em>) <br><br></li>
Location: <a href="../../location.html#AU">AU</a> - <em>Commonwealth of Australia</em> (<em>Australia</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -140,10 +140,9 @@ Australia</em> (<em>Australia</em>) <br><br></li>
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<h2 id="to-build">To build:</h2>
<p>This entry requires SDL2 to be installed. See <a
href="../../faq.html#SDL">FAQ 3.8: How do I compile an IOCCC entry that
requires SDL1 or SDL2?</a> if you don’t have it installed and don’t know
how to do so.</p>
<p>This entry requires SDL2 to be installed. See <a href="../../faq.html#SDL">FAQ 3.8: How do I compile an
IOCCC entry that requires SDL1 or SDL2?</a> if you don’t have it
installed and don’t know how to do so.</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></span></code></pre></div>
@@ -157,92 +156,62 @@ how to do so.</p>
<span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> sand.alt.txt</span></code></pre></div>
<p>NOTE: these invocations will take quite some time to finish.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Can you explain the behavior of the program when <a
href="ioccc.txt">ioccc.txt</a> is given to it as input?</p>
<p>How would the description of the state machine look like when
translated from Polynomish to English?</p>
<p>Can you explain the behavior of the program when <a href="ioccc.txt">ioccc.txt</a> is given
to it as input?</p>
<p>How would the description of the state machine look like when translated from
Polynomish to English?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="remarks">Remarks</h3>
<p>This entry graphically displays a simulation of sand falling. It uses
SDL to draw the interface.</p>
<p>The code makes the following assumptions about the underlying
system:</p>
<p>This entry graphically displays a simulation of sand falling.
It uses SDL to draw the interface.</p>
<p>The code makes the following assumptions about the underlying system:</p>
<ul>
<li>SDL2 is installed from <a
href="https://libsdl.org">https://libsdl.org</a> or your package
manager.</li>
<li><code>double</code> is an IEEE 754 floating-point type and
<code>sizeof(double)==8</code>.</li>
<li>SDL2 is installed from <a href="https://libsdl.org">https://libsdl.org</a> or your
package manager.</li>
<li><code>double</code> is an IEEE 754 floating-point type and <code>sizeof(double)==8</code>.</li>
<li>The compiler supports the C99 standard.</li>
</ul>
<p>In order to simulate the motion of the sand, a cellular automaton is
used. The state transition table is not stored directly. Instead, the
program stores the coefficients of a polynomial that map each state to
the correct one. These coefficients are stored as raw hexadecimal in the
<code>V[]</code> array, and they are reinterpreted as
<code>double</code>s when used. This allows more numeric precision in
fewer characters (base 16 &gt; base 10), and makes the purpose of the
array less clear.</p>
<p>The code is laid out graphically as a bucket pouring sand, and it is
far easier to observe this high-level layout than the code’s actual
function.</p>
<p>The preprocessor is used to both obfuscate the code as a whole and
abbreviate the calls to SDL. Additionally, throughout the code, the
variables were named so that they are short and easily confused with
each other.</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
Reserved. You are free to share and adapt this file under the terms of
this license:</p>
<p>In order to simulate the motion of the sand, a cellular automaton is used. The
state transition table is not stored directly. Instead, the program stores the
coefficients of a polynomial that map each state to the correct one. These
coefficients are stored as raw hexadecimal in the <code>V[]</code> array, and they are
reinterpreted as <code>double</code>s when used. This allows more numeric precision in fewer
characters (base 16 &gt; base 10), and makes the purpose of the array less clear.</p>
<p>The code is laid out graphically as a bucket pouring sand, and it is far easier
to observe this high-level layout than the code’s actual function.</p>
<p>The preprocessor is used to both obfuscate the code as a whole and abbreviate
the calls to SDL. Additionally, throughout the code, the variables were named
so that they are short and easily confused with each other.</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:</p>
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
<p>For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/</p>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2018giles"><a name="inventory"></a>Inventory for
2018/giles</h1>
<h1 id="inventory-for-2018giles"><a name="inventory"></a>Inventory for 2018/giles</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/giles/prog.c">prog.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/giles/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/giles/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/giles/ioccc.txt">ioccc.txt</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/giles/sand.alt.txt">sand.alt.txt</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/giles/sand.txt">sand.txt</a>
- sample input</li>
<li><a href="2018_giles.tar.bz2">2018_giles.tar.bz2</a> - download entry
source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/giles/prog.c">prog.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/giles/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/giles/prog.orig.c">prog.orig.c</a> - original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/giles/ioccc.txt">ioccc.txt</a> - sample input</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/giles/sand.alt.txt">sand.alt.txt</a> - sample input</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/giles/sand.txt">sand.txt</a> - sample input</li>
<li><a href="2018_giles.tar.bz2">2018_giles.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/giles/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/giles/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/giles/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/giles/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/giles/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/giles/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+36 -62
View File
@@ -130,8 +130,8 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Qiming_HOU">Qiming HOU</a><br>
Location: <a href="../../location.html#CN">CN</a> - <em>People’s
Republic of China</em> (<em>China</em>) <br><br></li>
Location: <a href="../../location.html#CN">CN</a> - <em>People’s Republic of China</em> (<em>China</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -144,90 +144,64 @@ Republic of China</em> (<em>China</em>) <br><br></li>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a
href="../../bugs.html#2018_hou">2018 hou bugs</a>.</p>
<p>For more detailed information see <a href="../../bugs.html#2018_hou">2018 hou bugs</a>.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">&lt;</span> input.json <span class="op">&gt;</span> output.html</span></code></pre></div>
<p>View <code>output.html</code> in a browser.</p>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<p>The script will generate a JSON file called <code>ioccc.json</code>,
showing it via <code>tee(1)</code> and then run the program on that. Can
you find any problem with the JSON file? What happens if you try and fix
it?</p>
<p>The script will generate a JSON file called <code>ioccc.json</code>, showing it via
<code>tee(1)</code> and then run the program on that. Can you find any problem with the
JSON file? What happens if you try and fix it?</p>
<p>As the script says, open <code>ioccc.html</code> in a browser.</p>
<p>Is anything wrong with the output? How can you fix it if so?</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This entry exhibits a way of obfuscation we haven’t seen before, we
think. The <code>rulez</code> of programming in an imperative language
are violated, aren’t they?</p>
<p>Try figuring out how to increase the number of different colors, if
you can.</p>
<p>This entry exhibits a way of obfuscation we haven’t seen before, we think.
The <code>rulez</code> of programming in an imperative language are violated, aren’t they?</p>
<p>Try figuring out how to increase the number of different colors, if you can.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>Nowadays almost every programmer needs to do some Web chore. With all
the open source stuff readily available, often we just need to call a
bunch of libraries to generate an HTML page from a JSON feed.</p>
<p>This entry takes such decadence to an extreme. It just calls a bunch
of libraries to generate an HTML page from a JSON feed, literally. There
is no variable (function parameters included), no operator, no flow
control statements except a few decorative <code>return</code>s. In
compliance to production coding standards, the code is littered with
fashionable jargon, doxygen comment, and license text.</p>
<p>As one would expect from such an approach, this program is much more
resource intensive than it should be. And one needs a C99-compatible
libc (with the common UNIX stuff) to build this and an HTML5-compatible
browser to open the result. And it terminates with an assertion failure,
but who cares if the web page is already generated?</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
Reserved. You are free to share and adapt this file under the terms of
this license:</p>
<p>Nowadays almost every programmer needs to do some Web chore. With all the open
source stuff readily available, often we just need to call a bunch of libraries
to generate an HTML page from a JSON feed.</p>
<p>This entry takes such decadence to an extreme. It just calls a bunch of
libraries to generate an HTML page from a JSON feed, literally. There is no
variable (function parameters included), no operator, no flow control statements
except a few decorative <code>return</code>s. In compliance to production coding standards,
the code is littered with fashionable jargon, doxygen comment, and license text.</p>
<p>As one would expect from such an approach, this program is much more resource
intensive than it should be. And one needs a C99-compatible libc (with the
common UNIX stuff) to build this and an HTML5-compatible browser to open the
result. And it terminates with an assertion failure, but who cares if the web
page is already generated?</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:</p>
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
<p>For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/</p>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2018hou"><a name="inventory"></a>Inventory for
2018/hou</h1>
<h1 id="inventory-for-2018hou"><a name="inventory"></a>Inventory for 2018/hou</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/hou/prog.c">prog.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/hou/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/hou/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/hou/input.json">input.json</a>
- sample JSON data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/hou/try.sh">try.sh</a>
- how to run</li>
<li><a href="2018_hou.tar.bz2">2018_hou.tar.bz2</a> - download entry
source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/hou/prog.c">prog.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/hou/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/hou/prog.orig.c">prog.orig.c</a> - original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/hou/input.json">input.json</a> - sample JSON data</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/hou/try.sh">try.sh</a> - how to run</li>
<li><a href="2018_hou.tar.bz2">2018_hou.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/hou/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/hou/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/hou/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/hou/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/hou/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/hou/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+59 -91
View File
@@ -123,56 +123,43 @@
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<h1 id="twenty-fifth-international-obfuscated-c-code-contest">Twenty
Fifth International Obfuscated C Code Contest</h1>
<h1 id="twenty-fifth-international-obfuscated-c-code-contest">Twenty Fifth International Obfuscated C Code Contest</h1>
<h2 id="standard-ioccc-stuff">Standard IOCCC stuff</h2>
<p>View the <code>index.html</code> web page for the given winning entry
for information on how compile the entry and how to run the winning
program. Look at the winning source and try to figure how it does what
it does! You may then wish to look at the Author’s remarks for even more
details. This year we included most of the information included by the
submitter.</p>
<p>The primary site can be found at <a
href="https://www.ioccc.org">www.ioccc.org</a>.</p>
<p>Use <code>make</code> to compile entries. It is possible that on
non-Unix / non-Linux systems the Makefile needs to be changed. See the
Makefile for details.</p>
<p>Look at the source and try to figure out what the programs do, and
run them with various inputs.</p>
<p>Read over the Makefile and index.html files for compile/build issues.
Your system may require certain changes (add or remove a library, add or
remove a <code>#define</code>).</p>
<p>View the <code>index.html</code> web page for the given winning entry for information on how
compile the entry and how to run the winning program. Look at the winning
source and try to figure how it does what it does! You may then wish to look at
the Author’s remarks for even more details. This year we included most of the
information included by the submitter.</p>
<p>The primary site can be found at <a href="https://www.ioccc.org">www.ioccc.org</a>.</p>
<p>Use <code>make</code> to compile entries. It is possible that on non-Unix / non-Linux
systems the Makefile needs to be changed. See the Makefile for details.</p>
<p>Look at the source and try to figure out what the programs do, and run
them with various inputs.</p>
<p>Read over the Makefile and index.html files for compile/build issues. Your
system may require certain changes (add or remove a library, add or remove a
<code>#define</code>).</p>
<p>Some C compilers are not quite as good as they should be. If yours is
lacking, you may need to compile using clang or gcc instead of your
local compiler.</p>
<h2 id="remarks-on-some-of-the-winning-entries">Remarks on some of the
winning entries</h2>
<p>We believe you will again be impressed with this year’s winning
entries.</p>
<p>The <a href="mills/index.html">“Best of show” (mills)</a> is an
amazing tribute to entries from 1984 and 2015.</p>
<p>Take a close look at the “<a href="hou/index.html">Most likely to top
the charts” (hou)</a>. Observe that while it contains no variables and
no operators, it remains functional in what it does.</p>
<p>The <a href="burton1/index.html">“Best one-liner” (burton1)</a>, at
109 characters, is a short and sweet implementation of a classic utility
and a nod to a winning entry from 1986. Sometimes it takes 20 some years
to do things the true IOCCC way.</p>
<p>The color of the remarks text this year was inspired by one of the
stars of the <a href="poikola/index.html">“Most stellar”
(poikola)</a>.</p>
<p>The <a href="endoh2/index.html">“Best use of python” (endoh2)</a> is
a not what you might think it is. It is something completely
different.</p>
<p>The <a href="ciura/index.html">“Most likely to be awarded”
(ciura)</a> has an amazing vocabulary!</p>
<p>There are also nods to entries of the years <a
href="2000/bellard/index.htmk">2000/bellard</a>, <a
href="1989/yang/index.html">1989/yang</a>, …</p>
<p>…We’ll stop spouting spoilers now. Have fun exploring all the
entries!</p>
<h2 id="remarks-on-some-of-submissions-that-did-not-win">Remarks on some
of submissions that did not win</h2>
lacking, you may need to compile using clang or gcc instead of your local
compiler.</p>
<h2 id="remarks-on-some-of-the-winning-entries">Remarks on some of the winning entries</h2>
<p>We believe you will again be impressed with this year’s winning entries.</p>
<p>The <a href="mills/index.html">“Best of show” (mills)</a> is an amazing tribute to entries
from 1984 and 2015.</p>
<p>Take a close look at the “<a href="hou/index.html">Most likely to top the charts” (hou)</a>.
Observe that while it contains no variables and no operators, it
remains functional in what it does.</p>
<p>The <a href="burton1/index.html">“Best one-liner” (burton1)</a>, at 109 characters, is a
short and sweet implementation of a classic utility and a nod to a winning entry
from 1986. Sometimes it takes 20 some years to do things the true IOCCC way.</p>
<p>The color of the remarks text this year was inspired by one of the stars
of the <a href="poikola/index.html">“Most stellar” (poikola)</a>.</p>
<p>The <a href="endoh2/index.html">“Best use of python” (endoh2)</a> is a not what you might think it is.
It is something completely different.</p>
<p>The <a href="ciura/index.html">“Most likely to be awarded” (ciura)</a> has an amazing vocabulary!</p>
<p>There are also nods to entries of the years <a href="2000/bellard/index.htmk">2000/bellard</a>,
<a href="1989/yang/index.html">1989/yang</a>, …</p>
<p>…We’ll stop spouting spoilers now. Have fun exploring all the entries!</p>
<h2 id="remarks-on-some-of-submissions-that-did-not-win">Remarks on some of submissions that did not win</h2>
<p>The number of entries that would have made it into the final rounds
would have been much higher had some people paid attention to rules 2
and 22 (one third of 666).</p>
@@ -185,69 +172,50 @@ and 22 (one third of 666).</p>
| Identifying yourself, in an obvious way in your code, data, remarks
| or program output, unless you are Peter Honeyman or pretending
| to be Peter Honeyman, will be grounds for disqualification of your entry.</code></pre>
<p>A number of other entries were based on <a
href="iocccsize.c">iocccsize.c</a>, making derivative works rather than
original works.</p>
<p>Still other entries were too large, violating the first line of rule
2:</p>
<p>A number of other entries were based on <a href="iocccsize.c">iocccsize.c</a>, making
derivative works rather than original works.</p>
<p>Still other entries were too large, violating the first line of rule 2:</p>
<blockquote>
<ol start="2" type="1">
<li>The size of your program source must be &lt;= 4096 bytes in
length.</li>
<li>The size of your program source must be &lt;= 4096 bytes in length.</li>
</ol>
</blockquote>
<p>While these entries might have passed under the 2053 limit for
iocccsize, they were larger than &lt;= 4096 bytes, sometimes by an order
or magnitude.</p>
<p>While these entries might have passed under the 2053 limit for iocccsize,
they were larger than &lt;= 4096 bytes, sometimes by an order or magnitude.</p>
<p>We hope the authors of some of those entries will fix and re-submit
them for the next IOCCC.</p>
<p>Some entries seemed to have a good idea, but the implementation of
the idea was limited in scope.</p>
<h2 id="final-comments">Final Comments</h2>
<p><strong>IMPORTANT NOTE</strong>: See <a
href="../contact.html">contact.html</a> for up to date contact details
as well as details on how to provide fixes to any of the entries. See
also <a href="../faq.html">the IOCCC FAQ</a> for addition information on
the IOCCC.</p>
<p><strong>IMPORTANT NOTE</strong>: See <a href="../contact.html">contact.html</a> for up to date contact details
as well as details on how to provide fixes to any of the entries.
See also <a href="../faq.html">the IOCCC FAQ</a> for addition information on the IOCCC.</p>
<h1 id="copyright-and-license">Copyright and License</h1>
<p>Copyright (C) 2018,2023, Landon Curt Noll and Leonid A. Broukhis. All
Rights Reserved. This work is licensed under a <a
href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons
CC BY-SA 4.0 DEED Attribution-ShareAlike 4.0 International</a> license.
If you do use this work in some form, the <a href="../judges.html">IOCCC
judges</a> would appreciate (but does not require) if you were to <a
href="../contact.html">send us a note about your use</a>.</p>
<p>Copyright (C) 2018,2023, Landon Curt Noll and Leonid A. Broukhis. All Rights Reserved.
This work is licensed under a <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons CC BY-SA 4.0 DEED Attribution-ShareAlike
4.0 International</a> license.
If you do use this work in some form, the <a href="../judges.html">IOCCC judges</a> would appreciate
(but does not require) if you were to <a href="../contact.html">send us a note about your use</a>.</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-year-index.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-year-index.sh -->
<h1
id="winning-entries-of-2018---the-25th-ioccc"><a name=inventory></a><a name=2018></a>Winning
Entries of 2018 - The 25th IOCCC</h1>
<p><strong>Download IOCCC</strong> <a
href="2018/ioccc.2018.tar.bz2">2018 entry source</a></p>
<h1 id="winning-entries-of-2018---the-25th-ioccc"><a name=inventory></a><a name=2018></a>Winning Entries of 2018 - The 25th IOCCC</h1>
<p><strong>Download IOCCC</strong> <a href="2018/ioccc.2018.tar.bz2">2018 entry source</a></p>
<ul>
<li><a href="algmyr/index.html">2018/algmyr</a> - Most cacophonic</li>
<li><a href="anderson/index.html">2018/anderson</a> - Most able to
divine code gaps</li>
<li><a href="bellard/index.html">2018/bellard</a> - Most
inflationary</li>
<li><a href="anderson/index.html">2018/anderson</a> - Most able to divine code gaps</li>
<li><a href="bellard/index.html">2018/bellard</a> - Most inflationary</li>
<li><a href="burton1/index.html">2018/burton1</a> - Best one-liner</li>
<li><a href="burton2/index.html">2018/burton2</a> - Best abuse of the
rules</li>
<li><a href="ciura/index.html">2018/ciura</a> - Most likely to be
awarded</li>
<li><a href="endoh1/index.html">2018/endoh1</a> - Best tool to reveal
holes</li>
<li><a href="endoh2/index.html">2018/endoh2</a> - Best use of
python</li>
<li><a href="ferguson/index.html">2018/ferguson</a> - Best use of weasel
words</li>
<li><a href="burton2/index.html">2018/burton2</a> - Best abuse of the rules</li>
<li><a href="ciura/index.html">2018/ciura</a> - Most likely to be awarded</li>
<li><a href="endoh1/index.html">2018/endoh1</a> - Best tool to reveal holes</li>
<li><a href="endoh2/index.html">2018/endoh2</a> - Best use of python</li>
<li><a href="ferguson/index.html">2018/ferguson</a> - Best use of weasel words</li>
<li><a href="giles/index.html">2018/giles</a> - Most unstable</li>
<li><a href="hou/index.html">2018/hou</a> - Most likely to top the
charts</li>
<li><a href="hou/index.html">2018/hou</a> - Most likely to top the charts</li>
<li><a href="mills/index.html">2018/mills</a> - Best of show</li>
<li><a href="poikola/index.html">2018/poikola</a> - Most stellar</li>
<li><a href="vokes/index.html">2018/vokes</a> - Most connected</li>
+409 -536
View File
File diff suppressed because it is too large. Load diff
+85 -127
View File
@@ -130,8 +130,8 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Timo_Poikola">Timo Poikola</a><br>
Location: <a href="../../location.html#FI">FI</a> - <em>Republic of
Finland </em> (<em>Finland</em>) <br><br></li>
Location: <a href="../../location.html#FI">FI</a> - <em>Republic of Finland </em> (<em>Finland</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -144,182 +144,140 @@ Finland </em> (<em>Finland</em>) <br><br></li>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></span></code></pre></div>
<h2 id="try">Try:</h2>
<p>On a terminal that supports 24 bit color, has black background, and
size at least 125x38, try:</p>
<p>On a terminal that supports 24 bit color, has black background, and size at
least 125x38, try:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>It is said by some students of Astronomy:</p>
<pre><code>Oh, Be A Fine Gal, Kiss Me!
Oh, Be A Fine Gentleman, Kiss Me!</code></pre>
<p>Many <a
href="http://www.star.ucl.ac.uk/%7Epac/obafgkmrns.html">Mnemonic
variations</a> exist. You might wish, on a star, to better understand
the colors being displayed. And those in the deep south might wish to go
north for a better view.</p>
<p>Many <a href="http://www.star.ucl.ac.uk/%7Epac/obafgkmrns.html">Mnemonic variations</a> exist.
You might wish, on a star, to better understand the colors being displayed.
And those in the deep south might wish to go north for a better view.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="how-to-build">How to build:</h3>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> <span class="at">-o</span> prog <span class="at">-std</span><span class="op">=</span>gnu11 <span class="at">-O3</span> prog.c</span></code></pre></div>
<p>or</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<h3 id="poster">Poster:</h3>
<p>You can generate an A3 sized poster by <em>make docs</em>. This
command creates a pdf file <em>poikola.pdf</em>.</p>
<p>You can generate an A3 sized poster by <em>make docs</em>. This command creates a pdf
file <em>poikola.pdf</em>.</p>
<h3 id="introduction">Introduction:</h3>
<p>It was a starry night when my wife pointed her finger up and asked:
“What is this star and may I have some Easter eggs?”</p>
<p>So I had to sit down and solve those tricky questions with Nano and a
C compiler.</p>
<p>It was a starry night when my wife pointed her finger up and asked: “What is
this star and may I have some Easter eggs?”</p>
<p>So I had to sit down and solve those tricky questions with Nano and a C
compiler.</p>
<h3 id="little-spoilers">Little spoilers:</h3>
<p>Basically, the program draws animated ASCII art of the Big Dipper
using Annie Jump Cannon’s spectral classification system of stars and I
think the colors of the output are as accurate as possible.</p>
<p>This program also tells once in a year if it is correct time to find
and eat some Easter eggs.</p>
<p>The program has also at least three other functions, obvious and not
so obvious.</p>
<p>Basically, the program draws animated ASCII art of the Big Dipper using Annie
Jump Cannon’s spectral classification system of stars and I think the colors of
the output are as accurate as possible.</p>
<p>This program also tells once in a year if it is correct time to find and eat
some Easter eggs.</p>
<p>The program has also at least three other functions, obvious and not so obvious.</p>
<h3 id="technical-jargon">Technical jargon</h3>
<p>This program has been tested on xterm and Konsole and also Linux
virtual terminal. Color support in the terminal is not necessary, but
the effect is better with it.</p>
<p>This entry has partial support for terminals with a white background
but the best viewing experience is achieved when the terminal in use
supports 24-bit colors, has a black background and the size is at least
125x38.</p>
<p>Special note for Mac users: <code>Terminal.app</code> does not work
as expected; you might need xterm from XQuartz (see <a
href="../../faq.html#X11macos">FAQ 3.7: How do I compile and use on
macOS, an IOCCC entry that requires X11?</a>) or some other working
terminal. Thanks to <a href="../../authors.html#Dave_Burton">Dave
Burton</a> for spotting this problem.</p>
<p>The main reason for the header <code>unistd.h</code> is
<code>getdelim(3)</code> but once I included it I also abused other
functions and <code>#define</code>s. This header is mutually exclusive
<p>This program has been tested on xterm and Konsole and also Linux virtual
terminal. Color support in the terminal is not necessary, but the effect is
better with it.</p>
<p>This entry has partial support for terminals with a white background but the
best viewing experience is achieved when the terminal in use supports 24-bit
colors, has a black background and the size is at least 125x38.</p>
<p>Special note for Mac users: <code>Terminal.app</code> does not work as expected; you might
need xterm from XQuartz (see <a href="../../faq.html#X11macos">FAQ 3.7: How do I compile and use on macOS, an
IOCCC entry that requires X11?</a>) or some other working
terminal. Thanks to <a href="../../authors.html#Dave_Burton">Dave Burton</a> for spotting this
problem.</p>
<p>The main reason for the header <code>unistd.h</code> is <code>getdelim(3)</code> but once I included it
I also abused other functions and <code>#define</code>s. This header is mutually exclusive
with <code>-std=c11</code>.</p>
<p>The program was developed with little-endian machines; I tried to
support big-endian too, but this support is somewhat limited.</p>
<p>The program was developed with little-endian machines; I tried to support
big-endian too, but this support is somewhat limited.</p>
<p>This program has been compiled with:</p>
<ol type="1">
<li>i386 (Debian Stretch) with gcc and clang</li>
<li>amd64 (Debian Buster) with gcc and clang</li>
<li>Raspberry Pi 3 (Debian stretch) with gcc and clang</li>
<li>Lego Mindstorms EV3 Intelligent Brick (Debian Jessie) with gcc and
clang (in this case, compiling time with clang-3.5 12 seconds and with
gcc 27 seconds)</li>
<li>Lego Mindstorms EV3 Intelligent Brick (Debian Jessie) with gcc and clang (in
this case, compiling time with clang-3.5 12 seconds and with gcc 27 seconds)</li>
</ol>
<h3
id="extra-notes-from-the-judges-on-the-macos-terminal.app-problems">Extra
notes from the judges on the macOS Terminal.app problems:</h3>
<p>Depending on the settings of the terminal in Terminal.app the program
might not show anything at all. In other cases it won’t show all the
colours right but mostly is okay. YMMV, as they say.</p>
<h3 id="warnings-and-restrictions-required-by-law">Warnings and
restrictions required by law:</h3>
<h3 id="extra-notes-from-the-judges-on-the-macos-terminal.app-problems">Extra notes from the judges on the macOS Terminal.app problems:</h3>
<p>Depending on the settings of the terminal in Terminal.app the program might not
show anything at all. In other cases it won’t show all the colours right but
mostly is okay. YMMV, as they say.</p>
<h3 id="warnings-and-restrictions-required-by-law">Warnings and restrictions required by law:</h3>
<p>Please do not feed little babies chocolate.</p>
<h3 id="major-spoilers">Major spoilers:</h3>
<p>I incorporated the <a
href="https://en.wikipedia.org/wiki/Fletcher%27s_checksum">Fletcher 16
checksum algorithm</a> into the source for security reasons; it might be
challenging to make changes without breaking the main functionality of
the code.</p>
<p>I incorporated the <a href="https://en.wikipedia.org/wiki/Fletcher%27s_checksum">Fletcher 16 checksum
algorithm</a> into the source
for security reasons; it might be challenging to make changes without breaking
the main functionality of the code.</p>
<p>The space after <code>#define p return</code> is necessary.</p>
<p>The computus (method to determine the date of Easter) uses an
algorithm described in the journal Nature in 1876. It should be valid
for Gregorian calendars.</p>
<h3 id="some-obfuscation-techniques-used">Some obfuscation techniques
used:</h3>
<p>The computus (method to determine the date of Easter) uses an algorithm
described in the journal Nature in 1876. It should be valid for Gregorian
calendars.</p>
<h3 id="some-obfuscation-techniques-used">Some obfuscation techniques used:</h3>
<ol type="1">
<li>I tried to use meaningless or misleading variable names. For
example, this program draws the Big Dipper with the correct colors, but
variables like <code>o</code>, <code>b</code>, and <code>a</code> are
used in totally unrelated tasks.</li>
<li>I reused and recycled variables almost every time when
possible.</li>
<li>Unnecessary use of predefined stuff like
<code>__ATOMIC_SEQ_CST</code>.</li>
<li>When I was a kid, my favorite programming language was Pascal. In
Pascal, there are things like <code>begin;</code> and <code>end;</code>
instead of curly brackets. They are used also in my code, but I had to
shorten them to meet size requirements.</li>
<li>I also have strong Perl background, and therefore I added some
dollar signs to the code. One of the first ideas was to write all
variables with prefixed <code>$</code>, but then I rejected it.</li>
<li>I tried to use meaningless or misleading variable names. For example, this
program draws the Big Dipper with the correct colors, but variables like <code>o</code>,
<code>b</code>, and <code>a</code> are used in totally unrelated tasks.</li>
<li>I reused and recycled variables almost every time when possible.</li>
<li>Unnecessary use of predefined stuff like <code>__ATOMIC_SEQ_CST</code>.</li>
<li>When I was a kid, my favorite programming language was Pascal. In Pascal,
there are things like <code>begin;</code> and <code>end;</code> instead of curly brackets. They are
used also in my code, but I had to shorten them to meet size requirements.</li>
<li>I also have strong Perl background, and therefore I added some dollar signs
to the code. One of the first ideas was to write all variables with prefixed
<code>$</code>, but then I rejected it.</li>
</ol>
<p>If you think you understand how this program works, can you answer
these questions:</p>
<p>If you think you understand how this program works, can you answer these
questions:</p>
<ol type="1">
<li>What is the value of <code>aI_</code> after line 21?</li>
<li>Why are there some big numbers on line 47?</li>
<li>How is the scaling effect created?</li>
<li>How do you change a single bit, without changing the
functionality?</li>
<li>How do you change a single bit, without changing the functionality?</li>
</ol>
<h3 id="rot18-part">Rot18 part</h3>
<p>Because the rot13 is too easy to decode with the plain eyes, I
decided to use the <a
href="https://en.wikipedia.org/wiki/Caesar_cipher">Caesar cipher</a>
with the key 18:</p>
<p>Because the rot13 is too easy to decode with the plain eyes, I decided to use
the <a href="https://en.wikipedia.org/wiki/Caesar_cipher">Caesar cipher</a> with the key
18:</p>
<pre><code>Lzw xajkl tsffwj ak wfugvwv mkafy AWWW 754 xdgslk gf dafw 47. Al ak hjaflwv
gfdq gf dalldw-wfvasf esuzafwk.</code></pre>
<p>If you want to or must know and don’t know how to decipher this, you
might look at the <a href="https://www.dcode.fr/caesar-cipher">Caesar
cipher decoder</a>. Find the text that says:</p>
<p>If you want to or must know and don’t know how to decipher this, you might look
at the <a href="https://www.dcode.fr/caesar-cipher">Caesar cipher decoder</a>. Find the
text that says:</p>
<pre><code>Manual decryption and parameters
Shift/Key (number)</code></pre>
<p>and enter 18 and then click the button that says:
<code>DECRYPT (BRUTEFORCE)</code>.</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
Reserved. You are free to share and adapt this file under the terms of
this license:</p>
<p>and enter 18 and then click the button that says: <code>DECRYPT (BRUTEFORCE)</code>.</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:</p>
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
<p>For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/</p>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2018poikola"><a name="inventory"></a>Inventory for
2018/poikola</h1>
<h1 id="inventory-for-2018poikola"><a name="inventory"></a>Inventory for 2018/poikola</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/poikola/prog.c">prog.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/poikola/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/poikola/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/poikola/try.sh">try.sh</a>
- how to run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/poikola/poikola.tex">poikola.tex</a>
- supplied documentation</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/poikola/prog-doc.c">prog-doc.c</a>
- minor change to entry source</li>
<li><a href="2018_poikola.tar.bz2">2018_poikola.tar.bz2</a> - download
entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/poikola/prog.c">prog.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/poikola/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/poikola/prog.orig.c">prog.orig.c</a> - original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/poikola/try.sh">try.sh</a> - how to run</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/poikola/poikola.tex">poikola.tex</a> - supplied documentation</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/poikola/prog-doc.c">prog-doc.c</a> - minor change to entry source</li>
<li><a href="2018_poikola.tar.bz2">2018_poikola.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/poikola/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/poikola/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/poikola/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/poikola/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/poikola/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/poikola/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+129 -176
View File
@@ -130,8 +130,8 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Scott_Vokes">Scott Vokes</a><br>
Location: <a href="../../location.html#US">US</a> - <em>United States of
America</em> (<em>United States</em>) <br><br></li>
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -144,19 +144,18 @@ America</em> (<em>United States</em>) <br><br></li>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a
href="../../bugs.html#2018_vokes">2018 vokes bugs</a>.</p>
<p>For more detailed information see <a href="../../bugs.html#2018_vokes">2018 vokes bugs</a>.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">&lt;</span> file.txt</span></code></pre></div>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>What this program does is not witchcraft and there are no spectres,
but you might have a meltdown trying to work it all out (look at the
source code to understand this better).</p>
<p>This entry is designed to mislead in many ways. However, if you find
yourself wanting to know the possibilities for navigating a graph, you
will get the answer you seek with no hocus pocus.</p>
<p>What this program does is not witchcraft and there are no spectres, but you
might have a meltdown trying to work it all out (look at the source code to
understand this better).</p>
<p>This entry is designed to mislead in many ways. However, if you find yourself
wanting to know the possibilities for navigating a graph, you will get the
answer you seek with no hocus pocus.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="introduction">Introduction:</h3>
<p>This program reads a directed graph (as lines with integer node IDs),
@@ -164,8 +163,7 @@ and prints the graph’s nodes in reverse-topologically sorted order,
grouped into strongly connected components. Given a set of nodes
representing targets and edges representing dependencies between them,
it produces a build order with any dependency cycles gathered.</p>
<p>For example, the following input (provided as <a
href="example-1.txt">example-1.txt</a>):</p>
<p>For example, the following input (provided as <a href="example-1.txt">example-1.txt</a>):</p>
<pre><code>0 4 8
1 0
2 1 3
@@ -184,205 +182,160 @@ href="example-1.txt">example-1.txt</a>):</p>
6 -&gt; 5, 2
7 -&gt; 3, 6, 7</code></pre>
<p>So, node 0 has edges to / depends on nodes 4 and 8, node 1 depends on
node 0, and so on. Then, it groups the graph’s nodes into strongly
connected components and prints them in reverse-topologically sorted
order:</p>
node 0, and so on. Then, it groups the graph’s nodes into
strongly connected components and prints them in reverse-topologically
sorted order:</p>
<pre><code>0: 8
1: 0 1 4
2: 2 3
3: 5 6
4: 7</code></pre>
<p>It uses <a
href="https://en.wikipedia.org/wiki/Tarjan&#39;s_strongly_connected_components_algorithm">Tarjan’s
strongly connected components algorithm</a> for the grouping and
reverse-topological sorting, along with a bonus hidden implementation of
counting sort, which sorts each group.</p>
<p>For other details about the input format, see <a
href="#issues-and-limitations">Issues and Limitations</a>.</p>
<p>It uses <a href="https://en.wikipedia.org/wiki/Tarjan&#39;s_strongly_connected_components_algorithm">Tarjan’s strongly connected components
algorithm</a>
for the grouping and reverse-topological sorting, along with a bonus hidden
implementation of counting sort, which sorts each group.</p>
<p>For other details about the input format, see <a href="#issues-and-limitations">Issues and
Limitations</a>.</p>
<h3 id="building">Building:</h3>
<p>To build:</p>
<pre><code> ${CC} -o prog prog.c -std=c11 -O3 \
-Wall -Wextra -pedantic -Wno-missing-prototypes</code></pre>
<p><code>-Wno-missing-prototypes</code> is necessary because there
aren’t any prototypes. (They would put the program well over the size
limit.)</p>
<p>Note: The program can also be built with <code>-std=c99</code> or
<code>-std=c89</code>.</p>
<p>If building with <code>-Weverything</code>, then
<code>-Wno-strict-prototypes</code> may also be necessary – the function
pointer declarations for <code>_</code> and <code>B</code> may get
warnings otherwise, for reasons described next in <a
href="#obfuscations">Obfuscations</a>.</p>
<p><code>-Wno-missing-prototypes</code> is necessary because there aren’t any
prototypes. (They would put the program well over the size limit.)</p>
<p>Note: The program can also be built with <code>-std=c99</code> or <code>-std=c89</code>.</p>
<p>If building with <code>-Weverything</code>, then <code>-Wno-strict-prototypes</code>
may also be necessary – the function pointer declarations for
<code>_</code> and <code>B</code> may get warnings otherwise, for reasons described
next in <a href="#obfuscations">Obfuscations</a>.</p>
<h3 id="obfuscations">Obfuscations:</h3>
<ul>
<li><p>This entry uses functions that have a variable number of
arguments, but despite what the rules say, there is no need to be
careful about <code>va_list</code> implementation differences. :) .
There are several references to a function pointer, <code>_</code>, but
it’s called with different numbers of arguments in different places. (In
particular, look at <code>spell</code>.) Because the function pointer
declaration has an empty list of parameters, the argument count and
types are unconstrained. <code>_</code> is set to different functions in
several places, but it is always called with appropriate argument(s) for
its possible current functions. This is allowed by the standard – The
section on
<code>F</code>,<code>I</code>,<code>N</code>,<code>D</code>,<code>M</code>,<code>Y</code>,<code>C</code>,<code>L</code>,<code>U</code>,<code>E</code>
has further details.</p></li>
<li><p>It uses <code>_</code> in three different scopes: as a
<code>goto</code> label (function scope), as an <code>enum</code> name,
and a <code>_</code> function pointer (which is required to have file
scope, since it starts with <code>_</code>). There are also other
<code>_</code>s: it appears in a string, obscured by a hexadecimal
escape sequence (<code>\x5f</code>), and the cauldron is supported by a
giant underscore. (Does this program qualify for Best One
Liner?)</p></li>
<li><p>This entry uses functions that have a variable number of arguments,
but despite what the rules say, there is no need to be careful about
<code>va_list</code> implementation differences. :) . There are several
references to a function pointer, <code>_</code>, but it’s called with different
numbers of arguments in different places. (In particular, look at
<code>spell</code>.) Because the function pointer declaration has an empty list
of parameters, the argument count and types are unconstrained. <code>_</code> is
set to different functions in several places, but it is always called
with appropriate argument(s) for its possible current functions. This
is allowed by the standard – The section on
<code>F</code>,<code>I</code>,<code>N</code>,<code>D</code>,<code>M</code>,<code>Y</code>,<code>C</code>,<code>L</code>,<code>U</code>,<code>E</code> has further details.</p></li>
<li><p>It uses <code>_</code> in three different scopes: as a <code>goto</code> label (function
scope), as an <code>enum</code> name, and a <code>_</code> function pointer (which is required
to have file scope, since it starts with <code>_</code>). There are also other
<code>_</code>s: it appears in a string, obscured by a hexadecimal escape sequence
(<code>\x5f</code>), and the cauldron is supported by a giant underscore.
(Does this program qualify for Best One Liner?)</p></li>
<li><p>Most of the variables are not only global, but used for unrelated
purposes at different times, so just renaming them while studying the
program should make it even more confusing. The few variables local to
functions have their names reused for different things in other
functions.</p></li>
<li><p>There is an enum early on that defines several single-letter
identifiers:
<code>F</code>,<code>I</code>,<code>N</code>,<code>D</code>,<code>M</code>,<code>Y</code>,<code>C</code>,<code>L</code>,<code>U</code>,<code>E</code>.
These are used for array offsets, both individually and in combination.
The first several values are also a clue: ISO/IEC 9899:1999 chapter
6.7.5.3 verse 14 describes how function declarators with an empty
parameter list behave. (As does 3.5.4.3 for ANSI C, which explains the
<code>0x3543</code> that appears soon after.)</p></li>
<li><p>Several parts of the program’s state are stashed in otherwise
unused offsets of the node arrays. These locations are accessed in
multiple ways, such as using <code>I[p]</code> (where
<code>I == 7</code>) as well as <code>p[F+L]</code> (6+1), or
<code>b[M-N]</code> (14-5) and <code>U[b]</code> (where
<code>U == 9</code>).</p></li>
<li><p>The other identifiers are misleading, punny, or both.
<code>spectre</code> does not exploit CVE-2017-5753 or CVE-2017-5715,
for example – it just fits the witch theme. <code>cast</code> doesn’t
cast, <code>hex</code> has nothing to do with hexadecimal,
<code>bubble</code> is not bubble sort, there is no undefined behavior
in <code>nasal_demons</code>, and <code>main()</code> has absolutely
nothing to do with a hand.</p></li>
<li><p>For well-formed input, how the program determines when to exit is
a bit obscure. <code>main()</code> ends with a <code>goto</code> leading
back to an earlier <code>_</code> label, so it just loops forever, and
<code>exit</code> only appears in code paths related to error-handling.
It looks like <code>cast</code> calls <code>meltdown</code> with its
second argument set to 0, which would call <code>exit</code>, but
running in <code>gdb(1)</code> with a breakpoint on <code>cast</code>
reveals that it isn’t being called…</p></li>
<li><p>Instead of using <code>isdigit(3)</code>, the program checks the
numeric value of each <code>char</code>, and literals that would suggest
comparing against e.g. <code>'0'</code> are specified in octal in one
place, and produced by arithmetic using the <code>enum</code>
elsewhere.</p></li>
<li><p>Common conventions are subverted: <code>i</code> is not a loop
index, <code>argv</code> and <code>argc</code>’s names are
swapped.</p></li>
<li><p><code>NULL</code> does not appear in the program. Instead,
<code>argc[argv]</code> (which is required to be a NULL pointer) is
saved and passed to where its value is needed.</p></li>
<li><p>Oh, and the program is squashed into the shape of a bubbling
cauldron, on top of a giant underscore, so there’s that.</p></li>
<li><p>There is an enum early on that defines several single-letter identifiers:
<code>F</code>,<code>I</code>,<code>N</code>,<code>D</code>,<code>M</code>,<code>Y</code>,<code>C</code>,<code>L</code>,<code>U</code>,<code>E</code>. These are used for array offsets,
both individually and in combination. The first several values are also a
clue: ISO/IEC 9899:1999 chapter 6.7.5.3 verse 14 describes how function
declarators with an empty parameter list behave. (As does 3.5.4.3 for ANSI C,
which explains the <code>0x3543</code> that appears soon after.)</p></li>
<li><p>Several parts of the program’s state are stashed in otherwise unused
offsets of the node arrays. These locations are accessed in multiple
ways, such as using <code>I[p]</code> (where <code>I == 7</code>) as well as <code>p[F+L]</code> (6+1),
or <code>b[M-N]</code> (14-5) and <code>U[b]</code> (where <code>U == 9</code>).</p></li>
<li><p>The other identifiers are misleading, punny, or both. <code>spectre</code> does
not exploit CVE-2017-5753 or CVE-2017-5715, for example – it just fits
the witch theme. <code>cast</code> doesn’t cast, <code>hex</code> has nothing to do with
hexadecimal, <code>bubble</code> is not bubble sort, there is no undefined
behavior in <code>nasal_demons</code>, and <code>main()</code> has absolutely nothing to do
with a hand.</p></li>
<li><p>For well-formed input, how the program determines when to exit is a
bit obscure. <code>main()</code> ends with a <code>goto</code> leading back to an earlier <code>_</code>
label, so it just loops forever, and <code>exit</code> only appears in code paths
related to error-handling. It looks like <code>cast</code> calls <code>meltdown</code> with
its second argument set to 0, which would call <code>exit</code>, but running in
<code>gdb(1)</code> with a breakpoint on <code>cast</code> reveals that it isn’t being called…</p></li>
<li><p>Instead of using <code>isdigit(3)</code>, the program checks the numeric value of
each <code>char</code>, and literals that would suggest comparing against e.g. <code>'0'</code>
are specified in octal in one place, and produced by arithmetic using
the <code>enum</code> elsewhere.</p></li>
<li><p>Common conventions are subverted: <code>i</code> is not a loop index, <code>argv</code> and
<code>argc</code>’s names are swapped.</p></li>
<li><p><code>NULL</code> does not appear in the program. Instead, <code>argc[argv]</code> (which is
required to be a NULL pointer) is saved and passed to where its value
is needed.</p></li>
<li><p>Oh, and the program is squashed into the shape of a bubbling cauldron,
on top of a giant underscore, so there’s that.</p></li>
</ul>
<h3 id="issues-and-limitations">Issues and Limitations:</h3>
<ul>
<li><p>Despite appearances, it does not handle numbers in hex, or
provide a <code>curses(3)</code>-based interface.</p></li>
<li><p>The expected input format is zero or more lines of
space-separated integers. If other characters appear in the input, it
will either reject the input entirely and exit with a non-zero status,
or skip number(s) adjacent to the non-digit characters, depending on
where the characters appear. Tabs and multiple consecutive spaces are
handled correctly, however.</p></li>
<li><p>Individual lines of input longer than <code>0x3543 - 1</code>
bytes will be split and processed as if they were multiple lines of
input, which can produce incorrect results. This magic number’s
significance is described earlier.</p></li>
<li><p>The algorithm expects its input to represent a fully connected
graph. While the output is otherwise topologically sorted, if there are
nodes completely unconnected to the rest of the graph (with or without
self-cycles), they will be output as soon as they are processed – this
means that, when there are disconnected nodes, reordering the input
lines can produce different output. Addressing this by adding another
pass is would put the program over the size limit.</p></li>
<li><p>While the node IDs don’t need to be consecutive or start at 0,
the implementation doesn’t have special handling for sparse graphs. If
you give it a graph with nodes numbered 0 and 2147483647, it will
attempt to allocate sufficient memory (potentially around 32 GB) for the
entire range of graph nodes, even if those are the only ones. If memory
allocation returns NULL, it will gracefully exit, otherwise it will
succeed, eventually, perhaps after a great deal of swapping.</p></li>
<li><p>Node IDs &gt;= 2147483648 will cause the program to print an
error message and exit with a non-zero status. This shrinks the code
that detects overflowing the array size by a bit.</p></li>
<li><p>A very large group of nodes in a cycle can cause a stack
overflow. This typically takes over 100,000 nodes, and depends on the
order the nodes are visited. Addressing this would put the program over
the size limit.</p></li>
<li><p>The implementation depends on the characters <code>'0'</code>,
<code>'1'</code>, … <code>'9'</code> having the values <code>48</code>
through <code>57</code>, rather than using <code>isdigit(3)</code>. As
noted above, this program has nothing to do with a hand.</p></li>
<li><p>Despite appearances, it does not handle numbers in hex, or provide
a <code>curses(3)</code>-based interface.</p></li>
<li><p>The expected input format is zero or more lines of space-separated
integers. If other characters appear in the input, it will either
reject the input entirely and exit with a non-zero status, or skip
number(s) adjacent to the non-digit characters, depending on where the
characters appear. Tabs and multiple consecutive spaces are handled
correctly, however.</p></li>
<li><p>Individual lines of input longer than <code>0x3543 - 1</code> bytes will be
split and processed as if they were multiple lines of input, which can
produce incorrect results. This magic number’s significance is
described earlier.</p></li>
<li><p>The algorithm expects its input to represent a fully connected graph.
While the output is otherwise topologically sorted, if there are nodes
completely unconnected to the rest of the graph (with or without
self-cycles), they will be output as soon as they are processed –
this means that, when there are disconnected nodes, reordering the
input lines can produce different output. Addressing this by adding
another pass is would put the program over the size limit.</p></li>
<li><p>While the node IDs don’t need to be consecutive or start at 0, the
implementation doesn’t have special handling for sparse graphs. If you
give it a graph with nodes numbered 0 and 2147483647, it will attempt
to allocate sufficient memory (potentially around 32 GB) for the
entire range of graph nodes, even if those are the only ones. If
memory allocation returns NULL, it will gracefully exit, otherwise it
will succeed, eventually, perhaps after a great deal of swapping.</p></li>
<li><p>Node IDs &gt;= 2147483648 will cause the program to print an error
message and exit with a non-zero status. This shrinks the code that
detects overflowing the array size by a bit.</p></li>
<li><p>A very large group of nodes in a cycle can cause a stack overflow.
This typically takes over 100,000 nodes, and depends on the order the
nodes are visited. Addressing this would put the program over the size
limit.</p></li>
<li><p>The implementation depends on the characters <code>'0'</code>, <code>'1'</code>, … <code>'9'</code> having
the values <code>48</code> through <code>57</code>, rather than using <code>isdigit(3)</code>. As noted above,
this program has nothing to do with a hand.</p></li>
</ul>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
Reserved. You are free to share and adapt this file under the terms of
this license:</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:</p>
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
<p>For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/</p>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2018vokes"><a name="inventory"></a>Inventory for
2018/vokes</h1>
<h1 id="inventory-for-2018vokes"><a name="inventory"></a>Inventory for 2018/vokes</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/prog.c">prog.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/example-1.txt">example-1.txt</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/example-2.txt">example-2.txt</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/example-tab.txt">example-tab.txt</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/ioccc.txt">ioccc.txt</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/try.sh">try.sh</a>
- how to run</li>
<li><a href="2018_vokes.tar.bz2">2018_vokes.tar.bz2</a> - download entry
source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/prog.c">prog.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/prog.orig.c">prog.orig.c</a> - original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/example-1.txt">example-1.txt</a> - sample input</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/example-2.txt">example-2.txt</a> - sample input</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/example-tab.txt">example-tab.txt</a> - sample input</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/ioccc.txt">ioccc.txt</a> - sample input</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/try.sh">try.sh</a> - how to run</li>
<li><a href="2018_vokes.tar.bz2">2018_vokes.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+65 -93
View File
@@ -130,8 +130,8 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Don_Yang">Don Yang</a><br>
Location: <a href="../../location.html#US">US</a> - <em>United States of
America</em> (<em>United States</em>) <br><br></li>
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -142,39 +142,34 @@ America</em> (<em>United States</em>) <br><br></li>
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<h2 id="to-use">To use:</h2>
<p>The author suggested that after compilation one should look at the
generated files. For instance:</p>
<p>The author suggested that after compilation one should look at the generated
files. For instance:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="fu">less</span> generated1.c</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="fu">less</span> generated2.c</span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="fu">less</span> generated3.c</span></code></pre></div>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Code should be readable in any direction! This tool will help you
rotate your code so you don’t have to stare at it sideways or even
upside down. Rotating this program left and recompiling will reveal
other tools including a right rotate and a shift program.</p>
<p>Strange things happen <a
href="https://en.wikipedia.org/wiki/Wacky_Wednesday_(book)">when the
world is upside down</a>! It is entirely possible that this remark is
completely misleading.</p>
<p>Code should be readable in any direction! This tool will help you rotate your
code so you don’t have to stare at it sideways or even upside down. Rotating
this program left and recompiling will reveal other tools including a right rotate
and a shift program.</p>
<p>Strange things happen <a href="https://en.wikipedia.org/wiki/Wacky_Wednesday_(book)">when the world is upside
down</a>! It is entirely possible
that this remark is completely misleading.</p>
<p>What exactly does the shift program do?</p>
<p>Like a great sliding puzzle (hint) this entry has six more programs
that will reveal messages and one more tool that can be used to reveal
the final message hidden in the original source. All of these can be
created using combinations of <code>./left</code>, <code>./right</code>
and <code>./shift</code> and the additionally generated programs.</p>
<p>Like a great sliding puzzle (hint) this entry has six more programs that will
reveal messages and one more tool that can be used to reveal the final message
hidden in the original source. All of these can be created using combinations
of <code>./left</code>, <code>./right</code> and <code>./shift</code> and the additionally generated programs.</p>
<p>The final message can be revealed using</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./msg9</span> <span class="op">&lt;</span> prog.c</span></code></pre></div>
<p>But what combinations will generate <code>./msg3</code>,
<code>./msg4</code>, <code>./msg5</code>, <code>./msg6</code>,
<code>./msg7</code>, <code>./msg8</code> and finally
<code>./msg9</code>?</p>
<p>But what combinations will generate <code>./msg3</code>, <code>./msg4</code>, <code>./msg5</code>, <code>./msg6</code>,
<code>./msg7</code>, <code>./msg8</code> and finally <code>./msg9</code>?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="tools-usage">Tools’ usage:</h3>
<p><code>Nuko</code> is a text rotator: given some text in
<code>stdin</code>, <code>Nuko</code> will write the same text to
<code>stdout</code>, but rotated 90 degrees counterclockwise.</p>
<p><code>Nuko</code> is a text rotator: given some text in <code>stdin</code>, <code>Nuko</code> will write the
same text to <code>stdout</code>, but rotated 90 degrees counterclockwise.</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> prog.c <span class="at">-o</span> left</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./left</span> <span class="op">&lt;</span> input.txt <span class="op">&gt;</span> rotated_counterclockwise.txt</span></code></pre></div>
<p>Due to static memory allocation, only the first 1K columns by 1K rows
@@ -187,9 +182,9 @@ tool with dynamic memory allocation is included:</p>
counterclockwise. Also, it can handle files larger than 1024x1024,
depending on how much memory you have.</p>
<p>Of course we wouldn’t stop with just two rotations, if we continue to
rotate counterclockwise once more, we get another program. This program
outputs a single message to <code>stdout</code>, which is the name of
the series that <code>Nuko</code> came from.</p>
rotate counterclockwise once more, we get another program. This
program outputs a single message to <code>stdout</code>, which is the name of the
series that <code>Nuko</code> came from.</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./left</span> <span class="op">&lt;</span> prog.c <span class="kw">|</span> <span class="ex">./left</span> <span class="op">&gt;</span> r2.c</span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> r2.c <span class="at">-o</span> msg0</span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./msg0</span></span></code></pre></div>
@@ -199,50 +194,46 @@ leading whitespaces:</p>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> r3.c <span class="at">-o</span> shift</span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./shift</span> <span class="op">&lt;</span> input.txt <span class="op">&gt;</span> no_leading_space.txt</span></code></pre></div>
<p>Where this might be useful, besides ruining the formatting of certain
files, is that it completes the set of tools needed to solve the puzzle
that is embedded in <a href="prog.c">prog.c</a>.</p>
files, is that it completes the set of tools needed to solve the
puzzle that is embedded in <a href="prog.c">prog.c</a>.</p>
<h3 id="puzzle-box">Puzzle box:</h3>
<p>Notice how the edges of <a href="prog.c">prog.c</a> contain two
notches. By rotating <a href="prog.c">prog.c</a> and removing leading
space, the code would be shifted one space toward one of those notches
(and create a new notch on the other side). This shifted code behaves
slightly different from the original program. For example, here are two
more messages that can be produced:</p>
<p>Notice how the edges of <a href="prog.c">prog.c</a> contain two notches. By rotating
<a href="prog.c">prog.c</a> and removing leading space, the code would be shifted one space
toward one of those notches (and create a new notch on the other
side). This shifted code behaves slightly different from the original
program. For example, here are two more messages that can be
produced:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./shift</span> <span class="op">&lt;</span> prog.c <span class="kw">|</span> <span class="ex">./right</span> <span class="op">&gt;</span> msg1.c <span class="kw">&amp;&amp;</span> <span class="fu">gcc</span> msg1.c <span class="at">-o</span> msg1 <span class="kw">&amp;&amp;</span> <span class="ex">./msg1</span></span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./shift</span> <span class="op">&lt;</span> prog.c <span class="kw">|</span> <span class="ex">./left</span> <span class="op">&gt;</span> msg2.c <span class="kw">&amp;&amp;</span> <span class="fu">gcc</span> msg2.c <span class="at">-o</span> msg2 <span class="kw">&amp;&amp;</span> <span class="ex">./msg2</span></span></code></pre></div>
<p>In total, there are 9 embedded strings that can be produced via a
sequence of rotates and shifts, one of which can be used to extract the
10th final string from <a href="prog.c">prog.c</a>. The intent is to
simulate those wooden puzzle boxes that can be opened by pushing and
shifting various well-concealed seams. Thus, finding the correct
sequence of rotates and shifts is left as an exercise to the reader (but
if you are really lazy, just read the <a
href="Makefile">Makefile</a>).</p>
<p>Source code for all the tools needed to solve this puzzle are
embedded in <a href="prog.c">prog.c</a>, all you need is a C
compiler.</p>
sequence of rotates and shifts, one of which can be used to extract
the 10th final string from <a href="prog.c">prog.c</a>. The intent is to simulate those
wooden puzzle boxes that can be opened by pushing and shifting various
well-concealed seams. Thus, finding the correct sequence of rotates
and shifts is left as an exercise to the reader (but if you are really
lazy, just read the <a href="Makefile">Makefile</a>).</p>
<p>Source code for all the tools needed to solve this puzzle are embedded
in <a href="prog.c">prog.c</a>, all you need is a C compiler.</p>
<h3 id="features">Features</h3>
<ul>
<li><p>Code compiles when rotated 4 ways. This required a bit of
patience to achieve. Code still compiles even with one column of text
shifted. This required even more patience.</p></li>
<li><p>All rotated and shifted variants compile without warnings. This
involves various tweaks to satisfy cases where the compiler is overly
protective, including but not limited to the “1125” at line 4 as opposed
to “1025”, to satisfy
<li><p>Code compiles when rotated 4 ways. This required a bit of patience to
achieve. Code still compiles even with one column of text shifted. This
required even more patience.</p></li>
<li><p>All rotated and shifted variants compile without warnings. This involves
various tweaks to satisfy cases where the compiler is overly protective, including
but not limited to the “1125” at line 4 as opposed to “1025”, to satisfy
<code>-Waggresive-loop-optimizations</code>.</p></li>
<li><p>CRC32 of the code is embedded in the code itself.</p></li>
<li><p>Process for writing <a href="prog.c">prog.c</a> is available in
<a href="spoiler.html">spoiler.html</a>.</p></li>
</ul>
<h3 id="compatibility">Compatibility:</h3>
<p><code>Nuko</code> and the rotated tools accept only ASCII files where
each character maps to exactly one byte. Also, end-of-line sequence is
assumed to be LF only, as opposed to CR-LF. All control characters are
treated like normal printable characters, so files containing tabs will
look weird after rotation, for example.</p>
<p><code>Nuko</code> has been verified to work with these compiler / OS
combinations:</p>
<p><code>Nuko</code> and the rotated tools accept only ASCII files where each
character maps to exactly one byte. Also, end-of-line sequence is
assumed to be LF only, as opposed to CR-LF. All control characters
are treated like normal printable characters, so files containing tabs
will look weird after rotation, for example.</p>
<p><code>Nuko</code> has been verified to work with these compiler / OS combinations:</p>
<ul>
<li>gcc 4.8.4 on Linux</li>
<li>gcc 4.9.2 on Linux</li>
@@ -254,56 +245,37 @@ combinations:</p>
<li>clang 5.0.1 on Cygwin</li>
<li>tcc 0.9.25 on JS/Linux</li>
</ul>
<p><code>Nuko</code> compiles without warnings with all compilers above,
even with <code>-Wall -Wextra -pedantic</code> for gcc and clang.</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
Reserved. You are free to share and adapt this file under the terms of
this license:</p>
<p><code>Nuko</code> compiles without warnings with all compilers above, even with
<code>-Wall -Wextra -pedantic</code> for gcc and clang.</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:</p>
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
<p>For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/</p>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2018yang"><a name="inventory"></a>Inventory for
2018/yang</h1>
<h1 id="inventory-for-2018yang"><a name="inventory"></a>Inventory for 2018/yang</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/yang/prog.c">prog.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/yang/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/yang/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/yang/try.sh">try.sh</a>
- how to run</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/yang/prog.c">prog.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/yang/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/yang/prog.orig.c">prog.orig.c</a> - original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/yang/try.sh">try.sh</a> - how to run</li>
<li><a href="spoiler.html">spoiler.html</a> - SPOILER WARNING</li>
<li><a href="2018_yang.tar.bz2">2018_yang.tar.bz2</a> - download entry
source</li>
<li><a href="2018_yang.tar.bz2">2018_yang.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/yang/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/yang/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/yang/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/yang/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/yang/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/yang/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->