home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.misc
- From: chongo@toad.com (Landon Curt Noll)
- Subject: v32i032: ioccc.1992 - 1992 International Obfuscated C Code Contest winners, Part05/05
- Message-ID: <1992Sep10.154628.27454@sparky.imd.sterling.com>
- X-Md4-Signature: 7ab4a9cf9e687398a2d8b7b9578270d5
- Date: Thu, 10 Sep 1992 15:46:28 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: chongo@toad.com (Landon Curt Noll)
- Posting-number: Volume 32, Issue 32
- Archive-name: ioccc.1992/part05
- Environment: C
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: 1992/adrian.grep.1 1992/adrian.grep.2 1992/adrian.grep.3
- # 1992/adrian.grep.4 1992/adrian.grep.5 1992/adrian.grep.from
- # 1992/adrian.grep.try 1992/ant.hint 1992/buzzard.2.README
- # 1992/buzzard.2.c 1992/demo1.th 1992/demo2.th 1992/demo3.th
- # 1992/demo4.th 1992/demo5.th 1992/demo6.th 1992/westley.c
- # Wrapped by kent@sparky on Thu Sep 10 10:21:22 1992
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 5 (of 5)."'
- if test -f '1992/adrian.grep.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'1992/adrian.grep.1'\"
- else
- echo shar: Extracting \"'1992/adrian.grep.1'\" \(131 characters\)
- sed "s/^X//" >'1992/adrian.grep.1' <<'END_OF_FILE'
- X <q0> a <q1> The first state to appear is the start state
- X <q1> b <q2>
- X <q2> c [q3]
- X [q3]
- END_OF_FILE
- if test 131 -ne `wc -c <'1992/adrian.grep.1'`; then
- echo shar: \"'1992/adrian.grep.1'\" unpacked with wrong size!
- fi
- # end of '1992/adrian.grep.1'
- fi
- if test -f '1992/adrian.grep.2' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'1992/adrian.grep.2'\"
- else
- echo shar: Extracting \"'1992/adrian.grep.2'\" \(64 characters\)
- sed "s/^X//" >'1992/adrian.grep.2' <<'END_OF_FILE'
- X <q0> a <q1>
- X <q1> b <q2>
- X <q2> c [q3]
- X [q3] . [q3]
- END_OF_FILE
- if test 64 -ne `wc -c <'1992/adrian.grep.2'`; then
- echo shar: \"'1992/adrian.grep.2'\" unpacked with wrong size!
- fi
- # end of '1992/adrian.grep.2'
- fi
- if test -f '1992/adrian.grep.3' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'1992/adrian.grep.3'\"
- else
- echo shar: Extracting \"'1992/adrian.grep.3'\" \(99 characters\)
- sed "s/^X//" >'1992/adrian.grep.3' <<'END_OF_FILE'
- X <q0> a <q1> . <q0>
- X <q1> b <q2> a <q1> . <q0>
- X <q2> c [q3] a <q1> . <q0>
- X [q3] . <q1>
- END_OF_FILE
- if test 99 -ne `wc -c <'1992/adrian.grep.3'`; then
- echo shar: \"'1992/adrian.grep.3'\" unpacked with wrong size!
- fi
- # end of '1992/adrian.grep.3'
- fi
- if test -f '1992/adrian.grep.4' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'1992/adrian.grep.4'\"
- else
- echo shar: Extracting \"'1992/adrian.grep.4'\" \(48 characters\)
- sed "s/^X//" >'1992/adrian.grep.4' <<'END_OF_FILE'
- X [q0] a <q1>
- X <q1> b <q2>
- X <q2> c [q0]
- END_OF_FILE
- if test 48 -ne `wc -c <'1992/adrian.grep.4'`; then
- echo shar: \"'1992/adrian.grep.4'\" unpacked with wrong size!
- fi
- # end of '1992/adrian.grep.4'
- fi
- if test -f '1992/adrian.grep.5' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'1992/adrian.grep.5'\"
- else
- echo shar: Extracting \"'1992/adrian.grep.5'\" \(60 characters\)
- sed "s/^X//" >'1992/adrian.grep.5' <<'END_OF_FILE'
- X <q0> ab <q1>
- X <q1> cd <q2>
- X <q2> ef [q3]
- X [q3]
- END_OF_FILE
- if test 60 -ne `wc -c <'1992/adrian.grep.5'`; then
- echo shar: \"'1992/adrian.grep.5'\" unpacked with wrong size!
- fi
- # end of '1992/adrian.grep.5'
- fi
- if test -f '1992/adrian.grep.from' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'1992/adrian.grep.from'\"
- else
- echo shar: Extracting \"'1992/adrian.grep.from'\" \(92 characters\)
- sed "s/^X//" >'1992/adrian.grep.from' <<'END_OF_FILE'
- X<q0> F <q1>
- X<q1> r <q2>
- X<q2> o <q3>
- X<q3> m <q4>
- X<q4> : <q5> . [q6]
- X<q5> . <q5>
- X[q6] . [q6]
- X
- END_OF_FILE
- if test 92 -ne `wc -c <'1992/adrian.grep.from'`; then
- echo shar: \"'1992/adrian.grep.from'\" unpacked with wrong size!
- fi
- # end of '1992/adrian.grep.from'
- fi
- if test -f '1992/adrian.grep.try' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'1992/adrian.grep.try'\"
- else
- echo shar: Extracting \"'1992/adrian.grep.try'\" \(101 characters\)
- sed "s/^X//" >'1992/adrian.grep.try' <<'END_OF_FILE'
- X <q0> t <q1> . <q0>
- X <q1> hc <q2> t <q1> . <q0>
- X <q2> eh [q3] t <q1> . <q0>
- X [q3] . <q1>
- END_OF_FILE
- if test 101 -ne `wc -c <'1992/adrian.grep.try'`; then
- echo shar: \"'1992/adrian.grep.try'\" unpacked with wrong size!
- fi
- # end of '1992/adrian.grep.try'
- fi
- if test -f '1992/ant.hint' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'1992/ant.hint'\"
- else
- echo shar: Extracting \"'1992/ant.hint'\" \(656 characters\)
- sed "s/^X//" >'1992/ant.hint' <<'END_OF_FILE'
- XBest Utility: <ant@mks.com> Anthony C Howe
- X
- X Anthony C Howe
- X Mortice Kern Systems Inc.
- X Unit 1, 14 Weber Street North
- X Waterloo, Ontario
- X N2J 3G4
- X Canada
- X
- X
- XJudges' comments:
- X
- X To use:
- X make am
- X am ant.test.mk
- X
- X Like much of Posix, obfuscation has its place. Your task is to
- X figure out where.
- X
- X This entry comes complete with a Posix-like command description.
- X Interested Posix balloters should lobby the IEEE for an obfuscated
- X P1003 sub-committee.
- X
- X We also suggest that you try:
- X make am
- X am Makefile am_clobber <-- clobber everything except am
- X am Makefile all
- X
- X
- XSelected notes from the author:
- X
- X See the file ant.README.
- END_OF_FILE
- if test 656 -ne `wc -c <'1992/ant.hint'`; then
- echo shar: \"'1992/ant.hint'\" unpacked with wrong size!
- fi
- # end of '1992/ant.hint'
- fi
- if test -f '1992/buzzard.2.README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'1992/buzzard.2.README'\"
- else
- echo shar: Extracting \"'1992/buzzard.2.README'\" \(756 characters\)
- sed "s/^X//" >'1992/buzzard.2.README' <<'END_OF_FILE'
- Xbuzzard.2.README this file
- Xbuzzard.2.design description of FIRST (design documentation of THIRD)
- Xthird implementation of THIRD in FIRST
- Xhelp.th online listing of THIRD primitives
- X
- X FIRST demos: use 'first < {demo}'
- X
- Xdemo1.1st prints Hello World! assuming ASCII
- X
- X THIRD demos: use 'cat third {demo} | first'
- X
- Xdemo1.th prints Hello World! regardless of character set
- Xdemo2.th demonstrates a simple loop
- Xdemo3.th demonstrates a simple if test
- Xdemo4.th recursive factorial calculating on the way up
- Xdemo5.th recursive factorial calculating on the way down
- Xdemo6.th demonstrates switching from compiler to execution mode
- X
- X Interactive THIRD: use 'cat third - | first'.
- X
- X To include the primitive on-line help, use
- X 'cat third help.th - | first'.
- END_OF_FILE
- if test 756 -ne `wc -c <'1992/buzzard.2.README'`; then
- echo shar: \"'1992/buzzard.2.README'\" unpacked with wrong size!
- fi
- # end of '1992/buzzard.2.README'
- fi
- if test -f '1992/buzzard.2.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'1992/buzzard.2.c'\"
- else
- echo shar: Extracting \"'1992/buzzard.2.c'\" \(791 characters\)
- sed "s/^X//" >'1992/buzzard.2.c' <<'END_OF_FILE'
- X#define c m[m[0]++] =
- X#define z;break;case
- X
- Xchar s[5000];
- Xint m[20000]={32},L=1,I,T[500],*S=T,t=64,w,f;
- X
- Xa(x)
- X{
- X c L;
- X L= *m-1;
- X c t;
- X c x;
- X scanf("%s",s+t);
- X t+=strlen(s+t)+1;
- X}
- X
- Xr(x)
- X{
- X switch(m[x++]){
- X z 5: for(w=scanf("%s",s)<1?exit(0),0:L;strcmp(s,&s[m[w+1]]);w=m[w]);
- X w-1 ? r(w+2) : (c 2,c atoi(s))
- X z 12: I=m[m[1]--]
- X z 15: f=S[-f]
- X z 1: c x
- X z 9: f *=* S--
- X z 7: m[f]= *S--;
- X f= *S--
- X z 0: *++S=f;
- X f=m[I++]
- X z 8: f= *S --- f
- X z 2: m[++m[1]]=I;
- X I=x
- X z 11: f=0>f
- X z 4: *m-=2;c 2
- X z 6: f=m[f]
- X z 10: f= *S--/f
- X z 3: a(1);
- X c 2
- X z 13: putchar(f);
- X f= *S--
- X z 14: *++S=f;
- X f=getchar();
- X }
- X}
- X
- Xmain()
- X{
- X a(3);
- X a(4);
- X a(1);
- X w= *m;
- X c 5;
- X c 2;
- X I= *m;
- X c w;
- X c I-1;
- X for(w=6;w<16;)
- X a(1),c w++;
- X m[1]= *m;
- X for(*m+=512;;r(m[I++]));
- X}
- END_OF_FILE
- if test 791 -ne `wc -c <'1992/buzzard.2.c'`; then
- echo shar: \"'1992/buzzard.2.c'\" unpacked with wrong size!
- fi
- # end of '1992/buzzard.2.c'
- fi
- if test -f '1992/demo1.th' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'1992/demo1.th'\"
- else
- echo shar: Extracting \"'1992/demo1.th'\" \(34 characters\)
- sed "s/^X//" >'1992/demo1.th' <<'END_OF_FILE'
- X: demo1 " Hello world!
- X" ;
- X
- Xdemo1
- END_OF_FILE
- if test 34 -ne `wc -c <'1992/demo1.th'`; then
- echo shar: \"'1992/demo1.th'\" unpacked with wrong size!
- fi
- # end of '1992/demo1.th'
- fi
- if test -f '1992/demo2.th' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'1992/demo2.th'\"
- else
- echo shar: Extracting \"'1992/demo2.th'\" \(135 characters\)
- sed "s/^X//" >'1992/demo2.th' <<'END_OF_FILE'
- X: demo2
- X
- X 10 0 ( iterate from 0 stopping before 10 )
- X do
- X i . ( print the loop counter )
- X loop
- X cr ( add a newline )
- X;
- X
- Xdemo2
- END_OF_FILE
- if test 135 -ne `wc -c <'1992/demo2.th'`; then
- echo shar: \"'1992/demo2.th'\" unpacked with wrong size!
- fi
- # end of '1992/demo2.th'
- fi
- if test -f '1992/demo3.th' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'1992/demo3.th'\"
- else
- echo shar: Extracting \"'1992/demo3.th'\" \(245 characters\)
- sed "s/^X//" >'1992/demo3.th' <<'END_OF_FILE'
- X: printfour
- X
- X dup ( save the number on top of the stack )
- X 4 = ( compare it to four )
- X if
- X " forth " ( output a string for it )
- X drop ( and delete the saved value )
- X else
- X .
- X endif
- X;
- X
- X: demo3 10 0 do i printfour loop cr ;
- X
- Xdemo3
- END_OF_FILE
- if test 245 -ne `wc -c <'1992/demo3.th'`; then
- echo shar: \"'1992/demo3.th'\" unpacked with wrong size!
- fi
- # end of '1992/demo3.th'
- fi
- if test -f '1992/demo4.th' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'1992/demo4.th'\"
- else
- echo shar: Extracting \"'1992/demo4.th'\" \(439 characters\)
- sed "s/^X//" >'1992/demo4.th' <<'END_OF_FILE'
- X( compute factorial recursively )
- X( take x as input, return x! and x as output )
- X
- X: fact-help
- X
- X dup if
- X 1 - ( leave x-1 on top )
- X fact-help ( leave x-1, [x-1]! )
- X 1 + ( leave x, [x-1]!, x )
- X swap over swap ( leave [x-1]!, x, x )
- X * ( into x!, x )
- X swap ( into x, x! )
- X else
- X 1 swap
- X then
- X;
- X
- X: fact
- X
- X fact-help
- X drop
- X
- X;
- X
- X: demo4
- X " 4 factorial is: " 4 fact . cr
- X " 6 factorial is: " 6 fact . cr
- X;
- X
- Xdemo4
- END_OF_FILE
- if test 439 -ne `wc -c <'1992/demo4.th'`; then
- echo shar: \"'1992/demo4.th'\" unpacked with wrong size!
- fi
- # end of '1992/demo4.th'
- fi
- if test -f '1992/demo5.th' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'1992/demo5.th'\"
- else
- echo shar: Extracting \"'1992/demo5.th'\" \(339 characters\)
- sed "s/^X//" >'1992/demo5.th' <<'END_OF_FILE'
- X( recursive factorial. given x on top, followed by )
- X( an "accumulator" containing the product except for x! )
- X
- X: fact-help2
- X
- X dup if
- X swap over swap
- X *
- X swap 1 -
- X fact-help2
- X then
- X;
- X
- X: fact
- X
- X 1 swap
- X fact-help2
- X drop
- X;
- X
- X: demo5
- X
- X " The factorial of 3 is: " 3 fact . cr
- X " The factorial of 5 is: " 5 fact . cr
- X;
- X
- Xdemo5
- END_OF_FILE
- if test 339 -ne `wc -c <'1992/demo5.th'`; then
- echo shar: \"'1992/demo5.th'\" unpacked with wrong size!
- fi
- # end of '1992/demo5.th'
- fi
- if test -f '1992/demo6.th' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'1992/demo6.th'\"
- else
- echo shar: Extracting \"'1992/demo6.th'\" \(388 characters\)
- sed "s/^X//" >'1992/demo6.th' <<'END_OF_FILE'
- X: foobar
- X 2
- X [ 2 , ( '[' turns the compiler off, allowing us to execute code )
- X 1 1 1 + + , ( and we compile in-line a 2 and a three )
- X ( the '2' means 'push the number following this' )
- X ]
- X + . cr
- X;
- X
- Xfoobar
- X
- X: 'foobar ' foobar ; ( ' can only be run inside the compiler )
- X ( ' leaves the address of the following word
- X on the stack )
- X
- X'foobar . cr
- X
- X'foobar dump
- END_OF_FILE
- if test 388 -ne `wc -c <'1992/demo6.th'`; then
- echo shar: \"'1992/demo6.th'\" unpacked with wrong size!
- fi
- # end of '1992/demo6.th'
- fi
- if test -f '1992/westley.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'1992/westley.c'\"
- else
- echo shar: Extracting \"'1992/westley.c'\" \(305 characters\)
- sed "s/^X//" >'1992/westley.c' <<'END_OF_FILE'
- X main(l
- X ,a,n,d)char**a;{
- X for(d=atoi(a[1])/10*80-
- X atoi(a[2])/5-596;n="@NKA\
- XCLCCGZAAQBEAADAFaISADJABBA^\
- XSNLGAQABDAXIMBAACTBATAHDBAN\
- XZcEMMCCCCAAhEIJFAEAAABAfHJE\
- XTBdFLDAANEfDNBPHdBcBBBEA_AL\
- X H E L L O, W O R L D! "
- X [l++-3];)for(;n-->64;)
- X putchar(!d+++33^
- X l&1);}
- END_OF_FILE
- if test 305 -ne `wc -c <'1992/westley.c'`; then
- echo shar: \"'1992/westley.c'\" unpacked with wrong size!
- fi
- # end of '1992/westley.c'
- fi
- echo shar: End of archive 5 \(of 5\).
- cp /dev/null ark5isdone
- MISSING=""
- for I in 1 2 3 4 5 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 5 archives.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-