build index.html for all winners

Updated manifest as per recent file changes.

Updated winner `.winner.json` to reflect the manifest changes.

Added [bin/all_run.sh](bin/all_run.sh) tool to run a command over
all winning entries.

These tools had slight improvements in the help usage message:

* bin/gen-author.sh VERSION="1.3.1 2024-01-16"
* bin/gen-inventory.sh VERSION="1.0.1 2024-01-16"
* bin/pandoc_wrapper.sh VERSION="1.3.1 2024-01-16"
* bin/subst.default.sh VERSION="1.1.1 2024-01-16"
* bin/subst.winner-index.sh VERSION="1.1.1 2024-01-16"

The `bin/readme2index.sh` tool was improved so that
if the `index.html` file exists and the tool forms
the exact same content, then the file `index.html`
file is NOT touched.

* bin/readme2index.sh VERSION="1.1 2024-01-16"

We used the following command to generate `index.html` files
for all winning entries:

```sh
bin/all_run.sh -v 3 bin/readme2index.sh
```

NOTE: We have not (yet) built HTML files above the winner directory
level (e.g., no year level nor top level HTML), nor have be built
non-index HTML files for winners.

NOTE: By default we are running `pandoc(1)` with:

```
--fail-if-warnings=true
```

This means that any problems with markdown to HTML
generates an error.  This is done to be sure that
the HTML conversion is clean.

We had to fix the following `README.md` files:

* `2000/rince/README.md`

The reference [^2] was never used.  We made a guess that [^2] applies
to the same spot as [^1].  Perhaps there is a better spot where
[^2] applies?

NOTE: For every reference, there MUST be some place where that
reference is used.

* 2012/vik/README.md

The string "$...$" is assumed to be a TeX encoded string.

NOTE: Every "$..$" needs to be backslashed as in "\$..\$".

* 2018/burton1/README.md

The reference [2] was duplicated.  We changed the
second [2] to [3].

NOTE: Every reference needs to have a unique number.

* 2020/carlini/README.md

The string "$...$" is assumed to be a TeX encoded string.

NOTE: Every "$..$" needs to be backslashed as in "\$..\$".

We also found 2 errors in the `author/author_handle.json` file set:

* author/Anonymous_2001.json

The `author/Anonymous_2001.json` file was missing.

* author/Jari_Arkko.json

The winner ID for `1989_jar.1` had a typo.
This commit is contained in:
Landon Curt Noll committed 2024-01-17 00:32:39 -08:00
1 parent 893cd915b6
commit c1466f5165
350 files changed
+95242 -4217

No files matched your search

