render HTML after removing bold code
This commit is contained in:
1 parent
ec6dc7187e
commit
8a8140f089
8 files changed
+51
-66
No files matched your search
@@ -146,7 +146,7 @@ website itself. I have set up an <a href="https://ioccc.xexyl.net/2018/weasel/er
|
||||
requiring a fix.</p></li>
|
||||
<li><p>I am keeping the weasel.spec file in the entry as it was part of my
|
||||
submission but I do not explain here how to set up the build environment or how
|
||||
to build a RPM: if you know how to use <strong><code>rpmbuild</code></strong> then you should be able to
|
||||
to build a RPM: if you know how to use <strong>rpmbuild</strong> then you should be able to
|
||||
work it out. Again that’s a crazy idea but again it was there and it was part of
|
||||
the judges’ comments (which I liked a lot) which is yet another reason I kept
|
||||
it.</p></li>
|
||||
|
||||
@@ -126,9 +126,9 @@ to any other version of Snake), this file shows just how extreme cannibalism can
|
||||
get with a long snake. I made a few changes, described below, to make it easier
|
||||
to distinguish what is what.</p>
|
||||
<h1 id="examples">Examples</h1>
|
||||
<p>In the below game dumps I have replaced the bug with <strong><code>B</code></strong>, the head with
|
||||
<strong><code>H</code></strong> and where it is known, the tail with <strong><code>T</code></strong>, in order to help
|
||||
distinguish where they are. Since the head is replaced with <strong><code>H</code></strong> I have noted
|
||||
<p>In the below game dumps I have replaced the bug with <strong>B</strong>, the head with
|
||||
<strong>H</strong> and where it is known, the tail with <strong>T</strong>, in order to help
|
||||
distinguish where they are. Since the head is replaced with <strong>H</strong> I have noted
|
||||
the direction it was moving above each dump as well as at the right of the line;
|
||||
each line with a bug, the head or tail is marked with upper case text at the
|
||||
right to make it easier to find.</p>
|
||||
|
||||
@@ -441,11 +441,11 @@ including how to find the bug, head and tail of the snake, at least where it was
|
||||
documented. The first run has several dumps. The final example has the snake
|
||||
inside itself.</p>
|
||||
<h1 id="gameplay-shedding-stretching"><a name="shedding" href="#toc">Gameplay: Shedding (stretching)</a></h1>
|
||||
<p>This feature will make you grow by the value of <strong><code>SHEDS</code></strong> for every <strong><code>SHED</code></strong>
|
||||
<p>This feature will make you grow by the value of <strong>SHEDS</strong> for every <strong>SHED</strong>
|
||||
movements (the counter isn’t incremented when you eat a bug). Basically growing
|
||||
without eating a bug (stretching would be better name here).</p>
|
||||
<h1 id="gameplay-winning"><a name="winning" href="#toc">Gameplay: Winning</a></h1>
|
||||
<p>If you ever get to the <strong><code>MAXSIZE</code></strong> the game is won. You can force a win by
|
||||
<p>If you ever get to the <strong>MAXSIZE</strong> the game is won. You can force a win by
|
||||
setting the max size to a smaller value than the size you specify (or the
|
||||
default) or setting the size to higher than the default (or < 0 which will end
|
||||
up being > the max size though I suppose there might be some value that makes it
|
||||
@@ -486,7 +486,7 @@ improved over time.</p>
|
||||
the modes below.</p>
|
||||
<h2 id="photosensitive-epilepsystimulation-overload-trigger-warnings"><a name="warning" href="#toc">Photosensitive epilepsy/Stimulation overload trigger warnings</a></h2>
|
||||
<p>If you have <strong>photosensitive epilepsy please be careful</strong> especially with low values
|
||||
for both <strong><code>WAIT</code></strong> and <strong><code>EVADE</code></strong>. It appears that the <a href="https://www.epilepsysociety.org.uk/photosensitive-epilepsy#.Xjgpwi2ZOgQ">number of hertz (flashes)
|
||||
for both <strong>WAIT</strong> and <strong>EVADE</strong>. It appears that the <a href="https://www.epilepsysociety.org.uk/photosensitive-epilepsy#.Xjgpwi2ZOgQ">number of hertz (flashes)
|
||||
per second triggering seizures</a> is wide but depending on the variables it
|
||||
easily can be in the range.</p>
|
||||
<p>There are different patterns and lights flashing at different speeds so please
|
||||
@@ -674,7 +674,7 @@ gameplay modes (as shown above) but here are some general notes about a few of t
|
||||
to a value that’s better for you. Remember it’s a wait time so if you want the
|
||||
snake to move slower you have to increase the wait time!</p>
|
||||
<h2 id="evade-bug-evasion-frequency"><a name="evade" href="#toc">EVADE: Bug evasion frequency</a></h2>
|
||||
<p>For every <strong><code>EVADE</code></strong> snake movements the bug will try and find a new place to
|
||||
<p>For every <strong>EVADE</strong> snake movements the bug will try and find a new place to
|
||||
occupy. It might be very close to it and I do not ensure it’s a new place at
|
||||
all.</p>
|
||||
<p>Each time the bug is placed the counter will be reset whether from eating the
|
||||
|
||||
+21
-20
@@ -152,50 +152,51 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
|
||||
and non-zero).</p>
|
||||
<h3 id="variables">Variables:</h3>
|
||||
<ul>
|
||||
<li><p><strong><code>WAIT</code></strong><br />
|
||||
<li><p><strong>WAIT</strong><br />
|
||||
positive or negative integer that changes how long to wait for
|
||||
a key press prior to moving again. < 0 blocks which allows
|
||||
for complete control over movement at your own pace. Default
|
||||
231; you can move faster by holding down or rapidly pressing an
|
||||
arrow key.</p></li>
|
||||
<li><p><strong><code>WALLS</code></strong><br />
|
||||
<li><p><strong>WALLS</strong><br />
|
||||
whether the walls are passable or impassable. Default passable,
|
||||
1; 0 makes walls impassable where you die if you hit a wall.</p></li>
|
||||
<li><p><strong><code>EVADE</code></strong><br />
|
||||
<li><p><strong>EVADE</strong><br />
|
||||
how many movements the Snake moves before the bug (well
|
||||
insect; see notes below about why bugs) will move to
|
||||
another location in the field. Default 300; 0 disables.</p></li>
|
||||
<li><p><strong><code>SIZE</code></strong><br />
|
||||
<li><p><strong>SIZE</strong><br />
|
||||
initial size of the Snake. Note that it grows by one per
|
||||
move so at the default 5 it will not initially be 5
|
||||
characters long! < 0 is likely an immediate win.</p></li>
|
||||
<li><p><strong><code>MAXSIZE</code></strong><br />
|
||||
<li><p><strong>MAXSIZE</strong><br />
|
||||
the maximum size the Snake can become before the game is
|
||||
won. < 0 is the maximum size based on terminal dimensions;
|
||||
any other size will be capped based on the terminal
|
||||
dimensions to prevent problems. Note that when <strong><code>SIZE+GROW >= MAXSIZE</code></strong> you win <em>before</em> you grow to the full size!</p></li>
|
||||
<li><p><strong><code>GROW</code></strong><br />
|
||||
dimensions to prevent problems. Note that when <strong>SIZE+GROW >=
|
||||
MAXSIZE</strong> you win <em>before</em> you grow to the full size!</p></li>
|
||||
<li><p><strong>GROW</strong><br />
|
||||
size to grow every time you eat a bug. Default 5; negative
|
||||
values are allowed. ‘Negativity’ creates for fun gameplay modes with
|
||||
enough creativity. See <a href="gameplay.html">gameplay.html</a>
|
||||
GitHub) as well as <a href="play.sh">play.sh</a> for some examples.</p></li>
|
||||
<li><p><strong><code>SHED</code></strong><br />
|
||||
every <strong><code>SHED</code></strong> movements you will grow (> 0), shrink (< 0) or
|
||||
stay the same length (0) by the <strong><code>SHEDS</code></strong> (below) value. Again
|
||||
<li><p><strong>SHED</strong><br />
|
||||
every <strong>SHED</strong> movements you will grow (> 0), shrink (< 0) or
|
||||
stay the same length (0) by the <strong>SHEDS</strong> (below) value. Again
|
||||
with creativity you can create some fun gameplay modes. NOTE:
|
||||
the concept of shedding in this game is a misnomer; see notes
|
||||
below.</p></li>
|
||||
<li><p><strong><code>SHEDS</code></strong><br />
|
||||
every <strong><code>SHED</code></strong> movements will impact what this value means: grow
|
||||
<li><p><strong>SHEDS</strong><br />
|
||||
every <strong>SHED</strong> movements will impact what this value means: grow
|
||||
(> 0), shrink (< 0) or not at all (0). Exception: if the snake
|
||||
eats a bug the counter isn’t incremented. Again with creativity
|
||||
you can create some fun gameplay modes here. For instance you
|
||||
can grow upon eating a bug but shrink every <strong><code>SHED</code></strong> movements
|
||||
and then it’s a battle of whether you win by <strong><code>SIZE < 0</code></strong> or
|
||||
<strong><code>SIZE >= MAXSIZE</code></strong>. See <a href="play.sh">play.sh</a> for examples.
|
||||
can grow upon eating a bug but shrink every <strong>SHED</strong> movements
|
||||
and then it’s a battle of whether you win by <strong>SIZE < 0</strong> or
|
||||
<strong>SIZE >= MAXSIZE</strong>. See <a href="play.sh">play.sh</a> for examples.
|
||||
NOTE: the concept of shedding in this game is a misnomer; see
|
||||
notes below.</p></li>
|
||||
<li><p><strong><code>CANNIBAL</code></strong><br />
|
||||
<li><p><strong>CANNIBAL</strong><br />
|
||||
whether you can go through the Snake or not. Default is 0
|
||||
(cannot - die if you try).</p></li>
|
||||
</ul>
|
||||
@@ -260,17 +261,17 @@ some features! The variables mentioned in the to run section at the top of this
|
||||
file modify the behaviour of Snake.</p>
|
||||
<p>Here are some other features of the game:</p>
|
||||
<ul>
|
||||
<li><p>A drawing/practising mode (<strong><code>WAIT</code></strong> < 0 makes <code>timeout()</code> block).</p></li>
|
||||
<li><p>A drawing/practising mode (<strong>WAIT</strong> < 0 makes <code>timeout()</code> block).</p></li>
|
||||
<li><p>Computer plays the game (<strong>WAIT=0</strong>).<br />
|
||||
</p>
|
||||
<ul>
|
||||
<li><strong>EPILEPSY/STIMULATION OVERLOAD WARNING</strong> included in the relevant
|
||||
section (this goes for a low <strong><code>EVADE</code></strong> value too).</li>
|
||||
section (this goes for a low <strong>EVADE</strong> value too).</li>
|
||||
</ul></li>
|
||||
<li><p>Grow-Shrink mode (Positive and Negative Winning) mode (see
|
||||
<a href="gameplay.html">gameplay.html</a> for more details).</p></li>
|
||||
<li><p>The dimensions of the game (this is actually a terminal thing but I document
|
||||
how to do this and its potential pitfalls) (<strong><code>LINES</code></strong> , <strong><code>COLUMNS</code></strong>).</p></li>
|
||||
how to do this and its potential pitfalls) (<strong>LINES</strong> , <strong>COLUMNS</strong>).</p></li>
|
||||
</ul>
|
||||
<p>There are no complicated command line invocations; it’s just a matter of passing
|
||||
into the game descriptively named variables and I include a script that sets up
|
||||
@@ -482,7 +483,7 @@ a pun and every pun deserves to be shed).</p>
|
||||
<p>They grow through a process called moulting - shedding their skin (other
|
||||
creatures also moult). This takes place over some days and unlike humans snakes
|
||||
never stop growing (though growth slows down as they mature). I chose the
|
||||
variables <strong><code>SHED</code></strong> and <strong><code>SHEDS</code></strong> for simplicity and because the words are
|
||||
variables <strong>SHED</strong> and <strong>SHEDS</strong> for simplicity and because the words are
|
||||
shorter. I don’t like the words because it’s rather a misnomer but what I had
|
||||
chosen before was longer - STRETCH and STRETCHES.</p>
|
||||
<h4 id="any-other-interesting-things-about-snakes"><a name="other" href="#toc">Any other interesting things about snakes?</a></h4>
|
||||
|
||||
@@ -173,8 +173,8 @@ approximately the <code>snake_size / growth_size</code> i.e. how many bugs it
|
||||
will take to win the game. The max bugs in the <code>bugs</code> line is approximately
|
||||
<code>max_snake_size / growth_size</code> i.e. how many bugs it’ll take to win at the
|
||||
maximum (capped) snake size.</p>
|
||||
<p>If I pass in any of the variables <strong><code>GROW</code></strong>, <strong><code>MAXSIZE</code></strong>, <strong><code>SIZE</code></strong> and/or
|
||||
<strong><code>LINES</code></strong> or <strong><code>COLUMNS</code></strong> it bases its calculations on those variables. For
|
||||
<p>If I pass in any of the variables <strong>GROW</strong>, <strong>MAXSIZE</strong>, <strong>SIZE</strong> and/or
|
||||
<strong>LINES</strong> or <strong>COLUMNS</strong> it bases its calculations on those variables. For
|
||||
example:</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">terminal</span> supports cursor movement</span>
|
||||
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="ex">terminal</span> supports making cursor invisible</span>
|
||||
|
||||
@@ -424,7 +424,7 @@ so that by setting the size to -1 it went to the max unsigned value):</p>
|
||||
<div class="sourceCode" id="cb19"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> MAXSIZE=-1 ./prog</span>
|
||||
<span id="cb19-2"><a href="#cb19-2" aria-hidden="true" tabindex="-1"></a><span class="ex">memory</span> error</span>
|
||||
<span id="cb19-3"><a href="#cb19-3" aria-hidden="true" tabindex="-1"></a><span class="ex">X:0/157</span> Y:0/42 S:3/18446744073709551614 B:0</span></code></pre></div>
|
||||
<p>BTW: There are two arrays that have to be <strong><code>MAXSIZE</code></strong> (technically + 1).</p>
|
||||
<p>BTW: There are two arrays that have to be <strong>MAXSIZE</strong> (technically + 1).</p>
|
||||
<p>Is it possible that some value specified by the user could mess this up? I do
|
||||
not know but what I do know is that because it’s unsigned it can’t be negative;
|
||||
if the max size is 0 then the array size will be 1 but it won’t matter because
|
||||
|
||||
@@ -283,8 +283,7 @@ the same issue.</p>
|
||||
clang</strong> despite the fact it might appear to be gcc: no symlink and both gcc and
|
||||
clang exist but the gcc is clang which you’ll see if you run <code>gcc --version</code>.</p>
|
||||
<p>A tip and some fix methods from Cody: in the older days args to main() not given
|
||||
a type were implicit ints but when they’re required to be <code>char **</code> this can
|
||||
cause a problem. In some cases Cody was able to use a <code>char *</code> inside <code>main()</code>
|
||||
a type were implicit ints but when they’re required to be <code>char ** this can cause a problem. In some cases Cody was able to use a</code>char *<code>inside</code>main()`
|
||||
(see <a href="1989/tromp/tromp.c">1989/tromp/tromp.c</a> and
|
||||
<a href="1986/holloway">1986/holloway/holloway.c</a> for two examples though done slightly
|
||||
differently). In other cases he was able to dereference the pointers to be used
|
||||
@@ -2183,7 +2182,7 @@ used.</li>
|
||||
<p>This program supports only “Combinator-calculus style notation” of Lazy K.
|
||||
“Unlambda style” and “Iota and Jot” style are not supported.</p>
|
||||
<p>Also, it requires a space between identifiers. In short, use <code>(S K)</code> instead of
|
||||
<code>(SK)</code>, “`sk”, <code>**i*i*i*ii*i*i*ii</code>, or <code>11111100011100</code>.</p>
|
||||
<code>(SK)</code>, “`sk”, **i<em>i</em>i<em>ii</em>i<em>i</em>ii<code>, or</code>11111100011100`.</p>
|
||||
<p>Huge memory may be required to compile the program (about 300 MB on my machine).</p>
|
||||
<p>In addition, there are some limitations (and workarounds) mentioned in <a href="2013/endoh1/index.html#spoiler">Spoiler
|
||||
section</a>.</p>
|
||||
|
||||
+17
-32
@@ -181,21 +181,14 @@ be kept in:</p>
|
||||
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="dt">char</span> x <span class="op">{</span><span class="kw">sizeof</span><span class="op">(</span></span>
|
||||
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a> <span class="dt">double</span><span class="op">(%</span>s<span class="op">,%</span>D<span class="op">)(*)())</span></span></code></pre></div>
|
||||
<p>This does mean that there cannot be a second arg to <code>main()</code>
|
||||
as clang requires that to be a <code>char **</code> and the <code>char</code> redefined would not
|
||||
allow this. Some versions of clang say that <code>main()</code> must have either 0, 2 or 3
|
||||
args but these versions do not object to 1 arg. However as the <code>char</code> macro
|
||||
seems more obscure and it is possible that a new version of clang will be even
|
||||
more strict the <code>int i</code> parameter in <code>main()</code> was moved to be inside <code>main()</code>,
|
||||
set to non-zero (setting <code>i</code> to 0 will not work). This way <code>main()</code> has zero
|
||||
as clang requires that to be a <code>char ** and the</code>char<code>redefined would not allow this. Some versions of clang say that</code>main()<code>must have either 0, 2 or 3 args but these versions do not object to 1 arg. However as the</code>char<code>macro seems more obscure and it is possible that a new version of clang will be even more strict the</code>int i<code>parameter in</code>main()<code>was moved to be inside</code>main()<code>, set to non-zero (setting</code>i<code>to 0 will not work). This way</code>main()` has zero
|
||||
args.</p>
|
||||
<p>Observe how on line 29 there is a call to <code>main()</code> which does pass in a
|
||||
parameter. It has never been observed to be an error to pass in too many
|
||||
parameters to a function (<code>main()</code> or otherwise - it warns with other functions
|
||||
but does not appear to with <code>main()</code>) but only that <code>main()</code> itself has a
|
||||
certain number of args (in some versions) and that the first arg is an <code>int</code> and
|
||||
the others are <code>char **</code>s. This is why the arg was removed and the call to
|
||||
<code>main()</code> was not updated beyond what had to be done to fix it for compilers that
|
||||
do not support <code>-traditional-cpp</code>.</p>
|
||||
the others are <code>char **s. This is why the arg was removed and the call to</code>main()<code>was not updated beyond what had to be done to fix it for compilers that do not support</code>-traditional-cpp`.</p>
|
||||
<p>If the ANSI C committee or a new version of clang messes this up (both of which
|
||||
seems possible) it is easy to fix but it is hoped that this won’t happen.</p>
|
||||
<p>Originally <a href="#yusuke">Yusuke</a> supplied a patch so that this entry would compile with gcc -
|
||||
@@ -367,7 +360,7 @@ program the added <code>input.txt</code> file.</p>
|
||||
<h2 id="holloway-index.html"><a name="1986_holloway"></a><a href="1986/holloway/holloway.c">1986/holloway</a> (<a href="1986/holloway/index.html%5D">index.html</a>)</h2>
|
||||
<p><a href="#cody">Cody</a> fixed this to compile and work with clang (it already worked with gcc).
|
||||
The problem was that clang is more strict about the type of second arg to
|
||||
<code>main()</code>. However simply changing it to a <code>char **</code> and updating the <code>*s</code> to <code>**s</code>
|
||||
<code>main()</code>. However simply changing it to a <code>char ** and updating the</code>*s<code>to **s</code>
|
||||
caused a segfault. By adding a new variable, <code>char *t</code>, initialising it to <code>s</code>
|
||||
and then using <code>t</code> instead of <code>s</code> it compiles and runs successfully under clang
|
||||
and gcc.</p>
|
||||
@@ -605,11 +598,11 @@ index.html file for more details.</p>
|
||||
publication, in the remarks, to help understand the entry, and for fun.</p>
|
||||
<h2 id="phillipps-index.html"><a name="1988_phillipps"></a><a href="1988/phillipps/phillipps.c">1988/phillipps</a> (<a href="1988/phillipps/index.html%5D">index.html</a>)</h2>
|
||||
<p><a href="#cody">Cody</a> fixed this for modern systems. It did not compile with clang because it
|
||||
requires the second and third args of <code>main()</code> to be <code>char **</code> but even before
|
||||
requires the second and third args of <code>main()</code> to be `char ** but even before
|
||||
that with gcc it printed garbage and then crashed.</p>
|
||||
<p>After fixing it for clang by changing the very <code>main()</code> (in fact it called
|
||||
itself up to 12 times!) to call the new function <code>pain()</code> (chosen because it’s a
|
||||
pain that clang requires these args to be <code>char **</code> :-), 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.</p>
|
||||
<p>Later Cody improved the fix to make it look a bit more like the original, using
|
||||
K&R style functions, and trying to match the format as best as possible of what
|
||||
@@ -771,25 +764,19 @@ might just not be possible.</p>
|
||||
<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
|
||||
which is allowed to have args as <code>int</code> (instead of <code>main()</code>’s args being int and
|
||||
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
|
||||
is <code>pain()</code>).</p>
|
||||
the rest being <code>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 is</code>pain()`).</p>
|
||||
<p>The args of <code>main()</code> had to be set to the right type but only three args, <strong>not
|
||||
four</strong>, even though the original program has four args. This is because not all
|
||||
versions of clang support four args and that is one of the issues with version 2
|
||||
and 3 as it generates <code>main()</code> to have four args and the wrong type, all <code>int</code>s.</p>
|
||||
<p>In the call to the new function, <code>pain()</code>, from <code>main()</code>, one of the <code>char **</code>s
|
||||
is used twice, once as <code>argc</code> with bitwise AND with 2, naturally first being
|
||||
cast to an <code>int</code> (<code>(int)ABBA&2</code>), and once as a <code>char **</code>, the fourth arg to
|
||||
<p>In the call to the new function, <code>pain()</code>, from <code>main()</code>, one of the <code>char **s is used twice, once as</code>argc<code>with bitwise AND with 2, naturally first being cast to an</code>int<code>(</code>(int)ABBA&2<code>), and once as a</code>char **, the fourth arg to
|
||||
<code>pain()</code> (yes even though <code>pain()</code> takes all <code>int</code>s).</p>
|
||||
<p>The argc,, meanwhile, <code>tang</code>, is used once and the second arg, <code>char **gnat</code> is
|
||||
used once (observe how <code>tang</code> is <code>gnat</code> spelt backwards as this is one of the
|
||||
things that makes this a masterpiece and very hard if not impossible to fix
|
||||
completely). Fortunately it is not actually necessary to use all four args (of
|
||||
<code>main()</code>) in the call which might or might not be surprising, especially as it
|
||||
uses one of the args, a <code>char **</code>, instead of an <code>int</code> (through casts), twice
|
||||
rather than just passing in for the fourth arg (the fourth arg passed in is the
|
||||
third arg to <code>main()</code>).</p>
|
||||
uses one of the args, a <code>char **, instead of an</code>int<code>(through casts), twice rather than just passing in for the fourth arg (the fourth arg passed in is the third arg to</code>main()`).</p>
|
||||
<p>This program heavily uses recursion and depending on the number of args it will
|
||||
print out output normally, ROT13 it, show it backwards or both. Along with the
|
||||
ROT13 and reversed output of the code, it is the <strong>comments that create the
|
||||
@@ -1246,7 +1233,8 @@ new char arrays (always cleared in the beginning of the loop) and then using
|
||||
both numbers (using <code>"%o %o"</code> does not solve the problem).</p>
|
||||
<h2 id="westley-index.html-5"><a name="1992_westley"></a><a href="1992/westley/westley.c">1992/westley</a> (<a href="1992/westley/index.html%5D">index.html</a>)</h2>
|
||||
<p><a href="#cody">Cody</a> fixed this to work for clang by changing the third and fourth arg of
|
||||
<code>main()</code> to be <code>char **</code> inside <code>main()</code>; clang requires args 2 - 4 to be <code>char **</code> and some versions do not even allow a fourth arg.</p>
|
||||
<code>main()</code> to be <code>char ** inside</code>main()<code>; clang requires args 2 - 4 to be</code>char
|
||||
** and some versions do not even allow a fourth arg.</p>
|
||||
<p>He also added the alternate version that the author gave in the remarks that is
|
||||
specifically for the USA rather than the world. This had to be fixed for clang
|
||||
as well to make the args of <code>main()</code> be the correct type and by moving the body
|
||||
@@ -1341,13 +1329,12 @@ compile time. See the index.html for details.</p>
|
||||
<p><a href="#cody">Cody</a> made this use <code>fgets(3)</code> not <code>gets(3)</code>.</p>
|
||||
<h2 id="vanb-index.html-1"><a name="1993_vanb"></a><a href="1993/vanb/vanb.c">1993/vanb</a> (<a href="1993/vanb/index.html%5D">index.html</a>)</h2>
|
||||
<p><a href="#cody">Cody</a> fixed this to work with clang. The problem was that the third arg to main()
|
||||
was not a <code>char **</code>. Instead <code>O5()</code> (which was <code>main()</code> via <code>-DO5=main</code>) is now
|
||||
was not a <code>char **. Instead</code>O5()<code>(which was</code>main()<code>via</code>-DO5=main`) is now
|
||||
its own function which main() calls with the right parameters.</p>
|
||||
<p>Later Cody fixed it again to look much more like the original where only a
|
||||
single line is added, that of <code>main()</code>, which calls <code>O5()</code>. This was done through
|
||||
<code>-include stdio.h</code> at the compiler (in the Makefile) and by removing the <code>O3</code>
|
||||
variable (an int) at the top of the file, instead making it a <code>char **</code> in
|
||||
<code>main()</code> (<code>O5()</code> had three args) but then passing in <code>0</code> to <code>O5()</code> for the third
|
||||
variable (an int) at the top of the file, instead making it a <code>char ** in</code>main()<code>(</code>O5()<code>had three args) but then passing in</code>0<code>to</code>O5()` for the third
|
||||
arg (as it was 0 at file scope already this is perfectly fine and it means
|
||||
there’s no need to cast it to an int in the function call though that would also
|
||||
work).</p>
|
||||
@@ -1988,7 +1975,7 @@ compiler that does not support this would not work. Thus we use the modification
|
||||
by Yusuke.</p>
|
||||
<h2 id="cheong-index.html"><a name="2001_cheong"></a><a href="2001/cheong/cheong.c">2001/cheong</a> (<a href="2001/cheong/index.html%5D">index.html</a>)</h2>
|
||||
<p><a href="#cody">Cody</a> fixed this to work with clang by adding another function that is allowed to
|
||||
have a third arg as an int, not a <code>char **</code>. He chose <code>pain()</code> because it’s a four
|
||||
have a third arg as an int, not a <code>char **. He chose</code>pain()` because it’s a four
|
||||
letter word that would match the format and because it’s pain that clang forces
|
||||
this. :-) This fix makes a point of the author’s notes on portability no longer
|
||||
valid, BTW.</p>
|
||||
@@ -2046,9 +2033,7 @@ SC2248 (style): Prefer double quoting even when variables don't contain spec
|
||||
<h2 id="herrmann2-index.html"><a name="2001_herrmann2"></a><a href="2001/herrmann2/herrmann2.c">2001/herrmann2</a> (<a href="2001/herrmann2/index.html%5D">index.html</a>)</h2>
|
||||
<p><a href="#cody">Cody</a> fixed this to work with both 64-bit and 32-bit compilers by changing most
|
||||
of the <code>int</code>s (all but that in <code>main(int ...)</code>) to <code>long</code>s. He also fixed it to
|
||||
compile with clang by changing the args of main to be <code>int</code> and <code>char **</code>,
|
||||
respectively, and changing specific references to the <code>argv</code> arg, casting to
|
||||
<code>long</code> (was <code>int</code> but the 64-bit fix requires <code>long</code>) which was its old type.</p>
|
||||
compile with clang by changing the args of main to be <code>int</code> and <code>char **, respectively, and changing specific references to the</code>argv<code>arg, casting to</code>long<code>(was</code>int<code>but the 64-bit fix requires</code>long`) which was its old type.</p>
|
||||
<p>Cody also added the <a href="2001/herrmann2/try.sh">try.sh</a> script which might be more
|
||||
useful than any other place as the command to try is quite long with C code.</p>
|
||||
<p>For some reason the original code was missing (presumingly because it had been
|
||||
@@ -2442,7 +2427,7 @@ bugs.html</a>.</p>
|
||||
back for arrow keys in the <a href="2006/night/night.alt.c">alternate version</a>.</p>
|
||||
<h2 id="sloane-index.html"><a name="2006_sloane"></a><a href="2006/sloane/sloane.c">2006/sloane</a> (<a href="2006/sloane/index.html%5D">index.html</a>)</h2>
|
||||
<p><a href="#cody">Cody</a> fixed this entry to work with clang which has a defect with the args to
|
||||
<code>main()</code>: it requires specific types: <code>int</code> and <code>char **</code> for the first and
|
||||
<code>main()</code>: it requires specific types: <code>int</code> and `char ** for the first and
|
||||
latter args.</p>
|
||||
<p>Cody also provided the <a href="2006/sloane/sloane.alt.c">alternate version</a>, which
|
||||
allows one to see what is going on in modern systems, and which we recommend one
|
||||
@@ -2618,9 +2603,9 @@ everything, filtered through less.</p>
|
||||
<a href="2012/endoh2/find-font-table.rb">find-font-table.rb</a>.</p>
|
||||
<h2 id="grothe-index.html-1"><a name="2012_grothe"></a><a href="2012/grothe/grothe.c">2012/grothe</a> (<a href="2012/grothe/index.html">index.html</a>)</h2>
|
||||
<p><a href="#cody">Cody</a> added the <a href="2012/grothe/try.sh">try.sh</a> script.</p>
|
||||
<p>Cody also changed <code>argv</code> to be not <code>const char **</code> but <code>char **</code>, mostly out of an
|
||||
<p>Cody also changed <code>argv</code> to be not <code>const char ** but</code>char <strong>, mostly out of an
|
||||
abundance of caution in case clang, which already imposes restrictions on the
|
||||
types of args to <code>main()</code> including to do with <code>char **</code>, decides to further
|
||||
types of args to <code>main()</code> including to do with `char </strong>, decides to further
|
||||
restrict them.</p>
|
||||
<p>Cody also restored the original code from the archive.</p>
|
||||
<p>And although the URL works for now (via redirect), Cody changed the website
|
||||
|
||||
Reference in new issue
Block a user