diff --git a/1988/westley/.gitignore b/1988/westley/.gitignore index 2a0c890f9..0c08f64e6 100644 --- a/1988/westley/.gitignore +++ b/1988/westley/.gitignore @@ -1 +1,2 @@ westley +westley.alt diff --git a/1988/westley/Makefile b/1988/westley/Makefile index 440787728..c4a7ed1ad 100644 --- a/1988/westley/Makefile +++ b/1988/westley/Makefile @@ -112,8 +112,8 @@ OBJ= ${PROG}.o DATA= TARGET= ${PROG} # -ALT_OBJ= -ALT_TARGET= +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt ################# diff --git a/1988/westley/README.md b/1988/westley/README.md index 42771de33..1a32e73bc 100644 --- a/1988/westley/README.md +++ b/1988/westley/README.md @@ -1,40 +1,71 @@ ## Best layout - Merlyn LeRoy (Brian Westley) - Rosemount, Inc. - 1121 Hamline Ave. N. #17 - St. Paul, MN - 55108 - U.S.A. +Merlyn LeRoy (Brian Westley) +Rosemount, Inc. +1121 Hamline Ave. N. #17 +St. Paul, MN +55108 +U.S.A. + - http://www.westley.org +## To build: + +```sh +make all +``` + +Misha Dynin provided a fix for [westley.c](westley.c) so that it may compile on +both K&R and more modern C compilers. Thank you Misha! The original code, used +for entertainment and educational value, is in [westley.alt.c](westley.alt.c), +described below. ## Try: - make all - ./westley +```sh +./westley +``` - -## Judges' remarks +## Judges' remarks: Your compiler must parse - #define _ -a - -_ +```c +#define _ -a +-_ +``` -as "--a" and not "-(-a)" or some other tokenized form. Some strictly +as `--a` and not `-(-a)` or some other tokenized form. Some strictly conforming ANSI C Preprocessors may object to this: for such compilers, you can elide the non-standard token-pasting requirement by changing the #define line to: - #define _ F-->00||F-OO--; +```c +#define _ F-->00||F-OO--; +``` You might enjoy looking at the output of: - cc -E westley.c +```sh +cc -E westley.c +``` + +### Alternate code: + +To see if your compiler has the problem described above try: + +```sh +make alt +./westley.alt +``` + +Does it show the same output as `westley`? + + +## Author's remarks: + +No remarks were provided by the author. + -Misha Dynin provided a fix for westley.c so that it may compile on -both K&R and more modern C compilers. ## Copyright and CC BY-SA 4.0 License: diff --git a/1988/westley/westley.alt.c b/1988/westley/westley.alt.c new file mode 100644 index 000000000..8398d5f7a --- /dev/null +++ b/1988/westley/westley.alt.c @@ -0,0 +1,20 @@ +#define _ -F<00||--F-OO--; +int F=00,OO=00;main(){F_OO();printf("%1.3f\n",4.*-F/OO/OO);}F_OO() +{ + _-_-_-_ + _-_-_-_-_-_-_-_-_ + _-_-_-_-_-_-_-_-_-_-_-_ + _-_-_-_-_-_-_-_-_-_-_-_-_-_ + _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ +_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ +_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ +_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ +_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + _-_-_-_-_-_-_-_-_-_-_-_-_-_ + _-_-_-_-_-_-_-_-_-_-_-_ + _-_-_-_-_-_-_-_ + _-_-_-_ +}