Merge pull request #1186 from xexyl/1984-mullender-fixes
This commit is contained in:
9 files changed
+107
-54
No files matched your search
@@ -1,5 +1,7 @@
|
|||||||
mullender
|
mullender
|
||||||
mullender.alt
|
mullender.alt
|
||||||
|
mullender.alt2
|
||||||
gentab
|
gentab
|
||||||
|
g.c
|
||||||
mullender.orig
|
mullender.orig
|
||||||
prog.orig
|
prog.orig
|
||||||
@@ -112,8 +112,8 @@ OBJ= ${PROG}.o
|
|||||||
DATA=
|
DATA=
|
||||||
TARGET= ${PROG}
|
TARGET= ${PROG}
|
||||||
#
|
#
|
||||||
ALT_OBJ= ${PROG}.alt.o
|
ALT_OBJ= ${PROG}.alt.o ${PROG}.alt2.o
|
||||||
ALT_TARGET= ${PROG}.alt
|
ALT_TARGET= ${PROG}.alt ${PROG}.alt2
|
||||||
|
|
||||||
|
|
||||||
#################
|
#################
|
||||||
@@ -142,8 +142,11 @@ gentab: gentab.c
|
|||||||
alt: data ${ALT_TARGET}
|
alt: data ${ALT_TARGET}
|
||||||
@${TRUE}
|
@${TRUE}
|
||||||
|
|
||||||
${ALT_TARGET}: ${PROG}.alt.c
|
${PROG}.alt: ${PROG}.alt.c
|
||||||
${CC} -include stdio.h -include unistd.h -include stdlib.h ${CFLAGS} $< -o $@ ${LDFLAGS}
|
${CC} -include stdio.h -include unistd.h -include stdlib.h ${CFLAGS} -Wno-implicit-int $< -o $@ ${LDFLAGS}
|
||||||
|
|
||||||
|
${PROG}.alt2: ${PROG}.alt2.c
|
||||||
|
${CC} -include stdio.h -include unistd.h -include stdlib.h ${CFLAGS} -Wno-implicit-int $< -o $@ ${LDFLAGS}
|
||||||
|
|
||||||
# data files
|
# data files
|
||||||
#
|
#
|
||||||
|
|||||||
+60
-38
@@ -9,56 +9,37 @@ Robbert van Renesse
|
|||||||
## To build:
|
## To build:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make all
|
make alt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
NOTE: the original code will not work on any system other than
|
||||||
|
[VAX-11](https://en.wikipedia.org/wiki/VAX-11) and
|
||||||
|
[PDP-11](https://en.wikipedia.org/wiki/PDP-11) and this is why we encourage you
|
||||||
|
to use the alt version instead. See [original code](#original-code) below for
|
||||||
|
the original version.
|
||||||
|
|
||||||
## To use:
|
## To use:
|
||||||
|
|
||||||
```sh
|
|
||||||
./mullender
|
|
||||||
```
|
|
||||||
|
|
||||||
NOTE: if your machine is not a [VAX-11](https://en.wikipedia.org/wiki/VAX-11)
|
|
||||||
or [PDP-11](https://en.wikipedia.org/wiki/PDP-11), this program will not execute
|
|
||||||
correctly. In later years, machine dependent code was discouraged. An alternate
|
|
||||||
version that will work with other systems is provided as alternate code below.
|
|
||||||
|
|
||||||
|
|
||||||
## Alternate code:
|
|
||||||
|
|
||||||
An alternate version exists which allows one to enjoy this entry on systems
|
|
||||||
other than a [VAX-11](https://en.wikipedia.org/wiki/VAX-11) or
|
|
||||||
[PDP-11](https://en.wikipedia.org/wiki/PDP-11). This version has a delay feature
|
|
||||||
as it goes so fast in modern systems. The author suggested that there was a
|
|
||||||
delay in the original code as well.
|
|
||||||
|
|
||||||
|
|
||||||
### Alternate build:
|
|
||||||
|
|
||||||
|
|
||||||
```sh
|
|
||||||
make alt
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### Alternate use:
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./mullender.alt [microseconds]
|
./mullender.alt [microseconds]
|
||||||
|
|
||||||
|
./mullender.alt2 [microseconds] # starts over after it times out
|
||||||
```
|
```
|
||||||
|
|
||||||
The default microseconds is 10000. This feature is so you can experiment with
|
The default microseconds is 10000 and it is also the lowest it can be as any
|
||||||
|
lower doesn't work very well. This feature is so you can experiment with
|
||||||
different speeds in between writes. It can be useful if your CPU is too slow or
|
different speeds in between writes. It can be useful if your CPU is too slow or
|
||||||
too fast.
|
too fast (:-) ).
|
||||||
|
|
||||||
Note that it is an `int` (argc) and it uses `atoi()` which does NOT check for
|
The author stated that the original version also had a delay.
|
||||||
|
|
||||||
|
Note that the microseconds is argc and it uses `atoi()` which does NOT check for
|
||||||
overflow!
|
overflow!
|
||||||
|
|
||||||
BTW: is there such a thing as too fast a CPU ? :-) Actually yes for certain code
|
BTW: is there such a thing as too fast a CPU ? :-) Actually yes for certain code
|
||||||
which is probably not as uncommon as you think :-).
|
which is probably not as uncommon as you think :-).
|
||||||
|
|
||||||
### Alternate try:
|
### Try:
|
||||||
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@@ -71,6 +52,44 @@ which is probably not as uncommon as you think :-).
|
|||||||
./mullender.alt 20000
|
./mullender.alt 20000
|
||||||
|
|
||||||
./mullender.alt 100000
|
./mullender.alt 100000
|
||||||
|
|
||||||
|
./mullender.alt2 500
|
||||||
|
# wait for 500 microseconds and see what happens
|
||||||
|
```
|
||||||
|
|
||||||
|
What happens if you hit enter after it reaches the end of the line? Why?
|
||||||
|
|
||||||
|
|
||||||
|
## Original code:
|
||||||
|
|
||||||
|
This original code will only execute correctly if your machine is a
|
||||||
|
[VAX-11](https://en.wikipedia.org/wiki/VAX-11) or
|
||||||
|
[PDP-11](https://en.wikipedia.org/wiki/PDP-11). In the following years, 1985 on,
|
||||||
|
machine dependent code was discouraged.
|
||||||
|
|
||||||
|
|
||||||
|
### Original build:
|
||||||
|
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make all
|
||||||
|
```
|
||||||
|
|
||||||
|
### Bugs and (Mis)features:
|
||||||
|
|
||||||
|
This entry a listed in [bugs.md](/bugs.md) as:
|
||||||
|
|
||||||
|
```
|
||||||
|
STATUS: INABIAF - please **DO NOT** fix
|
||||||
|
```
|
||||||
|
|
||||||
|
For more detailed information see [bugs.md](/bugs.md#1984mullender-readmemd).
|
||||||
|
|
||||||
|
|
||||||
|
### Original use:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./mullender
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -122,7 +141,7 @@ close to as the original as possible we used a copy of
|
|||||||
in the *fabulous* [Unix History
|
in the *fabulous* [Unix History
|
||||||
Repo](https://github.com/dspinellis/unix-history-repo/tree/Research-Release).
|
Repo](https://github.com/dspinellis/unix-history-repo/tree/Research-Release).
|
||||||
|
|
||||||
### Alternate build:
|
### gentab build:
|
||||||
|
|
||||||
`gentab.c` can be built like:
|
`gentab.c` can be built like:
|
||||||
|
|
||||||
@@ -131,18 +150,21 @@ Repo](https://github.com/dspinellis/unix-history-repo/tree/Research-Release).
|
|||||||
make gentab
|
make gentab
|
||||||
```
|
```
|
||||||
|
|
||||||
### Alternate use:
|
### gentab use:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./gentab file
|
./gentab file
|
||||||
```
|
```
|
||||||
|
|
||||||
### Alternate try:
|
### gentab try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./gentab gentab
|
./gentab gentab > g.c
|
||||||
```
|
```
|
||||||
|
|
||||||
|
NOTE: it is highly unlikely that you will be able to compile and run the output
|
||||||
|
of `gentab` but it should at least compile.
|
||||||
|
|
||||||
## Author's remarks:
|
## Author's remarks:
|
||||||
|
|
||||||
### Notes from the judges:
|
### Notes from the judges:
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ main(argc, argv) char **argv;
|
|||||||
fmt = "0x%x"; break;
|
fmt = "0x%x"; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (32 <= n && n < 127 && (rand() % 4)) fmt = "'%c'";
|
if (n == '\\' || n == '\'') fmt = "'\\%c'";
|
||||||
|
else if (32 <= n && n < 127 && (rand() % 4)) fmt = "'%c'";
|
||||||
printf(n < 8 ? "%d" : fmt, n);
|
printf(n < 8 ? "%d" : fmt, n);
|
||||||
printf(",");
|
printf(",");
|
||||||
if (pos++ == 8) {
|
if (pos++ == 8) {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
main(i,v)char**v;{i=v[1]?atoi(v[1]):10000;do write(1," :-)\b\b\b\b",9),usleep(i);while(--i);}
|
main(i,v)char**v;{i=v[1]?atoi(v[1]):10000;i=i<500?500:i;do write(1," :-)\b\b\b\b",9),usleep(i);while(--i);write(1,"\n",1);}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
main(i,v)char**v;{j:i=v[1]?atoi(v[1]):10000;i=i<500?500:i;do write(1," :-)\b\b\b\b",9),usleep(i);while(--i);write(1,"\n",1);goto j;}
|
||||||
@@ -449,6 +449,21 @@ without a newline after the `\`. This is not a bug.
|
|||||||
This entry will very likely crash or do something else if you run it without an
|
This entry will very likely crash or do something else if you run it without an
|
||||||
arg. It likely won't do anything at all if the arg is not a positive number.
|
arg. It likely won't do anything at all if the arg is not a positive number.
|
||||||
|
|
||||||
|
## [1984/mullender](1984/mullender/mullender.c) ([README.md](1984/mullender/README.md)
|
||||||
|
### STATUS: INABIAF - please **DO NOT** fix
|
||||||
|
|
||||||
|
Although there are two alt versions added by Cody that will work in modern
|
||||||
|
systems, if you do not have a [VAX-11](https://en.wikipedia.org/wiki/VAX-11) or
|
||||||
|
[PDP-11](https://en.wikipedia.org/wiki/PDP-11) to run the original entry on it
|
||||||
|
will not work. See the README.md for details on the alternate versions.
|
||||||
|
|
||||||
|
Cody added and fixed the [gentab.c](1984/mullender/gentab.c) which is from the
|
||||||
|
author's (or one of them, Mullender) remarks found by Cody. Cody fixed this to
|
||||||
|
compile and work (as best as he can determine: he has no VAX-11 or PDP-11 or
|
||||||
|
emulator to test it) but running the code on the binary itself produces a
|
||||||
|
`short[]` that can compile in modern systems.
|
||||||
|
|
||||||
|
|
||||||
# 1985
|
# 1985
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -241,9 +241,12 @@ can enjoy this entry. Try:
|
|||||||
```sh
|
```sh
|
||||||
make alt
|
make alt
|
||||||
./mullender.alt [microseconds]
|
./mullender.alt [microseconds]
|
||||||
|
./mullender.alt2 [microseconds]
|
||||||
```
|
```
|
||||||
|
|
||||||
The microseconds defaults to 10000.
|
The microseconds defaults to 10000 but has a minimum value of 1000. The
|
||||||
|
`mullender.alt2` is like the first alt except that it will start over once the
|
||||||
|
program times out.
|
||||||
|
|
||||||
Thank you Cody!
|
Thank you Cody!
|
||||||
|
|
||||||
|
|||||||
+15
-9
@@ -166,17 +166,23 @@ cd 1984/decot ; make diff_orig_prog
|
|||||||
|
|
||||||
## [1984/mullender](1984/mullender/mullender.c) ([README.md](1984/mullender/README.md]))
|
## [1984/mullender](1984/mullender/mullender.c) ([README.md](1984/mullender/README.md]))
|
||||||
|
|
||||||
Cody provided an alternate version, an improved version of the judges, so that
|
Cody provided an [alternate version](1984/mullender/mullender.alt.c), an
|
||||||
everyone can enjoy it with systems that are not VAX/PDP. We also refer you to
|
improved version of the judges, so that everyone can enjoy it with systems that
|
||||||
the [FAQ](faq.md) as there are some winning entries that also let one enjoy it -
|
are not VAX/PDP. We also refer you to the [FAQ](faq.md) as there are some
|
||||||
with more to them of course!
|
winning entries that also let one enjoy it - with more to them of course!
|
||||||
|
|
||||||
|
Cody further added the second alt version,
|
||||||
|
[mullender.alt2.c](1984/mullender/mullender.alt2.c) which is like the
|
||||||
|
[1984/mullender/mullender.alt.c](1984/mullender/mullender.alt.c) except that it
|
||||||
|
starts over after it times out.
|
||||||
|
|
||||||
Cody also added the [gentab.c](1984/mullender/gentab.c) file, fixed to compile
|
Cody also added the [gentab.c](1984/mullender/gentab.c) file, fixed to compile
|
||||||
and work with modern systems and so that it would create the proper array (it
|
(and work!, though see [bugs.md](#1984mullender-readmemd) with modern systems
|
||||||
had unbalanced '}'s), which the author noted in their remarks (which Cody also
|
and so that it would create the proper array (it had unbalanced '}'s), which the
|
||||||
found). As this file uses the old header file `a.out.h` that is not available in
|
author noted in their remarks (which Cody also found). As this file uses the old
|
||||||
all modern systems, Cody found a copy of it as to what it should have been at
|
header file `a.out.h` that is not available in all modern systems, Cody found a
|
||||||
the time, in the fabulous [Unix History
|
copy of it as to what it should have been at the time, in the fabulous [Unix
|
||||||
|
History
|
||||||
Repo](https://github.com/dspinellis/unix-history-repo/tree/Research-Release).
|
Repo](https://github.com/dspinellis/unix-history-repo/tree/Research-Release).
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user