Files
ioccc/2001/schweikh
Cody Boone Ferguson de8ee5f41a Many manifest improvements and fixes
This is a large update that modifies every .entry.json file and fixes
many others. The changes of every .entry.json file are as follows:

- change 'entry source' to 'entry source code' [0]
- change 'original source' to 'original source code' [0]
- change 'directory path from top directory' to 'directory path from top
  level directory'

[0] This is for consistency purposes. Other options were pondered but as
the index.html files refer to 'Alternate code' this was the simplest way
to go about it and it also feels more natural. A question was whether to
have 'entry code' and 'original entry code' or to have the word 'source'
added to it but I decided upon including the word 'source'. Another
question has occurred to me is whether or not 'original source code'
should instead be 'original entry source code' but that can be decided
upon later as that occurred to me after much of the files were already
rebuilt. The consistency that this commit has made is for the README.md
sections and in particular 'Alternate code'. One might wonder if that
should be changed to 'Alternate source code' as now the manifest
includes 'source' in the 'entry code' and 'original code' but the
manifest itself is what was actually updated and having 'source' feels
more natural for submitted files. After all not all entries have
alternate code. These questions can be decided on when looking at the
index.html files that have been rebuilt.

Changed 'alt code' to 'alternate code' where this was not already done
(in the manifest). It is questionable whether this should be done in
markdown files or not (in the README.md files section it already is done
but not necessarily in other places).

Many files had incorrect descriptions that have been checked.

Renamed 2020/endoh2/spoiler/spoiler.{md,html} to index.{md,html} so one
can go to just 2020/endoh2/spoiler and see the web page. Although the
manifest of 2 020/endoh2/index.html will link to it and that's probably
how most people will notice it it seems useful especially as the web
page links to the different files in spoiler/ or at least refers to
them, giving a description (kind of like the manifest in
2020/endoh2/index.html).

Due to the above changes all the entries had their index.html files
regenerated too.

There were likely other changes and fixes as well.

What has NOT been done is a check over all items, typos or otherwise,
though some typos have been fixed. Nonetheless this commit goes a long
way to resolving issue #1933.

Updated thanks file both with a missing <div> id and added a manifest
improvements section as the manifest is quite important.
2024-05-15 08:54:31 -07:00
..
2023-10-30 05:02:51 -07:00
2023-07-06 21:49:38 -07:00

To build:

    make

Bugs and (Mis)features:

The current status of this entry is:

    STATUS: INABIAF - please **DO NOT** fix

For more detailed information see 2001/schweikh in bugs.html.

To use:

    ./schweikh string string2

This program will very likely crash or do something else if you do not give it two args.

Note also that the glob pattern must match the whole string. See the author's comments for details and a workaround.

There's also no way to escape meta characters.

This is supposed to happen. As is written in the The Jargon File:

    That's not a bug, that's a feature.

Try:

    ./try.sh

Judges' remarks:

Do you get the pattern here?

Author's remarks:

This one-liner program is a glob pattern matcher. It understands the glob characters * meaning 'zero or more characters' and ? meaning exactly one character, just like your unix shell.

Run it with two args, the string and the glob pattern. The exit status is 0 (shell true) when the pattern matches, 1 otherwise. The glob pattern must match the whole string, so you may want to use * at the beginning and end of the pattern if you are looking for something in the middle.

You can use it for your shell scripting needs similar to a silent grep (and without stdout redirected to /dev/null):

    if prog "${VARIABLE}" '<glob>'; then
	echo VARIABLE matches
    else
	echo no match
    fi

Bugs

There is no way to escape the meta characters. Dammit Jim, I'm a one-liner, not a regexp lib.

All obfuscation is obviously in the recursive m() function, an 86 character glob pattern evaluator, returning nonzero for a match:

  • Just a single complex return expression.
  • Nested ternary operator ?: to save on if/else verbosity.
  • Short circuiting && and || to save even more on if/else verbosity.
  • Subtraction instead of an equality operator in *t - 42.
  • ASCII codes for * and ?.
  • Careful use of blanks even though this year's rules have extended that resource limit.
  • The source is a complete preprocessed C program. Because it communicates with the world out there by means of argv and the exit status, there is no need for stdio.h bloat. An asm guru could surely squeeze this program in less than a screenful.
  • indent(1) is probably not too helpful.

The recursion wonderfully and magically takes care of iteration and backtracking. I could tell you how it works but then I would have to kill request a NDA from you :-) Run it under a debugger with several inputs, it will be quite helpful and instructive. Handling of ? is straightforward; for * start out with *foo and foo* against foo. How does it deal with sequences of adjacent *? How could this be improved? If all else fails, recode the ?: operators with if/else and try again. For extra credit implement character classes like [a-z].