Add to git.
[dlife.git] / state.h
1 /* DLIFE Copyright (C) 2000 Richard W.M. Jones <rich@annexia.org>
2  * and other authors listed in the ``AUTHORS'' file.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17  *
18  * $Id: state.h,v 1.1 2002/04/05 14:40:28 rich Exp $
19  */
20
21 #ifndef state_h
22 #define state_h
23
24 #include "dlink.h"
25 #include "types.h"
26
27 struct state
28 {
29   /* The number of cycles we have been running for. */
30   unsigned long long cell_cycle;
31
32   /* The number of cells alive (running and on the alive list). */
33   int nr_cells_alive;
34
35   /* The number of cells allocated (alive + undivided daughters). */
36   int nr_cells_allocated;
37
38   /* The list of cells currently alive (running). Some cells may also
39    * exist in an undivided state.
40    */
41   dlink_list_t alive_list;
42
43   /* The same list of cells, kept in order of best (fewest errors) to
44    * worse (most errors). This allows the grim reaper to quickly remove
45    * dying cells.
46    */
47   dlink_list_t best_list;
48
49   /* The soup. */
50   byte_t *soup;
51
52   /* Number of bytes in soup, and number of bytes free in soup. */
53   int soup_size;
54   int soup_free;
55
56   /* Filename of the soup image (for this thread). */
57   char *filename;
58
59   /* Thread number (first thread is number 0). */
60   int thread_num;
61 };
62
63 extern struct state *state_malloc (int _soup_size, int thread_num);
64 extern void state_free (struct state *);
65
66 #endif /* state_h */