add hack-a-round for language specified markdown code blocks
When language is specified in a markdown code block such as:
````
```c
printf("Hello, world!\n");
```
````
is used, the resulting HTML as produced by `pandoc(1)` combined
with our revised `ioccc.css` is not intent the code block well.
A temporary "_hack-a-round_" is to turn the "markdown code language
specifier" into an HTML comment. For example:
````
```<!---c-->
printf("Hello, world!\n");
```
````
This commits turns off existing markdown code language specifiers
for now, while preserving our ability to restore them in the future
when a better "_hack-a-round_" to the "markdown code language
specifier" problem is found.
The HTML impact if this "_hack-a-round_" is to produce HTML that
looks like this:
```
<pre class="<!---c-->"><code> .. </code></pre>
```
We might be able to create a complex set of classes for each markdown
code language (there won't be very many) in `ioccc.css`, or we might
find a more general CSS (or maybe `pandoc(1)`?) solution.
For now, this hack-a-round will have to do.
This commit is contained in:
1 parent
3919df50fb
commit
b66c79254a
700 files changed
+7052
-7056
No files matched your search
+14
-14
@@ -1,26 +1,26 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./yarng
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./yarng integer_number
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.sh
|
||||
|
||||
./yarng
|
||||
@@ -42,13 +42,13 @@ At the time of judging, some non-gcc compilers that were not fully ANSI standard
|
||||
did not compile this entry correctly. Also at that time, some gcc and egcs
|
||||
implementations ran into a problem when building the entry. Doing:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make schweikh2
|
||||
```
|
||||
|
||||
often produced an error of the form:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
gcc -ansi schweikh2.alt.c -o schweikh2.alt
|
||||
as: Error: cca00NzV.s, line 58: Missing " at end of string
|
||||
"
|
||||
@@ -58,20 +58,20 @@ often produced an error of the form:
|
||||
|
||||
because the line:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
#line 10 ONE(O(1,1,2,6,0,6))
|
||||
```
|
||||
|
||||
turned into the line:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
# 9 "01\012"
|
||||
```
|
||||
|
||||
(note, though, how that line is on line 11) which caused gcc to give to the
|
||||
assembler the following two lines:
|
||||
|
||||
```asm
|
||||
```<!---asm-->
|
||||
.stabs "schweikh2.c
|
||||
",132,0,0,Ltext1
|
||||
```
|
||||
@@ -80,7 +80,7 @@ and the lone `"` after the `#.file` line resulted in an assembly syntax error.
|
||||
|
||||
In some cases one had to compile using `gcc -g`:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make schweikh2 CFLAGS=-g
|
||||
```
|
||||
|
||||
@@ -105,7 +105,7 @@ still can :-) ).
|
||||
|
||||
Because of this bug, the code was changed to be instead:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
#line 10 "01\015"
|
||||
```
|
||||
|
||||
@@ -122,13 +122,13 @@ compiler error:
|
||||
|
||||
so the line:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
#line 10 "01\015"
|
||||
```
|
||||
|
||||
was changed to:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
#line 10 ONE(O(1,1,2,6,0,6))
|
||||
```
|
||||
|
||||
@@ -158,7 +158,7 @@ different values? How long would you need for an empirical test?
|
||||
|
||||
For example:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
$ ./yarng 32
|
||||
10111001010101110110010101001111
|
||||
$ ./yarng 5
|
||||
|
||||
+25
-25
@@ -141,16 +141,16 @@ Location: <a href="../../location.html#DE">DE</a> - <em>Federal Republic of Germ
|
||||
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> all</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make all</code></pre>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./yarng</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./yarng</code></pre>
|
||||
<p>or</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">./yarng</span> integer_number</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./yarng integer_number</code></pre>
|
||||
<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>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./yarng</span></span>
|
||||
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="co"># watch what it does</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./try.sh
|
||||
|
||||
./yarng
|
||||
# watch what it does</code></pre>
|
||||
<p>What is the difference between what is in the script and running <code>yarng</code> without
|
||||
an arg?</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
@@ -160,24 +160,24 @@ results different? Why?</p>
|
||||
<p>At the time of judging, some non-gcc compilers that were not fully ANSI standard
|
||||
did not compile this entry correctly. Also at that time, some gcc and egcs
|
||||
implementations ran into a problem when building the entry. Doing:</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="fu">make</span> schweikh2</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make schweikh2</code></pre>
|
||||
<p>often produced an error of the form:</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="fu">gcc</span> <span class="at">-ansi</span> schweikh2.alt.c <span class="at">-o</span> schweikh2.alt</span>
|
||||
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">as:</span> Error: cca00NzV.s, line 58: Missing <span class="st">" at end of string</span></span>
|
||||
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="st"> "</span></span>
|
||||
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">as:</span> Error: cca00NzV.s, line 58: malformed statement</span>
|
||||
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">***</span> Error code 1 <span class="er">(</span><span class="ex">bu21</span><span class="kw">)</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> gcc -ansi schweikh2.alt.c -o schweikh2.alt
|
||||
as: Error: cca00NzV.s, line 58: Missing " at end of string
|
||||
"
|
||||
as: Error: cca00NzV.s, line 58: malformed statement
|
||||
*** Error code 1 (bu21)</code></pre>
|
||||
<p>because the line:</p>
|
||||
<div class="sourceCode" id="cb7"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a> <span class="pp">#line 10 ONE(O(1,1,2,6,0,6))</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> #line 10 ONE(O(1,1,2,6,0,6))</code></pre>
|
||||
<p>turned into the line:</p>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a> <span class="pp"># 9 "01\012"</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> # 9 "01\012"</code></pre>
|
||||
<p>(note, though, how that line is on line 11) which caused gcc to give to the
|
||||
assembler the following two lines:</p>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode asm"><code class="sourceCode fasm"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a> .stabs <span class="st">"schweikh2.c</span></span>
|
||||
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a> ",132,0,0,Ltext1</span></code></pre></div>
|
||||
<pre class="<!---asm-->"><code> .stabs "schweikh2.c
|
||||
",132,0,0,Ltext1</code></pre>
|
||||
<p>and the lone <code>"</code> after the <code>#.file</code> line resulted in an assembly syntax error.</p>
|
||||
<p>In some cases one had to compile using <code>gcc -g</code>:</p>
|
||||
<div class="sourceCode" id="cb10"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> schweikh2 CFLAGS=-g</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make schweikh2 CFLAGS=-g</code></pre>
|
||||
<p>to trigger this error.</p>
|
||||
<p>With the proper text beyond the <code>\012</code>, it was even possible to have all kinds
|
||||
of fun adding inline assembly via <code>#line</code> directives. :-)</p>
|
||||
@@ -191,7 +191,7 @@ for that matter :-) ).</p>
|
||||
you could have emailed the author for a free pat on the back (and maybe you
|
||||
still can :-) ).</p>
|
||||
<p>Because of this bug, the code was changed to be instead:</p>
|
||||
<div class="sourceCode" id="cb11"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a> <span class="pp">#line 10 "01\015"</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> #line 10 "01\015"</code></pre>
|
||||
<p>However in 2023 it was observed that <em>it is gcc</em> (at least some versions?) that
|
||||
has a problem with the compilation of the <em>modified</em> program, giving an internal
|
||||
compiler error:</p>
|
||||
@@ -200,9 +200,9 @@ compiler error:</p>
|
||||
:12:1: warning: missing terminating " character
|
||||
:12:19: internal compiler error: invalid built-in macro "__FILE__"</code></pre>
|
||||
<p>so the line:</p>
|
||||
<div class="sourceCode" id="cb13"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a> <span class="pp">#line 10 "01\015"</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> #line 10 "01\015"</code></pre>
|
||||
<p>was changed to:</p>
|
||||
<div class="sourceCode" id="cb14"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a> <span class="pp">#line 10 ONE(O(1,1,2,6,0,6))</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> #line 10 ONE(O(1,1,2,6,0,6))</code></pre>
|
||||
<p>and now it works with both clang and gcc.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="what-this-program-does">What this program does</h3>
|
||||
@@ -223,10 +223,10 @@ bits may be specified by an argument and defaults either to <code>UINT_MAX</code
|
||||
(least likely) or <code>UINT_MAX+1</code> (most likely). Extra credit: why the
|
||||
different values? How long would you need for an empirical test?</p>
|
||||
<p>For example:</p>
|
||||
<div class="sourceCode" id="cb15"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">$</span> ./yarng 32</span>
|
||||
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">10111001010101110110010101001111</span></span>
|
||||
<span id="cb15-3"><a href="#cb15-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">$</span> ./yarng 5</span>
|
||||
<span id="cb15-4"><a href="#cb15-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">10011</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> $ ./yarng 32
|
||||
10111001010101110110010101001111
|
||||
$ ./yarng 5
|
||||
10011</code></pre>
|
||||
<h3 id="why-i-think-this-is-obfuscated">Why I think this is obfuscated</h3>
|
||||
<ul>
|
||||
<li><p>Ever seen a ‘do for … while’ loop?</p></li>
|
||||
|
||||
Reference in new issue
Block a user