Add .path files to each winner directory: a file containing
the path to the winner directory from the top directory.
Changed YYYY/.year files to contain the paths, from the top
directory, if the winning directories for the given year.
Changed `/.top` to contain the IOCCC years.
Added `make genpath` rule to the top Makefile and the
year Makefiles to generate the above.
Added FAQ 6.8 to `faq.md` to explain the above.
Updated manifest to reflect recent changes to the list of files.
Since some versions of clang object to the number of args to main()
(requiring, supposedly, 0, 2 or 3[0] args) and in the case that it is
enforced to not allow 1 I have added a second alt code that will be
compiled IF sicherman.c fails to compile (and it'll compile into
sicherman, not sicherman.alt2 or something like that). This required
another change which also is in sicherman.c.
The macros in the code that were C (which only translated to '/**/') and
V were changed to lower case letters. Then the 'c' in 'subr()' was
changed back to upper case. This also feels better since the 'C' (now
'c') in main() is although used it is not necessary either since it just
is an empty comment. The primary reason for this change is that in the
new version we obviously want the first arg of main() to be 'C' but with
the macro 'C' this would not be possible. The change to 'v' from 'V' is
simply to match case as both were in the original main() args (as ints).
I am not sure I like having to change the macro names to lower case but
at the same time the 'C="..."' in 'subr()' makes more sense to be upper
case as it's about the language and it also allows in the new version
that main() can have upper case C. Of course I could have made that
change in just the new version but it felt better to match style as much
as possible.
[0] The version that objects to this still seems to allow 1 arg even
though it claims that it requires 0, 2 or 3 args.
Due to clang defect in number of args allowed in main(). Some versions
will if you use, say, 4 args, object and report that main() can only
have 0, 2 or 3 args. That same version does not appear to object to 1
arg (bug?) but it's entirely possible that this changes so I have
changed the number of args of main() to 2 even though it's unused just
out of abundance of caution.
Updated CSILENCE for no implicit int. I have to test the unused
parameter warning. That might need to be added to,
-Wno-unused-parameter, but I have to find out which compilers will or
will not object to it and that can come later on.
I believe that entries that alt versions are recommended to try first
should say what it looks like in modern systems so much as what it
looked like with systems of the time it was published.
Other entries with this have to be located as well so I've put it in the
todo.md file too.
Rather than check if $(CC) IS gcc or IS clang check for $(CC) containing
gcc or clang. This is because in some systems or conditions the compiler
might not be called JUST gcc or JUST clang. For instance gcc in MacPorts
is called gcc-mp-13 (for example) but without this change one would have
to symlink gcc to gcc-mp-13 or copy it to gcc.
The FAQ has been updated to address this.
... I think :-)
The thanks file gives much more details on how this works and as I am
very tired and want to get this in so I can do other things I will not
duplicate it here. It might become clear in that file why I believe it
cannot be made any more like the original without breaking it though I
left some questions for the reader to answer for themselves.
The Makefile also had a fix: the 'alt' rule was in error so that running
'make alt' in the directory would compile it to 'alt', not
'sicherman.alt'.
Yet again I was able to make it more like the original. This was done by
changing the 'C' macro to be 'c' and 'V' macro to 'v' so that I could
use 'C' and 'V' in main(). A minor downside is that the ')' at the end
of the line
* up.) (In the C Manual)*/
had to be commented out but since main() can now have both 'C' and 'V'
as parameters of the same type this seems well worth it.
Notice how the 'c' macro is now what the 'C' originally was, /b/! The
'V' to 'v' macro did not change its definition but now 'V' can be used.
Also the variable _ can be assigned to in main() it's just that the
subr() function cannot be called (previously both parts were commented
out).
Since C is now free we can have in subr() C be a char * which is what it
was originally.
Finally instead of having pairs of '"'s in subr() for the string
(assigned to C) we just escape the inner quotes.
The only difference from the original, besides the macro names and the
look it up in the C Manual part (I think in my tired head), is that some
of the macros have to be expanded and the subr() cannot be called. If I
can later on (that I am working on this is circumstantial, seeing an
untracked file when trying to clean up git status as it's too messy now)
figure out how to not have to expand the macros that would be great but
it's very possible that this is as close to the original as possible.
But since I said that before who knows.
This alt code allows one to resize the maze. Obviously if one uses -D
with a value that's not a number it will fail to compile. If it's <= 0
|| >= 5000 it will set to the default of 39.
The try.alt.sh script plays with this, first selecting a random number
(in range $RANDOM % 38) to compile with and then run. After that it runs
in an infinite loop, exiting only if input includes non-digit
characters. A value >= 5000 sets it to the default of 39 (in the code).
Due to GitHub not serving nor rendering HTML files whose filename
starts with "." (dot), we renamed `.inventory.html` to `inventory.html`.
Renamed: `tmp/gen_dot_winner.sh` -> `tmp/gen_winner_json.sh`
Fixed URL generation for GitHub links in `inventory.html`.
The manifest was updated accordingly.
The `tmp/README.md` file was updated accordingly.
Fixed an incorrect author win for "1989_jar.2" in `author_wins.numbers`
and `author_wins.csv`.
Changed winner_JSON_format_version to "0.5 2023-11-04".
Added `gen_dot_winner.sh` tool to generate .winner.json and .inventory.html
for a winner. This tool uses [pandoc](https://pandoc.org) to convert
markdown to HTML.
Used this command to generate `.winner.json` and `.inventory.html` for
all winners:
```sh
./run_all.sh -v 1 -D 1 ./gen_dot_winner.sh
```
Updated `tmp/README.md` to reflect the above.
Retired "fake.gen_inventory.sh" to `tmp/OLD_manifest/fake.gen_inventory.sh`.
Added `-D level` flag to `run_all.sh` to specify the `-v level` for
the tool that is being run.
As requested on GitHub: a tool that will be written, readme2index, will,
as explained:
'... will take the converted HTML from the README.md markdown and
inject it into an HTML template. Things such title, award one and
author information will be injected into the HTML page ahead of the
HTML that was converted from the README.md markdown. Without going
into details of HOW at this time, the result will be a coherent HTML
index.html page with the winner title / award, winning author
information, and important file links come from other sources and
NOT from the README.md file.
The text from the 1st award line, thru the authorship information,
and up to but not including the "## To build:" line in the README.md
file will just get in the way. Moreover authors might be tempted to
try and maintain that top of README.md text instead of working with
the author/_author_handle_.json and winner .winner.json files.
This was done with my[0] sgit(1) (https://github.com/xexyl/sgit) tool like:
sgit -o -n -e '/^## To build:/,$p' '[12][0-9][0-9][0-9]/*/README.md'
[0] Is that shameless self-promotion? I don't know but I don't care: it
is generally a very useful tool and has been used in other repos too.
Besides, I've done it many times before and it's a great example that I
will be adding to the README.md file of the tool, one I hadn't thought
of doing.
The `.id` files are no longer needed and so they were removed.
The `winner_id` (the contents of the `.id` files) are simply
a concatenation of "year" and "_" and "dir".
Adjusted `.inventory.html`, `tmp/README.md`,
`tmp/fake.gen_inventory.sh`, and the manifest according
to the above.
The new tool, tmp/fake.gen_inventory.sh, now adds
a fake .inventory.html file to each winner entry.
Once the winner2nventory tool is written, the .inventory.html
will contain links to all winner files listed in the inventory.
For now, the tmp/fake.gen_inventory.sh tool just creates
a placeholder file.
The word 'manual' should have been Manual and this has been restored.
I added to the thanks file more details on how it was fixed to not
require -traditional-cpp.
By changing some macros to what they used to expand to more of the code
can be used / not commented out. For instance now subr() no longer is
commented out. It cannot be used but it now is uncommented to make it
more like the original, even using the C macro as the arg (albeit
without a type specified as it actually just translates to /**/). The
macro that C used to use, 'b' (which is '*'), is still used just not in
C as doing so will cause compilation problems.
The single arg of main() was commented out because some versions of
clang do not only allow one arg to main().
There might have been other things to make it more like the original as
well.
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.
In the case where we recommend trying the alternate code first, the
lower section is 'Original code' but this was at heading level 3 when
discussion suggests 2 so this was done as well:
sgit -e 's/^### \(Original code\)/## \1/g' '*README.md'
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.
Unless (as seems possible) a format/style change is needed for alt code
sections, this should be the final pass over it.
The thanks-for-fixes.md file was fixed to not refer to the alt code for
the original but rather refer to sicherman.orig.c. The alt file was not
removed, however, because it is not yet clear how to deal with the
situation where alt code is the same as the original code and in
particular wrt Makefile rules. This is another reason that the README.md
file might need to be revisited again.
This is a rare case where it's better to first try the alternate code as
it moves too quickly to see in modern systems. Thus the build/try
section refers to alt and it explains how to reconfigure the time for
usleep(3). The original version is described in the Original code
section. It is encouraged to try this after trying the alternate code.
I also updated the thanks file to note that part of the fix to this
entry was the inclusion of unistd.h.
With this commit the README.md has also had a final pass of format/typo
checks and fixes though it might be that the way the alt/original
build/try section is written might be standardised in which case this
file would have to be modified again.