8 |
|
#include "holo.h" |
9 |
|
|
10 |
|
#define flgop(p,i,op) ((p)[(i)>>5] op (1L<<((i)&0x1f))) |
11 |
< |
#define isset(p,i) flgop(p,i,&) |
11 |
> |
#define issetfl(p,i) flgop(p,i,&) |
12 |
|
#define setfl(p,i) flgop(p,i,|=) |
13 |
|
#define clrfl(p,i) flgop(p,i,&=~) |
14 |
|
|
17 |
|
|
18 |
|
#define nextneigh() (bneighrem<=0 ? 0 : bneighlist[--bneighrem]) |
19 |
|
|
20 |
+ |
static void gcshifti(GCOORD *gc, int ia, int di, HOLO *hp); |
21 |
+ |
static void mkneighgrid(GCOORD ng[3*3], HOLO *hp, GCOORD *gc); |
22 |
+ |
static int firstneigh(HOLO *hp, int b); |
23 |
|
|
24 |
< |
gcshifti(gc, ia, di, hp) /* shift cell row or column */ |
25 |
< |
register GCOORD *gc; |
26 |
< |
int ia, di; |
27 |
< |
register HOLO *hp; |
24 |
> |
|
25 |
> |
|
26 |
> |
static void |
27 |
> |
gcshifti( /* shift cell row or column */ |
28 |
> |
register GCOORD *gc, |
29 |
> |
int ia, |
30 |
> |
int di, |
31 |
> |
register HOLO *hp |
32 |
> |
) |
33 |
|
{ |
34 |
|
int nw; |
35 |
|
|
51 |
|
} |
52 |
|
|
53 |
|
|
54 |
< |
mkneighgrid(ng, hp, gc) /* compute neighborhood for grid cell */ |
55 |
< |
GCOORD ng[3*3]; |
56 |
< |
HOLO *hp; |
57 |
< |
GCOORD *gc; |
54 |
> |
static void |
55 |
> |
mkneighgrid( /* compute neighborhood for grid cell */ |
56 |
> |
GCOORD ng[3*3], |
57 |
> |
HOLO *hp, |
58 |
> |
GCOORD *gc |
59 |
> |
) |
60 |
|
{ |
61 |
|
GCOORD gci0; |
62 |
|
register int i, j; |
73 |
|
|
74 |
|
|
75 |
|
static int |
76 |
< |
firstneigh(hp, b) /* initialize neighbor list and return first */ |
77 |
< |
HOLO *hp; |
78 |
< |
int b; |
76 |
> |
firstneigh( /* initialize neighbor list and return first */ |
77 |
> |
HOLO *hp, |
78 |
> |
int b |
79 |
> |
) |
80 |
|
{ |
81 |
|
GCOORD wg0[9], wg1[9], bgc[2]; |
82 |
|
int i, j; |
103 |
|
} |
104 |
|
|
105 |
|
|
106 |
< |
clumpbeams(hp, maxcnt, maxsiz, cf) /* clump beams from hinp */ |
107 |
< |
register HOLO *hp; |
108 |
< |
int maxcnt, maxsiz; |
109 |
< |
int (*cf)(); |
106 |
> |
extern void |
107 |
> |
clumpbeams( /* clump beams from hinp */ |
108 |
> |
register HOLO *hp, |
109 |
> |
int maxcnt, |
110 |
> |
int maxsiz, |
111 |
> |
int (*cf)(HOLO *hp, int *bqueue, int bqlen) |
112 |
> |
) |
113 |
|
{ |
114 |
|
static short primes[] = {9431,6803,4177,2659,1609,887,587,251,47,1}; |
115 |
|
uint32 *bflags; |
141 |
|
/* add each input beam and neighbors */ |
142 |
|
for (bc = bci = nbeams(hp); bc > 0; bc--, |
143 |
|
bci += bci>myprime ? -myprime : nbeams(hp)-myprime) { |
144 |
< |
if (isset(bflags, bci)) |
144 |
> |
if (issetfl(bflags, bci)) |
145 |
|
continue; |
146 |
|
bqueue[0] = bci; /* initialize queue */ |
147 |
|
bqlen = 1; |
152 |
|
/* add neighbors until full */ |
153 |
|
for (i = firstneigh(hp,bqueue[bqc]); i > 0; |
154 |
|
i = nextneigh()) { |
155 |
< |
if (isset(bflags, i)) /* done already? */ |
155 |
> |
if (issetfl(bflags, i)) /* done already? */ |
156 |
|
continue; |
157 |
|
bqueue[bqlen++] = i; /* add it */ |
158 |
|
bqtotal += bnrays(hp, i); |