Merge pull request #1710 from xexyl/burton2019
This commit is contained in:
20 files changed
+298
-140
No files matched your search
@@ -8,6 +8,5 @@ indent.c
|
||||
indent.o
|
||||
mullender
|
||||
mullender.alt
|
||||
mullender.alt2
|
||||
mullender.orig
|
||||
prog.orig
|
||||
@@ -112,8 +112,8 @@ OBJ= ${PROG}.o
|
||||
DATA=
|
||||
TARGET= ${PROG}
|
||||
#
|
||||
ALT_OBJ= ${PROG}.alt.o ${PROG}.alt2.o
|
||||
ALT_TARGET= ${PROG}.alt ${PROG}.alt2
|
||||
ALT_OBJ= ${PROG}.alt.o
|
||||
ALT_TARGET= ${PROG}.alt
|
||||
|
||||
|
||||
#################
|
||||
|
||||
+12
-14
@@ -26,16 +26,18 @@ For more detailed information see [1984 mullender in bugs.md](/bugs.md#1984-mull
|
||||
|
||||
```sh
|
||||
./mullender.alt [microseconds]
|
||||
|
||||
./mullender.alt2 [microseconds] # starts over after it times out
|
||||
```
|
||||
|
||||
The default microseconds is 10000 and it is also the lowest it can be as any
|
||||
lower doesn't work very well. This feature is so you can experiment with
|
||||
different speeds in between writes. It can be useful if your CPU is too slow or
|
||||
too fast (:-) ).
|
||||
Hit ctrl-c/intr to exit the program.
|
||||
|
||||
The author stated that the original version also had a delay.
|
||||
The default microseconds is 190000 as this is approximately how long it slept in
|
||||
the original entry but it can be no lower than 5000 as any lower doesn't work
|
||||
very well. This feature is so you can experiment with different speeds in
|
||||
between writes. It can be useful if your CPU is too fast :-)
|
||||
|
||||
The author stated that the original version also had a delay but the difference
|
||||
is it required one to hit enter for it to print another line; the alt code will
|
||||
start over once it times out or if one hits a key.
|
||||
|
||||
Note that the microseconds is argc and it uses `atoi()` which does NOT check for
|
||||
overflow!
|
||||
@@ -49,15 +51,11 @@ which is probably not as uncommon as you think :-).
|
||||
```sh
|
||||
./mullender.alt
|
||||
|
||||
./mullender.alt 5000
|
||||
./mullender.alt 5000 # wait for 5000 microseconds and see what happens
|
||||
|
||||
./mullender.alt 500
|
||||
./mullender.alt 20000 # wait for 20000 microseconds and see what happens
|
||||
|
||||
./mullender.alt 20000
|
||||
|
||||
./mullender.alt 100000
|
||||
|
||||
./mullender.alt2 500 # wait for 500 microseconds and see what happens
|
||||
./mullender.alt 100000 # wait for 100000 microseconds and see what happens
|
||||
```
|
||||
|
||||
What happens if you hit enter after it reaches the end of the line? Why? What
|
||||
|
||||
@@ -1 +1 @@
|
||||
main(i,v)char**v;{i=v[1]?atoi(v[1]):10000;i=i<500?500:i;do write(1," :-)\b\b\b\b",9),usleep(i);while(--i);write(1,"\n",1);}
|
||||
main(i,v)char**v;{j:i=v[1]?atoi(v[1]):190000;i=i<5000?5000:i;do write(1," :-)\b\b\b\b",9),usleep(i);while(--i);write(1,"\n",1);goto j;}
|
||||
@@ -1 +0,0 @@
|
||||
main(i,v)char**v;{j:i=v[1]?atoi(v[1]):10000;i=i<500?500:i;do write(1," :-)\b\b\b\b",9),usleep(i);while(--i);write(1,"\n",1);goto j;}
|
||||
+70
-44
@@ -5,6 +5,17 @@ make
|
||||
```
|
||||
|
||||
|
||||
### Bugs and (Mis)features:
|
||||
|
||||
The current status of this entry is:
|
||||
|
||||
```
|
||||
STATUS: INABIAF - please **DO NOT** fix
|
||||
```
|
||||
|
||||
For more detailed information see [2019 adamovsky in bugs.md](/bugs.md#2019-adamovsky).
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
@@ -15,17 +26,13 @@ make
|
||||
### Try:
|
||||
|
||||
```sh
|
||||
./prog spam.unl
|
||||
|
||||
./prog sierpinski.unl | less
|
||||
|
||||
./prog advent.unl
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
Even after pre-processing and indenting, the C code of this entry
|
||||
Even after pre-processing and indenting, the C code of this entry it
|
||||
is about as understandable as the Unlambda code.
|
||||
|
||||
Pretending that we don't know a bit of functional programming :) and lacking a
|
||||
@@ -38,10 +45,16 @@ bytes which crashed it:
|
||||
|
||||
Functional programming is not a panacea against core dumps, after all.
|
||||
|
||||
This can be demonstrated by:
|
||||
|
||||
```sh
|
||||
./prog crash.unl
|
||||
```
|
||||
|
||||
|
||||
## Author's remarks:
|
||||
|
||||
**»A highly structured state state machine«**
|
||||
### A highly structured state state machine
|
||||
|
||||
### Purpose:
|
||||
|
||||
@@ -49,17 +62,18 @@ The purpose of this program is to allow you to play Colossal Cave Adventure as
|
||||
implemented by [Kunihiko Sakamoto][1]. As that was written in [Unlambda programming
|
||||
language][2] designed by David Alexander Madore it has to be an Unlambda interpreter.
|
||||
|
||||
|
||||
### Aesthetics:
|
||||
|
||||
The program grew a bit too long so I had to use several macros to downsize it.
|
||||
That unfortunately reduced my options for program layout. I decided to separate
|
||||
it into two portions. The initial macro section where I had limited resources
|
||||
and you should disregard its shape, unless you like it, and the rest is a
|
||||
it into two portions: the initial macro section where I had limited resources
|
||||
which you should disregard its shape, unless you like it, and the rest, which is a
|
||||
separator in the form of a single line followed by a section signifying the
|
||||
function of the program, a block with removed shape of lambda character. Even
|
||||
the official IOCCC size tool acknowledges this: When you call `./iocccsize -i
|
||||
<prog.c`, using the [2019 version of
|
||||
iocccsize](https://www.ioccc.org/2019/iocccsize.c), iocccsize returns **955**,
|
||||
iocccsize](/2019/iocccsize.c), iocccsize returns **955**,
|
||||
which is the Unicode codepoint of the **λ** character.
|
||||
|
||||
It might be a surprise for you that according to the IOCCC size tool the program is
|
||||
@@ -82,6 +96,8 @@ and run it like this:
|
||||
./prog advent.unl
|
||||
```
|
||||
|
||||
> NOTE: the file was added to the entry so there is no need to download it.
|
||||
|
||||
You can also try other programs from the Web. Many example programs are in the official
|
||||
[Unlambda distribution][3] on the Unlambda homepage. The most complex programs there are
|
||||
entries from [quine contest][4].
|
||||
@@ -97,18 +113,21 @@ It will build the tool and use it to build an alternative program `prog2`, which
|
||||
produce an Unlambda program `identify.unl`. `make identify` runs this program to identify
|
||||
itself.
|
||||
|
||||
The base program (`prog`) implements an interpreter of Unlambda 2.0. It recognises all its
|
||||
builtins (`k`, `s`, `i`, `v`, `c`, `d`, `.x`, `e`, `@`, `?x` and `|`) including the syntactic sugar function
|
||||
`r` and formatting properties in the form of ignoring whitespace and comments
|
||||
to the end of line introduced by the `#` character.
|
||||
The base program (`prog`) implements an interpreter of Unlambda 2.0. It
|
||||
recognises all its builtins (`k`, `s`, `i`, `v`, `c`, `d`, `.x`, `e`, `@`, `?x`
|
||||
and `|`) including the syntactic sugar function `r` and formatting properties in
|
||||
the form of ignoring whitespace and comments to the end of line introduced by
|
||||
the `#` character.
|
||||
|
||||
In case of wrong usage (missing Unlambda program file or missing parameter) or use of an unseekable
|
||||
Unlambda program source if it uses the `c` function, the program returns message `fail`. It
|
||||
also informs you about syntactic errors in the Unlambda program should there be any (but only
|
||||
when the execution reaches them).
|
||||
In case of wrong usage (missing Unlambda program file or missing parameter) or
|
||||
use of an unseekable (`fseek(3)`) Unlambda program source if it uses the `c`
|
||||
function, the program returns the message `fail`. It also informs you about
|
||||
syntactic errors in the Unlambda program should there be any (but only when the
|
||||
execution reaches them).
|
||||
|
||||
The Unlambda source file may contain several Unlambda programs. The interpreter
|
||||
will run them all in sequence.
|
||||
|
||||
The Unlambda source file may contain several Unlambda programs. The interpreter will run
|
||||
them all in sequence.
|
||||
|
||||
### Unlambda
|
||||
|
||||
@@ -117,19 +136,21 @@ a brief introduction or its [homepage][2] for an in depth discussion. For furthe
|
||||
can visit Wikipedia pages on [Lambda Calculus][6] and [Combinatory Logic][7].
|
||||
|
||||
You can also play with an [online interpreter][8] by GitHub user inazz. There you can
|
||||
debug one of example programs provided or try your wits in writing your own.
|
||||
debug one of the example programs provided or try your wits in writing your own.
|
||||
|
||||
|
||||
### Hints:
|
||||
|
||||
Here are some pointers where to start when trying to understand the interpreter:
|
||||
|
||||
- Where is syntax error detected?
|
||||
- Where are syntax errors detected?
|
||||
- How is the memory managed?
|
||||
- How does a program character turn into a function?
|
||||
- How does exit function *e* work?
|
||||
- Can fD0 function be called?
|
||||
- How does exit function `e` work?
|
||||
- Can `fD0` function be called?
|
||||
- Are the function names familiar? (warning: some are misleading)
|
||||
|
||||
|
||||
### Obfuscation sources
|
||||
|
||||
- The elephant in the room is the Unlambda language. As we all know, functional
|
||||
@@ -138,19 +159,21 @@ unintelligible and hard to code in. Most of its functions are quite simple and
|
||||
straightforward to implement, but two make it a mess: the promise operator `d`
|
||||
and the call with current continuation `c`.
|
||||
- Most of the additional obfuscation is derived from basic design choices. That
|
||||
is, how the state of the program is stored and how are the Unlambda functions
|
||||
is, how the state of the program is stored and how the Unlambda functions are
|
||||
implemented.
|
||||
|
||||
More on this in the **Spoilers** section.
|
||||
|
||||
|
||||
### Build notes:
|
||||
|
||||
The program does not require any special treatment by compilers. Some warnings
|
||||
had to be suppressed when compiling with `-Wall -Wextra -pedantic`. Those were
|
||||
produced because of the formatting of the source code, not any programming
|
||||
technique. Compilation with `-Weverything` produced many more warnings, but those
|
||||
are only relevant for multi-source-file projects and some are really questionable
|
||||
(e.g. `-Wdisabled-macro-expansion`).
|
||||
technique. Compilation with `clang -Weverything` produced many more warnings,
|
||||
but those are only relevant for multi-source-file projects and some are really
|
||||
questionable (e.g. `-Wdisabled-macro-expansion`).
|
||||
|
||||
|
||||
### Portability:
|
||||
|
||||
@@ -164,21 +187,22 @@ without it, but the stack runs out quickly with some Unlambda programs (e.g.
|
||||
segfault). Clang with `-O3` option does this optimization well and said example
|
||||
does not segfault with it. I was not able to force GCC to optimize it out
|
||||
(probably an operator fault).
|
||||
- The only data structure of the program (the union structure) had much more
|
||||
members originally. I joined all integers to a single long long member in the
|
||||
- The only data structure of the program (the `union`) had much more
|
||||
members originally. I joined all integers to a single `long long` member in the
|
||||
name of obfuscation. It is used for reference counting (only 1 for every
|
||||
reference) among other uses. `size_t` should be used for that, but practically,
|
||||
I think the memory would run out sooner than the reference counter in any real
|
||||
world situation even when `size_t` is bigger than `long long`. It is also used
|
||||
for storing chars for later printing. This might produce some warnings, but
|
||||
since it was developed using chars it should be always used safely.
|
||||
for storing `char`s for later printing. This might produce some warnings, but
|
||||
since it was developed using `char`s it should be always used safely.
|
||||
|
||||
|
||||
### Spoilers:
|
||||
|
||||
- You can examine the [progSpoiler.c](progSpoiler.c) file. It is the original
|
||||
final version of the interpreter, before I started the downsizing. It accepts
|
||||
one more optional parameter that specifies filename for the output Unlambda
|
||||
function (it's the Unlambda function, that remains after all function
|
||||
one more optional parameter that specifies a filename for the output Unlambda
|
||||
function (it's the Unlambda function that remains after all function
|
||||
applications are done). When no filename is provided, `stderr` is used.
|
||||
|
||||
The function *output* is used for this additional functionality. You can use
|
||||
@@ -209,32 +233,34 @@ away, and the stack stored in the continuation is restored.
|
||||
|
||||
This makes implementation of a complete debugger a bit more challenging.
|
||||
|
||||
For this to work, the functions that do the work (i.e. make series of applications
|
||||
For this to work, the functions that do the work (i.e. make a series of applications
|
||||
and/or evaluations each of which may be a call to current continuation), the `s`
|
||||
combinator and the `` ` `` application operation had to be broken down to pieces, one
|
||||
for each application/evaluation and corresponding helper functions for stack
|
||||
rebuilding. (the helper functions are named beginning with *r* instead of *f*)
|
||||
rebuilding. (the helper functions are named beginning with `r` instead of `f`)
|
||||
|
||||
- The `` ` `` application operation does the reading of the Unlambda source when
|
||||
needed. It also implements the promise function. Whenever it would apply it, it
|
||||
overwrites the Apply constructor in translation array `T`, changing its function
|
||||
to build unevaluated subtree that is later evaluated whenever the promise is
|
||||
to build an unevaluated sub-tree that is later evaluated whenever the promise is
|
||||
applied.
|
||||
|
||||
- To further the obfuscation, I shortened the function names while downsizing,
|
||||
but preserved their meaning (with the exception of Apply functions, which I
|
||||
renamed to Y to possibly confuse with Y combinator). Simple functions retained
|
||||
renamed to `Y` to possibly confuse with `Y` combinator). Simple functions retained
|
||||
their names to misguide the reader to believe to know what is what. The names of
|
||||
continuation and exit functions were swapped. The names of S and Apply functions
|
||||
were shuffled both for S functions and Apply functions in the same way to hide
|
||||
continuation and exit functions were swapped. The names of `S` and Apply functions
|
||||
were shuffled both for `S` functions and Apply functions in the same way to hide
|
||||
the meaning of `f` and `r` prefixes.
|
||||
|
||||
|
||||
### Identification spoiler:
|
||||
|
||||
The alternative build path `make identify` output commemorates a [previous IOCCC
|
||||
winner][9] which uses similar methods to mess with the size tool.
|
||||
|
||||
### Judges' remarks spoilers:
|
||||
|
||||
### Judges' spoilers:
|
||||
|
||||
It is not a bug, it is a feature. :)
|
||||
|
||||
@@ -249,12 +275,12 @@ system settings (on Linux) or compiler options (on Windows) if your Unlambda
|
||||
program needs it. Nevertheless, it will not help the judges' program which
|
||||
quickly depletes any limit you define.
|
||||
|
||||
The judges, pretending not to know what they are doing, created a program that
|
||||
The judges, pretending to not know what they are doing, created a program that
|
||||
grows Unlambda execution stack indefinitely. You may consider it an Unlambda
|
||||
anti-pattern. Normally, infinite cycles in Unlambda work by creating two
|
||||
functions and applying one to the other which creates further functions to
|
||||
apply. The application of the function frees its position on the stack. This
|
||||
program builds one ever growing function that will never be complete and able to
|
||||
program builds one ever growing function that will never be complete and be able to
|
||||
be applied.
|
||||
|
||||
[1]: https://github.com/irori/advent-unlambda "Adventure"
|
||||
@@ -265,7 +291,7 @@ be applied.
|
||||
[6]: https://en.wikipedia.org/wiki/Lambda_calculus "Lambda Calculus on Wikipedia"
|
||||
[7]: https://en.wikipedia.org/wiki/Combinatory_logic "Combinatory Logic on Wikipedia"
|
||||
[8]: https://inazz.jp/unlambda/ "Online Unlambda interpreter"
|
||||
[9]: http://ioccc.org/2014/birken/hint.html "Best use of port 1701"
|
||||
[9]: /2014/birken/README.md "Best use of port 1701"
|
||||
|
||||
|
||||
## Copyright and CC BY-SA 4.0 License:
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
````.0`.0`.0`c.0``sssss
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# try.sh - demonstrate IOCCC winner 2019/adamovsky
|
||||
#
|
||||
|
||||
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
|
||||
# this way allows us to have the user specify a different compiler in an easy
|
||||
# way.
|
||||
if [[ -z "$CC" ]]; then
|
||||
CC="cc"
|
||||
fi
|
||||
|
||||
make CC="$CC" all >/dev/null || exit 1
|
||||
|
||||
# clear screen after compilation so that only the entry is shown
|
||||
clear
|
||||
|
||||
echo 1>&2
|
||||
echo "$ ./prog spam.unl | head -n 100 | less -EXF" 1>&2
|
||||
read -r -n 1 -p "Press any key to continue: "
|
||||
echo 1>&2
|
||||
./prog spam.unl | head -n 100 | less -EXF
|
||||
echo 1>&2
|
||||
|
||||
echo "$ ./prog sierpinski.unl | head -n 200 | less -EXF" 1>&2
|
||||
read -r -n 1 -p "Press any key to continue: "
|
||||
echo 1>&2
|
||||
./prog sierpinski.unl | head -n 200 | less -EXF
|
||||
|
||||
echo "$ make identify" 1>&2
|
||||
make identify
|
||||
echo 1>&2
|
||||
|
||||
read -r -p "Do you want to play Colossal Cave Adventure (Y/N)? "
|
||||
if [[ "$REPLY" == "Y" || "$REPLY" == "y" ]]; then
|
||||
./prog advent.unl
|
||||
fi
|
||||
@@ -50,7 +50,7 @@
|
||||
"winners_text" : "original source"
|
||||
},
|
||||
{
|
||||
"file_path" : "check",
|
||||
"file_path" : "check.sh",
|
||||
"winners_rank" : 100,
|
||||
"created_by" : null,
|
||||
"prog" : null,
|
||||
@@ -60,7 +60,7 @@
|
||||
"winners_text" : "test suite"
|
||||
},
|
||||
{
|
||||
"file_path" : "cow",
|
||||
"file_path" : "cow.sh",
|
||||
"winners_rank" : 100,
|
||||
"created_by" : null,
|
||||
"prog" : null,
|
||||
|
||||
@@ -139,12 +139,12 @@ remarks: README.md
|
||||
${RM} -f $@
|
||||
${CP} $? $@
|
||||
|
||||
correct: newlines remarks 256 check
|
||||
env out=${CAT} ${SHELL} ./check ${WC} > $@
|
||||
correct: newlines remarks 256 check.sh
|
||||
env out=${CAT} ${SHELL} ./check.sh ${WC} > $@
|
||||
|
||||
test: ${PROG} ${PROG}.clean correct check
|
||||
-${SHELL} ./check ./${PROG}
|
||||
-${SHELL} ./check ./${PROG}.clean
|
||||
test: ${PROG} ${PROG}.clean correct check.sh
|
||||
-${SHELL} ./check.sh ./${PROG}
|
||||
-${SHELL} ./check.sh ./${PROG}.clean
|
||||
|
||||
# alternative executable
|
||||
#
|
||||
|
||||
+25
-8
@@ -5,17 +5,30 @@ make
|
||||
```
|
||||
|
||||
|
||||
### Bugs and (Mis)features:
|
||||
|
||||
The current status of this entry is:
|
||||
|
||||
```
|
||||
STATUS: INABIAF - please **DO NOT** fix
|
||||
```
|
||||
|
||||
For more detailed information see [2019 burton in bugs.md](/bugs.md#2019-burton).
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./prog < prog.c
|
||||
./prog < file
|
||||
|
||||
./cow file
|
||||
```
|
||||
|
||||
|
||||
### Try:
|
||||
|
||||
```sh
|
||||
echo "Do or do not. There is no try."
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -30,7 +43,7 @@ unix utilities available as winning entries.
|
||||
|
||||
### Synopsis:
|
||||
|
||||
Feed it anything on stdin.
|
||||
Feed it anything on `stdin`.
|
||||
The output should look familiar.
|
||||
|
||||
Compiles cleanly with:
|
||||
@@ -44,11 +57,11 @@ cc -Wall -Wextra -Weverything -pedantic $WARN -include stdio.h -o prog prog.c
|
||||
|
||||
Included is a test script, useful for the corner cases. As in all good Unix
|
||||
programs, it is silent upon success; any output demonstrates an error. Instead
|
||||
of checking correctness, the check script can simply output the results: (The
|
||||
Makefile contains the spoiler):
|
||||
of checking correctness, the [check.sh](check.sh) script can simply output the
|
||||
results: (The Makefile contains the spoiler):
|
||||
|
||||
```sh
|
||||
out=cat ./check ./prog
|
||||
out=cat ./check.sh ./prog
|
||||
```
|
||||
|
||||
Interestingly, and a spoiler here: macOS and FreeBSD implement the common
|
||||
@@ -60,20 +73,24 @@ on these systems omit these characters from the description.
|
||||
|
||||
This program follows FreeBSD and macOS, the arbiters of correct for these purposes.
|
||||
|
||||
|
||||
### Limits:
|
||||
|
||||
Requires the C locale and ASCII character set.
|
||||
Input should be less than ten million octets "toavoidthisproblem".
|
||||
|
||||
|
||||
### See Also:
|
||||
|
||||
You can enjoy this code from beginning to end.
|
||||
No whitespace was harmed in the creation of this program.
|
||||
All your base belong to us, but the constants seem a bit ... off?
|
||||
|
||||
|
||||
### Bonus
|
||||
|
||||
The script `cow` provides a closer analog, and perhaps a more useful interface.
|
||||
The script [cow.sh](cow.sh) provides a closer analog, and perhaps a more useful
|
||||
interface.
|
||||
|
||||
Included is a version without compilation warnings:
|
||||
|
||||
@@ -83,7 +100,7 @@ cc -Wall -Wextra -Weverything -pedantic -include stdio.h -o prog.clean prog.clea
|
||||
|
||||
### Bugs
|
||||
|
||||
The flags are not supported. Although they could easily be added into `cow`.
|
||||
The flags are not supported. Although they could easily be added into `cow.sh`.
|
||||
This exercise left to the reader.
|
||||
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
x=$1
|
||||
: ${x:=./prog}
|
||||
|
||||
: ${out:="diff - correct"}
|
||||
|
||||
(
|
||||
/bin/echo -n | $x
|
||||
$x < /dev/null
|
||||
echo | $x
|
||||
/bin/echo -n a | $x
|
||||
echo a | $x
|
||||
$x < newlines
|
||||
$x < 256
|
||||
$x < remarks
|
||||
) | $out
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
x=$1
|
||||
: "${x:=./prog}"
|
||||
|
||||
if [[ ! -x "$x" ]]; then
|
||||
x="./prog"
|
||||
fi
|
||||
|
||||
: "${out:="diff - correct"}"
|
||||
|
||||
(
|
||||
/bin/echo -n | $x
|
||||
$x < /dev/null
|
||||
echo | $x
|
||||
/bin/echo -n a | $x
|
||||
echo a | $x
|
||||
$x < newlines
|
||||
# ^---^ SC2210 (warning): This is a file redirection. Was it supposed to be a comparison or fd operation?
|
||||
# Answer: 256 is a file so it is supposed to be file redirection.
|
||||
# shellcheck disable=SC2210
|
||||
$x < 256
|
||||
$x < remarks
|
||||
) | $out
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if test $# -eq 0; then
|
||||
./prog
|
||||
exit 0
|
||||
fi
|
||||
|
||||
args=$*
|
||||
for name in $args
|
||||
do if test -r $name; then
|
||||
s=$(./prog < $name)
|
||||
echo "$s" $name
|
||||
set -- $s
|
||||
((a += $1))
|
||||
((b += $2))
|
||||
((c += $3))
|
||||
((d += 1))
|
||||
fi; done
|
||||
((d > 1)) && printf "%8d%8d%8d total\n" $a $b $c
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if test $# -eq 0; then
|
||||
./prog
|
||||
exit 0
|
||||
fi
|
||||
|
||||
args=$*
|
||||
for name in $args
|
||||
do if test -r "$name"; then
|
||||
s=$(./prog < "$name")
|
||||
echo "$s" "$name"
|
||||
# We have to disable this warning to prevent ShellCheck from being a cow.sh
|
||||
# (or, to use Bart Simpson's advice, make it 'not have a cow.sh'), as we
|
||||
# actually need this to happen:
|
||||
#
|
||||
# ^-- SC2086 (info): Double quote to prevent globbing and word splitting.
|
||||
#
|
||||
# shellcheck disable=SC2086
|
||||
set -- $s
|
||||
((a += $1))
|
||||
((b += $2))
|
||||
((c += $3))
|
||||
((d += 1))
|
||||
fi; done
|
||||
((d > 1)) && printf "%8d%8d%8d total\n" "$a" "$b" "$c"
|
||||
@@ -25,7 +25,7 @@
|
||||
<hr style="width:50%;text-align:left;margin-left:0">
|
||||
|
||||
<!-- Start Nu Html Checker -->
|
||||
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2019%2Fburton%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2019/burton/index.html</a></p>
|
||||
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2019%2Fburton%2Findex.html">Nu Html check.sh https://ioccc-src.github.io/temp-test-ioccc/2019/burton/index.html</a></p>
|
||||
<!-- End Nu Html Checker -->
|
||||
|
||||
</body>
|
||||
|
||||
@@ -219,13 +219,13 @@ href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/burton/prog.
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;">test suite</td>
|
||||
<td style="text-align: left;"><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/burton/check">check</a></td>
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/burton/check.sh">check.sh</a></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;">an alternate implementation with a useful
|
||||
interface</td>
|
||||
<td style="text-align: left;"><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/burton/cow">cow</a></td>
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/burton/cow.sh">cow.sh</a></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;">on writing an IOCCC one-liner</td>
|
||||
@@ -276,7 +276,7 @@ href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/burton/newli
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4 id="nu-html-check">Nu HTML check</h4>
|
||||
<h4 id="nu-html-check.sh">Nu HTML check.sh</h4>
|
||||
<p>For web site admin: <a
|
||||
href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2019%2Fburton%2Finventory.html">Check
|
||||
HTML</a></p>
|
||||
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# try.sh - demonstrate IOCCC winner 2019/burton
|
||||
#
|
||||
|
||||
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
|
||||
# this way allows us to have the user specify a different compiler in an easy
|
||||
# way.
|
||||
if [[ -z "$CC" ]]; then
|
||||
CC="cc"
|
||||
fi
|
||||
|
||||
make CC="$CC" all >/dev/null || exit 1
|
||||
|
||||
# clear screen after compilation so that only the entry is shown
|
||||
clear
|
||||
|
||||
echo "$ cat prog.c" 1>&2
|
||||
cat prog.c
|
||||
echo 1>&2
|
||||
|
||||
for i in prog.c Makefile README.md; do
|
||||
echo "$ ./prog < $i && wc < $i" 1>&2
|
||||
printf "prog: %s\n%4s: %s\n\n" "$(./prog < "$i"|tr -s ' ')" "wc" "$(wc "$i" | tr -s ' ')"
|
||||
done
|
||||
echo 1>&2
|
||||
|
||||
echo "$ make test" 1>&2
|
||||
make test
|
||||
@@ -3257,6 +3257,26 @@ The author wrote the following:
|
||||
# 2019
|
||||
|
||||
|
||||
## 2019 adamovsky
|
||||
|
||||
### STATUS: INABIAF - please **DO NOT** fix
|
||||
### Source code: [2019/adamovsky/prog.c](/2019/adamovsky/prog.c)
|
||||
### Information: [2019/adamovsky/README.md](/2019/adamovsky/README.md)
|
||||
|
||||
Certain input can crash this program. The file
|
||||
[crash.unl](/2019/adamovsky/crash.unl) is an example file.
|
||||
|
||||
|
||||
## 2019 burton
|
||||
|
||||
### STATUS: INABIAF - please **DO NOT** fix
|
||||
### Source code: [2019/burton/prog.c](2019/burton/prog.c)
|
||||
### Information: [2019/burton/README.md](2019/burton/README.md)
|
||||
|
||||
The author pointed out that some implementations of `wc(1)` show different
|
||||
values but his implementation matches that of macOS and FreeBSD.
|
||||
|
||||
|
||||
## 2019 duble
|
||||
|
||||
### STATUS: INABIAF - please **DO NOT** fix
|
||||
|
||||
+40
-22
@@ -130,15 +130,15 @@ This was fixed on 30 October 2023 after the bug status was changed from INABIAF
|
||||
|
||||
## <a name="1984_mullender"></a>[1984/mullender](/1984/mullender/mullender.c) ([README.md](/1984/mullender/README.md]))
|
||||
|
||||
[Cody](#cody) provided an [alternate version](/1984/mullender/mullender.alt.c), an
|
||||
improved version of the judges, so that everyone can enjoy it with systems that
|
||||
are not VAX/PDP. We also refer you to the [FAQ](faq.md) as there are some
|
||||
winning entries that also let one enjoy it - with more to them of course!
|
||||
|
||||
Cody further added the second alt version,
|
||||
[mullender.alt2.c](/1984/mullender/mullender.alt2.c) which is like the
|
||||
[1984/mullender/mullender.alt.c](/1984/mullender/mullender.alt.c) except that it
|
||||
starts over after it times out.
|
||||
[Cody](#cody) provided an [alternate version](/1984/mullender/mullender.alt.c),
|
||||
an improved version of the judges, so that everyone can enjoy it with systems
|
||||
that are not VAX/PDP. It moves at approximately the same speed as the original
|
||||
did. We also refer you to the [FAQ](faq.md) as there are some winning entries
|
||||
that also let one enjoy it (which through trial and error was how the right
|
||||
speed was discovered) - with more to them of course! The difference between the
|
||||
original is that it will start over after it times out but that might not happen
|
||||
with the original (might need you to press a key though this is not known for
|
||||
sure).
|
||||
|
||||
Cody also added the [gentab.c](/1984/mullender/gentab.c) file, fixed to compile
|
||||
(and work, though see [bugs.md](#1984mullender-readmemd)) with modern systems
|
||||
@@ -4065,6 +4065,19 @@ that's probably true: let's just say that for the IOCCC I'm (Cody) a weasel! :-)
|
||||
Cody also added the [try.sh](/2018/hou/try.sh) script.
|
||||
|
||||
|
||||
## <a name="2018_poikola"></a>[2018/poikola](/2018/poikola/prog.c) ([README.md[(/2018/poikola/README.md))
|
||||
|
||||
[Cody](#cody) added the missing `docs` rule to the Makefile that forms a PDF
|
||||
file. The rule requires the tool `pdflatex`.
|
||||
|
||||
Cody also added the [try.sh](/2018/poikola/try.sh) script.
|
||||
|
||||
[Dave Burton](/winners.html#Dave_Burton), during the preview period, noticed a
|
||||
problem where the macOS `Terminal.app` does not work properly for this program.
|
||||
We added some additional notes on what might happen (it varies depending on
|
||||
configuration).
|
||||
|
||||
|
||||
## <a name="2018_vokes"></a>[2018/vokes](/2018/vokes/prog.c) ([README.md](/2018/vokes/README.md))
|
||||
|
||||
[Cody](#cody) added the [try.sh](/2018/vokes/try.sh) script.
|
||||
@@ -4081,11 +4094,29 @@ if the user wants to see some of the spoilers and only show them if they type
|
||||
# <a name="2019"></a>2019
|
||||
|
||||
|
||||
## <a name="2019_adamovsky"></a>[2019/adamovsky](/2019/adamovsky/prog.c) ([README.md](/2019/adamovsky/README.md]))
|
||||
|
||||
[Cody](#cody) added the [try.sh](/2019/adamovsky/try.sh) script and the Unlambda
|
||||
file [crash.unl](/2019/adamovsky/crash.unl) which is in the judges' remarks as
|
||||
to what can crash it - but it's not a bug, it's a feature.
|
||||
|
||||
|
||||
## <a name="2019_burton"></a>[2019/burton](/2019/burton/prog.c) ([README.md](/2019/burton/README.md]))
|
||||
|
||||
[Cody](#cody) fixed the Makefile which had a bad character, a '%' instead of a '$' which
|
||||
caused a rule to fail.
|
||||
|
||||
Cody also added the [try.sh](/2019/burton/try.sh) script which shows a
|
||||
side-by-side comparison on several files of the entry and `wc(1)` as well as
|
||||
running `make test`.
|
||||
|
||||
Cody also fixed the script [check.sh](/2019/burton/check.sh) (renamed from
|
||||
`check`) in case `x` is specified and is not executable and also made it satisfy
|
||||
ShellCheck. He also made ShellCheck not be a cow and/or (to use Bart Simpson's
|
||||
advice :-) ) 'not have a cow' about certain things (including one thing it was
|
||||
wrong about) in [cow.sh](/2019/burton/cow.sh) (which was renamed from `cow`)
|
||||
<strike>moo</strike>too.
|
||||
|
||||
|
||||
## <a name="2019_ciura"></a>[2019/ciura](/2019/ciura/prog.c) ([README.md](/2019/ciura/README.md]))
|
||||
|
||||
@@ -4127,19 +4158,6 @@ compilation as debugging symbols might just be useful for an entry that's
|
||||
supposed to segfault :-)
|
||||
|
||||
|
||||
## <a name="2019_poikola"></a>[2019/poikola](/2019/poikola/prog.c) ([README.md[(/2019/poikola/README.md))
|
||||
|
||||
[Cody](#cody) added the `docs` rule to the Makefile that forms a PDF file. The
|
||||
rule requires the tool `pdflatex`.
|
||||
|
||||
Cody also added the [try.sh](/2019/poikola/try.sh) script.
|
||||
|
||||
[Dave Burton](/winners.html#Dave_Burton), during the preview period, noticed a
|
||||
problem where the macOS `Terminal.app` does not work properly for this program.
|
||||
We added some additional notes on what might happen (it varies depending on
|
||||
configuration).
|
||||
|
||||
|
||||
## <a name="2019_karns"></a>[2019/karns](/2019/karns/prog.c) ([README.md](/2019/karns/README.md]))
|
||||
|
||||
[Cody](#cody) reported that with `-O` level > 0 this program segfaults (sometimes?). He's
|
||||
|
||||
Reference in new issue
Block a user