Merge pull request #2330 from xexyl/stein86-try

Add stein.sh to 1986/stein/README.md
This commit is contained in:
Landon Curt Noll authored and GitHub committed 2024-05-06 14:55:19 -07:00
commit bdde14dd3f
6 files changed
+135 -119

No files matched your search

+2 -2
View File
@@ -399,8 +399,8 @@ behaviour, depending on what changes in code were made and the optimiser being
on or off. <code>Clang</code> in macOS also dumped core!</p> on or off. <code>Clang</code> in macOS also dumped core!</p>
<p>The <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1986/marshall/marshall.c">marshall.c</a> has the original fix <p>The <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1986/marshall/marshall.c">marshall.c</a> has the original fix
for <code>clang</code> which works with some compilers depending on the optimiser. When we for <code>clang</code> which works with some compilers depending on the optimiser. When we
refer to the code below we refer to the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1986/marshall/marshall.alt.c">alternate code, refer to the code below we refer to the alternate code,
marshall.alt.c</a>.</p> <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1986/marshall/marshall.alt.c">marshall.alt.c</a>.</p>
<h2 id="the-conflicting-compiler-problems">The conflicting compiler problems:</h2> <h2 id="the-conflicting-compiler-problems">The conflicting compiler problems:</h2>
<p>Below we describe the conflicting options that resulted in the need to modify <p>Below we describe the conflicting options that resulted in the need to modify
the original code.</p> the original code.</p>
+2 -2
View File
@@ -26,8 +26,8 @@ on or off. `Clang` in macOS also dumped core!
The [marshall.c](%%REPO_URL%%/1986/marshall/marshall.c) has the original fix The [marshall.c](%%REPO_URL%%/1986/marshall/marshall.c) has the original fix
for `clang` which works with some compilers depending on the optimiser. When we for `clang` which works with some compilers depending on the optimiser. When we
refer to the code below we refer to the [alternate code, refer to the code below we refer to the alternate code,
marshall.alt.c](%%REPO_URL%%/1986/marshall/marshall.alt.c). [marshall.alt.c](%%REPO_URL%%/1986/marshall/marshall.alt.c).
## The conflicting compiler problems: ## The conflicting compiler problems:
+7
View File
@@ -12,6 +12,13 @@
``` ```
## Try:
``` <!---sh-->
./stein.sh
```
## Judges' remarks: ## Judges' remarks:
NOTE: to avoid problems with news and mail, the single line was split NOTE: to avoid problems with news and mail, the single line was split
+2
View File
@@ -399,6 +399,8 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
<pre><code> make all</code></pre> <pre><code> make all</code></pre>
<h2 id="to-use">To use:</h2> <h2 id="to-use">To use:</h2>
<pre><code> ./stein $(printf &quot;\015\015&quot;); echo</code></pre> <pre><code> ./stein $(printf &quot;\015\015&quot;); echo</code></pre>
<h2 id="try">Try:</h2>
<pre><code> ./stein.sh</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2> <h2 id="judges-remarks">Judges’ remarks:</h2>
<p>NOTE: to avoid problems with news and mail, the single line was split <p>NOTE: to avoid problems with news and mail, the single line was split
into 3 lines. Join all lines into a single line to recreate into 3 lines. Join all lines into a single line to recreate
+61 -57
View File
@@ -491,12 +491,12 @@ This was fixed on 30 October 2023 after the bug status was changed from INABIAF
<p><a href="#cody">Cody</a> provided an <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/mullender.alt.c">alternate version</a>, <p><a href="#cody">Cody</a> provided an <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/mullender.alt.c">alternate version</a>,
an improved version of the judges, so that everyone can enjoy it with systems an improved version of the judges, so that everyone can enjoy it with systems
that are not VAX/PDP. It moves at approximately the same speed as the original that are not VAX/PDP. It moves at approximately the same speed as the original
did. We also refer you to the <a href="faq.html">FAQ</a> as there are some winning entries did. By using one or more of the other entries that actually let one enjoy this entry as
that also let one enjoy it (which through trial and error was how the right originally written, Cody was able to find, with trial and error, approximately
speed was discovered) - with more to them of course! The difference between the the correct speed.</p>
original is that it will start over after it times out but that might not happen <p>The difference between the original is that it will start over after it times
with the original (might need you to press a key though this is not known for out but that might not happen with the original (might need you to press a key
sure).</p> though this is not known for sure).</p>
<p>Cody also added the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/gentab.c">gentab.c</a> file, fixed to compile <p>Cody also added the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/gentab.c">gentab.c</a> file, fixed to compile
(and work, though see <a href="bugs.html#1984_mullender">1984/mullender in bugs.html</a>) with modern systems (and work, though see <a href="bugs.html#1984_mullender">1984/mullender in bugs.html</a>) with modern systems
and so that it would create the proper array (it had unbalanced <code>}</code>s), which the and so that it would create the proper array (it had unbalanced <code>}</code>s), which the
@@ -515,13 +515,13 @@ Repo</a>.</p>
<p>Both <a href="#cody">Cody</a> and <a href="#yusuke">Yusuke</a> fixed this; Yusuke got this to not crash and Cody fixed it <p>Both <a href="#cody">Cody</a> and <a href="#yusuke">Yusuke</a> fixed this; Yusuke got this to not crash and Cody fixed it
to work with macOS.</p> to work with macOS.</p>
<p>The crash was because it destructively rewrites string literals. However with <p>The crash was because it destructively rewrites string literals. However with
<code>strdup()</code> it’s safe.</p> <code>strdup(3)</code> it’s safe.</p>
<p>The problem with macOS is that although it didn’t crash, it printed <code>H????</code> in a <p>The problem with macOS is that although it didn’t crash, it printed <code>H????</code> in a
seemingly infinite loop, each time printing another <code>?</code>, and it probably would seemingly infinite loop, each time printing another <code>?</code>, and it probably would
have until it ran out of memory.</p> have until it ran out of memory.</p>
<p>The fix for macOS is that there was no prototype for <code>execlp(3)</code> and macOS has <p>The fix for macOS is that there was no prototype for <code>execlp(3)</code> and macOS has
problems with missing prototypes for some functions (this was also seen when problems with missing prototypes for some functions (this was also seen when
Cody fixed <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/anonymous/anonymous.c">1984/anonymous</a> for macOS as well). As Cody fixed <a href="1984/anonymous/index.html">1984/anonymous</a> for macOS as well). As
this is a one-liner the include of <code>unistd.h</code> was done in the Makefile. this is a one-liner the include of <code>unistd.h</code> was done in the Makefile.
Ironically this fix was discovered through Linux!</p> Ironically this fix was discovered through Linux!</p>
<p>NOTE: originally this entry did not print a newline prior to returning to the <p>NOTE: originally this entry did not print a newline prior to returning to the
@@ -542,7 +542,7 @@ to check the output for the first <code>N</code> prime numbers of the output, wh
either the default or user specified. The inspiration was the previous <code>try</code> either the default or user specified. The inspiration was the previous <code>try</code>
command he gave to have fun with finding primes that might seem unusual in a command he gave to have fun with finding primes that might seem unusual in a
way.</p> way.</p>
<p>Cody also added the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1985/august/try.sh">try.sh</a> script (which calls <code>primes.sh</code> <p>Cody also added the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1985/august/try.sh">try.sh</a> script (which runs <code>primes.sh</code>
whether <code>primes(6)</code> is installed or not, but it only does it once with the whether <code>primes(6)</code> is installed or not, but it only does it once with the
default value).</p> default value).</p>
<div id="1985_lycklama"> <div id="1985_lycklama">
@@ -557,7 +557,7 @@ changed the <code>#o</code> lines to <code>#define</code>. Also <code>unistd.h</
that Cody added. See the <a href="1985/lycklama/index.html">index.html</a> for details.</p> that Cody added. See the <a href="1985/lycklama/index.html">index.html</a> for details.</p>
<p>Cody also provided the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1985/lycklama/try.alt.sh">try.alt.sh</a> script.</p> <p>Cody also provided the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1985/lycklama/try.alt.sh">try.alt.sh</a> script.</p>
<div id="1985_shapiro"> <div id="1985_shapiro">
<h2 id="shapiro"><a href="1985/lycklama/index.html">1985/shapiro</a></h2> <h2 id="shapiro"><a href="1985/shapiro/index.html">1985/shapiro</a></h2>
<h3 id="source-code-shapiro.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1985/shapiro/shapiro.c">shapiro.c</a></h3> <h3 id="source-code-shapiro.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1985/shapiro/shapiro.c">shapiro.c</a></h3>
</div> </div>
<p><a href="#cody">Cody</a> added the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1985/shapiro/shapiro.alt.c">alt code</a> <p><a href="#cody">Cody</a> added the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1985/shapiro/shapiro.alt.c">alt code</a>
@@ -599,18 +599,17 @@ were actually not what they appear: the only arg that existed in <code>main()</c
<ul> <ul>
<li><p>The macros <code>C</code> and <code>V</code> were changed to lower case. This is because it felt <li><p>The macros <code>C</code> and <code>V</code> were changed to lower case. This is because it felt
like the <code>C=" ..</code>’ part in <code>subr()</code> would be better to be upper case as it talks like the <code>C=" ..</code>’ part in <code>subr()</code> would be better to be upper case as it talks
about the language. Also in the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1985/sicherman/sicherman.c">alternate about the language. Also in the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1985/sicherman/sicherman.alt.c">alternate
version</a> (the first being the version</a> which is in case a new
original code) which is in case a new version of <code>clang</code> ever objects to only one version of <code>clang</code> ever objects to only one arg in <code>main()</code> (which is not out of
arg in <code>main()</code> (which is not out of the realm of possibility), <code>main()</code> can the realm of possibility), <code>main()</code>, <code>argc</code> of <code>main()</code> is <code>C</code> so it
have <code>C</code> as <code>argc</code> to <code>main()</code> so it would read like it once did: <code>C manual</code> would read like it once did: <code>C manual</code> albeit with a <code>,</code> separating the two.
albeit with a <code>,</code> separating the two. The <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1985/sicherman/sicherman.c">alternate The <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1985/sicherman/sicherman.alt.c">alternate version</a> can be
version</a> can be compiled compiled in case the first does not. Originally the macros were kept the same
in case the first does not. Originally the macros were kept the same and the and the <code>C</code> in <code>subr()</code> was <code>c</code>. It feels better (in some ways) to make it so
<code>C</code> in <code>subr()</code> was <code>c</code>. It feels better (in some ways) to make it so that the that the <code>C</code> for the language is upper case though, and since it actually
<code>C</code> for the language is upper case though, and since it actually translated to translated to <code>/**/</code> it can just be <code>c</code>, not <code>C</code>. The <code>V</code> was changed to <code>v</code> to
<code>/**/</code> it can just be <code>c</code>, not <code>C</code>. The <code>V</code> was changed to <code>v</code> to be the same be the same case as <code>c</code>.</p></li>
case as <code>c</code>.</p></li>
<li><p>The code:</p></li> <li><p>The code:</p></li>
</ul> </ul>
<pre><code> C=&quot;Lint says &quot;argument Manual isn&#39;t used.&quot; What&#39;s that <pre><code> C=&quot;Lint says &quot;argument Manual isn&#39;t used.&quot; What&#39;s that
@@ -672,7 +671,7 @@ should they object to <code>main()</code> having only one arg.</p>
the libc function gets(3) changed to use the libc function gets(3) changed to use
fgets(3)?</a> for why this was done.</p> fgets(3)?</a> for why this was done.</p>
<p>Cody also added the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1986/hague/try.sh">try.sh</a> script which also feeds to the <p>Cody also added the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1986/hague/try.sh">try.sh</a> script which also feeds to the
program the added <code>input.txt</code> file.</p> program the <code>input.txt</code> text file that Cody added.</p>
<div id="1986_holloway"> <div id="1986_holloway">
<h2 id="holloway"><a href="1986/holloway/index.html">1986/holloway</a></h2> <h2 id="holloway"><a href="1986/holloway/index.html">1986/holloway</a></h2>
<h3 id="source-code-holloway.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1986/holloway/holloway.c">holloway.c</a></h3> <h3 id="source-code-holloway.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1986/holloway/holloway.c">holloway.c</a></h3>
@@ -695,8 +694,8 @@ the same but some spaces had to be changed to non-spaces.</p>
different compilers (different problems with different compilers in different different compilers (different problems with different compilers in different
systems and also depending on optimisation with those compilers in those systems and also depending on optimisation with those compilers in those
systems).</p> systems).</p>
<p>We give more details in the <a href="1986/marshall/compilers.html">compilers.html</a> file, <p>Cody gives more details in the <a href="1986/marshall/compilers.html">compilers.html</a>
giving which compilers had which problems in which systems: the optimiser being file: which compilers had which problems in which systems: the optimiser being
enabled in one compiler let it work but broke it in the other; and disabling it enabled in one compiler let it work but broke it in the other; and disabling it
would let it work in the one that didn’t work but suddenly the one that worked would let it work in the one that didn’t work but suddenly the one that worked
wouldn’t work. And by ‘not working’ it did not work in more than one way and for wouldn’t work. And by ‘not working’ it did not work in more than one way and for
@@ -741,8 +740,8 @@ are produced.</p>
<p><a href="#cody">Cody</a> restored the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1986/stein/stein.orig.c">original <p><a href="#cody">Cody</a> restored the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1986/stein/stein.orig.c">original
entry</a> which was a single line. The code entry</a> which was a single line. The code
being longer (in 1986 a one liner could be longer) had been split to three lines to being longer (in 1986 a one liner could be longer) had been split to three lines to
avoid problems with news and mail but as it is the ‘Best one liner’ it is now avoid problems with news and mail but as it is the <strong>Best one liner</strong> the original
one line.</p> code is now one line.</p>
<p>Cody also added the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1986/stein/stein.sh">stein.sh</a> script which runs the two <p>Cody also added the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1986/stein/stein.sh">stein.sh</a> script which runs the two
commands that we suggest in order to get it to show clean output.</p> commands that we suggest in order to get it to show clean output.</p>
<div id="1986_wall"> <div id="1986_wall">
@@ -754,7 +753,7 @@ bit of tinkering as this entry <em>very twisted</em>; fixing <code>-traditional-
noted later on, very complicated, but we encourage you to look at <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1986/wall/wall.orig.c">original noted later on, very complicated, but we encourage you to look at <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1986/wall/wall.orig.c">original
code</a>, as well as below, to see how code</a>, as well as below, to see how
different C was in 1986.</p> different C was in 1986.</p>
<p><a href="#yusuke">Yusuke</a> originally patched this to use <code>strdup()</code> on two strings and this let it <p><a href="#yusuke">Yusuke</a> originally patched this to use <code>strdup(3)</code> on two strings and this let it
work with <code>gcc</code> - but it still required <code>-traditional-cpp</code>.</p> work with <code>gcc</code> - but it still required <code>-traditional-cpp</code>.</p>
<p>If you’d like to see the difference between the version that requires <p>If you’d like to see the difference between the version that requires
<code>-traditional-cpp</code> and the fixed version, try:</p> <code>-traditional-cpp</code> and the fixed version, try:</p>
@@ -962,7 +961,7 @@ macro in place but it’s no longer used.</p>
<p><a href="#cody">Cody</a> fixed this to work for modern systems. The problem was that the important <p><a href="#cody">Cody</a> fixed this to work for modern systems. The problem was that the important
function, a redefinition of <code>exit(3)</code>, was not being called in <code>main()</code>. Earlier function, a redefinition of <code>exit(3)</code>, was not being called in <code>main()</code>. Earlier
fixes that let it compile, but not work with modern systems, can be found in fixes that let it compile, but not work with modern systems, can be found in
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1988/isaak/isaak.alt.c">1988/isaak/isaak.alt.c</a>. See the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1988/isaak/isaak.alt.c">isaak.alt.c</a>. See the
index.html file for more details.</p> index.html file for more details.</p>
<p>Cody also uudecoded and removed the file <code>isaak.encode</code>, putting the output in <p>Cody also uudecoded and removed the file <code>isaak.encode</code>, putting the output in
<code>isaak.output.txt</code>. This was done strictly for historical remarks that can be <code>isaak.output.txt</code>. This was done strictly for historical remarks that can be
@@ -979,16 +978,18 @@ help understand the entry, and for fun.</p>
<h3 id="source-code-phillipps.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1988/phillipps/phillipps.c">phillipps.c</a></h3> <h3 id="source-code-phillipps.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1988/phillipps/phillipps.c">phillipps.c</a></h3>
</div> </div>
<p><a href="#cody">Cody</a> fixed this for modern systems. It did not compile with <code>clang</code> because it <p><a href="#cody">Cody</a> fixed this for modern systems. It did not compile with <code>clang</code> because it
requires the second and third args of <code>main()</code> to be <code>char ** but even before that with</code>gcc` it printed garbage and then crashed.</p> requires the second and third args of <code>main()</code> to be <code>char **</code> but even before
<p>After fixing it for <code>clang</code> by changing the very <code>main()</code> (in fact it called that with <code>gcc</code> it printed garbage and then crashed.</p>
itself up to 12 times!) to call the new function <code>pain()</code> (chosen because it’s a <p>After fixing it for <code>clang</code> by changing the <strong>very recursive</strong> <code>main()</code> (<strong>it called
pain that <code>clang</code> requires these args to be <code>char ** :-), which is just as recursive, with the correct args it now works with both</code>gcc<code>and</code>clang`.</p> itself up to <em>12</em> times!</strong>) to call the new function <code>pain()</code> (named such because it’s a
<p>Later Cody improved the fix to make it look a bit more like the original, using pain that <code>clang</code> requires these args to be <code>char **</code> :-) ), which is just as
K&amp;R style functions, and trying to match the format as best as possible of what recursive, with the correct args, it now works with both <code>gcc</code> and <code>clang</code>.</p>
<code>main()</code> used to look like but without the full body that cannot exist as it <p>To make it look as close to the original as possible, Cody made it K&amp;R style
once did. The format of <code>pain()</code> is exactly like how <code>main()</code> was as it’s the functions and tried to match the format as best as possible of what
same code. Additionally, <code>main()</code> returns <code>!pain(...)</code> like <code>main()</code> used to do <code>main()</code> used to look like but without the full body as that cannot exist as it
to itself and <code>pain()</code> does now.</p> once did; instead, the format of <code>pain()</code> is exactly like how <code>main()</code> was as it’s the
same code, just a <code>p</code> instead of an <code>m</code> in the name. Additionally, <code>main()</code> returns
<code>!pain(...)</code> like <code>main()</code> used to do to itself (<code>pain()</code> does as well).</p>
<div id="1988_reddy"> <div id="1988_reddy">
<h2 id="reddy"><a href="1988/reddy/index.html">1988/reddy</a></h2> <h2 id="reddy"><a href="1988/reddy/index.html">1988/reddy</a></h2>
<h3 id="source-code-reddy.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1988/reddy/reddy.c">reddy.c</a></h3> <h3 id="source-code-reddy.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1988/reddy/reddy.c">reddy.c</a></h3>
@@ -1075,20 +1076,22 @@ entry and the alt code) anyway, it works out well.</p>
</div> </div>
<p><a href="#cody">Cody</a> fixed this to work with modern compilers. Modern compilers do not allow <p><a href="#cody">Cody</a> fixed this to work with modern compilers. Modern compilers do not allow
code like:</p> code like:</p>
<pre><code> #define D define <pre><code> #define d define
#define a include #define a include
#D foo bar #d foo bar
#a &lt;stdio.h&gt;</code></pre> #a &lt;stdio.h&gt;</code></pre>
<p>He notes that there <em>is</em> a way to get it (or something close to it) to work. Do <p>Cody notes that there <em>is</em> a way to get it (or something close to it) to work. Do
you know how?</p> you know how?</p>
<p>The old <code>#define</code>s are left in to make it look like the original as much as
possible but they are not used.</p>
<p>Cody also provided the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/jar.2/try.sh">try.sh</a> script and the <p>Cody also provided the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/jar.2/try.sh">try.sh</a> script and the
supplementary files <a href="1989/jar.2/try.txt">try.txt</a>, supplementary files <a href="1989/jar.2/try.lisp">try.lisp</a>,
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/jar.2/fib.lisp">fib.lisp</a> and <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/jar.2/fib.lisp">fib.lisp</a> and
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/jar.2/chocolate_cake.lisp">chocolate_cake.lisp</a>. The <code>try.txt</code> comes <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/jar.2/chocolate_cake.lisp">chocolate_cake.lisp</a>. The
from the author and the <code>fib.lisp</code> comes from <a href="#yusuke">Yusuke</a>. Cody wrote the script and <code>try.lisp</code> comes from the author and the <code>fib.lisp</code> comes from
offered us some chocolate cake :-) See index.html for details on how to use the <a href="#yusuke">Yusuke</a>. Cody wrote the script and offered us some chocolate cake :-)
script.</p> See index.html for details on how to use the script.</p>
<p>Cody also fixed the Makefile where typing <code>make everything</code> or <code>make alt</code> would <p>Cody also fixed the Makefile where typing <code>make everything</code> or <code>make alt</code> would
result in:</p> result in:</p>
<pre><code> `clang`: error: no such file or directory: &#39;data&#39; <pre><code> `clang`: error: no such file or directory: &#39;data&#39;
@@ -1120,7 +1123,7 @@ discovered and fixed.</p>
<h3 id="source-code-paul.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/paul/paul.c">paul.c</a></h3> <h3 id="source-code-paul.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/paul/paul.c">paul.c</a></h3>
</div> </div>
<p><a href="#cody">Cody</a> fixed a segfault under macOS that prevented it from working. The problem <p><a href="#cody">Cody</a> fixed a segfault under macOS that prevented it from working. The problem
was that the int (from <code>#define f</code>) should be a long. This became apparent when was that the int (from <code>#define f</code>) should be a <code>long</code>. This became apparent when
he was using lldb and saw that the type of a pointer was too <code>long</code> :-)</p> he was using lldb and saw that the type of a pointer was too <code>long</code> :-)</p>
<p>Cody also provided the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/paul/paul.alt.c">alternate version</a> <p>Cody also provided the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/paul/paul.alt.c">alternate version</a>
which has the trace function that the author included but commented out. See the which has the trace function that the author included but commented out. See the
@@ -1133,7 +1136,7 @@ index.html for details.</p>
made, try:</p> made, try:</p>
<pre><code> cd 1989/robison ; make diff_orig_prog</code></pre> <pre><code> cd 1989/robison ; make diff_orig_prog</code></pre>
<p>(It adds the C token pasting operator <code>##</code> instead of <code>/**/</code>.)</p> <p>(It adds the C token pasting operator <code>##</code> instead of <code>/**/</code>.)</p>
<p>Cody also added the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/robison/try.sh">try.sh</a> script.</p> <p>Cody added the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/robison/try.sh">try.sh</a> script.</p>
<div id="1989_tromp"> <div id="1989_tromp">
<h2 id="tromp"><a href="1989/tromp/index.html">1989/tromp</a></h2> <h2 id="tromp"><a href="1989/tromp/index.html">1989/tromp</a></h2>
<h3 id="source-code-tromp.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/tromp/tromp.c">tromp.c</a></h3> <h3 id="source-code-tromp.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/tromp/tromp.c">tromp.c</a></h3>
@@ -1145,10 +1148,10 @@ to <code>main()</code> but instead be a variable in <code>main()</code>.</p>
<p>Cody also fixed a segfault and made it so the that the high score file would <p>Cody also fixed a segfault and made it so the that the high score file would
work (it was not even being created but it was supposed to be). This was work (it was not even being created but it was supposed to be). This was
happening due to a file pointer being declared as a <code>long</code> and more happening due to a file pointer being declared as a <code>long</code> and more
significantly is the command in <code>popen(3)</code> was not correct.</p> significantly the command in <code>popen(3)</code> was not correct.</p>
<p>Another problem Cody fixed was that the terminal was left in an insane state where you <p>Another problem Cody fixed was that the terminal was left in an insane state where you
could not type ‘<code>u</code>’ and echo was completely disabled.</p> could not type ‘<code>u</code>’ and echo was completely disabled.</p>
<p>Cody later on fixed the alt version, provided by the author, so that it would <p>Cody later on fixed the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/tromp/tromp.alt.c">alt version</a>, provided by the author, so that it would
compile with <code>clang</code>, not abort (with an alarm), would have the tetriminos fall, compile with <code>clang</code>, not abort (with an alarm), would have the tetriminos fall,
it would write to the high score file (the command to <code>popen(3)</code> was incorrect it would write to the high score file (the command to <code>popen(3)</code> was incorrect
here too but as can be seen it differs from the submitted version), could use here too but as can be seen it differs from the submitted version), could use
@@ -1182,7 +1185,7 @@ but even getting it just about there caused compilation errors in <code>gcc</cod
might just not be possible.</p> might just not be possible.</p>
<p>The way it was fixed might be hard to see and describe but this is an attempt. <p>The way it was fixed might be hard to see and describe but this is an attempt.
Because <code>main()</code>’s args were all <code>int</code>s, <code>main()</code> had to call a new function Because <code>main()</code>’s args were all <code>int</code>s, <code>main()</code> had to call a new function
which is allowed to have args as <code>int</code> (instead of <code>main()</code>’s args being int and which is allowed to have args as <code>int</code> (instead of <code>main()</code>’s args being <code>int</code> and
the rest being <code>char **</code>) but this is not as straight forward as it is for other the rest being <code>char **</code>) but this is not as straight forward as it is for other
entries (if you look at the code you might see what is meant; the function called entries (if you look at the code you might see what is meant; the function called
is <code>pain()</code>).</p> is <code>pain()</code>).</p>
@@ -1216,11 +1219,12 @@ can work for <code>clang</code> (versions 0 and 1 can).</p>
Comments might have been changed but it is no longer known if that happened only Comments might have been changed but it is no longer known if that happened only
in the working on version 2 and 3 or if in the fix for <code>clang</code> as well as version in the working on version 2 and 3 or if in the fix for <code>clang</code> as well as version
0 and 1.</p> 0 and 1.</p>
<p>To make use of this several scripts were added by Cody.</p> <p>To make use of this several scripts were added by Cody. The
<p>The <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/westley/compile.sh">compile.sh</a> script that removes the generated <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/westley/compile.sh">compile.sh</a> script that removes the
code, rebuilds the program and regenerates the other code and then compiles it generated code, rebuilds the program and regenerates the other code and then
will work for compilers like <code>gcc</code> and one can then use the compiles it will work for compilers like <code>gcc</code> and one can then use the
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/westley/try.sh">try.sh</a> script to see example input and output.</p> <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/westley/try.sh">try.sh</a> script to see example input and
output.</p>
<p>The <code>compile.sh</code> script allows one to specify the compiler with the <code>CC</code> <p>The <code>compile.sh</code> script allows one to specify the compiler with the <code>CC</code>
environmental variable; see the index.html for details.</p> environmental variable; see the index.html for details.</p>
<div id="1990"> <div id="1990">
+61 -58
View File
@@ -153,12 +153,13 @@ This was fixed on 30 October 2023 after the bug status was changed from INABIAF
[Cody](#cody) provided an [alternate version](%%REPO_URL%%/1984/mullender/mullender.alt.c), [Cody](#cody) provided an [alternate version](%%REPO_URL%%/1984/mullender/mullender.alt.c),
an improved version of the judges, so that everyone can enjoy it with systems an improved version of the judges, so that everyone can enjoy it with systems
that are not VAX/PDP. It moves at approximately the same speed as the original that are not VAX/PDP. It moves at approximately the same speed as the original
did. We also refer you to the [FAQ](faq.html) as there are some winning entries did. By using one or more of the other entries that actually let one enjoy this entry as
that also let one enjoy it (which through trial and error was how the right originally written, Cody was able to find, with trial and error, approximately
speed was discovered) - with more to them of course! The difference between the the correct speed.
original is that it will start over after it times out but that might not happen
with the original (might need you to press a key though this is not known for The difference between the original is that it will start over after it times
sure). out but that might not happen with the original (might need you to press a key
though this is not known for sure).
Cody also added the [gentab.c](%%REPO_URL%%/1984/mullender/gentab.c) file, fixed to compile Cody also added the [gentab.c](%%REPO_URL%%/1984/mullender/gentab.c) file, fixed to compile
(and work, though see [1984/mullender in bugs.html](bugs.html#1984_mullender)) with modern systems (and work, though see [1984/mullender in bugs.html](bugs.html#1984_mullender)) with modern systems
@@ -184,7 +185,7 @@ Both [Cody](#cody) and [Yusuke](#yusuke) fixed this; Yusuke got this to not cras
to work with macOS. to work with macOS.
The crash was because it destructively rewrites string literals. However with The crash was because it destructively rewrites string literals. However with
`strdup()` it's safe. `strdup(3)` it's safe.
The problem with macOS is that although it didn't crash, it printed `H????` in a The problem with macOS is that although it didn't crash, it printed `H????` in a
seemingly infinite loop, each time printing another `?`, and it probably would seemingly infinite loop, each time printing another `?`, and it probably would
@@ -192,7 +193,7 @@ have until it ran out of memory.
The fix for macOS is that there was no prototype for `execlp(3)` and macOS has The fix for macOS is that there was no prototype for `execlp(3)` and macOS has
problems with missing prototypes for some functions (this was also seen when problems with missing prototypes for some functions (this was also seen when
Cody fixed [1984/anonymous](%%REPO_URL%%/1984/anonymous/anonymous.c) for macOS as well). As Cody fixed [1984/anonymous](1984/anonymous/index.html) for macOS as well). As
this is a one-liner the include of `unistd.h` was done in the Makefile. this is a one-liner the include of `unistd.h` was done in the Makefile.
Ironically this fix was discovered through Linux! Ironically this fix was discovered through Linux!
@@ -219,7 +220,7 @@ either the default or user specified. The inspiration was the previous `try`
command he gave to have fun with finding primes that might seem unusual in a command he gave to have fun with finding primes that might seem unusual in a
way. way.
Cody also added the [try.sh](%%REPO_URL%%/1985/august/try.sh) script (which calls `primes.sh` Cody also added the [try.sh](%%REPO_URL%%/1985/august/try.sh) script (which runs `primes.sh`
whether `primes(6)` is installed or not, but it only does it once with the whether `primes(6)` is installed or not, but it only does it once with the
default value). default value).
@@ -241,7 +242,7 @@ Cody also provided the [try.alt.sh](%%REPO_URL%%/1985/lycklama/try.alt.sh) scrip
<div id="1985_shapiro"> <div id="1985_shapiro">
## [1985/shapiro](1985/lycklama/index.html) ## [1985/shapiro](1985/shapiro/index.html)
### Source code: [shapiro.c](%%REPO_URL%%/1985/shapiro/shapiro.c) ### Source code: [shapiro.c](%%REPO_URL%%/1985/shapiro/shapiro.c)
</div> </div>
@@ -296,17 +297,16 @@ were actually not what they appear: the only arg that existed in `main()` was
- The macros `C` and `V` were changed to lower case. This is because it felt - The macros `C` and `V` were changed to lower case. This is because it felt
like the `C=" ..`' part in `subr()` would be better to be upper case as it talks like the `C=" ..`' part in `subr()` would be better to be upper case as it talks
about the language. Also in the [alternate about the language. Also in the [alternate
version](%%REPO_URL%%/1985/sicherman/sicherman.c) (the first being the version](%%REPO_URL%%/1985/sicherman/sicherman.alt.c) which is in case a new
original code) which is in case a new version of `clang` ever objects to only one version of `clang` ever objects to only one arg in `main()` (which is not out of
arg in `main()` (which is not out of the realm of possibility), `main()` can the realm of possibility), `main()`, `argc` of `main()` is `C` so it
have `C` as `argc` to `main()` so it would read like it once did: `C manual` would read like it once did: `C manual` albeit with a `,` separating the two.
albeit with a `,` separating the two. The [alternate The [alternate version](%%REPO_URL%%/1985/sicherman/sicherman.alt.c) can be
version](%%REPO_URL%%/1985/sicherman/sicherman.c) can be compiled compiled in case the first does not. Originally the macros were kept the same
in case the first does not. Originally the macros were kept the same and the and the `C` in `subr()` was `c`. It feels better (in some ways) to make it so
`C` in `subr()` was `c`. It feels better (in some ways) to make it so that the that the `C` for the language is upper case though, and since it actually
`C` for the language is upper case though, and since it actually translated to translated to `/**/` it can just be `c`, not `C`. The `V` was changed to `v` to
`/**/` it can just be `c`, not `C`. The `V` was changed to `v` to be the same be the same case as `c`.
case as `c`.
- The code: - The code:
@@ -401,7 +401,7 @@ the libc function gets&#x28;3&#x29; changed to use
fgets&#x28;3&#x29;?](faq.html#faq4_1) for why this was done. fgets&#x28;3&#x29;?](faq.html#faq4_1) for why this was done.
Cody also added the [try.sh](%%REPO_URL%%/1986/hague/try.sh) script which also feeds to the Cody also added the [try.sh](%%REPO_URL%%/1986/hague/try.sh) script which also feeds to the
program the added `input.txt` file. program the `input.txt` text file that Cody added.
<div id="1986_holloway"> <div id="1986_holloway">
@@ -432,8 +432,8 @@ different compilers (different problems with different compilers in different
systems and also depending on optimisation with those compilers in those systems and also depending on optimisation with those compilers in those
systems). systems).
We give more details in the [compilers.html](1986/marshall/compilers.html) file, Cody gives more details in the [compilers.html](1986/marshall/compilers.html)
giving which compilers had which problems in which systems: the optimiser being file: which compilers had which problems in which systems: the optimiser being
enabled in one compiler let it work but broke it in the other; and disabling it enabled in one compiler let it work but broke it in the other; and disabling it
would let it work in the one that didn't work but suddenly the one that worked would let it work in the one that didn't work but suddenly the one that worked
wouldn't work. And by 'not working' it did not work in more than one way and for wouldn't work. And by 'not working' it did not work in more than one way and for
@@ -503,8 +503,8 @@ are produced.
[Cody](#cody) restored the [original [Cody](#cody) restored the [original
entry](%%REPO_URL%%/1986/stein/stein.orig.c) which was a single line. The code entry](%%REPO_URL%%/1986/stein/stein.orig.c) which was a single line. The code
being longer (in 1986 a one liner could be longer) had been split to three lines to being longer (in 1986 a one liner could be longer) had been split to three lines to
avoid problems with news and mail but as it is the 'Best one liner' it is now avoid problems with news and mail but as it is the **Best one liner** the original
one line. code is now one line.
Cody also added the [stein.sh](%%REPO_URL%%/1986/stein/stein.sh) script which runs the two Cody also added the [stein.sh](%%REPO_URL%%/1986/stein/stein.sh) script which runs the two
commands that we suggest in order to get it to show clean output. commands that we suggest in order to get it to show clean output.
@@ -521,7 +521,7 @@ noted later on, very complicated, but we encourage you to look at [original
code](%%REPO_URL%%/1986/wall/wall.orig.c), as well as below, to see how code](%%REPO_URL%%/1986/wall/wall.orig.c), as well as below, to see how
different C was in 1986. different C was in 1986.
[Yusuke](#yusuke) originally patched this to use `strdup()` on two strings and this let it [Yusuke](#yusuke) originally patched this to use `strdup(3)` on two strings and this let it
work with `gcc` - but it still required `-traditional-cpp`. work with `gcc` - but it still required `-traditional-cpp`.
If you'd like to see the difference between the version that requires If you'd like to see the difference between the version that requires
@@ -838,7 +838,7 @@ Cody also provided the [try.sh](%%REPO_URL%%/1988/dale/try.sh) script.
[Cody](#cody) fixed this to work for modern systems. The problem was that the important [Cody](#cody) fixed this to work for modern systems. The problem was that the important
function, a redefinition of `exit(3)`, was not being called in `main()`. Earlier function, a redefinition of `exit(3)`, was not being called in `main()`. Earlier
fixes that let it compile, but not work with modern systems, can be found in fixes that let it compile, but not work with modern systems, can be found in
[1988/isaak/isaak.alt.c](%%REPO_URL%%/1988/isaak/isaak.alt.c). See the [isaak.alt.c](%%REPO_URL%%/1988/isaak/isaak.alt.c). See the
index.html file for more details. index.html file for more details.
Cody also uudecoded and removed the file `isaak.encode`, putting the output in Cody also uudecoded and removed the file `isaak.encode`, putting the output in
@@ -862,20 +862,20 @@ help understand the entry, and for fun.
</div> </div>
[Cody](#cody) fixed this for modern systems. It did not compile with `clang` because it [Cody](#cody) fixed this for modern systems. It did not compile with `clang` because it
requires the second and third args of `main()` to be `char ** but even before requires the second and third args of `main()` to be `char **` but even before
that with `gcc` it printed garbage and then crashed. that with `gcc` it printed garbage and then crashed.
After fixing it for `clang` by changing the very `main()` (in fact it called After fixing it for `clang` by changing the **very recursive** `main()` (**it called
itself up to 12 times!) to call the new function `pain()` (chosen because it's a itself up to *12* times!**) to call the new function `pain()` (named such because it's a
pain that `clang` requires these args to be `char ** :-), which is just as pain that `clang` requires these args to be `char **` :-) ), which is just as
recursive, with the correct args it now works with both `gcc` and `clang`. recursive, with the correct args, it now works with both `gcc` and `clang`.
Later Cody improved the fix to make it look a bit more like the original, using To make it look as close to the original as possible, Cody made it K&R style
K&R style functions, and trying to match the format as best as possible of what functions and tried to match the format as best as possible of what
`main()` used to look like but without the full body that cannot exist as it `main()` used to look like but without the full body as that cannot exist as it
once did. The format of `pain()` is exactly like how `main()` was as it's the once did; instead, the format of `pain()` is exactly like how `main()` was as it's the
same code. Additionally, `main()` returns `!pain(...)` like `main()` used to do same code, just a `p` instead of an `m` in the name. Additionally, `main()` returns
to itself and `pain()` does now. `!pain(...)` like `main()` used to do to itself (`pain()` does as well).
<div id="1988_reddy"> <div id="1988_reddy">
@@ -998,23 +998,26 @@ entry and the alt code) anyway, it works out well.
code like: code like:
``` <!---c--> ``` <!---c-->
#define D define #define d define
#define a include #define a include
#D foo bar #d foo bar
#a <stdio.h> #a <stdio.h>
``` ```
He notes that there _is_ a way to get it (or something close to it) to work. Do Cody notes that there _is_ a way to get it (or something close to it) to work. Do
you know how? you know how?
The old `#define`s are left in to make it look like the original as much as
possible but they are not used.
Cody also provided the [try.sh](%%REPO_URL%%/1989/jar.2/try.sh) script and the Cody also provided the [try.sh](%%REPO_URL%%/1989/jar.2/try.sh) script and the
supplementary files [try.txt](1989/jar.2/try.txt), supplementary files [try.lisp](1989/jar.2/try.lisp),
[fib.lisp](%%REPO_URL%%/1989/jar.2/fib.lisp) and [fib.lisp](%%REPO_URL%%/1989/jar.2/fib.lisp) and
[chocolate_cake.lisp](%%REPO_URL%%/1989/jar.2/chocolate_cake.lisp). The `try.txt` comes [chocolate_cake.lisp](%%REPO_URL%%/1989/jar.2/chocolate_cake.lisp). The
from the author and the `fib.lisp` comes from [Yusuke](#yusuke). Cody wrote the script and `try.lisp` comes from the author and the `fib.lisp` comes from
offered us some chocolate cake :-) See index.html for details on how to use the [Yusuke](#yusuke). Cody wrote the script and offered us some chocolate cake :-)
script. See index.html for details on how to use the script.
Cody also fixed the Makefile where typing `make everything` or `make alt` would Cody also fixed the Makefile where typing `make everything` or `make alt` would
result in: result in:
@@ -1060,7 +1063,7 @@ discovered and fixed.
</div> </div>
[Cody](#cody) fixed a segfault under macOS that prevented it from working. The problem [Cody](#cody) fixed a segfault under macOS that prevented it from working. The problem
was that the int (from `#define f`) should be a long. This became apparent when was that the int (from `#define f`) should be a `long`. This became apparent when
he was using lldb and saw that the type of a pointer was too `long` :-) he was using lldb and saw that the type of a pointer was too `long` :-)
Cody also provided the [alternate version](%%REPO_URL%%/1989/paul/paul.alt.c) Cody also provided the [alternate version](%%REPO_URL%%/1989/paul/paul.alt.c)
@@ -1083,7 +1086,7 @@ made, try:
(It adds the C token pasting operator `##` instead of `/**/`.) (It adds the C token pasting operator `##` instead of `/**/`.)
Cody also added the [try.sh](%%REPO_URL%%/1989/robison/try.sh) script. Cody added the [try.sh](%%REPO_URL%%/1989/robison/try.sh) script.
<div id="1989_tromp"> <div id="1989_tromp">
@@ -1100,12 +1103,12 @@ to `main()` but instead be a variable in `main()`.
Cody also fixed a segfault and made it so the that the high score file would Cody also fixed a segfault and made it so the that the high score file would
work (it was not even being created but it was supposed to be). This was work (it was not even being created but it was supposed to be). This was
happening due to a file pointer being declared as a `long` and more happening due to a file pointer being declared as a `long` and more
significantly is the command in `popen(3)` was not correct. significantly the command in `popen(3)` was not correct.
Another problem Cody fixed was that the terminal was left in an insane state where you Another problem Cody fixed was that the terminal was left in an insane state where you
could not type '`u`' and echo was completely disabled. could not type '`u`' and echo was completely disabled.
Cody later on fixed the alt version, provided by the author, so that it would Cody later on fixed the [alt version](%%REPO_URL%%/1989/tromp/tromp.alt.c), provided by the author, so that it would
compile with `clang`, not abort (with an alarm), would have the tetriminos fall, compile with `clang`, not abort (with an alarm), would have the tetriminos fall,
it would write to the high score file (the command to `popen(3)` was incorrect it would write to the high score file (the command to `popen(3)` was incorrect
here too but as can be seen it differs from the submitted version), could use here too but as can be seen it differs from the submitted version), could use
@@ -1148,7 +1151,7 @@ might just not be possible.
The way it was fixed might be hard to see and describe but this is an attempt. The way it was fixed might be hard to see and describe but this is an attempt.
Because `main()`'s args were all `int`s, `main()` had to call a new function Because `main()`'s args were all `int`s, `main()` had to call a new function
which is allowed to have args as `int` (instead of `main()`'s args being int and which is allowed to have args as `int` (instead of `main()`'s args being `int` and
the rest being `char **`) but this is not as straight forward as it is for other the rest being `char **`) but this is not as straight forward as it is for other
entries (if you look at the code you might see what is meant; the function called entries (if you look at the code you might see what is meant; the function called
is `pain()`). is `pain()`).
@@ -1188,12 +1191,12 @@ Comments might have been changed but it is no longer known if that happened only
in the working on version 2 and 3 or if in the fix for `clang` as well as version in the working on version 2 and 3 or if in the fix for `clang` as well as version
0 and 1. 0 and 1.
To make use of this several scripts were added by Cody. To make use of this several scripts were added by Cody. The
[compile.sh](%%REPO_URL%%/1989/westley/compile.sh) script that removes the
The [compile.sh](%%REPO_URL%%/1989/westley/compile.sh) script that removes the generated generated code, rebuilds the program and regenerates the other code and then
code, rebuilds the program and regenerates the other code and then compiles it compiles it will work for compilers like `gcc` and one can then use the
will work for compilers like `gcc` and one can then use the [try.sh](%%REPO_URL%%/1989/westley/try.sh) script to see example input and
[try.sh](%%REPO_URL%%/1989/westley/try.sh) script to see example input and output. output.
The `compile.sh` script allows one to specify the compiler with the `CC` The `compile.sh` script allows one to specify the compiler with the `CC`
environmental variable; see the index.html for details. environmental variable; see the index.html for details.