Compare: (<)xlife36\button.c (3114 bytes) with: (>)Xlife35\source\button.c (3120 bytes) 46a46 > int t; 68,69c69,70 < numcells += 1 - < setcell(XPOS(event.xbutton.x,xpos),YPOS(event.xbutton.y,ypos),1); --- > addcell(XPOS(event.xbutton.x,xpos),YPOS(event.xbutton.y,ypos)); > numcells++; 92,93c93,94 < numcells -= < setcell(XPOS(event.xbutton.x,xpos),YPOS(event.xbutton.y,ypos),0); --- > deletecell(XPOS(event.xbutton.x,xpos),YPOS(event.xbutton.y,ypos)); > numcells--; ******************************************************************************* Compare: (<)xlife36\cell.c (18119 bytes) with: (>)Xlife35\source\cell.c (18074 bytes) 30,34c30,34 < { unsigned long cellpos = (ydx&3)*8 + (xdx&7); < if (ydx&4) < return(ptr->live2 & 1 << cellpos); < else < return(ptr->live1 & 1 << cellpos); --- > { > if (ydx > 3) > return(ptr->live2 & 1 << ( (ydx - 4)*8 + xdx)); > else > return(ptr->live1 & 1 << ( ydx*8 + xdx)); 41,58c41,58 < { unsigned long cellpos = (ydx&3)*8 + (xdx&7); < if (!(ptr->x+(xdx&7)>=lx && ptr->x+(xdx&7)<=ux && < ptr->y+(ydx&7)>=ly && ptr->y+(ydx&7)<=uy)) return 0; < else if (ydx&4) < return(ptr->live2 & 1 << cellpos); < else < return(ptr->live1 & 1 << cellpos); < } < < void defcell(cellbox *ptr, int xdx, int ydx, int val) < /* set state of cell xdx, ydx within box *ptr */ < { unsigned long cellpos = (ydx&3)*8 + (xdx&7); < if (val) < { < if (ydx&4) < ptr->live2 |= 1 << cellpos; < else < ptr->live1 |= 1 << cellpos; --- > { > if (!(ptr->x+xdx>=lx && ptr->x+xdx<=ux && > ptr->y+ydx>=ly && ptr->y+ydx<=uy)) return 0; > else if (ydx > 3) > return(ptr->live2 & 1 << ( (ydx - 4)*8 + xdx)); > else > return(ptr->live1 & 1 << ( ydx*8 + xdx)); > } > > void setcell(cellbox *ptr, int xdx, int ydx, int val) > /* set state of cell xdx, ydx within box *ptr */ > { > if (val) > { > if (ydx > 3) > ptr->live2 |= 1 << ( (ydx - 4)*8 + xdx); > else > ptr->live1 |= 1 << ( ydx*8 + xdx); 62,65c62,65 < if (ydx&4) < ptr->live2 &= ~ (1L << cellpos); < else < ptr->live1 &= ~ (1L << cellpos); --- > if (ydx > 3) > ptr->live2 &= 0xffffffff^(1 << ( (ydx - 4)*8 + xdx)); > else > ptr->live1 &= 0xffffffff^(1 << ( ydx*8 + xdx)); 372c372 < int sc; --- > int sc,yy; ******************************************************************************* Compare: (<)xlife36\cellbox.c (22580 bytes) with: (>)Xlife35\source\cellbox.c (20399 bytes) 34,36c34 < * int setcell(x, y, val) set cell to value val and get previous value --- 55,61c53,58 < * void defcell(ptr, dx, dy, val) -- set cell at x, y in box *ptr to state val < * void forget(ptr) -- cause a box to forget last generation's state < * < * to access cell state. It also relies on the existence of the functionc < * < * void displaybox(x, y, ptr) -- post box state to Xrect arrays < * void trdisplaybox(x, y, ptr) -- post box state to Xrect arrays --- > * void setcell(ptr, dx, dy, val) -- set cell at x, y in box *ptr to state val > * void forget(ptr) -- cause a box to forget last generation's state > * > * to access cell state. It also relies on the existence of a function > * > * void displaybox(x, y, ptr) -- post box state to Xrect arrays 69,70d66 < #include /* gethostname() */ < #define HOST_LEN 80 76a71 > #define SPACE '.' 93c89,92 < bzero((char*)boxes,HASHSIZE*sizeof(cellbox *)); --- > int i; > > bzero((char*)boxes,HASHSIZE*sizeof(cellbox *)); > 107c106 < defcell(ptr, xdx, ydx, 1); --- > setcell(ptr, xdx, ydx, 1); 119c118 < defcell(ptr, xdx, ydx, 0); --- > setcell(ptr, xdx, ydx, 0); 141,167d140 < int setcell(UNS32 x, UNS32 y, int val) < /* set cell and return back previous status */ < { < unsigned long ydx,xdx; < cellbox *ptr; < < if (ptr = looklink(x,y)){ < ydx = y - ptr->y; < xdx = x - ptr->x; < if ( !getcell(ptr, xdx, ydx) == !val ) < return val; < else < defcell(ptr, xdx, ydx, val); < return !val; < } < else if (val) < { ptr = lifelink(x,y); < ydx = y - ptr->y; < xdx = x - ptr->x; < ptr->dead=0; < defcell(ptr, xdx, ydx, 1); < return 0; < } < else < return 0; < } < 242,243c214,219 < x &= universe^7; < y &= universe^7; --- > #ifdef BOUNDED > x |= ~universe; > y |= ~universe; > #endif > x &= ~7; > y &= ~7; 302,303c278,283 < x &= universe^7; < y &= universe^7; --- > #ifdef BOUNDED > x |= ~universe; > y |= ~universe; > #endif > x &= ~7; > y &= ~7; 506a486,522 > void heapsort(UNS32 *data, UNS32 n) > { > unsigned long help; > register unsigned long i, j, k; > data --; > #define swap(x,y) { help=data[x]; data[x]=data[y]; data[y]=help; } > for (i=2;i<=n;i++) > { while (j = i/2) > { if (data[i] > data[j]) swap(i,j) > else break; > i = j; > } > } > for (k=n;k>1;k--) > { help = data[1]; > for (i=2,j=1;i { if (data[i+1] > data[i]) i++; > data[j] = data[i]; > j = i; > } > if (i==k) > { data[j] = data[i]; > j = i; > } > data[j] = data[k]; > data[k] = help; > if (j < k) > { while ( i = j/2 ) > { if (data[j] > data[i]) swap(i,j) > else break; > j = i; > } > } > } > #undef swap > data ++; > } 525,526c542,543 < heapsort(coordxlist,ctr,1); < heapsort(coordylist,ctr,1); --- > heapsort(coordxlist,ctr); > heapsort(coordylist,ctr); 602a619 > displaybox(x, y, ptr); 684,710d702 < void * get_list_of_sorted_cellbox_ptr(void) < { < unsigned long ctr, *coordxyptrlist, i; < cellbox *ptr; < if (!(coordxyptrlist= (unsigned long*) malloc( < ((2+1)*sizeof(unsigned long)) * (numboxes+1) ) )) < return (void *) 0; < ctr=0; < coordxyptrlist += 3; < for (ptr = head; ptr != NULL; ptr = ptr->next){ < if(!ptr->dead && (ptr->live1 || ptr->live2)){ < coordxyptrlist[ctr++] = ptr->y; < coordxyptrlist[ctr++] = ptr->x; < coordxyptrlist[ctr++] = (unsigned long) ptr; < } < } < ctr /= 3; < if (ctr>0) < heapsort(coordxyptrlist,ctr,3); < coordxyptrlist -= 3; < for (i=0;i char machine[80]; > /** mode should be one of "BbARDP\0" **/ 736c727 < gethostname(machine,HOST_LEN); --- > gethostname(machine,80); 823c814 < { long xx=0, yy=0; --- > { int xx=0, yy=0; 836,883d827 < else if (mode == 'M') < { unsigned long xx= -1, yy=0, x, y, i, j, k=0; < cellbox * *lex_start; < if (!(lex_start= (cellbox **) get_list_of_sorted_cellbox_ptr())) < { strcpy(inpbuf,"Insufficient memory: Can't save configuration "); < XClearWindow(disp,inputw); < XDrawString(disp,inputw,ntextgc,ICOORDS(0,0),inpbuf,strlen(inpbuf)); < return; < } < fprintf(ofp, "#M x = %ld , y = %ld\n", xmax+1-xmin, ymax+1-ymin ); < for (j=0;lex_start[j] != NULL;j=i) < for (dy = 0; dy < BOXSIZE; dy++) < for (ptr = lex_start[i=j]; ptr != NULL && < (i==j || lex_start[i-1]->y==ptr->y) ; ptr = lex_start[++i]) < if (!ptr->dead) < for (dx = 0; dx < BOXSIZE; dx++) < if (val = getcellinbounds(ptr, dx, dy, lx, ly, ux, uy)) < { x = ptr->x+dx-xmin; < y = ptr->y+dy-ymin; < if (y == yy && x == xx+1) < { k++; xx++; continue; } < if (k>1) < (void) fprintf(ofp, "%ldo",k); < else if (k) < (void) fputc('o', ofp); < k=1; < if (y > yy) < { xx= -1; < if (y > yy+1) < (void) fprintf(ofp, "%ld$",y-yy); < else < (void) fputc('$', ofp); < yy = y; < } < if (x > xx+2) < (void) fprintf(ofp, "%ldb",x-xx-1); < else if (x == xx+2) < (void) fputc('b', ofp); < xx = x; < } < if (k>1) < (void) fprintf(ofp, "%ldo",k); < else if (k) < (void) fputc('o', ofp); < (void) fputc('!', ofp); < (void) fputc('\n', ofp); < free(lex_start); < } ******************************************************************************* Compare: (<)xlife36\cellbox.h (2640 bytes) with: (>)Xlife35\source\cellbox.h (2640 bytes) 51c51 < GLOBAL void defcell( cellbox *ptr, int xdx, int ydx, int val ); --- > GLOBAL void setcell( cellbox *ptr, int xdx, int ydx, int val ); ******************************************************************************* Compare: (<)xlife36\collect.c (11343 bytes) with: (>)Xlife35\source\collect.c (11334 bytes) 133c133 < strncpy(newreq->patname,patname,PATHNAMELEN); --- > strncpy(newreq->patname,patname,PATNAMESIZ); 152c152 < strncpy(newpat->patname,patname,PATHNAMELEN); --- > strncpy(newpat->patname,patname,PATNAMESIZ); 177c177 < char patname[PATHNAMELEN],patfield[PATHNAMELEN]; --- > char patname[PATNAMESIZ],patfield[PATNAMESIZ]; 215c215 < char buf[BUFSIZ],patid[PATHNAMELEN],pardir[PATHNAMELEN]; --- > char buf[BUFSIZ],patid[PATNAMESIZ],pardir[PATNAMESIZ]; 247c247 < char tmpstring[PATHNAMELEN]; --- > char tmpstring[PATNAMESIZ]; 325c325 < char thispat[PATHNAMELEN]; --- > char thispat[PATNAMESIZ]; 346c346 < char outbuf[PATHNAMELEN]; --- > char outbuf[PATNAMESIZ]; ******************************************************************************* Compare: (<)xlife36\data.c (1722 bytes) with: (>)Xlife35\source\data.c (1720 bytes) 33,36c33,36 < #define PATHNAMELEN 255 < typedef struct lq { < long loadtime; < char patname[PATHNAMELEN]; --- > #define PATNAMESIZ 255 > typedef struct lq { > long loadtime; > char patname[PATNAMESIZ]; ******************************************************************************* Compare: (<)xlife36\data.h (5876 bytes) with: (>)Xlife35\source\data.h (5767 bytes) 65d65 < GLOBAL int setcell( UNS32 x, UNS32 y, int val ); 113d112 < GLOBAL void heapsort( UNS32 *data, UNS32 n, UNS32 size ); ******************************************************************************* Compare: (<)xlife36\defs.h (3820 bytes) with: (>)Xlife35\source\defs.h (3744 bytes) 37,45c37,44 < #define versionid "3.6" < #ifndef DIR < #define DIR "/usr/lib/X11/xlife-"versionid"/patterns/" < #endif < #ifndef SCRATCHFILE < #define SCRATCHFILE ".boxcontents" /* at most 60-1 characters! */ < #endif < #define MARK '*' /* on_cell character */ < #define SPACE '.' /* off_cell character */ --- > #define versionid "3.5" > #ifndef DIR > #define DIR "/usr/local/games/xlife-"versionid"/patterns/" > #endif > #ifndef SCRATCHFILE > #define SCRATCHFILE ".boxcontents" > #endif > #define MARK '*' /* on_cell character */ 99c98 < #define PATHNAMELEN 255 /* It's an arbitrary limit, but probably enough */ --- > #define PATNAMESIZ 255 /* It's an arbitrary limit, but probably enough */ 103c102 < char patname[PATHNAMELEN]; --- > char patname[PATNAMESIZ]; ******************************************************************************* Compare: (<)xlife36\file.c (26413 bytes) with: (>)Xlife35\source\file.c (26362 bytes) 44c44 < char tentpat[PATHNAMELEN]; --- > char tentpat[PATNAMESIZ]; 202c202 < char thispat[PATHNAMELEN],badpat[PATHNAMELEN]; --- > char errstr[80],thispat[PATNAMESIZ],badpat[PATNAMESIZ]; 289c289 < strncpy(newreq->patname,patname,PATHNAMELEN); --- > strncpy(newreq->patname,patname,PATNAMESIZ); 319c319 < char patname[PATHNAMELEN],patfield[PATHNAMELEN],tmpstring[PATHNAMELEN]; --- > char patname[PATNAMESIZ],patfield[PATNAMESIZ],tmpstring[PATNAMESIZ]; 372,374c372,374 < char buf[BUFSIZ],patid[PATHNAMELEN]; < int xoff = 0, yoff = 0; < int endpattern=0,found=0,anz; --- > char buf[BUFSIZ],patid[PATNAMESIZ]; > int xoff = 0, yoff = 0; > int endpattern=0,found=0; 402c402 < char pardir[PATHNAMELEN]; --- > char pardir[PATNAMESIZ]; 530,531c530 < linect=0; < anz=0; --- > linect=0; 563,564c562,564 < int n=anz, i=colct; < --- > int n, i=colct; > > n=0; 585d585 < anz=n; 643a642 > static char *ans; 711c711 < strncpy(newreq->patname,patname,PATHNAMELEN); --- > strncpy(newreq->patname,patname,PATNAMESIZ); 815c815 < char outbuf[100],tmp[PATHNAMELEN]; --- > char outbuf[100],tmp[PATNAMESIZ]; 864,865c864 < #define LIST_FILES_COMMAND "/bin/ls" < char outbuf[INPBUFLEN+16],tmp[PATHNAMELEN]; --- > char outbuf[100],tmp[PATNAMESIZ]; 882c881 < shellcommand(LIST_FILES_COMMAND" ",outbuf," ;>|<&",".life 2>&1"); --- > shellcommand("/bin/ls ",outbuf," ;>|<&",".life 2>&1"); ******************************************************************************* Compare: (<)xlife36\help.c (5971 bytes) with: (>)Xlife35\source\help.c (5864 bytes) 54d54 < "Set torus topology : #", 142d141 < if (strlen(prestr)+strlen(userstr)+strlen(poststr) >= MAXLINELEN) return; ******************************************************************************* Compare: (<)xlife36\keyin.c (13284 bytes) with: (>)Xlife35\source\keyin.c (13270 bytes) 119a119 > char pstring[50]; 175c176 < numcells -= setcell(x,y,0); --- > deletecell(x,y); 202c203 < numcells -= setcell(x,y,0); --- > deletecell(x,y); 449,456c450,459 < case '#': < { unsigned i; < i= 8*sizeof(universe); < getinputwstring("Logarithm of diameter of universe (>= 3 , default= infinite): "); < sscanf(inpbuf+1,"%u",&i); < universe= (i>=8*sizeof(universe)? -1L : (i>=3?(1L< #ifdef BOUNDED > case '#': > { unsigned i; > i= 8*sizeof(int); > getinputwstring("Logarithm of diameter of universe (default= infinite): "); > sscanf(inpbuf+1,"%u",&i); > universe= (i>=8*sizeof(int)? ~0 : (1< } > break; > #endif 479,480c482,483 < getinputwstring("Imageformat for saving patterns: A R D P M (default= automatic): "); < if (strchr("ARDPM",inpbuf[1])) --- > getinputwstring("Imageformat for saving patterns: A R D P (default= automatic): "); > if (strchr("ARDP",inpbuf[1])) ******************************************************************************* Compare: (<)xlife36\main.c (11199 bytes) with: (>)Xlife35\source\main.c (11205 bytes) 34d34 < #include 121c120 < hints.x += DisplayWidth(disp,screen) - hints.width - bwidth*2; --- > hints.x += DisplayWidth(disp,screen) - hints.width - bwidth * 2; 232c231 < scale = 2; --- > scale = 1; 238c237,239 < universe = ~0; --- > #ifdef BOUNDED > universe = ~0; > #endif ******************************************************************************* Compare: (<)xlife36\motion.c (2032 bytes) with: (>)Xlife35\source\motion.c (2001 bytes) 33,34c33 < numcells += 1 - < setcell(XPOS(event.xmotion.x,xpos),YPOS(event.xmotion.y,ypos),1); --- > addcell(XPOS(event.xmotion.x,xpos),YPOS(event.xmotion.y,ypos)); 41,42c40 < numcells -= < setcell(XPOS(event.xmotion.x,xpos),YPOS(event.xmotion.y,ypos),0); --- > deletecell(XPOS(event.xmotion.x,xpos),YPOS(event.xmotion.y,ypos)); ******************************************************************************* Compare: (<)xlife36\patchlevel.h (1367 bytes) with: (>)Xlife35\source\patchlevel.h (1367 bytes) 24c24 < static char *level="\nxlife 3 patchlevel 971216.1545"; --- > static char *level="\nxlife 3 patchlevel 971206.1605"; ******************************************************************************* Compare: (<)xlife36\utils.c (10108 bytes) with: (>)Xlife35\source\utils.c (8783 bytes) 223c223 < #define B2_31 0x80000000UL --- > #define B31 0x80000000 229,230c229,230 < /* Certificat: Angewandte Informatik 9/1983 p404-409 */ < register UNS32 p1=p_1, p2=p_2, b31=B2_31; --- > /* Certificat: Angewandte Informatik 9/83 p404-409 */ > register UNS32 p1=p_1, p2=p_2, b31=B31; 248,251c248,250 < if (!(x2&~B2_31 | x1)) x1 = 1; < p_1 = x1; p_2 = x2; < } < #undef B2_31 --- > if (!(x2&~B31 | x1)) x1 = 1; > p_1 = x1; p_2 = x2; > } 258c257 < numcells += 1 - setcell( random32()%dx+lx, random32()%dy+ly, 1); --- > addcell( random32()%dx+lx, random32()%dy+ly); 281c280 < unsigned long num,count; --- > u_long num,count; 342,384d341 < < void heapsort(UNS32 *data, UNS32 n, UNS32 size) < { /** !! There must be size UNS32 free for usage in front of data !! **/ < register unsigned long h, i, j, k; < data -= size; < #define copy(x,y) for (h=0;h data[(y)+h]) < for (i=2*size;i<=n*size;i+=size) < { while ((j=(i/size/2)*size) >= 1*size) < { if_is_first_greater(i,j) < { copy(0,i); copy(i,j); copy(j,0); } < else break; < i = j; < } < } < for (k=n*size;k>size;k-=size) < { copy(0,1*size); < for (i=2*size,j=size;i= 1*size) < { if_is_first_greater(j,i) < { copy(0,i); copy(i,j); copy(j,0); } < else break; < j = i; < } < } < } < #undef copy < #undef is_first_greater < data += size; < } ******************************************************************************* Compare: (<)xlife36\xlife.man (17117 bytes) with: (>)Xlife35\source\xlife.man (16833 bytes) 100,102d100 < .IP \fB#\fR 20 < Set the diameter of the universe -- it is truly a huge torus -- < to a power of 2. 155c152 < Select the imageformat for saving patterns: one of \fBA,R,D,P,M\fR or default . --- > Select the imageformat for saving patterns. 273c270 < \fBM\ [x = xdiam , y = ydiam]\fR -- nonempty picture with an optional diameter pair. --- > \fBM\ [x = xdiam y = ydiam [rule = digitstring/digitstring]]\fR -- Picture with an optional diameter pair and a rule declaration. 404,406c401 < will not be refreshed. Each rule which should born an on-cell if all its < neighbour cells are off yields no evolution outside the known boxes -- this < horizone will increase one step each generation into the vacancy. --- > will not be refreshed. ******************************************************************************* Compare: (<)xlife36\README (4482 bytes) with: (>)Xlife35\source\README (4052 bytes) 1,8c1,7 < Installation Notes < < As usual, do 'xmkmf -a' to get your own Makefile. < < You will probably want to modify the DIR define in defs.h to match < where you will be installing the xlife pattern libraries. Add it to the < CCOPTIONS like -DDIR=/vol/shared/X11/xlife/patterns/ in your Makefile. < The value will be what xlife pops up as the default load path. --- > Installation Notes > > As usual, do 'xmkmf' followed by 'make depend' to get your own Makefile. > > You will probably want to modify the DIR define in defs.h to match > where you will be installing the xlife pattern libraries. The value > will be what xlife pops up as the default load path. 54,56c53,55 < The lifesrch program based on Dean Hickerson's (dean@math.UCDavis.edu) < description (included in the 2.0 releases of xlife) by David I. Bell < (dbell@canb.auug.org.au) has been included in lifesearch/. --- > The lifesrch program based on Dean Hickerson's description (included > in the 2.0 releases of xlife) by David I. Bell has been included in > lifesearch/. 63,64d62 < Paul (callahan@cs.jhu.edu) < Achim (achim@uni-bielefeld.de) 108,113d105 < HP 780 running HP-UX 10.20 X11R6 < SGI Mips running IRIX 6.2 (as well as -n32 -32 -64) < SGI Mips running IRIX 5.3 < Linux 2.2.29 on a i586 with GNU 2.7.2.2 < ALpha AXP running DEC OSF1/V4.0 < Dec5000 running Ultrix V4.4 ************************************************************************8 No change to CHANGES cursor_data.h cursor_mask.h expose.c file_misc.c FIXED generate.c gentab.c icon.h key.c lifeconv.c macro.h NEWINCLUDE oldpconv.c resize.c tab.h TODO