Grupos de Google ya no admite nuevas publicaciones ni suscripciones de Usenet. El contenido anterior sigue siendo visible.

Life program (part 2/18)

Visto 5 veces
Saltar al primer mensaje no leído

David I. Bell

no leída,
16 mar 1993, 1:18:4516/3/93
a

#!/bin/sh
# this is LIFE.02 (part 2 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file life/cmdl.c continued
#
if touch 2>&1 | fgrep 'amc' > /dev/null
then TOUCH=touch
else TOUCH=true
fi
if test ! -r shar3_seq_.tmp; then
echo "Please unpack part 1 first!"
exit 1
fi
(read Scheck
if test "$Scheck" != 2; then
echo "Please unpack part $Scheck next!"
exit 1
else
exit 0
fi
) < shar3_seq_.tmp || exit 1
echo "x - Continuing file life/cmdl.c"
sed 's/^X//' << 'SHAR_EOF' >> life/cmdl.c &&
X obj->o_autoscale = FALSE;
X
X setscale(obj, defaultscale);
X mode = M_MOVE;
X obj->o_frequency = defaultfrequency;
X freqcount = defaultfrequency;
X}
X
X
X/*
X * See if one string is an abbreviation of another.
X * Returns nonzero if first string is an abbreviation.
X */
XBOOL
Xabbrev(str1, str2)
X register char *str1;
X register char *str2;
X{
X if ((str1 == NULL) || (str2 == NULL))
X return FALSE;
X while (*str1) {
X if (*str1++ != *str2++)
X return FALSE;
X }
X return TRUE;
X}
X
X/* END CODE */
SHAR_EOF
echo "File life/cmdl.c is complete" &&
$TOUCH -am 0316122993 life/cmdl.c &&
chmod 0644 life/cmdl.c ||
echo "restore of life/cmdl.c failed"
set `wc -c life/cmdl.c`;Wc_c=$1
if test "$Wc_c" != "14656"; then
echo original size 14656, current size $Wc_c
fi
# ============= life/gen.c ==============
echo "x - extracting life/gen.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > life/gen.c &&
X/*
X * Copyright (c) 1993 David I. Bell
X * Permission is granted to use, distribute, or modify this source,
X * provided that this copyright notice remains intact.
X */
X
X#include "life.h"
X
X
X/*
X * Life rules.
X */
Xchar rules[18] = {
X 0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0
X};
X
X
Xstatic ROW *computerow();
X
X
X/*
X * Compute one full generation of the current configuration.
X * This is done by calling computerow with each triple of rows which
X * contain any live cells, and remembering the result. When all rows
X * are finished, we change the object.
X */
Xvoid
Xdogeneration(obj)
X OBJECT *obj;
X{
X register ROW *crp; /* current row */
X register ROW *prp; /* previous row */
X register ROW *nrp; /* next row */
X register ROW *newrp; /* current row of new list */
X register ROW *srp; /* saved row pointer */
X COORD row; /* current row number */
X
X if (genleft <= 0)
X return;
X
X if ((--genleft == 0) || (--freqcount <= 0))
X update |= U_ALL;
X
X obj->o_gen++;
X obj->o_born = 0;
X obj->o_died = 0;
X newrp = &initrow;
X prp = termrow;
X crp = termrow;
X nrp = obj->o_firstrow;
X srp = nrp->r_next;
X row = nrp->r_row - 1;
X
X /*
X * Loop over each triple of rows.
X */
X while (TRUE) {
X if (row >= (INFINITY-1))
X break;
X
X prp = computerow(obj, prp, crp, nrp);
X if (prp) { /* have something in current row */
X newrp->r_next = prp;
X newrp = prp;
X newrp->r_row = row;
X obj->o_count += prp->r_count;
X }
X
X row++;
X prp = crp;
X crp = nrp;
X nrp = srp;
X
X if (nrp->r_row == row + 1) {
X srp = nrp->r_next;
X continue;
X }
X
X nrp = termrow;
X if ((prp != termrow) || (crp != termrow))
X continue;
X
X nrp = srp;
X srp = nrp->r_next;
X row = nrp->r_row - 1;
X }
X
X zeroobject(obj);
X
X if (newrp == &initrow) { /* died off */
X genleft = 0;
X update |= U_ALL;
X return;
X }
X
X obj->o_firstrow = initrow.r_next;
X newrp->r_next = termrow;
X obj->o_lastrow = newrp;
X
X if ((obj->o_born == 0) && (obj->o_died == 0)) { /* no change */
X genleft = 0;
X update |= U_ALL;
X }
X}
X
X
X/*
X * Compute the result of three adjacent rows, and return a row structure
X * containing the new middle row, or NULL if no live cells are produced.
X * When determining if a cell is dead or alive, each live neighbor counts
X * as a 1, but the current cell counts as 9 when alive. Indexing the rules
X * table with the sum then automatically produces the correct result.
X */
Xstatic ROW *
Xcomputerow(obj, prevrow, currow, nextrow)
X OBJECT *obj;
X ROW *prevrow;
X ROW *currow;
X ROW *nextrow;
X{
X register CELL *pcp; /* head of previous row of cells */
X register CELL *ccp; /* head of current row of cells */
X register CELL *ncp; /* head of next row of cells */
X register CELL *tcp; /* temporary cell */
X register CELL *newcp; /* new row of cells */
X COUNT i; /* sum of live cells and other uses */
X ROW *rp; /* new row pointer */
X COORD col; /* current column being examined */
X COORD colp1; /* one more than column */
X COUNT count; /* live cells */
X
X pcp = prevrow->r_firstcell;
X ccp = currow->r_firstcell;
X ncp = nextrow->r_firstcell;
X newcp = &initcell;
X count = 0;
X col = -INFINITY;
X
X /*
X * Loop over the cells of all three rows.
X */
X while (TRUE) {
X /*
X * Find next column where a cell exists on any row
X */
X i = col - 1;
X while (i > pcp->c_col)
X pcp = pcp->c_next;
X while (i > ccp->c_col)
X ccp = ccp->c_next;
X while (i > ncp->c_col)
X ncp = ncp->c_next;
X
X i = ccp->c_col;
X if (pcp->c_col < i)
X i = pcp->c_col;
X if (ncp->c_col < i)
X i = ncp->c_col;
X if (i == INFINITY)
X break;
X i--;
X if (col < i)
X col = i;
X i = 0;
X colp1 = col + 1;
X
X if (pcp->c_col <= colp1) { /* add cells in previous row */
X i++;
X tcp = pcp->c_next;
X i += (tcp->c_col <= colp1);
X tcp = tcp->c_next;
X i += (tcp->c_col <= colp1);
X }
X
X if (ccp->c_col <= colp1) { /* add cells on our row */
X i++;
X tcp = ccp->c_next;
X if ((ccp->c_col == col) || (tcp->c_col == col)) {
X i += (LIFE - 1);
X }
X i += (tcp->c_col <= colp1);
X tcp = tcp->c_next;
X i += (tcp->c_col <= colp1);
X }
X
X if (ncp->c_col <= colp1) { /* add cells in next row */
X i++;
X tcp = ncp->c_next;
X i += (tcp->c_col <= colp1);
X tcp = tcp->c_next;
X i += (tcp->c_col <= colp1);
X }
X
X if (rules[i]) { /* cell is alive */
X obj->o_born += (i < LIFE);
X tcp = alloccell();
X tcp->c_col = col;
X newcp->c_next = tcp;
X newcp = tcp;
X count++;
X } else /* cell is dead */
X obj->o_died += (i >= LIFE);
X col++;
X }
X
X if (newcp == &initcell)
X return NULL;
X
X newcp->c_next = termcell;
X rp = allocrow();
X rp->r_firstcell = initcell.c_next;
X rp->r_lastcell = newcp;
X rp->r_count = count;
X
X return rp;
X}
X
X/* END CODE */
SHAR_EOF
$TOUCH -am 0316122993 life/gen.c &&
chmod 0644 life/gen.c ||
echo "restore of life/gen.c failed"
set `wc -c life/gen.c`;Wc_c=$1
if test "$Wc_c" != "4578"; then
echo original size 4578, current size $Wc_c
fi
# ============= life/io.c ==============
echo "x - extracting life/io.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > life/io.c &&
X/*
X * Copyright (c) 1993 David I. Bell
X * Permission is granted to use, distribute, or modify this source,
X * provided that this copyright notice remains intact.
X */
X
X#include <sys/types.h>
X#include <dirent.h>
X#include "life.h"
X
X
Xstatic int tty_char(); /* terminal routines */
Xstatic void tty_term();
X
Xstatic int file_char(); /* file routines */
Xstatic void file_term();
X
Xstatic int loop_char(); /* loop routines */
Xstatic void loop_term();
X
Xstatic int macro_char(); /* macro routines */
Xstatic void macro_term();
X
Xstatic FILE *openlibfile();
Xstatic BOOL matchfile();
Xstatic BOOL spacewait();
Xstatic int sortfunc();
Xstatic void addfile();
X
Xstatic int helprow; /* current row of help text */
Xstatic BOOL helpbusy; /* true if doing help display */
Xstatic BOOL helpabort; /* true if help is aborted */
X
X
X/*
X * Read the next character from the appropriate input source.
X * EOF is never returned by this routine (longjmps are done instead).
X * This routine is usually called indirectly by scanchar.
X */
Xint
Xreadchar()
X{
X register INPUT *ip;
X int ch;
X
X while (TRUE) {
X ip = curinput;
X ch = (*ip->i_getchar)(ip);
X if (ch != EOF)
X break;
X (*ip->i_term)(ip);
X }
X
X return ch;
X}
X
X
X/*
X * Determine if the next input character to be read is from the terminal.
X * Returns TRUE if so.
X */
XBOOL
Xttyisinput()
X{
X register INPUT *ip;
X
X ip = curinput;
X while ((ip->i_type == INP_LOOP) && (ip->i_first))
X ip--;
X
X return ip->i_type == INP_TTY;
X}
X
X
X/*
X * Set up to read commands from the terminal. The lowest level of input
X * never quits, and is unusual in that it doesn't usually block waiting for
X * input. Returns nonzero if failed.
X */
XBOOL
Xsettty()
X{
X register INPUT *ip;
X
X ip = curinput + 1;
X if (ip >= &inputs[MAXINPUT])
X return TRUE;
X
X ip->i_getchar = tty_char;
X ip->i_term = tty_term;
X ip->i_type = INP_TTY;
X update |= U_STAT;
X curinput = ip;
X return FALSE;
X}
X
X
X/*
X * Read next character from the terminal if it is ready. If nothing is
X * going on we will wait for it anyway, to prevent excessive runtimes.
X * If something is going on, we will longjmp away if input is not ready.
X * We set the interactive flag to indicate we are talking to the user.
X */
Xstatic int
Xtty_char(ip)
X INPUT *ip;
X{
X int ch;
X int wait;
X
X interact = TRUE;
X
X wait = dowait || !(update || (genleft > 0));
X
X if (wait) {
X if (setjmp(intjmp)) {
X intjmpok = FALSE;
X return '\0';
X }
X
X intjmpok = TRUE;
X }
X
X ch = (*dev->readchar)(dev, wait);
X
X intjmpok = FALSE;
X
X if ((ch == EOF) && !wait)
X scaneof();
X
X if (errorstring) { /* disable error message */
X errorstring = NULL;
X update |= U_STAT;
X }
X
X return ch;
X}
X
X
X/*
X * Terminate reading from the terminal. If we are reading from the lowest
X * level of terminal input, this is a no-op, since that level can never return.
X */
Xstatic void
Xtty_term(ip)
X INPUT *ip;
X{
X if (ip > inputs)
X ip--;
X curinput = ip;
X update |= U_STAT;
X}
X
X
X/*
X * Set up to read commands from a given file name. When the file is complete,
X * some parameters (like the current cursor position) will be restored to their
X * original value. Returns nonzero if cannot set up to read the file.
X */
XBOOL
Xsetfile(name)
X char *name;
X{
X register INPUT *ip;
X FILE *fp;
X int ch;
X
X ip = curinput + 1;
X if (ip >= &inputs[MAXINPUT])
X return TRUE;
X
X fp = openlibfile(name, "r");
X if (fp == NULL)
X return TRUE;
X
X ip->i_file = fp;
X ip->i_getchar = file_char;
X ip->i_term = file_term;
X ip->i_type = INP_FILE;
X ip->i_obj = curobj;
X ip->i_row = crow;
X ip->i_col = ccol;
X ip->i_prow = prow;
X ip->i_pcol = pcol;
X prow = crow;
X pcol = ccol;
X update |= U_STAT;
X curinput = ip;
X
X /*
X * Now peek at the first character of the file to determine what type of
X * format it is. It can be either our own format, or else rle format,
X * or else xlife format. For our format, the contents will be read
X * after we return. But for the other formats, we must read in the
X * complete file here.
X */
X ch = fgetc(fp);
X if (ch != EOF)
X ungetc(ch, fp);
X
X switch (ch) {
X case 'x':
X readrle(fp);
X (*ip->i_term)(ip);
X break;
X
X case '#':
X readxlife(fp);
X (*ip->i_term)(ip);
X break;
X
X case '!':
X break;
X
X default:
X error("Unknown file format");
X }
X
X return FALSE;
X}
X
X
X/*
X * Open a life library file, trying various transformed names if necessary.
X * The order of the transformations which are tried is:
X * 1. Name exactly as given.
X * 2. Name with LIFEEXT appended to it.
X * 3. Name in the user's library directory.
X * 4. Name with LIFEEXT appended to it in the user's library.
X * 5 Name in the system's library directory.
X * 6. Name with LIFEEXT appended to it in the system library.
X * Returns the file handle if the open is successful, or NULL if all the
X * open attempts failed.
X */
Xstatic FILE *
Xopenlibfile(name, mode)
X char *name;
X char *mode;
X{
X FILE *fp;
X char buf[MAXPATH];
X
X fp = fopen(name, mode);
X if (fp)
X return fp;
X
X strcpy(buf, name);
X strcat(buf, LIFEEXT);
X fp = fopen(buf, mode);
X if (fp)
X return fp;
X
X if (*name == '/')
X return NULL;
X
X if (userlib) {
X strcpy(buf, userlib);
X strcat(buf, "/");
X strcat(buf, name);
X fp = fopen(buf, mode);
X if (fp)
X return fp;
X
X strcat(buf, LIFEEXT);
X fp = fopen(buf, mode);
X if (fp)
X return fp;
X }
X
X strcpy(buf, LIFELIB);
X strcat(buf, "/");
X strcat(buf, name);
X fp = fopen(buf, mode);
X if (fp)
X return fp;
X
X strcat(buf, LIFEEXT);
X return fopen(buf, mode);
X}
X
X
X/*
X * Here to read next character from a file. Called by readchar when
X * input source is a file. Returns EOF on end of file.
X */
Xstatic int
Xfile_char(ip)
X register INPUT *ip;
X{
X return fgetc(ip->i_file);
X}
X
X
X/*
X * Here on end of file or error to close the input file and restore some
X * of the previous state such as the cursor location.
X */
Xstatic void
Xfile_term(ip)
X register INPUT *ip;
X{
X fclose(ip->i_file);
X curobj = ip->i_obj;
X crow = ip->i_row;
X ccol = ip->i_col;
X prow = ip->i_prow;
X pcol = ip->i_pcol;
X update |= U_STAT;
X curinput = (ip - 1);
X}
X
X
X/*
X * Set up for execution of a loop. This remembers the initial and final
X * loop values, and sets up to remember commands as they are given.
X * This is also used for defining a macro command. The given character
X * will be assigned the string defined by the loop.
X * Returns nonzero if failed.
X */
XBOOL
Xsetloop(begval, endval, ch)
X VALUE begval;
X VALUE endval;
X int ch;
X{
X register INPUT *ip;
X
X ip = curinput + 1;
X if (ip >= &inputs[MAXINPUT])
X return TRUE;
X
X ip->i_begptr = malloc(LOOPSIZE);
X if (ip->i_begptr == NULL)
X return TRUE;
X
X ip->i_endptr = ip->i_begptr + LOOPSIZE;
X ip->i_curptr = ip->i_begptr;
X ip->i_first = TRUE;
X ip->i_getchar = loop_char;
X ip->i_term = loop_term;
X ip->i_type = INP_LOOP;
X ip->i_curval = begval;
X ip->i_endval = endval;
X ip->i_macro = ch;
X update |= U_STAT;
X curinput = ip;
X return FALSE;
X}
X
X
X/*
X * End the range of the currently defined loop. At this point, all of
X * the characters of the loop have been read in and saved, and we can
X * just proceed to iterate over them. The next read will find out that
X * the first iteration of the loop is over.
X */
Xvoid
Xendloop()
X{
X register INPUT *ip;
X
X ip = curinput;
X if (ip->i_type != INP_LOOP)
X error("Loop not being defined");
X
X ip->i_endptr = ip->i_curptr - 1; /* end before loop term cmd */
X ip->i_first = FALSE;
X}
X
X
X/*
X * Read one character from a loop buffer. If at the end of the buffer, the
X * pointer is reset so that the buffer is reread. When enough iterations
X * have been processed, EOF is returned. A special case exists the first time
X * through the loop at the first nesting level, in that we don't yet have
X * the characters necessary for the loop, and so we have to read them by
X * ourself.
X */
Xstatic int
Xloop_char(ip)
X register INPUT *ip;
X{
X int ch;
X
X if (ip->i_first) { /* collecting input chars */
X if (ip->i_curptr >= ip->i_endptr)
X error("Loop too long");
X ch = (*ip[-1].i_getchar)(ip - 1); /* char from previous level */
X if (ch == EOF)
X error("End of file in loop");
X *ip->i_curptr++ = ch;
X return ch;
X }
X
X if (ip->i_curptr >= ip->i_endptr) { /* done with one iteration */
X if (ip->i_curval == ip->i_endval)
X return EOF;
X
X ip->i_curval += ((ip->i_curval < ip->i_endval) ? 1 : -1);
X ip->i_curptr = ip->i_begptr;
X }
X
X return *ip->i_curptr++;
X}
X
X
X/*
X * Terminate reading from a loop buffer. If this was the definition of
X * a macro character, remember it for later.
X */
Xstatic void
Xloop_term(ip)
X INPUT *ip;
X{
X register MACRO *mp;
X
X mp = &macros[ip->i_macro - 'a'];
X if ((mp >= macros) && (mp < &macros[26])) {
X if (mp->m_begptr)
X free(mp->m_begptr);
X mp->m_begptr = ip->i_begptr;
X mp->m_endptr = ip->i_endptr;
X } else
X free(ip->i_begptr); /* or free buffer */
X
X update |= U_STAT;
X curinput = (ip - 1);
X}
X
X
X/*
X * Set up to read a defined macro command. Returns nonzero if failed.
X */
XBOOL
Xsetmacro(arg1, arg2, ch)
X VALUE arg1;
X VALUE arg2;
X int ch;
X{
X register INPUT *ip; /* current input */
X register MACRO *mp; /* macro command */
X
X mp = &macros[ch - 'a'];
X if ((mp < macros) || (mp >= &macros[26]) || (mp->m_begptr == NULL))
X return TRUE;
X
X ip = curinput + 1;
X if (ip >= &inputs[MAXINPUT])
X return TRUE;
X
X ip->i_getchar = macro_char;
X ip->i_term = macro_term;
X ip->i_begptr = mp->m_begptr;
X ip->i_curptr = mp->m_begptr;
X ip->i_endptr = mp->m_endptr;
X ip->i_type = INP_MACRO;
X ip->i_macro = ch;
X ip->i_curval = arg1;
X ip->i_endval = arg2;
X update |= U_STAT;
X curinput = ip;
X return FALSE;
X}
X
X
X/*
X * Read next character from macro definition.
X * Returns EOF when the macro is finished.
X */
Xstatic int
Xmacro_char(ip)
X register INPUT *ip;
X{
X if (ip->i_curptr >= ip->i_endptr)
X return EOF;
X
X return *ip->i_curptr++;
X}
X
X
X/*
X * Terminate reading from a macro definition.
X */
Xstatic void
Xmacro_term(ip)
X INPUT *ip;
X{
X curinput = (ip - 1);
X update |= U_STAT;
X}
X
X
X/*
X * Read a line from the user terminated by a newline (which is removed).
X * Editing of the input line is fully handled. The prompt string and the
X * input line are only visible if the current input is from the terminal.
X * Returns a pointer to the null-terminated string.
X */
Xchar *
Xreadstring(prompt)
X char *prompt;
X{
X scanreset(); /* no more scan interference */
X
X if (prompt == NULL)
X prompt = ""; /* set prompt if given NULL */
X
X if (!ttyisinput())
X prompt = NULL; /* no window stuff if not tty */
X
X dowait = TRUE; /* must wait for tty chars */
X readline(prompt, stringbuf, STRINGSIZE, 0);
X dowait = FALSE;
X
X if (prompt)
X update |= U_STAT;
X
X if (stop)
X error("Command aborted");
X
X return stringbuf;
X}
X
X
X/*
X * Read some input while possibly showing it on the status line.
X * If the prompt string is NULL, then editing is performed without
X * any display activity (useful when reading commands from scripts).
X * Otherwise, the prompt is shown in the window along with any input.
X * A trailing null character is inserted in the buffer. The buffer may
X * contain initial data which will initially appear in the window, and
X * which can be edited by the user. Initcount specifies the number of
X * initial characters in the buffer, so that a value of zero indicates
X * that there is no such data. Editing of the input is handled. If the
X * buffer fills up, the user is warned with beeps and further input is
X * ignored. Returns number of bytes of data read.
X */
Xint
Xreadline(prompt, buf, count, initcount)
X char *prompt; /* prompt string (if any) */
X char *buf; /* address of the storage buffer */
X int count; /* maximum number of bytes allowed */
X int initcount; /* number of bytes already in buffer */
X{
X register int ch; /* character which was read */
X register char *bp; /* current buffer pointer location */
X char *endbp; /* end of buffer */
X BOOL redraw; /* need to redisplay input */
X
X redraw = TRUE;
X bp = buf;
X endbp = bp + count - 1;
X if (initcount > 0) {
X if (initcount >= count)
X initcount = count - 1;
X bp = &buf[initcount];
X }
X
X while (TRUE) {
X if (prompt) {
X if (redraw) {
X *bp = '\0';
X (*dev->showstatus)(dev, prompt);
X (*dev->addstatus)(dev, buf);
X redraw = FALSE;
X }
X (*dev->update)(dev, 1);
X }
X
X ch = readchar();
X
X if (stop) { /* interrupted */
X buf[0] = '\0';
X return 0;
X }
X
X if (ch == '\0') /* ignore nulls */
X continue;
X
X if (ch == vlnext) { /* literal input */
X ch = readchar();
X if (stop) {
X buf[0] = '\0';
X return 0;
X }
X goto store;
X }
X
X if (ch == '\n') { /* end of line */
X *bp = '\0';
X return bp - buf;
X }
X
X if (ch == verase) { /* character erase */
X if (bp <= buf)
X continue;
X bp--;
X redraw = TRUE;
X continue;
X }
X
X if (ch == vkill) { /* line erase */
X bp = buf;
X redraw = TRUE;
X continue;
X }
X
X if (ch == vwerase) { /* word erase */
X if (bp <= buf)
X continue;
X while ((bp > buf) && ((bp[-1] == '\n')
X || isblank(bp[-1])))
X bp--;
X while ((bp > buf) && (bp[-1] != '\n')
X && !isblank(bp[-1]))
X bp--;
X redraw = TRUE;
X continue;
X }
X
Xstore: if (bp >= endbp) { /* buffer is full */
X beep();
X continue;
X }
X
X *bp = ch;
X bp[1] = '\0';
X
X if (prompt) {
X (*dev->addstatus)(dev, bp);
X (*dev->update)(dev, 1);
X }
X
X bp++;
X }
X}
X
X
X/*
X * Routine called to wait until a space, newline, or escape character
X * is typed. It is assumed that the screen contains a help display
X * that we can append our message to. If the more flag is used, and
X * the user types escape instead of a space, then we return nonzero.
X */
Xstatic BOOL
Xspacewait(more)
X BOOL more;
X{
X int ch;
X
X scanreset(); /* throw out stored chars */
X
X if (more)
X (*dev->addhelp)(dev, "\n[Type <space> to continue or <esc> to return]");
X else
X (*dev->addhelp)(dev, "\n[Type <space> to return]");
X (*dev->update)(dev);
X
X update |= U_ALL;
X dowait = TRUE; /* must wait for chars */
X
X do {
X if (stop) {
X ch = ESC;
X break;
X }
X ch = readchar();
X } while ((ch != ' ') && (ch != ESC) && (ch != '\n'));
X
X dowait = FALSE;
X
X return (more && (ch == ESC));
X}
X
X
X/*
X * Write all defined macros to a file so they can be read back in later.
X */
Xvoid
Xwritemacros(name)
X char *name; /* file name to write to */
X{
X MACRO *mp;
X FILE *fp;
X UCHAR *cp;
X
X fp = fopen(name, "w");
X if (fp == NULL)
X error("Cannot create file");
X
X fputs("! macros\n", fp);
X
X for (mp = macros; mp < &macros[26]; mp++) {
X if ((mp->m_begptr == NULL) || (mp->m_begptr >= mp->m_endptr))
X continue;
X
X fprintf(fp, "<%c", 'a' + (mp - macros));
X
X for (cp = mp->m_begptr; cp < mp->m_endptr; cp++)
X fputc(*cp, fp);
X
X fputs(">!\n", fp);
X }
X
X fflush(fp);
X if (ferror(fp)) {
X fclose(fp);
X error("Write failed");
X }
X if (fclose(fp))
X error("Close failed");
X}
X
X
X/*
X * Collect all *.l files under a directory which contain the specified pattern.
X * The names are appended to the given list of strings. If desired, the
X * list can have uninitialized pointers (indicated by max counts of zero).
X * For speed, the assumption is made that *.l files are valid life files,
X * and so are not directories. The skip length is how many characters of
X * the given directory name are not to be displayed in the list of files.
X * The depth is how deep to allow the search to go.
X */
Xvoid
Xgetfiles(list, dirname, pattern, skiplen, depth)
X LIST *list;
X char *dirname;
X char *pattern;
X{
X DIR *dirp;
X struct dirent *dp;
X char *name;
X char *nameappend;
X int len;
X char fullname[MAXPATH];
X
X dirp = opendir(dirname);
X if (dirp == NULL)
X return;
X
X depth--;
X strcpy(fullname, dirname);
X strcat(fullname, "/");
X nameappend = fullname + strlen(fullname);
X
X while ((dp = readdir(dirp)) != NULL) {
X name = dp->d_name;
X len = strlen(name) - sizeof(LIFEEXT) + 1;
X strcpy(nameappend, name);
X
X if ((len <= 0) || strcmp(name + len, LIFEEXT)) {
X if (depth && strcmp(name, ".") && strcmp(name, ".."))
X getfiles(list, fullname, pattern, skiplen, depth);
X fflush(stdout);
X continue;
X }
X
X nameappend[len] = '\0';
X
X if (!(*pattern) || matchfile(fullname + skiplen, pattern))
X addfile(list, fullname + skiplen);
X }
X
X closedir(dirp);
X}
X
X
X/*
X * Add a file name to the specified list.
X */
Xstatic void
Xaddfile(list, name)
X LIST *list;
X char *name;
X{
X int len;
X int size;
X char *mem;
X
X len = strlen(name);
X
X if (list->argc >= list->maxargc) {
X size = (list->maxargc + LISTARGSIZE) * sizeof(char *);
X if (list->maxargc)
X mem = realloc((char *) list->argv, size);
X else
X mem = malloc(size);
X if (mem == NULL)
X return;
X list->argv = (char **) mem;
X list->maxargc += LISTARGSIZE;
X }
X
X if (list->used + len >= list->maxused) {
X size = list->maxused + len + LISTBUFSIZE;
X if (list->maxused)
X mem = realloc(list->buf, size);
X else
X mem = malloc(size);
X if (mem == NULL)
X return;
X for (size = 0; size < list->argc; size++)
X list->argv[size] = mem +
X (list->argv[size] - list->buf);
X list->buf = mem;
X list->maxused += len + LISTBUFSIZE;
X }
X
X list->argv[list->argc] = &list->buf[list->used];
X strcpy(&list->buf[list->used], name);
X list->used += (len + 1);
X list->argc++;
X}
X
X
X/*
X * Sort and display a list of file names in the help window.
X * If many files are displayed, the user is asked to page through them all.
X */
Xvoid
Xlistfiles(list)
X LIST *list;
X{
X int col;
X int colwidth;
X int argc;
X char **argv;
X char *cp;
X
X if (list->argc <= 0)
X return;
X
X qsort((char *) list->argv, list->argc, sizeof(char *), sortfunc);
X
X colwidth = MAXFILE - sizeof(LIFEEXT) + 2;
X col = 0;
X
X argv = list->argv;
X argc = list->argc;
X while (argc-- > 0) {
X cp = *argv++;
X showhelp(cp);
X showhelp(" ");
X col += strlen(cp) + 1;
X
X while (col % colwidth) {
X showhelp(" ");
X col++;
X }
X
X if (col + colwidth > dev->textcols) {
X showhelp("\n");
X col = 0;
X }
X }
X
X if (col)
X showhelp("\n");
X
X endhelp();
X}
X
X
X/*
X * Sort function for files.
X * This is a alphabetic-numeric sort, so numbers appear in a natural order.
X */
Xstatic int
Xsortfunc(cp1, cp2)
X char **cp1;
X char **cp2;
X{
X char *s1;
X char *s2;
X int c1;
X int c2;
X long n1;
X long n2;
X
X s1 = *cp1;
X s2 = *cp2;
X
X while (TRUE) {
X c1 = *s1++;
X c2 = *s2++;
X
X if ((c1 == '\0') && (c2 == '\0'))
X return 0;
X
X if (!isdigit(c1) || !isdigit(c2)) {
X if (c1 == c2)
X continue;
X return c1 - c2;
X }
X
X n1 = c1 - '0';
X n2 = c2 - '0';
X while (isdigit(*s1))
X n1 = n1 * 10 + *s1++ - '0';
X while (isdigit(*s2))
X n2 = n2 * 10 + *s2++ - '0';
X
X if (n1 == n2)
X continue;
X return n1 - n2;
X }
X}
X
X
X/*
X * Add some text to the help screen. The text may contain newlines,
X * but line wrapping is not done. If the text goes to the bottom of
X * the screen, the output is stopped and the user is requested to type
X * a space to proceed, or escape to abort. If the user aborts, then
X * all further help output is suppressed until the endhelp call is made,
X * and this routine returns nonzero. If this routine is called, then
X * endhelp MUST also be called before non-help output occurs.
X */
XBOOL
Xshowhelp(str)
X char *str;
X{
X int len;
X char *cp;
X char buf[80];
X
X if (helpbusy && helpabort)
X return TRUE;
X
X if (!helpbusy) {
X (*dev->showhelp)(dev);
X helprow = 0;
X helpabort = FALSE;
X helpbusy = TRUE;
X }
X
X while (*str) {
X if (helprow > dev->textrows - 3) {
X if (spacewait(TRUE)) {
X helpabort = TRUE;
X return TRUE;
X }
X (*dev->showhelp)(dev);
X helprow = 0;
X }
X
X cp = strchr(str, '\n');
X if ((cp == NULL) || (cp[1] == '\0')) {
X (*dev->addhelp)(dev, str);
X if (cp)
X helprow++;
X return FALSE;
X }
X
X /*
X * Copy the line and null terminate it in order to display it.
X */
X cp++;
X while (str != cp) {
X len = (cp - str);
X if (len >= sizeof(buf))
X len = sizeof(buf) - 1;
X memcpy(buf, str, len);
X buf[len] = '\0';
X (*dev->addhelp)(dev, buf);
X str += len;
X }
X helprow++;
X }
X
X return FALSE;
X}
X
X
X/*
X * End the help display, by waiting for the user to type a space.
X */
Xvoid
Xendhelp()
X{
X if (helpbusy && !helpabort)
X spacewait(FALSE);
X helpbusy = FALSE;
X helpabort = FALSE;
X helprow = 0;
X}
X
X
X/*
X * See if the specified file name is matched by the specified pattern.
X * For our purposes, matching means the pattern is contain somewhere
X * within the name.
X */
Xstatic BOOL
Xmatchfile(name, pattern)
X char *name;
X char *pattern;
X{
X int patlen;
X int namelen;
X
X if (*pattern == '\0')
X return TRUE;
X namelen = strlen(name);
X patlen = strlen(pattern);
X
X while (namelen >= patlen) {
X if (memcmp(name, pattern, patlen) == 0)
X return TRUE;
X name++;
X namelen--;
X }
X
X return FALSE;
X}
X
X/* END CODE */
SHAR_EOF
$TOUCH -am 0316122993 life/io.c &&
chmod 0644 life/io.c ||
echo "restore of life/io.c failed"
set `wc -c life/io.c`;Wc_c=$1
if test "$Wc_c" != "20146"; then
echo original size 20146, current size $Wc_c
fi
# ============= life/lib/README ==============
if test ! -d 'life/lib'; then
echo "x - creating directory life/lib"
mkdir 'life/lib'
fi
echo "x - extracting life/lib/README (Text)"
sed 's/^X//' << 'SHAR_EOF' > life/lib/README &&
XThis directory contains the following catagories of Life objects:
X
Xgrow Objects with strange growth rates
Xgrow/breed Objects which grow as the square of time
Xgrow/sawtooth Objects with unbounded growth but don't tend to infinity
Xgrow/stretch Objects which grow by stretching
Xgun Glider or spaceship guns
Xobj Random collection of objects and reactions
Xosc Oscillators with fixed periods
Xosc/relay Oscillators which use a relay to allow multiple periods
Xpuff Puffers (moving objects which leave debris)
Xship Spaceships
Xship/c2 Spaceships which are period 2 and travel at c/2
Xship/c2.5 Spaceships which are period 5 and travel at 2c/5
Xship/c3 Spaceships which are period 3 and travel at c/3
Xship/c4 Spaceships which are period 4 and travel at c/4
Xship/p4 Spaceships which are period 4 and travel at c/2
Xship/hp Spaceships which have high periods
X
X
XI have tried to give credit for many of the objects I have collected,
Xalong with the approximate date of discovery and a brief description.
XBut as you can see, there are still many uncredited objects in the
Xcollection, and I apologize to their discoverers for that. Corrections
Xto this information are welcome.
X
XAlso, for many of the objects the short descriptions are my own. But
Xmany of the large descriptions are those of the original discoverer.
SHAR_EOF
$TOUCH -am 0314171593 life/lib/README &&
chmod 0644 life/lib/README ||
echo "restore of life/lib/README failed"
set `wc -c life/lib/README`;Wc_c=$1
if test "$Wc_c" != "1308"; then
echo original size 1308, current size $Wc_c
fi
# ============= life/lib/puff/shiprake.l ==============
if test ! -d 'life/lib/puff'; then
echo "x - creating directory life/lib/puff"
mkdir 'life/lib/puff'
fi
echo "x - extracting life/lib/puff/shiprake.l (Text)"
sed 's/^X//' << 'SHAR_EOF' > life/lib/puff/shiprake.l &&
X! "main" (cells 358 length 110 width 111 generation 0)
X!turk "Gregory Turk"@monet Tue Apr 10 01:14:25 1990
X!Four rakes make spaceships.
X30k38h@!
X..............................O.....O
X.............................OOO...OOO
X............................OO.O...O.OO
X............................OOO.....OOO
X.......OOO...OOO.............OO.....OO
X......O..O...O..O
X.........O...O...................O
X.........O...O..................OOO
X......O.O.....O.O..............O...O
X.
X..........OOO
X..........OOO..................OO.OO
X..........OOO....................O.......O
X.........................OOO............OOO
X........................O..O............O.OO
X..........OOO..............O.....OOO.....OOO
X..OOO.....OOO.....O....O...O.....OO......OOO
X.O..O............OOO...O...O.............OOO
X....O.....O.....OO.O.......O.............OO
XO...O....O.O....OOO.....O.O......O
XO...O....O.O....OOO.............O.O
X....O...........OOO
X.O.O.............OO
X...........O
X...........O
X.
X.
X.
X.
X.
X.............................O
X............................O
X............................OOO
X.
X.
X..............O.O
X...............OO
X...............O
X.
X.
X.
X.
X..............................................................O.....O
X60..OOO...OOO...........................OOO...OOO
X60.OO.O...O.OO..........................O..O.O..O
X60.OOO.....OOO..........................O.......O
X60..OO.....OO...........................O.......O
X60.......................................O.O.O.O
X23.O.........................................O
X22.O41.3O34.O
X22.3O75.3O
X64.O.O.................................OOO
X64..O
X20.O.O
X20..OO..................................O
X21.O34.3O12.3O20.O13.3O
X55.OO.O............O..O..................OOO...........O..O
X55.OOO.............O....................OO.O..............O
X55.OOO.............O...O................OOO...........O...O
X25.3O27.3O13.O3.O16.3O11.O3.O
X27.O28.OO7.O5.O20.3O7.O7.O
X26.O39.O5.O.O18.OO5.OO5.O.O
X31..................................OOO..................................OO
X.
X.
X31.OOO
X31...O
X31..O
X.
X.
X.
X31.......OOO
X31.........O
X31........O
X.
X.
X.
X31.............OOO
X31...............O.........................O........................O
X31..............O...........................O.....................OO
X31........................................OOO......................OO
X.
X.
X31...................OOO
X31.....................O
X31....................O
X.
X.
X.
X31.........................OOO
X31...........................O
X31..........................O
X.
X.
X.
X31...............................OOO
X31.................................O.............O............O
X31................................O...............O.........OO
X31..............................................OOO..........OO
X.
X.
X31.....................................OOO
X31.......................................O
X31......................................O
X.
X.
X.
X31...........................................OOO
X31.............................................O
X31............................................O
SHAR_EOF
$TOUCH -am 0217191292 life/lib/puff/shiprake.l &&
chmod 0644 life/lib/puff/shiprake.l ||
echo "restore of life/lib/puff/shiprake.l failed"
set `wc -c life/lib/puff/shiprake.l`;Wc_c=$1
if test "$Wc_c" != "2986"; then
echo original size 2986, current size $Wc_c
fi
# ============= life/lib/puff/switch.l ==============
echo "x - extracting life/lib/puff/switch.l (Text)"
sed 's/^X//' << 'SHAR_EOF' > life/lib/puff/switch.l &&
X! "switch" (cells 11 length 7 width 28 generation 0)
X! Switch Engine
X! This is a puffer train which travels diagonally at c/12 towards the upper
X! left with a period of 96. It's only exhaust is many sets of blocks
X! arranged in a zig-zag. This is the smallest known object which grows
X! without bound (11 cells). The block to the right is necessary to
X! stabilize the exhaust. Without it, the engine is killed by the untamed
X! exhaust before it reaches 12 full periods.
X! Charles Corderman, 1971
X1k@!
X.O.O
XO
X.O..O
X...OOO
X.
X..........................OO
X..........................O
SHAR_EOF
$TOUCH -am 0314152793 life/lib/puff/switch.l &&
chmod 0600 life/lib/puff/switch.l ||
echo "restore of life/lib/puff/switch.l failed"
set `wc -c life/lib/puff/switch.l`;Wc_c=$1
if test "$Wc_c" != "584"; then
echo original size 584, current size $Wc_c
fi
# ============= life/lib/puff/c3puff.l ==============
echo "x - extracting life/lib/puff/c3puff.l (Text)"
sed 's/^X//' << 'SHAR_EOF' > life/lib/puff/c3puff.l &&
X! "main" (cells 847 length 79 width 173 generation 0)
X! Pseudo c/3 puffer
X! No true puffer train from c/3 spaceships is known. This is the next best
X! thing, which is a pseudo-puffer made by converting a stream of spaceships
X! into puffer output using several c/3 spaceships.
X! David I. Bell, April 1992
X52k@!
X143.3O
X134.OO5.O4.O11.OO
X11.O129.O5.O10.OO
X10.O.O113.OO18.O
X9.OO100.OO11.OO..O15.OO
X11.O99.OO11.6O
X9.OO113.4O16.OO
X9.3O125.O8.O22.OO
X138.O..O5.O21.OO
X9.O..O123.3O..O4.O13.O.OO.O
X9.O.O64.O3.3O41.4O15.3O14.O.O.O.O
X9.O51.OO12.O.O..5O26.OO11.6O
X10.O50.OO12.O3.OO3.OO25.OO11.OO..O33.O3.O
X10.O.O63.O..O3.OO..O.OO35.OO37.OO
X11.O65.3O3.O..O..OO..3O12.OO53.O
X10.OO74.O6.OO13.OO
X77.3O3.O..OO3.3O
X9.O..O63.O..O3.OO3.O3.O
X8.O52.OO12.O3.OO3.OO
X7.OO..O49.OO12.O.O..5O3.O3.O56.O11.3O5.3O
X9.4O63.O3.3O3.OO3.3O53.O.O12.3O3.3O
X9.O.OO73.O6.OO13.OO38.OO10.O.4O.4O.O
X9.O.O74.O..OO..3O12.OO51.OO..O.O..OO
X9.3O75.O.OO71.3O3.3O
X9.OO152.O5.O
X10.O.OO
X13.O14.O..O42.O.O
X13.O13.O22.4O7.OO10.O33.OO44.OO
X11.3O13.O3.O5.OO11.O3.O5.4O9.O3.O5.OO21.4O19.OO21.4O
X9.OO16.4O5.OO.OO9.O8.OO.OO9.4O5.OO.OO18.OO.OO18.OO.OO18.OO.OO
X9.OO..O23.4O10.O..O5.OO21.4O19.OO21.4O19.OO
X12.O25.OO44.OO44.OO
X10.OO
X10.3O
X169.OO
X169.OO
X1
X89.O
X88.OO
X88.O.O
X1
X31.O35.O
X30.O36.OO
X30.3O33.O.O
X8.OO3.O
X7.3O4.O
X6.O3.3O
X5.OO.O.OO.O3.O9.O
X6.O.O6.3O8.OO18.O3.3O65.OO
X5.3O..O4.O..OO.O.OO.O4.OO12.O.O..5O45.OO15.OO.OO6.OO
X..O.OO.O8.O3.3O3.O4.OO12.O3.OO3.OO3.O39.OO17.O..O6.OO
XOO4.6O4.O..OO5.O19.O..O3.3O4.O3.O25.4O7.O16.O..O
XOO18.OO4.O20.3O3.OO.O8.O12.OO.OO6.OO..O25.OO
XOO4.6O4.O..OO5.O28.O5.OO..O12.OO.OO5.OO..O
X..O.OO.O8.O3.3O3.O20.3O3.OO..O5.OO24.O..O26.OO
X5.3O..O4.O..OO.O.OO.O19.O..O3.5O3.3O26.OO26.O..O
X6.O.O6.3O8.OO3.OO12.O3.OO3.OO62.O..O6.OO
X5.OO.O.OO.O3.O9.O3.OO12.O.O..8O3.3O26.OO25.OO.OO6.OO
X6.O3.3O33.O3.3O.O..O5.OO24.O..O25.OO
X7.3O4.O40.O5.OO..O12.OO.OO5.OO..O
X8.OO3.O41.OO8.O12.OO.OO6.OO..O
X60.O3.O25.4O
X15.O3.O39.O
X14.OO..O.O
X12.O.O5.O
X12.3O.OO.3O.O8.O.O
X12.O.O..OO..OO.O7.O
X16.3O7.O3.OO
X8.O.OO.O3.O4.3O..OO.OO..O
X7.O.OO.6O5.3O..4O3.O
X6.OO.OO16.3O.O..4O
X7.O.OO.6O5.3O..4O3.O
X8.O.OO.O3.O4.3O..OO.OO..O
X16.3O7.O3.OO
X12.O.O..OO..OO.O7.O
X12.3O.OO.3O.O8.O.O
X12.O.O5.O
X14.OO..O.O
X15.O3.O
SHAR_EOF
$TOUCH -am 0314152693 life/lib/puff/c3puff.l &&
chmod 0644 life/lib/puff/c3puff.l ||
echo "restore of life/lib/puff/c3puff.l failed"
set `wc -c life/lib/puff/c3puff.l`;Wc_c=$1
if test "$Wc_c" != "2141"; then
echo original size 2141, current size $Wc_c
fi
# ============= life/lib/puff/p32rake.l ==============
echo "x - extracting life/lib/puff/p32rake.l (Text)"
sed 's/^X//' << 'SHAR_EOF' > life/lib/puff/p32rake.l &&
X! "main" (cells 81 length 30 width 39 generation 0)
X! Period 32 rake.
X15k19h@!
X.................................OOOOO
X.............OOOO................O....O
X.O..........OOOOOO...............O
XO..........OO.OOOO................O
XO.....O.....OO
XOOOOOO
X.
X.
X....OOO
X.....OO
X..O
X.OO
XOO
X.OO
X.
X.
X.
X.OO
XOO
X.OO
X..O
X.....OO
X....OOO
X.
X.
XOOOOOO
XO.....O.....O
XO..........O
X.O.........O.....O
X...........OOOOOO
SHAR_EOF
$TOUCH -am 0314164693 life/lib/puff/p32rake.l &&
chmod 0644 life/lib/puff/p32rake.l ||
echo "restore of life/lib/puff/p32rake.l failed"
set `wc -c life/lib/puff/p32rake.l`;Wc_c=$1
if test "$Wc_c" != "398"; then
echo original size 398, current size $Wc_c
fi
# ============= life/lib/puff/p292.l ==============
echo "x - extracting life/lib/puff/p292.l (Text)"
sed 's/^X//' << 'SHAR_EOF' > life/lib/puff/p292.l &&
X! "main" (cells 132 length 31 width 27 generation 829)
X! Period 292 slightly dirty puffer.
X! David I. Bell, August 1992
X15k@!
X......................OOOO
X......................O...O
X..............O.......O
X............O...O......O..O
X...........O
X...........O....O
X...........OOOOO
X.
X.
X..........O
X.OO.O...OO.OO
XO..OOOOO.O
XO..O.OO.OO
XOO...OOO.OO........OO.O..OO
X..O......OO.......O.O.OOOOO
X.........OO...OOO.O
X..O......OO.......O.O.OOOOO
XOO...OOO.OO........OO.O..OO
XO..O.OO.OO
XO..OOOOO.O
X.OO.O...OO.OO
X..........O
X.
X.
X...........OOOOO
X...........O....O
X...........O
X............O...O......O..O
X..............O.......O
X......................O...O
X......................OOOO
SHAR_EOF
$TOUCH -am 0314152793 life/lib/puff/p292.l &&
chmod 0644 life/lib/puff/p292.l ||
echo "restore of life/lib/puff/p292.l failed"
set `wc -c life/lib/puff/p292.l`;Wc_c=$1
if test "$Wc_c" != "672"; then
echo original size 672, current size $Wc_c
fi
# ============= life/lib/puff/p24.l ==============
echo "x - extracting life/lib/puff/p24.l (Text)"
sed 's/^X//' << 'SHAR_EOF' > life/lib/puff/p24.l &&
X! "main" (cells 230 length 141 width 24 generation 0)
X! A collection of useful period 24 puffers:
X! forward glider; backward glider; block; blinker; 4 blocks + boat
X70k11h@!
X..............O
X.............O
X.............O...O
X.............OOOO
X.
X.
X.
X.OO
XOO.OO
X.OOOO...O
X..OO...O
X......O..O
X..OO...O
X.OOOO...O
XOO.OO
X.OO
X.
X..........O
X.........O
X.........O.....O
X.........OOOOOO
X.
X...................OOOO
X...................O...O
X...................O
X....................O
X.
X.
X.
X.
X.
X.
X.
X.
X.
X.
X...................OOOO
X..................OOOOOO
X.................OO.OOOO
X..................OO
X.
X.....OOOO
X.....O...O
X.....O
X......O..O..OO
X...........OOO
X......O..O..OO
X.....O
X.....O...O
X.....OOOO
X.
X..................O
X.................O
X.................O.....O
X.................OOOOOO
X.
X.
X.
X.
X.
X.
X.
X.
X.
X.
X.......OO........OOOOOO
X......OO.OO......O.....O
X.......OOOO......O
X........OO........O
X.
X.
X..........O
X.........OO
X........OO
X.........OO
X.
X.
X.
X.
X..........OOOOO
X..........O....O
X..........O
X...........O
X.
X.
X.
X.
X.
X.
X.
X.
X.
X.
X.....OOOO
X.....O...O
X.....O
X......O..O..OO
X...........OOO
X......O..O..OO
X.....O
X.....O...O
X.....OOOO
X.
X.
X.................OOOOOO
X.................O.....O
X.................O
X..................O
X.
X.
X.
X.
X.
X.
X.
X.
X.
X.
X...................OOOO
X...................O...O
X...................O
X....................O
X.
X.
X.
X.
X.
X.OO
XOO.OO
X.OOOO...O
X..OO...O
X......O..O
X..OO...O
X.OOOO...O
XOO.OO
X.OO
X.
X..........O
X.........O
X.........O.....O
X.........OOOOOO
SHAR_EOF
$TOUCH -am 0311172393 life/lib/puff/p24.l &&
chmod 0644 life/lib/puff/p24.l ||
echo "restore of life/lib/puff/p24.l failed"
set `wc -c life/lib/puff/p24.l`;Wc_c=$1
if test "$Wc_c" != "1464"; then
echo original size 1464, current size $Wc_c
fi
# ============= life/lib/puff/p12.l ==============
echo "x - extracting life/lib/puff/p12.l (Text)"
sed 's/^X//' << 'SHAR_EOF' > life/lib/puff/p12.l &&
X! "main" (cells 243 length 137 width 26 generation 0)
X! A collection of useful period 12 puffers:
X! backward glider; block; beehive; beehive; blinker
X68k12h@!
X.....................O
X....................O
X..........O.........O....O
X.OO......O..........OOOOO
XOO.OO....O...O
X.OOOO....OOOO
X..OO
X.
X.
X....O
X...OO
X..OO
X...OO
X.
X.
X......................OO
X.....................OO.OO
X....OOOOO.............OOOO
X....O....O.............OO
X....O
X.....O
X.
X.
X.
X.
X.
X.
X.
X.
X.
X....................O
X...................O
X...................O.....O
X...................OOOOOO
X.
X...........OO
X..........OO.OO
X...........OOOO...O
X............OO...O
X................O..O
X............OO...O
X...........OOOO...O
X..........OO.OO
X...........OO
X.
X....................O
X...................O
X...................O.....O
X...................OOOOOO
X.
X.
X.
X.
X.
X.
X.
X.
X.
X.
X.
X.....................OOOO
X.....................O...O
X.....................O
X......................O
X............OOOO
X............O...O
X............O
X.............O..O..OO
X..................OOO
X.............O..O..OO
X............O
X............O...O
X............OOOO
X......................O
X.....................O
X.....................O...O
X.....................OOOO
X.
X.
X.
X.
X.
X.
X.
X.
X.
X....................O
X...................O
X...................O.....O
X...................OOOOOO
X.
X.
X.......OO
X......OO.OO
X.......OOOO...O
X........OO...O
X............O..O
X........OO...O
X.......OOOO...O
X......OO.OO
X.......OO
X....................O
X...................O
X...................O.....O
X...................OOOOOO
X.
X.
X.
X.
X.
X.
X.
X.
X.
X.
X.
X....................O
X...................O
X...................O.....O
X...................OOOOOO
X.
X.
X............OOOO
X............O...O
X............O
X.............O..O..OO
X..................OOO
X.............O..O..OO
X............O
X............O...O
X............OOOO
X.
X.
X...................OOOOOO
X...................O.....O
X...................O
X....................O
SHAR_EOF
$TOUCH -am 0314152893 life/lib/puff/p12.l &&
chmod 0644 life/lib/puff/p12.l ||
echo "restore of life/lib/puff/p12.l failed"
set `wc -c life/lib/puff/p12.l`;Wc_c=$1
if test "$Wc_c" != "1922"; then
echo original size 1922, current size $Wc_c
fi
# ============= life/lib/puff/p1340.l ==============
echo "x - extracting life/lib/puff/p1340.l (Text)"
sed 's/^X//' << 'SHAR_EOF' > life/lib/puff/p1340.l &&
X! "main" (cells 183 length 65 width 177 generation 0)
X! Period 1340 puffer
X! Variable-period puffer demonstrating one-sided ignition of a blinker trail.
X! Moving the back two HWSS backwards and outwards by 6N cells, and also moving
X! the back LWSS backwards by 12N cells, will produce a puffer whose period is
X! increased by 120N, and which attempts to leave 3N more blinkers.
X! David I. Bell, February 1993
X23k@!
X...............................OOOO
X...............................O...O
X...............................O
X................................O..O
X.
X.
X.
X.
X.
X.
X..............O
X............O...O
X...........O
X...........O....O
X...........OOOOO
X.
X.
X..........O
X.OO.O...OO.OO
XO..OOOOO.O
XO..O.OO.OO..............O
XOO...OOO.OO......OO.O..O.O
X..O......OO.....O.O.OOOO.O
X.........OO.OOO.O
X..O......OO.....O.O.OOOO.O
XOO...OOO.OO......OO.O..O.O
XO..O.OO.OO..............O
XO..OOOOO.O
X.OO.O...OO.OO
X..........O.............................................O
X......................................................O...O
X53.O119.O..O
X11.5O37.O4.O113.O
X11.O4.O36.5O114.O3.O
X11.O160.4O
X12.O...O
X12...O
X.
X.
X.
X.
X.
X.
X.
X.
X.
X134.OOOOOO
X134.O.....O
X134.O
X134..O....O
X134....OO
X40..OO
X40.OO.OO
X40..OOOO
X40...OO
X.
X.
X.
X.
X.
X126.OOOOOO
X126.O.....O
X126.O
X126..O....O
X126....OO
SHAR_EOF
$TOUCH -am 0314152893 life/lib/puff/p1340.l &&
chmod 0644 life/lib/puff/p1340.l ||
echo "restore of life/lib/puff/p1340.l failed"
set `wc -c life/lib/puff/p1340.l`;Wc_c=$1
if test "$Wc_c" != "1255"; then
echo original size 1255, current size $Wc_c
fi
# ============= life/lib/puff/c3rake.l ==============
echo "x - extracting life/lib/puff/c3rake.l (Text)"
sed 's/^X//' << 'SHAR_EOF' > life/lib/puff/c3rake.l &&
X! "main" (cells 491 length 63 width 142 generation 0)
X! A c/3 pseudo-rake
X! Salvos of spaceships hit tbe backs of two c/3 spaceships to form debris
X! and gliders near the spaceships. This is like a rake or puffer, except
X! that the spaceships must be "fed" from the spaceship stream. Therefore,
X! this is a "pseudo-rake". No real c/3 puffer is known.
X! David I. Bell
X27k9h@!
X114..O.O..OO
X114.O...O.OOO....OO
X6.O108.O6.OO3.OO
X4.OO82.O3.OO22.5O.O
X4.OO74.OO4.OO.O.3O25.3O
X6.O73.OO4.O4.3O
X4.O81.O3.O28.3O
X4.O.O80.3O26.5O.O15.OO
X4.O.O108.O6.OO14.OO
X5.O81.3O24.O3.O.3O
X3.OO35.OO44.O3.O24.O.O..OO
X4.O25.OO7.O.O38.OO4.O4.3O15.O
X4.3O23.OO6.OO.O38.OO4.OO.O.3O16.OO
X5.O33.OO26.OO19.O3.OO15.OO
X2......O................................O..........................O.O.......OO
X2....OO..............................................................O.......OO
X2....OO.................................O..........................OOO
X2......................................OO
X2.OOO.........................OO......OO.O
X2.OO..OO......................OO.......O.O
X2...O...................................OO.......O.O...............OOO
X3.OO44.OO18.O7.OO52.OO5.OO
X3.OO45.O16.O.O7.OO51.O..O3.O..O
X3.O..O60.OO51.O.O10.OO.OO
X7.O113.OO9.O.O.O.O
X4.5O112.O10.O.O.O.O
X8.OO26.OO92.O9.O
X8.OO..OO21.4O6.O..O42.O..O34.O11.O
X5.4O..OO.OO5.4O9.OO.OO5.O22.4O19.O22.4O
X4.O3.O3.4O5.O3.O9.OO7.O3.O18.O3.O18.O3.O18.O3.O15.OO.OO
X4.3O6.OO6.O22.4O19.O22.4O19.O17.O..O.O..O
X4.O..O14.O..O42.O..O42.O..O13.3O3.3O
X5.O
X5.O.O
X6.O46.3O82.OO
X53.O84.OO
X10.............................................O
X.
X10..............................OOO
X10................................O
X10...............................O
X.
X.
X.
X.
X10........................................................OO
X10........................................................O.O
X10........................................................O..................OO
X10.OO.......................................................................O
XOO7.O.O16.OO52.O..OO10.OO
XOO6.OO.O15.O.O34.O17.O..O11.OO
X9.OO..................O.......OO.......................O..O................O.O
X9..O.........................OO.OO......OO.OO..........OOOOO................OO
X9.............................O..O......OO.OO..........OOO.OO
X9..O..........................O..O......................OO.O................OO
X9.OO...........................OO........................OO................O.O
XOO6.OO.O70.O..O11.OO
XOO7.O.O26.OO24.OO16.O..OO10.OO
X10.OO.........................O..O......................OO.O................O
X10............................O..O......OO.OO..........OOO.OO................OO
X10...........................OO.OO......OO.OO..........OOOOO
X10............................OO.......................O..O
X10.......................................................O
SHAR_EOF
$TOUCH -am 0314152693 life/lib/puff/c3rake.l &&
chmod 0644 life/lib/puff/c3rake.l ||
echo "restore of life/lib/puff/c3rake.l failed"
set `wc -c life/lib/puff/c3rake.l`;Wc_c=$1
if test "$Wc_c" != "2772"; then
echo original size 2772, current size $Wc_c
fi
# ============= life/lib/puff/p20.l ==============
echo "x - extracting life/lib/puff/p20.l (Text)"
sed 's/^X//' << 'SHAR_EOF' > life/lib/puff/p20.l &&
X! "main" (cells 190 length 109 width 23 generation 0)
X! A collection of useful period 20 puffers:
X! forward glider; backward glider; block; boat
X54k11h@!
X..O........OO
X.O........OOOO
X.O...O...OO.OO
X.OOOO.....OO
X.
X.
X.
X.....O
X...OO
X...O
X...O
X....O
X.
X.
X..O
X.O
X.O...O
X.OOOO.............OOOO
X..................O...O
X..................O
X...................O
X.
X.
X.
X.
X.
X.
X.
X.
X.
X.
X..................OOOO
X..................O...O
XOOOO..............O
XO...O..............O
XO
X.O
X.
X.
X...O
X..O
X..O
X..OO
X....O
SHAR_EOF
echo "End of part 2"
echo "File life/lib/puff/p20.l is continued in part 3"
echo "3" > shar3_seq_.tmp
exit 0
0 mensajes nuevos