Roll back ad04d21fda
As was discussed with Landon this was a mistake even if it helped with
consistency. There was even a brilliant pun that was destroyed with that
commit which I think is worth pointing out:
cp README.md hill
./ant hill
in 1991/ant ... even if it's technically 'anthill'.
I hope that I got all links fixed in years.html and winners.html. As
well I tried to make sure I got all handles fixed in all/summary.txt.
Nevertheless these should be checked. For some handles they were never
updated (at least in the html files - though maybe summary.txt too, not
sure) in the first place so there was nothing to do.
Typo fixes like references to *.hint when it should be README.md. There
probably are others that need to be fixed but haven't been located yet.
This commit is contained in:
1 parent
d4ef163cc4
commit
750255aded
52 files changed
+177
-164
No files matched your search
@@ -0,0 +1 @@
|
||||
ant
|
||||
@@ -0,0 +1,329 @@
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# IOCCC 1991 winning entry - ant
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# 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/
|
||||
|
||||
|
||||
#############################
|
||||
# shell used by this Makefile
|
||||
#############################
|
||||
#
|
||||
SHELL= bash
|
||||
|
||||
#######################
|
||||
# common tool locations
|
||||
#######################
|
||||
include ../../var.mk
|
||||
#
|
||||
|
||||
# Set X11_LIBDIR to the directory where the X11 library resides
|
||||
#
|
||||
#X11_LIBDIR= /usr/X11R6/lib
|
||||
#X11_LIBDIR= /usr/X11/lib
|
||||
X11_LIBDIR= /opt/X11/lib
|
||||
|
||||
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
|
||||
#
|
||||
#X11_INCDIR= /usr/X11R6/include
|
||||
#X11_INCDIR= /usr/X11/include
|
||||
X11_INCDIR= /opt/X11/include
|
||||
|
||||
# Common C compiler warnings to silence
|
||||
#
|
||||
#CSILENCE=
|
||||
CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-empty-body \
|
||||
-Wno-implicit-function-declaration -Wno-return-type
|
||||
|
||||
# Common C compiler warning flags
|
||||
#
|
||||
#CWARN= ${CSILENCE}
|
||||
#CWARN= -Wall ${CSILENCE}
|
||||
CWARN= -Wall -Wextra ${CSILENCE}
|
||||
#CWARN= -Wall -Wextra -pedantic ${CSILENCE}
|
||||
|
||||
# Compiler standard
|
||||
#
|
||||
#CSTD=
|
||||
#CSTD= -ansi
|
||||
CSTD= -std=gnu90
|
||||
|
||||
# Compiler bit architecture
|
||||
#
|
||||
# Some entries require 32-bitness:
|
||||
# ARCH= -m32
|
||||
#
|
||||
# Some entries require 64-bitness:
|
||||
# ARCH= -m64
|
||||
#
|
||||
# By default we assume nothing:
|
||||
#
|
||||
ARCH=
|
||||
|
||||
# Defines that are needed to compile
|
||||
#
|
||||
#CDEFINE=
|
||||
CDEFINE= -DMODE=0600 -DBUF=32767
|
||||
|
||||
# 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
|
||||
#
|
||||
# Most compiles will safely use -O2. Some can use only -O1 or -O.
|
||||
# A few compilers have broken optimizers or this entry make break
|
||||
# under those buggy optimizers and thus you may not want anything.
|
||||
# Reasonable compilers will allow for -O3.
|
||||
#
|
||||
#OPT=
|
||||
#OPT= -O
|
||||
#OPT= -O1
|
||||
#OPT= -O2
|
||||
OPT= -O3
|
||||
|
||||
# Default flags for ANSI C compilation
|
||||
#
|
||||
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
|
||||
|
||||
# Libraries needed to build
|
||||
#
|
||||
#LIBS=
|
||||
LIBS= -lcurses -ltermcap
|
||||
#LIBS= -L ${X11_LIBDIR} -lX11
|
||||
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
|
||||
|
||||
# C compiler to use
|
||||
#
|
||||
CC= cc
|
||||
#CC=clang
|
||||
#CC=gcc
|
||||
|
||||
# Compiler add-ons or replacements for clang only
|
||||
#
|
||||
ifeq ($(CC),clang)
|
||||
#
|
||||
CSILENCE+= -Wno-comma -Wno-implicit-int-conversion -Wno-missing-prototypes \
|
||||
-Wno-missing-variable-declarations -Wno-pedantic \
|
||||
-Wno-poison-system-directories -Wno-shadow -Wno-shorten-64-to-32 \
|
||||
-Wno-strict-prototypes
|
||||
#
|
||||
CWARN+= -Weverything
|
||||
#
|
||||
endif
|
||||
|
||||
# Specific add-ons or replacements for gcc only
|
||||
#
|
||||
ifeq ($(CC),gcc)
|
||||
#
|
||||
#CSILENCE+=
|
||||
#
|
||||
#CWARN+=
|
||||
#
|
||||
endif
|
||||
|
||||
|
||||
##############################
|
||||
# Special flags for this entry
|
||||
##############################
|
||||
#
|
||||
ENTRY= ant
|
||||
PROG= ${ENTRY}
|
||||
#
|
||||
OBJ= ${PROG}.o
|
||||
DATA=
|
||||
TARGET= ${PROG}
|
||||
#
|
||||
ALT_OBJ=
|
||||
ALT_TARGET=
|
||||
|
||||
|
||||
#################
|
||||
# build the entry
|
||||
#################
|
||||
#
|
||||
all: data ${TARGET}
|
||||
@${TRUE}
|
||||
|
||||
.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: data ${ALT_TARGET}
|
||||
@${TRUE}
|
||||
|
||||
# data files
|
||||
#
|
||||
data: ${DATA}
|
||||
@${TRUE}
|
||||
|
||||
# both all and alt
|
||||
#
|
||||
everything: all alt
|
||||
|
||||
|
||||
###############
|
||||
# utility rules
|
||||
###############
|
||||
#
|
||||
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 sandwich ]; then \
|
||||
${RM} -f sandwich; \
|
||||
echo 'ate sandwich'; \
|
||||
fi
|
||||
|
||||
install:
|
||||
@echo "Dr. Spock says that is not logical!"
|
||||
@${TRUE}
|
||||
|
||||
# you may be able to misunderstand the source by reading indent.c
|
||||
#
|
||||
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
|
||||
|
||||
|
||||
##################
|
||||
# 133t hacker rulz
|
||||
##################
|
||||
#
|
||||
love:
|
||||
@echo 'not war?'
|
||||
@${TRUE}
|
||||
|
||||
haste:
|
||||
$(MAKE) waste
|
||||
@${TRUE}
|
||||
|
||||
waste:
|
||||
@echo 'haste'
|
||||
@${TRUE}
|
||||
|
||||
maker:
|
||||
@echo 'Participate in a maker faire'
|
||||
@${TRUE}
|
||||
|
||||
easter_egg:
|
||||
@echo "you expected to often misunderstand this $${RANDOM} magic"
|
||||
@echo "chongo '<was here>' /\\oo/\\"
|
||||
@echo "Eggy"
|
||||
|
||||
sandwich: easter_egg
|
||||
@if [ `id -u` -eq 0 ]; then \
|
||||
echo 'Okay.'; \
|
||||
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
|
||||
else \
|
||||
echo 'What? Make it yourself.'; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
# Understand the history of the Homebrew Computer Club
|
||||
# as well as the West Coast Computer Faire and
|
||||
# you might be confused different. :-)
|
||||
#
|
||||
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"
|
||||
@${TRUE}
|
||||
|
||||
deep_magic: supernova
|
||||
@-if [ -r .code_anal ]; then \
|
||||
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
|
||||
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
|
||||
else \
|
||||
echo "Wrong! Do it again!"; \
|
||||
sleep 2; \
|
||||
echo "Wrong! Do it again!"; \
|
||||
sleep 2; \
|
||||
echo "Wrong! Do it again!"; \
|
||||
fi
|
||||
@${TRUE}
|
||||
|
||||
magic: deep_magic
|
||||
@-if [ -r .code_anal ]; then \
|
||||
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?!"; \
|
||||
fi
|
||||
@${TRUE}
|
||||
|
||||
# The IOCCC resident astronomer states
|
||||
#
|
||||
charon: magic
|
||||
@echo "$@ is a dwarf planet"
|
||||
@echo "dwarf is a type of planet"
|
||||
@echo "therefore IAU, $@ is a planet"
|
||||
|
||||
pluto: charon
|
||||
${MAKE} charon
|
||||
@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"
|
||||
@@ -0,0 +1,105 @@
|
||||
# Best Utility:
|
||||
|
||||
Anthony C Howe
|
||||
Mortice Kern Systems Inc. #CL-23
|
||||
35 King St. N 268 Phillip St.
|
||||
Waterloo, On Waterloo, On
|
||||
Canada, N2J 2W9 Canada, N2L 6G9
|
||||
|
||||
## To build:
|
||||
|
||||
make all
|
||||
|
||||
### To run
|
||||
|
||||
cp README.md hill
|
||||
./ant hill
|
||||
|
||||
## Judges' comments
|
||||
|
||||
The author was kind enough to supply a list of references below,
|
||||
in case you are still confused after read the source! :-)
|
||||
|
||||
## Author's comments
|
||||
|
||||
Ant's Editor vIOCCC91
|
||||
|
||||
Text files consists of lines of printable text or tab characters.
|
||||
A line can be of arbitrary length and is delimited by either a
|
||||
newline or the end of file. Carriage return is mapped to newline
|
||||
on input and ignored on output. Tab stops are every eight columns.
|
||||
Non-printable characters may have unpredictable results depending
|
||||
on the implementation of CURSES.
|
||||
|
||||
COMMANDS
|
||||
h j k l left, down, up, right cursor movement
|
||||
H J K L word left, page down, page up, word right
|
||||
[ ] beginning and end of line
|
||||
t b top and bottom of file
|
||||
i enter insert mode, formfeed to quit
|
||||
x delete character under the cursor
|
||||
W write buffer to file
|
||||
R refresh the screen
|
||||
Q quit
|
||||
|
||||
EXIT STATUS
|
||||
0 success
|
||||
2 missing edit filename
|
||||
|
||||
The BUF size should be set at compile time to 32767. This value
|
||||
was used because the Sozobon C compiler for the Atari ST has 16
|
||||
bit ints and a limit on the size of arrays & structures of 32k.
|
||||
Also the WatCom C compiler for the PC also has 16 bits ints. On
|
||||
machines that have 32 bit ints (most unix boxes), a larger value
|
||||
for BUF could be used.
|
||||
|
||||
It is recommend that compact memory model be used on PC class
|
||||
machines. Small memory model may work too provided BUF is not
|
||||
too large.
|
||||
|
||||
The character constants '\b', '\f', '\n', '\r', '\t' are used
|
||||
in order to provide more portable code, since the compiler should
|
||||
handle the translation of them into the native character set.
|
||||
Note that '\f' (formfeed) was used to exit insert mode because
|
||||
K&R C had no escape constant for the escape-key.
|
||||
|
||||
My goals for this project were to learn and experiment with the
|
||||
Buffer Gap Scheme [Fin80][net90], write a useful and *portable*
|
||||
programme, and meet the requirements of the IOCCC. I initially
|
||||
planned to have a mini CURSES built-in like the IOCCC Tetris entry
|
||||
from a previous year, however this was not as portable as using a
|
||||
CURSES library with TERMINFO/TERMCAP support.
|
||||
|
||||
I plan to post followups such as unobfuscated versions and bugs
|
||||
fixes to comp.editors. Reposts of the editor.101, gap.doc, and
|
||||
editor.102 can be found in the same group every so often.
|
||||
|
||||
This entry will display a file with long lines, but has trouble
|
||||
scrolling the screen with long lines. Paging up and down should
|
||||
work correctly, however.
|
||||
|
||||
REFERENCES
|
||||
[Fin80] Craig A. Finseth, "Theory and Practice of Text Editors or
|
||||
A Cookbook For An EMACS", TM-165, MIT Lab. for Computer
|
||||
Science
|
||||
|
||||
[KeP81] Kernighan & Plauger, "Software Tools in Pascal",
|
||||
Addison-Wesley, 81, chapter 6
|
||||
|
||||
[Mil86] Eugene W. Myers & Webb Miller, "Row-replacement Algorithms
|
||||
for Screen Editors", TR 86-19, Dept. of Computer Science,
|
||||
U. of Arizona
|
||||
|
||||
[MyM86] Eugene W. Myers & Webb Miller, "A simple row-replacement
|
||||
method", TR 86-28, Dept. of Computer Science, U. of Arizona
|
||||
|
||||
[Mil87] Webb Miller, "A Software Tools Sampler", Prentice Hall, 87
|
||||
ISBN 0-13-822305-X, chapter 5
|
||||
|
||||
[net90] "Editor 101/102" articles from comp.editors
|
||||
|
||||
Copyright (c) 1991, Landon Curt Noll & Larry Bassel.
|
||||
All Rights Reserved. Permission for personal, educational or non-profit use is
|
||||
granted provided this this copyright and notice are included in its entirety
|
||||
and remains unaltered. All other uses must receive prior permission in writing
|
||||
from both Landon Curt Noll and Larry Bassel.
|
||||
@@ -0,0 +1,28 @@
|
||||
#include <ctype.h>
|
||||
#include <curses.h>
|
||||
#define T isspace(*(t=Z(p)))&&
|
||||
#define V return
|
||||
#define _ while
|
||||
int d,i,j,m,n,p,q,x,y;char*c,b[BUF],*f,*g=b,*h,k[]="hjklHJKL[]tbixWRQ",*t;
|
||||
char*Z(a){if(a<0)V b;V b+a+(b+a<g?0:h-g);}P(a)char*a;{V
|
||||
a-b-(a<h?0:h-g);}S(){p=0;}bf(){n=p=P(c);}Q(){q=1;}C(){clear();Y();}
|
||||
G(){t=Z(p);_(t<g)*--h= *--g;_(h<t)*g++= *h++;p=P(h);}B(){_(!T b<t)--p;_(T
|
||||
b<t)--p;}M(a){_(b<(t=Z(--a))&&*t-'\n');V
|
||||
b<t?++a:0;}N(a){_((t=Z(a++))<c&&*t-'\n');V
|
||||
t<c?a:P(c);}A(a,j){i=0;_((t=Z(a))<c&&*t-'\n'&&i<j){i+= *t-'\t'?1:8-(i&7);++a;}V
|
||||
a;}L(){0<p&&--p;}R(){p<P(c)&&++p;}U(){p=A(M(M(p)-1),x);}
|
||||
D(){p=A(N(p),x);}H(){p=M(p);}E(){p=N(p);L();}
|
||||
J(){m=p=M(n-1);_(0<y--)D();n=P(c);}K(){j=d;_(0<--j)m=M(m-1),U();}
|
||||
I(){G();_((j=getch())-'\f'){if(j-'\b')g-h&&(*g++=j-'\r'?j:'\n');else
|
||||
b<g&&--g;p=P(h);Y();}}X(){G();p=h<c?P(++h):p;}
|
||||
F(){j=p;p=0;G();write(i=creat(f,MODE),h,(int)(c-h));close(i);p=j;}W(){_(!T
|
||||
t<c)++p;_(T
|
||||
t<c)++p;}int(*z[])()={L,D,U,R,B,J,K,W,H,E,S,bf,I,X,F,C,Q,G};
|
||||
Y(){m=p<m?M(p):m;if(n<=p){m=N(p);i=m-P(c)?d:d-2;_(0<i--)m=M(m-1);}
|
||||
move(0,0);i=j=0;n=m;_(1){p-n||(y=i,x=j);t=Z(n);if(d<=i||c<=t)break;
|
||||
if(*t-'\r')addch(*t),j+= *t-'\t'?1:8-(j&7);if(*t=='\n'||COLS<=j)
|
||||
++i,j=0;++n;}clrtobot();++i<d&&mvaddstr(i,0,"<< EOF >>");move(y,x);
|
||||
refresh();}main(u,v)char**v;{h=c=b+BUF;if(u<2)V
|
||||
2;initscr();d=LINES;raw();noecho();idlok(stdscr,1);if(0<(i=open(f= *++v,0))){
|
||||
g+=read(i,b,BUF);g=g<b?b:g;close(i);}S();_(!q){Y();i=0;j=getch();
|
||||
_(k[i]&&j-k[i])++i;(*z[i])();}endwin();V 0;}
|
||||
Reference in new issue
Block a user