home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume32 / ioccc.1992 / part04 < prev    next >
Text File  |  1992-09-11  |  55KB  |  2,242 lines

  1. Newsgroups: comp.sources.misc
  2. From: chongo@toad.com (Landon Curt Noll)
  3. Subject:  v32i031:  ioccc.1992 - 1992 International Obfuscated C Code Contest winners, Part04/05
  4. Message-ID: <1992Sep10.154532.27264@sparky.imd.sterling.com>
  5. X-Md4-Signature: 0f6c6ff777027ecc308c543afe753f73
  6. Date: Thu, 10 Sep 1992 15:45:32 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: chongo@toad.com (Landon Curt Noll)
  10. Posting-number: Volume 32, Issue 31
  11. Archive-name: ioccc.1992/part04
  12. Environment: C
  13.  
  14. #! /bin/sh
  15. # This is a shell archive.  Remove anything before this line, then feed it
  16. # into a shell via "sh file" or similar.  To overwrite existing files,
  17. # type "sh file -c".
  18. # Contents:  1992/adrian.c 1992/albert.c 1992/albert.hint 1992/ant.c
  19. #   1992/ant.test.mk 1992/buzzard.1.c 1992/buzzard.2.orig.c
  20. #   1992/help.th 1992/imc.c 1992/imc.orig.c 1992/kivinen.c
  21. #   1992/kivinen.hint 1992/kivinen.orig.c 1992/lush.c 1992/lush.hint
  22. #   1992/lush.orig.c 1992/marangon.c 1992/marangon.hint
  23. #   1992/marangon.orig.c 1992/nathan.c 1992/vern.c
  24. # Wrapped by kent@sparky on Thu Sep 10 10:21:21 1992
  25. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  26. echo If this archive is complete, you will see the following message:
  27. echo '          "shar: End of archive 4 (of 5)."'
  28. if test -f '1992/adrian.c' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'1992/adrian.c'\"
  30. else
  31.   echo shar: Extracting \"'1992/adrian.c'\" \(2583 characters\)
  32.   sed "s/^X//" >'1992/adrian.c' <<'END_OF_FILE'
  33. X/* . wc . */
  34. X#include<stdio.h>/* Wht majr flwchrt? */
  35. X#include<string.h>/* That mjr flwchrt! */
  36. X#define P 257
  37. X#define G 17
  38. X#define z 8
  39. X#define v(jr) jr
  40. Xint W ,head;
  41. X#define S(W,b,f) strncpy(W,b,f),W[f]=0\
  42. X
  43. X  
  44. Xchar *wcs=" \t\n";
  45. Xstruct{ char X[z+1]; 
  46. X        char f ;
  47. X        int e ; 
  48. X        struct{ char g[z+1];
  49. X                int b ;
  50. X              } w[ G];
  51. X      } o[ P];
  52. Xint L=0,j= -28;
  53. X
  54. X
  55. Xvoid E(int i, int m,char*c)
  56. X{   
  57. X for(; i<43; i+=3) 
  58. X   putc("}|uutsrq`_^bji`[Zkediml[PO]a_M__]ISOYIRGTNR"[i]+i-9,stderr);
  59. X fprintf(stderr,"(%d): %s\n" ,m,c);
  60. X exit(1);
  61. X}
  62. X
  63. X
  64. X
  65. Xint N(int m, char *t)
  66. X{ 
  67. X  int i ;
  68. X  if (strlen ( 
  69. X              t)>z) t[z ]=0;
  70. X  for(i= 0; i< L ; i++) if(
  71. X                           !strcmp (o[ i] . X
  72. X                                             , t))return i;
  73. X  if( L== P)
  74. X             E(0, m, t);
  75. X  S (o[ L] . X , t
  76. X                  ,z);
  77. X  head; W = .1* head;
  78. X  o[L ].f = !( strchr( t,']' )== 0 );
  79. X  o[L ++ ] . e = 0;
  80. X  return L -1 ; }
  81. X
  82. X#define v(x )
  83. X
  84. Xint A(char *R)
  85. X{
  86. X  int c=0, i;
  87. X  while(* R) {
  88. X    i = -1;
  89. X    while(j){
  90. X      if( ++ i==o[ c].e ) return 0;
  91. X      if(o[ 
  92. X           c] .w[i ] .g[0 ] 
  93. X                            =='.' ||strchr (o[ c].w[i] .g ,* R)){
  94. X      c=
  95. X        o[ c ] .w[i].b; break;/*
  96. Xmain(int sl,char *j[]){
  97. X      sleep (~~~~~~~~atoi(j[1])) ;/* . sl
  98. X      sl s l . sl
  99. X      l l ]
  100. X      sl */ }
  101. X    }
  102. X    R++;
  103. X  }
  104. X  return o[ c].f;
  105. X}
  106. X
  107. X
  108. X main(int wc,char *V[]){char Y[999],*s;FILE*W;int m=0,echo,jr,q,wcl=0,wcw=0,wcc=0;
  109. X v(s = V[1]; if (*V=strrchr(s,'/'))s=*V+1;  if(( !strncmp( s + (jr=strlen(s)) -
  110. X  (q=strlen(V[2]) ),V[2],q))&&jr!=q) s[jr-q] = 0;  puts(s); )
  111. X int e,p,C=0,Q ,basename;
  112. X W= fopen(wc>= 2 ? V[1] : "adgrep.c","rt");
  113. Xecho| m^ e| 5| (int) .8| echo|
  114. Xwc |C ==o[o[C] .e] . 
  115. Xe| e==+p,p; s[o[C] .e ] 
  116. X;
  117. Xwhile( fgets(Y,998,W)) { wcc += strlen(Y); m++;
  118. X     if( s = strtok(Y,wcs)) wcw++;
  119. X     else continue ;
  120. X     C=
  121. X       basename= j +j+*"* . basename" 
  122. X                +j+*"* r ] " + N(m,s) ;
  123. Xwhile( s = strtok(0,wcs)) {
  124. X       if( o[ C ] . e == 
  125. X                         G) E(1 ,m,o[C] .X) ;
  126. X       S(o[C
  127. X             ] .w[o[C ] .e].g,s, z);
  128. X       Q= C ;
  129. X       if(! ( s =strtok ( 0 ,wcs )))wcw --
  130. X       ,E( 2 , m, o[C]
  131. X                   . w[ o[ Q ] .e] . g );
  132. X       e
  133. X         = o[C ] .w[o[C ] .e++ ] .b= N(m,s)
  134. X       ; wcw += 2; }  
  135. X     0&& 
  136. X        W && wcl++
  137. X                  < 10 && printf((W,Y)); }
  138. X   if(j+28) { {
  139. X                ; } printf("%7u%7u%7u\n", wcl , wcw , wcc); }
  140. X   while( gets(Y) ) if(A(Y)) puts(Y);
  141. X   W, jr; }
  142. X
  143. XO(int wc,char**V) {
  144. X--wc && (printf("%s ",*++V), main(wc,V), 1) || printf("\n"); }
  145. X
  146. END_OF_FILE
  147.   if test 2583 -ne `wc -c <'1992/adrian.c'`; then
  148.     echo shar: \"'1992/adrian.c'\" unpacked with wrong size!
  149.   fi
  150.   # end of '1992/adrian.c'
  151. fi
  152. if test -f '1992/albert.c' -a "${1}" != "-c" ; then 
  153.   echo shar: Will not clobber existing file \"'1992/albert.c'\"
  154. else
  155.   echo shar: Extracting \"'1992/albert.c'\" \(3164 characters\)
  156.   sed "s/^X//" >'1992/albert.c' <<'END_OF_FILE'
  157. X#include <stdio.h>
  158. X#include <malloc.h>
  159. X#include <setjmp.h>
  160. X#include <ctype.h>
  161. X#define new(PP) (PP *) malloc(sizeof(PP)) 
  162. Xtypedef struct q {
  163. X    jmp_buf ppp;
  164. X    long qq;
  165. X    struct q *P;
  166. X    struct q *p;
  167. X} 
  168. XPP;
  169. X
  170. XPP *P;
  171. Xint aaaaaa=2;
  172. Xint aaaaaaa=1;
  173. X
  174. Xlong qqq;
  175. X
  176. X
  177. XaaAaaa(aa,aaa)
  178. Xchar *aa;
  179. Xchar *aaa;
  180. X{
  181. X    char aaaa = 0;
  182. X    if ((((( aaa )))))
  183. X    {
  184. X        aaaa = *aa;
  185. X        *aa=0;
  186. X        aa+=strlen(aa+1);
  187. X        P =new(PP);
  188. X        P->P=P;
  189. X        P->p=P;
  190. X    }
  191. X
  192. X    if ((((( !setjmp(P->ppp) ))))) 
  193. X        {
  194. X        if ((((( !isdigit(*aa) )))))
  195. X            longjmp(P->ppp,aaaaaaa);
  196. X        else {
  197. X            P->p->P = new(PP);
  198. X            P->p->P->P = P;
  199. X            P->p->P->p = P->p;
  200. X            P->p = P->p->P;
  201. X
  202. X            P->qq = *aa--;
  203. X            P = P->p;
  204. X            aaAaaa(aa,0);
  205. X        }
  206. X    } else {
  207. X        if ( !aaaa&&!*aa ) 
  208. X           longjmp(P->p->ppp,aaaaaaa);
  209. X
  210. X        if ((((( (P->qq=aaaa)<10     &&!
  211. X                 (isdigit(aaaa))     ||!
  212. X                 (isdigit(*aa)       ||!
  213. X                 *aa                        )))))) 
  214. X        {
  215. X            fprintf(stderr,"Usage %c%s <number>\n",
  216. X            (aaa[0]?7:aaaa),aaa+!aaa[0]);
  217. X            exit(1);
  218. X        }
  219. X    }
  220. X}
  221. X
  222. X
  223. XppPppp(pp,ppp)
  224. XPP **pp, *ppp;
  225. X{
  226. X    int aa;
  227. X    if ((((( !(aa=setjmp(ppp->ppp))||aa==aaaaaa )))))
  228. X    {
  229. X        if ((((( *pp==ppp )))))
  230. X        {
  231. X            ppp = (*pp)->p;
  232. X
  233. X            if ( qqq<47 ) return;
  234. X            if ( ppp->qq!=48 ) return;
  235. X
  236. X            while ( ppp->qq==48 ) 
  237. X            {
  238. X                printf("%ld\n",qqq-45);
  239. X                *pp = ppp;
  240. X                ppp = ppp->p;
  241. X            }
  242. X            qqq -= 1;
  243. X            longjmp(ppp->ppp,aaaaaaa);
  244. X        } else {
  245. X            PP *p;
  246. X
  247. X            ppPppp(pp,ppp->p);
  248. X            for (p=ppp;p!=*pp;p=p->p)
  249. X            {
  250. X                int qq=4;
  251. X                if ((((( qqq<47                            &&
  252. X                         (qq=0,p->qq+=p->p->qq-96)>=48-qqq ||
  253. X                         qqq>46                            &&
  254. X                         (p->qq-=p->p->qq)<0                   ))))) 
  255. X                {
  256. X                    p->qq += qqq+qq;
  257. X                    if ( p->p==P && qqq<=46 )
  258. X                    {
  259. X                        P->p->P = new(PP);
  260. X                        P->p->P->P = P;
  261. X                        P->p->P->p = P->p;
  262. X                        *pp = P = P->p = P->p->P;
  263. X                        P->qq = 48;
  264. X                    }
  265. X
  266. X                    p->p->qq+=qq==0;
  267. X                    p->p->qq-=qq!=0;
  268. X                }
  269. X                else
  270. X                {
  271. X                    p->qq += 48;
  272. X                }
  273. X            }
  274. X            if ( ppp->P==P ) longjmp(ppp->ppp,aaaaaaa);
  275. X        }
  276. X    }
  277. X    else
  278. X    {
  279. X        qqq += 1; 
  280. X
  281. X        while (48==P->qq )
  282. X        {
  283. X            P->P->p = P->p;
  284. X            P = P->p->P = P->P;
  285. X
  286. X        }
  287. X
  288. X        if ( ppp!=ppp->p->p || qqq<47 )
  289. X            longjmp(ppp->ppp,aaaaaa);
  290. X        else
  291. X        {
  292. X            printf("At most one remains\n");
  293. X            exit(0);
  294. X        }
  295. X    }
  296. X}
  297. X
  298. X
  299. Xmain(aaa,aaaa)
  300. Xint aaa;
  301. Xchar **aaaa;
  302. X{
  303. X    aaAaaa(aaa==aaaaaaa?aaaa[0]:aaaa[1],aaaa[0]);
  304. X    qqq = 39;
  305. X    ppPppp(&P,P->p);
  306. X}
  307. X
  308. X
  309. END_OF_FILE
  310.   if test 3164 -ne `wc -c <'1992/albert.c'`; then
  311.     echo shar: \"'1992/albert.c'\" unpacked with wrong size!
  312.   fi
  313.   # end of '1992/albert.c'
  314. fi
  315. if test -f '1992/albert.hint' -a "${1}" != "-c" ; then 
  316.   echo shar: Will not clobber existing file \"'1992/albert.hint'\"
  317. else
  318.   echo shar: Extracting \"'1992/albert.hint'\" \(3193 characters\)
  319.   sed "s/^X//" >'1992/albert.hint' <<'END_OF_FILE'
  320. XMost Useful Program: <albert%bsovax@sun4nl.nluug.nl> Albert van der Horst
  321. X
  322. X    Albert van der Horst
  323. X    S P&A R&C
  324. X    Oranjestraat 8
  325. X    3511 RA   UTRECHT
  326. X    The Netherlands
  327. X
  328. X
  329. XJudges' comments:
  330. X
  331. X    For a canned example:
  332. X    make albert
  333. X    albert 1234567890123456789
  334. X    
  335. X    We were impressed with the speed at which it was able to factor
  336. X    arbitrarily large numbers consisting of factors that fit into
  337. X    a long.
  338. X
  339. X
  340. XSelected notes from the author:
  341. X
  342. X    The Obfuscated version of the Horst algorithm.
  343. X
  344. X    This program will factor unlimited length numbers and print the 
  345. X    factors in ascending order. Numbers of one digit (e.g. 8) 
  346. X    are rejected without notice.
  347. X    It quits as soon as there is at most one
  348. X    factor left, but that factor will not be shown. 
  349. X    It accomplishes this efficiently, without resorting to division
  350. X    or multiplication, until the candidate factor no longer fits in 
  351. X    a signed long. 
  352. X
  353. X    The nicest way is to rename the program into e.g. 4294967297
  354. X    if you want to factor Fermat's 4th number. Then just run it.
  355. X    Or you may type "prog <some-number>"
  356. X    A nice one is also (30 ones)
  357. X    albert 111111111111111111111111111111
  358. X
  359. X    Apart from the foregoing there are no special execution instructions.
  360. X
  361. X    To customize the program into a factorizer of a fixed number, use
  362. X    cc albert.c -o 4294967297
  363. X    or some such.
  364. X
  365. X    There are no data files used, and it is not possible to feed input
  366. X    via stdin.
  367. X
  368. X    I think this program is a nice example of algorithmic obfuscation.
  369. X    Several times two similar algorithms are merged into one. Then you 
  370. X    need quite some tricks to get it running, such as long jumps 
  371. X    through recursive subroutines. I felt like a sword smith, 
  372. X    welding the sword very long, folding it again to the proper 
  373. X    length, keep on hammering till it is tight, then fold again.
  374. X    Always keeping it at the proper red hot temperature, but not too
  375. X    hot lest the hardness fades.
  376. X    The strict naming conventions for subroutines did not make things 
  377. X    much clearer after all, but it was not supposed to.
  378. X
  379. X    I would like to draw attention to the robustness of the program
  380. X    with respect to error handling and the nice stopping criterion.
  381. X    The esthetic appeal of some lines is at the expense of clearness, 
  382. X    I apologize.
  383. X    Running the program through the c-beautifier reveals nothing,
  384. X    it will only destroy some of the lay out.
  385. X    Running the program through lint shows the usual remarks for a
  386. X    K&R program. Defeating this through casts does not make a program 
  387. X    cleaner in my opinion.
  388. X
  389. X    Here are some hints, but they may not be too helpful.
  390. X    1. The Horst algorithm is described in the Hobby Computer Club 
  391. X    Newsletter, year 82, part 4, a real Dutch treat.
  392. X       Assembler, c and Forth version have been around for some years.
  393. X    2. Does fractal programming exist after all?
  394. X    3. You remember the ToomCook algorithm in Knuth?
  395. X       It uses iteration instead of recursion and is quite jumpy.
  396. X       This program shares these disadvantages in a modified form.
  397. X    4. The Conversion is to be found in Knuth, not so the Observation.
  398. X       The Observation: "if it ends in a zero, it is divisible by ten"
  399. END_OF_FILE
  400.   if test 3193 -ne `wc -c <'1992/albert.hint'`; then
  401.     echo shar: \"'1992/albert.hint'\" unpacked with wrong size!
  402.   fi
  403.   # end of '1992/albert.hint'
  404. fi
  405. if test -f '1992/ant.c' -a "${1}" != "-c" ; then 
  406.   echo shar: Will not clobber existing file \"'1992/ant.c'\"
  407. else
  408.   echo shar: Extracting \"'1992/ant.c'\" \(2547 characters\)
  409.   sed "s/^X//" >'1992/ant.c' <<'END_OF_FILE'
  410. X#define W while
  411. X#define S strspn 
  412. X#define R return 
  413. X#define F fprintf(stderr,
  414. X#define C continue;
  415. X
  416. X#include <stdlib.h>
  417. X#include <stdio.h>
  418. X#include <string.h>
  419. X#include <sys/stat.h>
  420. X
  421. X#ifndef RULES
  422. X#define RULES    500
  423. X#endif
  424. X
  425. X#define N(p, i)    (p += i, p += S(p, w), i = strcspn(p, w))
  426. X
  427. Xchar *b, l[BUFSIZ], *t[RULES], *d[RULES], *c[RULES], w[] = "\n\t ";
  428. X
  429. Xtime_t M();
  430. Xint T();
  431. Xvoid U();
  432. X
  433. X
  434. Xtime_t
  435. XM(f)
  436. Xchar *f;
  437. X{
  438. X    int j, x;
  439. X    size_t i = 0;
  440. X    struct stat s;
  441. X    N(f, i);
  442. X    x = f[i];
  443. X    f[i] = 0; 
  444. X    j = stat(f, &s);
  445. X    f[i] = x;
  446. X    R j < 0 ? 0 : s.st_mtime;
  447. X}
  448. X
  449. Xint
  450. XT(f)
  451. Xchar *f;
  452. X{
  453. X    char *q;
  454. X    size_t i = 0, j, k = 1;
  455. X    N(f, i);
  456. X    W ((q = t[k])) {
  457. X        j = 0;
  458. X        W (N(q, j)) {
  459. X            if (i == j && !strncmp(f, q, i))
  460. X                R k;
  461. X        }
  462. X        ++k;
  463. X    }
  464. X    R 0;
  465. X}
  466. X
  467. Xvoid
  468. XU(f)
  469. Xchar *f;
  470. X{
  471. X    time_t t = M(f);
  472. X    size_t i = 0, j = !t, k = T(f);
  473. X    char *p = d[k], *q = c[k];
  474. X    if (!N(p, i) && q && *q != '\t' && j) {
  475. X        F "am: Don't know how to make '%s'.\n", f);
  476. X        exit(1);
  477. X    }
  478. X    W (0 < i) {
  479. X        U(p);
  480. X        if (t < M(p))
  481. X            j = 1;
  482. X        N(p, i);
  483. X    }
  484. X    if (j && q && *q == '\t') {
  485. X        sleep(1);
  486. X        W (*q++ == '\t') {
  487. X            i = j = 1;
  488. X            W (0 < S(q, "-+@")) {
  489. X                if (*q == '@')
  490. X                    
  491. X                    i = 0;
  492. X                if (*q++ == '-')
  493. X                    
  494. X                    j = 0;
  495. X            }
  496. X            if (i)
  497. X                puts(q);
  498. X            if (system(q) && j) {
  499. X                F "am: Error making '%s'\n", f);
  500. X                exit(1);
  501. X            }
  502. X            q += strlen(q) + 1;
  503. X        }
  504. X        c[k] = 0;
  505. X    }
  506. X}
  507. X
  508. Xint
  509. Xmain(u, v)
  510. Xint u;
  511. Xchar **v;
  512. X{
  513. X    FILE *f;
  514. X    struct stat s;
  515. X    size_t i, j, k;
  516. X    char *m, *n, *p, *q, *r;
  517. X    if (u < 2) {
  518. X        F "usage: am <makefile> [target]\n");
  519. X        R 2;
  520. X    }
  521. X    if (stat(*++v, &s) || !(f = fopen(*v, "r")))
  522. X        R 3;
  523. X    q = b = malloc(2*s.st_size);
  524. X    if (!b)
  525. X        R 4;
  526. X    i = 1;
  527. X    k = 0;
  528. X    m = 0;
  529. X    *t = *d = *c = "";
  530. X    W ((r = fgets(l, BUFSIZ, f))) {
  531. X        if (RULES <= i) {
  532. X            F "am: Number of target-rules exceeds %d.\n", RULES);
  533. X            R 1;
  534. X        }
  535. X        if (k) {
  536. X            *q++ = ' ';
  537. X            r += S(r, w);
  538. X        } else {
  539. X            if (t[i])
  540. X                c[i++] = q;
  541. X            if (m && putenv(m))
  542. X                F "am: No more environment space.\n");
  543. X            m = 0;
  544. X            if (*l == '#' || *l == '\n')
  545. X                C
  546. X            p = q;
  547. X        }
  548. X        W (!(k = *r == '\\' && r[1] == '\n') && *r) {
  549. X            if (*r == '$') {
  550. X                if (r[1] == '(') {
  551. X                    n = r+2;
  552. X                    r += strcspn(r, ")");
  553. X                    *r++ = 0;
  554. X                    n = getenv(n);
  555. X                    if (n) 
  556. X                        q = strcpy(q, n) + strlen(n);
  557. X                    C
  558. X                }
  559. X                if (*r == r[1])
  560. X                    ++r;
  561. X            } 
  562. X            if (*r == '=' && *l != '\t' && !m) {
  563. X                *q = 0;
  564. X                m = p;
  565. X                j = 0;
  566. X                q = N(m, j) + m;
  567. X                *q++ = *r;
  568. X                j = 1;
  569. X                if (!N(r, j))
  570. X                    *q++ = 0;
  571. X                C
  572. X            }
  573. X            if (*r == ':') {
  574. X                t[i] = p;
  575. X                *r = 0;
  576. X                d[i] = q+1;
  577. X            }
  578. X            if (*r == '\n')
  579. X                *r = 0;
  580. X            *q++ = *r++;
  581. X        }
  582. X    }
  583. X    fclose(f);
  584. X    U(2 < u ? *++v : t[1]);
  585. X    R 0;
  586. X}
  587. X
  588. END_OF_FILE
  589.   if test 2547 -ne `wc -c <'1992/ant.c'`; then
  590.     echo shar: \"'1992/ant.c'\" unpacked with wrong size!
  591.   fi
  592.   # end of '1992/ant.c'
  593. fi
  594. if test -f '1992/ant.test.mk' -a "${1}" != "-c" ; then 
  595.   echo shar: Will not clobber existing file \"'1992/ant.test.mk'\"
  596. else
  597.   echo shar: Extracting \"'1992/ant.test.mk'\" \(3164 characters\)
  598.   sed "s/^X//" >'1992/ant.test.mk' <<'END_OF_FILE'
  599. X#
  600. X#    Test makefile for AM
  601. X#
  602. X
  603. X#
  604. X#  Allow for empty macros.
  605. X#
  606. XEMPTY=
  607. X
  608. X#
  609. X#  Allow for white space in macro assignment.
  610. X#
  611. XTEXT_1=no white space
  612. XTEXT_2 =left hand side
  613. XTEXT_3= right hand side
  614. XTEXT_4 = both sides
  615. XTEXT_5    =    tabs boths sides
  616. X
  617. X#
  618. X#  Test psuedo targets.
  619. X#
  620. Xall : print_macros repeat redefine many flags multiple split errors done
  621. X
  622. Xprint_macros : empty t1 t2 t3 t4 t5 t.all
  623. X
  624. X#
  625. X#  Targets with no dependencies.
  626. X#
  627. Xempty :
  628. X    echo EMPTY='$(EMPTY)'
  629. X
  630. Xt1 :
  631. X    echo TEXT_1='$(TEXT_1)'
  632. X
  633. Xt2 :
  634. X    echo TEXT_2='$(TEXT_2)'
  635. X
  636. Xt3 :
  637. X    echo TEXT_3='$(TEXT_3)'
  638. X
  639. Xt4 :
  640. X    echo TEXT_4='$(TEXT_4)'
  641. X
  642. Xt5 :
  643. X    echo TEXT_5='$(TEXT_5)'
  644. X
  645. Xt.all :
  646. X    echo $(TEXT_1) $(TEXT_2) $(TEXT_3) $(TEXT_4) $(TEXT_5)
  647. X
  648. X#
  649. X#  Test redefinition of macros.  AM allows redefinition and 
  650. X#  evaluates macros immediately.
  651. X#
  652. XTEXT_1    =text number 1
  653. XTEXT_2    = test macro split \
  654. X    across lines \
  655. X    three lines
  656. XTEXT_3    = test dollar macro '$$'
  657. XTEXT_4    = test dollar again "$$(TEXT_1)"
  658. XTEXT_5    =    imbeded macro '$(TEXT_1)'
  659. X
  660. Xredefine : r1 r2 r3 r4 r5 
  661. X
  662. Xr1 :
  663. X    echo TEXT_1='$(TEXT_1)'
  664. X
  665. Xr2 :
  666. X    echo TEXT_2='$(TEXT_2)'
  667. X
  668. Xr3 :
  669. X    echo TEXT_3='$(TEXT_3)'
  670. X
  671. Xr4 :
  672. X    echo TEXT_4='$(TEXT_4)'
  673. X
  674. Xr5 :
  675. X    echo TEXT_5='$(TEXT_5)'
  676. X
  677. X#
  678. X#  Try to update a prerequisite more than once.  Subsequent occurences
  679. X#  should be ignored once a prerequisite has been updated.
  680. X#
  681. Xrepeat: t1 repeat.a t3
  682. Xrepeat.a : t2 t1
  683. X
  684. X
  685. X#
  686. X#  Target with multi-line receipe.
  687. X#
  688. Xmany : leaf.1 leaf.2
  689. X    echo Execute receipe with multiple commands.
  690. X    ls -1 leaf.*
  691. X    echo Last line of receipe for target 'many'.
  692. X
  693. Xleaf.1 :
  694. X    touch leaf.1
  695. X
  696. Xleaf.2 : 
  697. X    touch leaf.2
  698. X
  699. X
  700. X#
  701. X#  Test receipe line flags.
  702. X#
  703. Xflags : silence ignore always combination
  704. X
  705. X#  Command not displayed before execution.
  706. Xsilence :
  707. X    echo You should not see the 'ls' command printed. 
  708. X    @ls leaf.*
  709. X
  710. X#  Ignore errors from command.
  711. Xignore :
  712. X    echo The 'ls' command should fail but not terminate AM.
  713. X    -ls unknown
  714. X
  715. X#  This flag is ignored by AM since we don't support a silence option (-n).
  716. Xalways :
  717. X    +echo The '+' flag is accepted and ignored.
  718. X
  719. Xcombination:
  720. X    -@echo The next displayed line should not be 'ls unknown'
  721. X    @-ls unknown
  722. X    @+-echo Combined flags test completed.
  723. X
  724. X
  725. X#
  726. X#  Multiple targets.
  727. X#
  728. Xmultiple : node.2 node.5
  729. X
  730. Xnode.1 node.2 node.3 : leaf.1 leaf.2
  731. X    touch node.1 node.2 node.3
  732. X
  733. Xnode.4 node.5 : node.2 leaf.3 
  734. X    touch node.4 node.5
  735. X
  736. Xleaf.3 :
  737. X    touch leaf.3
  738. X
  739. X
  740. X#
  741. X#  Test split lines.
  742. X#
  743. Xsplit : node.6 leaf.4 split.cmd
  744. X    echo Completed split line tests.
  745. X
  746. X#  Target dependencies split across lines.
  747. Xnode.6 : leaf.1 \
  748. X    leaf.2 \
  749. X    leaf.3
  750. X    echo Test dependency list split across lines.
  751. X    touch node.6
  752. X
  753. X#  Target list split across lines.
  754. Xsplit.tar \
  755. Xleaf.4 \
  756. Xleaf.5 :
  757. X    echo Test target list split across lines
  758. X    touch leaf.4 leaf.5 
  759. X
  760. X#  Command lines split across lines.
  761. Xsplit.cmd:
  762. X    echo Try spliting command \
  763. X        lines across more \
  764. X    than one line.
  765. X
  766. X
  767. X#
  768. X#  Test AM error reports and exit statuses.
  769. X#
  770. Xerrors:
  771. X    -am test.mk error.1
  772. X    -am test.mk error.2
  773. X    -am test.mk error.3
  774. X    
  775. X#  Target that does not exist, has no dependencies, and no commands.
  776. Xerror.1:
  777. X
  778. X#  Target where dependency does not exist.
  779. Xerror.2: unknown
  780. X
  781. X#  Receipe command causes error.
  782. Xerror.3: t1 fail t2
  783. Xfail:
  784. X    ls -l unknown
  785. X
  786. X
  787. X#
  788. X#
  789. X#
  790. Xdone:
  791. X    echo AM Test Complete
  792. X
  793. Xclean:
  794. X    rm leaf.* node.*
  795. END_OF_FILE
  796.   if test 3164 -ne `wc -c <'1992/ant.test.mk'`; then
  797.     echo shar: \"'1992/ant.test.mk'\" unpacked with wrong size!
  798.   fi
  799.   # end of '1992/ant.test.mk'
  800. fi
  801. if test -f '1992/buzzard.1.c' -a "${1}" != "-c" ; then 
  802.   echo shar: Will not clobber existing file \"'1992/buzzard.1.c'\"
  803. else
  804.   echo shar: Extracting \"'1992/buzzard.1.c'\" \(2236 characters\)
  805.   sed "s/^X//" >'1992/buzzard.1.c' <<'END_OF_FILE'
  806. X#define A(c,a,b) t=b;t+=a;_(c)
  807. X#define    B(b,a) P(u,a)t=0;t-=a;R t+=u;t+=1;t/=2;_(b)
  808. X#define b(x) x(g)
  809. X#define C ;main(argc,argv)char**argv;{for(;!w;){q=0;l
  810. X#define c(y) x
  811. X#define D(c,a,b) t=a;t/=b;_(c)
  812. X#define d(x) S(x,x,1)
  813. X#define E(a,d) t=d;t-=p;t*=r;t*=a;p+=t;t=1;t-=a;r*=t;
  814. X#define e(x) y
  815. X#define f(x) x(e)
  816. X#define G(x,y) Q(x,atoi(argv[y]))
  817. X#define g(x) x(b)
  818. X#define H Q(w,1)Q(p,0)r=0;
  819. X#define h(x) x(c)
  820. X#define i(c,a,b) a(b,b,c)
  821. X#define J(x) Q(p,x)r=0;
  822. X#define j(x) Q(f(g),x)
  823. X#define K(x) Q(x,argc)
  824. X#define k(x) S(a,y,x)
  825. X#define L(x) u=p;u-=x;t=u;t*=u;R r+=2;r-=t;r/=2;
  826. X#define l L(q) q+=1;
  827. X#define M(c,a,b) t=a;t*=b;_(c)
  828. X#define m(x) x(a,a)
  829. X#define n(x) x(a,y)
  830. X#define O(c,a,b) t=b;t+=1;t+=a;t/=2;Q(c,t)
  831. X#define o(x,y) M(x,x,y)
  832. X#define P(b,a) t=a;R _(b)
  833. X#define R t+=2047;t/=2048;t+=8191;t/=8192;
  834. X#define Q(a,b) t=b;_(a)
  835. X#define S(c,a,b) t=a;t-=b;_(c)
  836. X#define T }
  837. X#define U(c,a,b) u=b;t=b;t-=1;t*=r;t+=1;b=t;t=a;t/=b;b=u;_(c)
  838. X#define V int t,u,q,p=0,r,w=0,
  839. X#define X(y) printf("%x\n",y);
  840. X#define Z(a,d) t=p;t-=d;t*=a;t+=d;_(p)r*=a;
  841. X#define _(a) t-=a;t*=r;a+=t;
  842. X
  843. XV a,x,y,s C
  844. X
  845. X        G(f(g),q)G(          g(h),2)n(B)Z(a,4)n(
  846. X    P)E(a,1)j(2989)H l k     (1)m(B)Z(a,6)l k(h(b))
  847. X      B(s,a             )m(P)        Z(s             ,8)E
  848. X    (a,q                   )Q(       s,h               (g)
  849. X   )Q(                               f(c                ),f
  850. X  (g)                                )j(                s)l
  851. X  i(b                                (h)                ,S,
  852. X f(b                                 ))n               (B)
  853. X E(a                                 ,2)             J(8)
  854. Xl j(                                x)Q(x,1)l n(P)Z(a,8
  855. X)o(x                                ,g(f))d(f(e))J(5)l j
  856. X(x)l                                 d(x              )S(a
  857. X ,x,                                 1)m                (B)
  858. X  Z(a                                ,10                 )U(
  859. X  a,y                                ,x)                 o(a
  860. X   ,x)                               k(a                 )m(
  861. X    P)E(                   a,7)      l j                (0)
  862. X      Q(s,1            )l D(a        ,x,              q)o(
  863. X    a,q)S(a,h(g),a)i(s,       M,a)i(a,A,g(f))i(q,D,x
  864. X        )o(s,16)B(a          ,x)E(a,9)H l j(2766)H
  865. X
  866. XT  X(b(f))  T
  867. END_OF_FILE
  868.   if test 2236 -ne `wc -c <'1992/buzzard.1.c'`; then
  869.     echo shar: \"'1992/buzzard.1.c'\" unpacked with wrong size!
  870.   fi
  871.   # end of '1992/buzzard.1.c'
  872. fi
  873. if test -f '1992/buzzard.2.orig.c' -a "${1}" != "-c" ; then 
  874.   echo shar: Will not clobber existing file \"'1992/buzzard.2.orig.c'\"
  875. else
  876.   echo shar: Extracting \"'1992/buzzard.2.orig.c'\" \(794 characters\)
  877.   sed "s/^X//" >'1992/buzzard.2.orig.c' <<'END_OF_FILE'
  878. X#define c 0 [m] ++ [m] =
  879. X#define z;break;case
  880. X
  881. Xchar s[5000];
  882. Xint m[20000]={32},L=1,I,T[500],*S=T,t=64,w,f;
  883. X
  884. Xa(x)
  885. X{
  886. X   c L;
  887. X   L= *m-1;
  888. X   c t;
  889. X   c x;
  890. X   scanf("%s",s+t);
  891. X   t+=strlen(s+t)+1;
  892. X}
  893. X
  894. Xr(x)
  895. X{
  896. X   switch(x++[m]){
  897. X    z 5:    for(w=scanf("%s",s)<1?exit(0):L;strcmp(s,&w[&m[1]][s]);w=m[w]);
  898. X        w-1 ? r(w+2) : (c 2,c atoi(s))
  899. X    z 12:    I=1[m]--[m]
  900. X    z 15:    f=S[-f]
  901. X    z 1:    c x 
  902. X    z 9:    f *=* S--
  903. X    z 7:    m[f]= *S--;
  904. X        f= *S--
  905. X    z 0:    *++S=f;
  906. X        f=I++[m]
  907. X    z 8:    f= *S --- f
  908. X    z 2:    m[++1[m]]=I;
  909. X        I=x
  910. X    z 11:    f=0>f
  911. X    z 4:    *m-=2;c 2
  912. X    z 6:    f=f[m]
  913. X    z 10:    f= *S--/f
  914. X    z 3:    a(1);
  915. X        c 2
  916. X    z 13:    putchar(f);
  917. X        f= *S--
  918. X    z 14:    *++S=f;
  919. X        f=getchar();
  920. X   }
  921. X}
  922. X
  923. Xmain()
  924. X{
  925. X   a(3);
  926. X   a(4);
  927. X   a(1);
  928. X   w= *m;
  929. X   c 5;
  930. X   c 2;
  931. X   I= *m;
  932. X   c w;
  933. X   c I-1;
  934. X   for(w=6;w<16;)
  935. X      a(1),c w++;
  936. X   m[1]= *m;
  937. X   for(*m+=512;;r(m[I++]));
  938. X}
  939. END_OF_FILE
  940.   if test 794 -ne `wc -c <'1992/buzzard.2.orig.c'`; then
  941.     echo shar: \"'1992/buzzard.2.orig.c'\" unpacked with wrong size!
  942.   fi
  943.   # end of '1992/buzzard.2.orig.c'
  944. fi
  945. if test -f '1992/help.th' -a "${1}" != "-c" ; then 
  946.   echo shar: Will not clobber existing file \"'1992/help.th'\"
  947. else
  948.   echo shar: Extracting \"'1992/help.th'\" \(1774 characters\)
  949.   sed "s/^X//" >'1992/help.th' <<'END_OF_FILE'
  950. X: help key  ( flush the carriage return form the input buffer )
  951. X
  952. X" The following are the standard known words; words marked with (*) are
  953. Ximmediate words, which cannot be used from command mode, but only in
  954. Xword definitions.  Words marked by (**) declare new words, so are always
  955. Xfollowed by the new word.
  956. X
  957. X    ! @        fetch, store
  958. X    + - * / mod    standard arithmetic operations
  959. X    = < > <= >=    standard comparison operations
  960. X
  961. X    not        boolean not of top of stack
  962. X    logical        turn top of stack into 0 or 1
  963. X
  964. X    dup over    duplicate the top of stack or second of stack
  965. X    swap drop    reverse top two elements or drop topmost
  966. X
  967. X    inc dec        increment/decrement the value at address from stack
  968. X    add        add a value from 2nd of stack into address from top
  969. X
  970. X    echo key    output character from, or input to, top of stack
  971. X    . #        print out number on top of stack without/with cr
  972. X    cr        print a carriage return
  973. X
  974. X[more]" key
  975. X" (**)    var        declare variable with initial value taken from stack
  976. X(**)    constant    declare constant with initial value taken from stack
  977. X(**)    array        declare an array with size taken from stack
  978. X
  979. X(*)    if...else...then    FORTH branching construct
  980. X(*)    do...loop        FORTH looping construct
  981. X    i j            loop values (not variables)
  982. X
  983. X    print        print the string pointed to on screen
  984. X
  985. X(*)(**) :        declare a new THIRD word
  986. X(*)    <build does>    declare a data types compile-time and run-time
  987. X(*)    ;        terminate a word definition
  988. X
  989. X[more]" key
  990. X" Advanced words:
  991. X    here        current location in dictionary
  992. X    h        pointer into dictionary
  993. X    r        pointer to return stack
  994. X    fromr tor    pop a value from or to the return stack
  995. X
  996. X    ,        write the top of stack to dictionary
  997. X    '        store the address of the following word on the stack
  998. X    allot        leave space on the dictionary
  999. X
  1000. X    ::        compile a ':' header
  1001. X    [        switch into command mode
  1002. X    ]        continue doing : definitions
  1003. X" ;
  1004. END_OF_FILE
  1005.   if test 1774 -ne `wc -c <'1992/help.th'`; then
  1006.     echo shar: \"'1992/help.th'\" unpacked with wrong size!
  1007.   fi
  1008.   # end of '1992/help.th'
  1009. fi
  1010. if test -f '1992/imc.c' -a "${1}" != "-c" ; then 
  1011.   echo shar: Will not clobber existing file \"'1992/imc.c'\"
  1012. else
  1013.   echo shar: Extracting \"'1992/imc.c'\" \(1965 characters\)
  1014.   sed "s/^X//" >'1992/imc.c' <<'END_OF_FILE'
  1015. X#include             <stdio.h> 
  1016. X#include             <malloc.h> 
  1017. X#define              ext(a) (exit(a),0)
  1018. X#define I          " .:\';+<?F7RQ&%#*"
  1019. X#define a            "%s?\n"
  1020. X#define n            "0?\n"
  1021. X#define C            double    
  1022. X#define o             char
  1023. X#define l             long
  1024. X#define L            sscanf
  1025. X#define i            stderr
  1026. X#define e            stdout
  1027. X#define r               ext   (1)
  1028. X#define s(O,B)       L(++J,O,&B)!=1&&c>++q&&L(v[q],O,&B)!=1&&--q
  1029. X#define F(U,S,C,A) t=0,*++J&&(t=L(J,U,&C,&A)),(!t&&c>++q&&!(t=L(v[q],U,\
  1030. X           &C,&A)))?--q:(t<2&&c>++q&&!(t=L(v[q],S,&A))&&--q
  1031. X#define T(E)        (s("%d",E),E||(fputs(n,i),r))
  1032. X#define d(C,c)          (F("%lg,%lg","%lg",C,c)))
  1033. X#define O       (F("%d,%d","%d",N,U),(N&&U)||(fputs(n,i),r)))
  1034. X#define D              (s("%lg",f))
  1035. X#define E              putc
  1036. X                           C
  1037. X                        G=0,
  1038. X                        R
  1039. X                         =0,Q,H
  1040. X                        ,M,P,z,S
  1041. X                         =0,x=0
  1042. X                 ,        f=0;l b,j=0,          k
  1043. X                  =128,K=1,V,B=0,Y,m=128,p=0,N
  1044. X                 =768,U=768,h[]={0x59A66A95,256
  1045. X                 ,192,1,6912,1,0,0},t,A=0,W=0,Z=63,X=23
  1046. X                ;o*J,_;main(c,v)l c;o**v;{l q=1;for(;;q<
  1047. X          c       ?(((J=v[q])[0]&&J[0]<48&&J++,((_= *J)<99||
  1048. X        _/2==       '2'||(_-1)/3=='\"'||_==107||_/05*2==','||_
  1049. X          >0x074)?(   fprintf(i,a,v[q]),r):_>0152?(_/4>27?(_&1?(
  1050. X         O,Z=N,X=U):  (W++,N=Z,U=X)):_&1?T(K):T(k)):_>103?(d(G,
  1051. X    R    ),j=1):_&1? d(S,x):D,q++),q--,main(c-q,v+q)):A==0?(A=
  1052. X  1,f||(f=N/4.),b=(((N-1)&017)<8),q=(((N+7)>>3)+b)*U,(J=malloc(q)
  1053. X  )||(perror("malloc"),r),S-=(N/2)/f,x+=(U/2)/f):A==1?(B<U?(A=2,V
  1054. X    =    0,Q=x-B/f,j ||(R=Q),W&&E('\n',e),E(46,i)):(W&&E('\n',
  1055. X         e),E('\n',i  ),h[1]=N,h[2]=U,h[4]=q,W||(fwrite(h,1,32,
  1056. X          e),fwrite   (J,1,q,e)),free(J),ext(0))):A==2?(V<N?(j?
  1057. X        (H=V/f       +S,M=Q):(G=V/f+S,H=M=0),Y=0,A=03):((m&0x80
  1058. X           )       ||(m=0x80,p++),b&&(J[p++]=0),A=1,B++)):((Y
  1059. X                <k&&(P=H*H)+(z=M*M)<4.)?(M=2*H*M+R,H=P-z
  1060. X                 +G,Y++):(W&&E(I[0x0f*(Y&K)/K],e),Y&K?J
  1061. X                     [p]&=~m:(J[p]|=m),(m>>=1)||/*/
  1062. X                  (m=128,u--),A==6?ext(1):B<u
  1063. X                 .      e=3,l=2*c*/(       m
  1064. X                         =0x80,
  1065. X                        p++),V++
  1066. X                         ,A=0x2
  1067. X                        )
  1068. X                        ));
  1069. X                           }
  1070. END_OF_FILE
  1071.   if test 1965 -ne `wc -c <'1992/imc.c'`; then
  1072.     echo shar: \"'1992/imc.c'\" unpacked with wrong size!
  1073.   fi
  1074.   # end of '1992/imc.c'
  1075. fi
  1076. if test -f '1992/imc.orig.c' -a "${1}" != "-c" ; then 
  1077.   echo shar: Will not clobber existing file \"'1992/imc.orig.c'\"
  1078. else
  1079.   echo shar: Extracting \"'1992/imc.orig.c'\" \(1937 characters\)
  1080.   sed "s/^X//" >'1992/imc.orig.c' <<'END_OF_FILE'
  1081. X#include             <stdio.h> 
  1082. X#include             <malloc.h> 
  1083. X#define I          " .:\';+<?F7RQ&%#*"
  1084. X#define a            "%s?\n"
  1085. X#define n            "0?\n"
  1086. X#define C            double    
  1087. X#define o             char
  1088. X#define l             long
  1089. X#define L            sscanf
  1090. X#define i            stderr
  1091. X#define e            stdout
  1092. X#define r              exit   (1)
  1093. X#define s(O,B)       L(++J,O,&B)!=1&&c>++q&&L(v[q],O,&B)!=1&&--q
  1094. X#define F(U,S,C,A) t=0,*++J&&(t=L(J,U,&C,&A)),(!t&&c>++q&&!(t=L(v[q],U,\
  1095. X           &C,&A)))?--q:(t<2&&c>++q&&!(t=L(v[q],S,&A))&&--q
  1096. X#define T(E)        (s("%d",E),E||(fputs(n,i),r))
  1097. X#define d(C,c)          (F("%lg,%lg","%lg",C,c)))
  1098. X#define O       (F("%d,%d","%d",N,U),(N&&U)||(fputs(n,i),r)))
  1099. X#define D              (s("%lg",f))
  1100. X#define E              putc
  1101. X                           C
  1102. X                        G=0,
  1103. X                        R
  1104. X                         =0,Q,H
  1105. X                        ,M,P,z,S
  1106. X                         =0,x=0
  1107. X                 ,        f=0;l b,j=0,          k
  1108. X                  =128,K=1,V,B=0,Y,m=128,p=0,N
  1109. X                 =768,U=768,h[]={0x59A66A95,256
  1110. X                 ,192,1,6912,1,0,0},t,A=0,W=0,Z=63,X=23
  1111. X                ;o*J,_;main(c,v)l c;o**v;{l q=1;for(;;q<
  1112. X          c       ?(((J=v[q])[0]&&J[0]<48&&J++,((_= *J)<99||
  1113. X        _/2==       '2'||(_-1)/3=='\"'||_==107||_/05*2==','||_
  1114. X          >0x074)?(   fprintf(i,a,v[q]),r):_>0152?(_/4>27?(_&1?(
  1115. X         O,Z=N,X=U):  (W++,N=Z,U=X)):_&1?T(K):T(k)):_>103?(d(G,
  1116. X    R    ),j=1):_&1? d(S,x):D,q++),q--,main(c-q,v+q)):A==0?(A=
  1117. X  1,f||(f=N/4.),b=(((N-1)&017)<8),q=(((N+7)>>3)+b)*U,(J=malloc(q)
  1118. X  )||(perror("malloc"),r),S-=(N/2)/f,x+=(U/2)/f):A==1?(B<U?(A=2,V
  1119. X    =    0,Q=x-B/f,j ||(R=Q),W&&E('\n',e),E(46,i)):(W&&E('\n',
  1120. X         e),E('\n',i  ),h[1]=N,h[2]=U,h[4]=q,W||(fwrite(h,1,32,
  1121. X          e),fwrite   (J,1,q,e)),free(J),exit(0))):A==2?(V<N?(j?
  1122. X        (H=V/f       +S,M=Q):(G=V/f+S,H=M=0),Y=0,A=03):((m&0x80
  1123. X           )       ||(m=0x80,p++),b&&(J[p++]=0),A=1,B++)):((Y
  1124. X                <k&&(P=H*H)+(z=M*M)<4.)?(M=2*H*M+R,H=P-z
  1125. X                 +G,Y++):(W&&E(I[0x0f*(Y&K)/K],e),Y&K?J
  1126. X                     [p]&=~m:(J[p]|=m),(m>>=1)||/*/
  1127. X                  (m=128,u--),A==6?exit(1):B<u
  1128. X                 .      e=3,l=2*c*/(        m
  1129. X                         =0x80,
  1130. X                        p++),V++
  1131. X                         ,A=0x2
  1132. X                        )
  1133. X                        ));
  1134. X                           }
  1135. END_OF_FILE
  1136.   if test 1937 -ne `wc -c <'1992/imc.orig.c'`; then
  1137.     echo shar: \"'1992/imc.orig.c'\" unpacked with wrong size!
  1138.   fi
  1139.   # end of '1992/imc.orig.c'
  1140. fi
  1141. if test -f '1992/kivinen.c' -a "${1}" != "-c" ; then 
  1142.   echo shar: Will not clobber existing file \"'1992/kivinen.c'\"
  1143. else
  1144.   echo shar: Extracting \"'1992/kivinen.c'\" \(2119 characters\)
  1145.   sed "s/^X//" >'1992/kivinen.c' <<'END_OF_FILE'
  1146. X#include                               <X11/Xlib.h>
  1147. X#define                             ext(a) (exit(a),0)
  1148. X# define             X(        x,v,y) XMoveWindow(d,s[x],(v)*z,(y)*z)
  1149. X#  define             _        ButtonPressMask|ButtonReleaseMask
  1150. X#   define             I(             x,y) XSelectInput(d,s[x],y)
  1151. X#    define             N(              v) (XMapWindow(d,s[v]),v)
  1152. X#     define             V              VisibilityChangeMask
  1153. X#      define             A              XCreateSimpleWindow
  1154. X#    define             D                DefaultScreen(d)
  1155. X#     define             E               r.xbutton.button
  1156. X#      define         R                BlackPixel(d,D)
  1157. X#       define         S                r.xvisibility
  1158. X
  1159. X          int main(a)int a;{Window s[53];int w,u,i,c,y,l=0
  1160. X      ,q,e=32,t,k,j=~0,z=(a+1)/2,x=a&1,v=z&1;XEvent r;Display*
  1161. X    d=XOpenDisplay("");s[0]=A(d,DefaultRootWindow(d),200,200,(x&
  1162. X       v?330:120)*z,215*z,2,R,R);I(N(c=0),_);for(;c<(x?32:52);c++){s[
  1163. X       c+1]=A(d,s[0],x          ?c*20*z:(c-1)%10          *12*z,x?-20*z:(
  1164. X      c-1)/10*12*z,x        ?z*(c^31?10:        2):z*10*(c?1:2
  1165. X      ), x& v?z*10:     (c     &&!x?10:1+     x)     *z,k =q=1, R,
  1166. X      WhitePixel(d     ,D));I      (N(c+1),     V);}X(      N(1),y=(x&v)
  1167. X      *115+50,x*70+     60     ); X(N(c--     )+     1,x?-10:(i=y)
  1168. X      ,u=!x*130-20);        while(c &&e<        160){if(x){if(
  1169. X      v){l=!(e &32)*9;          for(w=30; w--;){          if(s[w+2]){ k=w%
  1170. X      10;l=e&32?k>l?k:l:k<l?k:l;X(w+2,10+k *20+q,(w/10)*20+e);}}l*=20;
  1171. X      e&31?e++:e&32?(q++,(q+l>300?e++:0)):(q--,q+l<10?e++:0); } u>140?
  1172. X      ext(c):u>-20?X(32,i,u-=(v?5:-1 )) :(!v?(u =5,srandom(time(0)),i=
  1173. X      random()%88+6):0); } else{k>0?i+=(i>105?k= -k:k):(i+=(i<1?k= -k:
  1174. X      k)); j>0?u     +=(u>140?ext(++c):j):(u+=(u        <1?j= -j:j
  1175. X      )); X(            52,i,u);}XSync(d,0);        while(
  1176. X      XCheckMaskEvent(d          ,_|V,&r))if(!(r.         type==ButtonPress
  1177. X      ?(E&1||!x||!v?t=E*4-8             :u<0?i=y+4,u=122:1):r
  1178. X      .type==ButtonRelease&&E?t=0,1:r.type^VisibilityNotify|S.state^1)
  1179. X      )for(x&v?(u=         -15),w++:(w=0);++w          <52-x*20;)if
  1180. X      (s[w]              ==S.window)x&&v||             w ^1?
  1181. X      XUnmapWindow           (d,s[w])          ,s[w]=0,c--:
  1182. X      0,l=1; if(!x&&l)j=                -j,l=0; if(l&x&&!v
  1183. X      )u=~19,c--,l=0;t=(!x||!v)             &&(y<5&&t<0||y>95&&t>0)?0
  1184. X      :t;s[1]?X(1,y+=x&v?t:t/(x+1),130):ext(++c);};return(c);}
  1185. END_OF_FILE
  1186.   if test 2119 -ne `wc -c <'1992/kivinen.c'`; then
  1187.     echo shar: \"'1992/kivinen.c'\" unpacked with wrong size!
  1188.   fi
  1189.   # end of '1992/kivinen.c'
  1190. fi
  1191. if test -f '1992/kivinen.hint' -a "${1}" != "-c" ; then 
  1192.   echo shar: Will not clobber existing file \"'1992/kivinen.hint'\"
  1193. else
  1194.   echo shar: Extracting \"'1992/kivinen.hint'\" \(2547 characters\)
  1195.   sed "s/^X//" >'1992/kivinen.hint' <<'END_OF_FILE'
  1196. XBest X Program: <kivinen@hut.fi> Tero Kivinen
  1197. X
  1198. X    Tero Kivinen
  1199. X    Helsinki University of Technology
  1200. X    Klovinrinne 6b
  1201. X    02180 Espoo
  1202. X    Finland
  1203. X
  1204. X
  1205. XJudges' comments:
  1206. X
  1207. X    If your machine support the X Window System, Version 11:
  1208. X    make kivinen
  1209. X
  1210. X    The type of entertainment depends on number of arguments
  1211. X    you have with the program.  :-)
  1212. X
  1213. X    NOTE: Some systems do not need (or have) -lsocket -lresolv -lnsl.
  1214. X      Such systems should compile using -lX11.
  1215. X
  1216. X    NOTE: The original winning source kivinen.orig.c assumed that
  1217. X      exit returned a value which cause problems for some
  1218. X      systems where exit returned a void.  The file kivinen.c
  1219. X      avoids this problem.
  1220. X    
  1221. X
  1222. XSelected notes from the author:
  1223. X
  1224. X    X Entertainment Kit
  1225. X
  1226. X    This kit includes three games from the early of video games for
  1227. X    The X Window System Version 11 Release 5. It should work with
  1228. X    earlier releases, though.
  1229. X
  1230. X
  1231. X    Space Invaders
  1232. X
  1233. X    The classic game of shooting aliens from outer space, trying to
  1234. X    exterminate all life on earth. The game ends when the first line
  1235. X    of aliens touches the ground, or destroy you. To win the game you
  1236. X    must destroy all the aliens. If you evade out from the screen you
  1237. X    lose.
  1238. X
  1239. X        Controls:
  1240. X                Button 1 = Move left
  1241. X                Button 2 = Fire missile
  1242. X                Button 3 = Move right
  1243. X
  1244. X
  1245. X    Breakout
  1246. X
  1247. X    Break all the bricks with the ball, using your paddle. If you miss
  1248. X    the ball the game ends.
  1249. X
  1250. X        Controls:
  1251. X                Button 1 = Move left
  1252. X                Button 3 = Move right
  1253. X
  1254. X
  1255. X    Dropout
  1256. X
  1257. X    Catch all the falling pieces, before they reach the ground. If you
  1258. X    miss it, game ends. To win you must catch all 30 pieces.
  1259. X
  1260. X        Controls:
  1261. X                Button 1 = Move left
  1262. X                Button 3 = Move right
  1263. X
  1264. X
  1265. X
  1266. X    Starting the game
  1267. X
  1268. X    The type of the game is determined by the number of arguments
  1269. X    given to the program.
  1270. X
  1271. X        no arguments = Space Invaders
  1272. X        1 argument   = Breakout
  1273. X        2 arguments  = Dropout
  1274. X        3 arguments  = double sized Breakout
  1275. X        4 arguments  = triple sized Space Invaders
  1276. X        5 arguments  = triple sized Breakout
  1277. X        6 arguments  = double sized Dropout
  1278. X        7 arguments  = quadruple sized Breakout
  1279. X        and so on...
  1280. X
  1281. X
  1282. X    Scores
  1283. X
  1284. X    The exit value of the game is your score. The smaller the score
  1285. X    the better it is. The exit value of zero means you have won.
  1286. X
  1287. X
  1288. X    Features
  1289. X
  1290. X    The game has a cheat system, which can be found after examining the
  1291. X    event loop at the end of program. It is not a bug, it's a feature!
  1292. X
  1293. END_OF_FILE
  1294.   if test 2547 -ne `wc -c <'1992/kivinen.hint'`; then
  1295.     echo shar: \"'1992/kivinen.hint'\" unpacked with wrong size!
  1296.   fi
  1297.   # end of '1992/kivinen.hint'
  1298. fi
  1299. if test -f '1992/kivinen.orig.c' -a "${1}" != "-c" ; then 
  1300.   echo shar: Will not clobber existing file \"'1992/kivinen.orig.c'\"
  1301. else
  1302.   echo shar: Extracting \"'1992/kivinen.orig.c'\" \(2084 characters\)
  1303.   sed "s/^X//" >'1992/kivinen.orig.c' <<'END_OF_FILE'
  1304. X#include                               <X11/Xlib.h>
  1305. X# define             X(        x,v,y) XMoveWindow(d,s[x],(v)*z,(y)*z)
  1306. X#  define             _        ButtonPressMask|ButtonReleaseMask
  1307. X#   define             I(             x,y) XSelectInput(d,s[x],y)
  1308. X#    define             N(              v) (XMapWindow(d,s[v]),v)
  1309. X#     define             V              VisibilityChangeMask
  1310. X#      define             A              XCreateSimpleWindow
  1311. X#    define             D                DefaultScreen(d)
  1312. X#     define             E               r.xbutton.button
  1313. X#      define         R                BlackPixel(d,D)
  1314. X#       define         S                r.xvisibility
  1315. X
  1316. X          int main(a)int a;{Window s[53];int w,u,i,c,y,l=0
  1317. X      ,q,e=32,t,k,j=~0,z=(a+1)/2,x=a&1,v=z&1;XEvent r;Display*
  1318. X    d=XOpenDisplay("");s[0]=A(d,DefaultRootWindow(d),200,200,(x&
  1319. X       v?330:120)*z,215*z,2,R,R);I(N(c=0),_);for(;c<(x?32:52);c++){s[
  1320. X       c+1]=A(d,s[0],x          ?c*20*z:(c-1)%10          *12*z,x?-20*z:(
  1321. X      c-1)/10*12*z,x        ?z*(c^31?10:        2):z*10*(c?1:2
  1322. X      ), x& v?z*10:     (c     &&!x?10:1+     x)     *z,k =q=1, R,
  1323. X      WhitePixel(d     ,D));I      (N(c+1),     V);}X(      N(1),y=(x&v)
  1324. X      *115+50,x*70+     60     ); X(N(c--     )+     1,x?-10:(i=y)
  1325. X      ,u=!x*130-20);        while(c &&e<        160){if(x){if(
  1326. X      v){l=!(e &32)*9;          for(w=30; w--;){          if(s[w+2]){ k=w%
  1327. X      10;l=e&32?k>l?k:l:k<l?k:l;X(w+2,10+k *20+q,(w/10)*20+e);}}l*=20;
  1328. X      e&31?e++:e&32?(q++,(q+l>300?e++:0)):(q--,q+l<10?e++:0); } u>140?
  1329. X      exit(c):u>-20?X(32,i,u-=(v?5:-1)):(!v?(u =5,srandom(time(0)),i=
  1330. X      random()%88+6):0); } else{k>0?i+=(i>105?k= -k:k):(i+=(i<1?k= -k:
  1331. X      k)); j>0?u    +=(u>140?exit(++c):j):(u+=(u        <1?j= -j:j
  1332. X      )); X(            52,i,u);}XSync(d,0);        while(
  1333. X      XCheckMaskEvent(d          ,_|V,&r))if(!(r.         type==ButtonPress
  1334. X      ?(E&1||!x||!v?t=E*4-8             :u<0?i=y+4,u=122:1):r
  1335. X      .type==ButtonRelease&&E?t=0,1:r.type^VisibilityNotify|S.state^1)
  1336. X      )for(x&v?(u=         -15),w++:(w=0);++w          <52-x*20;)if
  1337. X      (s[w]              ==S.window)x&&v||             w ^1?
  1338. X      XUnmapWindow           (d,s[w])          ,s[w]=0,c--:
  1339. X      0,l=1; if(!x&&l)j=                -j,l=0; if(l&x&&!v
  1340. X      )u=~19,c--,l=0;t=(!x||!v)             &&(y<5&&t<0||y>95&&t>0)?0
  1341. X     :t;s[1]?X(1,y+=x&v?t:t/(x+1),130):exit(++c);};return(c);}
  1342. END_OF_FILE
  1343.   if test 2084 -ne `wc -c <'1992/kivinen.orig.c'`; then
  1344.     echo shar: \"'1992/kivinen.orig.c'\" unpacked with wrong size!
  1345.   fi
  1346.   # end of '1992/kivinen.orig.c'
  1347. fi
  1348. if test -f '1992/lush.c' -a "${1}" != "-c" ; then 
  1349.   echo shar: Will not clobber existing file \"'1992/lush.c'\"
  1350. else
  1351.   echo shar: Extracting \"'1992/lush.c'\" \(1885 characters\)
  1352.   sed "s/^X//" >'1992/lush.c' <<'END_OF_FILE'
  1353. X#define f 000:
  1354. X          char
  1355. X      *s,*
  1356. X      t,v;
  1357. X      char 
  1358. X      _  [
  1359. X      999]
  1360. X      ,x [
  1361. X      999]
  1362. X      ,*p=
  1363. X      x  ;
  1364. X      char
  1365. X      *av[
  1366. X      ]= {
  1367. X      "W",
  1368. X      "H",
  1369. X      "o",
  1370. X      "l",
  1371. X      "N",
  1372. X      "e",
  1373. X      " ",
  1374. X      "r",
  1375. X      "d",
  1376. X      ".",
  1377. X      "m",
  1378. X          "s",
  1379. X          "g",
  1380. X          "!",
  1381. X          "*",
  1382. X          "\n"
  1383. X      }  ;
  1384. X       int 
  1385. X      n= 0
  1386. X      ;int 
  1387. X      __ =
  1388. X      0,i=
  1389. X      000;
  1390. X      main
  1391. X      () {
  1392. X#define f 001:
  1393. X#define F 042:
  1394. X#define f 100:
  1395. X         _[i--
  1396. X#define f 126:
  1397. X#define f 132:
  1398. X#define f 103:
  1399. X#define f 202:
  1400. X#define f 666:
  1401. X#define f 77::
  1402. X#define f 101:
  1403. X       ]=0
  1404. X#define f 232:
  1405. X#define f 151:
  1406. X      ;if(
  1407. X#define f 256:
  1408. X          !i){
  1409. X          puts
  1410. X          ("I"
  1411. X          "BM"
  1412. X          " S"
  1413. X          "UX"
  1414. X          );;;
  1415. X          ;;;}
  1416. X      ;for
  1417. X      (  ;
  1418. X      gets
  1419. X      (_);
  1420. X      )  {
  1421. X      for(
  1422. X#define f 301:
  1423. X      t=_,
  1424. X#define f 700:
  1425. X#define f 999:
  1426. X      s=t,
  1427. X#define f 77 :
  1428. X#define f 300:
  1429. X      s=t;
  1430. X#define f s=t;
  1431. X#define f 123:
  1432. X#define f 127:
  1433. X      *t&&
  1434. X      !(!(
  1435. X      *t <
  1436. X      '0'
  1437. X      ||*t
  1438. X      >'9'
  1439. X      )&&!
  1440. X          ((t[
  1441. X          1] ^
  1442. X          ':')
  1443. X          &&(t
  1444. X          [1]^
  1445. X          '.')
  1446. X      )) ; 
  1447. X      t++)
  1448. X#define f 137:
  1449. X#define f 133:
  1450. X      ;if(
  1451. X#define f 111:
  1452. X#define f 220:
  1453. X          v^*t
  1454. X          &&*t
  1455. X      ){v=
  1456. X          *t;;
  1457. X          n=n*
  1458. X      2+(1
  1459. X      &*t)
  1460. X      ;__=
  1461. X      (__+
  1462. X      1)&3
  1463. X      ; __
  1464. X      ||((
  1465. X      n<15
  1466. X      &&(*
  1467. X      p= *
  1468. X      av[n
  1469. X      ] ),
  1470. X#define f 2+2:
  1471. X      p++)
  1472. X      ,n=0
  1473. X      );}}
  1474. X#define f ==4:
  1475. X      ;*p=
  1476. X      '\0'
  1477. X      ;;;;
  1478. X#define f puts
  1479. X      puts
  1480. X      (x);
  1481. X      s=t;
  1482. X#define f s=5;
  1483. X      s=t;
  1484. X#define f s=5:
  1485. X      s=t;
  1486. X#define f 445:
  1487. X#define f 113:
  1488. X#define f 900:
  1489. X      s=t;
  1490. X#define f n22:
  1491. X#define f n40:
  1492. X      s=t;
  1493. X#define f nn6:
  1494. X      s=t;
  1495. X#define f nn1:
  1496. X#define f 0:--
  1497. X      s=t;
  1498. X#define f 19:-
  1499. X#define f x2:x
  1500. X      s=t;
  1501. X#define f x1:x
  1502. X      s=t;
  1503. X#define f y2:x
  1504. X#define f y7:y
  1505. X      s=t;
  1506. X#define f 1:::
  1507. X      s=t;
  1508. X#define f @3:@
  1509. X#define f 10:0
  1510. X#define f x+1:
  1511. X      s=t;
  1512. X#define f 2:::
  1513. X#define f 3:::
  1514. X#define x 7:::
  1515. X#define y 3:::
  1516. X#define z 990:
  1517. X#define Z 47::
  1518. X      ;;;}
  1519. X
  1520. END_OF_FILE
  1521.   if test 1885 -ne `wc -c <'1992/lush.c'`; then
  1522.     echo shar: \"'1992/lush.c'\" unpacked with wrong size!
  1523.   fi
  1524.   # end of '1992/lush.c'
  1525. fi
  1526. if test -f '1992/lush.hint' -a "${1}" != "-c" ; then 
  1527.   echo shar: Will not clobber existing file \"'1992/lush.hint'\"
  1528. else
  1529.   echo shar: Extracting \"'1992/lush.hint'\" \(695 characters\)
  1530.   sed "s/^X//" >'1992/lush.hint' <<'END_OF_FILE'
  1531. XWorst Abuse of the C Preprocessor: <lush@erc.msstate.edu> Ed Luke
  1532. X
  1533. X    Ed Luke
  1534. X    Mississippi State University
  1535. X    P.O. Box 6176
  1536. X    Mississippi State, MS 39762, USA
  1537. X
  1538. X
  1539. XJudges' comments:
  1540. X
  1541. X    To setup:
  1542. X    make lush
  1543. X    
  1544. X    Try:
  1545. X    make lush.again 2>&1 | lush        (sh or ksh users)
  1546. X    or:
  1547. X    make lush.again |& lush            (csh users)
  1548. X
  1549. X    The program uses error messages issued by the C Proproessor to
  1550. X    generate its message to the world.  One program's error is another 
  1551. X    program's data!
  1552. X
  1553. X
  1554. XSelected notes from the author:
  1555. X
  1556. X    This program is yet another "Hello World." program with a twist.  The
  1557. X    string Hello World has been encoded in the error messages the compiler
  1558. X    generates when compiling the source.
  1559. END_OF_FILE
  1560.   if test 695 -ne `wc -c <'1992/lush.hint'`; then
  1561.     echo shar: \"'1992/lush.hint'\" unpacked with wrong size!
  1562.   fi
  1563.   # end of '1992/lush.hint'
  1564. fi
  1565. if test -f '1992/lush.orig.c' -a "${1}" != "-c" ; then 
  1566.   echo shar: Will not clobber existing file \"'1992/lush.orig.c'\"
  1567. else
  1568.   echo shar: Extracting \"'1992/lush.orig.c'\" \(1885 characters\)
  1569.   sed "s/^X//" >'1992/lush.orig.c' <<'END_OF_FILE'
  1570. X#define f 000:
  1571. X          char
  1572. X      *s,*
  1573. X      t,v;
  1574. X      char 
  1575. X      _  [
  1576. X      999]
  1577. X      ,x [
  1578. X      999]
  1579. X      ,*p=
  1580. X      x  ;
  1581. X      char
  1582. X      *av[
  1583. X      ]= {
  1584. X      "W",
  1585. X      "H",
  1586. X      "o",
  1587. X      "l",
  1588. X      "N",
  1589. X      "e",
  1590. X      " ",
  1591. X      "r",
  1592. X      "d",
  1593. X      ".",
  1594. X      "m",
  1595. X          "s",
  1596. X          "g",
  1597. X          "!",
  1598. X          "*",
  1599. X          "\n"
  1600. X      }  ;
  1601. X       int 
  1602. X      n= 0
  1603. X      ;int 
  1604. X      __ =
  1605. X      0,i=
  1606. X      000;
  1607. X      main
  1608. X      () {
  1609. X#define f 001:
  1610. X#define F 042:
  1611. X#define f 100:
  1612. X          i--[
  1613. X#define f 126:
  1614. X#define f 132:
  1615. X#define f 103:
  1616. X#define f 202:
  1617. X#define f 666:
  1618. X#define f 77::
  1619. X#define f 101:
  1620. X      _]=0
  1621. X#define f 232:
  1622. X#define f 151:
  1623. X      ;if(
  1624. X#define f 256:
  1625. X          !i){
  1626. X          puts
  1627. X          ("I"
  1628. X          "BM"
  1629. X          " S"
  1630. X          "UX"
  1631. X          );;;
  1632. X          ;;;}
  1633. X      ;for
  1634. X      (  ;
  1635. X      gets
  1636. X      (_);
  1637. X      )  {
  1638. X      for(
  1639. X#define f 301:
  1640. X      t=_,
  1641. X#define f 700:
  1642. X#define f 999:
  1643. X      s=t,
  1644. X#define f 77 :
  1645. X#define f 300:
  1646. X      s=t;
  1647. X#define f s=t;
  1648. X#define f 123:
  1649. X#define f 127:
  1650. X      *t&&
  1651. X      !(!(
  1652. X      *t <
  1653. X      '0'
  1654. X      ||*t
  1655. X      >'9'
  1656. X      )&&!
  1657. X          ((t[
  1658. X          1] ^
  1659. X          ':')
  1660. X          &&(t
  1661. X          [1]^
  1662. X          '.')
  1663. X      )) ; 
  1664. X      t++)
  1665. X#define f 137:
  1666. X#define f 133:
  1667. X      ;if(
  1668. X#define f 111:
  1669. X#define f 220:
  1670. X          v^*t
  1671. X          &&*t
  1672. X      ){v=
  1673. X          *t;;
  1674. X          n=n*
  1675. X      2+(1
  1676. X      &*t)
  1677. X      ;__=
  1678. X      (__+
  1679. X      1)&3
  1680. X      ; __
  1681. X      ||((
  1682. X      n<15
  1683. X      &&(*
  1684. X      p= *
  1685. X      av[n
  1686. X      ] ),
  1687. X#define f 2+2:
  1688. X      p++)
  1689. X      ,n=0
  1690. X      );}}
  1691. X#define f ==4:
  1692. X      ;*p=
  1693. X      '\0'
  1694. X      ;;;;
  1695. X#define f puts
  1696. X      puts
  1697. X      (x);
  1698. X      s=t;
  1699. X#define f s=5;
  1700. X      s=t;
  1701. X#define f s=5:
  1702. X      s=t;
  1703. X#define f 445:
  1704. X#define f 113:
  1705. X#define f 900:
  1706. X      s=t;
  1707. X#define f n22:
  1708. X#define f n40:
  1709. X      s=t;
  1710. X#define f nn6:
  1711. X      s=t;
  1712. X#define f nn1:
  1713. X#define f 0:--
  1714. X      s=t;
  1715. X#define f 19:-
  1716. X#define f x2:x
  1717. X      s=t;
  1718. X#define f x1:x
  1719. X      s=t;
  1720. X#define f y2:x
  1721. X#define f y7:y
  1722. X      s=t;
  1723. X#define f 1:::
  1724. X      s=t;
  1725. X#define f @3:@
  1726. X#define f 10:0
  1727. X#define f x+1:
  1728. X      s=t;
  1729. X#define f 2:::
  1730. X#define f 3:::
  1731. X#define x 7:::
  1732. X#define y 3:::
  1733. X#define z 990:
  1734. X#define Z 47::
  1735. X      ;;;}
  1736. X
  1737. END_OF_FILE
  1738.   if test 1885 -ne `wc -c <'1992/lush.orig.c'`; then
  1739.     echo shar: \"'1992/lush.orig.c'\" unpacked with wrong size!
  1740.   fi
  1741.   # end of '1992/lush.orig.c'
  1742. fi
  1743. if test -f '1992/marangon.c' -a "${1}" != "-c" ; then 
  1744.   echo shar: Will not clobber existing file \"'1992/marangon.c'\"
  1745. else
  1746.   echo shar: Extracting \"'1992/marangon.c'\" \(1766 characters\)
  1747.   sed "s/^X//" >'1992/marangon.c' <<'END_OF_FILE'
  1748. X#include <stdio.h>
  1749. X#include <curses.h>
  1750. X
  1751. X#define ST strchr
  1752. X#define SRD srand48
  1753. X#define RD lrand48
  1754. X#define ext(a) (exit(a),0)
  1755. X
  1756. X#define Q return
  1757. X#define W wrefresh(r)
  1758. Xtypedef int i;
  1759. X
  1760. X#define Z(d,a) (RD()%((a)-(d)+1)+(d))
  1761. Xi f[3][3] = {15,52,36,20,-39,48,60,0,-25};
  1762. X
  1763. Xchar z[6][6];
  1764. X#define Y(x) (4*(x)+3)
  1765. X#define X(x) (2*(x)+1)
  1766. X#define I for
  1767. XWINDOW *r=NULL;
  1768. X#define K endwin()
  1769. X
  1770. Xchar *g ="\
  1771. XUse l-h-k-j for move.\nUse + for increment. Use - for decrement.\nUse Q to quit.";
  1772. X
  1773. Xi (*d())();
  1774. Xnt()
  1775. X{
  1776. Xlong time();
  1777. XSRD(time((i *)0));
  1778. Xmemset(z,5,36);
  1779. Xinitscr();
  1780. Xcbreak();
  1781. Xnoecho();
  1782. Xnonl();
  1783. Xif (COLS<80||LINES<24)
  1784. XK,ext(1);
  1785. Xif (!(r=newwin(X(6),Y(6),
  1786. X(LINES-X(6))/2,(COLS-Y(6))/2)))
  1787. XK,ext(1);
  1788. Xmvaddstr(LINES-5,0,g);
  1789. Xrefresh();
  1790. X}
  1791. Xi ci()
  1792. X{
  1793. Xi x,y=0;
  1794. XI (;y<6;++y)
  1795. XI(x=0;x<6;++x)
  1796. Xmvwaddch(r,X(y),Y(x),z[x][y]+'0'); Q(0);
  1797. X}
  1798. Xvoid main()
  1799. X{
  1800. Xchar *ST();
  1801. Xi a=0,b=0,c,q,t,s,x,sc=0;
  1802. Xi(*(*p)())()=(nt(),d);
  1803. XI(x=0 ; x++<20; )d(Z(0,5),Z(0,5),Z(1,2));
  1804. XI(t=Z(0,2),q=s=0; q<3; s+=f[q][t]*f[q++][t]);
  1805. XI(box(r,'|','-'),ci(),wmove(r,X(a),Y(b)),
  1806. XW; (ST ("+-Qlkjh",(char)(c=wgetch(r))))&&
  1807. X((i)((i)(q^=s%=Y(q),s/=2)!=(i)(s^=q)&&c&64&&(!(c&7|0)&&--b<0&&
  1808. X(b=q^s)&0|| c&4&&++b==6&&c&4<(~b&23?q^=s,b^=b
  1809. X:b&12?b=3:b|2)||c&2&&~c&1&&++a==++q/2+1&&c&16>(
  1810. X!a|12?a=7,a&=~a:a|4?a=2:a&2)||~c&4&&c&
  1811. X1&&--a<0&&(a+=6)&0)||~c&64&&(**p(b,a,~c))()||
  1812. Xc&16)?K,ext(0):1)||c; sc==36?ci(),W,K,ext(0):wmove(r,X(a),Y(b)),
  1813. XW)
  1814. XI(t=Z(0,2),q=s=0; q<3; s+=f[q][t]*f[q++][t])
  1815. XI(sc=0; sc<36&&*((char *)z+sc++)==5; );
  1816. X}
  1817. Xi (*d(a,b,c))()i a,b,c;
  1818. X{
  1819. Xi x,y;
  1820. XI(x=a>0?a-1:0; x<=(a<5?a+1:5); ++x)
  1821. XI(y=b>0?b-1:0; y<=(b<5?b+1:5); ++y)
  1822. Xif(x==a&&y==b&&z[x][y]==(c&2?1:9)||z[x][y]==(c&2?9:1)&&(x!=a||y!=b))Q(ci);
  1823. XI(x=a>0?a-1:0; x<=(a<5?a+1:5); x++)
  1824. XI(y=b>0?b-1:0; y<=(b<5?b+1:5)&&(x==a&&y==b&&(z[x][y]+=(c&2?-1:1))||(z[x][y]+=(c&2?1:-1))); y++); Q(ci);
  1825. X}
  1826. END_OF_FILE
  1827.   if test 1766 -ne `wc -c <'1992/marangon.c'`; then
  1828.     echo shar: \"'1992/marangon.c'\" unpacked with wrong size!
  1829.   fi
  1830.   # end of '1992/marangon.c'
  1831. fi
  1832. if test -f '1992/marangon.hint' -a "${1}" != "-c" ; then 
  1833.   echo shar: Will not clobber existing file \"'1992/marangon.hint'\"
  1834. else
  1835.   echo shar: Extracting \"'1992/marangon.hint'\" \(1062 characters\)
  1836.   sed "s/^X//" >'1992/marangon.hint' <<'END_OF_FILE'
  1837. XBest Game: <marangon@ghost.dsi.unimi.it> Marangoni Andrea
  1838. X
  1839. X    Marangoni Andrea
  1840. X    Department of Computer Science at Milano
  1841. X    Via Pausula, 72
  1842. X    62014 Corridonia (MC)
  1843. X    Italy
  1844. X
  1845. X
  1846. XJudges' comments:
  1847. X
  1848. X    Make and run.
  1849. X
  1850. X    The object is to refill the table with 5's, by incrementing
  1851. X    or decrementing numbers as needed.  It is the side effects
  1852. X    that get you into trouble.  If you are not careful, you may
  1853. X    find things "at 6's and 7's".  :-)
  1854. X
  1855. X    NOTE: Some compilers have had trouble optimizing this entry.
  1856. X
  1857. X    NOTE: Some systems need to compile with -ltermcap as well as -lcurses.
  1858. X
  1859. X    NOTE: The original winning source marangon.orig.c assumed that
  1860. X      exit returned a value which cause problems for some
  1861. X      systems where exit returned a void.  The file marangon.c
  1862. X      avoids this problem.
  1863. X
  1864. X
  1865. XSelected notes from the author:
  1866. X
  1867. X    It starts off by creating a table with number 5 in all places.  The
  1868. X    CPU melts the numbers and you must return them in original state.
  1869. X    When you increase a number, all the other eight numbers next to it
  1870. X    decrease and vice-versa.
  1871. END_OF_FILE
  1872.   if test 1062 -ne `wc -c <'1992/marangon.hint'`; then
  1873.     echo shar: \"'1992/marangon.hint'\" unpacked with wrong size!
  1874.   fi
  1875.   # end of '1992/marangon.hint'
  1876. fi
  1877. if test -f '1992/marangon.orig.c' -a "${1}" != "-c" ; then 
  1878.   echo shar: Will not clobber existing file \"'1992/marangon.orig.c'\"
  1879. else
  1880.   echo shar: Extracting \"'1992/marangon.orig.c'\" \(1743 characters\)
  1881.   sed "s/^X//" >'1992/marangon.orig.c' <<'END_OF_FILE'
  1882. X#include <stdio.h>
  1883. X#include <curses.h>
  1884. X
  1885. X#define ST strchr
  1886. X#define SRD srand48
  1887. X#define RD lrand48
  1888. X
  1889. X#define Q return
  1890. X#define W wrefresh(r)
  1891. Xtypedef int i;
  1892. X
  1893. X#define Z(d,a) (RD()%((a)-(d)+1)+(d))
  1894. Xi f[3][3] = {15,52,36,20,-39,48,60,0,-25};
  1895. X
  1896. Xchar z[6][6];
  1897. X#define Y(x) (4*(x)+3)
  1898. X#define X(x) (2*(x)+1)
  1899. X#define I for
  1900. XWINDOW *r=NULL;
  1901. X#define K endwin()
  1902. X
  1903. Xchar *g ="\
  1904. XUse l-h-k-j for move.\nUse + for increment. Use - for decrement.\nUse Q to quit.";
  1905. X
  1906. Xi (*d())();
  1907. Xnt()
  1908. X{
  1909. Xlong time();
  1910. XSRD(time((i *)0));
  1911. Xmemset(z,5,36);
  1912. Xinitscr();
  1913. Xcbreak();
  1914. Xnoecho();
  1915. Xnonl();
  1916. Xif (COLS<80||LINES<24)
  1917. XK,exit(1);
  1918. Xif (!(r=newwin(X(6),Y(6),
  1919. X(LINES-X(6))/2,(COLS-Y(6))/2)))
  1920. XK,exit(1);
  1921. Xmvaddstr(LINES-5,0,g);
  1922. Xrefresh();
  1923. X}
  1924. Xi ci()
  1925. X{
  1926. Xi x,y=0;
  1927. XI (;y<6;++y)
  1928. XI(x=0;x<6;++x)
  1929. Xmvwaddch(r,X(y),Y(x),z[x][y]+'0'); Q(0);
  1930. X}
  1931. Xvoid main()
  1932. X{
  1933. Xchar *ST();
  1934. Xi a=0,b=0,c,q,t,s,x,sc=0;
  1935. Xi(*(*p)())()=(nt(),d);
  1936. XI(x=0 ; x++<20; )d(Z(0,5),Z(0,5),Z(1,2));
  1937. XI(t=Z(0,2),q=s=0; q<3; s+=f[q][t]*f[q++][t]);
  1938. XI(box(r,'|','-'),ci(),wmove(r,X(a),Y(b)),
  1939. XW; (ST ("+-Qlkjh",(char)(c=wgetch(r))))&&
  1940. X((i)((i)(q^=s%=Y(q),s/=2)!=(i)(s^=q)&&c&64&&(!(c&7|0)&&--b<0&&
  1941. X(b=q^s)&0|| c&4&&++b==6&&c&4<(~b&23?q^=s,b^=b
  1942. X:b&12?b=3:b|2)||c&2&&~c&1&&++a==++q/2+1&&c&16>(
  1943. X!a|12?a=7,a&=~a:a|4?a=2:a&2)||~c&4&&c&
  1944. X1&&--a<0&&(a+=6)&0)||~c&64&&(**p(b,a,~c))()||
  1945. Xc&16)?K,exit(0):1)||c; sc==36?ci(),W,K,exit(0):wmove(r,X(a),Y(b)),
  1946. XW)
  1947. XI(t=Z(0,2),q=s=0; q<3; s+=f[q][t]*f[q++][t])
  1948. XI(sc=0; sc<36&&*((char *)z+sc++)==5; );
  1949. X}
  1950. Xi (*d(a,b,c))()i a,b,c;
  1951. X{
  1952. Xi x,y;
  1953. XI(x=a>0?a-1:0; x<=(a<5?a+1:5); ++x)
  1954. XI(y=b>0?b-1:0; y<=(b<5?b+1:5); ++y)
  1955. Xif(x==a&&y==b&&z[x][y]==(c&2?1:9)||z[x][y]==(c&2?9:1)&&(x!=a||y!=b))Q(ci);
  1956. XI(x=a>0?a-1:0; x<=(a<5?a+1:5); x++)
  1957. XI(y=b>0?b-1:0; y<=(b<5?b+1:5)&&(x==a&&y==b&&(z[x][y]+=(c&2?-1:1))||(z[x][y]+=(c&2?1:-1))); y++); Q(ci);
  1958. X}
  1959. END_OF_FILE
  1960.   if test 1743 -ne `wc -c <'1992/marangon.orig.c'`; then
  1961.     echo shar: \"'1992/marangon.orig.c'\" unpacked with wrong size!
  1962.   fi
  1963.   # end of '1992/marangon.orig.c'
  1964. fi
  1965. if test -f '1992/nathan.c' -a "${1}" != "-c" ; then 
  1966.   echo shar: Will not clobber existing file \"'1992/nathan.c'\"
  1967. else
  1968.   echo shar: Extracting \"'1992/nathan.c'\" \(878 characters\)
  1969.   sed "s/^X//" >'1992/nathan.c' <<'END_OF_FILE'
  1970. X#include <stdio.h>
  1971. Xstatic char *text[] =
  1972. X{
  1973. X  "Export of this program from the USA is governed by the US",
  1974. X  "Munitions List from the ITAR (International Traffic in Arms",
  1975. X  "Regulations). This list gives the specific categories of",
  1976. X  "restricted exports and includes cryptographic exports. Traffic",
  1977. X  "entirely external to, entirely internal to, or into the USA is",
  1978. X  "not restricted.",
  1979. X  "To obtain a copy of the program, email to nathan@inmos.co.uk",
  1980. X  "with a subject \"IOCCC request\". If you know that your 'From'",
  1981. X  "line is incorrect, add a single line",
  1982. X  "\"replyto you@your.correct.address\" to the body of the message.",
  1983. X  "A deamon will autoreply.",
  1984. X  "WARNING: You must not re-export this out of the USA, or else",
  1985. X  "the men in black might get you.",
  1986. X  NULL
  1987. X};
  1988. Xint main()
  1989. X{
  1990. X  char **ptr;
  1991. X
  1992. X  for(ptr = text; *ptr; ptr++)
  1993. X    printf("%s\n", *ptr);
  1994. X  return 0;
  1995. X}
  1996. END_OF_FILE
  1997.   if test 878 -ne `wc -c <'1992/nathan.c'`; then
  1998.     echo shar: \"'1992/nathan.c'\" unpacked with wrong size!
  1999.   fi
  2000.   # end of '1992/nathan.c'
  2001. fi
  2002. if test -f '1992/vern.c' -a "${1}" != "-c" ; then 
  2003.   echo shar: Will not clobber existing file \"'1992/vern.c'\"
  2004. else
  2005.   echo shar: Extracting \"'1992/vern.c'\" \(3203 characters\)
  2006.   sed "s/^X//" >'1992/vern.c' <<'END_OF_FILE'
  2007. X#include <stdio.h>
  2008. X;    m(x)(x<0?-1:!!x)
  2009. X;    g tj()-J
  2010. X;    a(x)(x<0?-x:x)
  2011. X;    h(x)((x)<=K?x:N-(x))
  2012. X;    f 9999
  2013. X;    A return
  2014. X;    H printf{ 
  2015. X;    R double
  2016. X;    U int
  2017. X;    V for
  2018. X;    b else
  2019. X;    u while
  2020. X;    B if
  2021. XU v,w,Y}     -1,W,J,p,F,o}    f,M,N,K,X,YY,_,P[f],s{ } ;
  2022. Xtypedef U{ *L} { } ;
  2023. XL q[f];
  2024. Xtj{ } {
  2025. XU S}    m{ v} +{ m{ w} <<K} ; 
  2026. XB{ !S} A J; 
  2027. XV{ v}    W+S; v!}    J&&!q[v]; v+}    S} ;
  2028. XA v; 
  2029. X}
  2030. Xk{ } {
  2031. X_}    K; 
  2032. XA v?a{ v} >1||w-Y||!q[J]:{ w-Y&&{ w-Y*2||q[W+Y*{ N+1} ]||
  2033. X    { J>>K} -K+{ Y-1} / 2} } ||q[J]; 
  2034. X}
  2035. Xz{ } {
  2036. X_}    5; 
  2037. XA v*w||g; 
  2038. X}
  2039. Xe{ } {
  2040. X_}     -2; 
  2041. XA{ v*v*v-v||w*w*w-w} &&{ J-W-2||{ W&N} -4||{ W>>K!}    { Y-1?N:0} } ||
  2042. X    q[W+1]||q[W+2]||q[W+K]!}    z||P[W+K]*Y<0} ; 
  2043. X}
  2044. XR VR{ } {
  2045. Xint PZ}    0x7fff; 
  2046. XA{ R} { rand{ } &PZ} /{ R} PZ; 
  2047. X}
  2048. Xl{ } {
  2049. X_}    K+1; 
  2050. XA{ v*w&&a{ v} -a{ w} } ||g; 
  2051. X}
  2052. XR UC{ } {
  2053. XR {    }    0,d; 
  2054. Xu{ { {    +}    d}    VR{ } } <1.0} ; 
  2055. XA d; 
  2056. X}
  2057. Xc{ } {
  2058. X_}     -11; 
  2059. XA a{ v} -a{ w} ||g; 
  2060. X}
  2061. XI{ ur,n,x} {
  2062. XW}    ur; 
  2063. XJ}    n; 
  2064. XB{ P[W]!}    Y||P[J]}    }    Y} A J+1;
  2065. Xv}    { J&N} -{ W&N} ; 
  2066. Xw}    { J>>K} -{ W>>K} ; 
  2067. XA q[W]{ } ||{ x&&QL{ W,J,s} } ; 
  2068. X}
  2069. XTT{ W} {
  2070. Xv}    w}    0; 
  2071. XA q[W]{ } +K; 
  2072. X}
  2073. Xs{ } {
  2074. XU j}     -1,{    ; 
  2075. XY}     -Y; 
  2076. XV{ {    }    0; {    <M; ++{    } {
  2077. XB{ j<0&&P[{    ]}    }     -Y&&TT{ {    } &&_}    }     -2} 
  2078. X{
  2079. Xj}    {    ; 
  2080. X{    }     -1; 
  2081. X}
  2082. Xb B{ j>}    0&&!I{ {    ,j,0} } A Y}     -Y; 
  2083. X}
  2084. XA!{ Y}     -Y} ; 
  2085. X}
  2086. Xbb{ } {
  2087. X_}    1; 
  2088. XA a{ v*w} -2; 
  2089. X}
  2090. Xuv{ } {
  2091. XV{ v}    0; v<f; ++v} {
  2092. XB{ h{ v>>K} }    }    0} {
  2093. XU S}    h{ v&N} ;
  2094. Xq[v]}    !S?z:{ S}    }    1?bb:{ S}    }    2?c:{ v&N>K?l:e} } } ; 
  2095. X}
  2096. Xb B{ h{ v>>K} }    }    1} q[v]}    k; 
  2097. Xb q[v]}    0;
  2098. XP[v]}    !!q[v]*{ 28-v} ; 
  2099. X}
  2100. X}
  2101. Xy{ } {
  2102. XU G}    Y,{    ; 
  2103. XJ}    0; 
  2104. XV{ {    }    0; {    <M; ++{    } {
  2105. X{    %8||H"\n%4o ",{    } ;
  2106. XB{ { Y}    P[{    ]}    m{ P[{    ]} } &&
  2107. XTT{ {    } } H"%c ",_+93+Y*16} ; 
  2108. Xb H"- "} ; 
  2109. X}
  2110. XH"\n    "} ; 
  2111. Xdo 
  2112. XH"%2d",{    ++&N} ; 
  2113. Xu{ {    &N} ; 
  2114. XY}    G; 
  2115. XH"\n"} ; 
  2116. X}
  2117. XO{ W,J} {
  2118. XB{ { q[J]}    q[W]} }    }    k&&h{ J>>K} }    }    0} q[J]}    l; 
  2119. XB{ q[W]}    }    e} B{ J-W}    }    2} O{ J+1,J-1} ;
  2120. Xb B{ W-J}    }    2} O{ W-1,W+1} ; 
  2121. XP[J]}    P[W]; 
  2122. Xq[W]}    0;
  2123. XP[W]}    0; 
  2124. X}
  2125. XQL{ W,J,D} L D; 
  2126. X{
  2127. XU HQ}    P[J],YX; 
  2128. XL AJ}    q[J],XY}    q[W]; 
  2129. XO{ W,J} ; 
  2130. XYX}    D{ } ;
  2131. XO{ J,W} ; 
  2132. Xq[J]}    AJ; 
  2133. Xq[W]}    XY; 
  2134. XP[J]}    HQ; 
  2135. XA YX; 
  2136. X}
  2137. XC{ } {
  2138. XU {    ,j,BZ}    0; 
  2139. XV{ {    }    0; {    <M; ++{    } {
  2140. XL Z}    q[{    ]; 
  2141. XB{ Z} {
  2142. XU r}    h{ {    >>K} +h{ {    &N} ,G}    Y,
  2143. X    S}    Z}    }    z?88:{ Z}    }    k?11
  2144. X+r+{ P[{    ]<0?N-{ {    >>K} :{ {    >>K} } :
  2145. X{ Z}    }    l?124-{ { YY<8&&{ { {    &N} !}    K||
  2146. X    { {    >>K} !}    { P[{    ]>0?0:N} } } ?M:0} :
  2147. X{ Z}    }    c?41+r:{ Z}    }    e?f-r-r:36+r+r} } } } ; 
  2148. XY}    P[{    ];
  2149. XV{ j}    0; j<M; ++j} B{ !I{ {    ,j,0} } S+}    { P[j]?5:1} ; 
  2150. XBZ+}    G}    }    Y?S:-S;
  2151. XY}    G; 
  2152. X}
  2153. X}
  2154. XB{ !{ ++X&M-1} } write{ 1,".",1} ; 
  2155. XA BZ; 
  2156. X}
  2157. XPX{ } {
  2158. XU {    ,Q}    0,XP}    0,JZ}    M*M,E}     -f,t,S}    o; 
  2159. XB{ !F--} A++F+C{ } ;
  2160. XV{ {    }    0; {    <JZ; ++{    } B{ !I{ {    >>K+K,{    &M-1,1} } {
  2161. XY}     -Y; 
  2162. Xo}     -E;
  2163. Xt}     -QL{ {    >>K+K,{    &M-1,PX} ; 
  2164. XY}     -Y; 
  2165. XB{ t>E} {
  2166. X++XP; 
  2167. XQ}    {    ; 
  2168. XE}    t; 
  2169. XB{ E>}    S} 
  2170. XA++F,E; 
  2171. X}
  2172. X}
  2173. XB{ !XP} E}    s{ } ?-f+1:0; 
  2174. Xp}    Q; 
  2175. XA++F,E; 
  2176. X}
  2177. XRZ{ } {
  2178. XU {    ,j,T}    0; 
  2179. XV{ ; ; } {
  2180. Xy{ } ; 
  2181. Xo}    f; 
  2182. Xdo{
  2183. XH"\n%d %d %d %s ",X,T,C{ } ,s{ } ?"!":">"} ;
  2184. Xfflush{ stdout} ; 
  2185. X}
  2186. Xu{ scanf{ "%o%o",&{    ,&j} !}    2||I{ {    ,j,1} } ;
  2187. XO{ {    ,j} ; 
  2188. Xy{ } ; 
  2189. XX}    0; 
  2190. X++YY;
  2191. XY}     -Y; 
  2192. XT}    PX{ } ; 
  2193. X{    }    p>>{ K<<1} ; 
  2194. Xj}    p&{ M-1} ; 
  2195. XB{ I{ {    ,j,1} } {
  2196. XH"Rats!\n"} ; 
  2197. XA; 
  2198. X}
  2199. XO{ {    ,j} ; 
  2200. XY}     -Y; 
  2201. XB{ T>M*M} H"\nHar har.\n"} ; 
  2202. X}
  2203. X}
  2204. Xmain{ ac,av} char**av; 
  2205. X{
  2206. Xlong time{ } ,j}    time{ &j} ; 
  2207. XR {    }    0; 
  2208. Xsrand{ { U} j} ;
  2209. XV{ M}    0; M<}    f; ++M} {    +}    UC{ } ; 
  2210. XM}    {    /100;
  2211. XB{ M&3} ++M; 
  2212. XB{ M&1} --M; 
  2213. XV{ N}    1; N*N<M; ++N} ;
  2214. XK}     --N/2; 
  2215. XF}    ac>1?atoi{ av[1]} :2; 
  2216. Xuv{ } ;
  2217. XRZ{ } ; 
  2218. X}
  2219. END_OF_FILE
  2220.   if test 3203 -ne `wc -c <'1992/vern.c'`; then
  2221.     echo shar: \"'1992/vern.c'\" unpacked with wrong size!
  2222.   fi
  2223.   # end of '1992/vern.c'
  2224. fi
  2225. echo shar: End of archive 4 \(of 5\).
  2226. cp /dev/null ark4isdone
  2227. MISSING=""
  2228. for I in 1 2 3 4 5 ; do
  2229.     if test ! -f ark${I}isdone ; then
  2230.     MISSING="${MISSING} ${I}"
  2231.     fi
  2232. done
  2233. if test "${MISSING}" = "" ; then
  2234.     echo You have unpacked all 5 archives.
  2235.     rm -f ark[1-9]isdone
  2236. else
  2237.     echo You still must unpack the following archives:
  2238.     echo "        " ${MISSING}
  2239. fi
  2240. exit 0
  2241. exit 0 # Just in case...
  2242.