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

+366 -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,378 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2004/vik2/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>2004 vik2</title>
<meta name="description" content="IOCCC year: 2004 IOCCC winner: vik2 winner index page">
<meta name="keywords" content="IOCCC,2004,vik2,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>2004/vik2</title>
<meta name="description" content="2004 IOCCC winner vik2">
<meta name="keywords" content="IOCCC, 2004, IOCCC 2004, IOCCC winner, vik2">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2004 vik2</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>2004/vik2</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%2F2004%2Fvik2%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2004/vik2/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../vik1/index.html">&larr; vik1</a>
<a class="Left" href="../index.html">&uarr; 2004 &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#Daniel_Vik">Daniel Vik</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">./vik2</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>The fun thing about <a
href="https://en.wikipedia.org/wiki/C_preprocessor">CPP</a> abuses is
that, in most cases, running the <a
href="https://en.wikipedia.org/wiki/C_preprocessor">preprocessor</a> on
them doesn’t help you decipher the obfuscated code. That’s assuming your
preprocessor can take it at all.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="introduction">Introduction</h3>
<p>It’s been a while since the last <a
href="https://en.wikipedia.org/wiki/C_preprocessor">pre-processor</a>
killer won the IOCCC. I thought it was time to relive hour long compile
times so I made a program that does (almost) all computation in the
pre-processor. The program even causes <code>gcc</code> (and other
pre-processors) to crash when configured to do maximum number of
computations. The default configuration of the <a
href="Makefile">Makefile</a> is set to make the program compile in a not
too long time.</p>
<p>I’ve got <code>cpp</code> to crash in a couple of different ways.
Most common is to get a segmentation fault, but a couple of times it
just got stuck in some infinite loop.</p>
<p>I actually had to write my own <a
href="https://en.wikipedia.org/wiki/C_preprocessor">pre-processor</a> to
verify that the program was doing the right thing…</p>
<p>Since it takes a very long time to compile the program, there is a
symbol that can be defined to shorten the compile time and avoid
compiler errors.</p>
<h3 id="features">Features</h3>
<p>The program implements an 11-bit <a
href="https://en.wikipedia.org/wiki/Arithmetic_logic_unit">ALU</a> in
the <a
href="https://en.wikipedia.org/wiki/C_preprocessor">pre-processor</a>.
The ALU has two <a
href="https://en.wikipedia.org/wiki/Processor_register">registers</a>,
<code>X</code> and <code>Y</code>, for calculations and one status
register <code>SR</code>. Each bit in the registers are represented by
one symbol that are either defined or undefined.</p>
<p>The ALU has six instructions:</p>
<ul>
<li><p><code>CLR_X</code> - Clear <a
href="https://en.wikipedia.org/wiki/Processor_register">register</a>
<code>X</code>.</p></li>
<li><p><code>CLR_Y</code> - Clear <a
href="https://en.wikipedia.org/wiki/Processor_register">register</a>
<code>Y</code>.</p></li>
<li><p><code>ADD</code> - Calculates <code>X</code> + <code>Y</code> and
stores the result in <code>X</code>. If the result is larger than 11
bits, the <a href="https://en.wikipedia.org/wiki/Carry_flag">CARRY
bit</a> in <code>SR</code> is set otherwise the <code>CARRY</code> bit
is cleared.</p></li>
<li><p><code>SUB</code> - Calculates <code>X</code> - <code>Y</code> and
stores the result in <code>X</code>. If <code>Y</code> was larger than
<code>X</code>, the <a
href="https://en.wikipedia.org/wiki/Carry_flag">CARRY bit</a> in
<code>SR</code> is set otherwise the <code>CARRY</code> bit is
cleared.</p></li>
<li><p><code>TST</code> - If <code>X</code> == <code>Y</code> the
<code>EQ</code> bit in <code>SR</code> is set, otherwise the
<code>EQ</code> bit is cleared. If <code>X</code> &lt; <code>Y</code>
the <code>LT</code> bit in <code>SR</code> is set, otherwise the
<code>LT</code> bit is cleared.</p></li>
<li><p><code>INC2</code> - Calculates <code>X</code> + 2 and stores the
result in <code>X</code>. The <a
href="https://en.wikipedia.org/wiki/Carry_flag">CARRY bit</a> is handled
as in the <code>ADD</code> instruction.</p></li>
</ul>
<p>Internally the <a
href="https://en.wikipedia.org/wiki/Arithmetic_logic_unit">ALU</a>
implements a one bit adder with a carry in and carry out. This adder is
the core of the ALU. The <code>ADD</code> instruction uses the one bit
adder to create the 11-bit adder. The <code>SUB</code> instruction is
implemented by adding <code>~Y</code> to <code>X</code> and then add 1.
Finally the <code>TST</code> instruction calculates <code>X-Y</code> and
checks the result and the <a
href="https://en.wikipedia.org/wiki/Carry_flag">CARRY bit</a> in the
<code>SR</code> <a
href="https://en.wikipedia.org/wiki/Processor_register">register</a> to
set the <code>EQ</code> and <code>LT</code> bits.</p>
<p>All calculations are made using only <code>#ifdef</code>,
<code>#ifndef</code>, <code>#else</code>, <code>#endif</code>,
<code>#define</code> and <code>#undef</code>. I never assign a value to
a defined symbol. The logic is done by assuming that a defined symbol is
1 and an undefined symbol is 0. (I guess this means that I have
unlimited memory as long as I only store zeroes (!)).</p>
<p>The application that uses the <a
href="https://en.wikipedia.org/wiki/C_preprocessor">pre-processor</a> <a
href="https://en.wikipedia.org/wiki/Arithmetic_logic_unit">ALU</a> is a
<a href="https://en.wikipedia.org/wiki/Prime_number">prime number</a>
generator. The application uses the same pre-processor directives.
Needed variables are stored in memory represented by one defined or
undefined symbol per bit. When doing arithmetics, the variables are
loaded into the <code>X</code> and <code>Y</code> registers by defining
/ undefining the <code>X</code> and <code>Y</code> <a
href="https://en.wikipedia.org/wiki/Processor_register">register</a>
bits. Then the calculation is made and the result is moved back to the
memory.</p>
<p>The choice of application may be a bit unfortunate since we’ve
already seen a winning entry calculating <a
href="https://en.wikipedia.org/wiki/Prime_number">prime numbers</a> in
the <a
href="https://en.wikipedia.org/wiki/C_preprocessor">pre-processor</a>.
There is a big difference though. The <a
href="/1988/applin/README.md">1988/applin</a> entry uses pre- processor
arithmetic (in a very nice way though). This program only defines and
undefines symbols in a well defined ;) way and doesn’t do any
pre-processor arithmetics.</p>
<p>The reason why I chose to do a <a
href="https://en.wikipedia.org/wiki/Prime_number">prime number</a>
application is that the algorithm can be written to do a lot of
calculations without a lot of nesting (GNU <code>cpp</code> allows only
200 nested includes).</p>
<h3 id="build-and-run">Build and Run</h3>
<p>First, do a first pre-processing of the initial definitions. The
<code>FNAME</code> symbol must be defined to the name of the output
file. If you want to speed up the compilation, define the
<code>STOP</code> symbol to anything from <code>_3</code> to
<code>_10</code>. (The default value is <code>_10</code> which will make
the compilation take some time.) Prime numbers up to <code>2^STOP</code>
will be calculated.</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="fu">cpp</span> <span class="st">&#39;-DSTOP=_5&#39;</span> <span class="st">&#39;-DFNAME=&quot;tmp1.c&quot;&#39;</span> prog.c tmp1.c</span></code></pre></div>
<p>Then use <code>cpp</code> or any other <a
href="https://en.wikipedia.org/wiki/C_preprocessor">pre-processor</a> to
do the actual work. This will take some time….</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">cpp</span> tmp1.c <span class="op">&gt;</span> tmp2.c</span></code></pre></div>
<p>Finally compile the pre-processed file</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> <span class="at">-O</span> tmp2.c <span class="at">-o</span> prog</span></code></pre></div>
<p>Then run the program to reveal all prime numbers up to 32 (if you
used <code>STOP=_5</code> as above):</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">./vik2</span></span></code></pre></div>
<h3 id="verification">Verification</h3>
<p>I wasn’t able to compile the full program which calculates <a
href="https://en.wikipedia.org/wiki/Prime_number">prime numbers</a> up
to 1024 using GNU <code>cpp</code> (or any other <a
href="https://en.wikipedia.org/wiki/C_preprocessor">pre-processor</a>)
so I had to write my own. Knowing how the program works it was quite
easy to reduce the compilation time from several hours to about one
second. I also added some statistics to my home made pre-processor and I
found that calculating prime numbers up to 1024 makes the program
include itself over 6.8 million times (see the statistics table
below).</p>
<h3 id="obfuscation">Obfuscation</h3>
<p>Well, since 98.5% of the program is <a
href="https://en.wikipedia.org/wiki/C_preprocessor">preprocessor</a>
directives, the main obfuscation is the use of preprocessor
directives.</p>
<p>Doing arithmetics without actually using any arithmetic operations
makes the program quite hard to follow.</p>
<p>In order to actually do the calculations, the program includes itself
a lot.</p>
<p>The symbol names are made as short as possible to meet the space
limits. This of course adds to the obfuscation (even though the program
is quite obfuscated with longer, readable macro names.</p>
<p>Finally, I made the 1.5% C code a bit harder to read by breaking all
lines after three characters.</p>
<p>The program has 1029 lines which makes it the longest entry (so
far).</p>
<p>Even though the pre-processed and indented output is easier to read,
it is quite hard to find the code in it. The size of the pre-processed
file is several Mb when using GNU <code>cpp</code>.</p>
<h3 id="limitations">Limitations</h3>
<p>In order to fit the program within the space limits, I had to define
the <code>#define</code>, <code>#endif</code>, and some other directives
as single character symbols. This does not compile on all <a
href="https://en.wikipedia.org/wiki/C_preprocessor">pre-processors</a>
but using GNU <code>cpp</code> as a first compilation step solves
this.</p>
<h3 id="statistics">Statistics</h3>
<p>The table below contains some interesting statistics about the
compilation of the program. The intermediate file size is the size of
the output file of the <code>cpp</code> <a
href="https://en.wikipedia.org/wiki/C_preprocessor">pre-processor</a>.
The times taken to pre-process the program were measured using GNU
<code>cpp</code> on my 2.0MHz P4 with 512Mb ram and a lot of disk.</p>
<pre><code> Generated Recursive Max nest Intermediate
Level prime nrs includes count file size Time
_3 &lt; 8 2 322 9 74 748 4&quot;
_4 &lt; 16 4 672 9 182 652 9&quot;
_5 &lt; 32 14 237 9 629 121 32&quot;
_6 &lt; 64 43 748 9 1 998 134 1&#39;41&quot;
_7 &lt; 128 149 851 11 6 823 575 5&#39;50&quot;
_8 &lt; 256 526 874 17 24 028 933 20&#39;37&quot;
_9 &lt; 512 1 920 272 38 65 527 808(*) 1h 42&#39;19&quot;(*)
_10 &lt; 1024 6 826 389 114 63 782 912(*) 2h 47&#39;58&quot;(*)
(*) Before cpp crashed.</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-2004vik2"><a name="inventory"></a>Inventory for
2004/vik2</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/2004/vik2/vik2.c">vik2.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2004/vik2/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2004/vik2/vik2.orig.c">vik2.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2004/vik2/vik2.possible.cat.death.c">vik2.possible.cat.death.c</a>
- include file for winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2004/vik2/vik2_1.c">vik2_1.c</a>
- include file for winning source</li>
<li><a href="2004_vik2.tar.bz2">2004_vik2.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/2004/vik2/.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/2004/vik2/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2004/vik2/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%2F2004%2Fvik2%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 -->