improved indentation and whitespace for markdown code blocks
All code blocks in markdown have been intended by at least 4 spaces. We add `--tab-stop=8` to all `pandoc(1)` executions in order to set a better tab stop indentation, especially for tab intended code blocks. Changed `bin/pandoc-wrapper.sh` VERSION from "1.5.3 2024-03-26" to "1.6 2024-03-31". Fixed `1991/brnstnd/sorta.README.md` so that the sorta code is code blocks. Removed unneeded paragraph group in copyright in `inc/footer.default.html`. Fixed excess whitespace after list Author on entry `index.html` page. Changed `bin/output-index-author.sh` VERSION from "1.5.2 2024-03-26" to "1.6 2024-03-31". Performed `make www` to perform the above and test under macOS. TODO: Fix the problem of the initial line of code being extra intended. TODO: Fix excess whitespace around code that is inline.
This commit is contained in:
1 parent
b84c27ce02
commit
a996f8d2b8
734 files changed
+16723
-16963
No files matched your search
+44
-45
@@ -125,18 +125,18 @@
|
||||
<h1 id="hints">HINTS</h1>
|
||||
<p>For the first program (<a href="shapiro.c">shapiro.c</a>):</p>
|
||||
<p>This is a very simple program:</p>
|
||||
<pre><code> 1. #include <stdio.h>
|
||||
2. main()
|
||||
3. {
|
||||
4. int K,L,M=0;
|
||||
5. FILE *J;
|
||||
6. J=fopen(__FILE__,"r");
|
||||
7. for(;
|
||||
8. (L=getc(J))>=0;
|
||||
9. L>='J'&&L<='J'+15 &&
|
||||
10. ((M=!M)?K=L:putchar(K-'J'|(L-'J'<<4)))
|
||||
11. );
|
||||
12. exit(0);}</code></pre>
|
||||
<pre><code> 1. #include <stdio.h>
|
||||
2. main()
|
||||
3. {
|
||||
4. int K,L,M=0;
|
||||
5. FILE *J;
|
||||
6. J=fopen(__FILE__,"r");
|
||||
7. for(;
|
||||
8. (L=getc(J))>=0;
|
||||
9. L>='J'&&L<='J'+15 &&
|
||||
10. ((M=!M)?K=L:putchar(K-'J'|(L-'J'<<4)))
|
||||
11. );
|
||||
12. exit(0);}</code></pre>
|
||||
<p>Lines 1-5 are basic stuff. Line 6 opens the source code for input. Line 7 is the
|
||||
loop. Line 8 reads in each character in the file (placed in <code>L</code>) while not >= 0.
|
||||
Line 9 is an <code>if</code> expression which filters out all characters not between <code>J</code>
|
||||
@@ -152,35 +152,34 @@ contiguous ASCII characters free for the encoding. Because of this the
|
||||
second program is mostly included as a comment. However, some of the
|
||||
characters of the encoded program are also source code for the decoder.</p>
|
||||
<h3 id="for-the-second-program-with-time.h">For the second program (with time.h):</h3>
|
||||
<pre><code> 1 #include <stdio.h>
|
||||
2 #include <time.h>
|
||||
3 #define o(j,k,m,n,l) {fprintf(j,a[k],m,n,a[l]);fflush(j);}
|
||||
4 char *a[]={"%c+------------+\n","%c+%3d %-8s+\n","seconds","minutes",
|
||||
5 "hours","%s\n","\0337\033[%d;65;H%s\0338"};
|
||||
6 int b[]={0,0,17,14,11,0};
|
||||
7 main(v,c)
|
||||
8 int v;
|
||||
9 char ** c;
|
||||
10 {
|
||||
11 char d[40],*e,f=6;
|
||||
12 time_t g;
|
||||
13 FILE *h,*i;
|
||||
14 while (--f && !pipe(d) && !fork());
|
||||
15 h=fdopen(6-f<<1,"a");
|
||||
16 i=fdopen((6-f<<1)+1,"r");
|
||||
17 for(;;){
|
||||
18 if(f){
|
||||
19 fgets(d,40,i);
|
||||
20 d[strlen(d)-1]='\0';
|
||||
21 if(*d=='0'+f){ sprintf(*c,"%s\n",d+1); o(stdout,6,6-f,d+1,0) }
|
||||
22 if(*d>'0'+f) o(h,5,d,0,0)
|
||||
23 }else{
|
||||
24 time(&g);
|
||||
25 e=asctime(localtime(&g));
|
||||
26 for(v=1;v<6;v++) o(h,v!=1&&v!=6-1,v+'0',atoi(e+b[v]),v)
|
||||
27 sleep(1);
|
||||
28 }}}
|
||||
</code></pre>
|
||||
<pre><code> 1 #include <stdio.h>
|
||||
2 #include <time.h>
|
||||
3 #define o(j,k,m,n,l) {fprintf(j,a[k],m,n,a[l]);fflush(j);}
|
||||
4 char *a[]={"%c+------------+\n","%c+%3d %-8s+\n","seconds","minutes",
|
||||
5 "hours","%s\n","\0337\033[%d;65;H%s\0338"};
|
||||
6 int b[]={0,0,17,14,11,0};
|
||||
7 main(v,c)
|
||||
8 int v;
|
||||
9 char ** c;
|
||||
10 {
|
||||
11 char d[40],*e,f=6;
|
||||
12 time_t g;
|
||||
13 FILE *h,*i;
|
||||
14 while (--f && !pipe(d) && !fork());
|
||||
15 h=fdopen(6-f<<1,"a");
|
||||
16 i=fdopen((6-f<<1)+1,"r");
|
||||
17 for(;;){
|
||||
18 if(f){
|
||||
19 fgets(d,40,i);
|
||||
20 d[strlen(d)-1]='\0';
|
||||
21 if(*d=='0'+f){ sprintf(*c,"%s\n",d+1); o(stdout,6,6-f,d+1,0) }
|
||||
22 if(*d>'0'+f) o(h,5,d,0,0)
|
||||
23 }else{
|
||||
24 time(&g);
|
||||
25 e=asctime(localtime(&g));
|
||||
26 for(v=1;v<6;v++) o(h,v!=1&&v!=6-1,v+'0',atoi(e+b[v]),v)
|
||||
27 sleep(1);
|
||||
28 }}}</code></pre>
|
||||
<p>Lines 1 and 2 have to be there. Think of <code>o</code> in line 3 as send message with
|
||||
<code>j</code>,<code>k</code> and <code>m</code> as where, format and what. Lines 4 and 5 are all the text
|
||||
strings. Line 6 is the offsets into the time string for the hours, minutes and
|
||||
@@ -206,10 +205,10 @@ to the string we just put there.</li>
|
||||
(<code>"\0337\033[%d;65;H%s\0338"</code>) If you can read VTxxx (and I read books printed
|
||||
as ANSI/VTxxx codes for fun :-) ) you know this is the sequence for:</li>
|
||||
</ol>
|
||||
<pre><code>remember where we are,
|
||||
go somewhere else,
|
||||
print the message,
|
||||
and return to where we started.</code></pre>
|
||||
<pre><code> remember where we are,
|
||||
go somewhere else,
|
||||
print the message,
|
||||
and return to where we started.</code></pre>
|
||||
<p>Line 22 says if this message is not for us (the number is bigger than ours)
|
||||
send it to <code>h</code> (up).</p>
|
||||
<p>Lines 24 to 27 are the master code. Here we get the time and convert it
|
||||
|
||||
Reference in new issue
Block a user