Add 2015/endoh3/try.sh + format/typo checks
A new make rule (or alias for mullender and back_to) called 'future' was
added for the theme. The try.sh script uses make future ('back_to' just
doesn't look that good in my eyes even when I added it).
The try.sh tries to stay in character with the award theme a bit too
though that will only be noticeable if you pay attention. I found the
films very boring (though maybe years later I would find it more
enjoyable) so I'm sure that something more fun could have been
added if I knew them more but I do not. Well I tried anyway.
This commit is contained in:
1 parent
29903d763b
commit
d9b2810392
4 files changed
+50
-10
No files matched your search
@@ -135,7 +135,7 @@ all: data ${TARGET}
|
|||||||
${PROG}: ${PROG}.c
|
${PROG}: ${PROG}.c
|
||||||
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
|
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
|
||||||
|
|
||||||
mullender back_to: ${PROG}.c mullender.c
|
future mullender back_to: ${PROG}.c mullender.c
|
||||||
${CC} ${CFLAGS} $< -o ${PROG} ${LDFLAGS} ${BACK_TO}
|
${CC} ${CFLAGS} $< -o ${PROG} ${LDFLAGS} ${BACK_TO}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,14 +17,12 @@ make
|
|||||||
To see the original [mullender](mullender.c) in action:
|
To see the original [mullender](mullender.c) in action:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cc -o prog prog.c mullender.c # or make mullender or make back_to
|
./try.sh
|
||||||
./prog
|
|
||||||
q
|
|
||||||
^C # where ^C is ctrl-C, interrupt.
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Observe what happens when you hit enter or another character! Send INTR to end
|
Observe what happens when you hit enter or another character! You might even try
|
||||||
the program.
|
typing out, one character at a time, `1984/mullender`, and then see what it looks
|
||||||
|
like at the end. Send INTR to end the program.
|
||||||
|
|
||||||
More generally use:
|
More generally use:
|
||||||
|
|
||||||
@@ -34,7 +32,7 @@ cc -o prog prog.c foo.c
|
|||||||
^C # if necessary, where ^C is ctrl-C, interrrupt
|
^C # if necessary, where ^C is ctrl-C, interrrupt
|
||||||
```
|
```
|
||||||
|
|
||||||
to run `prog` as whatever foo.c is in the joke PDP-11 emulator.
|
to compile and run `prog` as whatever foo.c is in the joke PDP-11 emulator.
|
||||||
|
|
||||||
|
|
||||||
## Judges' remarks:
|
## Judges' remarks:
|
||||||
@@ -55,6 +53,7 @@ clue, see the end of the author's remarks.) If in doubt, use
|
|||||||
|
|
||||||
## Author's remarks:
|
## Author's remarks:
|
||||||
|
|
||||||
|
|
||||||
### Hint / Compatibility
|
### Hint / Compatibility
|
||||||
|
|
||||||
* A little-endian system is required due to an external factor.
|
* A little-endian system is required due to an external factor.
|
||||||
@@ -65,6 +64,7 @@ the same reason. But I believe it is reasonably portable.
|
|||||||
the source code from all angles..
|
the source code from all angles..
|
||||||
* Find `main()` function.
|
* Find `main()` function.
|
||||||
|
|
||||||
|
|
||||||
### Spoiler
|
### Spoiler
|
||||||
|
|
||||||
This program is a joke PDP-11 emulator. ("ll-dpd" is embedded in the code.
|
This program is a joke PDP-11 emulator. ("ll-dpd" is embedded in the code.
|
||||||
@@ -80,6 +80,7 @@ clang -o prog prog.c mullender.c
|
|||||||
|
|
||||||
You can enjoy the legendary winner of the first IOCCC, again.
|
You can enjoy the legendary winner of the first IOCCC, again.
|
||||||
|
|
||||||
|
|
||||||
### Internal
|
### Internal
|
||||||
|
|
||||||
This program uses `__attribute__((constructor))`, which is a GCC extension, to
|
This program uses `__attribute__((constructor))`, which is a GCC extension, to
|
||||||
@@ -104,6 +105,7 @@ needed for [mullender.c](mullender.c) to work:
|
|||||||
* 4: Auto-decrement deferred
|
* 4: Auto-decrement deferred
|
||||||
* 6: Index (incomplete)
|
* 6: Index (incomplete)
|
||||||
|
|
||||||
|
|
||||||
### Limitations
|
### Limitations
|
||||||
|
|
||||||
Non-trivial combination of instruction and addressing mode may cause undefined
|
Non-trivial combination of instruction and addressing mode may cause undefined
|
||||||
|
|||||||
Executable
+36
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# try.sh - demonstrate IOCCC winner 2015/endoh3
|
||||||
|
#
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# clear screen so that only the entry is shown
|
||||||
|
clear
|
||||||
|
|
||||||
|
read -r -n 1 -p "Press any key to run: less -EXF prog.c (space = next page, q = quit): "
|
||||||
|
echo 1>&2
|
||||||
|
less -EXF prog.c
|
||||||
|
echo 1>&2
|
||||||
|
|
||||||
|
echo "$ make future" 1>&2
|
||||||
|
make future || exit 1
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
|
||||||
|
echo "Will go back to the future and run 1984/mullender through prog. To quit" 1>&2
|
||||||
|
echo "the program hit ctrl-c/intr." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "You might want to try hitting enter or another key when the output reaches" 1>&2
|
||||||
|
echo "the end of the line." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
read -r -n 1 -p "Press any key to continue: "
|
||||||
|
echo 1>&2
|
||||||
|
echo "$ ./prog" 1>&2
|
||||||
|
./prog
|
||||||
+4
-2
@@ -3818,9 +3818,11 @@ they avoided.
|
|||||||
symbols of `main()`. The fix is through the compiler option `-fcommon` which
|
symbols of `main()`. The fix is through the compiler option `-fcommon` which
|
||||||
will let it compile like it does with macOS.
|
will let it compile like it does with macOS.
|
||||||
|
|
||||||
Cody also made it easier to enjoy the theme of [Back to the
|
Cody also added the [try.sh](2015/endoh3/try.sh) script which makes use of the
|
||||||
|
make rule he added (to enjoy the theme of the entry, [Back to the
|
||||||
Future](https://en.wikipedia.org/wiki/Back_to_the_Future) using this entry by
|
Future](https://en.wikipedia.org/wiki/Back_to_the_Future) using this entry by
|
||||||
simply typing `make back_to` or `make mullender`.
|
simply typing `make back_to` or `make mullender`) and then runs the famous
|
||||||
|
[1984/mullender.c](/1984/mullender/mullender.c).
|
||||||
|
|
||||||
|
|
||||||
## [2015/hou](2015/hou/prog.c) ([README.md](2015/hou/README.md))
|
## [2015/hou](2015/hou/prog.c) ([README.md](2015/hou/README.md))
|
||||||
|
|||||||
Reference in new issue
Block a user