force use of pandoc version >= 3.1.12.2
The `bin/pandoc-wrapper.sh` tool will verify that the ssytem has a recent enough version of `pandoc(1)`. We explain why we insist on `pandoc(1)`. version >= 3.1.12.2 in comments where the $PANDOC_MIN_VERSION is set. Added `--wrap=preserve` as a default argument to `pandoc(1)`. While this change will impact every HTML file generated, we believe this will improve the ability of someone to look at the generated HTML and correlate with the original markdown. Changed `bin/pandoc-wrapper.sh` VERSION from "1.4.2 2024-03-17" to "1.4.3 2024-03-18". Performed `make www` to achieve all of the above and to generate HTML using the new `--wrap=preserve` `pandoc(1)` mode.
This commit is contained in:
1 parent
9eb7a54e9f
commit
b0b212acb1
402 files changed
+37061
-55132
No files matched your search
+160
-221
@@ -129,10 +129,9 @@
|
||||
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#James_Bonfield">James
|
||||
Bonfield</a><br> Location: <a href="../../location.html#GB">GB</a> -
|
||||
<em>United Kingdom of Great Britain and Northern Ireland</em>
|
||||
(<em>United Kingdom</em>) <br><br></li>
|
||||
<li>Name: <a href="../../authors.html#James_Bonfield">James Bonfield</a><br>
|
||||
Location: <a href="../../location.html#GB">GB</a> - <em>United Kingdom of Great Britain and Northern Ireland</em> (<em>United Kingdom</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -145,73 +144,64 @@ Bonfield</a><br> Location: <a href="../../location.html#GB">GB</a> -
|
||||
<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#2000_rince">2000 rince bugs</a>.</p>
|
||||
<p>For more detailed information see <a href="../../bugs.html#2000_rince">2000 rince 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">./rince</span> number number2</span></code></pre></div>
|
||||
<p>If <code>DISPLAY</code> is not set the program will very likely crash
|
||||
or do something different.</p>
|
||||
<p>If <code>DISPLAY</code> is not set the program will very likely crash or do something
|
||||
different.</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>
|
||||
<p>This will run the program several times with different parameters to
|
||||
show different types of things. See the author’s remarks for more
|
||||
details.</p>
|
||||
<p>This will run the program several times with different parameters to show
|
||||
different types of things. See the author’s remarks for more details.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>This program may have you going around in circles :-) Try running it
|
||||
first before reading the author’s remarks below.</p>
|
||||
<p>The judges verified the correctness of output for recent dates
|
||||
through visual observation.</p>
|
||||
<p>This program may have you going around in circles :-) Try running it first
|
||||
before reading the author’s remarks below.</p>
|
||||
<p>The judges verified the correctness of output for recent dates through visual
|
||||
observation.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="how-to-use-it">How to use it</h3>
|
||||
<p>The simplest way to run it is with no arguments. Just type:</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">./rince</span></span></code></pre></div>
|
||||
<p>You will need to have access to X windows, although it doesn’t
|
||||
require desperately high resolution and there are no known limitations
|
||||
on colour depth.</p>
|
||||
<p>The display will change slowly over time, although it may take 10
|
||||
minutes or more to be visible. For those that cannot wait that long the
|
||||
program has a built in time machine. Indeed the program knows the speed
|
||||
of light, which is used to ensure that we see the “live” pictures.
|
||||
Simply specify the fraction of a day to skip forward for each screen
|
||||
refresh. I suggest:</p>
|
||||
<p>You will need to have access to X windows, although it doesn’t require
|
||||
desperately high resolution and there are no known limitations on colour
|
||||
depth.</p>
|
||||
<p>The display will change slowly over time, although it may take 10 minutes
|
||||
or more to be visible. For those that cannot wait that long the program
|
||||
has a built in time machine. Indeed the program knows the speed of light,
|
||||
which is used to ensure that we see the “live” pictures. Simply specify
|
||||
the fraction of a day to skip forward for each screen refresh. I suggest:</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">./rince</span> 0.01</span></code></pre></div>
|
||||
<p>To display the output (still guessing?) for a given date, specify two
|
||||
arguments. The first argument is as before and the second argument is a
|
||||
Julian day number (given as a fractional component). E.g.:</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="ex">./rince</span> 0 2441193.6</span>
|
||||
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./rince</span> 0.01 2441193.6</span></code></pre></div>
|
||||
<p>A Julian day is defined to be the number of days since January 1st in
|
||||
the year <code>-4712 (4713BC)</code>, starting at 12 noon GMT.<a
|
||||
href="#fn1" class="footnote-ref" id="fnref1"
|
||||
role="doc-noteref"><sup>1</sup></a><a href="#fn2" class="footnote-ref"
|
||||
id="fnref2" role="doc-noteref"><sup>2</sup></a> To aid conversion from
|
||||
our time (GMT) to Julian day there is a supplementary program named: <a
|
||||
href="dmy2jd.c">dmy2jd.c</a>. Run it with
|
||||
<code>day_float month year</code> as arguments. See below for an
|
||||
example.</p>
|
||||
<p>A Julian day is defined to be the number of days since January 1st in the year
|
||||
<code>-4712 (4713BC)</code>, starting at 12 noon GMT.<a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a><a href="#fn2" class="footnote-ref" id="fnref2" role="doc-noteref"><sup>2</sup></a> To aid conversion from our time
|
||||
(GMT) to Julian day there is a supplementary program named:
|
||||
<a href="dmy2jd.c">dmy2jd.c</a>. Run it with <code>day_float month year</code> as arguments. See below
|
||||
for an example.</p>
|
||||
<h3 id="what-it-does">What it does</h3>
|
||||
<p>This program plots the positions of the four <a
|
||||
href="https://en.wikipedia.org/wiki/Galilean_moons">Galilean moons</a>
|
||||
of <a href="https://en.wikipedia.org/wiki/Jupiter">Jupiter</a>, as seen
|
||||
from <a href="https://en.wikipedia.org/wiki/Earth">Earth</a>. It doesn’t
|
||||
correct for your location on Earth, but I assure you that the <a
|
||||
href="https://en.wikipedia.org/wiki/Parallax#Astronomy">parallax</a> is
|
||||
minimal!</p>
|
||||
<p>The moons are labelled with Roman numerals from <code>I</code> to
|
||||
<code>IV</code>, <code>I</code> being the closest to the planet and
|
||||
<code>IV</code> being the furthest. They are:</p>
|
||||
<p>This program plots the positions of the four <a href="https://en.wikipedia.org/wiki/Galilean_moons">Galilean
|
||||
moons</a> of
|
||||
<a href="https://en.wikipedia.org/wiki/Jupiter">Jupiter</a>, as seen from
|
||||
<a href="https://en.wikipedia.org/wiki/Earth">Earth</a>. It doesn’t correct for your
|
||||
location on Earth, but I assure you that the
|
||||
<a href="https://en.wikipedia.org/wiki/Parallax#Astronomy">parallax</a> is minimal!</p>
|
||||
<p>The moons are labelled with Roman numerals from <code>I</code> to <code>IV</code>, <code>I</code> being the
|
||||
closest to the planet and <code>IV</code> being the furthest. They are:</p>
|
||||
<pre><code>I Io
|
||||
II Europa
|
||||
III Ganymede
|
||||
IV Callisto</code></pre>
|
||||
<p>Amazingly, all it takes is a pair of binoculars to see the Galilean
|
||||
moons, so the results can be experimentally checked. (Note that at
|
||||
present, the best views of Jupiter are over the autumn/winter.)</p>
|
||||
<p>The positions of the moons should be correct for binoculars, but
|
||||
possibly not if you have a telescope or if you are in the southern
|
||||
hemisphere. In that case I suggest that to get the correct image you
|
||||
look at the screen from inside the monitor whilst standing on your head.
|
||||
In case of confusion, please consult the following chart (*):</p>
|
||||
<p>Amazingly, all it takes is a pair of binoculars to see the Galilean moons,
|
||||
so the results can be experimentally checked. (Note that at present, the
|
||||
best views of Jupiter are over the autumn/winter.)</p>
|
||||
<p>The positions of the moons should be correct for binoculars, but possibly
|
||||
not if you have a telescope or if you are in the southern hemisphere. In
|
||||
that case I suggest that to get the correct image you look at the screen
|
||||
from inside the monitor whilst standing on your head. In case of
|
||||
confusion, please consult the following chart (*):</p>
|
||||
<pre><code> N
|
||||
^
|
||||
|
|
||||
@@ -221,9 +211,8 @@ In case of confusion, please consult the following chart (*):</p>
|
||||
S</code></pre>
|
||||
<p>(*) Not to scale.</p>
|
||||
<h3 id="history">History</h3>
|
||||
<p>Galileo discovered the moons in January 1610. <a
|
||||
href="https://web.archive.org/web/20001204212000/http://www-isds.jpl.nasa.gov/cwo/cwo_54ga/html/cd/galileo.htm"
|
||||
class="uri">https://web.archive.org/web/20001204212000/http://www-isds.jpl.nasa.gov/cwo/cwo_54ga/html/cd/galileo.htm</a>
|
||||
<p>Galileo discovered the moons in January 1610.
|
||||
<a href="https://web.archive.org/web/20001204212000/http://www-isds.jpl.nasa.gov/cwo/cwo_54ga/html/cd/galileo.htm" class="uri">https://web.archive.org/web/20001204212000/http://www-isds.jpl.nasa.gov/cwo/cwo_54ga/html/cd/galileo.htm</a>
|
||||
states the following:</p>
|
||||
<pre><code>By early 1610, Galileo had further improved his telescope by
|
||||
double its power, so it now enlarged objects a thousand
|
||||
@@ -257,181 +246,149 @@ Jupiter. One argument against the sun-centered theory was, if
|
||||
the Earth orbited the sun, wouldn't the moon get left behind?
|
||||
Here he could see for himself that somehow, a planet could
|
||||
orbit the sun, and not leave a moon behind!</code></pre>
|
||||
<p>Thus we can plot Galileo’s discoveries using the following three
|
||||
plots:</p>
|
||||
<div class="sourceCode" id="cb11"><pre
|
||||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./rince</span> 0 <span class="va">$(</span><span class="ex">./dmy2jd</span> 7.8 1 1610<span class="va">)</span></span>
|
||||
<p>Thus we can plot Galileo’s discoveries using the following three plots:</p>
|
||||
<div class="sourceCode" id="cb11"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./rince</span> 0 <span class="va">$(</span><span class="ex">./dmy2jd</span> 7.8 1 1610<span class="va">)</span></span>
|
||||
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./rince</span> 0 <span class="va">$(</span><span class="ex">./dmy2jd</span> 8.8 1 1610<span class="va">)</span></span>
|
||||
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./rince</span> 0 <span class="va">$(</span><span class="ex">./dmy2jd</span> 10.8 1 1610<span class="va">)</span></span></code></pre></div>
|
||||
<p>However we can go one better by seeing what Galileo would have seen
|
||||
if it wasn’t cloudy on the 9th. Try:</p>
|
||||
<div class="sourceCode" id="cb12"><pre
|
||||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./rince</span> 0 <span class="va">$(</span><span class="ex">./dmy2jd</span> 9.85 1 1610<span class="va">)</span></span></code></pre></div>
|
||||
<p>to see what he was missing out on. I wonder what he’d have made of
|
||||
that!</p>
|
||||
<p>However we can go one better by seeing what Galileo would have seen if it
|
||||
wasn’t cloudy on the 9th. Try:</p>
|
||||
<div class="sourceCode" id="cb12"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./rince</span> 0 <span class="va">$(</span><span class="ex">./dmy2jd</span> 9.85 1 1610<span class="va">)</span></span></code></pre></div>
|
||||
<p>to see what he was missing out on. I wonder what he’d have made of that!</p>
|
||||
<p>Galileo discovered the fourth moon a few days later.</p>
|
||||
<p>I’ve tried typing these dates into two Java based Jovian moon
|
||||
plotters, but both I tried had problems dealing with dates earlier than
|
||||
1900. More professional software, such as the <a
|
||||
href="http://www.bmsoftware.com/skymappro9.htm">SkyMap</a> gets these
|
||||
values correct and this compares well with the above description and
|
||||
with this IOCCC entry.</p>
|
||||
<p>The year 4713BC was chosen by <a
|
||||
href="https://en.wikipedia.org/wiki/Joseph_Justus_Scaliger">Joseph
|
||||
Justus Scaliger</a> in the 16th Century, so clearly this program has a
|
||||
long history :-) A more complete description of the origins of Julian
|
||||
Days can be found at <a
|
||||
href="https://web.archive.org/web/20001206152200/http://aa.usno.navy.mil/AA/faq/docs/millennium.html"
|
||||
class="uri">https://web.archive.org/web/20001206152200/http://aa.usno.navy.mil/AA/faq/docs/millennium.html</a>.</p>
|
||||
<p>I’ve tried typing these dates into two Java based Jovian moon plotters,
|
||||
but both I tried had problems dealing with dates earlier than 1900. More
|
||||
professional software, such as the
|
||||
<a href="http://www.bmsoftware.com/skymappro9.htm">SkyMap</a> gets these values
|
||||
correct and this compares well with the above description and with this
|
||||
IOCCC entry.</p>
|
||||
<p>The year 4713BC was chosen by <a href="https://en.wikipedia.org/wiki/Joseph_Justus_Scaliger">Joseph Justus
|
||||
Scaliger</a> in the 16th
|
||||
Century, so clearly this program has a long history :-) A more complete
|
||||
description of the origins of Julian Days can be found at
|
||||
<a href="https://web.archive.org/web/20001206152200/http://aa.usno.navy.mil/AA/faq/docs/millennium.html" class="uri">https://web.archive.org/web/20001206152200/http://aa.usno.navy.mil/AA/faq/docs/millennium.html</a>.</p>
|
||||
<h3 id="assumptions">Assumptions</h3>
|
||||
<p>This program assumes:</p>
|
||||
<ol type="1">
|
||||
<li><p>The ASCII character set is used.</p></li>
|
||||
<li><p>That an enormous comet hasn’t changed the course of Jupiter (or
|
||||
Earth!).</p></li>
|
||||
<li><p>That the date has not been specified as the gap between the <a
|
||||
href="https://en.wikipedia.org/wiki/Julian_calendar">Julian</a> and <a
|
||||
href="https://en.wikipedia.org/wiki/Gregorian_calendar">Gregorian</a>
|
||||
calendar.</p></li>
|
||||
<li><p>That the <code>DISPLAY</code> environment variable is set and the
|
||||
X display can opened. If this is not the case the program will
|
||||
crash.</p></li>
|
||||
<li><p>That an enormous comet hasn’t changed the course of Jupiter (or Earth!).</p></li>
|
||||
<li><p>That the date has not been specified as the gap between the
|
||||
<a href="https://en.wikipedia.org/wiki/Julian_calendar">Julian</a> and
|
||||
<a href="https://en.wikipedia.org/wiki/Gregorian_calendar">Gregorian</a> calendar.</p></li>
|
||||
<li><p>That the <code>DISPLAY</code> environment variable is set and the X display can opened.
|
||||
If this is not the case the program will crash.</p></li>
|
||||
<li><p>There is a year 2000BC problem :-)</p>
|
||||
<p>More specifically, the plots for dates that far back are too
|
||||
inaccurate to be of realistic use. Comparisons against <a
|
||||
href="http://www.bmsoftware.com/skymappro9.htm">SkyMap Pro</a> show that
|
||||
there is a good similarity (but not much more) up to about
|
||||
500BC.</p></li>
|
||||
<li><p>The code definitely is not portable - it will produce incorrect
|
||||
results if run from the surface of <a
|
||||
href="https://science.nasa.gov/mars/">Mars</a>.</p></li>
|
||||
<p>More specifically, the plots for dates that far back are too inaccurate to
|
||||
be of realistic use. Comparisons against <a href="http://www.bmsoftware.com/skymappro9.htm">SkyMap
|
||||
Pro</a> show that there is a good
|
||||
similarity (but not much more) up to about 500BC.</p></li>
|
||||
<li><p>The code definitely is not portable - it will produce incorrect results if
|
||||
run from the surface of <a href="https://science.nasa.gov/mars/">Mars</a>.</p></li>
|
||||
</ol>
|
||||
<h3 id="obfuscations">Obfuscations</h3>
|
||||
<p>In addition to the normal obfuscations, I feel that the code contains
|
||||
some less common tricks. Taken through the standard rounds listed in the
|
||||
<a href="../../2000/guidelines.txt">guidelines</a>, the code attempts to
|
||||
pass these as follows:</p>
|
||||
<p>In addition to the normal obfuscations, I feel that the code contains some less
|
||||
common tricks. Taken through the standard rounds listed in the
|
||||
<a href="../../2000/guidelines.txt">guidelines</a>, the code attempts to pass these as follows:</p>
|
||||
<ol type="1">
|
||||
<li><p>Look at the original source</p>
|
||||
<p>With luck, pure casual inspection should not reveal much except that
|
||||
the program contains the X Windows logo (a big clue) and contains a
|
||||
date. This date may give a clue to a few people that this is an
|
||||
astronomical program.</p>
|
||||
<p>Unfortunately I was stretched for space which meant that the large
|
||||
string constant could not be split up using a “partA” “partB” method
|
||||
which clearly limits the code layout. However the space saved by using a
|
||||
single long string constant is more than outweighed by the ability to
|
||||
further obfuscate.</p></li>
|
||||
<p>With luck, pure casual inspection should not reveal much except
|
||||
that the program contains the X Windows logo (a big clue) and
|
||||
contains a date. This date may give a clue to a few people that
|
||||
this is an astronomical program.</p>
|
||||
<p>Unfortunately I was stretched for space which meant that the
|
||||
large string constant could not be split up using a “partA”
|
||||
“partB” method which clearly limits the code layout. However the
|
||||
space saved by using a single long string constant is more than
|
||||
outweighed by the ability to further obfuscate.</p></li>
|
||||
<li><p>convert ANSI trigraphs to ASCII</p>
|
||||
<p>These are not used.</p></li>
|
||||
<li><p>C pre-process the source ignoring <code>#include</code>
|
||||
lines</p></li>
|
||||
<li><p>C pre-process the source ignoring <code>#define</code> and
|
||||
<code>#include</code> lines</p>
|
||||
<li><p>C pre-process the source ignoring <code>#include</code> lines</p></li>
|
||||
<li><p>C pre-process the source ignoring <code>#define</code> and <code>#include</code> lines</p>
|
||||
<p>This does a good job of expanding out the code, but it does not
|
||||
clarify things greatly. The use of <code>#define</code>s has been
|
||||
restricted primarily to a space-saving mechanism.</p>
|
||||
<p>Additionally, the use of <code>typedef</code>s means that the types
|
||||
used are still obscured unless further replacement edits are
|
||||
made.</p></li>
|
||||
clarify things greatly. The use of <code>#define</code>s has been restricted
|
||||
primarily to a space-saving mechanism.</p>
|
||||
<p>Additionally, the use of <code>typedef</code>s means that the types used are
|
||||
still obscured unless further replacement edits are made.</p></li>
|
||||
<li><p>Run it through a C beautifier.</p>
|
||||
<p>GNU <code>indent(1)</code> seems to do a reasonable job, provided
|
||||
that the <code>#define</code>s are expanded first. This doesn’t lay the
|
||||
algorithm particularly bare though as most of the obfuscations are not
|
||||
<p>GNU <code>indent(1)</code> seems to do a reasonable job, provided that the
|
||||
<code>#define</code>s are expanded first. This doesn’t lay the algorithm
|
||||
particularly bare though as most of the obfuscations are not
|
||||
simple code layouts.</p></li>
|
||||
<li><p>Examine the algorithm.</p>
|
||||
<p>The algorithm operates on two levels. The main visible level is by
|
||||
taking a large string and breaking this down into a series of opcodes
|
||||
(which I have termed J-code). These are then executed.</p>
|
||||
<p>To get to the real method of how it works, you need to decode the
|
||||
opcode string (which deliberately contains as many <code>;</code>,
|
||||
<code>{</code> and <code>}</code> symbols as possible), which will give
|
||||
you a <a
|
||||
href="https://en.wikipedia.org/wiki/Reverse_Polish_notation">Reverse
|
||||
Polish notation</a> chunk of mathematics.</p>
|
||||
<p>Sensible people amongst you will simply refer to the referenced book
|
||||
:-)</p></li>
|
||||
<p>The algorithm operates on two levels. The main visible level is
|
||||
by taking a large string and breaking this down into a series of
|
||||
opcodes (which I have termed J-code). These are then executed.</p>
|
||||
<p>To get to the real method of how it works, you need to decode the opcode
|
||||
string (which deliberately contains as many <code>;</code>, <code>{</code> and <code>}</code> symbols as
|
||||
possible), which will give you a <a href="https://en.wikipedia.org/wiki/Reverse_Polish_notation">Reverse Polish
|
||||
notation</a> chunk of
|
||||
mathematics.</p>
|
||||
<p>Sensible people amongst you will simply refer to the referenced book :-)</p></li>
|
||||
<li><p>Lint it.</p>
|
||||
<p>I no longer have lint, although I do have access to Purify. I’m happy
|
||||
to say that purify does not detect any memory errors or memory
|
||||
leaks.</p>
|
||||
<p>I no longer have lint, although I do have access to Purify. I’m
|
||||
happy to say that purify does not detect any memory errors or
|
||||
memory leaks.</p>
|
||||
<p>See below for compilation warnings.</p></li>
|
||||
<li><p>Compile it.</p>
|
||||
<p>I’m sorry to say that there are several warnings issued by the
|
||||
compiler.</p>
|
||||
<p>Firstly, the return type for <code>X()</code> is not specified, so it
|
||||
defaults to <code>int</code>. Horror of all horrors - this function does
|
||||
not return an integer type (it doesn’t contain any specific
|
||||
<code>return</code>s). The return value from <code>X()</code> is not
|
||||
accessed. The same problem occurs in <code>main()</code> - it does not
|
||||
return. However <code>main()</code> never exits unless there is a
|
||||
serious error.</p>
|
||||
<p>The 6th argument of <code>XDrawText</code> (which should be
|
||||
<code>XTextItem</code>) is passed as a compatible structure, but without
|
||||
casting. This is to reduce code space. A more elegant solution is to
|
||||
remove the <code>struct {...} Z</code> completely and use
|
||||
<code>XTextItem f={i-127+r/3*2,r%3+r/3+1,0,E}</code> at the start of
|
||||
<code>XDrawText</code> block. Although this is accepted by several
|
||||
compilers, it is not strict ANSI due to the non-constant initialisers. A
|
||||
pity.</p>
|
||||
<p>Note that I make use of <code>usleep()</code>. This is a POSIX call
|
||||
(it is BSD), but it’s supported on many systems. It may be implemented
|
||||
using <code>select()</code> or <code>poll()</code> if required, or as a
|
||||
final solution you can change the <code>usleep(10000)</code> to
|
||||
<code>sleep(1)</code>. To compile on systems which do not have
|
||||
<code>usleep()</code>, but do have <code>select()</code>, the following
|
||||
may suffice as an additional compiler argument:</p>
|
||||
<p>Firstly, the return type for <code>X()</code> is not specified, so it defaults to <code>int</code>.
|
||||
Horror of all horrors - this function does not return an integer type (it
|
||||
doesn’t contain any specific <code>return</code>s). The return value from <code>X()</code> is not
|
||||
accessed. The same problem occurs in <code>main()</code> - it does not return. However
|
||||
<code>main()</code> never exits unless there is a serious error.</p>
|
||||
<p>The 6th argument of <code>XDrawText</code> (which should be <code>XTextItem</code>) is
|
||||
passed as a compatible structure, but without casting. This is
|
||||
to reduce code space. A more elegant solution is to remove the
|
||||
<code>struct {...} Z</code> completely and use <code>XTextItem f={i-127+r/3*2,r%3+r/3+1,0,E}</code> at the start of <code>XDrawText</code>
|
||||
block. Although this is accepted by several compilers, it is not
|
||||
strict ANSI due to the non-constant initialisers. A pity.</p>
|
||||
<p>Note that I make use of <code>usleep()</code>. This is a POSIX call (it is BSD), but it’s
|
||||
supported on many systems. It may be implemented using <code>select()</code> or <code>poll()</code> if
|
||||
required, or as a final solution you can change the <code>usleep(10000)</code> to
|
||||
<code>sleep(1)</code>. To compile on systems which do not have <code>usleep()</code>, but do have
|
||||
<code>select()</code>, the following may suffice as an additional compiler argument:</p>
|
||||
<pre><code>-Dusleep={time_t v[2]={0,10000};select(0,0,0,0,v);}</code></pre>
|
||||
<p><code>gcc</code> complains about “unreachable code at beginning of
|
||||
switch statement”, although removing some of this code will prevent the
|
||||
algorithm from working.</p>
|
||||
<p><code>gcc</code> also suggests that I should be using extra
|
||||
parenthesis, but I’m taking this as good comment :-)</p></li>
|
||||
<p><code>gcc</code> complains about “unreachable code at beginning of switch
|
||||
statement”, although removing some of this code will prevent
|
||||
the algorithm from working.</p>
|
||||
<p><code>gcc</code> also suggests that I should be using extra parenthesis, but
|
||||
I’m taking this as good comment :-)</p></li>
|
||||
</ol>
|
||||
<p>In addition to the above, the program has the following useful(?)
|
||||
obfuscations:</p>
|
||||
<ol type="1">
|
||||
<li><p>The algorithm requires many floating point numbers (about 50).
|
||||
These are encoded as ASCII.</p></li>
|
||||
<li><p>The J-code algorithm has opcodes designed to be space saving.
|
||||
They are all one byte, but many are also considered as whitespace by the
|
||||
rules. This algorithm forms part of the same string that the floating
|
||||
point constants are embedded within. What does the <code>;</code>
|
||||
command do in J-code?</p></li>
|
||||
<li><p>The algorithm requires many floating point numbers (about 50). These are
|
||||
encoded as ASCII.</p></li>
|
||||
<li><p>The J-code algorithm has opcodes designed to be space saving. They are all
|
||||
one byte, but many are also considered as whitespace by the rules. This
|
||||
algorithm forms part of the same string that the floating point constants are
|
||||
embedded within. What does the <code>;</code> command do in J-code?</p></li>
|
||||
<li><p>The J-code language is both stack based and variable based. This
|
||||
“uncleanliness” is not ideal from a computer science angle, but when has
|
||||
cleanliness been considered as good in IOCCC? :-)</p></li>
|
||||
<li><p>Association of unconnected data by implied function usage. E.g.
|
||||
use of <code>strlen()</code> and <code>sizeof()</code> simply to return
|
||||
useful numerical values, using irrelevant arguments.</p></li>
|
||||
<li><p>As we already have a dependency on ASCII this has been abused
|
||||
further. Specifically some integer constants are specified as ASCII and
|
||||
some ASCII constants are integers. This hides the true meaning for the
|
||||
values.</p></li>
|
||||
<li><p>Red herrings: there are a couple of pieces of code whose
|
||||
appearance is just there to mislead the infirm of mind. I’ve only tried
|
||||
to include such examples in places where at first glance the code
|
||||
appears to be executed.</p></li>
|
||||
<li><p>Association of unconnected data by implied function usage. E.g. use of
|
||||
<code>strlen()</code> and <code>sizeof()</code> simply to return useful numerical values, using
|
||||
irrelevant arguments.</p></li>
|
||||
<li><p>As we already have a dependency on ASCII this has been abused further.
|
||||
Specifically some integer constants are specified as ASCII and some ASCII
|
||||
constants are integers. This hides the true meaning for the values.</p></li>
|
||||
<li><p>Red herrings: there are a couple of pieces of code whose appearance is just
|
||||
there to mislead the infirm of mind. I’ve only tried to include such examples
|
||||
in places where at first glance the code appears to be executed.</p></li>
|
||||
</ol>
|
||||
<h3 id="references">References</h3>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<section id="footnotes" class="footnotes footnotes-end-of-document"
|
||||
role="doc-endnotes">
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<section id="footnotes" class="footnotes footnotes-end-of-document" role="doc-endnotes">
|
||||
<hr />
|
||||
<ol>
|
||||
<li id="fn1"><p>Astronomical algorithms (1st ed): page 59 Jean Meeus.
|
||||
Published by Willmann-Bell Inc.<a href="#fnref1" class="footnote-back"
|
||||
role="doc-backlink">↩︎</a></p></li>
|
||||
<li id="fn2"><p>Astronomical algorithms (1st ed): pages 285-299. Jean
|
||||
Meeus. Published by Willmann-Bell Inc.<a href="#fnref2"
|
||||
class="footnote-back" role="doc-backlink">↩︎</a></p></li>
|
||||
<li id="fn1"><p>Astronomical algorithms (1st ed): page 59
|
||||
Jean Meeus. Published by Willmann-Bell Inc.<a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
|
||||
<li id="fn2"><p>Astronomical algorithms (1st ed): pages 285-299.
|
||||
Jean Meeus. Published by Willmann-Bell Inc.<a href="#fnref2" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
@@ -440,42 +397,24 @@ class="footnote-back" role="doc-backlink">↩︎</a></p></li>
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2000rince"><a name="inventory"></a>Inventory for
|
||||
2000/rince</h1>
|
||||
<h1 id="inventory-for-2000rince"><a name="inventory"></a>Inventory for 2000/rince</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/rince.c">rince.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/rince.orig.c">rince.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/dmy2jd.c">dmy2jd.c</a>
|
||||
- supplementary program source</li>
|
||||
<li><a href="2000_rince.tar.bz2">2000_rince.tar.bz2</a> - download entry
|
||||
source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/rince.c">rince.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/rince.orig.c">rince.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/dmy2jd.c">dmy2jd.c</a> - supplementary program source</li>
|
||||
<li><a href="2000_rince.tar.bz2">2000_rince.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
Reference in new issue
Block a user