Files
ioccc/1991/brnstnd/sorta.README.html
T
Landon Curt Noll c457b16358 fix all HTML headers
Renamed `ioccc.ico` to `favicon.ico`.

Correctly added use of `favicon.ico` to all constructed HTML headers.
Fixed the smart quote in HTML elements problem.

Moved HTML "DO NOT EDIT" comments down below at the bottom of the
HTML phase 1 section.  According to to the Nu Html Checker, a charset
attribute on a meta element found after the first 1024 bytes.

Changed `bin/md2html.sh` VERSION from "1.1.3 2024-03-28"
to "1.2 2024-03-30".

Improved `bin/gen-status.sh` to adjust the "status_update" value
only when the "contest_status" is changed.

Performed a `make www` to perform and test the above under macOS.
2024-03-30 22:21:45 -07:00

313 lines
14 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
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">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>The International Obfuscated C Code Contest</title>
<link rel="icon" type="image/x-icon" href="../../favicon.ico">
<meta name="description" content="sorta.README.md for 1991/brnstnd">
<meta name="keywords" content="IOCCC, 1991/brnstnd, sorta.README.md">
</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/gen-other-html.sh -->
<!-- The content of main section of this web page came from: 1991/brnstnd/sorta.README.md -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! Do not modify this web page, instead modify the file: 1991/brnstnd/sorta.README.md !!! -->
<!-- !!! Do not modify this web page, instead modify the file: 1991/brnstnd/sorta.README.md !!! -->
<!-- !!! Do not modify this web page, instead modify the file: 1991/brnstnd/sorta.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/header.default.html -->
<div class="header">
<img src="../../png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>sorta.README.md for 1991/brnstnd</h2>
</div>
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.up2index.html -->
<div class="topnav">
<a class="Left" href="index.html">&uarr; jump to index.html &uarr;</a>
</div>
<!-- END: this line ends content from: inc/topnav.up2index.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="../../index.html">IOCCC Home</a>
<a href="../../years.html">Winning Entries</a>
<a href="../../authors.html">People who have won</a>
<a href="../../location.html">Location of authors</a>
</div>
<hr>
<div class="sidenav">
<a href="../../news.html">IOCCC News</a>
<a href="../../status.html">Contest status</a>
<a href="../../faq.html#submit">How to enter the IOCCC</a>
<a href="../../faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="../../bugs.html">Bugs &amp; (mis)features</a>
<a href="../../faq.html#fix_an_entry">Fixing IOCCC entries</a>
<a href="../../faq.html#fix_web_site">Fixing the web site</a>
<a href="../../faq.html#fix_author">Fixing author info</a>
<a href="../../thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="../../judges.html">The IOCCC Judges</a>
<a href="../../contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<p>The <code>sorta</code> scripts described below can sorta be found in this directory.</p>
<h1 id="sorta.i22"><a href="sorta.i2+2">sorta.i2+2</a></h1>
<pre><code>2 2+#` [ about as basic as you can get ]ld</code></pre>
<p>This script takes 2, adds 2 to it, and prints the result (with a
newline). I get 5 on the hand-held Sinclair under ZYNIX. Let me know if
your machine produces a different result so that I can send you patches.</p>
<h1 id="sorta.iarg0"><a href="sorta.iarg0">sorta.iarg0</a></h1>
<pre><code>0A` [ take arg 0, print it ]</code></pre>
<p>This is self-explanatory.</p>
<h1 id="sorta.icalc"><a href="sorta.icalc">sorta.icalc</a></h1>
<pre><code>[D2sD3s]:Dld [ input m n, output m n m n ]ld
[2*1=d]:cld [ aux routine for :d recursion ]ld
[1=D1s&gt;1Ds_+=c]:dld [ input m n, as long as n &lt;= m double it, output m n ]ld
[D2s1s_+1s]:-ld [ input m n, output m-n n ]ld
[1=D1s&gt;1Ds_+#T=-2/D=1]:1ld [ aux routine for :@ ]ld
[1D=d2/1=1ddd1 ]:!ld
[&quot;0&quot;Td]:0ld
[DD=!1_+=0]:@ld [ input m, m assumed nonnegative, append
binary representation of m to top of s stack ]ld
[&quot;-&quot;T_]:+ld
[D0 1s&gt;=+1=@]:2ld [ input m, append - to top of s stack if m is negative,
then append binary representation of abs(m) to
top of s stack ]ld
[d1A:A2=A]:A 27182 a1&gt;=A
[d2A:A1=A]:A 3145 a2&gt;=A
D # &quot; in binary is &quot;T 1=2 `ld
1=Dd # &quot; in binary is &quot;T 1=2 `ld
1=D 1s# &quot; + &quot;T 1s#T &quot; is &quot;T + #Td `ld
1=D 1s# &quot; - &quot;T 1s#T &quot; is &quot;T _+ #Td `ld
1=D 1s# &quot; * &quot;T 1s#T &quot; is &quot;T * #Td `ld
1=D 1s# &quot; / &quot;T 1s#T &quot; is &quot;T / #Td `ld
1=D 1s# &quot; % &quot;T 1s#T &quot; is &quot;T 1=D/*_+ #Td `ld
1=D d &quot;~ &quot; #T &quot; is &quot;T D&amp; #T$ld &quot; (&quot; 1=2 &quot;)&quot;T `ld
1=D 1s# &quot; &amp; &quot;T 1s#T &quot; is &quot;T &amp;D&amp; #T$ld &quot; (&quot; 1=2 &quot;)&quot;T `ld
1=D 1s# &quot; | &quot;T 1s#T &quot; is &quot;T D&amp;1sD&amp;&amp; #T$ld &quot; (&quot; 1=2 &quot;)&quot;T `ld
1=D 1s# &quot; ^ &quot;T 1s#T &quot; is &quot;T 1=D&amp;2sD&amp;1sD&amp;&amp;&amp;D&amp; #T$ld &quot; (&quot; 1=2 &quot;)&quot;T `ld</code></pre>
<p><code>icalc</code> shows off <code>SORTA</code>’s understanding of integer arithmetic. You can run
it with up to two arguments; the arguments have default values of 27182
and 3145. Notice that <code>SORTA</code> doesn’t have a language primitive for
converting a string to a number, yet <code>icalc</code> is performing arithmetic on
its arguments. Can you see how? (Hint: Try <code>./sorta "2 2+" 3 &lt; sorta.icalc</code>.
Look at program A.) <code>icalc</code> also provides a useful binary output routine,
and if you can’t remember offhand that <code>D2sD3s&amp;2sD&amp;1sD&amp;&amp;&amp;D&amp;</code> means XOR,
you can just look it up here.</p>
<h1 id="sorta.idup"><a href="sorta.idup">sorta.idup</a></h1>
<pre><code>[ld#1_+1=y]:x
[uD1+=x]:y
0&quot;&quot;1=y`</code></pre>
<p>This script prints out the maximum file descriptor available from
repeated <code>dup(2)</code>s—usually <code>NOFILE - 1</code>. Can you see how it works?</p>
<h1 id="sorta.iecho"><a href="sorta.iecho">sorta.iecho</a></h1>
<pre><code>[&quot; &quot;$ld]:sld [ print a space ]ld
[1s1+DA$ld1s1_+D=sD=x]:xld [ given n (argc-n), print args ]ld
0a1_+D=x&quot;&quot;` [ simulation of /bin/echo ]ld</code></pre>
<p>This is a clone of <code>/bin/echo</code>, minus any argument processing and escape
interpretation. (Note that, unlike some shells’ echo, <code>/bin/echo</code> prints a
newline even with no arguments.) Try <code>./sorta foo bar &lt; iecho</code>.</p>
<h1 id="sorta.ifact1"><a href="sorta.ifact1">sorta.ifact1</a></h1>
<pre><code>1#`ld2*#`ld3*#`ld4*#`ld5*#`ld6*#`ld7*#`ld8*#`ld9*#`ld10*#`ld</code></pre>
<p>This is a very straightforward factorial program: Take 1, print it,
multiply by 2, print it, multiply by 3, print it, etc.</p>
<h1 id="sorta.ifact2"><a href="sorta.ifact2">sorta.ifact2</a></h1>
<pre><code>[1+D2s*#`ld1s]:f
1 0
1=f 1=f 1=f 1=f 1=f 1=f 1=f 1=f 1=f 1=f</code></pre>
<p><code>ifact1</code> does a lot of repeated work. <code>ifact2</code> takes advantage of this by
keeping the current <code>n!</code> <code>n</code> on the stack. Each call to routine <code>f (1=f)</code>
increments <code>n</code> by <code>1</code> and prints out the factorial.</p>
<h1 id="sorta.ifact3"><a href="sorta.ifact3">sorta.ifact3</a></h1>
<pre><code>[1+D2s*#`ld1s]:f [ given (n-1)! (n-1), print n!, put n! n ]
[2s1=f2s1_+D0&gt;=x]:x [ given n n! x, print (n+1)! through (n+x)! ]
0 1 10 1=x</code></pre>
<p>Finally, <code>ifact3</code> removes all the redundancy from <code>ifact2</code>, and exhibits
proper documentation of stack routines. You can replace the <code>10</code> by
anything in this version.</p>
<h1 id="sorta.iio"><a href="sorta.iio">sorta.iio</a></h1>
<pre><code> [ a simple example of interpreting code on the fly ]ld
[&quot;] &quot;2 2+&quot;:xT [&quot;]T &quot; produces &quot;T 1=x#T &quot; which should be 4.&quot;T`</code></pre>
<p>Notice that <code>"2 2+"</code> is a literal string inside the program.</p>
<h1 id="sorta.irot13"><a href="sorta.irot13">sorta.irot13</a></h1>
<pre><code>&quot;[] [.tr] &quot;
[&quot;]&quot;.[a-m][n-z][A-M][N-Z]&quot;[&quot; ]TTT [&quot;]&quot;.[n-z][a-m][N-Z][A-M]&quot;[&quot; ]TTT
&quot;[tr] !q&quot;T:xld
[&quot;rot13: fatal: need exactly one argument&quot;`q]:gld
[&quot;rot13: fatal: cannot open &quot;1ST`q]:hld
a2_+=g
1A 0 [ that 0 is for RDONLY ]ld
0 &#39;o D0 1s&gt;=hld
0Ou1=x [ in a more complex spawner, this would be done under a fork ]ld</code></pre>
<p>Despite its name, <code>irot13</code> is meant to show how to exec a program with
redirection from within <code>sorta</code>. You run it as <code>./sorta blah &lt; irot13</code>; it
opens <code>blah</code> and runs a (BSD-style) <code>tr</code> command to rotate all letters by 13
spots. <code>1A 0 0 o</code> opens <code>argv[1]</code>; the <code>'</code> keeps the filename around for
subroutine <code>h</code> to print a nice error message if necessary. <code>0Ou</code> closes
stdout and replaces it with the new descriptor. Finally, subroutine <code>x</code>
executes the <code>tr</code>.</p>
<h1 id="sorta.isleep"><a href="sorta.isleep">sorta.isleep</a></h1>
<pre><code>[&quot;&quot; &quot;+sleep&quot; &quot;+5&quot; &quot;sleep&quot; !q]:S [F0&gt;1_+=S]:s
&quot;forking sleep 5...&quot;`ld
1=s
&quot;waiting for sleep to finish...&quot;`ld
w
&quot;done, sleep exit code &quot; #T`</code></pre>
<p>This script illustrates the classic fork-exec-wait.</p>
<h1 id="sorta.itailrec"><a href="sorta.itailrec">sorta.itailrec</a></h1>
<pre><code>[3*#&quot; &quot;T$ldD=f]:f
1=f</code></pre>
<p>The sole purpose of this script is to prove that <code>sorta</code> can do infinite
tail recursion (in this case, in program <code>f</code>). Do <code>./sorta &lt; itailrec | more</code>
and watch the powers of 3 (mod your computer’s word size) flow by.</p>
<h1 id="sorta.iwhosort"><a href="sorta.iwhosort">sorta.iwhosort</a></h1>
<pre><code>[0Ou &quot;&quot; &quot;+-u&quot; &quot;sort&quot; !q]:S [F0&gt;1_+=S]:s
[1Ou &quot;&quot; &quot;+-u&quot; &quot;who&quot; !q]:W [F0&gt;1_+=W]:w
P1=wO1=sOww</code></pre>
<p>This final example is a simple pipeline, <code>who | sort</code>.</p>
<!--
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/
-->
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.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">
<h2>Copyright and CC BY-SA 4.0 License</h2>
<p>This file and web page is:</p>
<blockquote><b>Copyright &copy; 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></p></blockquote>
<p>You are free to share and adapt this file under the terms of this license:</p>
<blockquote><b>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</b></blockquote>
<p>For more information, see:</p>
<blockquote><a
href="https://creativecommons.org/licenses/by-sa/4.0/">https://creativecommons.org/licenses/by-sa/4.0/</a></blockquote>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=#">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->