+307 -13
View File
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
@@ -6,27 +8,319 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2018/algmyr/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2018 algmyr</title>
<meta name="description" content="IOCCC year: 2018 IOCCC winner: algmyr winner index page">
<meta name="keywords" content="IOCCC,2018,algmyr,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2018/algmyr</title>
<meta name="description" content="2018 IOCCC winner algmyr">
<meta name="keywords" content="IOCCC, 2018, IOCCC 2018, IOCCC winner, algmyr">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2018 algmyr</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2018/algmyr</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Falgmyr%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2018/algmyr/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../anderson/index.html">&larr; anderson</a>
<a class="Left" href="../index.html">&uarr; 2018 &uarr;</a>
<a class="Left" href="../bellard/index.html">bellard &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.mid.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Anton_Algmyr">Anton Älgmyr</a><br>
Location: <a href="/temp-test-ioccc/location.html#SE">SE</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<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.md#faq3_10">FAQ 3.10 - How do I compile and use an IOCCC
winner 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.md#2018-algmyr">2018
algmyr in bugs.md</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="fu">cat</span> prog.c <span class="kw">|</span> <span class="ex">./prog</span> <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>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="at">-d</span> 2 0 out.raw <span class="co"># Decode the first (0th) channel out of two</span></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>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>
<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>
<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
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>
<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>
<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>
<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>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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
<h1 id="inventory-for-2018algmyr"><a name="inventory"></a>Inventory for
2018/algmyr</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/algmyr/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/algmyr/Makefile">Makefile</a>
- winner 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
winning source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<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/.winner.json">.winner.json</a>
- description of winner in JSON</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/gen-inventory.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Falgmyr%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+235 -13
View File
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
@@ -6,27 +8,247 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2018/anderson/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2018 anderson</title>
<meta name="description" content="IOCCC year: 2018 IOCCC winner: anderson winner index page">
<meta name="keywords" content="IOCCC,2018,anderson,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2018/anderson</title>
<meta name="description" content="2018 IOCCC winner anderson">
<meta name="keywords" content="IOCCC, 2018, IOCCC 2018, IOCCC winner, anderson">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2018 anderson</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2018/anderson</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.first.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fanderson%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2018/anderson/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left Disabled" href="#">first entry</a>
<a class="Left" href="../index.html">&uarr; 2018 &uarr;</a>
<a class="Left" href="../algmyr/index.html">algmyr &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.first.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Derek_Anderson">Derek
Anderson</a><br> Location: <a
href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<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>
<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>
<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> above.</p>
<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
down</a>!</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="compiling-the-program">Compiling the program:</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">-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>
<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>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>
<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>
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
<h1 id="inventory-for-2018anderson"><a name="inventory"></a>Inventory
for 2018/anderson</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/anderson/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/anderson/Makefile">Makefile</a>
- winner 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.sh">try.sh</a>
- how to run</li>
<li><a href="2018_anderson.tar.bz2">2018_anderson.tar.bz2</a> - download
winning source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<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/.winner.json">.winner.json</a>
- description of winner in JSON</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/gen-inventory.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fanderson%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+256 -13
View File
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
@@ -6,27 +8,268 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2018/bellard/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2018 bellard</title>
<meta name="description" content="IOCCC year: 2018 IOCCC winner: bellard winner index page">
<meta name="keywords" content="IOCCC,2018,bellard,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2018/bellard</title>
<meta name="description" content="2018 IOCCC winner bellard">
<meta name="keywords" content="IOCCC, 2018, IOCCC 2018, IOCCC winner, bellard">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2018 bellard</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2018/bellard</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fbellard%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2018/bellard/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../algmyr/index.html">&larr; algmyr</a>
<a class="Left" href="../index.html">&uarr; 2018 &uarr;</a>
<a class="Left" href="../burton1/index.html">burton1 &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.mid.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Fabrice_Bellard">Fabrice
Bellard</a><br> Location: <a
href="/temp-test-ioccc/location.html#FR">FR</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<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>
<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>
<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">eog</span> lena.ppm <span class="co"># On Linux</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="ex">open</span> <span class="at">-a</span> Preview lena.ppm <span class="co"># On macOS</span></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a><span class="ex">pngtopam</span> <span class="op">&lt;</span> Lenna.png <span class="kw">|</span> <span class="ex">pnmscale</span> 0.25 <span class="kw">|</span> <span class="ex">cjpeg</span> <span class="at">-arithmetic</span> <span class="at">-dct</span> float <span class="at">-quality</span> 14 <span class="op">&gt;</span> small.jpg</span></code></pre></div>
<p>NOTE: <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.md#netpbm">FAQ 3.15 -
How do I compile and install netpbm for entries that require it?</a> and
<a href="/faq.md#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>
<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>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>
<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>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
includes the following features:</p>
<ul>
<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>
<p>Although the program was optimized to decompress its built-in image,
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>
<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>
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
<h1 id="inventory-for-2018bellard"><a name="inventory"></a>Inventory for
2018/bellard</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/bellard/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/bellard/Makefile">Makefile</a>
- winner 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="2018_bellard.tar.bz2">2018_bellard.tar.bz2</a> - download
winning source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<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/.winner.json">.winner.json</a>
- description of winner in JSON</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>
</ul>
<!-- END: next line ends content generated by: bin/gen-inventory.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fbellard%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+1 -1
View File
@@ -210,7 +210,7 @@ not yet written for UNIX).
[1]: http://minnie.tuhs.org/cgi-bin/utree.pl
[2]: http://ioccc.org/all/README
[2]: https://web.archive.org/web/20180521074522/http://www.computerworld.com.au/article/279011/a-z_programming_languages_bourne_shell_sh/?pp=4
[3]: https://web.archive.org/web/20180521074522/http://www.computerworld.com.au/article/279011/a-z_programming_languages_bourne_shell_sh/?pp=4
More significant is that v7 `printf(3)` does not report the number of characters
written, and therefore 111 compiles but does not work correctly; 113 is the
+394 -13
View File
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
@@ -6,27 +8,406 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2018/burton1/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2018 burton1</title>
<meta name="description" content="IOCCC year: 2018 IOCCC winner: burton1 winner index page">
<meta name="keywords" content="IOCCC,2018,burton1,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2018/burton1</title>
<meta name="description" content="2018 IOCCC winner burton1">
<meta name="keywords" content="IOCCC, 2018, IOCCC 2018, IOCCC winner, burton1">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2018 burton1</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2018/burton1</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fburton1%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2018/burton1/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../bellard/index.html">&larr; bellard</a>
<a class="Left" href="../index.html">&uarr; 2018 &uarr;</a>
<a class="Left" href="../burton2/index.html">burton2 &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.mid.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Dave_Burton">Dave Burton</a><br>
Location: <a href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<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>
<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>
<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>
<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>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>
</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>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>
</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>
<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>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a>O<span class="op">||</span> puts<span class="op">(</span>o<span class="op">);}</span> main <span class="op">(</span>l<span class="op">){</span></span>
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span><span class="op">(;~(</span>l<span class="op">=</span>getchar<span class="op">())</span> <span class="op">;</span>I<span class="op">(</span>O</span>
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a><span class="op">&amp;=</span><span class="dv">15</span> <span class="op">))</span>o<span class="op">[</span> O<span class="op">++</span> <span class="op">]=</span><span class="dv">4</span><span class="op">&lt;</span></span>
<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>
<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>
<span id="cb7-4"><a href="#cb7-4" 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>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><span class="dv">15</span><span class="op">)||</span>puts<span class="op">(</span>o<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">&gt;</span><span class="dv">1</span><span class="op">&amp;&amp;</span>puts<span class="op">(</span>o<span class="op">);}</span></span>
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a><span class="co">// 115</span></span>
<span id="cb7-6"><a href="#cb7-6" 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>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">=-~</span>O<span class="op">&amp;</span><span class="dv">15</span><span class="op">)||</span>puts<span class="op">(</span>o<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">&amp;&amp;</span>puts<span class="op">(</span>o<span class="op">);}</span></span>
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a><span class="co">// 113</span></span>
<span id="cb7-8"><a href="#cb7-8" 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>O<span class="op">=~</span>l<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">&amp;</span><span class="dv">15</span><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>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></span>
<span id="cb7-9"><a href="#cb7-9" aria-hidden="true" tabindex="-1"></a><span class="co">// 112</span></span>
<span id="cb7-10"><a href="#cb7-10" 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>O<span class="op">=~</span>l<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>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></span>
<span id="cb7-11"><a href="#cb7-11" aria-hidden="true" tabindex="-1"></a><span class="co">// 111</span></span>
<span id="cb7-12"><a href="#cb7-12" 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>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-13"><a href="#cb7-13" aria-hidden="true" tabindex="-1"></a><span class="co">// 110</span></span>
<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>
<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>
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a>O<span class="op">;</span>main<span class="op">(</span>l<span class="op">){</span><span class="cf">while</span><span class="op">(~(</span>l<span class="op">=</span>getchar<span class="op">()))</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%02x%c</span><span class="st">&quot;</span><span class="op">,</span>l<span class="op">,++</span>O<span class="op">&amp;</span><span class="dv">15</span><span class="op">?</span><span class="dv">32</span><span class="op">:</span><span class="dv">10</span><span class="op">);</span>O<span class="op">&amp;</span><span class="dv">15</span><span class="op">&amp;&amp;</span>puts<span class="op">(</span><span class="st">&quot;&quot;</span><span class="op">);}</span></span>
<span id="cb8-5"><a href="#cb8-5" aria-hidden="true" tabindex="-1"></a><span class="co">// 78</span></span>
<span id="cb8-6"><a href="#cb8-6" 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>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">&amp;</span><span class="dv">15</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-7"><a href="#cb8-7" aria-hidden="true" tabindex="-1"></a><span class="co">// 77</span></span>
<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>
<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>
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true" tabindex="-1"></a><span class="ex">75</span></span>
<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/README.md">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>
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="/all/README.md">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>
</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="http://ioccc.org/all/README">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>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>
</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>
<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>
<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>
<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>
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
<h1 id="inventory-for-2018burton1"><a name="inventory"></a>Inventory for
2018/burton1</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/Makefile">Makefile</a>
- winner 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
winning source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<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/.winner.json">.winner.json</a>
- description of winner in JSON</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/gen-inventory.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fburton1%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+713 -13
View File
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
@@ -6,27 +8,725 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2018/burton2/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2018 burton2</title>
<meta name="description" content="IOCCC year: 2018 IOCCC winner: burton2 winner index page">
<meta name="keywords" content="IOCCC,2018,burton2,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2018/burton2</title>
<meta name="description" content="2018 IOCCC winner burton2">
<meta name="keywords" content="IOCCC, 2018, IOCCC 2018, IOCCC winner, burton2">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2018 burton2</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2018/burton2</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fburton2%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2018/burton2/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../burton1/index.html">&larr; burton1</a>
<a class="Left" href="../index.html">&uarr; 2018 &uarr;</a>
<a class="Left" href="../ciura/index.html">ciura &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.mid.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Dave_Burton">Dave Burton</a><br>
Location: <a href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<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>
<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="pp">[-</span><span class="ss">tcksri</span><span class="pp">]</span> <span class="op">&lt;</span> file.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>
<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="https://www.ioccc.org/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>
<p><code>tac</code> computes C program size<br />
(obfuscated / otherwise)<br />
by splitting code as tokens small,<br />
ignoring space, then counting all.<br />
</p>
<p>It tries quite hard to act the same<br />
as counting tool of I-OCCC fame.<br />
Some bugs were fixed, it’s faster too,<br />
and does more things, just add some glue!<br />
</p>
<p>It does far more than print the size:<br />
the token part’s a better prize!<br />
With each upon on a single line,<br />
how many things can you design?<br />
</p>
<p>Included is a keyword sorter,<br />
de-obfuscator, freq reporter.<br />
With code produced as little parts,<br />
just add your own creative arts.<br />
</p>
<p>But first you have to figure out<br />
the braces part, without a doubt!<br />
And then the code - it isn’t easy:<br />
for as else? That’s rather cheesy!<br />
</p>
<p>The rest of it is standard fare:<br />
expressions strange, the globals bare,<br />
confusing symbols one and oh,<br />
and precedence you have to know.<br />
</p>
<p>The keyword list was made external,<br />
because of standards change eternal.<br />
Thus other languages can now,<br />
be counted just like C, somehow!<br />
</p>
<p>I hope you find this code obscure<br />
enough to win, and thus procure<br />
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
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>
<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>
</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><code>I</code> is not a reserved word.</li>
<li><code>tac</code> correctly penetrates <a
href="/2014/birken/README.md" 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>
</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>
<h3 id="backwards-compatibility">Backwards Compatibility:</h3>
<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.md">discrepancies.md</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.md">discrepancies.md</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>
</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>
<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>
<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>
<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="co">#!/usr/bin/env bash</span></span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="kw">function</span><span class="fu"> iskeyword</span> <span class="kw">{</span></span>
<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>
<pre><code>1980s 1990s 2000s 2010s
----- ----- ----- -----
94 if 532 char 375 if 254 int
69 for 524 if 372 char 217 for
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
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>
<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>
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a><span class="st"> f=&quot;c11&quot;; while(getline &lt;f &gt; 0) kw[$0]++; close(f);</span></span>
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a><span class="st">}</span></span>
<span id="cb11-7"><a href="#cb11-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-8"><a href="#cb11-8" aria-hidden="true" tabindex="-1"></a><span class="st">function iskw(a) { return a in kw }</span></span>
<span id="cb11-9"><a href="#cb11-9" aria-hidden="true" tabindex="-1"></a><span class="st">function indent(a) { return sprintf(&quot;%*s&quot;, n*3, &quot; &quot;) }</span></span>
<span id="cb11-10"><a href="#cb11-10" aria-hidden="true" tabindex="-1"></a><span class="st">function newline() { if (!infor &amp;&amp; last != nl) printf last=nl; }</span></span>
<span id="cb11-11"><a href="#cb11-11" aria-hidden="true" tabindex="-1"></a><span class="st">function show(a) {</span></span>
<span id="cb11-12"><a href="#cb11-12" aria-hidden="true" tabindex="-1"></a><span class="st"> if (last==nl) printf &quot;%s&quot;, indent()</span></span>
<span id="cb11-13"><a href="#cb11-13" aria-hidden="true" tabindex="-1"></a><span class="st"> printf &quot;%s%s&quot;, space(), a</span></span>
<span id="cb11-14"><a href="#cb11-14" aria-hidden="true" tabindex="-1"></a><span class="st"> last=a</span></span>
<span id="cb11-15"><a href="#cb11-15" aria-hidden="true" tabindex="-1"></a><span class="st">}</span></span>
<span id="cb11-16"><a href="#cb11-16" aria-hidden="true" tabindex="-1"></a><span class="st">function space() {</span></span>
<span id="cb11-17"><a href="#cb11-17" aria-hidden="true" tabindex="-1"></a><span class="st"> return iskw(last) ||</span></span>
<span id="cb11-18"><a href="#cb11-18" aria-hidden="true" tabindex="-1"></a><span class="st"> (last ~ /[A-Za-z0-9_+-\/%^[&amp;\]\)=:&lt;&gt;;]$/ &amp;&amp; $0 !~ /[:;()\[\],]/) ? &quot; &quot; : &quot;&quot;</span></span>
<span id="cb11-19"><a href="#cb11-19" aria-hidden="true" tabindex="-1"></a><span class="st">}</span></span>
<span id="cb11-20"><a href="#cb11-20" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-21"><a href="#cb11-21" aria-hidden="true" tabindex="-1"></a><span class="st">/^\(/ { ++paren }</span></span>
<span id="cb11-22"><a href="#cb11-22" aria-hidden="true" tabindex="-1"></a><span class="st">/^\)/ { --paren }</span></span>
<span id="cb11-23"><a href="#cb11-23" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-24"><a href="#cb11-24" aria-hidden="true" tabindex="-1"></a><span class="st">/^for/ { newline(); infor=1 }</span></span>
<span id="cb11-25"><a href="#cb11-25" aria-hidden="true" tabindex="-1"></a><span class="st">infor &amp;&amp; /^;/ { ++infor; show($0 &quot; &quot;); next }</span></span>
<span id="cb11-26"><a href="#cb11-26" aria-hidden="true" tabindex="-1"></a><span class="st">infor==1 &amp;&amp; /^:/ { ++infor }</span></span>
<span id="cb11-27"><a href="#cb11-27" aria-hidden="true" tabindex="-1"></a><span class="st">infor&gt;1 &amp;&amp; paren==0 { infor=0 }</span></span>
<span id="cb11-28"><a href="#cb11-28" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-29"><a href="#cb11-29" aria-hidden="true" tabindex="-1"></a><span class="st">/^\?/ { tern++; n++; newline(); show($0 &quot; &quot;); next }</span></span>
<span id="cb11-30"><a href="#cb11-30" aria-hidden="true" tabindex="-1"></a><span class="st">tern &amp;&amp; /^:/ { newline(); show($0); --tern; --n; next }</span></span>
<span id="cb11-31"><a href="#cb11-31" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-32"><a href="#cb11-32" aria-hidden="true" tabindex="-1"></a><span class="st">/^#/ { newline(); show($0); newline(); next }</span></span>
<span id="cb11-33"><a href="#cb11-33" aria-hidden="true" tabindex="-1"></a><span class="st">/^;/ { show($0); newline(); next }</span></span>
<span id="cb11-34"><a href="#cb11-34" aria-hidden="true" tabindex="-1"></a><span class="st">/^{/ { show($0); ++n; newline(); next }</span></span>
<span id="cb11-35"><a href="#cb11-35" aria-hidden="true" tabindex="-1"></a><span class="st">/^}/ { n--; newline(); show($0); newline(); next }</span></span>
<span id="cb11-36"><a href="#cb11-36" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-37"><a href="#cb11-37" aria-hidden="true" tabindex="-1"></a><span class="st">{ show($0) }</span></span>
<span id="cb11-38"><a href="#cb11-38" aria-hidden="true" tabindex="-1"></a><span class="st">&#39;</span></span>
<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>
<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>
<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>
<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>
</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>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>
</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 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="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 winners</li>
</ul>
<p>NB: The keyword file used in this code is derived from the list in <a
href="https://www.ioccc.org/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>
<ul>
<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>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>
<h3 id="coda">Coda:</h3>
<p><a href="/winners.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>
<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>
<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>
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
<h1 id="inventory-for-2018burton2"><a name="inventory"></a>Inventory for
2018/burton2</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton2/Makefile">Makefile</a>
- winner 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="2018_burton2.tar.bz2">2018_burton2.tar.bz2</a> - download
winning source</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>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<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/.winner.json">.winner.json</a>
- description of winner in JSON</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/gen-inventory.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fburton2%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+430 -13
View File
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
@@ -6,27 +8,442 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2018/ciura/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2018 ciura</title>
<meta name="description" content="IOCCC year: 2018 IOCCC winner: ciura winner index page">
<meta name="keywords" content="IOCCC,2018,ciura,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2018/ciura</title>
<meta name="description" content="2018 IOCCC winner ciura">
<meta name="keywords" content="IOCCC, 2018, IOCCC 2018, IOCCC winner, ciura">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2018 ciura</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2018/ciura</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fciura%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2018/ciura/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../burton2/index.html">&larr; burton2</a>
<a class="Left" href="../index.html">&uarr; 2018 &uarr;</a>
<a class="Left" href="../endoh1/index.html">endoh1 &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.mid.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Marcin_Ciura">Marcin Ciura</a><br>
Location: <a href="/temp-test-ioccc/location.html#PL">PL</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<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>
<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">./prog</span> <span class="op">&lt;</span> Makefile</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> README.md</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
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>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>prog.alt</code> as you would <code>prog</code> above.</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>
<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>
<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>
</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>
<h3 id="the-big-string">The Big String:</h3>
<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>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>
</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>
<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>
<ul>
<li><code>nil</code> = 0,</li>
<li><code>space</code> = 1,</li>
<li><code>new_line</code> = 2,</li>
<li><code>uppercase</code> = 3,</li>
<li><code>lowercase</code> = 4,</li>
<li><code>period</code> = 5,</li>
<li><code>bang_question</code> = 6,</li>
<li><code>punctuation</code> = 7,</li>
</ul>
<p>or one of word classes:</p>
<ul>
<li><code>adverb</code> = 0,</li>
<li><code>other</code> = 2,</li>
<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>
</ul>
<p>The <code>output</code> is either one of:</p>
<ul>
<li><code>end_of_text</code> = 0,</li>
<li><code>sentence_start</code> = 1,</li>
<li><code>sentence_end</code> = 2,</li>
<li><code>token_end</code> = 3,</li>
<li><code>ignore</code> = 4,</li>
</ul>
<p>or one of</p>
<ul>
<li><code>passive_construction_start</code> = 1,</li>
<li><code>ignore</code> = 2,</li>
<li><code>passive_construction_end</code> = 3.</li>
</ul>
<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>
<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>
</ul>
<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>
</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>The <code>transition_label</code> is one of:</p>
<ul>
<li><code>word_start</code> = 0,</li>
<li><code>period_or_apostrophe</code> = 1,</li>
<li><code>a_z_letter</code> = 2..27.</li>
</ul>
<p>The <code>output</code> is either one of word classes:</p>
<ul>
<li><code>adverb</code> = 0,</li>
<li><code>ignore</code> = 1,</li>
<li><code>other</code> = 2,</li>
<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,</li>
</ul>
<p>or</p>
<ul>
<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[836 + 2*(state + transition_label)]</code> =</p>
<ul>
<li><code>' '</code> when <code>next_state / 376 == 0</code>,</li>
<li><code>';'</code> when <code>next_state / 376 == 1</code>.</li>
</ul>
<p>The byte <code>c[837 + 2*(state + transition_label)]</code> =</p>
<ul>
<li><code>' '</code> when <code>next_state / 94 % 4 == 0</code>,</li>
<li><code>';'</code> when <code>next_state / 94 % 4 == 1</code>,</li>
<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>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>
<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>
</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>.
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 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>
<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>
<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>
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
<h1 id="inventory-for-2018ciura"><a name="inventory"></a>Inventory for
2018/ciura</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/ciura/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/ciura/Makefile">Makefile</a>
- winner 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.sh">try.sh</a>
- how to run</li>
<li><a href="2018_ciura.tar.bz2">2018_ciura.tar.bz2</a> - download
winning source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<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/.winner.json">.winner.json</a>
- description of winner in JSON</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/gen-inventory.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fciura%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+213 -13
View File
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
@@ -6,27 +8,225 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2018/endoh1/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2018 endoh1</title>
<meta name="description" content="IOCCC year: 2018 IOCCC winner: endoh1 winner index page">
<meta name="keywords" content="IOCCC,2018,endoh1,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2018/endoh1</title>
<meta name="description" content="2018 IOCCC winner endoh1">
<meta name="keywords" content="IOCCC, 2018, IOCCC 2018, IOCCC winner, endoh1">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2018 endoh1</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2018/endoh1</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fendoh1%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2018/endoh1/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../ciura/index.html">&larr; ciura</a>
<a class="Left" href="../index.html">&uarr; 2018 &uarr;</a>
<a class="Left" href="../endoh2/index.html">endoh2 &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.mid.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Yusuke_Endoh">Yusuke Endoh</a><br>
Location: <a href="/temp-test-ioccc/location.html#JP">JP</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<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>
<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>
<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>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>
<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>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>
<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>
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
<h1 id="inventory-for-2018endoh1"><a name="inventory"></a>Inventory for
2018/endoh1</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh1/Makefile">Makefile</a>
- winner 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
winning source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<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/.winner.json">.winner.json</a>
- description of winner in JSON</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/gen-inventory.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fendoh1%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+244 -13
View File
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
@@ -6,27 +8,256 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2018/endoh2/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2018 endoh2</title>
<meta name="description" content="IOCCC year: 2018 IOCCC winner: endoh2 winner index page">
<meta name="keywords" content="IOCCC,2018,endoh2,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2018/endoh2</title>
<meta name="description" content="2018 IOCCC winner endoh2">
<meta name="keywords" content="IOCCC, 2018, IOCCC 2018, IOCCC winner, endoh2">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2018 endoh2</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2018/endoh2</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fendoh2%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2018/endoh2/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../endoh1/index.html">&larr; endoh1</a>
<a class="Left" href="../index.html">&uarr; 2018 &uarr;</a>
<a class="Left" href="../ferguson/index.html">ferguson &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.mid.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Yusuke_Endoh">Yusuke Endoh</a><br>
Location: <a href="/temp-test-ioccc/location.html#JP">JP</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<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>
<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>
<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: 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>
<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>
<pre><code> ___-----__
_-- --__
_- _--_ \
_- /\ +-.:.:-+ /\ \
/ \/ |.:.:.:| \/ |
/ |:.:.:.| |
/ |.:.:.:| | ___-----___
| |.:.:| | / \
| |:.:.| | &lt; It&#39;s ... |
\ |:.| | \ /
\ || | ---_____---
_--\ |
_- -__ |
__- --___ |
_- |
/ |
| |</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>
<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>
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
<h1 id="inventory-for-2018endoh2"><a name="inventory"></a>Inventory for
2018/endoh2</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/endoh2/Makefile">Makefile</a>
- winner 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
winning source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<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/.winner.json">.winner.json</a>
- description of winner in JSON</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/gen-inventory.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fendoh2%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+1285 -13
View File
File diff suppressed because it is too large. Load diff
+226 -13
View File
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
@@ -6,27 +8,238 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2018/giles/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2018 giles</title>
<meta name="description" content="IOCCC year: 2018 IOCCC winner: giles winner index page">
<meta name="keywords" content="IOCCC,2018,giles,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2018/giles</title>
<meta name="description" content="2018 IOCCC winner giles">
<meta name="keywords" content="IOCCC, 2018, IOCCC 2018, IOCCC winner, giles">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2018 giles</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2018/giles</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fgiles%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2018/giles/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../ferguson/index.html">&larr; ferguson</a>
<a class="Left" href="../index.html">&uarr; 2018 &uarr;</a>
<a class="Left" href="../hou/index.html">hou &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.mid.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Edward_Giles">Edward Giles</a><br>
Location: <a href="/temp-test-ioccc/location.html#AU">AU</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<p>This entry requires SDL2 to be installed. See <a
href="/faq.md#SDL">FAQ 3.8: How do I compile an IOCCC winner 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>
<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">./prog</span> ioccc.txt</span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> prog.c</span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> sand.txt</span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> sand.alt.txt</span></code></pre></div>
<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>
<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>
<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>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>
<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>
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
<h1 id="inventory-for-2018giles"><a name="inventory"></a>Inventory for
2018/giles</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/giles/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/giles/Makefile">Makefile</a>
- winner 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
winning source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<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/.winner.json">.winner.json</a>
- description of winner in JSON</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/gen-inventory.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fgiles%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+211 -13
View File
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
@@ -6,27 +8,223 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2018/hou/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2018 hou</title>
<meta name="description" content="IOCCC year: 2018 IOCCC winner: hou winner index page">
<meta name="keywords" content="IOCCC,2018,hou,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2018/hou</title>
<meta name="description" content="2018 IOCCC winner hou">
<meta name="keywords" content="IOCCC, 2018, IOCCC 2018, IOCCC winner, hou">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2018 hou</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2018/hou</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fhou%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2018/hou/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../giles/index.html">&larr; giles</a>
<a class="Left" href="../index.html">&uarr; 2018 &uarr;</a>
<a class="Left" href="../mills/index.html">mills &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.mid.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Qiming_HOU">Qiming HOU</a><br>
Location: <a href="/temp-test-ioccc/location.html#CN">CN</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<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>
<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.md#2018-hou">2018
hou in bugs.md</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>As the script says, open <code>output.html</code> in a browser.</p>
<p>What’s not right with the output? How can one fix it?</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>
<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>
<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>
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
<h1 id="inventory-for-2018hou"><a name="inventory"></a>Inventory for
2018/hou</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/hou/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/hou/Makefile">Makefile</a>
- winner 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 winning
source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<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/.winner.json">.winner.json</a>
- description of winner in JSON</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/gen-inventory.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fhou%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+897 -13
View File
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
@@ -6,27 +8,909 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2018/mills/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2018 mills</title>
<meta name="description" content="IOCCC year: 2018 IOCCC winner: mills winner index page">
<meta name="keywords" content="IOCCC,2018,mills,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2018/mills</title>
<meta name="description" content="2018 IOCCC winner mills">
<meta name="keywords" content="IOCCC, 2018, IOCCC 2018, IOCCC winner, mills">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2018 mills</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2018/mills</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fmills%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2018/mills/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../hou/index.html">&larr; hou</a>
<a class="Left" href="../index.html">&uarr; 2018 &uarr;</a>
<a class="Left" href="../poikola/index.html">poikola &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.mid.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Christopher_Mills">Christopher
Mills</a><br> Location: <a
href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<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>If you wish to save state so that you can run the program and keep
files changed (for instance you don’t want to compile
<code>mullender.c</code> again) you can compile it like:</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">make</span> clobber SAVE=1 all</span></code></pre></div>
<p>Make sure that if you do add a file (including by compiling code)
that before you exit (ctrl-e) you type in <code>sync</code>! Otherwise
the file might not exist or it will be corrupt if it does.</p>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: known bug - please help us fix
STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a href="/bugs.md#2018-mills">2018
mills in bugs.md</a>.</p>
<h2 id="to-use">To use:</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">./prog</span></span></code></pre></div>
<h2 id="try">Try:</h2>
<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></code></pre></div>
<p>At the <code>&gt;boot</code> prompt, type return.</p>
<p>At the <code>:</code> prompt, type <code>rk(0,0)rkunix</code> and
wait for it to initialise itself. Now try typing:</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">cat</span> <span class="op">&gt;</span> prog.c</span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="fu">main()</span><span class="kw">{</span> <span class="bu">printf</span><span class="er">(</span><span class="st">&quot;Hello, world!\n&quot;</span><span class="kw">);</span> <span class="kw">}</span></span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="ex">^D</span></span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> prog.c</span>
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a><span class="ex">a.out</span></span></code></pre></div>
<p>where <code>^D</code> is EOF.</p>
<p>Next try:</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">cc</span> mullender.c</span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="ex">a.out</span></span></code></pre></div>
<p>… and enjoy the classic <a
href="/1984/mullender/README.md">1984/mullender</a> entry as it would
have been in 1984 with a VAX-11/PDP-11! Once it reaches the end of the
line, hit enter and see what happens again. When you’re tired of it hit
ctrl-c.</p>
<p>But there is much more to this entry! See below.</p>
<p>NOTE: To quit, press Control-E.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Do small machines only need small programs? This program weighs in at
just 3636 bytes, which is considerably lighter than the original machine
it can replace.</p>
<p>This program can take you back to the start of everything, it is
possible to run v0. Just type:</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="ex">./v0</span></span></code></pre></div>
<p>NOTE: To quit v0, press Control-E.</p>
<p>You will be greeted with a familiar prompt of “login”. The username
and password are “dmr” and “dmr”. To make things more familiar you’ll
need to create ‘.’ as it hasn’t been invented yet on this image!</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> ln dd dmr .</span></code></pre></div>
<p>An <code>ls</code> will reveal that C hasn’t been invented yet! IOBCC
anyone? The compiler is <code>bc</code>. It produces assembly, which
will then need to be assembled together like
<code>ops.s bl.s hello.s bi.s</code> (in that order) to produce
a.out!</p>
<p>But wait, we said this was the start of it all! This program can also
run a program that replaces an even larger machine that can run BSD 2.9.
To start this,</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="ex">./prog</span></span></code></pre></div>
<p>At the <code>&gt;boot</code> prompt, type return.</p>
<p>At the “:” prompt, type <code>rk(0,0)rkunix</code>.</p>
<p>NOTE: To quit prog, press Control-E.</p>
<p>This should now be very familiar and it is possible to compile and
run one of the very first IOCCC entries <a
href="/1984/mullender/mullender.c">mullender.c</a>, as shown
earlier.</p>
<p>But wait, there is even more! Try:</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="ex">./v6</span></span></code></pre></div>
<p>At the <code>@</code> prompt, type <code>rkunix</code>. You might
want to type <code>stty -lcase</code> as otherwise the output will be in
all caps.</p>
<p>NOTE: To quit v6, press Control-E.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3
id="this-ioccc-entry-is-dedicated-to-the-late-dennis-m.-ritchie"><em>This
IOCCC entry is dedicated to the late Dennis M. Ritchie</em></h3>
<h3 id="the-program">The Program:</h3>
<p>Since this is the 25th “annual” IOCCC, I thought I should mark the
occasion with a look back to its earliest roots. At the same time the
contest enters its 34th year of providing a safe forum for poor C code,
the C language itself is fast approaching its 50th anniversary, along
with the UNIX operating system whose history is so entwined with.</p>
<p>The program delivered here is both a full machine emulation of the
original PDP-7 that Ken Thompson used to write the first version of UNIX
and a full machine emulation of the PDP-11/40 used by subsequent UNICES.
The <code>Makefile</code> can build versions that can run each of the
following:</p>
<ol type="1">
<li>UNIX v0 for the PDP-7 (circa 1969)</li>
<li>Research UNIX Version 6 (circa 1975)</li>
<li>BSD 2.9 (circa 1983)</li>
</ol>
<p>For reasons to be described in a bit, the last (BSD 2.9) is the
default.</p>
<h3 id="building-and-running-bsd-2.9">Building and Running BSD 2.9:</h3>
<p>To run BSD 2.9, do <code>make</code> to build <code>prog</code> and
then <code>./prog</code> to run it.</p>
<p>You should see a prompt from the first-stage bootloader that looks
like</p>
<pre><code>&gt;boot</code></pre>
<p>Hit enter/return at this point and you will get to the second-stage
boot loader that looks like</p>
<pre><code>40Boot
:</code></pre>
<p>The 40 in the prompt indicates that the bootloader has correctly
determined that we are running on a PDP-11/40.</p>
<p>At this point, type the rather cryptic command
<code>rk(0,0)rkunix</code> – this tells the system to look at the first
partition on the first <code>RK05</code> fixed disk, find the
<code>rkunix</code> file and load it. You should eventually see the
following:</p>
<pre><code>&gt;boot
40Boot
: rk(0,0)rkunix
Berkeley UNIX (Rev. 2.9.1) Sun Nov 20 14:55:50 PST 1983
mem = 135872
CONFIGURE SYSTEM:
xp ? csr 176700 vector 254 skipped: No CSR
rk 0 csr 177400 vector 220 attached
hk ? csr 177440 vector 210 skipped: No CSR
rl ? csr 174400 vector 160 skipped: No CSR
rp ? csr 176700 vector 254 skipped: No CSR
ht 0 csr 172440 vector 224 skipped: No CSR
tm 0 csr 172520 vector 224 skipped: No CSR
ts 0 csr 172520 vector 224 skipped: No CSR
dh ? csr 160020 vector 370 skipped: No CSR
dm ? csr 170500 vector 360 skipped: No autoconfig routines
dz ? csr 160110 vector 320 skipped: No CSR
dz ? csr 160110 vector 320 skipped: No CSR
dn 0 csr 175200 vector 300 skipped: No autoconfig routines
vp ? csr 177500 vector 174 skipped: No autoconfig routines
lp ? csr 177514 vector 200 skipped: No CSR
Erase=^?, kill=^U, intr=^C
#</code></pre>
<p>Congratulations, you are running BSD UNIX 2.9 in single-user mode as
root.</p>
<p>On the other hand, if you did a typo somewhere, the boot loader has
probably crashed and halted – if so, type Control-E to quit the emulator
and try again. If you did really badly, you might have corrupted the
virtual disk. If so, consider a <code>make clean</code> to start from
scratch.</p>
<p>Assuming you managed to type 15 characters correctly, you should be
at the root prompt. Most of the commands you are familiar with work here
(this was only a quarter of a century ago – how much could things have
changed?). Let’s try some:</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="co"># ls</span></span>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a><span class="ex">.cshrc</span> .profile boot hkunix mnt tmp</span>
<span id="cb15-3"><a href="#cb15-3" aria-hidden="true" tabindex="-1"></a><span class="ex">.login</span> 2.9stamp dev lib mullender.c unix</span>
<span id="cb15-4"><a href="#cb15-4" aria-hidden="true" tabindex="-1"></a><span class="ex">.msgsrc</span> bin etc lost+found rkunix usr</span>
<span id="cb15-5"><a href="#cb15-5" aria-hidden="true" tabindex="-1"></a><span class="co"># df</span></span>
<span id="cb15-6"><a href="#cb15-6" aria-hidden="true" tabindex="-1"></a><span class="ex">Filesystem</span> Mounted on kbytes used free % used</span>
<span id="cb15-7"><a href="#cb15-7" aria-hidden="true" tabindex="-1"></a><span class="ex">/dev/rk0</span> / 1958 1688 270 86%</span>
<span id="cb15-8"><a href="#cb15-8" aria-hidden="true" tabindex="-1"></a><span class="co"># bin/cc mullender.c</span></span>
<span id="cb15-9"><a href="#cb15-9" aria-hidden="true" tabindex="-1"></a><span class="co"># ./a.out</span></span></code></pre></div>
<p>The program you’ve just run was the [winner of the first IOCCC
contest from 1984] <a
href="https://www.ioccc.org/1984/mullender/mullender.c"
title="mullender.c">1</a> (or was it 1894?), a personal favorite of
mine. It is rather tightly bound to running on either a PDP-11 or a
VAX-11. Now you have one.</p>
<p>Hitting Control-C will return you to the BSD UNIX prompt. Hitting
Control-D will log you out of the single-user session and get you back
to the <code>:login:</code> prompt. Here you can log in as
<code>root</code> and get a full time-sharing session. Feel free to try
things like <code>vi</code>. I’ve taken the liberty of editing the
<code>.login</code> and <code>.profile</code> files to set the console
to a less traditional setup so that you don’t have to wait for the Model
33 KSR teletype to move its carriage. I’ve also predefined
<code>TERM</code> to <code>vt100</code>, which will probably work well
enough with whatever sort of ANSI terminal emulation you are using.</p>
<p>Note that I have not mounted the <code>/usr</code> disk here, so some
commands from <code>/usr/bin</code> will be missing, along with all of
the <code>man</code> pages. They are [available online] <a
href="http://minnie.tuhs.org/cgi-bin/utree.pl?file=2.9BSD"
title="2.9 BSD">2</a> if you need them. Adding a second RK05 disk was
possible, but I didn’t get around to it… As the Judges can no doubt
attest, “Mid 2017” creeps up on you quicker than you expect. :)</p>
<p>Once you’ve had enough fun in BSD 2.9, type Control-E to exit the
emulation.</p>
<h3 id="building-and-running-research-unix-v6">Building and Running
Research UNIX v6:</h3>
<p>Research UNIX v6 and BSD 2.9 use the same executable, but require a
different disk image. Type <code>make v6</code> to build it, then type
<code>./prog</code> to run it.</p>
<p>You should see the boot loader prompt which is a single
<code>@</code>:</p>
<pre><code>@</code></pre>
<p>At this point, you again must type a special incantation:
<code>rkunix</code>. After that you should see:</p>
<pre><code>@rkunix
mem = 1035
RESTRICTED RIGHTS
Use, duplication or disclosure is subject to
restrictions stated in Contract with Western
Electric Company, Inc.
#</code></pre>
<p>You are now running a single-user session of v6 UNIX. You might want
to start with <code>stty -lcase</code> because otherwise everything will
be IN ALL CAPS.</p>
<p>Again, if you failed typing seven characters without making a
mistake, you may need to use Control-E to quit the emulation.</p>
<p>Assuming you’re more careful than that, we can try a few
commands:</p>
<pre><code>@rkunix
mem = 1035
RESTRICTED RIGHTS
Use, duplication or disclosure is subject to
restrictions stated in Contract with Western
Electric Company, Inc.
# STTY -LCASE
# ls
bin
dev
etc
hpunix
lib
mnt
rkunix
rpunix
tmp
unix
usr
# cat &gt; foo.c
main()
{
printf(&quot;Hello, World!\n&quot;);
}
^D
# cc foo.c
# ./a.out
Hello, World!</code></pre>
<p>Why is Version 6 interesting? Well, it was the oldest version that I
could find a boot image of that had a C compiler… This C compiler is
recognizably C, but not quite the same syntax as we have today. It’s
much closer to the [B language] <a
href="https://www.bell-labs.com/usr/dmr/www/kbman.html"
title="B Language">3</a> from which it is derived. In particular, this C
compiler would not be able to compile <code>mullender.c</code> (as
simple as it is), because the following syntax features don’t exist
yet:</p>
<ul>
<li>The <code>short</code> data type doesn’t exist yet. Only
<code>int</code> (<code>short</code> will show up when <code>long</code>
comes, and the port to the Interdata 7/32 starts to make the idea of
portability become important).</li>
<li>Hexadecimal constants don’t exist yet. Digital’s computers all used
octal.</li>
<li>The array initializer syntax hasn’t yet moved to using
<code>=</code>. It still uses the older form taken from B, which looks
like <code>array[] { 1, 2, 3 };</code></li>
</ul>
<p>It can still compile “Hello World!” (note that you must type a
Control-D after you finish entering the code, to let <code>cat</code>
see an end-of-file).</p>
<p>This version of UNIX doesn’t go into multi-user mode if you do a
Control-D. Single-user mode was entered because the front-panel console
switches were set to the magic number 0173030 (this can be changed with
a recompile).</p>
<p>Once you are done with Version 6, Type Control-E to exit the
emulation.</p>
<p>Note that since both BSD 2.9 and UNIX v6 use the same PDP-11/40
emulation code, and they use the same name for the disk
(<code>rk05.fs</code>), if you want to go back to the BSD emulation, you
should either delete <code>rk05.fs</code> or do a
<code>make clean</code> before you do a <code>make</code>.</p>
<h3 id="building-and-running-unix-v0">Building and Running UNIX v0:</h3>
<p>We now set the Wayback Machine to the very start of it all, 1969.</p>
<p>[The story] <a href="https://www.bell-labs.com/usr/dmr/www/hist.html"
title="UNIX history">4</a> here is interesting and well worth a read.
Bell Labs was pulling out of the Multics project and Ken Thompson and
his colleagues had become accustomed to the relatively nice programming
environment. They also enjoyed the early computer game [<em>Space
Travel</em>] <a
href="https://www.bell-labs.com/usr/dmr/www/spacetravel.html"
title="Space Travel">5</a> and wanted another system to run it on. They
found a PDP-7 which was already obsolete at the time to port <em>Space
Travel</em> to. The primitive programming environment influenced
Thompson to recreate parts of the Multics experience in the much more
hardware-constrained PDP-7 environment. In the summer of 1969, with his
wife out on a month-long vacation, Thompson rewrote a filesystem
emulation he had been experimenting with to include an assembler, a
shell, an editor and an operating system kernel and hence created the
first version of UNIX (although it hadn’t been named that yet).</p>
<p>You can try out this version by typing <code>make v0</code>. Since
this version is a native PDP-7 emulation, it gets its own binary. Type
<code>./v0</code> to run it. You should see the login prompt.</p>
<pre><code>login:</code></pre>
<p>There are two user accounts <code>ken</code> and <code>dmr</code>,
with the passwords <code>ken</code> and <code>dmr</code> respectively.
Let’s try the Dennis Richie’s <code>dmr</code> account:</p>
<pre><code>login: dmr
password: dmr
@ ls
. ?</code></pre>
<p>Even though this is not Ken’s doing, I feel this gives me licence to
include this quote from the BSD <code>fortune</code> program:</p>
<blockquote>
<p>Ken Thompson has an automobile which he helped design. Unlike most
automobiles, it has neither speedometer, nor gas gauge, nor any of the
numerous idiot lights which plague the modern driver. Rather, if the
driver makes any mistake, a giant “?” lights up in the center of the
dashboard. “The experienced driver”, he says, “will usually know what’s
wrong.”</p>
</blockquote>
<p>What’s the deal here? Well, that’s a slightly long story. The short
version is we have gone so far back in the history of UNIX that <em>we
don’t have filesystem paths yet</em>. In other words, we can’t say
something like <code>/bin/ls</code> yet, and the shell can’t store that
path in <code>$PATH</code> to search for it. We also haven’t invented
<code>.</code> or <code>..</code> yet. In fact, the filesystem isn’t
even the traditional UNIX tree structure, it’s a directed graph of hard
links…</p>
<p><code>ls</code> needs to be able to read <code>.</code>, the current
directory. <code>dmr</code>’s home directory doesn’t have that yet, but
we can make it, because the home directory has a hard link to
<code>dd</code>, which is the directory that holds all of the user home
directories (this will eventually become <code>/</code>, the root path).
We can do</p>
<pre><code>@ ln dd dmr .</code></pre>
<p>To make the new link (note that <code>ln</code> doesn’t support paths
either, so you have to give it three arguments – a directory in the
current dir, a file in that directory, and the new name).</p>
<p>Now <code>ls</code> will work, and we can try some other things while
we are here:</p>
<pre><code>login: dmr
password: dmr
@ ln dd dmr .
@ ls
dd
system
as.s
b_readme
bi.s
bl.s
db.s
hello.b
ops.s
.
@ cat b_readme
Here is how to compile and run hello.b:
@ bc hello.b hello.s
@ as ops.s bl.s hello.s bi.s
I
II
ops.s
bl.s
hello.s
bi.s
@ a.out
Hello, World!
@ bc hello.b hello.s
@ as ops.s bl.s hello.s bi.s
I
II
ops.s
bl.s
hello.s
bi.s
@ a.out
Hello, World!
@</code></pre>
<p>The last command is invoking the compiler for an extremely early
version of the [B programming language] <a
href="https://www.bell-labs.com/usr/dmr/www/kbman.html"
title="B Language">3</a>, the predecessor to C. Thompson missed the
convenience of writing code in a high-level language – Multics was
written in a version of PL/1 – and wanted the same convenience in UNIX.
He preferred BCPL (a typeless language) to PL/1. As Dennis Ritchie
[wrote] <a href="https://www.bell-labs.com/usr/dmr/www/chist.html"
title="C History">6</a>:</p>
<blockquote>
<p>B can be thought of as C without types; more accurately, it is BCPL
squeezed into 8K bytes of memory and filtered through Thompson’s
brain.</p>
</blockquote>
<p>A look at the B reference manual will show the strong correlation
with C, and shows the source of a lot of C’s mysteriousness – some of
which is preserved simply so that C could compile the <em>dozens</em> of
lines of existing B code…</p>
<p>Thompson’s assembler was also extremely simple. It didn’t even know
about opcodes – these need to be defined in the first assembly file,
with the assembler OR-ing the opcode fields together (space was the
“operator” for logical OR). There is no link step – all files are
provided to the assembler on the command line, concatenated together and
assembled, producing a single <code>a.out</code> (assembler output)
file. Even after UNIX got a linker, <code>a.out</code> remained the
default name of the binary generated by the linker (and hence also by
<code>cc</code>).</p>
<p>This system still has the familiarity of UNIX, with all the two and
three letter commands, device files, shell redirection and the same core
system calls (<code>read(2)</code>, <code>write(2)</code>,
<code>open(2)</code>, <code>close(2)</code>, <code>creat(2)</code>,
<code>fork(2)</code>, etc.). There are a number of differences
still:</p>
<ul>
<li>As noted, there are no file paths.</li>
<li><code>read(2)</code> and <code>write(2)</code> do I/O on (18-bit)
words. Character I/O on files need to unpack those bytes, and of course
deal with <code>NUL</code> characters.</li>
<li><code>exec(2)</code> was performed by the shell directly. Arguments
are passed as four words (eight bytes), and space padded. This matches
the format for file names for <code>open(2)</code> and
<code>creat(2)</code>.</li>
<li><code>wait(2)</code> does not yet exist. A more complicated
mechanism for sending and receiving messages (<code>smes</code> and
<code>rmes</code>) are used instead.</li>
<li>File permission bits are all different, since groups don’t exist
yet.</li>
<li>User programs are not allowed to run during disk I/O. This is
because the disk controller’s “data break” (DMA) accesses were so fast
relative to the CPU that transfers would be dropped if an instruction
that used “deferred” mode (indirection) was executed. This also meant
that the “program break” (interrupt) routine in the kernel had to
specifically avoid deferred accesses by using self-modifying code to do
indirection through pointers.</li>
<li>Although the PDP-7 supported a “trap mode” (a primitive supervisor
mode), the UNIX kernel doesn’t use it. This means that user programs
could alter or crash the kernel at will (in fact, there is a system call
that returns addresses of useful kernel routines so that user code can
call them directly).</li>
</ul>
<p>As usual, when you are done exploring UNIX v0, type Control-E to exit
the emulator.</p>
<h3 id="about-the-program">About the Program:</h3>
<p>The program came about when I was looking for something to honor the
pending 50th anniversary of the C language (because of the mercurial
nature of IOCCC contest scheduling, I chose not to wait for the actual
50th anniversary). I had thought of writing self-hosting compilers for a
stripped-down version of C, or maybe even a version of the B language…
At the same time, I was obsessed with the idea of allowing <a
href="/1984/mullender/README.md">mullender.c from 1984</a> to run.
Although that was still a possibility on an interpreted version of B or
a stripped-down version of C, it felt cheap, as it would be <a
href="/1984/mullender/mullender.c">mullender.c</a> only in spirit.</p>
<p>It was during this time that I discovered that in 2016, members of
the Unix Heritage Society got access to [printouts of assembly-language
source for the original version of UNIX] <a
href="http://www.tuhs.org/Archive/Distributions/Research/McIlroy_v0/"
title="V0 Scans">7</a>. With what was a [huge amount of work] <a
href="https://web.archive.org/web/20180826162445/https://minnie.tuhs.org//Y5/wkt_hapop_paper.pdf"
title="UNIX v0">8</a>, they scanned in the printouts, fixed up the OCR
translations, built assembler and file system tools from scratch and
made an accurate emulation of Thompson’s PDP-7 that allowed them to get
the system up and running. Although source for the entire kernel and
about half of the user-space commands were present (including the
runtime and libraries for the B compiler), the remainder needed to be
written from scratch, including the shell. The final results of the
project are [available on GitHub] <a
href="https://github.com/DoctorWkt/pdp7-unix"
title="PDP-7 UNIX">9</a>.</p>
<p>None of this was remotely easy (as I was to discover myself). The
PDP-7 is long gone, and the documentation for it is less complete than
one would like. In addition, the devices attached for it were a bit of a
mystery. The disk system is referenced only in an old price list. It was
a RB09 fixed disk, probably made by Burroughs. It is close to what was
called the RC10 for the PDP-10, but with a different interface. And the
system also included a custom display device called Graphics-2, which
had been built in-house by AT&amp;T. It can’t be completely ignored,
because the kernel itself pokes at it (the UNIX crew used it as a second
terminal – a “glass TTY”).</p>
<p>I decided that implementing this PDP-7 would be possible as an IOCCC
entry.</p>
<p>The emulator emulates the full machine:</p>
<ul>
<li>PDP-7 Central Processor.</li>
<li>Core Memory Module Type 147 – extends the core to 8,192 18-bit
words.</li>
<li>Extended Arithmetic Element Type 177 – adds one’s-complement
multiplication, division and shifting.</li>
<li>Real Time Clock.</li>
<li>Teletype Model 33 KSR.</li>
<li>Perforated Tape Reader Type 444.</li>
<li>RB09 Fixed Disk Controller.</li>
</ul>
<p>The [PDP-7] <a
href="http://bitsavers.trailing-edge.com/pdf/dec/pdp7/F-75P_PDP7prelimUM_Dec64.pdf"
title="PDP-7 Manual">10</a> is an odd duck by modern computer
standards:</p>
<ul>
<li>18 bit words, with no byte addressing.</li>
<li>Both one’s and two’s complement math (there is <code>ADD</code> for
one’s complement and <code>TAD</code> for two’s complement). The EAE is
entirely one’s-complement.</li>
<li>“Microcoded” instructions.</li>
<li>Auto-increment memory locations.</li>
<li>Non-reentrant function calls (the return address is stored at the
indicated address and the PC jumps to the location after it).</li>
<li>The <code>XCT</code> instruction, that executes the word loaded from
memory as an instruction.</li>
<li>An instruction <code>LAW</code> that loads the instruction opcode
into the accumulator.</li>
<li>Heavy use of <code>inline</code> operands. For instance the
<code>MUL</code> instruction expects the second operand to be stored in
memory after the instruction. This pretty much requires the use of
self-modifying code.</li>
<li>No immediates. Almost all constants have to live in memory locations
and be referenced by address.</li>
<li>Common operations, like “subtract” and “inclusive OR” are not
directly supported on the machine and require multiple instructions and
some spare memory locations to support. Being clever also helps.</li>
<li>Single accumulator architecture. No direct support for things like
stacks.</li>
<li>I/O is done with dedicated I/O instructions (which are also
microcoded).</li>
<li>The RB09 disk controller gets a special mention here because of its
particularly annoying encoding of track and sector offsets in [packed
BCD] <a href="https://en.wikipedia.org/wiki/Binary-coded_decimal"
title="BCD">11</a>. A non-trivial amount of code space in the simulator
is needed to convert into and out of BCD, along with an equivalent
amount of code in the UNIX kernel itself.</li>
</ul>
<p>The emulation handles everything I was able to discover about the
PDP-7, even things that the UNIX code itself doesn’t use. For instance,
it correctly implements the “trap mode” feature (a primitive form of
supervisor mode) even though the kernel does not enable it. It also
implements the microcoding of the EAE instructions even though the UNIX
environment uses only the standard encodings. If you wanted to do a
11-bit multiply instead of an 18-bit one, it will probably work.</p>
<p>The emulation starts by loading a boot program off of the virtualized
paper tape, which is in a modified version of the RIM boot loader
format. The RIM format encodes each 18-bit word as three six-bit
characters, using one bit to denote the final word (which is executed
directly and is usually a <code>JMP</code> or <code>HLT</code>
instruction). The load address comes from the console address switches.
Both of these are controlled by compile-time flags.</p>
<p>The emulator continues emulating instructions until it sees a
<code>HLT</code> instruction which will cause it to exit. Console I/O is
emulated by setting the terminal into raw mode and polling via
<code>read(2)</code>. Line-clock ticks (at 60 Hz) are done by polling
<code>gettimeofday(2)</code>. Dynamic frequency code arranges to reduce
the polling interval to a few polls per tick, so that emulation remains
responsive. Since we use the real wall-clock time, this means that the
emulated system will see time advance at the correct rate.</p>
<h3 id="licencing-fun">Licencing Fun</h3>
<p>So now I have a system that can run UNIX v0. One problem remains… I
don’t have permission to submit UNIX v0 to the IOCCC. It is not my code
and the copyright for it remains the property of whoever owns that part
of what was once Bell Labs – I believe it is Nokia at this point. I have
worked around this problem in two ways:</p>
<p>First, I didn’t submit the source code or binary image for v0 UNIX as
part of my IOCCC entry. I merely submitted a <code>Makefile</code> that
can issue a <code>curl</code> command to fetch a pre-built v0 disk image
from the GitHub repository. I am hoping this is considered part of
“Legal abuse of the rules” which is supposed to be “somewhat
encouraged”. As per RULE 12, I am justifying said abuse here, in the
remarks file.</p>
<p>Secondly, the choice to run the UNIX v0 code is optional. If you are
worried about Nokia’s lawyers running you to the ground for running a
50-year old copy of a binary image for a machine that is almost
completely non-existent, you can just not do so. Delete the lines from
the <code>Makefile</code> and sleep well. You still have two other
UNICES to play with.</p>
<p>What about the other two UNIX variants? These are both covered by
licences that allow me to use them. Back in 2002, Caldera International
released Research Unix versions 1-7 and 32V under a [permissive BSD-like
license] <a href="http://www.tuhs.org/Archive/Caldera-license.pdf"
title="Caldera Licence">12</a>. BSD UNIX is based off of v7 UNIX, and of
course has its own permissive BSD licence. And in 2017, Nokia also
released versions 8-10 under the condition that it will not assert
copyright rights for non-commercial use.</p>
<p>So the newer UNICES are in the clear. I doubt anyone actually cares
about version 0 either, but technically it’s still under copyright.</p>
<h3 id="pdp-1140">PDP-11/40</h3>
<p>So if I have a PDP-7 emulator, how do I run operating systems that
expect a PDP-11? Simple… <em>I emulate a PDP-11/40 on the PDP-7</em>. I
have written PDP-7 assembler code to emulate a PDP-11/40 with the
following equipment:</p>
<ul>
<li>PDP-11/40 (KD11-A).</li>
<li>EIS instruction set (KE11-E).</li>
<li>Memory management unit (KJ11-A).</li>
<li>Line time clock (KT11-D).</li>
<li>124 Kwords of memory (244 Kbytes).</li>
<li>RK05 fixed disk drive (RK11).</li>
<li>Console TTY (DL11).</li>
</ul>
<p>This required a few tweaks to the emulator. The first problem is that
the RK05 disk is about 2.5 MB, but the RB09 is only about 2 MB. That’s
easily solvable – just add more tracks to the RB09. UNIX v0 is unlikely
to notice (although the number of tracks is a compile time parameter,
and the <code>v0</code> build commands set it to the correct value).</p>
<p>The second problem is that we are emulating a system that can have up
to 124K words of memory on a system with only 8K words total. That meant
I needed to virtualize the PDP-11/40’s physical memory (and add a few
more tracks to the disk to hold the virtualization).</p>
<p>A large amount of time was spent tuning this code to be efficient.
The memory virtualization uses part of the 8 Kword memory as an LRU
cache, and uses a number of first-level microcaches to avoid having to
do the LRU updates. This also serves to offload the complexity of the
PDP-11’s segmentation logic from a large number of memory accesses (the
PDP-11 does as many as eight accesses per instruction). Despite the
super fast emulated disk, the PDP-7 code in the emulator is slow, mostly
because it has to do a bunch of divides to convert the linear disk
offset into a BCD-coded track and sector for the emulated RB09. I/O
polling is again used, except this time it uses the PDP-7’s “skip on
flag set” I/O instructions. As with the PDP-7 emulator itself, the
PDP-11 emulator dynamically measures the instruction throughput relative
to the line-clock tick, so that it only polls for I/O a few times per
tick.</p>
<p>The one remaining problem is building the disk images themselves.
Since the PDP-11’s disk is 16-bit, but the PDP-7’s is 18-bit (which the
emulator stores in 32-bit <code>int</code>s), a conversion program is
needed to unpack the binary disk images from 16 bits per word to 32.
This in turn needs to be done in the Makefile using standard POSIX
tools, which aren’t exactly good with binary. I had a weirdly clever way
to do this with <code>od(1)</code>, <code>awk(1)</code> and
<code>uudecode(1)</code> that I will leave as an exercise for the
curious, but I decided it would be easier to do it with the PDP-7
emulator itself, feeding a simple program in on its boot tape. This
required an additional tweak to the emulator, since by default its
console TTY is not eight-bit clean (in fact, UNIX v0 expects to see the
MSB set on the terminal reads, and sets it on writes, what is called
“mark” parity). This is also enabled by a compile-time setting (used
only for the <code>builddisk</code> program).</p>
<p>Despite the complexity of the PDP-11 instruction set and its emulated
I/O devices and the corresponding primitiveness of the PDP-7’s
instruction set, the emulation itself is a surprisingly small amount of
code, not really taxing the 8K word memory, with about 2.25 Kwords of
actual code and a similar amount of space for the memory virtualization
cache and disk block buffer, leaving nearly half (3.5 Kwords) of the
memory unused. The simulator executes somewhere around 250 PDP-7
instructions per PDP-11 instruction. On my laptop, the PDP-7 is running
somewhere in the neighborhood of 70 MIPS, which means the PDP-11 is
running at about 0.3 MIPS, which is probably not too far off of its
actual speed (the cycle time of an 11/40 was around a microsecond for
simple instructions, but could be proportionally larger for instructions
that did multiple memory accesses, which many did).</p>
<p>As an aside, although the idea of emulating the PDP-11 on an emulated
PDP-7 came about from the realization that I needed a response to the
late-discovered licence issue, I’m quite pleased with the result – it
enables an interesting window on the dawn of the UNIX era. I feel that
someone should complete the circle here by emulating a VAX 780 on the
PDP-11 and run 4.2BSD on it, so that we can get the [original runtime
environment used for the first IOCCC] <a
href="https://groups.google.com/forum/?hl=en#!msg/net.lang.c/lx-TAuEyeRI/HdOOnNx6LC0J"
title="First annual IOCCC announcement">13</a>.</p>
<h3 id="compile-time-options">Compile-time Options:</h3>
<p>The following command flags control the compilation:</p>
<ul>
<li><code>-DI="image.fs"</code>: Name of the disk image file. This must
be created offline, and be of the correct size to avoid segmentation
violations.</li>
<li><code>-DA=4096</code>: Setting of the console address switches. This
tells the RIM bootloader where to load the boot image.</li>
<li><code>-DS=0</code>: Setting of the console data switches. The PDP-7
emulation can read these with the microcoded <code>OAS</code> (OR
switches into AC) instruction. By proxy, the PDP-11 emulation can read
them via the <code>CSW</code> device.</li>
<li><code>-DW=MAP_PRIVATE</code>: This sets the memory mapping for
<code>mmap(2)</code>. Setting to <code>MAP_PRIVATE</code> makes the disk
image be copy-on-write. Setting it to <code>MAP_SHARED</code> makes the
disk image be shareable. Do the latter if you want to preserve the disk
contents between sessions.</li>
<li><code>-DT=</code>: List of initializers for the <code>termios</code>
structure. The v0 UNIX expects the terminal to be in half-duplex mode,
echoing its input, with swapped CR and NL. The PDP-11 UNICES don’t.</li>
<li><code>-DX=5</code>: The ASCII code of the control character that
causes the emulation to abort. If set to 0, there is no abort code.</li>
<li><code>-DY=128</code>: Controls console I/O parity. If set to zero,
the console is eight-bit clean. If set to 128, the high bit is set on
keyboard reads and masked off on printer output (“mark” parity). UNIX v0
expects the latter.</li>
<li><code>-DV=270</code>: The size of the disk, in tracks. The UNIX v0
disk has 200 tracks (each has 80 sectors of 64 18-bit words). The PDP-11
UNICES increase this to 270, to allow for the larger RK05 disk emulation
(406 tracks of twelve 256-word sectors), plus the space for the 124K
words of virtualized memory and the 8K words of emulator code.</li>
<li><code>-DP="xxx"</code>: RIM bootstrap program paper tape image. Be
careful with the quoting here – there are at least three levels going
on. In particular, you will need to escape <code>$</code> as
<code>$$</code> to protect it from <code>make</code>.</li>
</ul>
<h3 id="what-is-the-ascii-art-supposed-to-be">What is the ASCII art
supposed to be?</h3>
<p>The ASCII art represents a torn piece of [paper tape] <a
href="https://en.wikipedia.org/wiki/Punched_tape"
title="Paper Tape">14</a>.</p>
<h3 id="acknowledgements">Acknowledgements</h3>
<p>None of this could have been possible without the hard work of</p>
<ul>
<li>Warren Toomey and the other members of the [The Unix Heritage
Society] <a href="http://www.tuhs.org"
title="The Unix Heritage Society">15</a></li>
<li>Robert M. Supnik and the other contributors to [SimH] <a
href="http://simh.trailing-edge.com" title="SimH">16</a>, the simulator
for historic computer architectures. The number of times I needed to
“Use the Source, Luke” on SimH to unravel some dark corner of these
machines was uncountable.</li>
<li>[Bitsavers] <a href="http://bitsavers.trailing-edge.com"
title="Bitsavers.org">17</a>, which acquired, scanned and preserved all
the manuals I spent many hours squinting at.</li>
<li>Ken Thompson, Dennis Ritchie, Brian Kernigan, M. D. McIlroy, J. F.
Osssanna, Rudd Canaday and the other members of the Bell Labs Computing
Science Research Center who were responsible for the invention of UNIX,
the C programming language, and the innumerable other innovations that
we now take for granted as part of the modern software landscape. In
particular, the [home page of the late Dennis Ritchie] <a
href="https://www.bell-labs.com/usr/dmr/www/"
title="DMR Homepage">18</a> contained a trove of useful information on
the evolution of UNIX and C and is recommended for perusal by others who
share my peculiar retro computing passion.</li>
</ul>
<p>Finally, thanks to my spouse for putting up with the many hours I
spent on this nonsense, and treating “I’m working on my IOCCC entry” as
an acceptable answer to queries about how I was spending my free time.
Similarly, I apologise to those friends and coworkers who had to listen
to me complain about obscure corner-case bugs in my code. The obsession
is over, at least until next time…</p>
<hr />
<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>
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
<h1 id="inventory-for-2018mills"><a name="inventory"></a>Inventory for
2018/mills</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/mills/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/mills/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/mills/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a href="2018_mills.tar.bz2">2018_mills.tar.bz2</a> - download
winning source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/mills/.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/mills/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/mills/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="boot.dat">boot.dat</a> - binary support file</li>
<li><a href="bsd.img.bz2">bsd.img.bz2</a> - bz2 compressed BSD disk
image</li>
<li><a href="v0.image.fs">v0.image.fs</a> - filesystem image</li>
<li><a href="v6.tape.gz">v6.tape.gz</a> - compressed filesystem
image</li>
</ul>
<!-- END: next line ends content generated by: bin/gen-inventory.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fmills%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+307 -13
View File
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
@@ -6,27 +8,319 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2018/poikola/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2018 poikola</title>
<meta name="description" content="IOCCC year: 2018 IOCCC winner: poikola winner index page">
<meta name="keywords" content="IOCCC,2018,poikola,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2018/poikola</title>
<meta name="description" content="2018 IOCCC winner poikola">
<meta name="keywords" content="IOCCC, 2018, IOCCC 2018, IOCCC winner, poikola">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2018 poikola</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2018/poikola</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fpoikola%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2018/poikola/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../mills/index.html">&larr; mills</a>
<a class="Left" href="../index.html">&uarr; 2018 &uarr;</a>
<a class="Left" href="../vokes/index.html">vokes &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.mid.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Timo_Poikola">Timo Poikola</a><br>
Location: <a href="/temp-test-ioccc/location.html#FI">FI</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<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>
<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>
<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>
<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>
<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>
<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>
<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.md#X11macos">FAQ 3.7: How do I compile and use on macOS, an
IOCCC winner that requires X11?</a>) or some other working terminal.
Thanks to <a href="/winners.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 <em>-std=c11</em>.</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>
</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>
<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>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>
<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>
</ol>
<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>
</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>
<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>
<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>
<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>
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
<h1 id="inventory-for-2018poikola"><a name="inventory"></a>Inventory for
2018/poikola</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/poikola/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/poikola/Makefile">Makefile</a>
- winner 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 winning source</li>
<li><a href="2018_poikola.tar.bz2">2018_poikola.tar.bz2</a> - download
winning source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<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/.winner.json">.winner.json</a>
- description of winner in JSON</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/gen-inventory.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fpoikola%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+370 -13
View File
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
@@ -6,27 +8,382 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2018/vokes/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2018 vokes</title>
<meta name="description" content="IOCCC year: 2018 IOCCC winner: vokes winner index page">
<meta name="keywords" content="IOCCC,2018,vokes,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2018/vokes</title>
<meta name="description" content="2018 IOCCC winner vokes">
<meta name="keywords" content="IOCCC, 2018, IOCCC 2018, IOCCC winner, vokes">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2018 vokes</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2018/vokes</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fvokes%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2018/vokes/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../poikola/index.html">&larr; poikola</a>
<a class="Left" href="../index.html">&uarr; 2018 &uarr;</a>
<a class="Left" href="../yang/index.html">yang &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.mid.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Scott_Vokes">Scott Vokes</a><br>
Location: <a href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<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>
<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.md#2018-vokes">2018
vokes in bugs.md</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>
<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),
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>
<pre><code>0 4 8
1 0
2 1 3
3 2
4 1
5 4 6
6 5 2
7 3 6 7</code></pre>
<p>would be interpreted as:</p>
<pre><code>0 -&gt; 4, 8
1 -&gt; 0
2 -&gt; 1, 3
3 -&gt; 2
4 -&gt; 1
5 -&gt; 4, 6
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>
<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>
<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>
<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>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>
</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>
</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>
<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>
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
<h1 id="inventory-for-2018vokes"><a name="inventory"></a>Inventory for
2018/vokes</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/vokes/Makefile">Makefile</a>
- winner 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
winning source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<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/.winner.json">.winner.json</a>
- description of winner in JSON</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/gen-inventory.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fvokes%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+291 -13
View File
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
@@ -6,27 +8,303 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2018/yang/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2018 yang</title>
<meta name="description" content="IOCCC year: 2018 IOCCC winner: yang winner index page">
<meta name="keywords" content="IOCCC,2018,yang,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2018/yang</title>
<meta name="description" content="2018 IOCCC winner yang">
<meta name="keywords" content="IOCCC, 2018, IOCCC 2018, IOCCC winner, yang">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2018 yang</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2018/yang</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.last.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fyang%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2018/yang/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../vokes/index.html">&larr; vokes</a>
<a class="Left" href="../index.html">&uarr; 2018 &uarr;</a>
<a class="Left Disabled" href="#">last entry</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.last.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Don_Yang">Don Yang</a><br> Location:
<a href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<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>
<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>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>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>
<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>
<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
are rotated, the rest are silently ignored. But fear not, a separate
tool with dynamic memory allocation is included:</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">./left</span> <span class="op">&lt;</span> prog.c <span class="op">&gt;</span> r1.c</span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> r1.c <span class="at">-o</span> right</span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./right</span> <span class="op">&lt;</span> input.txt <span class="op">&gt;</span> rotated_clockwise.txt</span></code></pre></div>
<p>For variety, this second tool rotates clockwise instead of
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>
<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>
<p>There is one final rotation, which produces a tool that removes
leading whitespaces:</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="ex">./left</span> <span class="op">&lt;</span> prog.c <span class="kw">|</span> <span class="ex">./left</span> <span class="kw">|</span> <span class="ex">./left</span> <span class="op">&gt;</span> r3.c</span>
<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>
<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>
<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>
<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
<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>
<ul>
<li>gcc 4.8.4 on Linux</li>
<li>gcc 4.9.2 on Linux</li>
<li>gcc 6.1.0 on JS/Linux</li>
<li>gcc 6.3.0 on Linux</li>
<li>gcc 6.4.0 on Cygwin</li>
<li>clang 3.5.0 on Linux</li>
<li>clang 3.8.1 on Linux</li>
<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>
<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>
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
<h1 id="inventory-for-2018yang"><a name="inventory"></a>Inventory for
2018/yang</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/yang/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/yang/Makefile">Makefile</a>
- winner 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 winning
source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<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/.winner.json">.winner.json</a>
- description of winner in JSON</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/gen-inventory.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2018%2Fyang%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->