Files
ioccc/2001/herrmann1/index.html
T

800 lines
33 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- END: this line ends content from: inc/top.default.html -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<link rel="stylesheet" href="../../ioccc.css">
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@100..900&display=swap" rel="stylesheet">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2001/herrmann1 - Best abuse of the C preprocessor</title>
<link rel="icon" type="image/x-icon" href="../../favicon.ico">
<meta name="description" content="2001 IOCCC entry herrmann1 - Best abuse of the C preprocessor">
<meta name="keywords" content="IOCCC, 2001, IOCCC 2001, IOCCC entry, herrmann1, Best abuse of the C preprocessor">
</head>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- END: this line ends content from: inc/head.default.html -->
<!-- -->
<!-- This web page was formed via the tool: bin/readme2index.sh -->
<!-- The content of main section of this web page came from: 2001/herrmann1/README.md -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! Do not modify this web page, instead modify the file: 2001/herrmann1/README.md !!! -->
<!-- !!! Do not modify this web page, instead modify the file: 2001/herrmann1/README.md !!! -->
<!-- !!! Do not modify this web page, instead modify the file: 2001/herrmann1/README.md !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- Markdown content was converted into HTML via the tool: bin/md2html.sh -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/topbar.default.html -->
<div class="theader">
<nav class="topbar">
<div class="container">
<div class="logo">
<a href="../../index.html" class="logo-link">
IOCCC
</a>
</div>
<div class="topbar-items">
<div class="item">
<span class="item-header">
Entries
</span>
<div class="sub-item">
<div class="outfit-font">
<a href="../../years.html" class="sub-item-link">
Winning Entries
</a>
</div>
<div class="outfit-font">
<a href="../../authors.html" class="sub-item-link">
Winning Authors
</a>
</div>
<div class="outfit-font">
<a href="../../location.html" class="sub-item-link">
Location of winning authors
</a>
</div>
<div class="outfit-font">
<a href="../../bugs.html" class="sub-item-link">
Bugs and (mis)features
</a>
</div>
</div>
</div>
<div class="item">
<span class="item-header">
Status
</span>
<div class="sub-item">
<div class="outfit-font">
<a href="../../news.html" class="sub-item-link">
IOCCC News
</a>
</div>
<div class="outfit-font">
<a href="../../status.html" class="sub-item-link">
Contest status
</a>
</div>
<div class="outfit-font">
<a href="../../next/index.html" class="sub-item-link">
Rules and Guidelines
</a>
</div>
</div>
</div>
<div class="item">
<span class="item-header">
FAQ
</span>
<div class="sub-item">
<div class="outfit-font">
<a href="../../faq.html" class="sub-item-link">
FAQ
</a>
</div>
<div class="outfit-font">
<a href="../../faq.html#submit" class="sub-item-link">
How to enter the IOCCC
</a>
</div>
<div class="outfit-font">
<a href="../../faq.html#fix_an_entry" class="sub-item-link">
Fixing IOCCC entries
</a>
</div>
<div class="outfit-font">
<a href="../../faq.html#fix_web_site" class="sub-item-link">
Fixing the website
</a>
</div>
<div class="outfit-font">
<a href="../../faq.html#fix_author" class="sub-item-link">
Updating author info
</a>
</div>
</div>
</div>
<div class="item">
<span class="item-header">
About
</span>
<div class="sub-item">
<div class="outfit-font">
<a href="../../index.html" class="sub-item-link">
IOCCC Home
</a>
</div>
<div class="outfit-font">
<a href="../../judges.html" class="sub-item-link">
The IOCCC Judges
</a>
</div>
<div class="outfit-font">
<a href="../../contact.html" class="sub-item-link">
Contacting the IOCCC
</a>
</div>
<div class="outfit-font">
<a href="../../SECURITY.html" class="sub-item-link">
IOCCC Security Policy
</a>
</div>
<div class="outfit-font">
<a href="../../thanks-for-help.html" class="sub-item-link">
Thanks for the help
</a>
</div>
<div class="outfit-font">
<a href="../../markdown.html" class="sub-item-link">
IOCCC markdown guidelines
</a>
</div>
</div>
</div>
</div>
</div>
</nav>
<div class="header-mobile-menu">
<noscript>
<a href="../../nojs-menu.html" class="topbar-js-label">
Please Enable JavaScript
</a>
</noscript>
<button id="header-open-menu-button" class="topbar-mobile-menu">
<img
src="../../png/hamburger-icon-open.png"
alt="hamburger style menu icon - open state"
width=48
height=48>
</button>
<button id="header-close-menu-button" class="hide-content">
<img
src="../../png/hamburger-icon-closed.png"
alt="hamburger style menu icon - closed state"
width=48
height=48>
</button>
<div id="mobile-menu-panel" class="hide-content">
<div class="mobile-menu-container">
<div class="mobile-menu-wrapper">
<div class="mobile-menu-item">
Entries
</div>
<div class="mobile-submenu-wrapper">
<a class="mobile-submenu-item" href="../../years.html">
Winning Entries
</a>
<a class="mobile-submenu-item" href="../../authors.html">
Authors of winning IOCCC entries
</a>
<a class="mobile-submenu-item" href="../../location.html">
Location of authors
</a>
<a class="mobile-submenu-item" href="../../bugs.html">
Bugs and (mis)features
</a>
</div>
</div>
<div class="mobile-menu-wrapper">
<div class="mobile-menu-item">
Status
</div>
<div class="mobile-submenu-wrapper">
<a class="mobile-submenu-item" href="../../status.html">
Contest status
</a>
<a class="mobile-submenu-item" href="../../next/index.html">
Rules and Guidelines
</a>
<a class="mobile-submenu-item" href="../../news.html">
IOCCC News
</a>
</div>
</div>
<div class="mobile-menu-wrapper">
<div class="mobile-menu-item">
FAQ
</div>
<div class="mobile-submenu-wrapper">
<a class="mobile-submenu-item" href="../../faq.html">
Frequently Asked Questions
</a>
<a class="mobile-submenu-item" href="../../faq.html#submit">
How to enter the IOCCC
</a>
<a class="mobile-submenu-item" href="../../faq.html#fix_an_entry">
Fixing IOCCC entries
</a>
<a class="mobile-submenu-item" href="../../faq.html#fix_web_site">
Fixing the website
</a>
<a class="mobile-submenu-item" href="../../faq.html#fix_author">
Fixing author info
</a>
</div>
</div>
<div class="mobile-menu-wrapper">
<div class="mobile-menu-item">
About
</div>
<div class="mobile-submenu-wrapper">
<a class="mobile-submenu-item" href="../../index.html">
IOCCC Home
</a>
<a class="mobile-submenu-item" href="../../judges.html">
The IOCCC Judges
</a>
<a class="mobile-submenu-item" href="../../contact.html">
Contacting the IOCCC
</a>
<a class="mobile-submenu-item" href="../../thanks-for-help.html">
Thanks for the help
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
var headerOpenMenuButton = document.getElementById("header-open-menu-button");
var headerCloseMenuButton = document.getElementById("header-close-menu-button");
var mobileMenuPanel = document.getElementById("mobile-menu-panel");
headerOpenMenuButton.addEventListener("click", () => {
headerOpenMenuButton.classList.remove("topbar-mobile-menu");
headerOpenMenuButton.classList.add("hide-content");
headerCloseMenuButton.classList.remove("hide-content");
headerCloseMenuButton.classList.add("topbar-mobile-menu");
mobileMenuPanel.classList.remove("hide-content");
mobileMenuPanel.classList.add("topbar-mobile-panel");
});
headerCloseMenuButton.addEventListener("click", () => {
headerCloseMenuButton.classList.remove("topbar-mobile-menu");
headerCloseMenuButton.classList.add("hide-content");
mobileMenuPanel.classList.add("hide-content");
mobileMenuPanel.classList.remove("topbar-mobile-panel");
headerOpenMenuButton.classList.add("topbar-mobile-menu");
headerOpenMenuButton.classList.remove("hide-content");
});
</script>
<!-- END: this line ends content from: inc/topbar.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<div class="header">
<a href="../../2011/zucker/index.html">
<img src="../../png/ioccc.png"
alt="IOCCC image by Matt Zucker"
width=300
height=110>
</a>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2001/herrmann1 - Best abuse of the C preprocessor</h2>
<h3>A Turing machine using preprocessor</h3>
</div>
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/navbar.mid.html -->
<div class="navbar">
<a class="Left" href="../dgbeards/index.html">&larr; 2001/dgbeards</a>
<a class="Left" href="../index.html">&uarr; 2001 &uarr;</a>
<a class="Left" href="../herrmann2/index.html">2001/herrmann2 &rarr;</a>
<a class="Right" href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann1/herrmann1.c">C code</a>
<a class="Right" href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann1/Makefile">Makefile</a>
<a class="Right" href="#inventory">Inventory</a>
<a class="Right" href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2001%2Fherrmann1%2Findex.html">&#x2713;</a>
</div>
<!-- END: this line ends content from: inc/navbar.mid.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<div class="content" id="content">
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content for HTML phase 20 by: bin/output-index-author.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-author.sh -->
<h2 id="author">Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Immanuel_Herrmann">Immanuel Herrmann</a><br>
Location: <a href="../../location.html#DE">DE</a> - <em>Federal Republic of Germany</em> (<em>Germany</em>)</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
<!-- END: this line ends content for HTML phase 20 by: bin/output-index-author.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- BEFORE: 1st line of markdown file: 2001/herrmann1/README.md -->
<h2 id="to-build">To build:</h2>
<pre><code> make</code></pre>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<blockquote>
<p><strong>STATUS: missing files - please provide them</strong><br>
<strong>STATUS: known bug - please help us fix</strong></p>
</blockquote>
<p>For more detailed information see <a href="../../bugs.html#2001_herrmann1">2001/herrmann1 in bugs.html</a>.</p>
<h2 id="to-use">To use:</h2>
<pre><code> ./herrmann1.sh &#39;prg=file&#39;</code></pre>
<p><strong>NOTE</strong>: this entry seems to rely on older versions of gcc for the compilation
stage and as such if you wish to see that part like it was designed you will
need an older compiler perhaps gcc 2.95.</p>
<h2 id="try">Try:</h2>
<pre><code> ./try.sh</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>There are some clear hints in the source code as to the
purpose of this program. Perhaps the only way to figure out what is
going on is to look at the differences between the runs of the C
preprocessor! Computer Science students should recognize what is going
on.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>Many cool things have been done with the preprocessor,
e.g. calculation of prime numbers or the Tower of Hanoi. However,
up to now, no one proved that the preprocessor is Turing complete,
and I wondered why. Well, the answer is simply that the
preprocessor is <em>not</em> Turing complete, at least not if the program
is preprocessed only once. This is true even if the program is
allowed to include itself. (The reason being that for a given
program, the preprocessor has only a finite number of states, plus
a stack consisting of the places which the file has been included
from. This is only a push-down automaton.)</p>
<p>Well, this entry <em>is</em> a Turing machine implemented in the
preprocessor; so of course, it has to be preprocessed several
times. Here are the main features:</p>
<ul>
<li><p>Easy to program: Write your own Turing programs in a nice
syntax.</p></li>
<li><p>Easy to debug: (some) errors in the Turing machine program will
be reported nicely. (That’s something which is not often seen in
IOCCC programs.)</p></li>
<li><p>Ultra-fast: The resulting C program will print the output in
time <code>O(n)</code>, where <code>n</code> is the length of the output. This means for
example that you can solve NP hard problems in polynomial time!
;-)</p></li>
<li><p>And best of all: During the preprocessing, watch the animated
Turing machine running over the tape and doing its work in your
terminal!</p></li>
</ul>
<h3 id="how-to-use-it">How to use it</h3>
<h4 id="for-the-impatient">For the impatient</h4>
<p>The info files <code>herrmann1.turing</code> and <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann1/herrmann1.gcd">herrmann1.gcd</a> are sample
programs for the Turing machine. For example, type</p>
<pre><code> ./herrmann1.sh &#39;prg=herrmann1.times2&#39;</code></pre>
<p>and watch the animated Turing machine multiply 8 by two (in
unary representation). Here’s a screen shot during compilation:</p>
<pre><code> /*
*
* State: st2.
*
* _ _ _ _ _ * _ _ _ _ _ _ _ _ _ _ _ _ _
* ... O O I I I I I O I I I I I O O ...
* ~ ~ ~ ~ ~ * ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
*
*
*/</code></pre>
<p>(As on real videos, you’ll see a bit of “white noise” at the
beginning and at the end.;-) After compilation has terminated,
type <code>./herrmann1</code> to see the final result. The output will be</p>
<p>Final tape:</p>
<pre><code> *
..OOIIIIIIIIIIIIIIIIOOOO..
*</code></pre>
<p>(Note that the last frame of the animation is <em>not</em> the final
result.)</p>
<p>In the previous example, the Turing machine started on the default
tape of the program <code>times2.turing</code>. To provide your own tape, type
(for example)</p>
<pre><code> ./herrmann1 prg=times2.turing tape=&quot;O O O I I I O O O&quot;</code></pre>
<p>(The <code>O</code>s and <code>I</code>s are letters, not digits.) You might prefer to
provide only a finite portion of the tape, like I did above. In
this case, the remainder of the tape is filled with <code>O</code>s. ;-)</p>
<p>If you just type:</p>
<pre><code> ./herrmann1</code></pre>
<p>and run the program, you’ll get a usage message (and the return
code will be 2).</p>
<p>Note: To get a really nice animation, you’ll need a terminal which
is able to scroll fast enough. <code>xterm</code> is not very good. The
KDE terminal <code>konsole</code> or the text console under linux are much
better. Simply try some out.</p>
<h3 id="writing-your-own-programs">Writing your own programs</h3>
<p>Now, let’s assume you want to write a program which adds 1 to a
number in unary representation. (That is, a row of I’s is
expected, and one more I is appended to the row.) Let’s call it
<code>plus1.turing</code>. Here’s what it could look like:</p>
<pre><code> /* Search beginning of number. */
#define start_O O, right, start
/* Number found. Move one step to the left. */
#define start_I I, left, st2
/* Write a I and stop */
#define st2_O I, left, stop</code></pre>
<p>Some explanations:
- The tape alphabet is always O and I.
- The states can be anything starting with “<code>st</code>”. “<code>start</code>” and
“<code>stop</code>” are the start and stop states, respectively.
- To define a state, use two lines: one for each letter on the
tape. You may omit one of the lines if the Turing machine will
never enter the state reading that letter. (In the example, the
line defining <code>st2_I</code> has been left out.)
- The order of the lines is irrelevant.
- You may use C-style comments. (Would you have guessed it?)</p>
<p>Now, the program can be used with</p>
<pre><code> ./herrmann1.sh &#39;prg=plus1.turing&#39; &#39;tape=&quot;I I I&quot;&#39;</code></pre>
<p>But what happens if no tape is provided? Up to now, the Turing
machine would start on an empty tape (that is, a tape filled with
<code>O</code>s). For many programs, this doesn’t make much sense (as is
the case for <code>plus1.turing</code>). So you might want to provide a
default tape by adding a line like</p>
<pre><code> #define tape O O O O O I I I I</code></pre>
<p>to your program.</p>
<h3 id="debugging">Debugging</h3>
<p>When writing long programs, the most common errors are to forget
to define a state or to misspell one. Let’s assume you forgot the
line</p>
<pre><code> #define start_I I, left, st2</code></pre>
<p>Remove it and type</p>
<pre><code> ./herrmann1 &#39;prg=plus1.turing&#39;</code></pre>
<p>The output will be</p>
<p>Undefined state start.</p>
<p>Tape:</p>
<pre><code> *
..OOOOOOOOIIIIOO..
*</code></pre>
<p>and the return code will be <code>1</code>. As you can see, the Turing machine
moved over the <code>O</code>s, but when it arrived at the <code>I</code> (still in state
start), the error occurred.</p>
<p>Note that other kinds of errors can cause compilation to fail.
If this happens, the build script will write the error message of
<code>gcc</code> into a file called <code>error</code> and then exit.</p>
<h3 id="what-the-build-script-does">What the build script does</h3>
<p>In principle, the build script simply runs the preprocessor over
and over again, until nothing changes anymore; then, the program
is compiled. After each preprocessing step, the script outputs the
beginning of the program; this is where the animation takes place
(except in the first and last few steps).</p>
<p>However, there’s a technical problem to overcome: Some compilers
(including <code>gcc</code>) insert a lot of white space during the
preprocessing. This is bad for two reasons. First, the animated
picture won’t look right. And second, after some time, the file
will grow too big for your hard disk. (The amount of white space
grows exponentially.) So after each preprocessing, the first thing
the build script does is remove all the unnecessary white space
using <code>sed</code>.</p>
<p>(<code>gcc</code> would even insert <code>#line</code> directives if I didn’t suppress
them with the <code>-P</code> option.)</p>
<h3 id="some-more-details">Some more details</h3>
<ul>
<li><p>The arguments passed to the build script are passed on to <code>gcc</code>
with a <code>-D</code> before. I had a slight technical problem doing this
(especially with the spaces that can appear within the tape
argument). That made the build script a bit longer.</p></li>
<li><p>It would be enough to pass the <code>#define</code>s in the first
preprocessing. The program then “remembers” them. However, it
doesn’t matter if they are passed in all pre-processes. (This
doesn’t sound very impressive, but it has required some extra
lines of code.)</p></li>
<li><p>During the preprocessing, intermediate files <code>herrmann1-1.c</code> and
<code>herrmann1-2.c</code> are generated.</p></li>
<li><p>Also, a file <code>error</code> is generated. This file is removed after
the compilation, except if <code>gcc</code> produced an error; then it contains
the error message. (I can’t let <code>gcc</code> output all its messages
directly, because the warnings would clobber the animation. I
could have made the compile script output the error file in case
of an error, but I didn’t want to make it yet longer.)</p></li>
</ul>
<h3 id="some-technical-details-obfuscations">Some technical details / obfuscations</h3>
<ul>
<li><p>The program is compressed. In the first three preprocessing
passes, it uncompresses itself and initializes the
“variables”. So if you want to understand how it works, the best
thing is to pre-process it three times and then look at it
again. (However, I wouldn’t have wasted three passes if they
weren’t needed anyway to initialize the tape in certain
cases. Find out why.)</p></li>
<li><p>The first problem I had to solve when writing this program was
to write a preprocessor program which outputs itself. Of course,
each program which doesn’t contain any preprocessor directives
is such a program, but that’s not what I needed. In fact, to do
this, the program has to include itself, but even then, it’s not
easy.</p></li>
<li><p>The next problem to solve was how to pass results of a
calculation of one preprocessing to the next one. This is done
by outputting <code>#define</code>s with the result. But there’s a problem
with this: it is impossible to output a <code>#define result xxx</code>,
where <code>xxx</code> depends on the previous value of result. Try it if you
don’t believe it. And find out what I did instead.</p></li>
<li><p>What’s a useful way to store information, especially the content
of the tape? Of course, a <code>#define tape OOIOOIOIIIIO</code> contains
the information, but then, how do you access the information?
(For example, you won’t be able to write preprocessor code which
replaces the first <code>O</code> by <code>I</code>.) My answer looks very much like the
way a stack would have been implemented in lambda calculus. (The
tape is implemented as two stacks, to be exact.) And still,
there were some technical problems to solve. Look at the program
for more details.</p></li>
<li><p>There are many other interesting things to look at, e.g. the way
to access the information in the user-provided program, the way
a non-defined state is detected, the way the picture is
produced, etc. If you want a real challenge, try to understand
what the line <code>w j k(P ## x)</code> does.</p></li>
<li><p>Due to the fact that our alphabet has only 53 ;-) letters, I had
to use many variables more than once.</p></li>
<li><p>I couldn’t refrain from doing a little bit of nasty stuff like</p></li>
</ul>
<pre><code> #define a 0&amp;0
#if !a</code></pre>
<p>Of course, it is a bit more subtle, and even useful.</p>
<ul>
<li>The layout of the source code…, well, let’s call it the
“modern art of programming” - a mixture of program-like
indenting and modern art. There are even some comments…</li>
</ul>
<h3 id="compatibility">Compatibility</h3>
<ul>
<li><p>It works with many versions of <code>gcc</code>. I tested it with versions
2.7.2.1, 2.8.1, 2.95.2, and ecgs-2.91.66. However, an old version
of <code>gcc</code> produced “internal compiler errors” (obviously not my
fault).</p></li>
<li><p>The only warnings I get tell me that I’m undefining <code>__FILE__</code> and
that preprocessing directives are not recognized within macro
args. My answer to this is “yes, I know this and it’s all
right”. With <code>-Wall</code>, I also get some warnings about <code>/*</code>
inside comments (Well, <em>I</em> like some well-placed <code>/*/*/</code>.) as
well as some suggestions where to place some more parentheses
(as if I didn’t know the operator precedence).</p></li>
<li><p>Different versions of <code>cc</code> all produced only rubbish. Apparently,
the preprocessors didn’t really work. (I don’t feel guilty
there, either. Even with very simple programs, they produced
mysterious output.)</p></li>
<li><p>For Mac-Users: It works with the C compiler of CodeWarrior (an
old version). This compiler even leaves out all that unnecessary
white space, so that no clean-up is needed. (It would be useful
to write a kind of script which does the equivalent to the build
script, so that one does not have to choose “preprocess” from
the menu over and over again. I leave this as an exercise to the
experienced Mac programmer.)</p></li>
<li><p>In the build script, I passed the <code>-P</code> option to <code>gcc</code> to suppress
the insertion of <code>#line</code> directives. If your compiler doesn’t
support this option (and does insert <code>#line</code> directives), you
should change the call to <code>sed</code> to remove them, too: Add</p></li>
</ul>
<pre><code> -e &quot;/^#line/ d&quot;</code></pre>
<p>to the <code>sed</code> parameters. Or, if your <code>#line</code> directives look like</p>
<pre><code> # 15 &quot;filename&quot;</code></pre>
<p>add</p>
<pre><code> -e &quot;/^# [0-9]/ d&quot;</code></pre>
<p>instead.</p>
<ul>
<li><p>First, I had <code>-ansi -pedantic</code> turned on, but on some systems,
the <code>stdio.h</code> is not compatible to that, so I turned it back off.</p></li>
<li><p>The build script probably needs a bash to run in. So perhaps you
have to add <code>#!/bin/bash</code> or something like this at the
beginning.</p></li>
<li><p>On SunOS, I had to remove the <code>-q</code> option from diff in the build
script.</p></li>
</ul>
<!--
Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/
-->
<!-- AFTER: last line of markdown file: 2001/herrmann1/README.md -->
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<div id="inventory">
<h1 id="inventory-for-2001herrmann1">Inventory for 2001/herrmann1</h1>
</div>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann1/herrmann1.c">herrmann1.c</a> - entry source code</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann1/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann1/herrmann1.orig.c">herrmann1.orig.c</a> - original source code</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann1/herrmann1.gcd">herrmann1.gcd</a> - GCD program as C defines</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann1/herrmann1.sh">herrmann1.sh</a> - script to run entry</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann1/herrmann1.times2">herrmann1.times2</a> - Turing program as C defines</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann1/plus1.turing">plus1.turing</a> - Turing program as C defines</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann1/try.sh">try.sh</a> - script to try entry</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="2001_herrmann1.tar.bz2">2001_herrmann1.tar.bz2</a> - download entry tarball</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann1/README.md">README.md</a> - markdown source for this web page</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann1/.entry.json">.entry.json</a> - entry summary and manifest in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann1/.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/2001/herrmann1/.path">.path</a> - directory path from top level directory</li>
<li><a href="index.html">index.html</a> - this web page</li>
</ul>
<hr style="width:10%;text-align:left;margin-left:0">
<h4>
Jump to: <a href="#">top</a>
</h4>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
<!-- END: this line ends content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
</div>
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/footer.inventory.html -->
<!--
Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/
-->
<div class="footer">
<div id="copyright"><h3>Copyright &copy; 1984-2024 by Landon Curt Noll:
<a href="https://creativecommons.org/faq/#what-does-some-rights-reserved-mean"
target="_blank"
rel="license noopener noreferrer">Some Rights Reserved</a></h3>
<p>
This work is <b>licensed by Landon Curt Noll</b> under
<b><a href="https://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1"
target="_blank"
rel="license noopener noreferrer"
style="display:inline-block;">CC BY-SA 4.0</a></b>.
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
src="../../png/cc.png"
alt="cc inside circle symbol">
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
src="../../png/by.png"
alt="person inside circle symbol">
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
src="../../png/sa.png"
alt="arrow looping back on itself inside circle symbol"><br>
You should <b>carefully review</b> the
<b><a href="https://creativecommons.org/licenses/by-sa/4.0/legalcode.en"
target="_blank"
rel="license noopener noreferrer">CC BY-SA 4.0 LEGAL CODE</a></b>
before using the licensed material.<br>
You may wish to review the
<b><a href="../../license.html"
target="_blank"
rel="license noopener noreferrer">highlights of some of the key features and terms</a></b>
of <b>CC BY-SA 4.0</b>.<br>
</p>
</div>
<div id="coda"><h3>Coda</h3>
<p>
<a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2001%2Fherrmann1%2Findex.html" rel="nofollow">Nu HTML check this web page</a><br>
<a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a><br>
</p>
</div>
</div>
<!-- END: this line ends content from: inc/footer.inventory.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->