From a74abb69b7e9b87e305b529941bf46f97ffff341 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 4 Apr 2023 12:31:34 -0700 Subject: [PATCH] Fix 1986/wall to no longer need -traditional-cpp This was also a lot of fun to fix. It took a fair bit of tinkering but it was a lot of fun to figure out and now it works like it does with -traditional-cpp! Removed this entry from the bugs.md file as it now works. Also added to the bugs.md a minor clarification about another entry that is in status INABIAF (about warnings). --- 1986/wall/.gitignore | 1 + 1986/wall/Makefile | 10 ++---- 1986/wall/README.md | 34 +++++++++++++++---- 1986/wall/wall.alt.c | 78 ++++++++++++++++++++++++++++++++++++++++++++ 1986/wall/wall.c | 28 ++++++++-------- bugs.md | 10 +----- 6 files changed, 123 insertions(+), 38 deletions(-) create mode 100644 1986/wall/wall.alt.c diff --git a/1986/wall/.gitignore b/1986/wall/.gitignore index 8d40b1eda..8784710db 100644 --- a/1986/wall/.gitignore +++ b/1986/wall/.gitignore @@ -1 +1,2 @@ wall +wall.alt diff --git a/1986/wall/Makefile b/1986/wall/Makefile index c481c37fd..fdf429fbc 100644 --- a/1986/wall/Makefile +++ b/1986/wall/Makefile @@ -114,13 +114,8 @@ OBJ= ${PROG}.o DATA= TARGET= ${PROG} # -ALT_OBJ= -ALT_TARGET= - -# FORCE use of -traditional-cpp -# -CFLAGS+= -traditional-cpp - +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt ################# # build the entry @@ -134,7 +129,6 @@ all: data ${TARGET} supernova deep_magic magic charon pluto ${PROG}: ${PROG}.c - @echo "NOTE: This entry requires a compiler that supports -traditional-cpp" ${CC} ${CFLAGS} $< -o $@ ${LIBS} # alternative executable diff --git a/1986/wall/README.md b/1986/wall/README.md index ae75e6acc..f8143ce42 100644 --- a/1986/wall/README.md +++ b/1986/wall/README.md @@ -8,17 +8,37 @@ US of A ## To build: - make all - +```sh +make all +``` We used a patch provided by [Yusuke Endoh](/winners.html#Yusuke_Endoh) to make -this work with gcc. Thank you Yusuke! +this work with gcc. Thank you Yusuke! [Cody Boone +Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this so that it does not +require `-traditional-cpp`. This took a fair bit of tinkering as this entry *is* +strange. Thank you Cody for your assistance! -NOTE: On modern systems this entry requires the option `-traditional-cpp` which -clang does not support. Please be advised that gcc under macOS is actually -clang so this will not compile with the default gcc under macOS. As this entry -stood in modern systems it did not work even when compiled. +## To use: +```sh +./wall +``` + +### Alternative code: + +If you have an old compiler or a compiler that supports `-traditional-cpp` you +might enjoy looking at the original source (after patch by Yusuke applied) in +[wall.alt.c](wall.alt.c). To build: + +```sh +# if you have an old enough compiler: +make alt + +# or with gcc: +make CFLAGS+="-traditional-cpp" alt +``` + +Use `./wall.alt` as you would `./wall`. ## Judges' comments: diff --git a/1986/wall/wall.alt.c b/1986/wall/wall.alt.c new file mode 100644 index 000000000..1c938d49a --- /dev/null +++ b/1986/wall/wall.alt.c @@ -0,0 +1,78 @@ +#define _c(C)_ (C)&('|'+3):c_()(C)>>('\n'-3) __; /**/ +#define C char* +#define keyboard ",,B3-u;.(&*5., /(b*(1\036!a%\031m,,,,,\r\n" +#define main(o,oo)oo(o){ +#define _ ;case +C +#define c_(cc)c cc= +#define C_(sand)_O(sand)witch +o=keyboard; +#define __ ;break; +C +ccc( +cc) +C +cc; +{ cc=strdup(cc); +C +cccc= +cc;int +#ifndef lint +#define keyboard "dijs QH.soav Vdtnsaoh DmfpaksoQz;kkt oa, -dijs" +#endif +c; +main(;c_(=(*cc);*cc++)c,for); +#define _O(s)s +main(0xb+(c>>5),C_(s)) +_'\v' +:__ _'\f': +main(c,C_(s)); +_c(8098)_c(6055)_c(14779)_c(10682) +#define O_(O)_O(O)stem(ccc( +_c(15276)_c(11196)_c(15150) +#define _C ;return +_c(11070)_c(15663)_c(11583) +} +__ +default +:c_(+)o[c&__LINE__-007]; +main(c_(-)'-'-1,C_(s))_ +0214 +:_ +0216 +:c_(+)025 _ +0207 +:c_(-)4 _ +0233 +:c_(+)' '-1; +}}c_(&)'z'+5; +}_C cccc; +}main(,cc) +C +#define O write(1, +c=strdup("O"); +O_(sy) keyboard)); +main(;;,for); +read(0, +c,1);* +c_(&)'~'+1 +;O ccc( +c), +'\0'); +main(*c, +C_(s));_ +4 +:O_(sy)";kkt -oa, dijszdijs QQ"))_C +_ +13 +:O o+' ', +3 +) +#undef main +__ _ 127:O"\b \b",3)__ +default +:O +c,1) +__}}}main(){ +cc(); +} diff --git a/1986/wall/wall.c b/1986/wall/wall.c index 1c938d49a..3977aee21 100644 --- a/1986/wall/wall.c +++ b/1986/wall/wall.c @@ -23,10 +23,10 @@ cc;int c; main(;c_(=(*cc);*cc++)c,for); #define _O(s)s -main(0xb+(c>>5),C_(s)) +switch(0xb+(c>>5)){ _'\v' :__ _'\f': -main(c,C_(s)); +switch(c){; _c(8098)_c(6055)_c(14779)_c(10682) #define O_(O)_O(O)stem(ccc( _c(15276)_c(11196)_c(15150) @@ -35,34 +35,34 @@ _c(11070)_c(15663)_c(11583) } __ default -:c_(+)o[c&__LINE__-007]; -main(c_(-)'-'-1,C_(s))_ +:c +=o[c&__LINE__-007]; +switch(c -='-'-1){;case 0214 :_ 0216 -:c_(+)025 _ +:c+=025 _ 0207 -:c_(-)4 _ +:c-=4 _ 0233 -:c_(+)' '-1; -}}c_(&)'z'+5; -}_C cccc; -}main(,cc) +:c+=' '-1; +}}c&='z'+5; +}return cccc; +}void main(,cc) C #define O write(1, c=strdup("O"); -O_(sy) keyboard)); +system(ccc( keyboard)); main(;;,for); read(0, c,1);* -c_(&)'~'+1 +c &= '~'+1 ;O ccc( c), '\0'); main(*c, -C_(s));_ +switch);_ 4 -:O_(sy)";kkt -oa, dijszdijs QQ"))_C +:system(ccc(";kkt -oa, dijszdijs QQ"));return _ 13 :O o+' ', diff --git a/bugs.md b/bugs.md index b9a56e691..1b357e9f6 100644 --- a/bugs.md +++ b/bugs.md @@ -322,15 +322,7 @@ holloway.c:34:1: warning: control reaches end of non-void function [-Wreturn-typ ``` - - - -## [1986/wall/wall.c](1986/wall/wall.c) ([README.md](1986/wall/README.md)) -## STATUS: Requires a compiler supporting `-traditional-cpp` - alternate code requested - -This entry needs a compiler that support `-traditional-cpp`. `gcc` -supports this but `clang` does not. Please be advised that `gcc` under macOS is -actually gcc if it looks like it's gcc (two different binaries). +or any others. # 1987