diff --git a/2011/richards/README.md b/2011/richards/README.md index 3e3219423..287f0255b 100644 --- a/2011/richards/README.md +++ b/2011/richards/README.md @@ -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 ``` diff --git a/2011/richards/try.alt.sh b/2011/richards/try.alt.sh new file mode 100755 index 000000000..0373e7d8c --- /dev/null +++ b/2011/richards/try.alt.sh @@ -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 diff --git a/2011/richards/try.sh b/2011/richards/try.sh new file mode 100755 index 000000000..d0fcc13d6 --- /dev/null +++ b/2011/richards/try.sh @@ -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 diff --git a/bugs.md b/bugs.md index bfd4cf016..907a7e70d 100644 --- a/bugs.md +++ b/bugs.md @@ -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 diff --git a/thanks-for-help.md b/thanks-for-help.md index 84930d28e..e8ad23df5 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -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). ## [2011/toledo](/2011/toledo/toledo.c) ([README.md](/2011/toledo/README.md]))