Add 2011/richards try scripts

The bugs.md refers to the alt try script for testing any fix with the
Apple silicon chip. If someone gets it to work the entry could be
removed from the bugs.md file and the README.md file updated to refer to
the alternate code. As the alternate code does not work (though it has a
different type of crash) the alt build/try is not mentioned in the
README.md file. It is not clear if it's helpful or not to have it in the
README.md at this point as the important part is in bugs.md.
This commit is contained in:
Cody Boone Ferguson committed 2024-01-24 08:32:46 -08:00
1 parent 4cc95db8b0
commit 3b0a3b12a0
5 files changed
+72 -4

No files matched your search

+1 -2
View File
@@ -4,7 +4,6 @@
make
```
### Bugs and (Mis)features:
The current status of this entry is:
@@ -19,7 +18,7 @@ For more detailed information see [2011 richards in bugs.md](/bugs.md#2011-richa
## To use:
```sh
./richards
./try.sh
```
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
#
# try.alt.sh - demonstrate IOCCC winner 2011/richards alt code
#
# 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
read -r -n 1 -p "Press any key to run: echo '10 9 8 7 6 5 4 3 2 1*p*p*p*p*p*p*p*p*p' | ./richards.alt: "
echo 1>&2
echo '10 9 8 7 6 5 4 3 2 1*p*p*p*p*p*p*p*p*p' | ./richards.alt
echo 1>&2
read -r -n 1 -p "Press any key to run: echo '64 256 128 p/p*p' | ./richards.alt: "
echo 1>&2
echo '64 256 128 p/p*p' | ./richards.alt
echo 1>&2
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2011/richards
#
# 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
read -r -n 1 -p "Press any key to run: echo '10 9 8 7 6 5 4 3 2 1*p*p*p*p*p*p*p*p*p' | ./richards: "
echo 1>&2
echo '10 9 8 7 6 5 4 3 2 1*p*p*p*p*p*p*p*p*p' | ./richards
echo 1>&2
read -r -n 1 -p "Press any key to run: echo '64 256 128 p/p*p' | ./richards: "
echo 1>&2
echo '64 256 128 p/p*p' | ./richards
echo 1>&2
+7
View File
@@ -2868,6 +2868,13 @@ f *lib2[] = { T, ld, lp, lx, l1 } ;
This can be fixed easily enough however but it doesn't appear to matter in this
case.
### Testing fixes
It might be helpful to use the [try.alt.sh](/2011/richards/try.alt.sh) script to
test that it does not crash.
### Resources
#### More from the author
+8 -2
View File
@@ -3643,11 +3643,17 @@ Cody also added the [try.sh](/2011/konno/try.sh) script.
however that as of this time this entry does not work properly with macOS at
least with the silicon chip (Intel has not been tested) and it is quite possibly
an inherent problem in macOS to do with executing code in in memory/JIT and in
particular with the silicon chip. See [bugs.md](/bugs.md) for more details and a
particular with the silicon chip. See [2011/richards in
bugs.md](/bugs.md#2011-richards) for more details and a
document from Apple about how it might be fixed if anyone is brave enough to
try. If they do they might want to look also at
[richards.alt.c](/2011/richards/richards.alt.c), for whatever it might or might
not be worth.
not be worth, as it is a possible starting point that Cody added.
Cody also added the [try.sh](/2011/richards/try.sh) and the
[try.alt.sh](/2011/richards/try.alt.sh) scripts. The `try.alt.sh` script will be
helpful to test any fixes for Apple silicon chips (see [2011/richards in
bugs.md](/bugs.md#2011-richards) for more details).
## <a name="2011_toledo"></a>[2011/toledo](/2011/toledo/toledo.c) ([README.md](/2011/toledo/README.md]))