improved indentation and whitespace for markdown code blocks

All code blocks in markdown have been intended by at least 4 spaces.

We add `--tab-stop=8` to all `pandoc(1)` executions in order to set
a better tab stop indentation, especially for tab intended code blocks.

Changed `bin/pandoc-wrapper.sh` VERSION from "1.5.3 2024-03-26"
to "1.6 2024-03-31".

Fixed `1991/brnstnd/sorta.README.md` so that the sorta code
is code blocks.

Removed unneeded paragraph group in copyright in `inc/footer.default.html`.

Fixed excess whitespace after list Author on entry `index.html` page.

Changed `bin/output-index-author.sh` VERSION from "1.5.2 2024-03-26"
to "1.6 2024-03-31".

Performed `make www` to perform the above and test under macOS.

TODO: Fix the problem of the initial line of code being extra intended.
TODO: Fix excess whitespace around code that is inline.
This commit is contained in:
Landon Curt Noll committed 2024-04-01 04:48:48 -07:00
1 parent b84c27ce02
commit a996f8d2b8
734 files changed
+16723 -16963

No files matched your search

+48 -40
View File
@@ -1,7 +1,7 @@
## To build:
```sh
make
make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
STATUS: INABIAF - please **DO NOT** fix
STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2011 fredriksson bugs](../../bugs.html#2011_fredriksson).
@@ -19,14 +19,14 @@ For more detailed information see [2011 fredriksson bugs](../../bugs.html#2011_f
## To use:
```sh
./fredriksson [-icvtnk#] regexp < file
./fredriksson [-icvtnk#] regexp < file
```
## Try:
```sh
./try.sh
./try.sh
```
NOTE: you need to be allowed to change your stack size or else the last command
@@ -56,7 +56,7 @@ Implements a variant of `grep`.
To search regexp from file, do:
```sh
./fredriksson [-icvtnk#] regexp < file
./fredriksson [-icvtnk#] regexp < file
```
Pipes might not work, see the section Limitations.
@@ -79,8 +79,8 @@ This version of `grep` recognizes two more options, not present in normal
[edit-distance](https://en.wikipedia.org/wiki/Edit_distance)). E.g.
"`obfuscated`" matches "`obfuscation`"
with one deletion and two mismatches. Likewise, "`obfuscate`" and
"`oversimplify`" match with 7 [edit
operations](https://en.wikipedia.org/wiki/Edit_distance#Formal_definition_and_properties).
"`oversimplify`" match with 7
[edit operations](https://en.wikipedia.org/wiki/Edit_distance#Formal_definition_and_properties).
The default is `-k0` (i.e. exact match).
* `-t` Add local transpositions to the set of allowed
@@ -124,13 +124,13 @@ Just say
```sh
./fredriksson -k3 cat < file
./fredriksson -k3 cat < file
```
* Like with `cat`, you can append line numbers too:
```sh
./fredriksson -nk3 cat < file
./fredriksson -nk3 cat < file
```
@@ -173,7 +173,9 @@ Just say
* Depending on the file, it might require a lot of stack space. If the
program segfaults (because of this), say
ulimit -s unlimited
```sh
ulimit -s unlimited
```
cross your fingers, hope it is enough, and try again.
@@ -185,14 +187,14 @@ Just say
to be 'gcc', but any compiler would work, provided that it supports
C99, or long lines as an extension. This code has been tested on:
- GNU/Linux FC4, i386, gcc
- GNU/Linux FC7, x86_64, gcc 4.1.2, tcc 0.9.24 and icc 10.0
- GNU/Linux FC9, x86_64, gcc 4.?.?
- GNU/Linux CentOS 5, gcc 4.1.2
- GNU/Linux Ubuntu 11.04, gcc 4.5.2
- SunOS 5.8, UltraSPARC IIIi, gcc 4.1.2
- SunOS 5.9, UltraSPARC IIIi, gcc 4.1.1 and Sun ONE Studio 8 CC
- AIX 5.3, IBM eServer p5-550, gcc 3.3.3 and AIX CC Version 6
- GNU/Linux FC4, i386, gcc
- GNU/Linux FC7, x86_64, gcc 4.1.2, tcc 0.9.24 and icc 10.0
- GNU/Linux FC9, x86_64, gcc 4.?.?
- GNU/Linux CentOS 5, gcc 4.1.2
- GNU/Linux Ubuntu 11.04, gcc 4.5.2
- SunOS 5.8, UltraSPARC IIIi, gcc 4.1.2
- SunOS 5.9, UltraSPARC IIIi, gcc 4.1.1 and Sun ONE Studio 8 CC
- AIX 5.3, IBM eServer p5-550, gcc 3.3.3 and AIX CC Version 6
(Btw, tcc has its roots in IOCCC...)
@@ -205,7 +207,9 @@ Just say
extracts and builds that, and then calls it. More precisely, the command
to build is
gcc -O3 ag.c -o ag
```sh
gcc -O3 ag.c -o ag
```
To change that you need to edit the char array `p[]` and (possibly) two
specially encoded constants, `-~('('*'(')` and `'C'*' '-'-'`.
@@ -216,29 +220,29 @@ Just say
from the submitted entry.)
* The code demonstrates several useful programming paradigms, such as:
- recursion to remove all loops
- subroutines (`main()` contains several logical subroutines,
selected by the first argument)
- function pointers
- recursion to remove all loops
- subroutines (`main()` contains several logical subroutines,
selected by the first argument)
- function pointers
* Algorithmically, it incorporates the following:
- (inverse) Burrows-Wheeler transform (used also e.g. in `bzip2(1)`)
- data compression (really expansion :-), run-length-encoding,
unary coding (this is why it is expansion rather than compression)
- approximate string matching
- dynamic programming to compute the edit distance
- parallel computation in sequential computers (by packing
several objects into a single `long`, to speed up the dynamic
programming)
- self extracting, compiling and running code
- (inverse) Burrows-Wheeler transform (used also e.g. in `bzip2(1)`)
- data compression (really expansion :-), run-length-encoding,
unary coding (this is why it is expansion rather than compression)
- approximate string matching
- dynamic programming to compute the edit distance
- parallel computation in sequential computers (by packing
several objects into a single `long`, to speed up the dynamic
programming)
- self extracting, compiling and running code
* As a C program, it demonstrates that
- a C subset without reserved words is complete enough,
excluding data type specific things (`int`, `char`, `void` ...)
- only letters are needed (i.e. the digits `0-9` are not)
- only one statement is enough to code any program (plus
variable definitions)
- white space has other uses than just indenting the code
- a C subset without reserved words is complete enough,
excluding data type specific things (`int`, `char`, `void` ...)
- only letters are needed (i.e. the digits `0-9` are not)
- only one statement is enough to code any program (plus
variable definitions)
- white space has other uses than just indenting the code
* It also shows the power of boolean logic and bitwise arithmetic.
@@ -256,12 +260,16 @@ Just say
* No numerical values, other than in the initialized char array, try
./fredriksson -ck0 [0-9] < fredriksson.c
```sh
./fredriksson -ck0 [0-9] < fredriksson.c
```
This should print 1, as there is a number `3` in the char array (only).
You can also try
./fredriksson -ck0 [0-9] < ag.c
```sh
./fredriksson -ck0 [0-9] < ag.c
```
after running `fredriksson` at least once (since this generates that
`ag.c` file), and this should print 0.
+36 -33
View File
@@ -132,8 +132,7 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Kimmo_Fredriksson">Kimmo Fredriksson</a><br>
Location: <a href="../../location.html#FI">FI</a> - <em>Republic of Finland </em> (<em>Finland</em>)
<br><br></li>
Location: <a href="../../location.html#FI">FI</a> - <em>Republic of Finland </em> (<em>Finland</em>)</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -142,15 +141,15 @@ Location: <a href="../../location.html#FI">FI</a> - <em>Republic of Finland </em
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<h2 id="to-build">To build:</h2>
<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>
<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>
<pre><code> STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a href="../../bugs.html#2011_fredriksson">2011 fredriksson bugs</a>.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./fredriksson</span> <span class="pp">[-</span><span class="ss">icvtnk#</span><span class="pp">]</span> regexp <span class="op">&lt;</span> file</span></code></pre></div>
<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">./fredriksson</span> <span class="pp">[-</span><span class="ss">icvtnk#</span><span class="pp">]</span> regexp <span class="op">&lt;</span> file</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>
<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>NOTE: you need to be allowed to change your stack size or else the last command
in the script would likely cause the program to dump core, which is why the
script checks the exit code of <code>ulimit</code> first.</p>
@@ -166,7 +165,7 @@ program and calls it. As an exercise, try writing the compressor.</p>
<p>Implements a variant of <code>grep</code>.</p>
<h3 id="usage">Usage</h3>
<p>To search regexp from file, do:</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">./fredriksson</span> <span class="pp">[-</span><span class="ss">icvtnk#</span><span class="pp">]</span> regexp <span class="op">&lt;</span> file</span></code></pre></div>
<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">./fredriksson</span> <span class="pp">[-</span><span class="ss">icvtnk#</span><span class="pp">]</span> regexp <span class="op">&lt;</span> file</span></code></pre></div>
<p>Pipes might not work, see the section Limitations.
The options <code>-i</code>, <code>-c</code>, <code>-v</code> and <code>-n</code> are the classic ones:</p>
<ul>
@@ -184,8 +183,8 @@ matches (aka
<a href="https://en.wikipedia.org/wiki/Edit_distance">edit-distance</a>). E.g.
“<code>obfuscated</code>” matches “<code>obfuscation</code>”
with one deletion and two mismatches. Likewise, “<code>obfuscate</code>” and
“<code>oversimplify</code>” match with 7 <a href="https://en.wikipedia.org/wiki/Edit_distance#Formal_definition_and_properties">edit
operations</a>.
“<code>oversimplify</code>” match with 7
<a href="https://en.wikipedia.org/wiki/Edit_distance#Formal_definition_and_properties">edit operations</a>.
The default is <code>-k0</code> (i.e. exact match).</p></li>
<li><p><code>-t</code> Add local transpositions to the set of allowed
<a href="https://en.wikipedia.org/wiki/Edit_distance#Formal_definition_and_properties">edit-operations</a>.
@@ -221,11 +220,11 @@ expressions by putting <code>]</code> as the first character, and putting <code>
<li>You can use this in place of <a href="https://en.wikipedia.org/wiki/Cat_(Unix)">cat</a>.
Just say</li>
</ul>
<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">./fredriksson</span> <span class="at">-k3</span> cat <span class="op">&lt;</span> file</span></code></pre></div>
<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">./fredriksson</span> <span class="at">-k3</span> cat <span class="op">&lt;</span> file</span></code></pre></div>
<ul>
<li>Like with <code>cat</code>, you can append line numbers too:</li>
</ul>
<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">./fredriksson</span> <span class="at">-nk3</span> cat <span class="op">&lt;</span> file</span></code></pre></div>
<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">./fredriksson</span> <span class="at">-nk3</span> cat <span class="op">&lt;</span> file</span></code></pre></div>
<h3 id="other-features">Other features</h3>
<ul>
<li><p>It is assumed that the user knows how to feed correct input to the
@@ -255,42 +254,44 @@ input has this limit, as using the edit operations can make the string
longer. However, no assumptions are made for <code>sizeof(long)</code>. In fact,
you can easily use <code>long long</code> instead,</p></li>
<li><p>Depending on the file, it might require a lot of stack space. If the
program segfaults (because of this), say</p>
<p>ulimit -s unlimited</p>
<p>cross your fingers, hope it is enough, and try again.</p></li>
program segfaults (because of this), say</p></li>
</ul>
<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="bu">ulimit</span> <span class="at">-s</span> unlimited</span></code></pre></div>
<p>cross your fingers, hope it is enough, and try again.</p>
<ul>
<li><p>Assumes C99 standard, because of the one very long line. Most C compilers
handle this just fine even in C89 mode, though.</p></li>
<li><p>The code should be reasonably portable, it assumes standard ASCII codes
for each char, and that a C compiler is on <code>$PATH</code>; the latter is hard coded
to be ‘gcc’, but any compiler would work, provided that it supports
C99, or long lines as an extension. This code has been tested on:</p>
<ul>
<li>GNU/Linux FC4, i386, gcc</li>
<li>GNU/Linux FC7, x86_64, gcc 4.1.2, tcc 0.9.24 and icc 10.0</li>
<li>GNU/Linux FC9, x86_64, gcc 4.?.?</li>
<li>GNU/Linux CentOS 5, gcc 4.1.2</li>
<li>GNU/Linux Ubuntu 11.04, gcc 4.5.2</li>
<li>SunOS 5.8, UltraSPARC IIIi, gcc 4.1.2</li>
<li>SunOS 5.9, UltraSPARC IIIi, gcc 4.1.1 and Sun ONE Studio 8 CC</li>
<li>AIX 5.3, IBM eServer p5-550, gcc 3.3.3 and AIX CC Version 6</li>
</ul>
C99, or long lines as an extension. This code has been tested on:</p></li>
<li><p>GNU/Linux FC4, i386, gcc</p></li>
<li><p>GNU/Linux FC7, x86_64, gcc 4.1.2, tcc 0.9.24 and icc 10.0</p></li>
<li><p>GNU/Linux FC9, x86_64, gcc 4.?.?</p></li>
<li><p>GNU/Linux CentOS 5, gcc 4.1.2</p></li>
<li><p>GNU/Linux Ubuntu 11.04, gcc 4.5.2</p></li>
<li><p>SunOS 5.8, UltraSPARC IIIi, gcc 4.1.2</p></li>
<li><p>SunOS 5.9, UltraSPARC IIIi, gcc 4.1.1 and Sun ONE Studio 8 CC</p></li>
<li><p>AIX 5.3, IBM eServer p5-550, gcc 3.3.3 and AIX CC Version 6</p>
<p>(Btw, tcc has its roots in IOCCC…)</p></li>
</ul>
<h3 id="obfuscations-a.k.a.-spoilers">Obfuscations (a.k.a. spoilers…)</h3>
<ul>
<li><p>The initialized char array includes the source code of the real program,
<li>The initialized char array includes the source code of the real program,
as well as its name and commands to build and run it, all
<a href="https://en.wikipedia.org/wiki/Burrows-Wheeler_transform">Burrows-Wheeler</a>
-transformed, then run-length-encoded with unary coding. The main program
extracts and builds that, and then calls it. More precisely, the command
to build is</p>
<pre><code> gcc -O3 ag.c -o ag</code></pre>
to build is</li>
</ul>
<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="fu">gcc</span> <span class="at">-O3</span> ag.c <span class="at">-o</span> ag</span></code></pre></div>
<p>To change that you need to edit the char array <code>p[]</code> and (possibly) two
specially encoded constants, <code>-~('('*'(')</code> and <code>'C'*' '-'-'</code>.
The extracted source (<code>ag.c</code>) is obfuscated as well.</p>
<p>(The original version also deleted the generated source and the
corresponding binary after running it, but this feature was removed
from the submitted entry.)</p></li>
from the submitted entry.)</p>
<ul>
<li><p>The code demonstrates several useful programming paradigms, such as:</p>
<ul>
<li>recursion to remove all loops</li>
@@ -330,13 +331,15 @@ complexity.</p></li>
if-then-else constructs (also, no ternary <code>?:</code> constructs are present).
Two’s complement representation of integers is also abused. E.g. instead
of writing <code>x++</code> or <code>x-1</code>, it is much better to write <code>x=-~x</code> and <code>~-x</code>.</p></li>
<li><p>No numerical values, other than in the initialized char array, try</p>
<pre><code> ./fredriksson -ck0 [0-9] &lt; fredriksson.c</code></pre>
<li><p>No numerical values, other than in the initialized char array, try</p></li>
</ul>
<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">./fredriksson</span> <span class="at">-ck0</span> <span class="pp">[</span><span class="ss">0</span><span class="pp">-</span><span class="ss">9</span><span class="pp">]</span> <span class="op">&lt;</span> fredriksson.c</span></code></pre></div>
<p>This should print 1, as there is a number <code>3</code> in the char array (only).
You can also try</p>
<pre><code> ./fredriksson -ck0 [0-9] &lt; ag.c</code></pre>
<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">./fredriksson</span> <span class="at">-ck0</span> <span class="pp">[</span><span class="ss">0</span><span class="pp">-</span><span class="ss">9</span><span class="pp">]</span> <span class="op">&lt;</span> ag.c</span></code></pre></div>
<p>after running <code>fredriksson</code> at least once (since this generates that
<code>ag.c</code> file), and this should print 0.</p></li>
<code>ag.c</code> file), and this should print 0.</p>
<ul>
<li><p>The source code is best viewed with cat (or using the program itself),
instead of some editor. (This is a somewhat system dependent thing.)</p>
<p>One reason for this is that the code builds (some of the) constant