This does not complete the alt code related headers but I noticed this
and it was easy to do quickly. Unless I run across another when I am
working on the README.md files of the entries I will probably have to do
the rest manually as I come across them as most likely the headers are
missing.
This was done as
sgit -e 's/^#### Try/### Alternate try/g' '*README.md'
As the 'Alternate code' and 'Original code' heading level is now 2 the
'To build' and 'To use' subsections should be level 3, not 4, and also
reworded, this was done:
sgit -e 's/^#### To build/### Alternate build/g' -e 's/^#### To use/### Alternate use/g' '*README.md'
Many more have to be updated and this will be done manually at another
time.
Change level 3 (###) to level 2 (##):
sgit -e 's/^### \(Alternate code\)/## \1/g' '*README.md'
which is the same as:
sgit -e 's/^### Alternate code/## Alternate code/g' '*README.md'
This is per discussion in GitHub.
As in:
sgit -e 's/# To run/# To use/g' '*README.md'
This makes consistent the message for how to use the program. 'How to
use' was chosen because one can run a program just by doing './foo' but
that doesn't imply that's how to use it but the purpose of the section
is how to use it.
We now have 6 diff rules:
diff_orig_prog
diff_prog_orig
diff_alt_prog
diff_prog_alt
diff_orig_alt
diff_alt_orig
The FAQ for these diffs needs to be updated
as we have 6 types of diffs now.
Having to click on the links in each README.md file will have to be done
to verify the links work but it appears to be in the form of:
/bugs.md#YYYYauthor-readmemd
To make sure that this looks okay before doing it for the rest of the
entries I am doing this test commit to make sure the link works okay and
the format looks okay. If any problems are found (which I expect) they
will be corrected and once things look okay the rest of the files will
be done as well.
The judges noted that some new compilers dislike ... but that was a
very long time ago now so I added in parentheses 'in 1984' to be
explicit about it.
Update formatting of the alt code (heading levels) and added subsections
for how to build and run (rather than having it all together).
Updated the historical remarks as well. It's important in this case to
refer to decot.orig.c and not decot.alt.c because the orig code is the
one that was submitted whereas the alt code is the modification the
judges made.
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.
When I restored the macros it allowed for reinstating the 'union'
instead of 'static struct' and it also allowed for reintroducing the 'x'
(which is '=') in that line so that it looks just like the original:
union tag u x{4};
For documentation purposes this was added in the thanks file (in the
same part of that entry, the making it look more like the original which
is a worthy goal) as well.
I was able to bring back some code and only had to comment out one part
and make a minor change to another another. Originally the code had:
extern int floor;
but this is not possible in modern systems so it was changed to:
extern double floor(double);
The
double (x1, y1) b;
could be brought back, changed from:
int b,
(the comma is not a typo there).
Now it looks rather more like the original.
The thanks-for-fixes.md file was updated here, including a diff to try
(to see what had to be done to fix the entry for modern systems) but I'm
afraid it has a minor change in another entry, something I accidentally
left out of 1984/mullender.
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'
This commit includes the two entries not already done (other changes
besides a final typo and formatting pass) in 1984, anonymous and laman.
This commit means that the entries of 1984 have each had their README.md
file formatted and typo fixed one more time and this should be good for
publication.
And I forgot to mention in the previous commit that typo changes were
made and additional formatting too. I added some links that seemed
relevant. Due to the historical significance of the entry I had added
quite a few but few entries have this and I likely won't do it for any
additional entries as it takes too much time. Nevertheless to be
consistent with the rest of the file I did this as well.
Earlier on I found the code that the authors used to generate the array.
I fixed it so it would compile but it created unbalanced '}'s (no
opening '{'s) and it instead should be a single '{' and '}' pair like
mullender.c has and which it now does.
To make it look more like the original but to still work with compilers
without -traditional-cpp (which clang does not support) and other
defects with clang (including one that was problematic in linux but not
macOS) code that used macros had to be modified and used directly. But I
removed the macros because of this. Now they are added back even though
they are unused, just to give it a more authentic, original look.
The thanks-for-fixes.md file was updated for this, both formatting and
otherwise, but an unfortunate thing is that another entry was also
modified in there. This is because I was aiming to just do format fixes
in 1984 in one pull request to save time but then I came across this and
decided to fix it and this should be in a single pull request.
Something I noticed is that the fix for linux clang _appears_ to not be
needed at least with clang 16.0.6 but what the difference is is just
extra warnings. I cannot imagine I changed it just for that so I have
left that change in in case there was a problem in earlier versions or
something else I do not recall. It should be noted that without the
change at least with clang 16.0.6 it appears to work just fine. It is
unclear if it should be changed back but again as I can't imagine that I
would have changed it just for warnings I think it's wiser not to.
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.
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).
I paid a lot of attention to 1984/mullender partly because it is one of
Landon's all time favourite entries to this day and partly because it
felt like it was a good idea especially as there is a lot of
instructional value in the author's remarks that I located a while back.
However this did take quite some time so I probably won't do that for
many more entries if any more as it will slow things down tremendously.
There was an unfortunate typo fix in this README.md too: a typo in the
file, possibly a typo from the copy paste (think I copied from an image
but it might have been a pdf too in which case the original person
adding the remarks in the book cited made a typo / copy-pasted the
information from the author), which could cause confusion when reading
the remarks.
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.
Make the decot.orig.c what was originally submitted prior to the judges
changing a line due to some compilers disliking that line. The alt
version does not have this fix applied. Note that I yanked paste the
line so if there was a typo that's there too though it appears not to
have that problem.
Updated Makefile noting that the purpose of the entry is to print out
rubbish so if one sees nonsense it's expected.
Fix README.md to refer to decot.orig.c instead of decot.alt.c for the
change made by the judges (that is to see it prior to the judges'
change).
The anonymous.c no longer triggers a warning that can't be disabled
(added 'int' before 'i' which is how it was in the original anyway).
Minor fix in the README.md.
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.
Although my change of not requiring -traditional-cpp worked in macOS it
turns out one change had to be made for clang in linux which has now
been done.
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
```
The tattoo image now has the code at the top of it (separate but in the
same image) so one can see both next to each other.
The README.md had some slight improvements in wording and so did the
Makefile. Also with the Makefile I tried to make it clearer that the alt
entry might not work on some systems. This same style (or something like
it) could be done for other entries 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.
This included adding the 'a.out.h' as not all systems have it and also
I wanted it as close to the original as possible so I got a copy
(https://raw.githubusercontent.com/dspinellis/unix-history-repo/Research-Release/usr/include/a.out.h) from
the fabulous Unix History repo
(https://github.com/dspinellis/unix-history-repo) which I highly
recommend anyone interested in the evolution of Unix to check out!
... and yes: the repo is under the account of Diomidis Spinellis who is
a previous IOCCC winner!
To generate the tool run `make gentab'. Note that keeping the short ints
short generates a lot of negative numbers but this might or might not be
a problem: the original mullender.c has a negative number for instance.
Updated .gitignore and README.md files.
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/.
These come from the book 'Obfuscated C and Other Mysteries' but I don't
believe this violates any copyright since the only copied text (and
code, some of which I had to typo fix but certainly it might be that I
made some typos as well) is from the authors of the entry not the book
(well one of the authors).