|
|
1.1 root 1: #include "stdio.h"
2: #include "trace.h"
3: #include "trace.d"
4:
5: extern int level, maxlevel, maxreached;
6: struct Wheel **charriot;
7:
8: struct Spoke *
9: getspoke(avoid)
10: struct STATE *avoid;
11: { register int i, j;
12:
13: for (i = maxreached; i >= 0; i--)
14: for (j = (charriot[i]->n)-1; j >= 0; j--)
15: if (charriot[i]->spoke[j].st != avoid)
16: { charriot[i]->n = j;
17: return &(charriot[i]->spoke[j]);
18: }
19: fprintf(stderr, "level %3d, unlikely event - getspoke\n", level);
20: return NULL;
21: }
22:
23: addspoke(this, that)
24: struct STATE *this;
25: struct VISIT *that;
26: { int i = charriot[level]->n;
27:
28: if (i < NSPOKES)
29: { charriot[level]->spoke[i].st = this;
30: charriot[level]->spoke[i].vi = that;
31: charriot[level]->n++;
32: }
33: }
34:
35: inilookup()
36: { register int i;
37: char *Smalloc();
38: charriot = (struct Wheel **)
39: Smalloc(maxlevel * sizeof(struct Wheel *));
40: for (i = 0; i < maxlevel; i++)
41: { charriot[i] = (struct Wheel *)
42: Smalloc(sizeof(struct Wheel));
43: charriot[i]->n = 0;
44: }
45: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.