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

+4 -4
View File
@@ -1,14 +1,14 @@
## To build:
```sh
make all
make all
```
## To use:
```sh
./anonymous
./anonymous
```
@@ -23,7 +23,7 @@ as the alternate code. See below for the tattoo side-by-side with the code.
### Alternate build:
```sh
make alt
make alt
```
@@ -32,7 +32,7 @@ make alt
NOTE: this version might not work on some systems like macOS.
```sh
./anonymous.alt
./anonymous.alt
```
+5 -6
View File
@@ -132,8 +132,7 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Anonymous_1984">Anonymous 1984</a><br>
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
<br><br></li>
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -142,19 +141,19 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
<!-- 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> all</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> all</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">./anonymous</span></span></code></pre></div>
<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">./anonymous</span></span></code></pre></div>
<h2 id="alternate-code">Alternate code:</h2>
<p>The original version of this entry was added, by request,
in order to show the code that was turned into the
<a href="https://web.archive.org/web/20070120220721/https://thomasscovell.com/tattoo.php">tattoo</a>,
as the alternate code. See below for the tattoo side-by-side with the code.</p>
<h3 id="alternate-build">Alternate build:</h3>
<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">make</span> alt</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="fu">make</span> alt</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</h3>
<p>NOTE: this version might not work on some systems like macOS.</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">./anonymous.alt</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">./anonymous.alt</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>The author was too embarrassed that they could write such trash, so I
promised to protect their identity. I will say that the author of this
+8 -8
View File
@@ -1,7 +1,7 @@
## To build:
```sh
make all
make all
```
NOTE: there is an [alternate version](#alternate-code) which will only work if
@@ -14,7 +14,7 @@ The original code was fixed in 2023 to not require this.
The current status of this entry is:
```
STATUS: INABIAF - please **DO NOT** fix
STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [1984 decot bugs](../../bugs.html#1984_decot).
@@ -23,7 +23,7 @@ For more detailed information see [1984 decot bugs](../../bugs.html#1984_decot).
## To use:
```sh
./decot
./decot
```
@@ -37,14 +37,14 @@ can use this version.
### Alternate build:
```sh
make alt
make alt
```
### Alternate use:
```sh
./decot.alt
./decot.alt
```
@@ -62,13 +62,13 @@ Some new (in 1984) compilers disliked line 15 of the original source, so we
changed it from:
```c
for(signal=0;*k * x * __FILE__ *i;) do {
for(signal=0;*k * x * __FILE__ *i;) do {
```
to:
```c
for(signal=0;*k *x * __FILE__ *i;) do {
for(signal=0;*k *x * __FILE__ *i;) do {
```
To see what we mean look at the [original source file](decot.orig.c). The
@@ -76,7 +76,7 @@ To see what we mean look at the [original source file](decot.orig.c). The
fixed version has instead:
```c
for(signal=0;*k *= * __FILE__ *i;) do {
for(signal=0;*k *= * __FILE__ *i;) do {
```
+9 -10
View File
@@ -132,8 +132,7 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Dave_Decot">Dave Decot</a><br>
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
<br><br></li>
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -142,24 +141,24 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
<!-- 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> all</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> all</span></code></pre></div>
<p>NOTE: there is an <a href="#alternate-code">alternate version</a> which will only work if
you have an old enough compiler or a compiler that supports <code>-traditional-cpp</code>.
The original code was fixed in 2023 to not require this.</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>
<pre><code> STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a href="../../bugs.html#1984_decot">1984 decot 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">./decot</span></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">./decot</span></span></code></pre></div>
<h2 id="alternate-code">Alternate code:</h2>
<p>This alternate code, the original, requires a compiler that supports
<code>-traditional-cpp</code> or an old enough compiler. If you have such a compiler you
can use this version.</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>
<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>
<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">./decot.alt</span></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">./decot.alt</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This program prints out what looks like a fragment of C code.</p>
<p>Is this a <strong>bug</strong> or is this a <strong>feature</strong>? To help choose
@@ -167,13 +166,13 @@ the judges offer this one comment: understand remarks!</p>
<h3 id="historical-remarks">Historical remarks:</h3>
<p>Some new (in 1984) compilers disliked line 15 of the original source, so we
changed it from:</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="cf">for</span><span class="op">(</span>signal<span class="op">=</span><span class="dv">0</span><span class="op">;*</span>k <span class="op">*</span> x <span class="op">*</span> __FILE__ <span class="op">*</span>i<span class="op">;)</span> <span class="cf">do</span> <span class="op">{</span></span></code></pre></div>
<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="cf">for</span><span class="op">(</span>signal<span class="op">=</span><span class="dv">0</span><span class="op">;*</span>k <span class="op">*</span> x <span class="op">*</span> __FILE__ <span class="op">*</span>i<span class="op">;)</span> <span class="cf">do</span> <span class="op">{</span></span></code></pre></div>
<p>to:</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="cf">for</span><span class="op">(</span>signal<span class="op">=</span><span class="dv">0</span><span class="op">;*</span>k <span class="op">*</span>x <span class="op">*</span> __FILE__ <span class="op">*</span>i<span class="op">;)</span> <span class="cf">do</span> <span class="op">{</span></span></code></pre></div>
<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="cf">for</span><span class="op">(</span>signal<span class="op">=</span><span class="dv">0</span><span class="op">;*</span>k <span class="op">*</span>x <span class="op">*</span> __FILE__ <span class="op">*</span>i<span class="op">;)</span> <span class="cf">do</span> <span class="op">{</span></span></code></pre></div>
<p>To see what we mean look at the <a href="decot.orig.c">original source file</a>. The
<a href="decot.alt.c">alternate code</a> is the version that has this modification. The
fixed version has instead:</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="cf">for</span><span class="op">(</span>signal<span class="op">=</span><span class="dv">0</span><span class="op">;*</span>k <span class="op">*=</span> <span class="op">*</span> __FILE__ <span class="op">*</span>i<span class="op">;)</span> <span class="cf">do</span> <span class="op">{</span></span></code></pre></div>
<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="cf">for</span><span class="op">(</span>signal<span class="op">=</span><span class="dv">0</span><span class="op">;*</span>k <span class="op">*=</span> <span class="op">*</span> __FILE__ <span class="op">*</span>i<span class="op">;)</span> <span class="cf">do</span> <span class="op">{</span></span></code></pre></div>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>No remarks were provided by the author.</p>
<!--
+10 -10
View File
@@ -1,14 +1,14 @@
## To build:
```sh
make all
make all
```
## To use:
```sh
./laman <positive number>
./laman <positive number>
```
@@ -18,11 +18,11 @@ The program accepts ONE POSITIVE number. Seeing is believing, so try things
like:
```sh
./try.sh
./try.sh
./laman 4
./laman 9
./laman 16
./laman 4
./laman 9
./laman 16
```
This code should run you in circles.
@@ -34,15 +34,15 @@ Some new compilers (in 1984) dislike lines 6 and 10 of the source, so we changed
them from:
```c
;++f)a[ b<<5|c] =d++,b+ =e;for( f=0;f<O
<<5|c]^ =a[b<<5 |c]^=a[ (k-(b+1 ))<<5|c]
;++f)a[ b<<5|c] =d++,b+ =e;for( f=0;f<O
<<5|c]^ =a[b<<5 |c]^=a[ (k-(b+1 ))<<5|c]
```
to:
```c
;++f)a[ b<<5|c] =d++,b+= e;for( f=0;f<O
<<5|c]^= a[b<<5 |c]^=a[ (k-(b+1 ))<<5|c]
;++f)a[ b<<5|c] =d++,b+= e;for( f=0;f<O
<<5|c]^= a[b<<5 |c]^=a[ (k-(b+1 ))<<5|c]
```
I hope you have a C beautifier!
+11 -12
View File
@@ -132,8 +132,7 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Mike_Laman">Mike Laman</a><br>
Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em>
<br><br></li>
Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -142,26 +141,26 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</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> all</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> all</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">./laman</span> <span class="op">&lt;</span>positive number<span class="op">&gt;</span></span></code></pre></div>
<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">./laman</span> <span class="op">&lt;</span>positive number<span class="op">&gt;</span></span></code></pre></div>
<h2 id="try">Try:</h2>
<p>The program accepts ONE POSITIVE number. Seeing is believing, so try things
like:</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>
<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>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./laman</span> 4</span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a><span class="ex">./laman</span> 9</span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a><span class="ex">./laman</span> 16</span></code></pre></div>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./laman</span> 4</span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">./laman</span> 9</span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">./laman</span> 16</span></code></pre></div>
<p>This code should run you in circles.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Some new compilers (in 1984) dislike lines 6 and 10 of the source, so we changed
them from:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="op">;++</span>f<span class="op">)</span>a<span class="op">[</span> b<span class="op">&lt;&lt;</span><span class="dv">5</span><span class="op">|</span>c<span class="op">]</span> <span class="op">=</span>d<span class="op">++,</span>b<span class="op">+</span> <span class="op">=</span>e<span class="op">;</span><span class="cf">for</span><span class="op">(</span> f<span class="op">=</span><span class="dv">0</span><span class="op">;</span>f<span class="op">&lt;</span>O</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="op">&lt;&lt;</span><span class="dv">5</span><span class="op">|</span>c<span class="op">]^</span> <span class="op">=</span>a<span class="op">[</span>b<span class="op">&lt;&lt;</span><span class="dv">5</span> <span class="op">|</span>c<span class="op">]^=</span>a<span class="op">[</span> <span class="op">(</span>k<span class="op">-(</span>b<span class="op">+</span><span class="dv">1</span> <span class="op">))&lt;&lt;</span><span class="dv">5</span><span class="op">|</span>c<span class="op">]</span></span></code></pre></div>
<div class="sourceCode" id="cb4"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="op">;++</span>f<span class="op">)</span>a<span class="op">[</span> b<span class="op">&lt;&lt;</span><span class="dv">5</span><span class="op">|</span>c<span class="op">]</span> <span class="op">=</span>d<span class="op">++,</span>b<span class="op">+</span> <span class="op">=</span>e<span class="op">;</span><span class="cf">for</span><span class="op">(</span> f<span class="op">=</span><span class="dv">0</span><span class="op">;</span>f<span class="op">&lt;</span>O</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;&lt;</span><span class="dv">5</span><span class="op">|</span>c<span class="op">]^</span> <span class="op">=</span>a<span class="op">[</span>b<span class="op">&lt;&lt;</span><span class="dv">5</span> <span class="op">|</span>c<span class="op">]^=</span>a<span class="op">[</span> <span class="op">(</span>k<span class="op">-(</span>b<span class="op">+</span><span class="dv">1</span> <span class="op">))&lt;&lt;</span><span class="dv">5</span><span class="op">|</span>c<span class="op">]</span></span></code></pre></div>
<p>to:</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><span class="op">;++</span>f<span class="op">)</span>a<span class="op">[</span> b<span class="op">&lt;&lt;</span><span class="dv">5</span><span class="op">|</span>c<span class="op">]</span> <span class="op">=</span>d<span class="op">++,</span>b<span class="op">+=</span> e<span class="op">;</span><span class="cf">for</span><span class="op">(</span> f<span class="op">=</span><span class="dv">0</span><span class="op">;</span>f<span class="op">&lt;</span>O</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="op">&lt;&lt;</span><span class="dv">5</span><span class="op">|</span>c<span class="op">]^=</span> a<span class="op">[</span>b<span class="op">&lt;&lt;</span><span class="dv">5</span> <span class="op">|</span>c<span class="op">]^=</span>a<span class="op">[</span> <span class="op">(</span>k<span class="op">-(</span>b<span class="op">+</span><span class="dv">1</span> <span class="op">))&lt;&lt;</span><span class="dv">5</span><span class="op">|</span>c<span class="op">]</span></span></code></pre></div>
<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="op">;++</span>f<span class="op">)</span>a<span class="op">[</span> b<span class="op">&lt;&lt;</span><span class="dv">5</span><span class="op">|</span>c<span class="op">]</span> <span class="op">=</span>d<span class="op">++,</span>b<span class="op">+=</span> e<span class="op">;</span><span class="cf">for</span><span class="op">(</span> f<span class="op">=</span><span class="dv">0</span><span class="op">;</span>f<span class="op">&lt;</span>O</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;&lt;</span><span class="dv">5</span><span class="op">|</span>c<span class="op">]^=</span> a<span class="op">[</span>b<span class="op">&lt;&lt;</span><span class="dv">5</span> <span class="op">|</span>c<span class="op">]^=</span>a<span class="op">[</span> <span class="op">(</span>k<span class="op">-(</span>b<span class="op">+</span><span class="dv">1</span> <span class="op">))&lt;&lt;</span><span class="dv">5</span><span class="op">|</span>c<span class="op">]</span></span></code></pre></div>
<p>I hope you have a C beautifier!</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>No remarks were provided by the author.</p>
+87 -88
View File
@@ -1,7 +1,7 @@
## To build:
```sh
make alt
make alt
```
NOTE: the original code will not work on any system other than
@@ -16,7 +16,7 @@ the original version.
The current status of this entry is:
```
STATUS: INABIAF - please **DO NOT** fix
STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [1984 mullender bugs](../../bugs.html#1984_mullender).
@@ -25,7 +25,7 @@ For more detailed information see [1984 mullender bugs](../../bugs.html#1984_mul
## To use:
```sh
./mullender.alt [microseconds]
./mullender.alt [microseconds]
```
Hit ctrl-c/intr to exit the program.
@@ -49,13 +49,13 @@ which is probably not as uncommon as you think :-).
## Try:
```sh
./mullender.alt
./mullender.alt
./mullender.alt 5000 # wait for 5000 microseconds and see what happens
./mullender.alt 5000 # wait for 5000 microseconds and see what happens
./mullender.alt 20000 # wait for 20000 microseconds and see what happens
./mullender.alt 20000 # wait for 20000 microseconds and see what happens
./mullender.alt 100000 # wait for 100000 microseconds and see what happens
./mullender.alt 100000 # wait for 100000 microseconds and see what happens
```
What happens if you hit enter after it reaches the end of the line? Why? What
@@ -73,14 +73,14 @@ machine dependent code was discouraged.
### Original build:
```sh
make all
make all
```
### Original use:
```sh
./mullender
./mullender
```
@@ -138,19 +138,19 @@ Repo](https://github.com/dspinellis/unix-history-repo/tree/Research-Release).
```sh
make gentab
make gentab
```
### gentab use:
```sh
./gentab file
./gentab file
```
### gentab try:
```sh
./gentab gentab > g.c
./gentab gentab > g.c
```
NOTE: it is highly unlikely that you will be able to run the output of `gentab`
@@ -285,18 +285,18 @@ We both knew [PDP-11](https://en.wikipedia.org/wiki/PDP-11) assembly so that was
no problem. The assembly code we came up with is as follows:
```asm
pdp:
mov pc,r4
tst -(r4)
sub $9, r4
mov r4,0f
mov $1, r0
sys 4; 0:0; 9
mov $1000, r2
1:
sys 55
sob r2,1b
br pdp
pdp:
mov pc,r4
tst -(r4)
sub $9, r4
mov r4,0f
mov $1, r0
sys 4; 0:0; 9
mov $1000, r2
1:
sys 55
sob r2,1b
br pdp
```
This is not the code we originally wrote, but it is the code that we ultimately
@@ -332,26 +332,26 @@ program that we came up with is as follows:
```asm
vax: .word 0400 + (pdp - vax) / 2 - 1
1:
pushl $9
pushal str
pushl $1
calls $3, write
cvtwl $32767, r2
vax: .word 0400 + (pdp - vax) / 2 - 1
1:
pushl $9
pushal str
pushl $1
calls $3, write
cvtwl $32767, r2
2:
decl r2
jneq 2b
jbr 1b
2:
decl r2
jneq 2b
jbr 1b
write: .word 0
chmk $4
ret
write: .word 0
chmk $4
ret
str: .ascii " :-)\b\b\b\b"
str: .ascii " :-)\b\b\b\b"
pdp: .word 4548, 3044, 58820, 9, 4407, 6, 5568, 1, 35076, 0, 9, 5570, 512, 35117, 32386, 496
pdp: .word 4548, 3044, 58820, 9, 4407, 6, 5568, 1, 35076, 0, 9, 5570, 512, 35117, 32386, 496
```
The first word (after the label `vax`) is the
@@ -390,60 +390,59 @@ extracted the machine code from the object file.
compiled in modern systems.
```c
\#include <stdio.h>
\#include <a.out.h>
#include <stdio.h>
#include <a.out.h>
main(argc, argv) char **argv;
{
register FILE *fp;
register short pos = 0, c, n;
register char *fmt;
if (argc != 2) {
fprintf (stderr, "Usage: %s file\n", argv[0]);
exit (1);
}
if ((fp = fopen(argv[1], "r")) == NULL) {
fprintf(stderr, "%s: can't open %s\n", argv[0], argv[1]);
exit(2);
}
fseek (fp, (long) sizeof (struct exec), 0);
printf("/* portable between VAX and PDP11 */\n\n");
printf ("short main[] = {\n");
for (;;) {
if (pos == 0)
printf("\t");
c=getc(fp) & 0377;
if (feof(fp)) break;
n = getc(fp) << 8|c;
switch (rand() % 5) {
case 0:
case 1:
fmt = "%d"; break;
case 2:
fmt = "%u"; break;
case 3:
fmt = "0%o"; break;
case 4:
fmt = "0x%x"; break;
main(argc, argv) char **argv;
{
register FILE *fp;
register short pos = 0, c, n;
register char *fmt;
if (argc != 2) {
fprintf (stderr, "Usage: %s file\n", argv[0]);
exit (1);
}
if (32 <= n && n < 127 && (rand() % 4)) fmt = "'%c'";
printf(n < 8 ? "%d" : fmt, n);
printf(",");
if (pos++ == 8) {
printf("\n");
pos = 0;
if ((fp = fopen(argv[1], "r")) == NULL) {
fprintf(stderr, "%s: can't open %s\n", argv[0], argv[1]);
exit(2);
}
else printf(" ");
printf("};\n");
fseek (fp, (long) sizeof (struct exec), 0);
printf("/* portable between VAX and PDP11 */\n\n");
printf ("short main[] = {\n");
for (;;) {
if (pos == 0)
printf("\t");
c=getc(fp) & 0377;
if (feof(fp)) break;
n = getc(fp) << 8|c;
switch (rand() % 5) {
case 0:
case 1:
fmt = "%d"; break;
case 2:
fmt = "%u"; break;
case 3:
fmt = "0%o"; break;
case 4:
fmt = "0x%x"; break;
}
if (32 <= n && n < 127 && (rand() % 4)) fmt = "'%c'";
printf(n < 8 ? "%d" : fmt, n);
printf(",");
if (pos++ == 8) {
printf("\n");
pos = 0;
}
else printf(" ");
printf("};\n");
}
}
}
```
As can be seen, there is a slight preference for decimal, and also a character
+87 -88
View File
@@ -135,8 +135,7 @@
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
<br><br></li>
<li>Name: <a href="../../authors.html#Sjoerd_Mullender">Sjoerd Mullender</a><br>
Location: <a href="../../location.html#NL">NL</a> - <em>Kingdom of the Netherlands</em> (<em>Netherlands</em>)
<br><br></li>
Location: <a href="../../location.html#NL">NL</a> - <em>Kingdom of the Netherlands</em> (<em>Netherlands</em>)</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -145,7 +144,7 @@ Location: <a href="../../location.html#NL">NL</a> - <em>Kingdom of the Netherlan
<!-- 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> alt</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> alt</span></code></pre></div>
<p>NOTE: the original code will not work on any system other than
<a href="https://en.wikipedia.org/wiki/VAX-11">VAX-11</a> and
<a href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a> and this is why we encourage you
@@ -153,10 +152,10 @@ to use the alt version instead. See <a href="#original-code">original code</a> b
the original version.</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>
<pre><code> STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a href="../../bugs.html#1984_mullender">1984 mullender 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">./mullender.alt</span> <span class="pp">[</span><span class="ss">microseconds</span><span class="pp">]</span></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">./mullender.alt</span> <span class="pp">[</span><span class="ss">microseconds</span><span class="pp">]</span></span></code></pre></div>
<p>Hit ctrl-c/intr to exit the program.</p>
<p>The default microseconds is 190000 as this is approximately how long it slept in
the original entry but it can be no lower than 5000 as any lower doesn’t work
@@ -170,13 +169,13 @@ overflow!</p>
<p>BTW: is there such a thing as too fast a CPU ? :-) Actually yes for certain code
which is probably not as uncommon as you think :-).</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">./mullender.alt</span></span>
<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">./mullender.alt</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./mullender.alt</span> 5000 <span class="co"># wait for 5000 microseconds and see what happens</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./mullender.alt</span> 5000 <span class="co"># wait for 5000 microseconds and see what happens</span></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a><span class="ex">./mullender.alt</span> 20000 <span class="co"># wait for 20000 microseconds and see what happens</span></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">./mullender.alt</span> 20000 <span class="co"># wait for 20000 microseconds and see what happens</span></span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a><span class="ex">./mullender.alt</span> 100000 <span class="co"># wait for 100000 microseconds and see what happens</span></span></code></pre></div>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> <span class="ex">./mullender.alt</span> 100000 <span class="co"># wait for 100000 microseconds and see what happens</span></span></code></pre></div>
<p>What happens if you hit enter after it reaches the end of the line? Why? What
happens after some time of waiting?</p>
<h2 id="original-code">Original code:</h2>
@@ -185,9 +184,9 @@ happens after some time of waiting?</p>
<a href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a>. In the following years, 1985 on,
machine dependent code was discouraged.</p>
<h3 id="original-build">Original 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">make</span> all</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="fu">make</span> all</span></code></pre></div>
<h3 id="original-use">Original use:</h3>
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./mullender</span></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">./mullender</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Without question, this C program is the one of the most obfuscated C program
that has ever been received! Like all great contest entries, it resulted in a
@@ -226,11 +225,11 @@ in the <em>fabulous</em> <a href="https://github.com/dspinellis/unix-history-rep
Repo</a>.</p>
<h3 id="gentab-build">gentab build:</h3>
<p><code>gentab.c</code> can be built like:</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">make</span> gentab</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="fu">make</span> gentab</span></code></pre></div>
<h3 id="gentab-use">gentab use:</h3>
<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">./gentab</span> file</span></code></pre></div>
<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">./gentab</span> file</span></code></pre></div>
<h3 id="gentab-try">gentab try:</h3>
<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">./gentab</span> gentab <span class="op">&gt;</span> g.c</span></code></pre></div>
<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">./gentab</span> gentab <span class="op">&gt;</span> g.c</span></code></pre></div>
<p>NOTE: it is highly unlikely that you will be able to run the output of <code>gentab</code>
but it should at least compile.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
@@ -334,18 +333,18 @@ simple.</p>
<a href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a> code in assembly.
We both knew <a href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a> assembly so that was
no problem. The assembly code we came up with is as follows:</p>
<div class="sourceCode" id="cb11"><pre class="sourceCode asm"><code class="sourceCode fasm"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="fu">pdp:</span></span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a> <span class="bu">mov</span> pc<span class="op">,</span>r4</span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a> tst <span class="op">-(</span>r4<span class="op">)</span></span>
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a> <span class="bu">sub</span> <span class="op">$</span><span class="bn">9</span><span class="op">,</span> r4</span>
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a> <span class="bu">mov</span> r4<span class="op">,</span><span class="fl">0</span><span class="bn">f</span></span>
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a> <span class="bu">mov</span> <span class="op">$</span><span class="bn">1</span><span class="op">,</span> r0</span>
<span id="cb11-7"><a href="#cb11-7" aria-hidden="true" tabindex="-1"></a> sys <span class="dv">4</span><span class="co">; 0:0; 9</span></span>
<span id="cb11-8"><a href="#cb11-8" aria-hidden="true" tabindex="-1"></a> <span class="bu">mov</span> <span class="op">$</span><span class="bn">1000</span><span class="op">,</span> r2</span>
<span id="cb11-9"><a href="#cb11-9" aria-hidden="true" tabindex="-1"></a>1:</span>
<span id="cb11-10"><a href="#cb11-10" aria-hidden="true" tabindex="-1"></a> sys <span class="dv">55</span></span>
<span id="cb11-11"><a href="#cb11-11" aria-hidden="true" tabindex="-1"></a> sob r2<span class="op">,</span><span class="bn">1b</span></span>
<span id="cb11-12"><a href="#cb11-12" aria-hidden="true" tabindex="-1"></a> br pdp</span></code></pre></div>
<div class="sourceCode" id="cb11"><pre class="sourceCode asm"><code class="sourceCode fasm"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">pdp:</span></span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a> <span class="bu">mov</span> pc<span class="op">,</span>r4</span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a> tst <span class="op">-(</span>r4<span class="op">)</span></span>
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a> <span class="bu">sub</span> <span class="op">$</span><span class="bn">9</span><span class="op">,</span> r4</span>
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a> <span class="bu">mov</span> r4<span class="op">,</span><span class="fl">0</span><span class="bn">f</span></span>
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a> <span class="bu">mov</span> <span class="op">$</span><span class="bn">1</span><span class="op">,</span> r0</span>
<span id="cb11-7"><a href="#cb11-7" aria-hidden="true" tabindex="-1"></a> sys <span class="dv">4</span><span class="co">; 0:0; 9</span></span>
<span id="cb11-8"><a href="#cb11-8" aria-hidden="true" tabindex="-1"></a> <span class="bu">mov</span> <span class="op">$</span><span class="bn">1000</span><span class="op">,</span> r2</span>
<span id="cb11-9"><a href="#cb11-9" aria-hidden="true" tabindex="-1"></a> 1:</span>
<span id="cb11-10"><a href="#cb11-10" aria-hidden="true" tabindex="-1"></a> sys <span class="dv">55</span></span>
<span id="cb11-11"><a href="#cb11-11" aria-hidden="true" tabindex="-1"></a> sob r2<span class="op">,</span><span class="bn">1b</span></span>
<span id="cb11-12"><a href="#cb11-12" aria-hidden="true" tabindex="-1"></a> br pdp</span></code></pre></div>
<p>This is not the code we originally wrote, but it is the code that we ultimately
used in the program. The string to be printed is shared by the
<a href="https://en.wikipedia.org/wiki/VAX">VAX</a> and the
@@ -374,26 +373,26 @@ VAX <a href="https://en.wikipedia.org/wiki/Assembly_language">assembly</a>, we w
VAX code in C and massaged the
<a href="https://en.wikipedia.org/wiki/Compiler">compiler</a> output. The VAX assembly
program that we came up with is as follows:</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode asm"><code class="sourceCode fasm"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="fu">vax:</span> .<span class="dt">word</span> <span class="dv">0400</span> <span class="op">+</span> <span class="op">(</span>pdp <span class="op">-</span> vax<span class="op">)</span> <span class="op">/</span> <span class="dv">2</span> <span class="op">-</span> <span class="dv">1</span></span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a>1:</span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a> pushl <span class="op">$</span><span class="bn">9</span></span>
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a> pushal str</span>
<span id="cb12-5"><a href="#cb12-5" aria-hidden="true" tabindex="-1"></a> pushl <span class="op">$</span><span class="bn">1</span></span>
<span id="cb12-6"><a href="#cb12-6" aria-hidden="true" tabindex="-1"></a> calls <span class="op">$</span><span class="bn">3</span><span class="op">,</span> write</span>
<span id="cb12-7"><a href="#cb12-7" aria-hidden="true" tabindex="-1"></a> cvtwl <span class="op">$</span><span class="bn">32767</span><span class="op">,</span> r2</span>
<div class="sourceCode" id="cb12"><pre class="sourceCode asm"><code class="sourceCode fasm"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">vax:</span> .<span class="dt">word</span> <span class="dv">0400</span> <span class="op">+</span> <span class="op">(</span>pdp <span class="op">-</span> vax<span class="op">)</span> <span class="op">/</span> <span class="dv">2</span> <span class="op">-</span> <span class="dv">1</span></span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a> 1:</span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a> pushl <span class="op">$</span><span class="bn">9</span></span>
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a> pushal str</span>
<span id="cb12-5"><a href="#cb12-5" aria-hidden="true" tabindex="-1"></a> pushl <span class="op">$</span><span class="bn">1</span></span>
<span id="cb12-6"><a href="#cb12-6" aria-hidden="true" tabindex="-1"></a> calls <span class="op">$</span><span class="bn">3</span><span class="op">,</span> write</span>
<span id="cb12-7"><a href="#cb12-7" aria-hidden="true" tabindex="-1"></a> cvtwl <span class="op">$</span><span class="bn">32767</span><span class="op">,</span> r2</span>
<span id="cb12-8"><a href="#cb12-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-9"><a href="#cb12-9" aria-hidden="true" tabindex="-1"></a>2:</span>
<span id="cb12-10"><a href="#cb12-10" aria-hidden="true" tabindex="-1"></a> decl r2</span>
<span id="cb12-11"><a href="#cb12-11" aria-hidden="true" tabindex="-1"></a> jneq <span class="dv">2</span><span class="er">b</span></span>
<span id="cb12-12"><a href="#cb12-12" aria-hidden="true" tabindex="-1"></a> jbr <span class="bn">1b</span></span>
<span id="cb12-9"><a href="#cb12-9" aria-hidden="true" tabindex="-1"></a> 2:</span>
<span id="cb12-10"><a href="#cb12-10" aria-hidden="true" tabindex="-1"></a> decl r2</span>
<span id="cb12-11"><a href="#cb12-11" aria-hidden="true" tabindex="-1"></a> jneq <span class="dv">2</span><span class="er">b</span></span>
<span id="cb12-12"><a href="#cb12-12" aria-hidden="true" tabindex="-1"></a> jbr <span class="bn">1b</span></span>
<span id="cb12-13"><a href="#cb12-13" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-14"><a href="#cb12-14" aria-hidden="true" tabindex="-1"></a><span class="fu">write:</span> .<span class="dt">word</span> <span class="dv">0</span></span>
<span id="cb12-15"><a href="#cb12-15" aria-hidden="true" tabindex="-1"></a> chmk <span class="op">$</span><span class="bn">4</span></span>
<span id="cb12-16"><a href="#cb12-16" aria-hidden="true" tabindex="-1"></a> <span class="cf">ret</span></span>
<span id="cb12-14"><a href="#cb12-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">write:</span> .<span class="dt">word</span> <span class="dv">0</span></span>
<span id="cb12-15"><a href="#cb12-15" aria-hidden="true" tabindex="-1"></a> chmk <span class="op">$</span><span class="bn">4</span></span>
<span id="cb12-16"><a href="#cb12-16" aria-hidden="true" tabindex="-1"></a> <span class="cf">ret</span></span>
<span id="cb12-17"><a href="#cb12-17" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-18"><a href="#cb12-18" aria-hidden="true" tabindex="-1"></a><span class="fu">str:</span> .ascii <span class="st">&quot; :-)\b\b\b\b&quot;</span></span>
<span id="cb12-18"><a href="#cb12-18" aria-hidden="true" tabindex="-1"></a> <span class="fu">str:</span> .ascii <span class="st">&quot; :-)\b\b\b\b&quot;</span></span>
<span id="cb12-19"><a href="#cb12-19" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-20"><a href="#cb12-20" aria-hidden="true" tabindex="-1"></a><span class="fu">pdp:</span> .<span class="dt">word</span> <span class="dv">4548</span><span class="op">,</span> <span class="dv">3044</span><span class="op">,</span> <span class="dv">58820</span><span class="op">,</span> <span class="dv">9</span><span class="op">,</span> <span class="dv">4407</span><span class="op">,</span> <span class="dv">6</span><span class="op">,</span> <span class="dv">5568</span><span class="op">,</span> <span class="dv">1</span><span class="op">,</span> <span class="dv">35076</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">9</span><span class="op">,</span> <span class="dv">5570</span><span class="op">,</span> <span class="dv">512</span><span class="op">,</span> <span class="dv">35117</span><span class="op">,</span> <span class="dv">32386</span><span class="op">,</span> <span class="dv">496</span></span></code></pre></div>
<span id="cb12-20"><a href="#cb12-20" aria-hidden="true" tabindex="-1"></a> <span class="fu">pdp:</span> .<span class="dt">word</span> <span class="dv">4548</span><span class="op">,</span> <span class="dv">3044</span><span class="op">,</span> <span class="dv">58820</span><span class="op">,</span> <span class="dv">9</span><span class="op">,</span> <span class="dv">4407</span><span class="op">,</span> <span class="dv">6</span><span class="op">,</span> <span class="dv">5568</span><span class="op">,</span> <span class="dv">1</span><span class="op">,</span> <span class="dv">35076</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">9</span><span class="op">,</span> <span class="dv">5570</span><span class="op">,</span> <span class="dv">512</span><span class="op">,</span> <span class="dv">35117</span><span class="op">,</span> <span class="dv">32386</span><span class="op">,</span> <span class="dv">496</span></span></code></pre></div>
<p>The first word (after the label <code>vax</code>) is the
<a href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a> <a href="https://en.wikipedia.org/wiki/Branch_(computer_science)">branch
instruction</a>.
@@ -427,59 +426,59 @@ extracted the machine code from the object file.</p>
<p>NOTE from judges: see <a href="gentab.c">gentab.c</a> for a copy of this file that can be
compiled in modern systems.</p>
</blockquote>
<div class="sourceCode" id="cb13"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a>\#include <span class="op">&lt;</span>stdio<span class="op">.</span>h<span class="op">&gt;</span></span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a>\#include <span class="op">&lt;</span>a<span class="op">.</span>out<span class="op">.</span>h<span class="op">&gt;</span></span>
<div class="sourceCode" id="cb13"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a> <span class="pp">#include </span><span class="im">&lt;stdio.h&gt;</span></span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a> <span class="pp">#include </span><span class="im">&lt;a.out.h&gt;</span></span>
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-4"><a href="#cb13-4" aria-hidden="true" tabindex="-1"></a>main<span class="op">(</span>argc<span class="op">,</span> argv<span class="op">)</span> <span class="dt">char</span> <span class="op">**</span>argv<span class="op">;</span></span>
<span id="cb13-5"><a href="#cb13-5" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb13-6"><a href="#cb13-6" aria-hidden="true" tabindex="-1"></a> <span class="dt">register</span> <span class="dt">FILE</span> <span class="op">*</span>fp<span class="op">;</span></span>
<span id="cb13-7"><a href="#cb13-7" aria-hidden="true" tabindex="-1"></a> <span class="dt">register</span> <span class="dt">short</span> pos <span class="op">=</span> <span class="dv">0</span><span class="op">,</span> c<span class="op">,</span> n<span class="op">;</span></span>
<span id="cb13-8"><a href="#cb13-8" aria-hidden="true" tabindex="-1"></a> <span class="dt">register</span> <span class="dt">char</span> <span class="op">*</span>fmt<span class="op">;</span></span>
<span id="cb13-9"><a href="#cb13-9" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>argc <span class="op">!=</span> <span class="dv">2</span><span class="op">)</span> <span class="op">{</span></span>
<span id="cb13-10"><a href="#cb13-10" aria-hidden="true" tabindex="-1"></a> fprintf <span class="op">(</span>stderr<span class="op">,</span> <span class="st">&quot;Usage: </span><span class="sc">%s</span><span class="st"> file</span><span class="sc">\n</span><span class="st">&quot;</span><span class="op">,</span> argv<span class="op">[</span><span class="dv">0</span><span class="op">]);</span></span>
<span id="cb13-11"><a href="#cb13-11" aria-hidden="true" tabindex="-1"></a> exit <span class="op">(</span><span class="dv">1</span><span class="op">);</span></span>
<span id="cb13-12"><a href="#cb13-12" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<span id="cb13-4"><a href="#cb13-4" aria-hidden="true" tabindex="-1"></a> main<span class="op">(</span>argc<span class="op">,</span> argv<span class="op">)</span> <span class="dt">char</span> <span class="op">**</span>argv<span class="op">;</span></span>
<span id="cb13-5"><a href="#cb13-5" aria-hidden="true" tabindex="-1"></a> <span class="op">{</span></span>
<span id="cb13-6"><a href="#cb13-6" aria-hidden="true" tabindex="-1"></a> <span class="dt">register</span> <span class="dt">FILE</span> <span class="op">*</span>fp<span class="op">;</span></span>
<span id="cb13-7"><a href="#cb13-7" aria-hidden="true" tabindex="-1"></a> <span class="dt">register</span> <span class="dt">short</span> pos <span class="op">=</span> <span class="dv">0</span><span class="op">,</span> c<span class="op">,</span> n<span class="op">;</span></span>
<span id="cb13-8"><a href="#cb13-8" aria-hidden="true" tabindex="-1"></a> <span class="dt">register</span> <span class="dt">char</span> <span class="op">*</span>fmt<span class="op">;</span></span>
<span id="cb13-9"><a href="#cb13-9" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>argc <span class="op">!=</span> <span class="dv">2</span><span class="op">)</span> <span class="op">{</span></span>
<span id="cb13-10"><a href="#cb13-10" aria-hidden="true" tabindex="-1"></a> fprintf <span class="op">(</span>stderr<span class="op">,</span> <span class="st">&quot;Usage: </span><span class="sc">%s</span><span class="st"> file</span><span class="sc">\n</span><span class="st">&quot;</span><span class="op">,</span> argv<span class="op">[</span><span class="dv">0</span><span class="op">]);</span></span>
<span id="cb13-11"><a href="#cb13-11" aria-hidden="true" tabindex="-1"></a> exit <span class="op">(</span><span class="dv">1</span><span class="op">);</span></span>
<span id="cb13-12"><a href="#cb13-12" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<span id="cb13-13"><a href="#cb13-13" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-14"><a href="#cb13-14" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">((</span>fp <span class="op">=</span> fopen<span class="op">(</span>argv<span class="op">[</span><span class="dv">1</span><span class="op">],</span> <span class="st">&quot;r&quot;</span><span class="op">))</span> <span class="op">==</span> NULL<span class="op">)</span> <span class="op">{</span></span>
<span id="cb13-15"><a href="#cb13-15" aria-hidden="true" tabindex="-1"></a> fprintf<span class="op">(</span>stderr<span class="op">,</span> <span class="st">&quot;</span><span class="sc">%s</span><span class="st">: can&#39;t open </span><span class="sc">%s\n</span><span class="st">&quot;</span><span class="op">,</span> argv<span class="op">[</span><span class="dv">0</span><span class="op">],</span> argv<span class="op">[</span><span class="dv">1</span><span class="op">]);</span></span>
<span id="cb13-16"><a href="#cb13-16" aria-hidden="true" tabindex="-1"></a> exit<span class="op">(</span><span class="dv">2</span><span class="op">);</span></span>
<span id="cb13-17"><a href="#cb13-17" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<span id="cb13-14"><a href="#cb13-14" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">((</span>fp <span class="op">=</span> fopen<span class="op">(</span>argv<span class="op">[</span><span class="dv">1</span><span class="op">],</span> <span class="st">&quot;r&quot;</span><span class="op">))</span> <span class="op">==</span> NULL<span class="op">)</span> <span class="op">{</span></span>
<span id="cb13-15"><a href="#cb13-15" aria-hidden="true" tabindex="-1"></a> fprintf<span class="op">(</span>stderr<span class="op">,</span> <span class="st">&quot;</span><span class="sc">%s</span><span class="st">: can&#39;t open </span><span class="sc">%s\n</span><span class="st">&quot;</span><span class="op">,</span> argv<span class="op">[</span><span class="dv">0</span><span class="op">],</span> argv<span class="op">[</span><span class="dv">1</span><span class="op">]);</span></span>
<span id="cb13-16"><a href="#cb13-16" aria-hidden="true" tabindex="-1"></a> exit<span class="op">(</span><span class="dv">2</span><span class="op">);</span></span>
<span id="cb13-17"><a href="#cb13-17" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<span id="cb13-18"><a href="#cb13-18" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-19"><a href="#cb13-19" aria-hidden="true" tabindex="-1"></a> fseek <span class="op">(</span>fp<span class="op">,</span> <span class="op">(</span><span class="dt">long</span><span class="op">)</span> <span class="kw">sizeof</span> <span class="op">(</span><span class="kw">struct</span> exec<span class="op">),</span> <span class="dv">0</span><span class="op">);</span></span>
<span id="cb13-20"><a href="#cb13-20" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">&quot;/* portable between VAX and PDP11 */</span><span class="sc">\n\n</span><span class="st">&quot;</span><span class="op">);</span></span>
<span id="cb13-21"><a href="#cb13-21" aria-hidden="true" tabindex="-1"></a> printf <span class="op">(</span><span class="st">&quot;short main[] = {</span><span class="sc">\n</span><span class="st">&quot;</span><span class="op">);</span></span>
<span id="cb13-22"><a href="#cb13-22" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> <span class="op">(;;)</span> <span class="op">{</span></span>
<span id="cb13-23"><a href="#cb13-23" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>pos <span class="op">==</span> <span class="dv">0</span><span class="op">)</span></span>
<span id="cb13-24"><a href="#cb13-24" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">\t</span><span class="st">&quot;</span><span class="op">);</span></span>
<span id="cb13-19"><a href="#cb13-19" aria-hidden="true" tabindex="-1"></a> fseek <span class="op">(</span>fp<span class="op">,</span> <span class="op">(</span><span class="dt">long</span><span class="op">)</span> <span class="kw">sizeof</span> <span class="op">(</span><span class="kw">struct</span> exec<span class="op">),</span> <span class="dv">0</span><span class="op">);</span></span>
<span id="cb13-20"><a href="#cb13-20" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">&quot;/* portable between VAX and PDP11 */</span><span class="sc">\n\n</span><span class="st">&quot;</span><span class="op">);</span></span>
<span id="cb13-21"><a href="#cb13-21" aria-hidden="true" tabindex="-1"></a> printf <span class="op">(</span><span class="st">&quot;short main[] = {</span><span class="sc">\n</span><span class="st">&quot;</span><span class="op">);</span></span>
<span id="cb13-22"><a href="#cb13-22" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> <span class="op">(;;)</span> <span class="op">{</span></span>
<span id="cb13-23"><a href="#cb13-23" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>pos <span class="op">==</span> <span class="dv">0</span><span class="op">)</span></span>
<span id="cb13-24"><a href="#cb13-24" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">\t</span><span class="st">&quot;</span><span class="op">);</span></span>
<span id="cb13-25"><a href="#cb13-25" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-26"><a href="#cb13-26" aria-hidden="true" tabindex="-1"></a> c<span class="op">=</span>getc<span class="op">(</span>fp<span class="op">)</span> <span class="op">&amp;</span> <span class="bn">0377</span><span class="op">;</span></span>
<span id="cb13-27"><a href="#cb13-27" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>feof<span class="op">(</span>fp<span class="op">))</span> <span class="cf">break</span><span class="op">;</span></span>
<span id="cb13-28"><a href="#cb13-28" aria-hidden="true" tabindex="-1"></a> n <span class="op">=</span> getc<span class="op">(</span>fp<span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="dv">8</span><span class="op">|</span>c<span class="op">;</span></span>
<span id="cb13-26"><a href="#cb13-26" aria-hidden="true" tabindex="-1"></a> c<span class="op">=</span>getc<span class="op">(</span>fp<span class="op">)</span> <span class="op">&amp;</span> <span class="bn">0377</span><span class="op">;</span></span>
<span id="cb13-27"><a href="#cb13-27" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>feof<span class="op">(</span>fp<span class="op">))</span> <span class="cf">break</span><span class="op">;</span></span>
<span id="cb13-28"><a href="#cb13-28" aria-hidden="true" tabindex="-1"></a> n <span class="op">=</span> getc<span class="op">(</span>fp<span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="dv">8</span><span class="op">|</span>c<span class="op">;</span></span>
<span id="cb13-29"><a href="#cb13-29" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-30"><a href="#cb13-30" aria-hidden="true" tabindex="-1"></a> <span class="cf">switch</span> <span class="op">(</span>rand<span class="op">()</span> <span class="op">%</span> <span class="dv">5</span><span class="op">)</span> <span class="op">{</span></span>
<span id="cb13-31"><a href="#cb13-31" aria-hidden="true" tabindex="-1"></a> <span class="cf">case</span> <span class="dv">0</span><span class="op">:</span></span>
<span id="cb13-32"><a href="#cb13-32" aria-hidden="true" tabindex="-1"></a> <span class="cf">case</span> <span class="dv">1</span><span class="op">:</span></span>
<span id="cb13-33"><a href="#cb13-33" aria-hidden="true" tabindex="-1"></a> fmt <span class="op">=</span> <span class="st">&quot;</span><span class="sc">%d</span><span class="st">&quot;</span><span class="op">;</span> <span class="cf">break</span><span class="op">;</span></span>
<span id="cb13-34"><a href="#cb13-34" aria-hidden="true" tabindex="-1"></a> <span class="cf">case</span> <span class="dv">2</span><span class="op">:</span></span>
<span id="cb13-35"><a href="#cb13-35" aria-hidden="true" tabindex="-1"></a> fmt <span class="op">=</span> <span class="st">&quot;</span><span class="sc">%u</span><span class="st">&quot;</span><span class="op">;</span> <span class="cf">break</span><span class="op">;</span></span>
<span id="cb13-36"><a href="#cb13-36" aria-hidden="true" tabindex="-1"></a> <span class="cf">case</span> <span class="dv">3</span><span class="op">:</span></span>
<span id="cb13-37"><a href="#cb13-37" aria-hidden="true" tabindex="-1"></a> fmt <span class="op">=</span> <span class="st">&quot;0</span><span class="sc">%o</span><span class="st">&quot;</span><span class="op">;</span> <span class="cf">break</span><span class="op">;</span></span>
<span id="cb13-38"><a href="#cb13-38" aria-hidden="true" tabindex="-1"></a> <span class="cf">case</span> <span class="dv">4</span><span class="op">:</span></span>
<span id="cb13-39"><a href="#cb13-39" aria-hidden="true" tabindex="-1"></a> fmt <span class="op">=</span> <span class="st">&quot;0x</span><span class="sc">%x</span><span class="st">&quot;</span><span class="op">;</span> <span class="cf">break</span><span class="op">;</span></span>
<span id="cb13-40"><a href="#cb13-40" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<span id="cb13-30"><a href="#cb13-30" aria-hidden="true" tabindex="-1"></a> <span class="cf">switch</span> <span class="op">(</span>rand<span class="op">()</span> <span class="op">%</span> <span class="dv">5</span><span class="op">)</span> <span class="op">{</span></span>
<span id="cb13-31"><a href="#cb13-31" aria-hidden="true" tabindex="-1"></a> <span class="cf">case</span> <span class="dv">0</span><span class="op">:</span></span>
<span id="cb13-32"><a href="#cb13-32" aria-hidden="true" tabindex="-1"></a> <span class="cf">case</span> <span class="dv">1</span><span class="op">:</span></span>
<span id="cb13-33"><a href="#cb13-33" aria-hidden="true" tabindex="-1"></a> fmt <span class="op">=</span> <span class="st">&quot;</span><span class="sc">%d</span><span class="st">&quot;</span><span class="op">;</span> <span class="cf">break</span><span class="op">;</span></span>
<span id="cb13-34"><a href="#cb13-34" aria-hidden="true" tabindex="-1"></a> <span class="cf">case</span> <span class="dv">2</span><span class="op">:</span></span>
<span id="cb13-35"><a href="#cb13-35" aria-hidden="true" tabindex="-1"></a> fmt <span class="op">=</span> <span class="st">&quot;</span><span class="sc">%u</span><span class="st">&quot;</span><span class="op">;</span> <span class="cf">break</span><span class="op">;</span></span>
<span id="cb13-36"><a href="#cb13-36" aria-hidden="true" tabindex="-1"></a> <span class="cf">case</span> <span class="dv">3</span><span class="op">:</span></span>
<span id="cb13-37"><a href="#cb13-37" aria-hidden="true" tabindex="-1"></a> fmt <span class="op">=</span> <span class="st">&quot;0</span><span class="sc">%o</span><span class="st">&quot;</span><span class="op">;</span> <span class="cf">break</span><span class="op">;</span></span>
<span id="cb13-38"><a href="#cb13-38" aria-hidden="true" tabindex="-1"></a> <span class="cf">case</span> <span class="dv">4</span><span class="op">:</span></span>
<span id="cb13-39"><a href="#cb13-39" aria-hidden="true" tabindex="-1"></a> fmt <span class="op">=</span> <span class="st">&quot;0x</span><span class="sc">%x</span><span class="st">&quot;</span><span class="op">;</span> <span class="cf">break</span><span class="op">;</span></span>
<span id="cb13-40"><a href="#cb13-40" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<span id="cb13-41"><a href="#cb13-41" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-42"><a href="#cb13-42" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span><span class="dv">32</span> <span class="op">&lt;=</span> n <span class="op">&amp;&amp;</span> n <span class="op">&lt;</span> <span class="dv">127</span> <span class="op">&amp;&amp;</span> <span class="op">(</span>rand<span class="op">()</span> <span class="op">%</span> <span class="dv">4</span><span class="op">))</span> fmt <span class="op">=</span> <span class="st">&quot;&#39;</span><span class="sc">%c</span><span class="st">&#39;&quot;</span><span class="op">;</span></span>
<span id="cb13-43"><a href="#cb13-43" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span>n <span class="op">&lt;</span> <span class="dv">8</span> <span class="op">?</span> <span class="st">&quot;</span><span class="sc">%d</span><span class="st">&quot;</span> <span class="op">:</span> fmt<span class="op">,</span> n<span class="op">);</span></span>
<span id="cb13-44"><a href="#cb13-44" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">&quot;,&quot;</span><span class="op">);</span></span>
<span id="cb13-45"><a href="#cb13-45" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>pos<span class="op">++</span> <span class="op">==</span> <span class="dv">8</span><span class="op">)</span> <span class="op">{</span></span>
<span id="cb13-46"><a href="#cb13-46" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span><span class="op">);</span></span>
<span id="cb13-47"><a href="#cb13-47" aria-hidden="true" tabindex="-1"></a> pos <span class="op">=</span> <span class="dv">0</span><span class="op">;</span></span>
<span id="cb13-48"><a href="#cb13-48" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<span id="cb13-49"><a href="#cb13-49" aria-hidden="true" tabindex="-1"></a> <span class="cf">else</span> printf<span class="op">(</span><span class="st">&quot; &quot;</span><span class="op">);</span></span>
<span id="cb13-42"><a href="#cb13-42" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span><span class="dv">32</span> <span class="op">&lt;=</span> n <span class="op">&amp;&amp;</span> n <span class="op">&lt;</span> <span class="dv">127</span> <span class="op">&amp;&amp;</span> <span class="op">(</span>rand<span class="op">()</span> <span class="op">%</span> <span class="dv">4</span><span class="op">))</span> fmt <span class="op">=</span> <span class="st">&quot;&#39;</span><span class="sc">%c</span><span class="st">&#39;&quot;</span><span class="op">;</span></span>
<span id="cb13-43"><a href="#cb13-43" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span>n <span class="op">&lt;</span> <span class="dv">8</span> <span class="op">?</span> <span class="st">&quot;</span><span class="sc">%d</span><span class="st">&quot;</span> <span class="op">:</span> fmt<span class="op">,</span> n<span class="op">);</span></span>
<span id="cb13-44"><a href="#cb13-44" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">&quot;,&quot;</span><span class="op">);</span></span>
<span id="cb13-45"><a href="#cb13-45" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>pos<span class="op">++</span> <span class="op">==</span> <span class="dv">8</span><span class="op">)</span> <span class="op">{</span></span>
<span id="cb13-46"><a href="#cb13-46" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span><span class="op">);</span></span>
<span id="cb13-47"><a href="#cb13-47" aria-hidden="true" tabindex="-1"></a> pos <span class="op">=</span> <span class="dv">0</span><span class="op">;</span></span>
<span id="cb13-48"><a href="#cb13-48" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<span id="cb13-49"><a href="#cb13-49" aria-hidden="true" tabindex="-1"></a> <span class="cf">else</span> printf<span class="op">(</span><span class="st">&quot; &quot;</span><span class="op">);</span></span>
<span id="cb13-50"><a href="#cb13-50" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-51"><a href="#cb13-51" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">&quot;};</span><span class="sc">\n</span><span class="st">&quot;</span><span class="op">);</span></span>
<span id="cb13-52"><a href="#cb13-52" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<span id="cb13-53"><a href="#cb13-53" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<span id="cb13-51"><a href="#cb13-51" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">&quot;};</span><span class="sc">\n</span><span class="st">&quot;</span><span class="op">);</span></span>
<span id="cb13-52"><a href="#cb13-52" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<span id="cb13-53"><a href="#cb13-53" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span></code></pre></div>
<p>As can be seen, there is a slight preference for decimal, and also a character
format is sometimes used, but only if the data is a printable ASCII character.</p>
<p>When we ran this program, we were almost completely satisfied with the result.