1 |
– |
/* Copyright (c) 1998 Silicon Graphics, Inc. */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ SGI"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* Bundle holodeck beams together into clumps. |
6 |
|
*/ |
17 |
|
|
18 |
|
#define nextneigh() (bneighrem<=0 ? 0 : bneighlist[--bneighrem]) |
19 |
|
|
23 |
– |
static BEAMI *beamdir; |
20 |
|
|
25 |
– |
|
21 |
|
gcshifti(gc, ia, di, hp) /* shift cell row or column */ |
22 |
|
register GCOORD *gc; |
23 |
|
int ia, di; |
92 |
|
} |
93 |
|
|
94 |
|
|
95 |
< |
static int |
101 |
< |
bpcmp(b1p, b2p) /* compare beam positions on disk */ |
102 |
< |
int *b1p, *b2p; |
103 |
< |
{ |
104 |
< |
register long pdif = beamdir[*b1p].fo - beamdir[*b2p].fo; |
105 |
< |
|
106 |
< |
if (pdif > 0L) return(1); |
107 |
< |
if (pdif < 0L) return(-1); |
108 |
< |
return(0); |
109 |
< |
} |
110 |
< |
|
111 |
< |
|
112 |
< |
clumpbeams(hp, maxcnt, maxsiz, bf) /* clump beams from hinp */ |
95 |
> |
clumpbeams(hp, maxcnt, maxsiz, cf) /* clump beams from hinp */ |
96 |
|
register HOLO *hp; |
97 |
|
int maxcnt, maxsiz; |
98 |
< |
int (*bf)(); |
98 |
> |
int (*cf)(); |
99 |
|
{ |
100 |
|
static short primes[] = {9431,6803,4177,2659,1609,887,587,251,47,1}; |
118 |
– |
HDBEAMI bis; |
119 |
– |
BEAM *bp; |
101 |
|
unsigned int4 *bflags; |
102 |
|
int *bqueue; |
103 |
|
int bqlen; |
150 |
|
if (i > 0) |
151 |
|
break; |
152 |
|
} |
153 |
< |
beamdir = hp->bi; /* sort queue */ |
173 |
< |
qsort((char *)bqueue, bqlen, sizeof(*bqueue), bpcmp); |
174 |
< |
/* transfer each beam */ |
175 |
< |
for (i = 0; i < bqlen; i++) { |
176 |
< |
bp = hdgetbeam(bis.h=hp, bis.b=bqueue[i]); |
177 |
< |
(*bf)(bp, &bis); |
178 |
< |
} |
179 |
< |
hdfreebeam(NULL, 0); /* write & free clump */ |
153 |
> |
(*cf)(hp, bqueue, bqlen); /* transfer clump */ |
154 |
|
} |
155 |
< |
hdsync(NULL, 0); /* we're done -- clean up */ |
156 |
< |
free((char *)bqueue); |
157 |
< |
free((char *)bflags); |
155 |
> |
/* all done; clean up */ |
156 |
> |
free((void *)bqueue); |
157 |
> |
free((void *)bflags); |
158 |
|
} |