From 3ac19cfcab25177495869baed45675e1315c1990 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 20:45:46 -0800 Subject: [PATCH] remove orig code from 2018/poikola --- 2018/poikola/Makefile | 256 ++++++++++++++++++++++----------------- 2018/poikola/README.md | 8 +- 2018/poikola/prog.orig.c | 91 -------------- 3 files changed, 149 insertions(+), 206 deletions(-) delete mode 100644 2018/poikola/prog.orig.c diff --git a/2018/poikola/Makefile b/2018/poikola/Makefile index c3d442668..2a50cc7ea 100644 --- a/2018/poikola/Makefile +++ b/2018/poikola/Makefile @@ -1,40 +1,52 @@ #!/usr/bin/env make # -# 2018 makefile +# IOCCC 2018 winning entry - poikola + +################################################################################ # -# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis -# is licensed under: +# Regarding individual entries: +# +# IOCCC winning entry code may not work on your system. Even with standards, +# conditions and build environments change, especially when it comes to more +# extreme code such you might find in an IOCCC winner. Moreover, what was +# allowed and liked in one IOCCC contest may no longer be liked/allowed in +# later IOCCC years. +# +# Corrections on winning author and fixing typos in remarks are VERY WELCOME. +# +# GitHub pull requests are welcome: +# +# If you have a patch that might make running an entry work in modern Unix-like +# environments, please create a GitHub pull request for the IOCCC judges to +# consider. +# +# Suggestions and corrections regarding Makefiles, winning author information, +# fixing typos in remarks, and code patches are welcome via opening a GitHub +# issue or better yet, by creating a GitHub pull request for the IOCCC judges +# to consider. To form a GitHub issue or GitHub pull, please visit: +# +# https://github.com/ioccc-src/winner +# +################################################################################ + +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # # Creative Commons Attribution-ShareAlike 3.0 Unported License. # # See: http://creativecommons.org/licenses/by-sa/3.0/ -################ -# tool locations -################ +############################# +# shell used by this Makefile +############################# # SHELL= bash -CP= cp -CPP= cpp -GUNZIP= gunzip -BUNZIP2= bunzip2 -GZIP_PROG= gzip -BZIP2= bzip2 -CURL= curl -DD= dd -LD= ld -MAKE= make -RM= rm -SED= sed -TAR= tar -TRUE= true -MKDIR= mkdir -MV= mv -TR= tr -GREP= grep -SORT= sort -UNIQ= uniq + +####################### +# common tool locations +####################### +# +include ../../var.mk # Set X11_LIBDIR to the directory where the X11 library resides # @@ -48,29 +60,26 @@ X11_LIBDIR= /opt/X11/lib #X11_INCDIR= /usr/X11/include X11_INCDIR= /opt/X11/include -# Compiler warnings +# Common C compiler warnings to silence # -#CWARN= -#CWARN= -Wall -#CWARN= -Wall -Wextra +#CSILENCE= +CSILENCE= -Wno-comment -Wno-dollar-in-identifier-extension -Wno-string-plus-int \ + -Wno-unused-parameter + +# Common C compiler warning flags +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} CWARN= -Wall -Wextra -pedantic ${CSILENCE} -#CWARN= -Wall -Wextra -Weverything -#CWARN= -Wall -Wextra -Weverything -pedantic -#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} -# Silence warnings that ${CWARN} would normally complain about -# -CSILENCE= -Wno-dollar-in-identifier-extension -Wno-comment -Wno-unused-parameter -#CSILENCE= -Wno-implicit-int - -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi -#CSTD= -std=c11 -CSTD= -std=gnu11 +CSTD= -std=gnu17 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -82,21 +91,21 @@ CSTD= -std=gnu11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # #CDEFINE= CDEFINE= -Dunix=1 -#CDEFINE= -DIOCCC=25 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h #CINCLUDE= -include stdio.h #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} +#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O1 or -O. # A few compilers have broken optimizers or this entry make break @@ -109,105 +118,131 @@ CINCLUDE= #OPT= -O2 OPT= -O3 -# default flags for ANSI C compilation +# Default flags for ANSI C compilation # CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} # Libraries needed to build # LIBS= -#LIBS= -L ${X11_LIBDIR} +#LIBS= -lm +#LIBS= -L ${X11_LIBDIR} -lX11 +#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL -# ANSI compiler -# -# Set CC to the name of your ANSI compiler. -# -# Some entries seem to need gcc. If you have gcc, set -# both CC and MAY_NEED_GCC to gcc. -# -# If you do not have gcc, set CC to the name of your ANSI compiler, and -# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : -# to disable such programs. +# C compiler to use # CC= cc #CC=clang -MAY_NEED_GCC= gcc +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +CSILENCE+= -Wno-comma -Wno-date-time -Wno-float-conversion \ + -Wno-implicit-float-conversion -Wno-missing-prototypes \ + -Wno-missing-variable-declarations -Wno-poison-system-directories \ + -Wno-shadow -Wno-sign-conversion +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif ############################## # Special flags for this entry ############################## # -OBJ= prog.o +ENTRY= poikola +PROG= prog +# +OBJ= ${PROG}.o DATA= -TARGET= prog +TARGET= ${PROG} # ALT_OBJ= -ALT_TARGET= prog.orig +ALT_TARGET= -DOCS= poikola.tex ################# # build the entry ################# # -all: ${TARGET} ${DATA} +all: data ${TARGET} @${TRUE} -prog: prog.c +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c ${CC} ${CFLAGS} $< -o $@ ${LIBS} # alternative executable # -alt: ${ALT_TARGET} +alt: data ${ALT_TARGET} @${TRUE} -prog.orig: prog.orig.c - ${CC} ${CFLAGS} $< -o $@ ${LIBS} - # data files # data: ${DATA} @${TRUE} -docs: ${DOCS} - pdflatex ${DOCS} +# both all and alt +# +everything: all alt ############### # utility rules ############### # -everything: all alt - clean: ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi clobber: clean ${RM} -f ${TARGET} ${ALT_TARGET} - @-if [ -e poikola.pdf ]; then \ - ${RM} -f poikola.pdf poikola.aux poikola.log; \ - echo 'ate all docs'; \ - fi @-if [ -e sandwich ]; then \ ${RM} -f sandwich; \ echo 'ate sandwich'; \ fi -nuke: clobber - @${TRUE} - -dist_clean: nuke - @${TRUE} - install: - @echo "Surely you are performing, Dr. May!" + @echo "Dr. Spock says that is not logical!" @${TRUE} -# backwards compatibility +# you may be able to misunderstand the source by reading indent.c # -build: all - @${TRUE} +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi ################## @@ -226,22 +261,19 @@ waste: @echo 'haste' @${TRUE} -make: - @echo 'Attend a maker faire' +maker: + @echo 'Participate in a maker faire' @${TRUE} easter_egg: - @echo you expected to often mis-understand this $${RANDOM} magic - @echo chongo '' "/\\oo/\\" - @echo Eggy + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" -fabricate fashion form frame manufacture produce: make - @${TRUE} - -sandwich: +sandwich: easter_egg @if [ `id -u` -eq 0 ]; then \ echo 'Okay.'; \ - echo $${RANDOM}`date +%s`$${RANDOM} > $@; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ else \ echo 'What? Make it yourself.'; \ exit 1; \ @@ -251,18 +283,19 @@ sandwich: # as well as the West Coast Computer Faire and # you might be confused different. :-) # -supernova: nuke +supernova: sandwich @-if [ -r .code_anal ]; then \ ${RM} -f .code_anal_v6; \ else \ echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ fi - @echo A $@ helps ${MAKE} the elements that help form planets + @echo "A $@ helps ${MAKE} the elements that help form planets" @${TRUE} -deep_magic: +deep_magic: supernova @-if [ -r .code_anal ]; then \ - ccode_analysis --deep_magic 3a3fabb90892eeb2f610ae0f74a35a970060665a063ab702bd686c17c4ae07f6 --FNV1a_hash_256_bit "prog"; \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ else \ echo "Wrong! Do it again!"; \ sleep 2; \ @@ -274,7 +307,7 @@ deep_magic: magic: deep_magic @-if [ -r .code_anal ]; then \ - ccode_analysis --mode 216091 --level 216193 --FNV1a_hash_256_bit "prog"; \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ else \ echo "If you don't eat yer meat, you can't have any pudding!"; \ echo "How can you have any pudding if you don't eat yer meat?!"; \ @@ -283,14 +316,15 @@ magic: deep_magic # The IOCCC resident astronomer states # -charon: supernova - @echo $@ is a dwarf planet - @echo dwarf is a type of planet - @echo $@ is a planet +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" -pluto: supernova +pluto: charon ${MAKE} charon - @echo $@ is a dwarf planet - @echo dwarf is a type of planet - @echo $@ is a planet - @echo get used to having lots of planets becasue supernovae can ${MAKE} a lot of them + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" + diff --git a/2018/poikola/README.md b/2018/poikola/README.md index 899e06ca5..44353fd33 100644 --- a/2018/poikola/README.md +++ b/2018/poikola/README.md @@ -3,11 +3,11 @@ Timo Poikola +## To build: -## Judges' comments: -### To use: + make all - make +### To run ./prog @@ -28,8 +28,8 @@ Many [Mnemonic variations](http://www.star.ucl.ac.uk/%7Epac/obafgkmrns.html) exi You might wish, on a star, to better understand the colors being displayed. And those in the deep south might wish to go north for a better view. - ## Author's comments: + ### How to build gcc -o prog -std=gnu11 -O3 prog.c diff --git a/2018/poikola/prog.orig.c b/2018/poikola/prog.orig.c deleted file mode 100644 index a71202891..000000000 --- a/2018/poikola/prog.orig.c +++ /dev/null @@ -1,91 +0,0 @@ -#include -#include -#include -#define p return -#define X typedef -#define E { -#define B } -#define stup(y)printf("%.11s\n",(char*)y); -#define $ printf("\x1b" -#define G(y)usleep(y);fflush(stdout); -#define O __DATE__+7 -#define K printf( -X unsigned short P; -X int _; -_ s=37985; //Sleeping time factor -X char H; -_ o,b,a,f,g,k, m; // Oh, be a fine girl, kiss me -FILE *W; -X enum {T,F} z; //True & False -X double w; -_ a5_, N = 11,A4=1<<3,a8_=17,A8=2*2,aI_=~-(__FLT_MAX_EXP__<2 /* alpha Ursae Minoris Ab*/ - )p b*b*D;p b*b ; - B _ u(_ x) E if( x <2)p - F;p x*u(x-unix); B - /*alpha Ursae Minoris B*/ _ vir(H __[]) E _ e, - q=0;for(e=T;e[__];e++) - q=q* -~9+__[e]-48;p q;B P A - (H *a7_, _ a6_ );w V(_ v - ,_ i){v%=0550;w D='-'-'-'; - for(i-=i;i^__CHAR_BIT__;i++ - )D+=Z(_POSIX_TRACE,i)*Z(0x1.1df46a226e211p-6 *v,2*i)/u(2*i);p D;B _ main(a6,n)_ a6;H**n;E _ a7,A1,a1_,a8,t, - A6,D,Y;size_t a3_;_ A2[]=E'q',W_OK,5911774,'y',13,1052160,77,15,1709568,'5',a8_,1314816,34,18,1446400 - ,91,22,1314816,12,28,F_OK B;time_t j =time(NULL);a4 *= '_' ;float and [] =/*trolling is a art */ - E 4612954808543207739097088.0, 207.285645, 214354950132336733650542884425029386240.0 B ; - struct tm R = *localtime (&j) ;for (;t=aI_ ,a5_[l];) l[a5_++] ^=-~__LINE__ ; A6=a4 += - R.tm_year;a4 /='d';ssize_t A3 =1;k=A6/'d',b=k/A8,a=k%4,o=(k-((k+A4)/25)+1)/F_TEST - ,m=(19*(A6%a4 )+k-b-o+__DBL_DIG__)%30,k=(A6%'d')/R_OK;H*a2_=NULL;f=(A6%'d')% - R_OK,g=(' '+2*a+SEEK_END*k-m-f)%7,k=__ATOMIC_SEQ_CST;W=fopen(__FILE__, - "r" ); $"[40m\033[2J\033[;H\x1b[?25l");if(*(H *)(_[])E X_OK B)stup - (and)A3 =getdelim(&a2_,&a3_,'\0', W);b=((A6%19)+N*m+22*g)/(N* - ')'),o=m+g-(~-A4)*b+'r',D=o/31;for(;a1[I];a1++,a5_=0xb3) - I[a1 ]^= '-'-'#';Y=o% ~-' ' +F;for(a3 =T;a3-1) - E $ "[40m\x1b[2J");for(a6=W_OK;a6<025;a6 +=3) - E a7 = A2 [ a6 -__FLT_RADIX__ ] - 0102, a8 =k - + a6 [A2],a1 = A2[~-a6 ] *0x1.db6db6db6a92ap+0 ; - a1-=~-__DBL_DIG__,a1_=a7 *V(a5_,_XOPEN_VERSION ) - - a1*V(90-a5_,a7 )+66,A1 =(a7*V(90-a5_,a1 ) +a1 *V ( - a5_,a8 )+0xe)/1.8571428571;if(A1 >T&&a1_>0) E $"[3" - "8;2;%d;%d;%dm", (a8>> 16 )&t,(a8>>8)& 255,a8 &t);$ - "[%d;%dH%c %.*s",A1,a1_ ,a5_>90?46:111,6,a5_>45 - ?"":l+ ((a6-F_TLOCK) / __ATOMIC_RELEASE)*6); - B B G(u(A4 ) )B/**/ a4_:$ "[H\x1b[0m" - "\x1b[?25h") ;if( ( D^ (R.tm_mon+1)) - == (Y-= R./* */ tm_mday) ) E K - "%s\n",I);B K "" "%d\n", - vir(O) );p a4 ;B //END\ - OF THIS ENTRY IS\ - N E A R SO NEAR\ - .***** ******\ - **** ***\ - . . - - - - - - - - - - - - - -