Merge pull request #1860 from xexyl/ovdluhe89-alt
This commit is contained in:
4 files changed
+60
-6
No files matched your search
@@ -140,8 +140,11 @@ ${PROG}: ${PROG}.c
|
|||||||
alt: data ${ALT_TARGET}
|
alt: data ${ALT_TARGET}
|
||||||
@${TRUE}
|
@${TRUE}
|
||||||
|
|
||||||
|
# Variable to simplify reconfiguring P
|
||||||
|
#
|
||||||
|
P= '(A<<AP)'
|
||||||
${PROG}.alt: ${PROG}.alt.c
|
${PROG}.alt: ${PROG}.alt.c
|
||||||
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
|
${CC} ${CFLAGS} -DP=${P} $< -o $@ ${LDFLAGS}
|
||||||
|
|
||||||
# data files
|
# data files
|
||||||
#
|
#
|
||||||
|
|||||||
+13
-2
@@ -35,11 +35,12 @@ it's a `#define` it's easy to set up.
|
|||||||
### Alternate build:
|
### Alternate build:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make CFLAGS="-DP=9" clobber alt
|
make P=9 clobber alt
|
||||||
```
|
```
|
||||||
|
|
||||||
You do not have to define `P` but if you do you can replace the value with
|
You do not have to define `P` but if you do you can replace the value with
|
||||||
whatever you wish, as long as it's an int.
|
whatever you wish, as long as it's an int (or evaluates to an int like the
|
||||||
|
default `(A<<AP)` does).
|
||||||
|
|
||||||
|
|
||||||
### Alternate use:
|
### Alternate use:
|
||||||
@@ -48,6 +49,16 @@ whatever you wish, as long as it's an int.
|
|||||||
./ovdluhe.alt
|
./ovdluhe.alt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Alternate try:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./try.alt.sh
|
||||||
|
|
||||||
|
P=5 ./try.alt.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
NOTE: if you specify too high a value for `P` the program might fail.
|
||||||
|
|
||||||
|
|
||||||
## Judges' remarks:
|
## Judges' remarks:
|
||||||
|
|
||||||
|
|||||||
Executable
+38
@@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# try.alt.sh - demonstrate IOCCC winner 1989/ovdluhe.alt 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
|
||||||
|
|
||||||
|
# user may also reconfigure P
|
||||||
|
if [[ -n "$P" ]]; then
|
||||||
|
make clobber CC="$CC" P="$P" alt >/dev/null || exit 1
|
||||||
|
else
|
||||||
|
make clobber CC="$CC" alt >/dev/null || exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# clear screen after compilation so that only the entry is shown
|
||||||
|
|
||||||
|
i=0
|
||||||
|
for ((i=0; i<4; ++i)); do
|
||||||
|
read -r -n 1 -p "Press any key to run: ./ovdluhe.alt < ovdluhe.alt.c: "
|
||||||
|
echo 1>&2
|
||||||
|
./ovdluhe.alt < ovdluhe.alt.c
|
||||||
|
echo 1>&2
|
||||||
|
|
||||||
|
read -r -n 1 -p "Press any key to run: ./ovdluhe.alt < README.md: "
|
||||||
|
echo 1>&2
|
||||||
|
./ovdluhe.alt < README.md
|
||||||
|
echo 1>&2
|
||||||
|
|
||||||
|
read -r -n 1 -p "Press any key to run: ./ovdluhe.alt < Makefile: "
|
||||||
|
echo 1>&2
|
||||||
|
./ovdluhe.alt < Makefile
|
||||||
|
echo 1>&2
|
||||||
|
done
|
||||||
+5
-3
@@ -819,9 +819,11 @@ the program on each file four times in a row but rather does it on each file
|
|||||||
and starts over, doing it four times, to help with hopefully allowing different
|
and starts over, doing it four times, to help with hopefully allowing different
|
||||||
output.
|
output.
|
||||||
|
|
||||||
Cody also provided an [alternate version](/1989/ovdluhe/ovdluhe.alt.c) based on the
|
Cody also provided an [alternate version](/1989/ovdluhe/ovdluhe.alt.c) based on
|
||||||
author's remarks. See the README.md for details. The fix described above was
|
the author's remarks and the [try.alt.sh](/1989/ovdluhe/try.alt.sh) script that
|
||||||
fixed in this version too, after it was discovered and fixed.
|
uses the alt code, allowing one to configure the alt build. See the README.md
|
||||||
|
for details. The fix described above was fixed in this version too, after it was
|
||||||
|
discovered and fixed.
|
||||||
|
|
||||||
|
|
||||||
## <a name="1989_paul"></a>[1989/paul](/1989/paul/paul.c) ([README.md](/1989/paul/README.md]))
|
## <a name="1989_paul"></a>[1989/paul](/1989/paul/paul.c) ([README.md](/1989/paul/README.md]))
|
||||||
|
|||||||
Reference in new issue
Block a user