The use of the markdown trailing whitespace to indicate
line break should NOT be done when the following line is empty.
This removes such improper use of whitespace in README.md files.
Check for executable 'westley' before compiling and only _after_
compilation (if necessary) is the source shown. This way if it's
already done (as likely the case) the result of the program will be
shown closer to the source code which is entirely the point. But even if
it's not already compiled since it's compiled first it'll have the
result closer to the source (if it fails though it'll not show the
source at all).
In addition to exiting (1) on compilation error (rather than trying to
run the program) don't use -Wall -Wextra and don't redirect stderr to
/dev/null. This way if there ever is a problem compiling it can be seen.
Another option might be to first check if the program is already
compiled but this might not be that important. This can be determined
later.
The reason for the demo is because when one looks at the code and then
sees the output at the same time it's far more beautiful and magical.
The README.md has been typo and format checked.
With this commit, the README.md files for the 1988 entries have been
checked and besides some things brought up on GitHub they should be in
good order (for now?).
By some crazy chance the winner's name was not in the README.md file:
just a corporation (which has been removed along with the address). I
was able to locate it in the author/ subdirectory in the JSON file.
Format and typo checked the README.md and also added some things to try
to explore the entry more.
As main() used K&R style I changed main() to use K&R. The function that
it became (to fix it), pain(), already has the same exact format of what
main() once was only named painfully. Since main() also had the function
on many lines, even just the return statement in the beginning, I did
this in main() but given that main() only calls pain() obviously this is
not perfect. This has been documented in the thanks file like for all
the other improvements, to keep track of it.
Format/typo check README.md.
The README.md and the Makefile were both updated. The Makefile because
of typos/unclear things. The README.md had formatting fixes and also
added the historical note about 1988 from the Makefile as it's far less
likely people will see that note versus that which is in the README.md.
Format and typo check the README.md file.
Improved the order of the alt code (displayed by the judges) and what
followed it (that might seem like it's related to the alt code when
although maybe true it still is about the entry itself).
Updated thanks file to refer to the alt code and removed myself from the
README.md (this before the far superior idea of a single file outside of
the entries existed and because some entries were missed, this one
included).
Added a section with historical notes about the entry (that is I added
the section heading and put the respective text, some of which I
previously added, under it).
This file should be in good order except perhaps a pending issue of
formatting the alternate code/to build/try sections.
This includes the thanks-for-fixes.md file where C code was actually in
the form of a diff (which happened when I was looking for the
differences to put in the file in the first place, forgetting to remove
the [-+] at the time).
There was a comment in the form of:
... the liked/allowed ...
which should instead be:
... liked/allowed ...
and this was fixed with my sgit tool like:
sgit -e 's,the \(liked/allowed or compile\),\1,g' '*Makefile'
With the make indent rule there was a typo for indent as 'intent'. This
was fixed with my sgit tool like:
sgit -e 's/no intent\( tool found\)/no indent\1/g' '*Makefile'
This is not only to help with formatting - especially important in
markdown files - but it's no longer really necessary to do it. One
might not feel the need to do it in non-markdown files but I did it
anyway to be consistent. Thus instead of showing Un*x/UN*X it shows
Unix/UNIX.
A question of whether or not it should all be the same case is another
thing entirely but if this is desired at some point it should be easy to
do anyway - with some care in case it's in formatted text.
A note about the glob: why '.' when there are C files and other file
types where it could be dangerous to modify? Because I did a git grep
first so I knew that it was safe.
The README.md pointed out that not having the file name being 'isaak.c'
(see the source code why) would cause a problem but this was fixed by
use of the '__FILE__' macro, prior my fix to the entry itself and so the
README.md now points out that this feature (some might say 'defect' or
'limitation') no longer exists.
I also updated the todo.md file as I left some things out that have to
be done. I only explicitly named one thing but when I go over them as a
final pass I will address the things in question (some will require
discussion).
This is a HUGE commit:
417 files changed, 874 insertions(+), 874 deletions(-)
As the IOCCC website now is https enabled I have updated the
'http://www.ioccc' to 'https://www.ioccc'.
There was also a typo in Makefiles where it said 'for VERY WELCOME' when
it should be 'are VERY WELCOME'.
Finally slashdot.org is also https enabled so references to
'http://slashdot' were changed to 'https://slashdot'.
This was done by my sgit tool (see https://github.com/xexyl/sgit)
like:
sgit -e 's,http://www.ioccc,https://www.ioccc,g' -e 's/for VERY WELCOME/are VERY WELCOME/g' -e .
but because I didn't have a list of files that should be modified I had
to be careful which files to commit as I had files that were changed but
not ready to be committed. Since I did it in steps, finding typos as I
went along, I actually ran sgit three times but to simplify the above
(and to show that it's possible to do more than one sed command) I made
it all as one. Since I did not have a list of files ahead of time I had
to determine what files to commit, first going through them like:
for j in $(for i in $(git status|grep modified|cut -d: -f2); do \
git grep 'https://www.ioccc' "$i"; done|cut -d: -f1|sort|uniq); \
do git diff "$j"; done|less -r
(I had to pipe through less because of a strange problem with the git
diff which appears to be because of a terminal problem maybe due to the
command above but it was all I could come up with in a very tired head.)
The above and
git status | grep modified:
showed that some C files had been modified which obviously should not be
done so I had to do:
git co '*c'
to undo those changes.
Finally to commit the correct files I did:
for i in $(git status|grep modified|cut -d: -f2); do \
git grep -E 'https://www.ioccc|https://slashdot|are VERY WELCOME' "$i"; \
done |cut -d: -f1|sort|uniq|xargs git commit -v
or so (with any formatting issues or typos here due to typos in the log
due to the terminal (in)sanity issue described).
The rule zsmall.c comment suggested that applin rule (which is done via
the ${PROG} variable which is the value of ${ENTRY} which is how every
other entry Makefile is done) was below but actually it is above.
If ${CC} is clang then add to CSILENCE -Wno-gnu-line-marker. This
unfortunately means one has to either have by default CC as clang or
they have to specify e.g.:
make clobber CC=clang everything
as CC tends to be just 'cc'.
The warning cannot be silenced with gcc and although it allows one to
use of -Wno-gnu-line-marker it has no effect other than to say it's
unrecognised because gcc (at least in some versions?) does not allow
this warning to be silenced, for whatever (invalid :-) ) reason(s). Thus
unless one explicitly says that CC=clang they will get the warning.
Still at least it's now silenced if one does indeed do CC=clang in the
compile line.
It redefines gets() to use fgets() so that the only change is an
additional #define macro.
Now the entry won't have an obnoxious warning at compiling, linking or
runtime (the most annoying kind).
The `1988/spinellis/spinellis.data` file was an artifact
from the old 1988 Makefile. It is not mentioned in the
`1988/spinellis/README.md`, nor is it needed.
This is to make it more standard which further allows one to run make on
some other source code, say because they want to try and fix an entry
but forget to update the Makefile. Or if they're the author they can not
worry about it in some cases. But since LDFLAGS is the standard way it
seems better to have the LIBS variable in the Makefile be LDFLAGS.
Maybe there is a reason to not have this and I'm happy to close this in
that case but it does seem better this way so I'm doing this commit.
As besides the entries that are not supposed to compile/cannot compile
due to architectural limitations all the entries can compile in macOS
(though some do not work - yet(? I have plans to work on more later)) it
was not necessary to not silence the warnings after all as the entries
that don't work will be easy to identify ('they don't work' :-) ) so I
can just do make CSILENCE= all in the directory of those entries which
solves the problem I had originally thought of.
Some of the Makefiles have retained other changes I had to make
yesterday to get the entries to work with clang in linux but most of
them were either not changed or were made better with the rollback of
the commit that originally silenced warnings.
Now work on silencing warnings for linux can be done.
Due to the fact we now have .orig.c files and thus the possibility of
winner.orig or prog.orig being built I have updated all the .gitignore
files so that these files ignored. This was done with the following
shell commands, for reference:
for i in $(find 19* 200* 201[0123] -mindepth 2 -maxdepth 2 -name .gitignore) ; do echo $(dirname "$i"|sed -e 's,[0-9]\{4\}/,,g').orig >> "$i"; done
for i in $(find 201[4-9] 2020 -mindepth 2 -maxdepth 2 -name .gitignore) ; do echo prog.orig >> "$i"; done
and the two commands is because it was only in 2014 that the winning
entries were renamed to prog so prog.orig is the correct glob.
Used the following script to check for warnings
not silenced via ${CSILENCE}:
```sh
find ???? -mindepth 1 -maxdepth 1 -type d | while read dir; do
(cd "$dir"; echo =-=-= "$dir" =-=-= ; csilence -v 1 clobber all ; echo ; csilence -v 1 clobber alt)
done 2>&1 | less
```
At least one entry was missing (1984/anonymous).
Some entries were removed. One such entry was not ever broken but
instead when I had renamed a file (to markdown) I forgot to update the
DATA variable in the Makefile which then broke compilation. This was
seen in the log and mistakenly believed that there was something wrong
with the entry when there wasn't. Other entries removed were not fixes
but notes.
Various README.md files have been updated for this sometimes just
formatting merely because I opened the file because for instance there
is an alternate version (many by me) that is referred to. I'd not be
surprised if more README.md files have to be updated for this much
better system but these will be found in time when I do another pass
(and some years I have not checked at all yet).
There were several fixes that needed to be made. Some were done and in
the process I discovered some fixed entries that really should be an
alternate version. That was not yet done but I have kept track of some
and will find the others - another time.
As there are more important things to do (like the jprint tool in the
mkiocccentry repo) and since I need a break I have decided to make a
pull request with the changes made.
Some README.md files had to be updated for this commit as well.
NOTE: this is just one way to fix the problem described below but it can
be modified - perhaps greatly changed - or rejected and done
differently. That being said it does isolate the entries that can be
modified except for the one by Simon Cooper as I had intended to do all
entries before a commit but I am too tired to continue and there are
more important things to be done for the IOCCC (hopefully later today).
I don't mind but I wanted to save Landon some of the work as I started
the problem even though all with good intention after Landon noted he
wanted to thank those in the README.md files.
First I would like to also apologise to any previous winners if there
was upset or concern; this was all done with the best intentions and I
know that it was a fine line but the judges' goal is to make it so
previous entries do work in modern systems so that everyone can enjoy
them. Still I am sorry if I caused any offence or anything else! I
actually agree with the situation and I had been wondering about how to
go about it too. Now for the rationale behind this update.
A couple previous winners have voiced concern about the way the thank
you notes are displayed in the README.md files I have started the work
to save Landon some of the trouble as although it was with good
intentions (and based on the note that Landon wanted to thank those who
fixed an entry) I started the problem so it seems only right that I help
rectify it. I also agree with the problem and had thought of it before,
even thinking that in some entries it needs not have any reference to
anyone but the winner! This commit has removed the thank you notes from
several entries and added a THANKS.md file.
The THANKS.md file has the rest of the entries that were fixed as well
which should if nothing else help isolate the entries that need to be
modified. Some entries actually referred to me but were not a thank you
note due to a fix; some were from winners themselves for instance.
Note that I did not update the bugs.md file or any other file that might
refer to these things in the README.md files. The bugs.md for instance
refers to adding credits to those who fix problems or provide missing
links or files to the respective README.md files and this will have to
change once the way this is done is finalised. But hopefully this is a
help to Landon so that he may also focus on the important jprint tool in
the mkiocccentry repo.
Reword a few things in README.md, add more commands to try (with some
questions)
Add INABIAF section. Added same to bugs.md and put note in Makefile
about it too: in linux the program appears to drop dump cores even
though there is no error (at least at command line?).
To match the rest of the repository with alternate code (where possible)
the file is now applin.alt.c. However the rule in the Makefile copies
the file to zsmall.c and builds it accordingly, compiling into
applin.alt.
.gitignore has had applin.alt added to it.
There was no 'To build' or 'To run' section.
The alt code is that which the judges suggested to try and understand
the code a bit more. As it was fun output and it seems instructive I
decided to add it as an alt version.
Updated .gitignore.
This is because I feel it can be interesting to see side by side what
was once allowed in C with how it has to be today without having to
extract it from the archive.
This was done quite easily with a bit of thought. I generated a script
that could be modified in vim if necessary (as it turned out to be
though some of it could have been generated too but I did not think of
everything at once and it is a hack).
This is how I generated it:
echo '#!/bin/bash' > bin/check_awards.sh ; ( while read -r g ; do echo grep "$g"; done < <(sed -e 's,_,/,g' -e 's/"/\\"/g' tmp/year-auth-prize.csv | awk -F, '{print grep "\x22" $2 "\x22" " " $1 "/" "README.md"}' ); ) >> bin/check_awards.sh
Then I I modified the file (again this was a hack to make it easier and
quicker and better for being tired too) in vim to make the grep use -Hc
so I could pipe it to 'grep :0'. This found the files without the right
award. So the final command was:
sh bin/check_awards.sh |grep :0
though I did have to edit some files several times.
For reference the script has been added to the repo too but with +x
permissions.
This change also required updating the CSV file in tmp/.