1diff -urN xlife-6.7.5/data.c xlife-6.7.6/data.c
2--- xlife-6.7.5/data.c	2013-10-22 22:56:19.000000000 +0400
3+++ xlife-6.7.6/data.c	2014-01-14 11:25:58.000000000 +0400
4@@ -21,9 +21,9 @@
5  */
6
7 /*
8-A lot of modifications were added at 2001, 2011-13 by Vladimir Lidovski vol.litwr@gmail.com
9+A lot of modifications were added at 2001, 2011-14 by Vladimir Lidovski vol.litwr@gmail.com
10 (C) This version of XLife may be used under the same conditions as mentioned above
11-$Id: data.c 216 2013-07-28 18:06:27Z micro $
12+$Id: data.c 278 2014-01-13 18:19:40Z litwr $
13 */
14
15 #include "defs.h"
16@@ -102,3 +102,8 @@
17
18 char curdir[PATNAMESIZ], inidir[PATNAMESIZ], colorfile[PATNAMESIZ];
19 cell_t *trans;
20+
21+#if VFREQ != 0
22+struct timeval prev_vsync;
23+#endif
24+
25diff -urN xlife-6.7.5/defs.h xlife-6.7.6/defs.h
26--- xlife-6.7.5/defs.h	2013-10-22 22:56:19.000000000 +0400
27+++ xlife-6.7.6/defs.h	2014-01-14 11:26:08.000000000 +0400
28@@ -21,9 +21,9 @@
29  */
30
31 /*
32-A lot of modifications were added at 2001, 2011-13 by Vladimir Lidovski vol.litwr@gmail.com
33+A lot of modifications were added at 2001, 2011-14 by Vladimir Lidovski vol.litwr@gmail.com
34 (C) This version of XLife may be used under the same conditions as mentioned above
35-$Id: defs.h 255 2013-10-22 09:12:33Z teacher $
36+$Id: defs.h 278 2014-01-13 18:19:40Z litwr $
37 */
38
39 #ifdef __GNUCC__
40@@ -36,6 +36,7 @@
41 #include <X11/cursorfont.h>
42 #include <X11/keysym.h>
43 #include <X11/keysymdef.h>
44+#include <sys/time.h>
45 #include <string.h>
46 #include "common.h"
47
48@@ -433,3 +434,8 @@
49 #define btrans ((cell_t(*)[maxstates][maxstates][maxstates][maxstates][maxstates][maxstates][maxstates][maxstates])trans)
50 extern XColor cellcolor[], exact;
51 extern XGCValues xgcv;
52+
53+#if VFREQ != 0
54+extern struct timeval prev_vsync;
55+#endif
56+
57diff -urN xlife-6.7.5/file.c xlife-6.7.6/file.c
58--- xlife-6.7.5/file.c	2013-08-04 15:10:25.000000000 +0400
59+++ xlife-6.7.6/file.c	2014-01-12 22:06:19.000000000 +0400
60@@ -28,7 +28,7 @@
61 /*
62 A lot of modifications were added at 2001, 2011-13 by Vladimir Lidovski vol.litwr@gmail.com
63 (C) This version of XLife may be used under the same conditions as mentioned above
64-$Id: file.c 241 2013-08-04 10:00:07Z micro $
65+$Id: file.c 256 2013-10-22 19:17:22Z teacher $
66 */
67
68 /*
69@@ -478,7 +478,7 @@
70    strcpy(patfile, patname);
71    if (patfile[0] == '/'
72 #ifdef MICROSOFT
73-                         || strstr(patfile, ":/") == patfile + 1
74+           || strstr(patfile, ":/") == patfile + 1 || strchr(patfile, '/') == 0
75 #endif
76                                                                 )
77       strcpy(fullpath, patfile);
78diff -urN xlife-6.7.5/file.h xlife-6.7.6/file.h
79--- xlife-6.7.5/file.h	2013-03-23 13:02:49.000000000 +0400
80+++ xlife-6.7.6/file.h	2014-01-11 13:55:41.000000000 +0400
81@@ -23,7 +23,7 @@
82 /*
83 A lot of modifications were added at 2001, 2011-13 by Vladimir Lidovski vol.litwr@gmail.com
84 (C) This version of XLife may be used under the same conditions as mentioned above
85-$Id: file.h 174 2013-03-23 09:02:49Z micro $
86+$Id: file.h 216 2013-07-28 18:06:27Z micro $
87 */
88
89 extern char rfullpath[];
90diff -urN xlife-6.7.5/file_misc.c xlife-6.7.6/file_misc.c
91--- xlife-6.7.5/file_misc.c	2013-01-25 19:28:17.000000000 +0400
92+++ xlife-6.7.6/file_misc.c	2014-01-11 13:55:41.000000000 +0400
93@@ -23,7 +23,7 @@
94 /*
95  * A lot of modifications were added at 2001, 2011, 2012 by Vladimir Lidovski vol.litwr@gmail.com
96  * (C) This version of XLife may be used under the same conditions as mentioned above
97- * $Id: file_misc.c 73 2012-05-13 07:16:57Z micro $
98+ * $Id: file_misc.c 216 2013-07-28 18:06:27Z micro $
99  */
100
101 #include "defs.h"
102diff -urN xlife-6.7.5/generate.c xlife-6.7.6/generate.c
103--- xlife-6.7.5/generate.c	2013-08-04 15:10:25.000000000 +0400
104+++ xlife-6.7.6/generate.c	2014-01-12 22:06:19.000000000 +0400
105@@ -25,7 +25,7 @@
106 /*
107 A lot of modifications were added at 2001, 2011-13 by Vladimir Lidovski vol.litwr@gmail.com
108 (C) This version of XLife may be used under the same conditions as mentioned above
109-$Id: generate.c 241 2013-08-04 10:00:07Z micro $
110+$Id: generate.c 270 2014-01-11 15:25:55Z litwr $
111 */
112
113 /*
114@@ -1498,7 +1498,7 @@
115
116 /*
117  * Offsets of current tile in hold area.  The idea here is that we need to copy
118- * enough of the surrounding tiles into the hold area to do all resolution.
119+ * enough of the surrounding tiles into the hold area to do all resolution.
120  * For table-driven functions one edge row suffices; for payoff-driven
121  * functions, two edge rows/columns are needed (because we need to compute the
122  * payoffs of the inner edge cells).
123diff -urN xlife-6.7.5/gen-multirules.c xlife-6.7.6/gen-multirules.c
124--- xlife-6.7.5/gen-multirules.c	2013-03-17 19:30:44.000000000 +0400
125+++ xlife-6.7.6/gen-multirules.c	2014-01-11 13:55:41.000000000 +0400
126@@ -1,6 +1,6 @@
127 /*
128  * Multirules Generator Copyright 2013 Vladimir Lidovski vol.litwr@gmail.com
129- * $Id: gen-multirules.c 152 2013-03-17 15:30:44Z micro $
130+ * $Id: gen-multirules.c 216 2013-07-28 18:06:27Z micro $
131  *
132  * Permission to use, copy, modify, distribute, and sell this software and its
133  * documentation for any purpose is hereby granted without fee, provided that
134diff -urN xlife-6.7.5/gentab.c xlife-6.7.6/gentab.c
135--- xlife-6.7.5/gentab.c	2012-05-05 20:17:09.000000000 +0400
136+++ xlife-6.7.6/gentab.c	2014-01-11 13:55:41.000000000 +0400
137@@ -23,7 +23,7 @@
138 /*
139 A lot of modifications were added at 2011, 2012 by Vladimir Lidovski vol.litwr@gmail.com
140 (C) This version of XLife may be used under the same conditions as mentioned above
141-$Id: gentab.c 65 2012-05-05 16:17:09Z micro $
142+$Id: gentab.c 216 2013-07-28 18:06:27Z micro $
143 */
144
145 #include "defs.h"
146diff -urN xlife-6.7.5/history.c xlife-6.7.6/history.c
147--- xlife-6.7.5/history.c	2013-05-28 08:06:55.000000000 +0400
148+++ xlife-6.7.6/history.c	2014-01-11 13:55:41.000000000 +0400
149@@ -1,6 +1,6 @@
150 /*
151  * XLife Copyright 2013 Vladimir Lidovski vol.litwr@gmail.com
152- * $Id: history.c 197 2013-05-28 04:06:55Z micro $
153+ * $Id: history.c 216 2013-07-28 18:06:27Z micro $
154  *
155  * Permission to use, copy, modify, distribute, and sell this software and its
156  * documentation for any purpose is hereby granted without fee, provided that
157diff -urN xlife-6.7.5/history.h xlife-6.7.6/history.h
158--- xlife-6.7.5/history.h	2013-03-10 09:09:06.000000000 +0400
159+++ xlife-6.7.6/history.h	2014-01-11 13:55:41.000000000 +0400
160@@ -1,6 +1,6 @@
161 /*
162  * XLife Copyright 2013 Vladimir Lidovski vol.litwr@gmail.com
163- * $Id: history.h 142 2013-03-10 05:09:06Z micro $
164+ * $Id: history.h 216 2013-07-28 18:06:27Z micro $
165  *
166  * Permission to use, copy, modify, distribute, and sell this software and its
167  * documentation for any purpose is hereby granted without fee, provided that
168diff -urN xlife-6.7.5/isave.c xlife-6.7.6/isave.c
169--- xlife-6.7.5/isave.c	2013-08-01 15:56:59.000000000 +0400
170+++ xlife-6.7.6/isave.c	2014-01-12 22:06:19.000000000 +0400
171@@ -5,7 +5,7 @@
172
173 /*
174 Several modifications were added at 2011 by Vladimir Lidovski <vol.litwr@gmail.com>
175-$Id: isave.c 216 2013-07-28 18:06:27Z micro $
176+$Id: isave.c 271 2014-01-11 15:33:25Z litwr $
177 */
178
179 /* it saves pattern in I-format.
180@@ -116,7 +116,7 @@
181 		for (j = 0; j < sp->xsize; j++) {
182 		    transform(flip, rotation, j, i, tp->xsize-1, tp->ysize-1,
183 			      &newx, &newy);
184-		    if (lookcell(sp->blob, sp->blob->xmin + j, sp->blob->ymin + i)
185+		    if (lookcell(sp->blob, sp->blob->xmin + j, sp->blob->ymin + i)
186 			!= lookcell(tp->blob, tp->blob->xmin + newx, tp->blob->ymin + newy))
187 			goto nomatch;
188 		}
189diff -urN xlife-6.7.5/main.c xlife-6.7.6/main.c
190--- xlife-6.7.5/main.c	2013-10-22 22:56:19.000000000 +0400
191+++ xlife-6.7.6/main.c	2014-01-14 11:08:26.000000000 +0400
192@@ -23,9 +23,9 @@
193  */
194
195 /*
196- * A lot of modifications were added at 2001, 2011-13 by Vladimir Lidovski vol.litwr@gmail.com
197+ * A lot of modifications were added at 2001, 2011-14 by Vladimir Lidovski vol.litwr@gmail.com
198  * (C) This version of XLife may be used under the same conditions as mentioned above
199- * $Id: main.c 256 2013-10-22 19:17:22Z teacher $
200+ * $Id: main.c 279 2014-01-14 08:09:57Z litwr $
201  */
202
203 #include <X11/Xlib.h>
204@@ -71,6 +71,9 @@
205       XClearWindow(disp, lifew);
206       pivot = 0;
207       drawboundedgrid();
208+#if VFREQ != 0
209+      prev_vsync.tv_sec--;
210+#endif
211       redisplay(MESH + EXPOSE);
212    }
213    else if (win == inputw) {
214@@ -1181,6 +1184,9 @@
215         fatal("Can't open X display\n");
216     if (XDefaultDepth(disp, screen) < STATEBITS)
217         fatal("Not enough colors for compiled STATEBITS value\n");
218+#if VFREQ != 0
219+    gettimeofday(&prev_vsync, 0);
220+#endif
221     setcurdir(LIFEDIR); /*inidir*/
222     fileinit();
223     initcells(&active);
224@@ -1303,7 +1309,7 @@
225 #ifndef MICROSOFT
226                 KeyPressMask |
227 #endif
228-                 ExposureMask | StructureNotifyMask);
229+                ExposureMask | StructureNotifyMask);
230     XSelectInput(disp, inputw, ButtonPressMask | ExposureMask);
231     XSelectInput(disp, lifew, KeyPressMask | ButtonPressMask | Button1MotionMask
232        | PointerMotionMask | Button3MotionMask | ButtonReleaseMask | ExposureMask);
233diff -urN xlife-6.7.5/patchlevel.h xlife-6.7.6/patchlevel.h
234--- xlife-6.7.5/patchlevel.h	2013-10-22 12:51:32.000000000 +0400
235+++ xlife-6.7.6/patchlevel.h	2014-01-13 21:18:09.000000000 +0400
236@@ -23,9 +23,9 @@
237 /*
238  * Several modifications were added at 2011-13 by Vladimir Lidovski vol.litwr@gmail.com
239  * (C) This version of XLife may be used under the same conditions as mentioned above
240- * $Id: patchlevel.h 255 2013-10-22 09:12:33Z teacher $
241+ * $Id: patchlevel.h 278 2014-01-13 18:19:40Z litwr $
242  */
243
244 static int majorversion = 6;
245 static int minorversion = 7;
246-static int patchlevel = 5;
247+static int patchlevel = 6;
248diff -urN xlife-6.7.5/tab.h xlife-6.7.6/tab.h
249--- xlife-6.7.5/tab.h	2012-03-30 18:37:35.000000000 +0400
250+++ xlife-6.7.6/tab.h	2014-01-11 13:55:41.000000000 +0400
251@@ -23,7 +23,7 @@
252 /*
253  * Several modifications were added at 2011, 2012 by Vladimir Lidovski vol.litwr@gmail.com
254  * (C) This version of XLife may be used under the same conditions as mentioned above
255- * $Id: tab.h 43 2012-03-08 19:11:49Z micro $
256+ * $Id: tab.h 216 2013-07-28 18:06:27Z micro $
257  */
258
259 int tab1[] = {
260diff -urN xlife-6.7.5/tentative.c xlife-6.7.6/tentative.c
261--- xlife-6.7.5/tentative.c	2013-08-04 15:10:25.000000000 +0400
262+++ xlife-6.7.6/tentative.c	2014-01-11 13:55:41.000000000 +0400
263@@ -23,7 +23,7 @@
264 /*
265  * A lot of modifications were added at 2001, 2011-13 by Vladimir Lidovski vol.litwr@gmail.com
266  * (C) This version of XLife may be used under the same conditions as mentioned above
267- * $Id: tentative.c 241 2013-08-04 10:00:07Z micro $
268+ * $Id: tentative.c 245 2013-08-04 10:04:07Z teacher $
269  */
270
271 #include <stddef.h>     /* we need offsetof() */
272diff -urN xlife-6.7.5/tile.c xlife-6.7.6/tile.c
273--- xlife-6.7.5/tile.c	2013-09-29 22:21:44.000000000 +0400
274+++ xlife-6.7.6/tile.c	2014-01-14 11:08:26.000000000 +0400
275@@ -21,9 +21,9 @@
276  */
277
278 /*
279- * A lot of modifications were added at 2001, 2011-13 by Vladimir Lidovski vol.litwr@gmail.com
280+ * A lot of modifications were added at 2001, 2011-14 by Vladimir Lidovski vol.litwr@gmail.com
281  * (C) This version of XLife may be used under the same conditions as mentioned above
282- * $Id: tile.c 253 2013-09-29 18:39:43Z teacher $
283+ * $Id: tile.c 279 2014-01-14 08:09:57Z litwr $
284  */
285
286 /*
287@@ -330,6 +330,9 @@
288 }
289
290 void display_move(int force, int dx, int dy) {
291+#if VFREQ != 0
292+   prev_vsync.tv_sec--;
293+#endif
294    if ((tentative.tiles || force) && wireframe && scale == 1)
295       redraw_lifew();
296    else if ((tentative.tiles || force) && wireframe && scale > 1 && !dispmesh) {
297@@ -460,13 +463,15 @@
298 #if VFREQ == 0
299    return 1;
300 #else
301-   static struct timeval prev, cur;
302+   struct timeval cur;
303    gettimeofday(&cur, 0);
304-   if ((unsigned)((cur.tv_sec - prev.tv_sec)*1000000 + cur.tv_usec
305-                                             - prev.tv_usec) > 1000000/VFREQ) {
306-      prev = cur;
307+   if ((cur.tv_sec - prev_vsync.tv_sec)*1000000 + cur.tv_usec
308+                                        - prev_vsync.tv_usec > 1000000/VFREQ) {
309+      prev_vsync = cur;
310       return 1;
311-   }
312+   }
313+   else if (cur.tv_sec < prev_vsync.tv_sec)
314+      prev_vsync = cur;
315    return state == STOP;
316 #endif
317 }
318@@ -881,16 +886,16 @@
319  * Determine the bounding box of the live cells.
320  */
321     cellcount = bounding_box(pp);
322-    if (mode == '4') {
323+    if (mode == '4') { /* 8-bit format */
324           if (ev_mode != VALENCE_DRIVEN || (born&1) || pp->xmax - pp->xmin >= 192
325                 || pp->ymax - pp->ymin >= 192
326                 || pp->xmax - pp->xmin >= 160 && pp->ymax - pp->ymin >= 160) {
327              fprintf(stderr, "can't convert this pattern\n");
328              return;
329           }
330+          fprintf(ofp, "%c%c", pp->xmax - pp->xmin + 1, pp->ymax - pp->ymin + 1);
331           fwrite(&live, 2, 1, ofp);
332           fwrite(&born, 2, 1, ofp);
333-          fprintf(ofp, "%c%c", pp->xmax - pp->xmin + 1, pp->ymax - pp->ymin + 1);
334 	  FOR_CELLS(pp, ptr, dx, dy)
335 		if (val = getcell(&ptr->cells, dx, dy))
336 		    fprintf(ofp, "%c%c",
337diff -urN xlife-6.7.5/tile.h xlife-6.7.6/tile.h
338--- xlife-6.7.5/tile.h	2013-08-04 15:10:25.000000000 +0400
339+++ xlife-6.7.6/tile.h	2014-01-11 13:55:41.000000000 +0400
340@@ -23,7 +23,7 @@
341 /*
342  * A lot of modifications were added at 2001, 2011-13 by Vladimir Lidovski vol.litwr@gmail.com
343  * (C) This version of XLife may be used under the same conditions as mentioned above
344- * $Id: tile.h 240 2013-08-01 12:11:59Z micro $
345+ * $Id: tile.h 240 2013-08-01 12:45:59Z  $
346  */
347
348 #define XMASK 0xfffffff8
349diff -urN xlife-6.7.5/topology.h xlife-6.7.6/topology.h
350--- xlife-6.7.5/topology.h	2013-04-07 18:11:20.000000000 +0400
351+++ xlife-6.7.6/topology.h	2014-01-11 13:55:41.000000000 +0400
352@@ -1,6 +1,6 @@
353 /*
354  * XLife Copyright 2012, 2013 Vladimir Lidovski vol.litwr@gmail.com
355- * $Id: topology.h 187 2013-04-07 14:11:20Z micro $
356+ * $Id: topology.h 216 2013-07-28 18:06:27Z micro $
357  *
358  * Permission to use, copy, modify, distribute, and sell this software and its
359  * documentation for any purpose is hereby granted without fee, provided that
360diff -urN xlife-6.7.5/utils.c xlife-6.7.6/utils.c
361--- xlife-6.7.5/utils.c	2013-10-22 22:56:19.000000000 +0400
362+++ xlife-6.7.6/utils.c	2014-01-14 11:26:37.000000000 +0400
363@@ -21,15 +21,14 @@
364  */
365
366 /*
367- * A lot of modifications were added at 2001, 2011-13 by Vladimir Lidovski vol.litwr@gmail.com
368+ * A lot of modifications were added at 2001, 2011-14 by Vladimir Lidovski vol.litwr@gmail.com
369  * (C) This version of XLife may be used under the same conditions as mentioned above
370- * $Id: utils.c 241 2013-08-04 10:00:07Z micro $
371+ * $Id: utils.c 278 2014-01-13 18:19:40Z litwr $
372  */
373
374 #include <pwd.h>
375 #include <stdlib.h>
376 #include <ctype.h>
377-#include <sys/time.h>
378 #include "defs.h"
379 #include "tile.h"
380 #include "colors.h"
381@@ -56,6 +55,27 @@
382    XRaiseWindow(disp, coordw);
383 }
384
385+#ifdef MICROSOFT
386+void fatalw(const char *s) {
387+   XSelectInput(disp, mainw, KeyPressMask|ButtonPressMask|ExposureMask);
388+   XMapWindow(disp, mainw);
389+   XSetWindowBackground(disp, mainw, cellcolor[RED_EVER].pixel);
390+   XClearWindow(disp, mainw);
391+   for (;;) {
392+      XDrawString(disp, mainw, ntextgc, 10, 10, s, strlen(s));
393+      XMaskEvent(disp, KeyPressMask|ButtonPressMask|ExposureMask, &event);
394+      switch(event.type) {
395+      case ButtonPress:
396+      case KeyPress:
397+         goto finish;
398+      case Expose:;
399+      }
400+   }
401+finish:
402+   exit(22);
403+}
404+#endif
405+
406 void fatal(const char *s) {
407    fprintf(stderr, s);
408    exit(22);
409@@ -225,6 +245,7 @@
410          num++;
411    }
412    redisplay(0);
413+   displaystats();
414 }
415
416 void settimeout(unsigned long ms) {
417diff -urN xlife-6.7.5/xlife.man xlife-6.7.6/xlife.man
418--- xlife-6.7.5/xlife.man	2013-03-21 18:50:17.000000000 +0400
419+++ xlife-6.7.6/xlife.man	2014-01-11 13:55:41.000000000 +0400
420@@ -1,5 +1,5 @@
421 .TH Xlife 6
422-\" $Id: xlife.man 167 2013-03-21 14:50:17Z micro $
423+\" $Id: xlife.man 216 2013-07-28 18:06:27Z micro $
424 .SH NAME
425 Xlife \- Conway's Game of Life and other cellular automata, for X
426 .SH SYNTAX
427diff -urN xlife-6.7.5/xwidget.c xlife-6.7.6/xwidget.c
428--- xlife-6.7.5/xwidget.c	2013-08-04 15:10:25.000000000 +0400
429+++ xlife-6.7.6/xwidget.c	2014-01-12 22:06:19.000000000 +0400
430@@ -1,6 +1,6 @@
431 /*
432  * XLife Copyright 2011-13 Vladimir Lidovski vol.litwr@gmail.com
433- * $Id: xwidget.c 241 2013-08-04 10:00:07Z micro $
434+ * $Id: xwidget.c 272 2014-01-11 15:44:48Z litwr2 $
435  *
436  * Permission to use, copy, modify, distribute, and sell this software and its
437  * documentation for any purpose is hereby granted without fee, provided that
438@@ -202,9 +202,9 @@
439                                                                     strlen(p));
440       if (gc == itextgc)
441          if (strlen(widget_fn) >= LOADW_WIDTH/FONTWIDTH) {
442-	    XSetWindowBackground(disp, inputw, cellcolor[GREEN_EVER].pixel);
443+            XSetWindowBackground(disp, inputw, cellcolor[GREEN_EVER].pixel);
444             XClearWindow(disp, inputw);
445-	    XSetWindowBackground(disp, inputw, fcolor);
446+            XSetWindowBackground(disp, inputw, fcolor);
447             XDrawString(disp, inputw, ntextgc, 2, FONTHEIGHT, widget_fn,
448                                                             strlen(widget_fn));
449          }
450diff -urN xlife-6.7.5/xwidget.h xlife-6.7.6/xwidget.h
451--- xlife-6.7.5/xwidget.h	2012-05-11 16:30:21.000000000 +0400
452+++ xlife-6.7.6/xwidget.h	2014-01-11 13:55:41.000000000 +0400
453@@ -1,6 +1,6 @@
454 /*
455  * XLife Copyright 2011, 2012 Vladimir Lidovski vol.litwr@gmail.com
456- * $Id: xwidget.h 71 2012-05-11 12:30:21Z micro $
457+ * $Id: xwidget.h 216 2013-07-28 18:06:27Z micro $
458  *
459  * Permission to use, copy, modify, distribute, and sell this software and its
460  * documentation for any purpose is hereby granted without fee, provided that
461