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:
1 parent
b84c27ce02
commit
a996f8d2b8
734 files changed
+16723
-16963
No files matched your search
+1
-1
@@ -78,7 +78,7 @@ Also include anything else that you would like to see in future contests.
|
||||
Send such email to:
|
||||
|
||||
```
|
||||
judges@toad.com
|
||||
judges@toad.com
|
||||
```
|
||||
|
||||
If you use, distribute or publish these entries in some way, please drop
|
||||
|
||||
+59
-60
@@ -1,7 +1,7 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ make all
|
||||
The current status of this entry is:
|
||||
|
||||
```
|
||||
STATUS: doesn't work with some compilers - please provide alternative code or fix for more compilers
|
||||
STATUS: doesn't work with some compilers - please provide alternative code or fix for more compilers
|
||||
```
|
||||
|
||||
For more detailed information see [1996 august bugs](../../bugs.html#1996_august).
|
||||
@@ -19,8 +19,8 @@ For more detailed information see [1996 august bugs](../../bugs.html#1996_august
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
cat august.c test.oc | ./august > test.oo
|
||||
./august < test.oo
|
||||
cat august.c test.oc | ./august > test.oo
|
||||
./august < test.oo
|
||||
```
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ The above should print a `!` followed by a newline.
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -44,33 +44,33 @@ This entry can feed on itself. If you C pre-process the source,
|
||||
you can compile the interpreter:
|
||||
|
||||
```sh
|
||||
make august.oc
|
||||
make august.oc
|
||||
```
|
||||
|
||||
We can now compile the interpreter as follows:
|
||||
|
||||
```sh
|
||||
cat august.c august.oc | ./august > august.oo
|
||||
cat august.c august.oc | ./august > august.oo
|
||||
```
|
||||
|
||||
and use the compiled interpreter to execute some previously
|
||||
compiled code:
|
||||
|
||||
```sh
|
||||
cat august.oo test.oo | ./august
|
||||
cat august.oo test.oo | ./august
|
||||
```
|
||||
|
||||
And we can have the compiled interpreter interpret itself which
|
||||
in turn compiles the test program:
|
||||
|
||||
```sh
|
||||
cat august.oo august.oo fac.oo | ./august
|
||||
cat august.oo august.oo fac.oo | ./august
|
||||
```
|
||||
|
||||
And if you have lots of spare time, you can recurse one level deeper:
|
||||
|
||||
```sh
|
||||
cat august.oo august.oo august.oo fac.oo | ./august
|
||||
cat august.oo august.oo august.oo fac.oo | ./august
|
||||
```
|
||||
|
||||
We (the judges) recommend that you spend some time studying this
|
||||
@@ -108,25 +108,25 @@ Assume that the interpreter has been compiled (source in [august.c](august.c)
|
||||
and binary in august) and that we have this in a file named `test.oc`:
|
||||
|
||||
```c
|
||||
main() { putchar('!'); putchar('\n'); exit(0); }
|
||||
main() { putchar('!'); putchar('\n'); exit(0); }
|
||||
```
|
||||
|
||||
We can then compile by
|
||||
|
||||
```sh
|
||||
cat august.c test.oc | ./august > test.oo
|
||||
cat august.c test.oc | ./august > test.oo
|
||||
```
|
||||
|
||||
And run the compiled program by
|
||||
|
||||
```sh
|
||||
./august < test.oo
|
||||
./august < test.oo
|
||||
```
|
||||
|
||||
Or even simpler:
|
||||
|
||||
```sh
|
||||
cat august.c test.oc | ./august | ./august
|
||||
cat august.c test.oc | ./august | ./august
|
||||
```
|
||||
|
||||
A larger example is included [fac.oc](fac.oc).
|
||||
@@ -142,26 +142,26 @@ command from the Makefile, but add the `-E` flag and change 60000 to 40000,
|
||||
i.e.:
|
||||
|
||||
```sh
|
||||
cc -E -DZ=40000 .... august.c > august.oc
|
||||
cc -E -DZ=40000 .... august.c > august.oc
|
||||
```
|
||||
|
||||
If `august.oc` contain some junk line starting with a `#` (most likely
|
||||
it does) then remove it like:
|
||||
|
||||
```sh
|
||||
sed -i'' '/^#/d' august.oc
|
||||
sed -i'' '/^#/d' august.oc
|
||||
```
|
||||
|
||||
OK, we can now compile the interpreter:
|
||||
|
||||
```sh
|
||||
cat august.c august.oc | ./august > august.oo
|
||||
cat august.c august.oc | ./august > august.oo
|
||||
```
|
||||
|
||||
And we can run it:
|
||||
|
||||
```sh
|
||||
cat august.oo test.oo | ./august
|
||||
cat august.oo test.oo | ./august
|
||||
```
|
||||
|
||||
Here we have the interpreter interpreting another interpreter that runs
|
||||
@@ -169,13 +169,13 @@ the program. Did you think that was too fast? Just throw in another
|
||||
level of interpretation:
|
||||
|
||||
```sh
|
||||
cat august.oo august.oo test.oo | ./august
|
||||
cat august.oo august.oo test.oo | ./august
|
||||
```
|
||||
|
||||
And another...
|
||||
|
||||
```sh
|
||||
cat august.oo august.oo august.oo test.oo | ./august
|
||||
cat august.oo august.oo august.oo test.oo | ./august
|
||||
```
|
||||
|
||||
---
|
||||
@@ -214,62 +214,61 @@ Below is a description of the OC grammar.
|
||||
Terminals are in quotes, `()` is used for bracketing.
|
||||
|
||||
```
|
||||
program: decl*
|
||||
program: decl*
|
||||
|
||||
decl: vardecl
|
||||
fundecl
|
||||
decl: vardecl
|
||||
fundecl
|
||||
|
||||
vardecl: type NAME ;
|
||||
type NAME "[" INT "]" ;
|
||||
vardecl: type NAME ;
|
||||
type NAME "[" INT "]" ;
|
||||
|
||||
fundecl: type NAME "(" args ")" "{" body "}"
|
||||
fundecl: type NAME "(" args ")" "{" body "}"
|
||||
|
||||
args: /*empty*/
|
||||
( arg "," )* arg
|
||||
args: /*empty*/
|
||||
( arg "," )* arg
|
||||
|
||||
arg: type NAME
|
||||
arg: type NAME
|
||||
|
||||
body: vardecl* stmt*
|
||||
body: vardecl* stmt*
|
||||
|
||||
stmt: ifstmt
|
||||
whilestmt
|
||||
dowhilestmt
|
||||
"return" expr ";"
|
||||
expr ";"
|
||||
"{" stmt* "}"
|
||||
";"
|
||||
stmt: ifstmt
|
||||
whilestmt
|
||||
dowhilestmt
|
||||
"return" expr ";"
|
||||
expr ";"
|
||||
"{" stmt* "}"
|
||||
";"
|
||||
|
||||
ifstmt: "if" "(" expr ")" stmt
|
||||
"if" "(" expr ")" stmt "else" stmt
|
||||
ifstmt: "if" "(" expr ")" stmt
|
||||
"if" "(" expr ")" stmt "else" stmt
|
||||
|
||||
whilestmt: "while" "(" expr ")" stmt
|
||||
whilestmt: "while" "(" expr ")" stmt
|
||||
|
||||
dowhilestmt: "do" stmt "while" "(" expr ")" ";"
|
||||
dowhilestmt: "do" stmt "while" "(" expr ")" ";"
|
||||
|
||||
expr: expr binop expr
|
||||
unop expr
|
||||
expr "[" expr "]"
|
||||
"(" expr ")"
|
||||
expr "(" exprs ")"
|
||||
NAME
|
||||
INT
|
||||
CHAR
|
||||
STRING
|
||||
expr: expr binop expr
|
||||
unop expr
|
||||
expr "[" expr "]"
|
||||
"(" expr ")"
|
||||
expr "(" exprs ")"
|
||||
NAME
|
||||
INT
|
||||
CHAR
|
||||
STRING
|
||||
|
||||
exprs: /*empty*/
|
||||
(expr ",")* expr
|
||||
exprs: /*empty*/
|
||||
(expr ",")* expr
|
||||
|
||||
binop: "+" | "-" | "*" | "/" | "%" |
|
||||
"=" |
|
||||
"<" | "==" | "!="
|
||||
binop: "+" | "-" | "*" | "/" | "%" |
|
||||
"=" |
|
||||
"<" | "==" | "!="
|
||||
|
||||
unop: "!" | "-" | "*"
|
||||
unop: "!" | "-" | "*"
|
||||
|
||||
type: "int" stars
|
||||
"char" stars
|
||||
|
||||
stars: "*"*
|
||||
type: "int" stars
|
||||
"char" stars
|
||||
|
||||
stars: "*"*
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
+60
-62
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Lennart_Augustsson">Lennart Augustsson</a><br>
|
||||
Location: <a href="../../location.html#SE">SE</a> - <em>Kingdom of Sweden</em> (<em>Sweden</em>)
|
||||
<br><br></li>
|
||||
Location: <a href="../../location.html#SE">SE</a> - <em>Kingdom of Sweden</em> (<em>Sweden</em>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,34 +141,34 @@ Location: <a href="../../location.html#SE">SE</a> - <em>Kingdom of Sweden</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>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code>STATUS: doesn't work with some compilers - please provide alternative code or fix for more compilers</code></pre>
|
||||
<pre><code> STATUS: doesn't work with some compilers - please provide alternative code or fix for more compilers</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#1996_august">1996 august 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="fu">cat</span> august.c test.oc <span class="kw">|</span> <span class="ex">./august</span> <span class="op">></span> test.oo</span>
|
||||
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./august</span> <span class="op"><</span> test.oo</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">cat</span> august.c test.oc <span class="kw">|</span> <span class="ex">./august</span> <span class="op">></span> test.oo</span>
|
||||
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./august</span> <span class="op"><</span> test.oo</span></code></pre></div>
|
||||
<p>NOTE: some compilers will compile this code into infinite loops! If the above
|
||||
cat line (or one of the ones later in the try section) does not execute in a
|
||||
very short amount of time, then you may need to fix your compiler or use gcc.</p>
|
||||
<p>The above should print a <code>!</code> followed by a newline.</p>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>This entry can feed on itself. If you C pre-process the source,
|
||||
you can compile the interpreter:</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">make</span> august.oc</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> august.oc</span></code></pre></div>
|
||||
<p>We can now compile the interpreter as follows:</p>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> august.c august.oc <span class="kw">|</span> <span class="ex">./august</span> <span class="op">></span> august.oo</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="fu">cat</span> august.c august.oc <span class="kw">|</span> <span class="ex">./august</span> <span class="op">></span> august.oo</span></code></pre></div>
|
||||
<p>and use the compiled interpreter to execute some previously
|
||||
compiled code:</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">cat</span> august.oo test.oo <span class="kw">|</span> <span class="ex">./august</span></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">cat</span> august.oo test.oo <span class="kw">|</span> <span class="ex">./august</span></span></code></pre></div>
|
||||
<p>And we can have the compiled interpreter interpret itself which
|
||||
in turn compiles the test program:</p>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> august.oo august.oo fac.oo <span class="kw">|</span> <span class="ex">./august</span></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="fu">cat</span> august.oo august.oo fac.oo <span class="kw">|</span> <span class="ex">./august</span></span></code></pre></div>
|
||||
<p>And if you have lots of spare time, you can recurse one level deeper:</p>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> august.oo august.oo august.oo fac.oo <span class="kw">|</span> <span class="ex">./august</span></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="fu">cat</span> august.oo august.oo august.oo fac.oo <span class="kw">|</span> <span class="ex">./august</span></span></code></pre></div>
|
||||
<p>We (the judges) recommend that you spend some time studying this
|
||||
entry as it surely will make the ‘best of the IOCCC’ list. It was
|
||||
very well received by those who attended the IOCCC BOF.</p>
|
||||
@@ -195,13 +194,13 @@ of operators, and control constructs.</p>
|
||||
can go wrong. But this is what seasoned C programmers are used to.</p>
|
||||
<p>Assume that the interpreter has been compiled (source in <a href="august.c">august.c</a>
|
||||
and binary in august) and that we have this in a file named <code>test.oc</code>:</p>
|
||||
<div class="sourceCode" id="cb10"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a>main<span class="op">()</span> <span class="op">{</span> putchar<span class="op">(</span><span class="ch">'!'</span><span class="op">);</span> putchar<span class="op">(</span><span class="ch">'</span><span class="sc">\n</span><span class="ch">'</span><span class="op">);</span> exit<span class="op">(</span><span class="dv">0</span><span class="op">);</span> <span class="op">}</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb10"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a> main<span class="op">()</span> <span class="op">{</span> putchar<span class="op">(</span><span class="ch">'!'</span><span class="op">);</span> putchar<span class="op">(</span><span class="ch">'</span><span class="sc">\n</span><span class="ch">'</span><span class="op">);</span> exit<span class="op">(</span><span class="dv">0</span><span class="op">);</span> <span class="op">}</span></span></code></pre></div>
|
||||
<p>We can then compile by</p>
|
||||
<div class="sourceCode" id="cb11"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> august.c test.oc <span class="kw">|</span> <span class="ex">./august</span> <span class="op">></span> test.oo</span></code></pre></div>
|
||||
<div class="sourceCode" id="cb11"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">cat</span> august.c test.oc <span class="kw">|</span> <span class="ex">./august</span> <span class="op">></span> test.oo</span></code></pre></div>
|
||||
<p>And run the compiled program by</p>
|
||||
<div class="sourceCode" id="cb12"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./august</span> <span class="op"><</span> test.oo</span></code></pre></div>
|
||||
<div class="sourceCode" id="cb12"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./august</span> <span class="op"><</span> test.oo</span></code></pre></div>
|
||||
<p>Or even simpler:</p>
|
||||
<div class="sourceCode" id="cb13"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> august.c test.oc <span class="kw">|</span> <span class="ex">./august</span> <span class="kw">|</span> <span class="ex">./august</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb13"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">cat</span> august.c test.oc <span class="kw">|</span> <span class="ex">./august</span> <span class="kw">|</span> <span class="ex">./august</span></span></code></pre></div>
|
||||
<p>A larger example is included <a href="fac.oc">fac.oc</a>.</p>
|
||||
<p>The compiler for OC is naturally written in OC (where did you think the byte
|
||||
code came from?). It is in the file <a href="parse.oc">parse.oc</a>.</p>
|
||||
@@ -211,20 +210,20 @@ preprocessor (hey, what do you expect from a program that is this small), so we
|
||||
need to use an external one. To pre-process <a href="august.c">august.c</a> use the
|
||||
command from the Makefile, but add the <code>-E</code> flag and change 60000 to 40000,
|
||||
i.e.:</p>
|
||||
<div class="sourceCode" id="cb14"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> <span class="at">-E</span> <span class="at">-DZ</span><span class="op">=</span>40000 .... august.c <span class="op">></span> august.oc</span></code></pre></div>
|
||||
<div class="sourceCode" id="cb14"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">cc</span> <span class="at">-E</span> <span class="at">-DZ</span><span class="op">=</span>40000 .... august.c <span class="op">></span> august.oc</span></code></pre></div>
|
||||
<p>If <code>august.oc</code> contain some junk line starting with a <code>#</code> (most likely
|
||||
it does) then remove it like:</p>
|
||||
<div class="sourceCode" id="cb15"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="fu">sed</span> <span class="at">-i</span><span class="st">''</span> <span class="st">'/^#/d'</span> august.oc</span></code></pre></div>
|
||||
<div class="sourceCode" id="cb15"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">sed</span> <span class="at">-i</span><span class="st">''</span> <span class="st">'/^#/d'</span> august.oc</span></code></pre></div>
|
||||
<p>OK, we can now compile the interpreter:</p>
|
||||
<div class="sourceCode" id="cb16"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> august.c august.oc <span class="kw">|</span> <span class="ex">./august</span> <span class="op">></span> august.oo</span></code></pre></div>
|
||||
<div class="sourceCode" id="cb16"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">cat</span> august.c august.oc <span class="kw">|</span> <span class="ex">./august</span> <span class="op">></span> august.oo</span></code></pre></div>
|
||||
<p>And we can run it:</p>
|
||||
<div class="sourceCode" id="cb17"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> august.oo test.oo <span class="kw">|</span> <span class="ex">./august</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb17"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">cat</span> august.oo test.oo <span class="kw">|</span> <span class="ex">./august</span></span></code></pre></div>
|
||||
<p>Here we have the interpreter interpreting another interpreter that runs
|
||||
the program. Did you think that was too fast? Just throw in another
|
||||
level of interpretation:</p>
|
||||
<div class="sourceCode" id="cb18"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> august.oo august.oo test.oo <span class="kw">|</span> <span class="ex">./august</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb18"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">cat</span> august.oo august.oo test.oo <span class="kw">|</span> <span class="ex">./august</span></span></code></pre></div>
|
||||
<p>And another…</p>
|
||||
<div class="sourceCode" id="cb19"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> august.oo august.oo august.oo test.oo <span class="kw">|</span> <span class="ex">./august</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb19"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">cat</span> august.oo august.oo august.oo test.oo <span class="kw">|</span> <span class="ex">./august</span></span></code></pre></div>
|
||||
<hr />
|
||||
<p>Fitting the byte code for the compiler into the initial comment
|
||||
was a challenge. I had to strip the compiler/interpreter of
|
||||
@@ -251,62 +250,61 @@ defined. <code>getchar()</code> and <code>putchar()</code> are predefined functi
|
||||
<p>Below is a description of the OC grammar.</p>
|
||||
<h3 id="oc-grammar">OC grammar</h3>
|
||||
<p>Terminals are in quotes, <code>()</code> is used for bracketing.</p>
|
||||
<pre><code>program: decl*
|
||||
<pre><code> program: decl*
|
||||
|
||||
decl: vardecl
|
||||
fundecl
|
||||
decl: vardecl
|
||||
fundecl
|
||||
|
||||
vardecl: type NAME ;
|
||||
type NAME "[" INT "]" ;
|
||||
vardecl: type NAME ;
|
||||
type NAME "[" INT "]" ;
|
||||
|
||||
fundecl: type NAME "(" args ")" "{" body "}"
|
||||
fundecl: type NAME "(" args ")" "{" body "}"
|
||||
|
||||
args: /*empty*/
|
||||
( arg "," )* arg
|
||||
args: /*empty*/
|
||||
( arg "," )* arg
|
||||
|
||||
arg: type NAME
|
||||
arg: type NAME
|
||||
|
||||
body: vardecl* stmt*
|
||||
body: vardecl* stmt*
|
||||
|
||||
stmt: ifstmt
|
||||
whilestmt
|
||||
dowhilestmt
|
||||
"return" expr ";"
|
||||
expr ";"
|
||||
"{" stmt* "}"
|
||||
";"
|
||||
stmt: ifstmt
|
||||
whilestmt
|
||||
dowhilestmt
|
||||
"return" expr ";"
|
||||
expr ";"
|
||||
"{" stmt* "}"
|
||||
";"
|
||||
|
||||
ifstmt: "if" "(" expr ")" stmt
|
||||
"if" "(" expr ")" stmt "else" stmt
|
||||
ifstmt: "if" "(" expr ")" stmt
|
||||
"if" "(" expr ")" stmt "else" stmt
|
||||
|
||||
whilestmt: "while" "(" expr ")" stmt
|
||||
whilestmt: "while" "(" expr ")" stmt
|
||||
|
||||
dowhilestmt: "do" stmt "while" "(" expr ")" ";"
|
||||
dowhilestmt: "do" stmt "while" "(" expr ")" ";"
|
||||
|
||||
expr: expr binop expr
|
||||
unop expr
|
||||
expr "[" expr "]"
|
||||
"(" expr ")"
|
||||
expr "(" exprs ")"
|
||||
NAME
|
||||
INT
|
||||
CHAR
|
||||
STRING
|
||||
expr: expr binop expr
|
||||
unop expr
|
||||
expr "[" expr "]"
|
||||
"(" expr ")"
|
||||
expr "(" exprs ")"
|
||||
NAME
|
||||
INT
|
||||
CHAR
|
||||
STRING
|
||||
|
||||
exprs: /*empty*/
|
||||
(expr ",")* expr
|
||||
exprs: /*empty*/
|
||||
(expr ",")* expr
|
||||
|
||||
binop: "+" | "-" | "*" | "/" | "%" |
|
||||
"=" |
|
||||
"<" | "==" | "!="
|
||||
binop: "+" | "-" | "*" | "/" | "%" |
|
||||
"=" |
|
||||
"<" | "==" | "!="
|
||||
|
||||
unop: "!" | "-" | "*"
|
||||
unop: "!" | "-" | "*"
|
||||
|
||||
type: "int" stars
|
||||
"char" stars
|
||||
type: "int" stars
|
||||
"char" stars
|
||||
|
||||
stars: "*"*
|
||||
</code></pre>
|
||||
stars: "*"*</code></pre>
|
||||
<hr />
|
||||
<p>Well, that is enough ranting for now.</p>
|
||||
<!--
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./dalbec
|
||||
./dalbec
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
Why does the output end with 121?
|
||||
|
||||
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#John_Dalbec">John Dalbec</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,11 +141,11 @@ 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">./dalbec</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">./dalbec</span></span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<p>Why does the output end with 121?</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>The output is mis-leading … why does it also print 2047?</p>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make alt
|
||||
make alt
|
||||
```
|
||||
|
||||
We recommend that you use the alt version to see what the entry looked like back
|
||||
@@ -12,7 +12,7 @@ section.
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./eldby.alt
|
||||
./eldby.alt
|
||||
```
|
||||
|
||||
To quit send intr (typically ctrl-c).
|
||||
@@ -29,8 +29,8 @@ value used in `usleep()`. The default is `35000` but you can easily change
|
||||
it. To do so try:
|
||||
|
||||
```sh
|
||||
make SLEEP=20000 clobber alt
|
||||
./eldby.alt
|
||||
make SLEEP=20000 clobber alt
|
||||
./eldby.alt
|
||||
```
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ This version is the original which has no sleep time in between updates.
|
||||
### Original build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Thor_Eldby">Thor Eldby</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,12 +141,12 @@ 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> 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>We recommend that you use the alt version to see what the entry looked like back
|
||||
in 1996. For the original version see the <a href="#original-code">original code</a>
|
||||
section.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./eldby.alt</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">./eldby.alt</span></span></code></pre></div>
|
||||
<p>To quit send intr (typically ctrl-c).</p>
|
||||
<p>NOTE: to reset the sanity of your terminal after this program ends try <code>reset</code>.</p>
|
||||
<h2 id="try">Try:</h2>
|
||||
@@ -156,12 +155,12 @@ happening with modern systems, and to not flash too quickly, which can be
|
||||
problematic for some people, can be configured to different speeds by way of the
|
||||
value used in <code>usleep()</code>. The default is <code>35000</code> but you can easily change
|
||||
it. To do so try:</p>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> SLEEP=20000 clobber alt</span>
|
||||
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./eldby.alt</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="fu">make</span> SLEEP=20000 clobber alt</span>
|
||||
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./eldby.alt</span></span></code></pre></div>
|
||||
<h2 id="original-code">Original code:</h2>
|
||||
<p>This version is the original which has no sleep time in between updates.</p>
|
||||
<h3 id="original-build">Original 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> all</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> all</span></code></pre></div>
|
||||
<h3 id="original-use">Original use:</h3>
|
||||
<p>Use <code>./eldby</code> as you would <code>./eldby.alt</code> above.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ make all
|
||||
The current status of this entry is:
|
||||
|
||||
```
|
||||
STATUS: missing or dead link - please provide them
|
||||
STATUS: missing or dead link - please provide them
|
||||
```
|
||||
|
||||
For more detailed information see [1996 gandalf bugs](../../bugs.html#1996_gandalf).
|
||||
@@ -19,14 +19,14 @@ For more detailed information see [1996 gandalf bugs](../../bugs.html#1996_ganda
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./gandalf
|
||||
./gandalf
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
As the script asks, care to guess why these execute differently? Only the
|
||||
@@ -42,7 +42,7 @@ BTW: it is perilous to 'try' the patience of
|
||||
For misleading C pre-processor output, try:
|
||||
|
||||
```sh
|
||||
cc -E gandalf.c
|
||||
cc -E gandalf.c
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Dean_Swift">Dean Swift</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,15 +141,15 @@ 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>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code>STATUS: missing or dead link - please provide them</code></pre>
|
||||
<pre><code> STATUS: missing or dead link - please provide them</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#1996_gandalf">1996 gandalf 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">./gandalf</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">./gandalf</span></span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<p>As the script asks, care to guess why these execute differently? Only the
|
||||
compiler knows … ok maybe other things like the author, the judges and perhaps
|
||||
you too?</p>
|
||||
@@ -158,7 +157,7 @@ you too?</p>
|
||||
<a href="https://www.glyphweb.com/arda/g/gandalf.html">Gandalf</a>. Go ahead, ‘try’ it! :-)</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>For misleading C pre-processor output, try:</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">-E</span> gandalf.c</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">cc</span> <span class="at">-E</span> gandalf.c</span></code></pre></div>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<p>The program requires an ASCII system.</p>
|
||||
<!--
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ make all
|
||||
The current status of this entry is:
|
||||
|
||||
```
|
||||
STATUS: uses gets() - change to fgets() if possible
|
||||
STATUS: uses gets() - change to fgets() if possible
|
||||
```
|
||||
|
||||
For more detailed information see [1996 huffman bugs](../../bugs.html#1996_huffman).
|
||||
@@ -19,14 +19,14 @@ For more detailed information see [1996 huffman bugs](../../bugs.html#1996_huffm
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
echo 'Huffman Decoding' | ./huffman
|
||||
echo 'Huffman Decoding' | ./huffman
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ And for a misleading hint, consider who won! :-)
|
||||
And if you really can't see what is going on, here is an extra spoiler:
|
||||
|
||||
```sh
|
||||
./huffman < huffman.c 2>/dev/null
|
||||
./huffman < huffman.c 2>/dev/null
|
||||
```
|
||||
|
||||
This entry was very well received at the IOCCC BOF.
|
||||
|
||||
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Ken_Huffman">Ken Huffman</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,21 +141,21 @@ 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>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code>STATUS: uses gets() - change to fgets() if possible</code></pre>
|
||||
<pre><code> STATUS: uses gets() - change to fgets() if possible</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#1996_huffman">1996 huffman 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="bu">echo</span> <span class="st">'Huffman Decoding'</span> <span class="kw">|</span> <span class="ex">./huffman</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="bu">echo</span> <span class="st">'Huffman Decoding'</span> <span class="kw">|</span> <span class="ex">./huffman</span></span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>If you are still confused and want to read a spoiler, check out
|
||||
the source and it will be clear as mud!</p>
|
||||
<p>And for a misleading hint, consider who won! :-)</p>
|
||||
<p>And if you really can’t see what is going on, here is an extra spoiler:</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">./huffman</span> <span class="op"><</span> huffman.c <span class="dv">2</span><span class="op">></span>/dev/null</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">./huffman</span> <span class="op"><</span> huffman.c <span class="dv">2</span><span class="op">></span>/dev/null</span></code></pre></div>
|
||||
<p>This entry was very well received at the IOCCC BOF.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<p>This filter program is really not obfuscated code. It compiles cleanly
|
||||
|
||||
+1
-1
@@ -180,7 +180,7 @@ Rules differ from year to year, sometimes in significant ways.</p>
|
||||
<p>Please send us comments and suggestions what we have expressed above.
|
||||
Also include anything else that you would like to see in future contests.
|
||||
Send such email to:</p>
|
||||
<pre><code>judges@toad.com</code></pre>
|
||||
<pre><code> judges@toad.com</code></pre>
|
||||
<p>If you use, distribute or publish these entries in some way, please drop
|
||||
us a line. We enjoy seeing who, where and how the contest is used.</p>
|
||||
<h2 id="final-comments">Final Comments</h2>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
NOTE: this entry requires `X11/Xlib.h` header file and the X11 library to
|
||||
@@ -15,8 +15,8 @@ entry.
|
||||
The current status of this entry is:
|
||||
|
||||
```
|
||||
STATUS: INABIAF - please **DO NOT** fix
|
||||
STATUS: missing or dead link - please provide them
|
||||
STATUS: INABIAF - please **DO NOT** fix
|
||||
STATUS: missing or dead link - please provide them
|
||||
```
|
||||
|
||||
For more detailed information see [1996 jonth bugs](../../bugs.html#1996_jonth).
|
||||
@@ -25,7 +25,7 @@ For more detailed information see [1996 jonth bugs](../../bugs.html#1996_jonth).
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./jonth :0 :0
|
||||
./jonth :0 :0
|
||||
```
|
||||
|
||||
NOTE: the two boards will be on top of each other so you will have to drag one
|
||||
@@ -36,21 +36,21 @@ NOTE: if there is no X service open this will crash. If this is the case you
|
||||
might try:
|
||||
|
||||
```sh
|
||||
./jonth
|
||||
./jonth
|
||||
```
|
||||
|
||||
These are supposed to happen. As is written in the
|
||||
[The Jargon File](http://catb.org/jargon/html/F/feature.html):
|
||||
|
||||
```
|
||||
That's not a bug, that's a feature.
|
||||
That's not a bug, that's a feature.
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./jonth host1:0 host2:0
|
||||
./jonth host1:0 host2:0
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Jon_Thingvold">Jon Thingvold</a><br>
|
||||
Location: <a href="../../location.html#NO">NO</a> - <em>Kingdom of Norway</em> (<em>Norway</em>)
|
||||
<br><br></li>
|
||||
Location: <a href="../../location.html#NO">NO</a> - <em>Kingdom of Norway</em> (<em>Norway</em>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,28 +141,28 @@ Location: <a href="../../location.html#NO">NO</a> - <em>Kingdom of Norway</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>
|
||||
<p>NOTE: this entry requires <code>X11/Xlib.h</code> header file and the X11 library to
|
||||
compile. macOS users running Mountain Lion and later will need to download and
|
||||
install <a href="https://www.xquartz.org">XQuartz</a> in order to compile and run this
|
||||
entry.</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
|
||||
STATUS: missing or dead link - please provide them</code></pre>
|
||||
<pre><code> STATUS: INABIAF - please **DO NOT** fix
|
||||
STATUS: missing or dead link - please provide them</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#1996_jonth">1996 jonth 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">./jonth</span> :0 :0</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">./jonth</span> :0 :0</span></code></pre></div>
|
||||
<p>NOTE: the two boards will be on top of each other so you will have to drag one
|
||||
off the other so that you can properly play.</p>
|
||||
<p>NOTE: if there is no X service open this will crash. If this is the case you
|
||||
might try:</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./jonth</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">./jonth</span></span></code></pre></div>
|
||||
<p>These are supposed to happen. As is written in the
|
||||
<a href="http://catb.org/jargon/html/F/feature.html">The Jargon File</a>:</p>
|
||||
<pre><code>That's not a bug, that's a feature.</code></pre>
|
||||
<pre><code> That's not a bug, that's a feature.</code></pre>
|
||||
<h2 id="try">Try:</h2>
|
||||
<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">./jonth</span> host1:0 host2:0</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">./jonth</span> host1:0 host2:0</span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>For extra credit, figure out how you can cheat by taking over a square already
|
||||
occupied by an opponent.</p>
|
||||
|
||||
+5
-5
@@ -1,14 +1,14 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./rcm < file.gz
|
||||
./rcm < file.gz
|
||||
```
|
||||
|
||||
where `file.gz` is some gzipped file.
|
||||
@@ -19,7 +19,7 @@ where `file.gz` is some gzipped file.
|
||||
For more information try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ For more information try:
|
||||
For a good no-op try:
|
||||
|
||||
```sh
|
||||
gzip -c < rcm.c | ./rcm
|
||||
gzip -c < rcm.c | ./rcm
|
||||
```
|
||||
|
||||
NOTE: this is done in the [try.sh](try.sh) script as well, along with some other
|
||||
@@ -71,7 +71,7 @@ from the GNU gzip source tree is 31,613 characters in length and uncompresses
|
||||
the emacs distribution file in slightly under 25 seconds. Thus:
|
||||
|
||||
```
|
||||
3100 / 130 = 23.85 -vs- 31613 / 25 = 1264.52
|
||||
3100 / 130 = 23.85 -vs- 31613 / 25 = 1264.52
|
||||
```
|
||||
|
||||
which represents a better than 530% improvement in the ratio of
|
||||
|
||||
+6
-7
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Ron_McFarland">Ron McFarland</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,16 +141,16 @@ 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">./rcm</span> <span class="op"><</span> file.gz</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">./rcm</span> <span class="op"><</span> file.gz</span></code></pre></div>
|
||||
<p>where <code>file.gz</code> is some gzipped file.</p>
|
||||
<h2 id="try">Try:</h2>
|
||||
<p>For more information try:</p>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>For a good no-op try:</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">gzip</span> <span class="at">-c</span> <span class="op"><</span> rcm.c <span class="kw">|</span> <span class="ex">./rcm</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="fu">gzip</span> <span class="at">-c</span> <span class="op"><</span> rcm.c <span class="kw">|</span> <span class="ex">./rcm</span></span></code></pre></div>
|
||||
<p>NOTE: this is done in the <a href="try.sh">try.sh</a> script as well, along with some other
|
||||
commands including a way to do the above command but with more steps.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
@@ -176,7 +175,7 @@ file
|
||||
about 130 seconds on my HP 9000/735. The now obsolete source file `inflate.c’
|
||||
from the GNU gzip source tree is 31,613 characters in length and uncompresses
|
||||
the emacs distribution file in slightly under 25 seconds. Thus:</p>
|
||||
<pre><code>3100 / 130 = 23.85 -vs- 31613 / 25 = 1264.52</code></pre>
|
||||
<pre><code> 3100 / 130 = 23.85 -vs- 31613 / 25 = 1264.52</code></pre>
|
||||
<p>which represents a better than 530% improvement in the ratio of
|
||||
source file size to execution time.”</p>
|
||||
<h4 id="the-whining-programmers-argument">The Whining Programmer’s Argument:</h4>
|
||||
|
||||
+25
-26
@@ -1,14 +1,14 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./schweikh1
|
||||
./schweikh1
|
||||
```
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ To find the day that Easter falls on in the current year and to show all Easter
|
||||
dates from 1582 to 2199:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -48,43 +48,42 @@ Calendar](https://en.wikipedia.org/wiki/Gregorian_calendar), that is, from ad 15
|
||||
to ad 2199:
|
||||
|
||||
```
|
||||
Let J be the year.
|
||||
If J is from 1582 to 1699, let M be 22, let N be 2
|
||||
If J is from 1700 to 1799, let M be 23, let N be 3
|
||||
If J is from 1800 to 1899, let M be 23, let N be 4
|
||||
If J is from 1900 to 2099, let M be 24, let N be 5
|
||||
If J is from 2100 to 2199, let M be 24, let N be 6
|
||||
Let a be the modulus of J divided by 19
|
||||
Let b be the modulus of J divided by 4
|
||||
Let c be the modulus of J divided by 7
|
||||
Let d be the modulus of (19a + M) divided by 30
|
||||
Let e be the modulus of (2b + 4c + 6d + N) divided by 7
|
||||
|
||||
Let J be the year.
|
||||
If J is from 1582 to 1699, let M be 22, let N be 2
|
||||
If J is from 1700 to 1799, let M be 23, let N be 3
|
||||
If J is from 1800 to 1899, let M be 23, let N be 4
|
||||
If J is from 1900 to 2099, let M be 24, let N be 5
|
||||
If J is from 2100 to 2199, let M be 24, let N be 6
|
||||
Let a be the modulus of J divided by 19
|
||||
Let b be the modulus of J divided by 4
|
||||
Let c be the modulus of J divided by 7
|
||||
Let d be the modulus of (19a + M) divided by 30
|
||||
Let e be the modulus of (2b + 4c + 6d + N) divided by 7
|
||||
```
|
||||
|
||||
The interesting Sunday is either:
|
||||
|
||||
```
|
||||
March 22 + d + e or
|
||||
April d + e - 9 (only one of them is a valid date)
|
||||
March 22 + d + e or
|
||||
April d + e - 9 (only one of them is a valid date)
|
||||
```
|
||||
|
||||
with the following exceptions:
|
||||
|
||||
```
|
||||
April 26 must always be changed to April 19
|
||||
April 25 must be changed to April 18 if d is 28 and a is greater than 10
|
||||
April 26 must always be changed to April 19
|
||||
April 25 must be changed to April 18 if d is 28 and a is greater than 10
|
||||
```
|
||||
|
||||
### Example:
|
||||
|
||||
```
|
||||
J = 1962, M = 24, N = 5
|
||||
a = J % 19 == 5
|
||||
b = J % 4 == 2
|
||||
c = J % 7 == 2
|
||||
d = 119 % 30 == 29
|
||||
e = 191 % 7 == 2
|
||||
J = 1962, M = 24, N = 5
|
||||
a = J % 19 == 5
|
||||
b = J % 4 == 2
|
||||
c = J % 7 == 2
|
||||
d = 119 % 30 == 29
|
||||
e = 191 % 7 == 2
|
||||
```
|
||||
|
||||
March 53 is invalid, so the result is April 22 1962.
|
||||
@@ -120,7 +119,7 @@ Try to be as precise as can be and no one will comprehend what you mean.
|
||||
|
||||
|
||||
```
|
||||
comprehension = 1/(2**precision)
|
||||
comprehension = 1/(2**precision)
|
||||
```
|
||||
|
||||
|
||||
|
||||
+26
-28
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Jens_Schweikhardt">Jens Schweikhardt</a><br>
|
||||
Location: <a href="../../location.html#DE">DE</a> - <em>Federal Republic of Germany</em> (<em>Germany</em>)
|
||||
<br><br></li>
|
||||
Location: <a href="../../location.html#DE">DE</a> - <em>Federal Republic of Germany</em> (<em>Germany</em>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,13 +141,13 @@ Location: <a href="../../location.html#DE">DE</a> - <em>Federal Republic of Germ
|
||||
<!-- 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">./schweikh1</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">./schweikh1</span></span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<p>To find the day that Easter falls on in the current year and to show all Easter
|
||||
dates from 1582 to 2199:</p>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>Look at the source. There is something very odd going on here.
|
||||
Where does the real code come from if everything is a C pre-processor
|
||||
@@ -167,31 +166,30 @@ ueber das Weltall” ‘Handbook About Space’, Meyer, 5th Edition, 1973, p149]
|
||||
for anni domini within the <a href="https://en.wikipedia.org/wiki/Gregorian_calendar">Gregorian
|
||||
Calendar</a>, that is, from ad 1582
|
||||
to ad 2199:</p>
|
||||
<pre><code>Let J be the year.
|
||||
If J is from 1582 to 1699, let M be 22, let N be 2
|
||||
If J is from 1700 to 1799, let M be 23, let N be 3
|
||||
If J is from 1800 to 1899, let M be 23, let N be 4
|
||||
If J is from 1900 to 2099, let M be 24, let N be 5
|
||||
If J is from 2100 to 2199, let M be 24, let N be 6
|
||||
Let a be the modulus of J divided by 19
|
||||
Let b be the modulus of J divided by 4
|
||||
Let c be the modulus of J divided by 7
|
||||
Let d be the modulus of (19a + M) divided by 30
|
||||
Let e be the modulus of (2b + 4c + 6d + N) divided by 7
|
||||
</code></pre>
|
||||
<pre><code> Let J be the year.
|
||||
If J is from 1582 to 1699, let M be 22, let N be 2
|
||||
If J is from 1700 to 1799, let M be 23, let N be 3
|
||||
If J is from 1800 to 1899, let M be 23, let N be 4
|
||||
If J is from 1900 to 2099, let M be 24, let N be 5
|
||||
If J is from 2100 to 2199, let M be 24, let N be 6
|
||||
Let a be the modulus of J divided by 19
|
||||
Let b be the modulus of J divided by 4
|
||||
Let c be the modulus of J divided by 7
|
||||
Let d be the modulus of (19a + M) divided by 30
|
||||
Let e be the modulus of (2b + 4c + 6d + N) divided by 7</code></pre>
|
||||
<p>The interesting Sunday is either:</p>
|
||||
<pre><code>March 22 + d + e or
|
||||
April d + e - 9 (only one of them is a valid date)</code></pre>
|
||||
<pre><code> March 22 + d + e or
|
||||
April d + e - 9 (only one of them is a valid date)</code></pre>
|
||||
<p>with the following exceptions:</p>
|
||||
<pre><code>April 26 must always be changed to April 19
|
||||
April 25 must be changed to April 18 if d is 28 and a is greater than 10</code></pre>
|
||||
<pre><code> April 26 must always be changed to April 19
|
||||
April 25 must be changed to April 18 if d is 28 and a is greater than 10</code></pre>
|
||||
<h3 id="example">Example:</h3>
|
||||
<pre><code>J = 1962, M = 24, N = 5
|
||||
a = J % 19 == 5
|
||||
b = J % 4 == 2
|
||||
c = J % 7 == 2
|
||||
d = 119 % 30 == 29
|
||||
e = 191 % 7 == 2</code></pre>
|
||||
<pre><code> J = 1962, M = 24, N = 5
|
||||
a = J % 19 == 5
|
||||
b = J % 4 == 2
|
||||
c = J % 7 == 2
|
||||
d = 119 % 30 == 29
|
||||
e = 191 % 7 == 2</code></pre>
|
||||
<p>March 53 is invalid, so the result is April 22 1962.</p>
|
||||
<h3 id="why-i-think-this-is-obfuscated">Why I think this is obfuscated</h3>
|
||||
<p>Apart from the calculation of the Easter date, the definition <em>and</em>
|
||||
@@ -214,7 +212,7 @@ these easy to remember language elements is justified in my opinion.</p>
|
||||
<h3 id="the-moral">The moral:</h3>
|
||||
<p>Try to be as precise as can be and no one will comprehend what you mean.</p>
|
||||
<h4 id="the-formula">The formula:</h4>
|
||||
<pre><code>comprehension = 1/(2**precision)</code></pre>
|
||||
<pre><code> comprehension = 1/(2**precision)</code></pre>
|
||||
<h4 id="the-interpretation">The interpretation:</h4>
|
||||
<p>“Say nothing and everybody will understand.”</p>
|
||||
<p>The <code>-I/usr/include</code> in the build file is needed by gcc on Solaris because
|
||||
|
||||
+14
-14
@@ -1,14 +1,14 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./schweikh2
|
||||
./schweikh2
|
||||
```
|
||||
|
||||
The program accepts up to 4 parameters:
|
||||
@@ -25,19 +25,19 @@ The program accepts up to 4 parameters:
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
What happens if you pass only three parameters like the below?
|
||||
|
||||
```sh
|
||||
./schweikh2 15 1 0
|
||||
./schweikh2 15 1 0
|
||||
```
|
||||
|
||||
The author also suggests:
|
||||
|
||||
```sh
|
||||
while :; do grep -v '#' schweikh2.c; done
|
||||
while :; do grep -v '#' schweikh2.c; done
|
||||
```
|
||||
|
||||
(and we do too) which works with `sh`, `bash`, `ksh` and `zsh` as well. Press
|
||||
@@ -52,9 +52,9 @@ in [hunni.c](hunni.c). The perl script, [hunni.pl](hunni.pl), obfuscates it
|
||||
appropriately. Try:
|
||||
|
||||
```sh
|
||||
less hunni.c
|
||||
less hunni.c
|
||||
|
||||
perl ./hunni.pl < hunni.c
|
||||
perl ./hunni.pl < hunni.c
|
||||
```
|
||||
|
||||
This entry was another crowd pleaser at the IOCCC BOF.
|
||||
@@ -138,12 +138,12 @@ minutes (`gcc -O3`).
|
||||
### Sample arguments:
|
||||
|
||||
```sh
|
||||
./schweikh2 6
|
||||
./schweikh2 7 0
|
||||
./schweikh2 7 7 0
|
||||
./schweikh2 8 9 -1 -67/21
|
||||
./schweikh2 8 2 2/5 -98/25
|
||||
./schweikh2 2 1/0 1 1/0
|
||||
./schweikh2 6
|
||||
./schweikh2 7 0
|
||||
./schweikh2 7 7 0
|
||||
./schweikh2 8 9 -1 -67/21
|
||||
./schweikh2 8 2 2/5 -98/25
|
||||
./schweikh2 2 1/0 1 1/0
|
||||
```
|
||||
|
||||
### Miscellaneous
|
||||
@@ -152,7 +152,7 @@ The diamond pattern can be continued without a break.
|
||||
For a nice printout try this on your Bourne compatible shell:
|
||||
|
||||
```sh
|
||||
while :; do grep -v '#' schweikh2.c; done
|
||||
while :; do grep -v '#' schweikh2.c; done
|
||||
```
|
||||
|
||||
|
||||
|
||||
+15
-16
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Jens_Schweikhardt">Jens Schweikhardt</a><br>
|
||||
Location: <a href="../../location.html#DE">DE</a> - <em>Federal Republic of Germany</em> (<em>Germany</em>)
|
||||
<br><br></li>
|
||||
Location: <a href="../../location.html#DE">DE</a> - <em>Federal Republic of Germany</em> (<em>Germany</em>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,9 +141,9 @@ Location: <a href="../../location.html#DE">DE</a> - <em>Federal Republic of Germ
|
||||
<!-- 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">./schweikh2</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">./schweikh2</span></span></code></pre></div>
|
||||
<p>The program accepts up to 4 parameters:</p>
|
||||
<ol start="0" type="1">
|
||||
<li><p>The number of operators in the expression [default: 9]</p></li>
|
||||
@@ -153,11 +152,11 @@ Location: <a href="../../location.html#DE">DE</a> - <em>Federal Republic of Germ
|
||||
<li><p>The goal value or 0/0 [default: 42]</p></li>
|
||||
</ol>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<p>What happens if you pass only three parameters like the below?</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">./schweikh2</span> 15 1 0</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">./schweikh2</span> 15 1 0</span></code></pre></div>
|
||||
<p>The author also suggests:</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="cf">while</span> <span class="bu">:</span><span class="kw">;</span> <span class="cf">do</span> <span class="fu">grep</span> <span class="at">-v</span> <span class="st">'#'</span> schweikh2.c<span class="kw">;</span> <span class="cf">done</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="cf">while</span> <span class="bu">:</span><span class="kw">;</span> <span class="cf">do</span> <span class="fu">grep</span> <span class="at">-v</span> <span class="st">'#'</span> schweikh2.c<span class="kw">;</span> <span class="cf">done</span></span></code></pre></div>
|
||||
<p>(and we do too) which works with <code>sh</code>, <code>bash</code>, <code>ksh</code> and <code>zsh</code> as well. Press
|
||||
ctrl-c to stop it. Observe how the <a href="try.sh">try.sh</a> script does this once to
|
||||
make it easier to see what is happening.</p>
|
||||
@@ -165,9 +164,9 @@ make it easier to see what is happening.</p>
|
||||
<p>The original program, with only slight obfuscations, may be found
|
||||
in <a href="hunni.c">hunni.c</a>. The perl script, <a href="hunni.pl">hunni.pl</a>, obfuscates it
|
||||
appropriately. Try:</p>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">less</span> hunni.c</span>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">less</span> hunni.c</span>
|
||||
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="fu">perl</span> ./hunni.pl <span class="op"><</span> hunni.c</span></code></pre></div>
|
||||
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">perl</span> ./hunni.pl <span class="op"><</span> hunni.c</span></code></pre></div>
|
||||
<p>This entry was another crowd pleaser at the IOCCC BOF.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<p>Note: the source must be viewed with tabstop 8. To appreciate the
|
||||
@@ -231,16 +230,16 @@ operators but you will probably wait quite some time for every of the
|
||||
on a 50 MHz SPARC, <code>4^11</code> expressions are evaluated in about 3 cpu
|
||||
minutes (<code>gcc -O3</code>).</p>
|
||||
<h3 id="sample-arguments">Sample arguments:</h3>
|
||||
<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">./schweikh2</span> 6</span>
|
||||
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./schweikh2</span> 7 0</span>
|
||||
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./schweikh2</span> 7 7 0</span>
|
||||
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a><span class="ex">./schweikh2</span> 8 9 <span class="at">-1</span> <span class="at">-67</span>/21</span>
|
||||
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a><span class="ex">./schweikh2</span> 8 2 2/5 <span class="at">-98</span>/25</span>
|
||||
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a><span class="ex">./schweikh2</span> 2 1/0 1 1/0</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">./schweikh2</span> 6</span>
|
||||
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./schweikh2</span> 7 0</span>
|
||||
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./schweikh2</span> 7 7 0</span>
|
||||
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">./schweikh2</span> 8 9 <span class="at">-1</span> <span class="at">-67</span>/21</span>
|
||||
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">./schweikh2</span> 8 2 2/5 <span class="at">-98</span>/25</span>
|
||||
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a> <span class="ex">./schweikh2</span> 2 1/0 1 1/0</span></code></pre></div>
|
||||
<h3 id="miscellaneous">Miscellaneous</h3>
|
||||
<p>The diamond pattern can be continued without a break.
|
||||
For a nice printout try this on your Bourne compatible shell:</p>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="cf">while</span> <span class="bu">:</span><span class="kw">;</span> <span class="cf">do</span> <span class="fu">grep</span> <span class="at">-v</span> <span class="st">'#'</span> schweikh2.c<span class="kw">;</span> <span class="cf">done</span></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="cf">while</span> <span class="bu">:</span><span class="kw">;</span> <span class="cf">do</span> <span class="fu">grep</span> <span class="at">-v</span> <span class="st">'#'</span> schweikh2.c<span class="kw">;</span> <span class="cf">done</span></span></code></pre></div>
|
||||
<!--
|
||||
|
||||
Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.
|
||||
|
||||
+17
-17
@@ -1,7 +1,7 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ or force you to reboot using the Big Red Button! This is **NOT** a joke.
|
||||
You have been warned.
|
||||
|
||||
```sh
|
||||
./schweikh3
|
||||
./schweikh3
|
||||
```
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ systems.
|
||||
But still it is a useful utility. To use try:
|
||||
|
||||
```sh
|
||||
./schweikh3
|
||||
./schweikh3
|
||||
```
|
||||
|
||||
and thanks for the virtual memories! :-)
|
||||
@@ -58,26 +58,26 @@ compiler. The source fails to compile under a C++ compiler due to
|
||||
the `new' identifier which is a C++ reserved word:
|
||||
|
||||
```sh
|
||||
$ g++ schweikh3.c
|
||||
schweikh3.c:9: parse error before `new'
|
||||
schweikh3.c:16: parse error before `new'
|
||||
schweikh3.c:46: parse error before `void'
|
||||
schweikh3.c:65: parse error before `Lisp'
|
||||
schweikh3.c:68: parse error before `;'
|
||||
[...]
|
||||
schweikh3.c:91: confused by earlier errors, bailing out
|
||||
$ g++ schweikh3.c
|
||||
schweikh3.c:9: parse error before `new'
|
||||
schweikh3.c:16: parse error before `new'
|
||||
schweikh3.c:46: parse error before `void'
|
||||
schweikh3.c:65: parse error before `Lisp'
|
||||
schweikh3.c:68: parse error before `;'
|
||||
[...]
|
||||
schweikh3.c:91: confused by earlier errors, bailing out
|
||||
```
|
||||
|
||||
The source fails to compile on compilers that recognize the inline
|
||||
keyword by default, e.g. gcc:
|
||||
|
||||
```sh
|
||||
$ gcc schweikh3.c
|
||||
schweikh3.c:46: parse error before `void'
|
||||
schweikh3.c: In function `main':
|
||||
schweikh3.c:91: parse error before `inline'
|
||||
schweikh3.c: At top level:
|
||||
schweikh3.c:97: parse error before `void'
|
||||
$ gcc schweikh3.c
|
||||
schweikh3.c:46: parse error before `void'
|
||||
schweikh3.c: In function `main':
|
||||
schweikh3.c:91: parse error before `inline'
|
||||
schweikh3.c: At top level:
|
||||
schweikh3.c:97: parse error before `void'
|
||||
```
|
||||
|
||||
The `-ansi` option to gcc fixes this.
|
||||
|
||||
+18
-19
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Jens_Schweikhardt">Jens Schweikhardt</a><br>
|
||||
Location: <a href="../../location.html#DE">DE</a> - <em>Federal Republic of Germany</em> (<em>Germany</em>)
|
||||
<br><br></li>
|
||||
Location: <a href="../../location.html#DE">DE</a> - <em>Federal Republic of Germany</em> (<em>Germany</em>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,20 +141,20 @@ Location: <a href="../../location.html#DE">DE</a> - <em>Federal Republic of Germ
|
||||
<!-- 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>
|
||||
<p><strong>WARNING: DO NOT RUN this program without reading this text down to the end!</strong>
|
||||
It may render your system unusable for a limited amount of time
|
||||
or force you to reboot using the Big Red Button! This is <strong>NOT</strong> a joke.
|
||||
You have been warned.</p>
|
||||
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./schweikh3</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">./schweikh3</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>The source fails to compile on compilers that recognize the inline
|
||||
keyword by default. For gcc, you may need to use <code>-ansi</code>.</p>
|
||||
<p>See the file <a href="schweikh3.info">schweikh3.info</a> for example output from various
|
||||
systems.</p>
|
||||
<p>But still it is a useful utility. To use try:</p>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./schweikh3</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">./schweikh3</span></span></code></pre></div>
|
||||
<p>and thanks for the virtual memories! :-)</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="why-i-think-my-entry-is-obfuscated">Why I think my entry is obfuscated</h3>
|
||||
@@ -172,22 +171,22 @@ COBOL, F77, awk etc.</p>
|
||||
<p>You have to select maximum ANSI C conformance of your
|
||||
compiler. The source fails to compile under a C++ compiler due to
|
||||
the `new’ identifier which is a C++ reserved word:</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">$</span> g++ schweikh3.c</span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">schweikh3.c:9:</span> parse error before <span class="kw">`</span><span class="ex">new</span><span class="st">'</span></span>
|
||||
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="st">schweikh3.c:16: parse error before `new'</span></span>
|
||||
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="ex">schweikh3.c:46:</span> parse error before <span class="kw">`</span>void<span class="st">'</span></span>
|
||||
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a><span class="st">schweikh3.c:65: parse error before `Lisp'</span></span>
|
||||
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a><span class="ex">schweikh3.c:68:</span> parse error before <span class="kw">`;</span><span class="st">'</span></span>
|
||||
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a><span class="st">[...]</span></span>
|
||||
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a><span class="st">schweikh3.c:91: confused by earlier errors, bailing out</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">$</span> g++ schweikh3.c</span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">schweikh3.c:9:</span> parse error before <span class="kw">`</span><span class="ex">new</span><span class="st">'</span></span>
|
||||
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="st"> schweikh3.c:16: parse error before `new'</span></span>
|
||||
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">schweikh3.c:46:</span> parse error before <span class="kw">`</span>void<span class="st">'</span></span>
|
||||
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a><span class="st"> schweikh3.c:65: parse error before `Lisp'</span></span>
|
||||
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a> <span class="ex">schweikh3.c:68:</span> parse error before <span class="kw">`;</span><span class="st">'</span></span>
|
||||
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a><span class="st"> [...]</span></span>
|
||||
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a><span class="st"> schweikh3.c:91: confused by earlier errors, bailing out</span></span></code></pre></div>
|
||||
<p>The source fails to compile on compilers that recognize the inline
|
||||
keyword by default, e.g. gcc:</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">$</span> gcc schweikh3.c</span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="ex">schweikh3.c:46:</span> parse error before <span class="kw">`</span><span class="ex">void</span><span class="st">'</span></span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="st">schweikh3.c: In function `main'</span><span class="ex">:</span></span>
|
||||
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a><span class="ex">schweikh3.c:91:</span> parse error before <span class="kw">`</span>inline<span class="st">'</span></span>
|
||||
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a><span class="st">schweikh3.c: At top level:</span></span>
|
||||
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a><span class="st">schweikh3.c:97: parse error before `void'</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">$</span> gcc schweikh3.c</span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">schweikh3.c:46:</span> parse error before <span class="kw">`</span><span class="ex">void</span><span class="st">'</span></span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="st"> schweikh3.c: In function `main'</span><span class="ex">:</span></span>
|
||||
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">schweikh3.c:91:</span> parse error before <span class="kw">`</span>inline<span class="st">'</span></span>
|
||||
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a><span class="st"> schweikh3.c: At top level:</span></span>
|
||||
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a><span class="st"> schweikh3.c:97: parse error before `void'</span></span></code></pre></div>
|
||||
<p>The <code>-ansi</code> option to gcc fixes this.</p>
|
||||
<p>The source fails to compile on obsolete systems with obsolete
|
||||
memory models due to the identifier <code>far</code> (to be honest: this is
|
||||
|
||||
+12
-12
@@ -1,27 +1,27 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
```
|
||||
make all
|
||||
```
|
||||
|
||||
There is another version which is the original entry. See [alternate
|
||||
version](#alternate-code) for details as to how to use and why it was made the
|
||||
alt version.
|
||||
There is another version which is the original entry. See [alternate
|
||||
version](#alternate-code) for details as to how to use and why it was made the
|
||||
alt version.
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./clock1.sh
|
||||
./clock2.sh
|
||||
./clock3.sh
|
||||
./clock1.sh
|
||||
./clock2.sh
|
||||
./clock3.sh
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -35,14 +35,14 @@ provided, to show the differences.
|
||||
### Alternate build:
|
||||
|
||||
```sh
|
||||
make alt
|
||||
make alt
|
||||
```
|
||||
|
||||
|
||||
### Alternate try:
|
||||
|
||||
```sh
|
||||
./try.alt.sh
|
||||
./try.alt.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ larger.
|
||||
The code is simple; the arguments passed are:
|
||||
|
||||
```sh
|
||||
./westley minute_map hour_map hand_symbol clock_image
|
||||
./westley minute_map hour_map hand_symbol clock_image
|
||||
```
|
||||
|
||||
The program merely takes the minute (0-59) and the hour (0-23)
|
||||
|
||||
+9
-10
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Brian_Westley">Brian Westley</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>There is another version which is the original entry. See <a href="#alternate-code">alternate
|
||||
version</a> for details as to how to use and why it was made the
|
||||
alt version.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./clock1.sh</span></span>
|
||||
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./clock2.sh</span></span>
|
||||
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./clock3.sh</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">./clock1.sh</span></span>
|
||||
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./clock2.sh</span></span>
|
||||
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./clock3.sh</span></span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
<p>The original version had a display problem in modern systems which somewhat
|
||||
affected the usability of the program. This alternate code, the original, is
|
||||
provided, to show the differences.</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-try">Alternate try:</h3>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.alt.sh</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.alt.sh</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>Time and time again, Brian Westley seems to come up with a winning entry!
|
||||
We are amazed at how much is being done with only one relatively
|
||||
@@ -184,7 +183,7 @@ my sample scripts.</p></li>
|
||||
<p>These assumptions are pretty reasonable. 2) can be eliminated but makes the code
|
||||
larger.</p>
|
||||
<p>The code is simple; the arguments passed are:</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">./westley</span> minute_map hour_map hand_symbol clock_image</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">./westley</span> minute_map hour_map hand_symbol clock_image</span></code></pre></div>
|
||||
<p>The program merely takes the minute (0-59) and the hour (0-23)
|
||||
values, looks up the offsets in <code>minute_map</code> and <code>hour_map</code>
|
||||
and writes the <code>hand_symbol</code> for each into the <code>clock_image</code>
|
||||
|
||||
Reference in new issue
Block a user