Add 2015/yang/try.sh + formatting/typo checks

This commit is contained in:
Cody Boone Ferguson committed 2023-12-06 08:55:43 -08:00
1 parent 07c10027f7
commit 8d020bac96
3 files changed
+93 -23

No files matched your search

+6 -23
View File
@@ -8,35 +8,16 @@ make
## To use:
```sh
echo Some text | ./prog\
echo Some text | ./prog
```
### Try:
```sh
echo IOCCC 2015 | ./prog | tee output.c
make output
./output
echo IOCCC 2015 | ./prog_c11 | tee output.c
make output
./output
echo IOCCC 2015 | ./prog_c++98 | tee output.c
make output
./output
./try.sh
```
### Also try:
```sh
./prog
```
Keep pressing enter to see more output. Send EOF to terminate.
## Judges' remarks:
@@ -54,7 +35,7 @@ so you need not worry about this.
## Author's remarks:
`Fuuko` is a [sea star](https://en.wikipedia.org/wiki/Starfish) generator. Feed
her some input through `stdin` to get lots of sea star patterns in `stdout`.
her some input through `stdin` to get lots of sea star patterns on `stdout`.
```sh
cc -O3 -std=c90 fuuko.c -lm -o fuuko_c90
@@ -70,7 +51,7 @@ echo IOCCC | ./fuuko_c99 > output_c99.c
```
Don't like [sea stars](https://en.wikipedia.org/wiki/Starfish)? Use a C++98
compiler to get [dango](https://en.wikipedia.org/wiki/Dango) instead.
compiler to get a [dango](https://en.wikipedia.org/wiki/Dango) instead.
```sh
g++ -O3 -std=c++98 fuuko.c -lm -o fuuko_cpp98
@@ -102,6 +83,7 @@ filled with pointer dereferences (C stars).
Next time people ask you for a few pointers on C, you can run their
question through `Fuuko` and give them pointers all day long.
### Compatibility
`Fuuko` has been tested under these environments:
@@ -117,6 +99,7 @@ question through `Fuuko` and give them pointers all day long.
- clang 3.4.1 on Linux
- tcc 0.9.25 on JS/Linux (C99 only)
### Features
The most obscure parts are in detecting the subtle differences in
+85
View File
@@ -0,0 +1,85 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2015/yang
#
# 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" everything >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
echo "$ echo IOCCC 2015 | ./prog | tee output.c | less" 1>&2
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2
echo IOCCC 2015 | ./prog | tee output.c | less -EXF
echo "$ make CC=\"${CC}\" output" 1>&2
make CC="${CC}" output 2>/dev/null
read -r -n 1 -p "Press any key to run: ./output: "
echo 1>&2
./output
echo 1>&2
echo "$ echo IOCCC 2015 | ./prog_c90 | tee output.c | less" 1>&2
read -r -n 1 -p "Press any key to show sea star (space = next page, q = quit): "
echo 1>&2
echo IOCCC 2015 | ./prog_c90 | tee output.c | less -EXF
echo "$ make CC=\"${CC}\" output" 1>&2
make CC="${CC}" output 2>/dev/null
read -r -n 1 -p "Press any key to run: ./output: "
echo 1>&2
./output
echo 1>&2
echo "$ echo IOCCC 2015 | ./prog_c99 | tee output.c | less" 1>&2
read -r -n 1 -p "Press any key to show sea star with eyes (space = next page, q = quit): "
echo 1>&2
echo IOCCC 2015 | ./prog_c99 | tee output.c | less -EXF
echo "Did you notice the 'rabbit' in there?" 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
echo "$ make CC=\"${CC}\" output" 1>&2
make CC="${CC}" output 2>/dev/null
read -r -n 1 -p "Press any key to run: ./output: "
echo 1>&2
./output
echo "$ echo IOCCC 2015 | ./prog_cpp98 | tee output.c | less" 1>&2
read -r -n 1 -p "Press any key to show dango (space = next page, q = quit): "
echo IOCCC 2015 | ./prog_cpp98 | tee output.c | less -EXF
echo "$ make CC=\"${CC}\" output" 1>&2
make CC="${CC}" output 2>/dev/null
read -r -n 1 -p "Press any key to run: ./output: "
echo 1>&2
./output
echo "$ echo IOCCC 2015 | ./prog_cpp11 | tee output.c | less" 1>&2
read -r -n 1 -p "Press any key to show circles/Swiss cheese (space = next page, q = quit): "
echo IOCCC 2015 | ./prog_cpp11 | tee output.c | less -EXF
echo "$ make CC=\"${CC}\" output" 1>&2
make CC="${CC}" output 2>/dev/null
read -r -n 1 -p "Press any key to run: ./output: "
echo 1>&2
./output
echo 1>&2
echo "$ echo IOCCC 2015 | ./prog_c11 | tee output.c | less" 1>&2
read -r -n 1 -p "Press any key to show no extra pattern (space = next page, q = quit): "
echo 1>&2
echo IOCCC 2015 | ./prog_c11 | tee output.c | less -EXF
echo "$ make CC=\"${CC}\" output" 1>&2
make CC="${CC}" output 2>/dev/null
read -r -n 1 -p "Press any key to run: ./output: "
echo 1>&2
./output
read -r -n 1 -p "Press enter key repeatedly to get more output (send EOF to quit): "
./prog
exit 0
+2
View File
@@ -3811,6 +3811,8 @@ files from compiling properly, trying instead to compile already compiled code.
He also added explicit linking of libm (`-lm`) for systems that do not do this
(Linux seems to not but macOS does).
He also added the [try.sh](2015/yang/try.sh) script.
# <a name="2018"></a>2018