add hack-a-round for language specified markdown code blocks
When language is specified in a markdown code block such as:
````
```c
printf("Hello, world!\n");
```
````
is used, the resulting HTML as produced by `pandoc(1)` combined
with our revised `ioccc.css` is not intent the code block well.
A temporary "_hack-a-round_" is to turn the "markdown code language
specifier" into an HTML comment. For example:
````
```<!---c-->
printf("Hello, world!\n");
```
````
This commits turns off existing markdown code language specifiers
for now, while preserving our ability to restore them in the future
when a better "_hack-a-round_" to the "markdown code language
specifier" problem is found.
The HTML impact if this "_hack-a-round_" is to produce HTML that
looks like this:
```
<pre class="<!---c-->"><code> .. </code></pre>
```
We might be able to create a complex set of classes for each markdown
code language (there won't be very many) in `ioccc.css`, or we might
find a more general CSS (or maybe `pandoc(1)`?) solution.
For now, this hack-a-round will have to do.
This commit is contained in:
1 parent
3919df50fb
commit
b66c79254a
700 files changed
+7052
-7056
No files matched your search
+3
-3
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
@@ -18,14 +18,14 @@ For more detailed information see [1993 ant bugs](../../bugs.html#1993_ant).
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./ant 'ERE' [file ...]
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
+3
-3
@@ -141,15 +141,15 @@ Location: <a href="../../location.html#CA">CA</a> - <em>Canada</em></li>
|
||||
<!-- 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>
|
||||
<pre class="<!---sh-->"><code> make all</code></pre>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code> STATUS: missing file - please provide it</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#1993_ant">1993 ant 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">./ant</span> <span class="st">'ERE'</span> [file ...]</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./ant 'ERE' [file ...]</code></pre>
|
||||
<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>
|
||||
<pre class="<!---sh-->"><code> ./try.sh</code></pre>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>See the author’s POSIX P1003.2-like documentation file <a href="ant.txt">ant.txt</a> for
|
||||
more information.</p>
|
||||
|
||||
@@ -4,7 +4,7 @@ We recommend you try the alt version first so you can get a better idea of what
|
||||
this entry was like back in 1993. See the [original code](#original-code)
|
||||
section below to run the original.
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
@@ -16,7 +16,7 @@ requires X11?](../../faq.html#X11macos).
|
||||
|
||||
To configure how many microseconds to sleep before updates try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make clobber SLEEP=200 alt
|
||||
```
|
||||
|
||||
@@ -34,7 +34,7 @@ For more detailed information see [1993 cmills bugs](../../bugs.html#1993_cmills
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
DISPLAY="your_X_server_display"
|
||||
export DISPLAY
|
||||
./cmills.alt [speed] # must be run on an X11 server
|
||||
@@ -56,7 +56,7 @@ on but you can use the original without any delays if you wish.
|
||||
|
||||
### Original build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
@@ -144,21 +144,21 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
|
||||
<p>We recommend you try the alt version first so you can get a better idea of what
|
||||
this entry was like back in 1993. See the <a href="#original-code">original code</a>
|
||||
section below to run the original.</p>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> alt</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make alt</code></pre>
|
||||
<p>NOTE: this entry requires the <code>X11/Xlib.h</code> header file and the X11 library to
|
||||
compile. If you’re under macOS and do not know how to install and use X11
|
||||
programs see <a href="../../faq.html#X11macos">FAQ 3.7 - How do I compile and use on macOS, an IOCCC entry that
|
||||
requires X11?</a>.</p>
|
||||
<p>To configure how many microseconds to sleep before updates try:</p>
|
||||
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> clobber SLEEP=200 alt</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make clobber SLEEP=200 alt</code></pre>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code> STATUS: known bug - please help us fix</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#1993_cmills">1993 cmills bugs</a>.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="va">DISPLAY</span><span class="op">=</span><span class="st">"your_X_server_display"</span></span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="bu">export</span> <span class="va">DISPLAY</span></span>
|
||||
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./cmills.alt</span> <span class="pp">[</span><span class="ss">speed</span><span class="pp">]</span> <span class="co"># must be run on an X11 server</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> DISPLAY="your_X_server_display"
|
||||
export DISPLAY
|
||||
./cmills.alt [speed] # must be run on an X11 server</code></pre>
|
||||
<p>where:</p>
|
||||
<p><code>speed</code> is update speed from 1 to 9 (default is 9).</p>
|
||||
<p>NOTE: in most cases <code>DISPLAY</code> should already be set.</p>
|
||||
@@ -166,7 +166,7 @@ requires X11?</a>.</p>
|
||||
<p>We recommend the version that uses <code>usleep(3)</code> to more easily see what is going
|
||||
on but you can use the original without any delays if you wish.</p>
|
||||
<h3 id="original-build">Original build:</h3>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> all</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make all</code></pre>
|
||||
<h3 id="original-use">Original use:</h3>
|
||||
<p>Use <code>cmills</code> as you would <code>cmills.alt</code> above.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./dgibson.sh [datafile]
|
||||
```
|
||||
|
||||
@@ -18,7 +18,7 @@ where:
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -141,13 +141,13 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
|
||||
<!-- 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>
|
||||
<pre class="<!---sh-->"><code> make all</code></pre>
|
||||
<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">./dgibson.sh</span> <span class="pp">[</span><span class="ss">datafile</span><span class="pp">]</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./dgibson.sh [datafile]</code></pre>
|
||||
<p>where:</p>
|
||||
<p><code>datafile</code> is the initial pattern (default: <a href="dgibson.data1">dgibson.data1</a>)</p>
|
||||
<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>
|
||||
<pre class="<!---sh-->"><code> ./try.sh</code></pre>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>We have provided the shell script <a href="dgibson.sh">dgibson.sh</a> to make it easier
|
||||
to run this entry. Run this shell script several times to
|
||||
|
||||
+6
-6
@@ -1,26 +1,26 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./ejb level
|
||||
```
|
||||
|
||||
where:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
level a value from -128 to 127
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -45,7 +45,7 @@ We note that this also works under macOS just fine.
|
||||
|
||||
#### Output solution to Towers of Hanoi for five rings:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./ejb 5
|
||||
```
|
||||
|
||||
@@ -54,7 +54,7 @@ text description of how to solve the puzzle.
|
||||
|
||||
#### Output solution to the Patience puzzle for six rings:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./ejb -6
|
||||
```
|
||||
|
||||
|
||||
+6
-6
@@ -141,13 +141,13 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
|
||||
<!-- 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>
|
||||
<pre class="<!---sh-->"><code> make all</code></pre>
|
||||
<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">./ejb</span> level</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./ejb level</code></pre>
|
||||
<p>where:</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">level</span> a value from <span class="at">-128</span> to 127</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> level a value from -128 to 127</code></pre>
|
||||
<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>
|
||||
<pre class="<!---sh-->"><code> ./try.sh</code></pre>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>A negative argument plays the patience puzzle. An argument
|
||||
greater than 0 plays the Tower of Hanoi puzzle. In either case
|
||||
@@ -160,11 +160,11 @@ the argument 127 to this program and want to see it finish!</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="what-this-program-does">What this program does</h3>
|
||||
<h4 id="output-solution-to-towers-of-hanoi-for-five-rings">Output solution to Towers of Hanoi for five rings:</h4>
|
||||
<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">./ejb</span> 5</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./ejb 5</code></pre>
|
||||
<p>The format of the output for the Towers of Hanoi case is simply a
|
||||
text description of how to solve the puzzle.</p>
|
||||
<h4 id="output-solution-to-the-patience-puzzle-for-six-rings">Output solution to the Patience puzzle for six rings:</h4>
|
||||
<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">./ejb</span> <span class="at">-6</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./ejb -6</code></pre>
|
||||
<p>For the patience puzzle, the output is a sequence binary codes representing
|
||||
successive states of the puzzle. The rightmost digit represents the first ring.
|
||||
A <code>1</code> means the ring is on the <code>U</code>; a <code>0</code> means it is off the <code>U</code>. The program
|
||||
|
||||
@@ -5,14 +5,14 @@ compile. macOS users running Mountain Lion and later will need to download and
|
||||
install [XQuartz](https://www.xquartz.org) in order to compile and run this
|
||||
entry.
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./jonth # must be run on an X11 server
|
||||
```
|
||||
|
||||
|
||||
@@ -145,9 +145,9 @@ Location: <a href="../../location.html#NO">NO</a> - <em>Kingdom of Norway</em> (
|
||||
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>
|
||||
<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>
|
||||
<pre class="<!---sh-->"><code> make all</code></pre>
|
||||
<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">./jonth</span> <span class="co"># must be run on an X11 server</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./jonth # must be run on an X11 server</code></pre>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>Use <code>h</code> and <code>l</code> to shift objects left or right. Use <code>k</code> to
|
||||
rotate and press SPACE to drop.</p>
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
|
||||
To have the computer guess:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./leo [colors]
|
||||
```
|
||||
|
||||
To guess the computer's number:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./mind [colors]
|
||||
```
|
||||
|
||||
|
||||
+3
-3
@@ -141,12 +141,12 @@ 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>
|
||||
<pre class="<!---sh-->"><code> make all</code></pre>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<p>To have the computer guess:</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">./leo</span> <span class="pp">[</span><span class="ss">colors</span><span class="pp">]</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./leo [colors]</code></pre>
|
||||
<p>To guess the computer’s number:</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">./mind</span> <span class="pp">[</span><span class="ss">colors</span><span class="pp">]</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./mind [colors]</code></pre>
|
||||
<p>where:</p>
|
||||
<p>[colors] is the number of possible colors (1 to 15) (default: 6)</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
If you have gcc < 2.3.3 you can build this entry like:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
@@ -48,7 +48,7 @@ For more detailed information see [1993 lmfjyh bugs](../../bugs.html#1993_lmfjyh
|
||||
|
||||
If you have gcc < 2.3.3 (i.e. the entry can compile):
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./lmfjyh
|
||||
```
|
||||
|
||||
@@ -64,7 +64,7 @@ Nonetheless it will be compiled in case the original entry fails to compile.
|
||||
|
||||
Should you wish to build this version manually:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
@@ -99,7 +99,7 @@ that should be familiar to all C-programmers.
|
||||
#### Listing 1: A simple "Hello World" program
|
||||
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
main()
|
||||
{
|
||||
puts("Hello World!");
|
||||
@@ -118,14 +118,14 @@ the file.
|
||||
|
||||
#### Listing 2: Compressed "Hello world"
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
char*_=__FILE__;
|
||||
```
|
||||
|
||||
|
||||
#### Listing 3: Code embedded in the file name
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
";main(){puts("Hello World!");}char*C=".c
|
||||
```
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ Location: <a href="../../location.html#FI">FI</a> - <em>Republic of Finland </em
|
||||
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<p>If you have gcc < 2.3.3 you can build this entry like:</p>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> all</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make all</code></pre>
|
||||
<p>This will try to create a file whose actual filename is literally:</p>
|
||||
<pre><code> ";main(){puts("Hello World!");}char*C=".c</code></pre>
|
||||
<p>When that file is compiled, it will greet the world in the
|
||||
@@ -166,14 +166,14 @@ section below for more details.</p>
|
||||
<p>For more detailed information see <a href="../../bugs.html#1993_lmfjyh">1993 lmfjyh bugs</a>.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<p>If you have gcc < 2.3.3 (i.e. the entry can compile):</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">./lmfjyh</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./lmfjyh</code></pre>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
<p>This version does what the code did but in a way that will work with modern
|
||||
compilers. We’d like to say there’s something special about it but there isn’t.
|
||||
Nonetheless it will be compiled in case the original entry fails to compile.</p>
|
||||
<h3 id="alternate-build">Alternate build:</h3>
|
||||
<p>Should you wish to build this version manually:</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> alt</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make alt</code></pre>
|
||||
<h3 id="alternate-use">Alternate use:</h3>
|
||||
<p>Use <code>lmfjyh.alt</code> as you would <code>lmfjyh</code> above. Note that other code could also be
|
||||
done with the bug that the entry abuses but that would have to be manually
|
||||
@@ -189,10 +189,10 @@ best with C-source code.</p>
|
||||
<p>As an example, I have taken a simple “Hello world!” program
|
||||
that should be familiar to all C-programmers.</p>
|
||||
<h4 id="listing-1-a-simple-hello-world-program">Listing 1: A simple “Hello World” program</h4>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a> main<span class="op">()</span></span>
|
||||
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="op">{</span></span>
|
||||
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a> puts<span class="op">(</span><span class="st">"Hello World!"</span><span class="op">);</span></span>
|
||||
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> main()
|
||||
{
|
||||
puts("Hello World!");
|
||||
}</code></pre>
|
||||
<h3 id="packing-method">Packing method</h3>
|
||||
<p>Normally a file name is used only to identify the file, but this new
|
||||
revolutionary method introduces a totally new concept: <strong>THE FILE NAME <em>IS</em> THE
|
||||
@@ -200,9 +200,9 @@ PROGRAM</strong>. There is no need to waste valuable disk space to store source
|
||||
The program is embedded in the file name, only a minor portion of it is inside
|
||||
the file.</p>
|
||||
<h4 id="listing-2-compressed-hello-world">Listing 2: Compressed “Hello world”</h4>
|
||||
<div class="sourceCode" id="cb7"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a> <span class="dt">char</span><span class="op">*</span>_<span class="op">=</span>__FILE__<span class="op">;</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> char*_=__FILE__;</code></pre>
|
||||
<h4 id="listing-3-code-embedded-in-the-file-name">Listing 3: Code embedded in the file name</h4>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a> <span class="st">";main(){puts("</span>Hello World<span class="op">!</span><span class="st">");}char*C="</span><span class="op">.</span>c</span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> ";main(){puts("Hello World!");}char*C=".c</code></pre>
|
||||
<p>The sample program in listing 1 is 36 bytes long. By using the new
|
||||
compression method, the example program may be squeezed to sixteen
|
||||
bytes. In the example the compression ratio is 2:1. It is evident
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
@@ -12,21 +12,21 @@ code](#original-code) below.
|
||||
|
||||
If you wish to speed the entry up, say to 500 microseconds between writes, try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make clobber SLEEP=500 alt
|
||||
```
|
||||
|
||||
Alternatively if you wish to slow it down, say to 1500 microseconds between
|
||||
writes, try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make clobber SLEEP=1500 alt
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./plummer.alt number arg
|
||||
```
|
||||
|
||||
@@ -42,7 +42,7 @@ bypass](https://hitchhikers.fandom.com/wiki/Bypass).
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.alt.sh
|
||||
|
||||
./try.alt.sh 21701
|
||||
@@ -70,7 +70,7 @@ course).
|
||||
|
||||
### Original build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
@@ -82,7 +82,7 @@ Use `plummer` as you would `plummer.alt` above.
|
||||
|
||||
### Original try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.sh
|
||||
|
||||
./try.sh 21701
|
||||
|
||||
+33
-33
@@ -141,19 +141,19 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
|
||||
<!-- 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>
|
||||
<pre class="<!---sh-->"><code> make alt</code></pre>
|
||||
<p>We recommend that you try the alternate version first to get a better idea of
|
||||
what this entry looked like back in 1993. The alternate version sleeps (via
|
||||
<code>usleep(3)</code>) in between writes, defaulting at 1000 microseconds (but
|
||||
reconfigurable). If you wish to see the original entry then see <a href="#original-code">original
|
||||
code</a> below.</p>
|
||||
<p>If you wish to speed the entry up, say to 500 microseconds between writes, try:</p>
|
||||
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> clobber SLEEP=500 alt</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make clobber SLEEP=500 alt</code></pre>
|
||||
<p>Alternatively if you wish to slow it down, say to 1500 microseconds between
|
||||
writes, 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> clobber SLEEP=1500 alt</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make clobber SLEEP=1500 alt</code></pre>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./plummer.alt</span> number arg</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./plummer.alt number arg</code></pre>
|
||||
<p>where:</p>
|
||||
<ul>
|
||||
<li>number is a number (try 21701)</li>
|
||||
@@ -163,43 +163,43 @@ writes, try:</p>
|
||||
<a href="https://hitchhikers.fandom.com/wiki/Vogon">Vogons</a> build that <a href="https://hitchhikers.fandom.com/wiki/Bypass">hyperspace
|
||||
bypass</a>.</p>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.alt.sh</span></span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.alt.sh</span> 21701</span>
|
||||
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a> <span class="va">SLEEP</span><span class="op">=</span>500 <span class="ex">./try.alt.sh</span></span>
|
||||
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a> <span class="va">SLEEP</span><span class="op">=</span>900 <span class="ex">./try.alt.sh</span> 789789789789789</span>
|
||||
<span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb5-9"><a href="#cb5-9" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.alt.sh</span> 789789789</span>
|
||||
<span id="cb5-10"><a href="#cb5-10" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb5-11"><a href="#cb5-11" aria-hidden="true" tabindex="-1"></a> <span class="va">SLEEP</span><span class="op">=</span>400 <span class="ex">./try.alt.sh</span> 42424242424242</span>
|
||||
<span id="cb5-12"><a href="#cb5-12" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb5-13"><a href="#cb5-13" aria-hidden="true" tabindex="-1"></a> <span class="va">SLEEP</span><span class="op">=</span>1000 <span class="ex">./try.alt.sh</span> xyzzyzzyx</span>
|
||||
<span id="cb5-14"><a href="#cb5-14" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb5-15"><a href="#cb5-15" aria-hidden="true" tabindex="-1"></a> <span class="va">SLEEP</span><span class="op">=</span>1200 <span class="ex">./try.alt.sh</span> xyzzyzzyx 5555</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./try.alt.sh
|
||||
|
||||
./try.alt.sh 21701
|
||||
|
||||
SLEEP=500 ./try.alt.sh
|
||||
|
||||
SLEEP=900 ./try.alt.sh 789789789789789
|
||||
|
||||
./try.alt.sh 789789789
|
||||
|
||||
SLEEP=400 ./try.alt.sh 42424242424242
|
||||
|
||||
SLEEP=1000 ./try.alt.sh xyzzyzzyx
|
||||
|
||||
SLEEP=1200 ./try.alt.sh xyzzyzzyx 5555</code></pre>
|
||||
<h2 id="original-code">Original code:</h2>
|
||||
<p>This version, the original, does not sleep in between writes, and is thus much
|
||||
faster (depending on the <code>SLEEP</code> parameter specified in the build of <code>alt</code>, of
|
||||
course).</p>
|
||||
<h3 id="original-build">Original build:</h3>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> all</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make all</code></pre>
|
||||
<h3 id="original-use">Original use:</h3>
|
||||
<p>Use <code>plummer</code> as you would <code>plummer.alt</code> above.</p>
|
||||
<h3 id="original-try">Original try:</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">./try.sh</span></span>
|
||||
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span> 21701</span>
|
||||
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span> 789789789789789</span>
|
||||
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span> 789789789</span>
|
||||
<span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb7-9"><a href="#cb7-9" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span> 42424242424242</span>
|
||||
<span id="cb7-10"><a href="#cb7-10" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb7-11"><a href="#cb7-11" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span> xyzzyzzyx</span>
|
||||
<span id="cb7-12"><a href="#cb7-12" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb7-13"><a href="#cb7-13" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span> xyzzyzzyx 5555</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./try.sh
|
||||
|
||||
./try.sh 21701
|
||||
|
||||
./try.sh 789789789789789
|
||||
|
||||
./try.sh 789789789
|
||||
|
||||
./try.sh 42424242424242
|
||||
|
||||
./try.sh xyzzyzzyx
|
||||
|
||||
./try.sh xyzzyzzyx 5555</code></pre>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>For extra credit: What happens when ‘number’ contains non-numeric
|
||||
characters, and why?</p>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
@@ -22,7 +22,7 @@ For more detailed information see [bugs report with 1993/rince](../../bugs.html#
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./rince [cabbage]
|
||||
```
|
||||
|
||||
@@ -37,13 +37,13 @@ Some people may want to slow down the game by increasing the
|
||||
value 17 in the lines:
|
||||
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
struct timeval v= {0,1<<17} ;
|
||||
```
|
||||
|
||||
and
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
refresh(),c=select(k,&y,0,0,(v.tv_usec=1<<17,&v))?getch():0;
|
||||
```
|
||||
|
||||
@@ -57,7 +57,7 @@ changed).
|
||||
|
||||
### Alternate build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make SLEEP=18 clobber alt
|
||||
```
|
||||
|
||||
@@ -107,7 +107,7 @@ with the curses library (typically `/lib/libcurses.a` for static libraries)
|
||||
used. It has been suggested that the following gcc command may help:
|
||||
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
gcc -fno-builtin -I/usr/include -o rince rince.c -lcurses -ltermcap
|
||||
```
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ Location: <a href="../../location.html#GB">GB</a> - <em>United Kingdom of Great
|
||||
<!-- 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>
|
||||
<pre class="<!---sh-->"><code> make all</code></pre>
|
||||
<p>NOTE: there are two alternate versions of this program, both allowing one to
|
||||
slow down the game and the second one with movements more familiar to vi users.
|
||||
See the <a href="#alternate-code">Alternate code</a> section below.</p>
|
||||
@@ -150,22 +150,22 @@ See the <a href="#alternate-code">Alternate code</a> section below.</p>
|
||||
<pre><code> STATUS: INABIAF - please **DO NOT** fix</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#1993_rince">bugs report with 1993/rince</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">./rince</span> <span class="pp">[</span><span class="ss">cabbage</span><span class="pp">]</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./rince [cabbage]</code></pre>
|
||||
<p>where:</p>
|
||||
<p><code>[cabbage]</code> is a CABBAGE description file (default: <code>rince.c</code>)</p>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
<p>Some people may want to slow down the game by increasing the
|
||||
value 17 in the lines:</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="kw">struct</span> timeval v<span class="op">=</span> <span class="op">{</span><span class="dv">0</span><span class="op">,</span><span class="dv">1</span><span class="op"><<</span><span class="dv">17</span><span class="op">}</span> <span class="op">;</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> struct timeval v= {0,1<<17} ;</code></pre>
|
||||
<p>and</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> refresh<span class="op">(),</span>c<span class="op">=</span>select<span class="op">(</span>k<span class="op">,&</span>y<span class="op">,</span><span class="dv">0</span><span class="op">,</span><span class="dv">0</span><span class="op">,(</span>v<span class="op">.</span>tv_usec<span class="op">=</span><span class="dv">1</span><span class="op"><<</span><span class="dv">17</span><span class="op">,&</span>v<span class="op">))?</span>getch<span class="op">():</span><span class="dv">0</span><span class="op">;</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> refresh(),c=select(k,&y,0,0,(v.tv_usec=1<<17,&v))?getch():0;</code></pre>
|
||||
<p>to another value like 18 or 19 which you can do with the alternate code.</p>
|
||||
<p>In the case of <a href="rince.alt2.c">rince.alt2.c</a> the movement keys for the default
|
||||
game are slightly different and will feel more familiar to vi users: <code>h</code> for
|
||||
left, <code>l</code> for right (that was not changed) and <code>k</code> for fire (that was also not
|
||||
changed).</p>
|
||||
<h3 id="alternate-build">Alternate build:</h3>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> SLEEP=18 clobber alt</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make SLEEP=18 clobber alt</code></pre>
|
||||
<p>Replace 18 with whatever number you wish.</p>
|
||||
<h3 id="alternate-use">Alternate use:</h3>
|
||||
<p>Use <code>rince.alt</code> or <code>rince.alt2</code> as you would <code>rince</code> above.</p>
|
||||
@@ -194,7 +194,7 @@ with it.</p>
|
||||
<code>/usr/local/include/curses.h</code> if not <code>/usr/include/curses.h</code>) is not compatible
|
||||
with the curses library (typically <code>/lib/libcurses.a</code> for static libraries)
|
||||
used. It has been suggested that the following gcc command may help:</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">gcc</span> <span class="at">-fno-builtin</span> <span class="at">-I</span>/usr/include <span class="at">-o</span> rince rince.c <span class="at">-lcurses</span> <span class="at">-ltermcap</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> gcc -fno-builtin -I/usr/include -o rince rince.c -lcurses -ltermcap</code></pre>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<p>This is a Cellular Automata Based, Beautifully Abysmal Game Environment (or
|
||||
CABBAGE for short). To execute the program simply type <code>./rince gamefile</code>,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
@@ -18,7 +18,7 @@ For more detailed information see [1993 schnitzi bugs](../../bugs.html#1993_schn
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./schnitzi file
|
||||
```
|
||||
|
||||
@@ -33,14 +33,14 @@ in [1993 schnitzi bugs](../../bugs.html#1993_schnitzi).
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./schnitzi schnitzi.info
|
||||
# ask some questions suggested by the author, noted below
|
||||
```
|
||||
|
||||
We also suggest you ask the program the following questions:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
Who is Mark Schnitzus?
|
||||
|
||||
Who was Jack the Ripper ?
|
||||
@@ -51,7 +51,7 @@ intentional spelling error there.
|
||||
|
||||
Try feeding the program source to the program and ask both:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
What is cat ?
|
||||
What is cat?
|
||||
```
|
||||
|
||||
@@ -141,29 +141,29 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
|
||||
<!-- 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>
|
||||
<pre class="<!---sh-->"><code> make all</code></pre>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code> STATUS: INABIAF - please **DO NOT** fix</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#1993_schnitzi">1993 schnitzi 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">./schnitzi</span> file</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./schnitzi file</code></pre>
|
||||
<p>where</p>
|
||||
<p><code>file</code> is a file containing some text.</p>
|
||||
<p>Certain input will cause the program to fail as described
|
||||
in <a href="../../bugs.html#1993_schnitzi">1993 schnitzi bugs</a>.</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">./schnitzi</span> schnitzi.info</span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="co"># ask some questions suggested by the author, noted below</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./schnitzi schnitzi.info
|
||||
# ask some questions suggested by the author, noted below</code></pre>
|
||||
<p>We also suggest you ask the program the following questions:</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">Who</span> is Mark Schnitzus<span class="pp">?</span></span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">Who</span> was Jack the Ripper <span class="pp">?</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> Who is Mark Schnitzus?
|
||||
|
||||
Who was Jack the Ripper ?</code></pre>
|
||||
<p>Notice how it still manages to answer the first question despite there being an
|
||||
intentional spelling error there.</p>
|
||||
<p>Try feeding the program source to the program and ask both:</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">What</span> is cat <span class="pp">?</span></span>
|
||||
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">What</span> is cat<span class="pp">?</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> What is cat ?
|
||||
What is cat?</code></pre>
|
||||
<p>What happens if you ask it other questions with and without a space before the
|
||||
<code>?</code>?</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
|
||||
+7
-7
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
@@ -18,7 +18,7 @@ For more detailed information see [1993 vanb bugs](../../bugs.html#1993_vanb).
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./vanb 'exp'
|
||||
```
|
||||
|
||||
@@ -28,7 +28,7 @@ hexadecimal and decimal numbers.
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -133,7 +133,7 @@ Here's a version of the program before it got formatted into the VIII,
|
||||
augmented with comments showing where each state begins. `N1` and `N2` are
|
||||
notes:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
#define O5 main
|
||||
O5(O2,O7,O3)char**O7;
|
||||
{
|
||||
@@ -180,14 +180,14 @@ printf, and sends the parser to state `012` (which is `<E>`).
|
||||
|
||||
The `E` and `T` states work like this:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
int e(){ return eprime( t() ); }
|
||||
```
|
||||
|
||||
|
||||
The `E'` and `T'` states work like this:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
int eprime( int intermediate )
|
||||
{
|
||||
if( ch == '+' )
|
||||
@@ -202,7 +202,7 @@ The `E'` and `T'` states work like this:
|
||||
The `D`, `X` and `O` states work like this (they assume that they're initially
|
||||
called with `0`):
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
int octal( int intermediate )
|
||||
{
|
||||
if( ch>='0' && ch<='7' )
|
||||
|
||||
+58
-58
@@ -141,17 +141,17 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
|
||||
<!-- 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>
|
||||
<pre class="<!---sh-->"><code> make all</code></pre>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code> STATUS: INABIAF - please **DO NOT** fix</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#1993_vanb">1993 vanb 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">./vanb</span> <span class="st">'exp'</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./vanb 'exp'</code></pre>
|
||||
<p>where <code>exp</code> is an octal expression. See below for how it can also have
|
||||
hexadecimal and decimal numbers.</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>
|
||||
<pre class="<!---sh-->"><code> ./try.sh</code></pre>
|
||||
<p>What happens if you use something other than valid digits?</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>The octal expression may contain:</p>
|
||||
@@ -217,70 +217,70 @@ involving <code>**O7</code> and octal constants are looking for certain characte
|
||||
<p>Here’s a version of the program before it got formatted into the VIII,
|
||||
augmented with comments showing where each state begins. <code>N1</code> and <code>N2</code> are
|
||||
notes:</p>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a> <span class="pp">#define O5 main</span></span>
|
||||
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a> O5<span class="op">(</span>O2<span class="op">,</span>O7<span class="op">,</span>O3<span class="op">)</span><span class="dt">char</span><span class="op">**</span>O7<span class="op">;</span></span>
|
||||
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a> <span class="op">{</span></span>
|
||||
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span></span>
|
||||
<span id="cb9-5"><a href="#cb9-5" aria-hidden="true" tabindex="-1"></a> <span class="co">/* N1 */</span> <span class="op">!(</span>O2<span class="op">+=~</span><span class="bn">01</span><span class="op">+</span><span class="bn">01</span><span class="op">)</span> <span class="op">?</span>\</span>
|
||||
<span id="cb9-6"><a href="#cb9-6" aria-hidden="true" tabindex="-1"></a> <span class="bn">00</span><span class="op">:</span></span>
|
||||
<span id="cb9-7"><a href="#cb9-7" aria-hidden="true" tabindex="-1"></a> <span class="co">/* N2 */</span> <span class="op">!(</span>O2<span class="op">-=</span><span class="bn">02</span><span class="op">></span><span class="bn">01</span><span class="op">)</span> <span class="op">?</span>\</span>
|
||||
<span id="cb9-8"><a href="#cb9-8" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">"</span><span class="sc">\045</span><span class="er">\1</span><span class="st">57</span><span class="sc">\012</span><span class="st">"</span><span class="op">,</span>O5<span class="op">(</span><span class="bn">012</span><span class="op">,</span>O7<span class="op">+</span><span class="bn">01</span><span class="op">,</span><span class="bn">00</span><span class="op">)):</span></span>
|
||||
<span id="cb9-9"><a href="#cb9-9" aria-hidden="true" tabindex="-1"></a> <span class="co">/* O */</span> <span class="op">!(</span>O2<span class="op">-=</span><span class="bn">02</span><span class="op">>></span><span class="bn">01</span><span class="op">)</span> <span class="op">?</span>\</span>
|
||||
<span id="cb9-10"><a href="#cb9-10" aria-hidden="true" tabindex="-1"></a> <span class="op">(**</span>O7<span class="op"><=</span><span class="bn">067</span> <span class="op">&&</span> <span class="op">**</span>O7<span class="op">></span><span class="bn">057</span> <span class="op">?</span> O5<span class="op">(</span><span class="bn">03</span><span class="op">,</span>O7<span class="op">,*(*</span>O7<span class="op">)++-</span><span class="bn">060</span><span class="op">+</span><span class="bn">010</span><span class="op">*</span>O3<span class="op">):</span>O3<span class="op">):</span></span>
|
||||
<span id="cb9-11"><a href="#cb9-11" aria-hidden="true" tabindex="-1"></a> <span class="co">/* D */</span> <span class="op">!(</span>O2<span class="op">-=-</span>O3<span class="op">-~</span>O3<span class="op">)</span> <span class="op">?</span>\</span>
|
||||
<span id="cb9-12"><a href="#cb9-12" aria-hidden="true" tabindex="-1"></a> <span class="op">(</span><span class="bn">072</span><span class="op">>**</span>O7 <span class="op">&&</span> <span class="bn">060</span><span class="op"><=**</span>O7 <span class="op">?</span> O5<span class="op">(</span><span class="bn">04</span><span class="op">,</span>O7<span class="op">,</span><span class="bn">012</span><span class="op">*</span>O3<span class="op">-</span><span class="bn">060</span><span class="op">+*(*</span>O7<span class="op">)++):</span>O3<span class="op">):</span></span>
|
||||
<span id="cb9-13"><a href="#cb9-13" aria-hidden="true" tabindex="-1"></a> <span class="co">/* X */</span> <span class="op">!(</span>O2<span class="op">-=!</span>O3<span class="op">+!!</span>O3<span class="op">)</span> <span class="op">?</span>\</span>
|
||||
<span id="cb9-14"><a href="#cb9-14" aria-hidden="true" tabindex="-1"></a> <span class="op">(**</span>O7<span class="op">></span><span class="bn">057</span> <span class="op">&&</span> <span class="op">**</span>O7<span class="op"><=</span><span class="bn">071</span> <span class="op">?</span> O5<span class="op">(</span><span class="bn">05</span><span class="op">,</span>O7<span class="op">,*(*</span>O7<span class="op">)+++</span>O3<span class="op">*</span><span class="bn">020</span><span class="op">-</span><span class="bn">060</span><span class="op">):</span></span>
|
||||
<span id="cb9-15"><a href="#cb9-15" aria-hidden="true" tabindex="-1"></a> <span class="op">**</span>O7<span class="op"><=</span><span class="bn">0106</span> <span class="op">&&</span> <span class="bn">0101</span><span class="op"><=**</span>O7 <span class="op">?</span> O5<span class="op">(</span><span class="bn">05</span><span class="op">,</span>O7<span class="op">,</span><span class="bn">020</span><span class="op">*</span>O3<span class="op">+*(*</span>O7<span class="op">)++-</span><span class="bn">067</span><span class="op">):</span></span>
|
||||
<span id="cb9-16"><a href="#cb9-16" aria-hidden="true" tabindex="-1"></a> <span class="bn">0140</span><span class="op"><**</span>O7 <span class="op">&&</span> <span class="op">**</span>O7<span class="op"><</span><span class="bn">0147</span> <span class="op">?</span> O5<span class="op">(</span><span class="bn">05</span><span class="op">,</span>O7<span class="op">,-</span><span class="bn">0127</span><span class="op">+*(*</span>O7<span class="op">)+++</span><span class="bn">020</span><span class="op">*</span>O3<span class="op">):</span>O3<span class="op">):</span></span>
|
||||
<span id="cb9-17"><a href="#cb9-17" aria-hidden="true" tabindex="-1"></a> <span class="co">/* F */</span> <span class="op">!(</span>O2<span class="op">-=</span><span class="bn">02</span><span class="op">-</span><span class="bn">01</span><span class="op">)</span> <span class="op">?</span>\</span>
|
||||
<span id="cb9-18"><a href="#cb9-18" aria-hidden="true" tabindex="-1"></a> <span class="op">(**</span>O7<span class="op">==</span><span class="bn">050</span> <span class="op">?</span> <span class="bn">050</span><span class="op">**++*</span>O7<span class="op">,</span>O5<span class="op">(</span><span class="bn">013</span><span class="op">,</span>O7<span class="op">,</span>O5<span class="op">(</span><span class="bn">012</span><span class="op">,</span>O7<span class="op">,</span><span class="bn">00</span><span class="op">)):</span></span>
|
||||
<span id="cb9-19"><a href="#cb9-19" aria-hidden="true" tabindex="-1"></a> <span class="op">**</span>O7<span class="op"><</span><span class="bn">056</span> <span class="op">&&</span> <span class="bn">054</span><span class="op"><**</span>O7 <span class="op">?</span> <span class="bn">055</span><span class="op">**++*</span>O7<span class="op">,-</span>O5<span class="op">(</span><span class="bn">06</span><span class="op">,</span>O7<span class="op">,</span><span class="bn">00</span><span class="op">):</span></span>
|
||||
<span id="cb9-20"><a href="#cb9-20" aria-hidden="true" tabindex="-1"></a> <span class="bn">054</span><span class="op">>**</span>O7 <span class="op">&&</span> <span class="bn">052</span><span class="op"><**</span>O7 <span class="op">?</span> <span class="bn">050</span><span class="op">**(*</span>O7<span class="op">)++,</span>O5<span class="op">(</span><span class="bn">06</span><span class="op">,</span>O7<span class="op">,</span><span class="bn">00</span><span class="op">):</span></span>
|
||||
<span id="cb9-21"><a href="#cb9-21" aria-hidden="true" tabindex="-1"></a> <span class="op">!(**</span>O7<span class="op">^</span><span class="bn">0170</span><span class="op">)||!(</span><span class="bn">0130</span><span class="op">^**</span>O7<span class="op">)</span> <span class="op">?</span> <span class="op">*++*</span>O7<span class="op">,</span>O5<span class="op">(</span><span class="bn">05</span><span class="op">,</span>O7<span class="op">,</span><span class="bn">00</span><span class="op">):</span></span>
|
||||
<span id="cb9-22"><a href="#cb9-22" aria-hidden="true" tabindex="-1"></a> <span class="op">**</span>O7<span class="op">==</span><span class="bn">0144</span><span class="op">||**</span>O7<span class="op">==</span><span class="bn">0104</span> <span class="op">?</span> <span class="op">++*</span>O7<span class="op">,</span>O5<span class="op">(</span><span class="bn">04</span><span class="op">,</span>O7<span class="op">,</span><span class="bn">00</span><span class="op">):</span>O5<span class="op">(</span><span class="bn">03</span><span class="op">,</span>O7<span class="op">,</span><span class="bn">00</span><span class="op">)):</span></span>
|
||||
<span id="cb9-23"><a href="#cb9-23" aria-hidden="true" tabindex="-1"></a> <span class="co">/* T' */</span> <span class="op">!--</span>O2 <span class="op">?</span>\</span>
|
||||
<span id="cb9-24"><a href="#cb9-24" aria-hidden="true" tabindex="-1"></a> <span class="op">(**</span>O7<span class="op">==</span><span class="bn">052</span> <span class="op">?</span> O5<span class="op">(</span><span class="bn">07</span><span class="op">,</span>O7<span class="op">,</span>O3<span class="op">*(*++*</span>O7<span class="op">,</span>O5<span class="op">(</span><span class="bn">06</span><span class="op">,</span>O7<span class="op">,</span><span class="bn">00</span><span class="op">))):</span></span>
|
||||
<span id="cb9-25"><a href="#cb9-25" aria-hidden="true" tabindex="-1"></a> <span class="op">!(</span><span class="bn">045</span><span class="op">-**</span>O7<span class="op">)</span> <span class="op">?</span> O5<span class="op">(</span><span class="bn">07</span><span class="op">,</span>O7<span class="op">,</span>O3<span class="op">%(</span><span class="bn">03</span><span class="op">+(*</span>O7<span class="op">)++,</span>O5<span class="op">(</span><span class="bn">06</span><span class="op">,</span>O7<span class="op">,</span><span class="bn">00</span><span class="op">))):</span></span>
|
||||
<span id="cb9-26"><a href="#cb9-26" aria-hidden="true" tabindex="-1"></a> <span class="op">!(**</span>O7<span class="op">^</span><span class="bn">057</span><span class="op">)</span> <span class="op">?</span> O5<span class="op">(</span><span class="bn">07</span><span class="op">,</span>O7<span class="op">,</span>O3<span class="op">/(</span><span class="bn">03</span><span class="op">-*++*</span>O7<span class="op">,</span>O5<span class="op">(</span><span class="bn">06</span><span class="op">,</span>O7<span class="op">,</span><span class="bn">00</span><span class="op">))):</span>O3<span class="op">):</span></span>
|
||||
<span id="cb9-27"><a href="#cb9-27" aria-hidden="true" tabindex="-1"></a> <span class="co">/* T */</span> <span class="op">!(</span>O2<span class="op">+=</span><span class="bn">01</span><span class="op">-</span><span class="bn">02</span><span class="op">)</span> <span class="op">?</span>\</span>
|
||||
<span id="cb9-28"><a href="#cb9-28" aria-hidden="true" tabindex="-1"></a> O5<span class="op">(</span><span class="bn">07</span><span class="op">,</span>O7<span class="op">,</span>O5<span class="op">(</span><span class="bn">06</span><span class="op">,</span>O7<span class="op">,</span><span class="bn">00</span><span class="op">)):</span></span>
|
||||
<span id="cb9-29"><a href="#cb9-29" aria-hidden="true" tabindex="-1"></a> <span class="co">/* E' */</span> <span class="op">!(</span>O2<span class="op">+=-</span><span class="bn">02</span><span class="op">/</span><span class="bn">02</span><span class="op">)</span> <span class="op">?</span>\</span>
|
||||
<span id="cb9-30"><a href="#cb9-30" aria-hidden="true" tabindex="-1"></a> <span class="op">(!(**</span>O7<span class="op">-</span><span class="bn">053</span><span class="op">)?</span>O5<span class="op">(</span><span class="bn">011</span><span class="op">,</span>O7<span class="op">,</span>O3<span class="op">+(++*</span>O7<span class="op">,</span>O5<span class="op">(</span><span class="bn">010</span><span class="op">,</span>O7<span class="op">,</span><span class="bn">00</span><span class="op">))):</span></span>
|
||||
<span id="cb9-31"><a href="#cb9-31" aria-hidden="true" tabindex="-1"></a> <span class="op">!(</span><span class="bn">055</span><span class="op">^**</span>O7<span class="op">)</span> <span class="op">?</span> O5<span class="op">(</span><span class="bn">011</span><span class="op">,</span>O7<span class="op">,</span>O3<span class="op">-(</span><span class="bn">03</span><span class="op">+*(*</span>O7<span class="op">)++,</span>O5<span class="op">(</span><span class="bn">010</span><span class="op">,</span>O7<span class="op">,</span><span class="bn">00</span><span class="op">))):</span>O3<span class="op">):</span></span>
|
||||
<span id="cb9-32"><a href="#cb9-32" aria-hidden="true" tabindex="-1"></a> <span class="co">/* E */</span> <span class="op">!(</span>O2<span class="op">-=</span><span class="bn">0563</span><span class="op">&</span><span class="bn">0215</span><span class="op">)</span> <span class="op">?</span>\</span>
|
||||
<span id="cb9-33"><a href="#cb9-33" aria-hidden="true" tabindex="-1"></a> O5<span class="op">(</span><span class="bn">011</span><span class="op">,</span>O7<span class="op">,</span>O5<span class="op">(</span><span class="bn">010</span><span class="op">,</span>O7<span class="op">,</span><span class="bn">00</span><span class="op">)):</span></span>
|
||||
<span id="cb9-34"><a href="#cb9-34" aria-hidden="true" tabindex="-1"></a> <span class="co">/* C */</span> <span class="op">(++*</span>O7<span class="op">,</span>O3<span class="op">);</span></span>
|
||||
<span id="cb9-35"><a href="#cb9-35" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> #define O5 main
|
||||
O5(O2,O7,O3)char**O7;
|
||||
{
|
||||
return
|
||||
/* N1 */ !(O2+=~01+01) ?\
|
||||
00:
|
||||
/* N2 */ !(O2-=02>01) ?\
|
||||
printf("\045\157\012",O5(012,O7+01,00)):
|
||||
/* O */ !(O2-=02>>01) ?\
|
||||
(**O7<=067 && **O7>057 ? O5(03,O7,*(*O7)++-060+010*O3):O3):
|
||||
/* D */ !(O2-=-O3-~O3) ?\
|
||||
(072>**O7 && 060<=**O7 ? O5(04,O7,012*O3-060+*(*O7)++):O3):
|
||||
/* X */ !(O2-=!O3+!!O3) ?\
|
||||
(**O7>057 && **O7<=071 ? O5(05,O7,*(*O7)+++O3*020-060):
|
||||
**O7<=0106 && 0101<=**O7 ? O5(05,O7,020*O3+*(*O7)++-067):
|
||||
0140<**O7 && **O7<0147 ? O5(05,O7,-0127+*(*O7)+++020*O3):O3):
|
||||
/* F */ !(O2-=02-01) ?\
|
||||
(**O7==050 ? 050**++*O7,O5(013,O7,O5(012,O7,00)):
|
||||
**O7<056 && 054<**O7 ? 055**++*O7,-O5(06,O7,00):
|
||||
054>**O7 && 052<**O7 ? 050**(*O7)++,O5(06,O7,00):
|
||||
!(**O7^0170)||!(0130^**O7) ? *++*O7,O5(05,O7,00):
|
||||
**O7==0144||**O7==0104 ? ++*O7,O5(04,O7,00):O5(03,O7,00)):
|
||||
/* T' */ !--O2 ?\
|
||||
(**O7==052 ? O5(07,O7,O3*(*++*O7,O5(06,O7,00))):
|
||||
!(045-**O7) ? O5(07,O7,O3%(03+(*O7)++,O5(06,O7,00))):
|
||||
!(**O7^057) ? O5(07,O7,O3/(03-*++*O7,O5(06,O7,00))):O3):
|
||||
/* T */ !(O2+=01-02) ?\
|
||||
O5(07,O7,O5(06,O7,00)):
|
||||
/* E' */ !(O2+=-02/02) ?\
|
||||
(!(**O7-053)?O5(011,O7,O3+(++*O7,O5(010,O7,00))):
|
||||
!(055^**O7) ? O5(011,O7,O3-(03+*(*O7)++,O5(010,O7,00))):O3):
|
||||
/* E */ !(O2-=0563&0215) ?\
|
||||
O5(011,O7,O5(010,O7,00)):
|
||||
/* C */ (++*O7,O3);
|
||||
}</code></pre>
|
||||
<p>Note <code>N1</code>: It should never enter this state, unless the user invokes the
|
||||
program with no parameters, in which case it just returns 0.</p>
|
||||
<p>Note <code>N2</code>: Since the program is properly invoked with 1 parameter, this is
|
||||
the first state it will go into. This state just invokes
|
||||
printf, and sends the parser to state <code>012</code> (which is <code><E></code>).</p>
|
||||
<p>The <code>E</code> and <code>T</code> states work like this:</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> <span class="dt">int</span> e<span class="op">(){</span> <span class="cf">return</span> eprime<span class="op">(</span> t<span class="op">()</span> <span class="op">);</span> <span class="op">}</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> int e(){ return eprime( t() ); }</code></pre>
|
||||
<p>The <code>E'</code> and <code>T'</code> states work like this:</p>
|
||||
<div class="sourceCode" id="cb11"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a> <span class="dt">int</span> eprime<span class="op">(</span> <span class="dt">int</span> intermediate <span class="op">)</span></span>
|
||||
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a> <span class="op">{</span></span>
|
||||
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span><span class="op">(</span> ch <span class="op">==</span> <span class="ch">'+'</span> <span class="op">)</span></span>
|
||||
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a> <span class="op">{</span></span>
|
||||
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a> ch <span class="op">=</span> nextchar<span class="op">();</span></span>
|
||||
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> eprime<span class="op">(</span> intermediate <span class="op">+</span> t<span class="op">()</span> <span class="op">);</span></span>
|
||||
<span id="cb11-7"><a href="#cb11-7" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
|
||||
<span id="cb11-8"><a href="#cb11-8" aria-hidden="true" tabindex="-1"></a> <span class="cf">else</span> <span class="cf">return</span> intermediate<span class="op">;</span></span>
|
||||
<span id="cb11-9"><a href="#cb11-9" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> int eprime( int intermediate )
|
||||
{
|
||||
if( ch == '+' )
|
||||
{
|
||||
ch = nextchar();
|
||||
return eprime( intermediate + t() );
|
||||
}
|
||||
else return intermediate;
|
||||
}</code></pre>
|
||||
<p>The <code>D</code>, <code>X</code> and <code>O</code> states work like this (they assume that they’re initially
|
||||
called with <code>0</code>):</p>
|
||||
<div class="sourceCode" id="cb12"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a> <span class="dt">int</span> octal<span class="op">(</span> <span class="dt">int</span> intermediate <span class="op">)</span></span>
|
||||
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a> <span class="op">{</span></span>
|
||||
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span><span class="op">(</span> ch<span class="op">>=</span><span class="ch">'0'</span> <span class="op">&&</span> ch<span class="op"><=</span><span class="ch">'7'</span> <span class="op">)</span></span>
|
||||
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a> <span class="op">{</span></span>
|
||||
<span id="cb12-5"><a href="#cb12-5" aria-hidden="true" tabindex="-1"></a> intermediate <span class="op">=</span> intermediate <span class="op">*</span> <span class="dv">8</span> <span class="op">+</span> ch <span class="op">-</span> <span class="ch">'0'</span><span class="op">;</span></span>
|
||||
<span id="cb12-6"><a href="#cb12-6" aria-hidden="true" tabindex="-1"></a> ch <span class="op">=</span> nextchar<span class="op">();</span></span>
|
||||
<span id="cb12-7"><a href="#cb12-7" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> octal<span class="op">(</span> intermediate <span class="op">);</span></span>
|
||||
<span id="cb12-8"><a href="#cb12-8" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
|
||||
<span id="cb12-9"><a href="#cb12-9" aria-hidden="true" tabindex="-1"></a> <span class="cf">else</span> <span class="cf">return</span> intermediate<span class="op">;</span></span>
|
||||
<span id="cb12-10"><a href="#cb12-10" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> int octal( int intermediate )
|
||||
{
|
||||
if( ch>='0' && ch<='7' )
|
||||
{
|
||||
intermediate = intermediate * 8 + ch - '0';
|
||||
ch = nextchar();
|
||||
return octal( intermediate );
|
||||
}
|
||||
else return intermediate;
|
||||
}</code></pre>
|
||||
<p><code>F</code> and <code>C</code> work similarly.</p>
|
||||
<!--
|
||||
|
||||
|
||||
Reference in new issue
Block a user