There were some things unclear in the README.md file that have now been
corrected.
Clarified in the README.md that running make clobber all will run the
program itself.
The make alt target now runs the alt code just like the entry itself.
This is fine because it is a simulation (to avoid annoyance of writing
binary data to /dev/tty) and since one may still run the program or
script directly it's fine.
The alternate code section in the README.md was cleaned up and formatted
as well.
This is not complete as some things are not clear to me at this time. I
just fixed some things that could be fixed without looking over the full
file, just updating what was immediately noticed.
Format fix the README.md file including removing some '\'s at end of
lines (in the remarks).
Document feature that if the arg is a large number or < 0 (the latter of
which I discovered a few minutes ago as I was working on this) it will
enter an infinite loop trying to compile code that has syntax errors.
This was noted by the judges at the time so it is not a bug but a
feature. This has been added to the bugs.md and the README.md file.
As Landon said it is a bug (after I asked about it) I have fixed it.
Without this fix the program printed the same thing over and over again
in some cases. The problem was a for() loop that didn't always have the
pointer incremented. It looks like I could have got away with just
updating the increment part of the loop but I didn't do that as I didn't
see it at first.
The optimiser was disabled. That might not be strictly necessary but I
had it disabled for a time so I have kept it disabled.
Also I removed my name in the README.md: this was missed when the much
better idea of a general thanks file was come up with. When testing the
fix I came across part of my name which made me check. I have not yet
typo/format checked this file or any of 1989 so that was not done. That
might or might not happen in part or in whole later today but either way
it'll be started soon.
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.
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.
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).
In the judges' remarks they refer to ouroboros.c as being an executable
but it's not in the repo. This is because it's created by the program
itself. It happens to be in .gitignore but this note should make it less
confusing and prevent people from thinking that a file is actually
missing.
I have tried to make the README.md file less cluttered wrt the clang
defects and instead just show how to use the entry, referring to the
bugs.md for those who need to know.
Added script compile.sh which generates the files and tries to compile
them. The script sleeps (by default approximately 1 second) in between
commands but this can be changed to another value (including 0). One can
also change the compiler path in case their compiler is clang or in the
case of macOS gcc IS clang. The README.md refers to this and gives
examples.
The bugs.md and the thanks-for-fixes.md files have been updated for
these changes and additions.
For those who do not know of the clang defects it is discussed in the
bugs.md and unfortunately for this entry there might be little that can
be done. I haven't tried to understand the entry deeply and maybe doing
so would give some ideas for fixes (beyond what I already did which lets
the main program compile with clang - or at least versions that allow a
fourth arg to main()) but this seems less important for now.
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).
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.
Instead of writing the literal output of the binary to /dev/tty,
we simulate the output by silencing stderr and by piping the binary
thru strings.
The raw binary executable output to /dev/tty was capable "ill effects".
Such "ill effects" could be as mild as printing strange characters, to
beeping (sometimes for extended periods), and even the termination
of the terminal app window in some cases.
The "ill effects" from the printing of the raw binary executable
is highly dependent on the compiler, compiler version, libc, crt0.o,
operating system, terminal app and/or terminal driver. As such,
the "ill effects" that one user might see may be hard to reproduce
in order environments. While some of the more extreme "ill effects"
might be unlikely, what was more common was for the binary output
to be interpreted strangely by the terminal app and/or driver to
the extent that the was lost or not well seen by the user.
This change introduces the ${STRINGS} Makefile variable to the
`/var/mk` file and uses to to "clean out" any output that might
produce such "ill effects". Prior to the command, the echo does
clearly state:
```
NOTE: We will now simulate: cc -c -o /dev/tty jar.1.c
```
We also modify the `1989/jar.1/jar.1.sh` and `1989/jar.1/jar.1.alt.sh'
shell scripts to pipe raw binary through strings as well.
Thus the user can, if they wish, try the raw command themselves.
If that command does produce the more extreme examples of "ill
effects", the fault rests with the user. We mention that the
Makefile will echo the command to stdout in the `README.md`. But
that is as far as we go. We do **NOT RECOMMEND** having a shell
script or Makefile rule that would write the raw binary to `/dev/tty`
but rather let the immigration of the user try or not try it.
In general, the use piping raw binary thru stings makes the original
output more apparent, as was the case when using dumb CRT terminals
that couldn't even process ANSI escape sequences were more common.
In linux running make ver1 and make ver2 and make ver3 (not sure about
ver0 now) there was a strange error when running the rules that meant
the code was not compiled. Thinking on it just now it very likely was
the exit code of the program causing the problem but the file was
generated so I added a '-' to the line so that the rule will proceed to
try and compile the code.
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.
Makefile:90: *** recipe commences before first target. Stop.
This happened due to a typo which left off a \ before a newline where
it is meant to be one line.
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 Makefile now has the other versions as alt targets. Running make
ver0 will generate ver0.c and then try compiling it. Running make ver1
will do the same for ver1.c and running make alt will do this on ver0,
ver1, ver2 and ver3. Error in compilation in these rules are not fatal
so that make alt can continue. This is important for clang.
I have some other enhancements on the presentation of this entry but
they have to be reworked and decided upon (it might be that it's not
necessary with the alt rule but then the README.md file really ought to
be updated too which it will be in another commit).
It might be that making these alt targets is not even the right approach
but for now it'll do as at least it's easier to generate and compile the
individual files even if one does not use make alt. This is all TBD
later.
Try and improve the note during compilation that some versions will not
work with some compilers.
Make the other versions alt code. Running make alt will stop on the
first error but I made it alt targets so that make clobber will remove
the compiled files. In order to make it actual targets the Makefile
would have to do more to generate the files and this might or might not
be better.
Format fixes and a typo fix in README.md.
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 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/.
This to make the country code consistent with mkiocccentry (and I guess
international standard country codes).
This affects many README.md files and (for one line) winners.csv.
The alt code is based on the author's remarks. It allows one to more
easily redefine the macro they refer to (P) in a way that lets them try
it out without having to modify the code.
Updated .gitignore.
Format fixes in README.md.
There were many many README.md files with the wrong heading level for
different sections. These have been changed.
To help go through the changes it should be noted I used sgit and also
here is what is changed:
The 'Try', 'To build' and 'To run' lines have two '#'s. Some had one and
others had three.
An exception is that in 1984/anonymous/README.md for the alternative
code that had three '#'s. This is not consistent yet and it might be
that only two are desired. But for now that one at least has three.
The problem was that the int * needed to be a long *. It became apparent
to me when evaluating it with lldb as I noticed a pointer was long, not
an int. This does not cause a problem with linux. I have no 32-bit
system to test but I don't believe this will be an actual problem.
Split judges' comments to be a to build, try and judges' comments. The
to build section already existed.
Also added ./ in front of the binary name so commands would actually
work.