1 |
< |
/* Copyright (c) 1997 Silicon Graphics, Inc. */ |
1 |
> |
/* Copyright (c) 1998 Silicon Graphics, Inc. */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ SGI"; |
11 |
|
#include "rholo.h" |
12 |
|
#include "rhdisp.h" |
13 |
|
#include "rhdriver.h" |
14 |
+ |
#include "random.h" |
15 |
|
|
16 |
< |
extern int *getviewcells(); |
16 |
> |
#ifndef MAXDIST |
17 |
> |
#define MAXDIST 42 /* maximum distance outside section */ |
18 |
> |
#endif |
19 |
> |
#ifndef NVSAMPS |
20 |
> |
#define NVSAMPS 4096 /* number of ray samples per view */ |
21 |
> |
#endif |
22 |
|
|
23 |
< |
typedef struct { |
24 |
< |
int hd; /* holodeck section number (-1 if inactive) */ |
19 |
< |
int i[3]; /* voxel index (may be outside section) */ |
20 |
< |
} VOXL; /* a voxel */ |
23 |
> |
#define MAXTODO 3 /* maximum sections to look at */ |
24 |
> |
#define MAXDRAT 3.0 /* maximum distance ratio */ |
25 |
|
|
22 |
– |
static VOXL voxel[8] = { /* current voxel list */ |
23 |
– |
{-1}, {-1}, {-1}, {-1}, |
24 |
– |
{-1}, {-1}, {-1}, {-1} |
25 |
– |
}; |
26 |
– |
|
26 |
|
#define CBEAMBLK 1024 /* cbeam allocation block size */ |
27 |
|
|
28 |
|
static struct beamcomp { |
29 |
< |
short wants; /* flags telling which voxels want us */ |
31 |
< |
short hd; /* holodeck section number */ |
29 |
> |
int hd; /* holodeck section number */ |
30 |
|
int bi; /* beam index */ |
31 |
+ |
int4 nr; /* number of samples desired */ |
32 |
|
} *cbeam = NULL; /* current beam list */ |
33 |
|
|
34 |
|
static int ncbeams = 0; /* number of sorted beams in cbeam */ |
35 |
|
static int xcbeams = 0; /* extra (unregistered) beams past ncbeams */ |
36 |
|
static int maxcbeam = 0; /* size of cbeam array */ |
37 |
|
|
39 |
– |
struct cellact { |
40 |
– |
short vi; /* voxel index */ |
41 |
– |
short add; /* zero means delete */ |
42 |
– |
}; /* action for cell */ |
38 |
|
|
44 |
– |
struct beamact { |
45 |
– |
struct cellact ca; /* cell action */ |
46 |
– |
GCOORD gc; /* grid coordinate */ |
47 |
– |
}; /* beam origin and action */ |
48 |
– |
|
49 |
– |
|
39 |
|
int |
40 |
|
newcbeam() /* allocate new entry at end of cbeam array */ |
41 |
|
{ |
74 |
|
{ |
75 |
|
register int c; |
76 |
|
|
77 |
< |
if (!cb1->wants) /* put orphans at the end, unsorted */ |
78 |
< |
return(cb2->wants); |
77 |
> |
if (!cb1->nr) /* put orphans at the end, unsorted */ |
78 |
> |
return(cb2->nr); |
79 |
> |
if (!cb2->nr) |
80 |
> |
return(-1); |
81 |
|
if ((c = cb1->bi - cb2->bi)) /* sort on beam index first */ |
82 |
|
return(c); |
83 |
|
return(cb1->hd - cb2->hd); /* use hd to resolve matches */ |
93 |
|
|
94 |
|
if (ncbeams <= 0) |
95 |
|
return(-1); |
96 |
< |
cb.wants = 0; cb.hd = hd; cb.bi = bi; |
96 |
> |
cb.hd = hd; cb.bi = bi; cb.nr = 0; |
97 |
|
p = (struct beamcomp *)bsearch((char *)&cb, (char *)cbeam, ncbeams, |
98 |
|
sizeof(struct beamcomp), cbeamcmp); |
99 |
|
if (p == NULL) |
121 |
|
if (bi < 1 | bi > nbeams(hdlist[hd])) |
122 |
|
error(INTERNAL, "illegal beam index in getcbeam"); |
123 |
|
n = newcbeam(); /* allocate and assign */ |
124 |
< |
cbeam[n].wants = 0; cbeam[n].hd = hd; cbeam[n].bi = bi; |
124 |
> |
cbeam[n].nr = 0; cbeam[n].hd = hd; cbeam[n].bi = bi; |
125 |
|
return(n); |
126 |
|
} |
127 |
|
|
139 |
|
if (adopt) |
140 |
|
return; |
141 |
|
for (i = ncbeams; i--; ) /* identify orphans */ |
142 |
< |
if (cbeam[i].wants) |
142 |
> |
if (cbeam[i].nr) |
143 |
|
break; |
144 |
|
xcbeams = ncbeams - ++i; /* put orphans after ncbeams */ |
145 |
|
ncbeams = i; |
146 |
|
} |
147 |
|
|
148 |
|
|
149 |
< |
cbeamadd(bl, n, v, hr, vr) /* add beams to server list */ |
149 |
> |
cbeamop(op, bl, n) /* update beams on server list */ |
150 |
> |
int op; |
151 |
|
register struct beamcomp *bl; |
152 |
|
int n; |
161 |
– |
VIEW *v; |
162 |
– |
int hr, vr; |
153 |
|
{ |
154 |
|
register PACKHEAD *pa; |
155 |
|
register int i; |
158 |
|
return; |
159 |
|
pa = (PACKHEAD *)malloc(n*sizeof(PACKHEAD)); |
160 |
|
if (pa == NULL) |
161 |
< |
error(SYSTEM, "out of memory in cbeamadd"); |
172 |
< |
for (i = 0; i < n; i++) |
173 |
< |
pa[i].nr = npixels(v, hr, vr, |
174 |
< |
hdlist[pa[i].hd=bl[i].hd], |
175 |
< |
pa[i].bi=bl[i].bi) / 8; |
176 |
< |
|
177 |
< |
serv_request(DR_ADDSET, n*sizeof(PACKHEAD), (char *)pa); |
178 |
< |
free((char *)pa); |
179 |
< |
} |
180 |
< |
|
181 |
< |
|
182 |
< |
cbeamdel(bl, n) /* delete unwanted beam requests */ |
183 |
< |
register struct beamcomp *bl; |
184 |
< |
int n; |
185 |
< |
{ |
186 |
< |
register PACKHEAD *pa; |
187 |
< |
register int i; |
188 |
< |
|
189 |
< |
if (n <= 0) |
190 |
< |
return; |
191 |
< |
pa = (PACKHEAD *)malloc(n*sizeof(PACKHEAD)); |
192 |
< |
if (pa == NULL) |
193 |
< |
error(SYSTEM, "out of memory in cbeamdel"); |
161 |
> |
error(SYSTEM, "out of memory in cbeamop"); |
162 |
|
for (i = 0; i < n; i++) { |
163 |
|
pa[i].hd = bl[i].hd; |
164 |
|
pa[i].bi = bl[i].bi; |
165 |
< |
pa[i].nr = 0; /* removes any request */ |
165 |
> |
pa[i].nr = bl[i].nr; |
166 |
> |
pa[i].nc = 0; |
167 |
|
} |
168 |
< |
serv_request(DR_DELSET, n*sizeof(PACKHEAD), (char *)pa); |
168 |
> |
serv_request(op, n*sizeof(PACKHEAD), (char *)pa); |
169 |
|
free((char *)pa); |
170 |
|
} |
171 |
|
|
172 |
|
|
173 |
|
int |
174 |
< |
set_voxels(vl, n) /* set new voxel array */ |
175 |
< |
VOXL vl[8]; |
176 |
< |
int n; |
174 |
> |
comptodo(tdl, vw) /* compute holodeck sections in view */ |
175 |
> |
int tdl[MAXTODO+1]; |
176 |
> |
VIEW *vw; |
177 |
|
{ |
209 |
– |
short wmap[256]; |
210 |
– |
int vmap[8]; |
211 |
– |
int comn = 0; |
212 |
– |
int no; |
213 |
– |
register int i, j; |
214 |
– |
/* find common voxels */ |
215 |
– |
for (j = 0; j < 8 && voxel[j].hd >= 0; j++) { |
216 |
– |
vmap[j] = -1; |
217 |
– |
for (i = n; i--; ) |
218 |
– |
if (!bcmp((char *)(vl+i), (char *)(voxel+j), |
219 |
– |
sizeof(VOXL))) { |
220 |
– |
vmap[j] = i; |
221 |
– |
comn |= 1<<i; |
222 |
– |
break; |
223 |
– |
} |
224 |
– |
} |
225 |
– |
no = comn ? j : 0; /* compute flag mapping */ |
226 |
– |
for (i = 256; i--; ) { |
227 |
– |
wmap[i] = 0; |
228 |
– |
for (j = no; j--; ) |
229 |
– |
if (vmap[j] >= 0 && i & 1<<j) |
230 |
– |
wmap[i] |= 1<<vmap[j]; |
231 |
– |
} |
232 |
– |
/* fix cbeam flags */ |
233 |
– |
for (i = ncbeams; i--; ) |
234 |
– |
cbeam[i].wants = wmap[cbeam[i].wants]; |
235 |
– |
/* update our voxel list */ |
236 |
– |
bcopy((char *)vl, (char *)voxel, n*sizeof(VOXL)); |
237 |
– |
for (j = n; j < 8; j++) |
238 |
– |
voxel[j].hd = -1; |
239 |
– |
return(comn); /* return bit array of common voxels */ |
240 |
– |
} |
241 |
– |
|
242 |
– |
|
243 |
– |
int |
244 |
– |
get_voxels(vl, vp) /* find voxels corresponding to view point */ |
245 |
– |
VOXL vl[8]; |
246 |
– |
FVECT vp; |
247 |
– |
{ |
178 |
|
int n = 0; |
179 |
< |
FVECT gp; |
180 |
< |
double d; |
181 |
< |
int dist, bestd = 0x7fff; |
182 |
< |
VOXL vox; |
183 |
< |
register int i, j, k; |
184 |
< |
/* find closest voxels */ |
185 |
< |
for (i = 0; n < 8 && hdlist[i]; i++) { |
186 |
< |
hdgrid(gp, hdlist[i], vp); |
187 |
< |
for (j = 0; n < 8 && j < 8; j++) { |
188 |
< |
dist = 0; |
189 |
< |
for (k = 0; k < 3; k++) { |
190 |
< |
d = gp[k] - .5 + (j>>k & 1); |
191 |
< |
if (d < 0.) |
192 |
< |
dist += -(vox.i[k] = (int)d - 1); |
193 |
< |
else if ((vox.i[k] = d) >= hdlist[i]->grid[k]) |
194 |
< |
dist += vox.i[k] - |
195 |
< |
hdlist[i]->grid[k] + 1; |
266 |
< |
} |
267 |
< |
if (dist > bestd) /* others were closer */ |
268 |
< |
continue; |
269 |
< |
if (dist < bestd) { /* start closer list */ |
270 |
< |
n = 0; |
271 |
< |
bestd = dist; |
272 |
< |
} |
273 |
< |
vox.hd = i; /* add this voxel */ |
274 |
< |
copystruct(&vl[n], &vox); |
275 |
< |
n++; |
179 |
> |
FVECT gp, dv; |
180 |
> |
double dist2[MAXTODO+1], thisdist2; |
181 |
> |
register int i, j; |
182 |
> |
/* find closest MAXTODO sections */ |
183 |
> |
for (i = 0; hdlist[i]; i++) { |
184 |
> |
hdgrid(gp, hdlist[i], vw->vp); |
185 |
> |
for (j = 0; j < 3; j++) |
186 |
> |
if (gp[j] < 0.) |
187 |
> |
dv[j] = -gp[j]; |
188 |
> |
else if (gp[j] > hdlist[i]->grid[j]) |
189 |
> |
dv[j] = gp[j] - hdlist[i]->grid[j]; |
190 |
> |
else |
191 |
> |
dv[j] = 0.; |
192 |
> |
thisdist2 = DOT(dv,dv); |
193 |
> |
for (j = n; j > 0 && thisdist2 < dist2[j-1]; j--) { |
194 |
> |
tdl[j] = tdl[j-1]; |
195 |
> |
dist2[j] = dist2[j-1]; |
196 |
|
} |
197 |
+ |
tdl[j] = i; |
198 |
+ |
dist2[j] = thisdist2; |
199 |
+ |
if (n < MAXTODO) |
200 |
+ |
n++; |
201 |
|
} |
202 |
+ |
/* watch for bad move */ |
203 |
+ |
if (n && dist2[0] > MAXDIST*MAXDIST) { |
204 |
+ |
error(COMMAND, "move past outer limits"); |
205 |
+ |
return(0); |
206 |
+ |
} |
207 |
+ |
/* avoid big differences */ |
208 |
+ |
for (j = 1; j < n; j++) |
209 |
+ |
if (dist2[j] > MAXDRAT*MAXDRAT*dist2[j-1]) |
210 |
+ |
n = j; |
211 |
+ |
tdl[n] = -1; |
212 |
|
return(n); |
213 |
|
} |
214 |
|
|
215 |
|
|
216 |
< |
int |
217 |
< |
dobeam(gcp, bp) /* express interest or disintrest in a beam */ |
218 |
< |
GCOORD *gcp; |
219 |
< |
register struct beamact *bp; |
216 |
> |
addview(hd, vw, hres, vres) /* add view for section */ |
217 |
> |
int hd; |
218 |
> |
VIEW *vw; |
219 |
> |
int hres, vres; |
220 |
|
{ |
221 |
+ |
int sampquant; |
222 |
+ |
int h, v, shr, svr; |
223 |
|
GCOORD gc[2]; |
224 |
< |
int bi, i; |
225 |
< |
/* compute beam index */ |
226 |
< |
copystruct(gc, gcp); |
227 |
< |
copystruct(gc+1, &bp->gc); |
228 |
< |
if ((bi = hdbindex(hdlist[voxel[bp->ca.vi].hd], gc)) <= 0) |
229 |
< |
error(CONSISTENCY, "bad grid coordinate in dobeam"); |
230 |
< |
if (bp->ca.add) { /* add it in */ |
231 |
< |
i = getcbeam(voxel[bp->ca.vi].hd, bi); |
232 |
< |
cbeam[i].wants |= 1<<bp->ca.vi; /* say we want it */ |
297 |
< |
return(i == ncbeams+xcbeams-1); /* return 1 if totally new */ |
224 |
> |
FVECT rorg, rdir; |
225 |
> |
/* compute sampling grid */ |
226 |
> |
if (hres|vres && hres*vres <= NVSAMPS) { |
227 |
> |
shr = hres; svr = vres; |
228 |
> |
sampquant = 1; |
229 |
> |
} else { |
230 |
> |
shr = sqrt(NVSAMPS/viewaspect(vw)) + .5; |
231 |
> |
svr = (NVSAMPS + shr/2)/shr; |
232 |
> |
sampquant = (hres*vres + shr*svr/2)/(shr*svr); |
233 |
|
} |
234 |
< |
/* else delete it */ |
235 |
< |
i = findcbeam(voxel[bp->ca.vi].hd, bi); |
236 |
< |
if (i >= 0 && cbeam[i].wants & 1<<bp->ca.vi) { |
237 |
< |
cbeam[i].wants &= ~(1<<bp->ca.vi); /* we don't want it */ |
238 |
< |
return(1); /* indicate change */ |
239 |
< |
} |
240 |
< |
return(0); |
234 |
> |
/* intersect sample rays with section */ |
235 |
> |
for (v = svr; v--; ) |
236 |
> |
for (h = shr; h--; ) { |
237 |
> |
if (viewray(rorg, rdir, vw, (v+frandom())/svr, |
238 |
> |
(h+frandom())/shr) < -FTINY) |
239 |
> |
continue; |
240 |
> |
if (hdinter(gc, NULL, NULL, hdlist[hd], rorg, rdir) |
241 |
> |
>= FHUGE) |
242 |
> |
continue; |
243 |
> |
cbeam[getcbeam(hd,hdbindex(hdlist[hd],gc))].nr += |
244 |
> |
sampquant; |
245 |
> |
} |
246 |
|
} |
247 |
|
|
248 |
|
|
249 |
< |
|
250 |
< |
int |
311 |
< |
docell(gcp, cap) /* find beams corresponding to cell and voxel */ |
312 |
< |
GCOORD *gcp; |
313 |
< |
register struct cellact *cap; |
249 |
> |
beam_init(fresh) /* clear beam list for new view(s) */ |
250 |
> |
int fresh; |
251 |
|
{ |
315 |
– |
FVECT org, dir[4]; |
316 |
– |
FVECT gp, cv[4], vc; |
317 |
– |
struct beamact bo; |
252 |
|
register int i; |
319 |
– |
/* compute cell vertices */ |
320 |
– |
hdcell(cv, hdlist[voxel[cap->vi].hd], gcp); |
321 |
– |
/* compute cell and voxel centers */ |
322 |
– |
for (i = 0; i < 3; i++) { |
323 |
– |
org[i] = 0.5*(cv[0][i] + cv[2][i]); |
324 |
– |
gp[i] = voxel[cap->vi].i[i] + 0.5; |
325 |
– |
} |
326 |
– |
hdworld(vc, hdlist[voxel[cap->vi].hd], gp); |
327 |
– |
/* compute voxel pyramid using vector trick */ |
328 |
– |
for (i = 0; i < 3; i++) { |
329 |
– |
dir[0][i] = vc[i] - cv[0][i]; /* to 3 */ |
330 |
– |
dir[2][i] = vc[i] - cv[3][i]; /* to 0 */ |
331 |
– |
if (gcp->w & 1) { /* watch vertex order! */ |
332 |
– |
dir[1][i] = vc[i] - cv[2][i]; /* to 1 */ |
333 |
– |
dir[3][i] = vc[i] - cv[1][i]; /* to 2 */ |
334 |
– |
} else { |
335 |
– |
dir[1][i] = vc[i] - cv[1][i]; /* to 2 */ |
336 |
– |
dir[3][i] = vc[i] - cv[2][i]; /* to 1 */ |
337 |
– |
} |
338 |
– |
} |
339 |
– |
/* visit beams for opposite cells */ |
340 |
– |
copystruct(&bo.ca, cap); |
341 |
– |
copystruct(&bo.gc, gcp); |
342 |
– |
return(visit_cells(org, dir, hdlist[voxel[cap->vi].hd], dobeam, &bo)); |
343 |
– |
} |
253 |
|
|
254 |
< |
|
255 |
< |
int |
256 |
< |
doview(cap, vp) /* visit cells for a given view */ |
257 |
< |
struct cellact *cap; |
258 |
< |
VIEW *vp; |
350 |
< |
{ |
351 |
< |
FVECT org, dir[4]; |
352 |
< |
/* compute view pyramid */ |
353 |
< |
if (vp->type == VT_PAR) goto viewerr; |
354 |
< |
if (viewray(org, dir[0], vp, 0., 0.) < -FTINY) goto viewerr; |
355 |
< |
if (viewray(org, dir[1], vp, 0., 1.) < -FTINY) goto viewerr; |
356 |
< |
if (viewray(org, dir[2], vp, 1., 1.) < -FTINY) goto viewerr; |
357 |
< |
if (viewray(org, dir[3], vp, 1., 0.) < -FTINY) goto viewerr; |
358 |
< |
/* visit cells within pyramid */ |
359 |
< |
return(visit_cells(org, dir, hdlist[voxel[cap->vi].hd], docell, cap)); |
360 |
< |
viewerr: |
361 |
< |
error(INTERNAL, "unusable view in doview"); |
254 |
> |
if (fresh) /* discard old beams? */ |
255 |
> |
ncbeams = xcbeams = 0; |
256 |
> |
else /* else clear sample requests */ |
257 |
> |
for (i = ncbeams+xcbeams; i--; ) |
258 |
> |
cbeam[i].nr = 0; |
259 |
|
} |
260 |
|
|
261 |
|
|
262 |
< |
mvview(voxi, vold, vnew) /* move view for a voxel */ |
263 |
< |
int voxi; |
264 |
< |
VIEW *vold, *vnew; |
262 |
> |
beam_view(vn, hr, vr) /* add beam view (if advisable) */ |
263 |
> |
VIEW *vn; |
264 |
> |
int hr, vr; |
265 |
|
{ |
266 |
< |
int netchange = 0; |
267 |
< |
int *ocl, *ncl; |
268 |
< |
struct cellact ca; |
269 |
< |
int ocnt, ncnt; |
270 |
< |
int c; |
271 |
< |
register GCOORD *ogcp, *ngcp; |
272 |
< |
/* get old and new cell lists */ |
273 |
< |
ocl = getviewcells(hdlist[voxel[voxi].hd], vold); |
274 |
< |
ncl = getviewcells(hdlist[voxel[voxi].hd], vnew); |
275 |
< |
if (ocl != NULL) { |
379 |
< |
ocnt = *ocl; ogcp = (GCOORD *)(ocl+1); |
380 |
< |
} else { |
381 |
< |
ocnt = 0; ogcp = NULL; |
382 |
< |
} |
383 |
< |
if (ncl != NULL) { |
384 |
< |
ncnt = *ncl; ngcp = (GCOORD *)(ncl+1); |
385 |
< |
} else { |
386 |
< |
ncnt = 0; ngcp = NULL; |
387 |
< |
} |
388 |
< |
ca.vi = voxi; /* add and delete cells */ |
389 |
< |
while (ocnt > 0 & ncnt > 0) |
390 |
< |
if ((c = cellcmp(ogcp, ngcp)) > 0) { |
391 |
< |
ca.add = 1; /* new cell */ |
392 |
< |
netchange += docell(ngcp++, &ca); |
393 |
< |
ncnt--; |
394 |
< |
} else if (c < 0) { |
395 |
< |
ca.add = 0; /* obsolete cell */ |
396 |
< |
netchange -= docell(ogcp++, &ca); |
397 |
< |
ocnt--; |
398 |
< |
} else { |
399 |
< |
ogcp++; ocnt--; /* unchanged cell */ |
400 |
< |
ngcp++; ncnt--; |
401 |
< |
} |
402 |
< |
/* take care of list tails */ |
403 |
< |
for (ca.add = 1; ncnt > 0; ncnt--) |
404 |
< |
netchange += docell(ngcp++, &ca); |
405 |
< |
for (ca.add = 0; ocnt > 0; ocnt--) |
406 |
< |
netchange -= docell(ogcp++, &ca); |
407 |
< |
/* clean up */ |
408 |
< |
if (ocl != NULL) free((char *)ocl); |
409 |
< |
if (ncl != NULL) free((char *)ncl); |
410 |
< |
return(netchange); |
266 |
> |
int todo[MAXTODO+1]; |
267 |
> |
int n; |
268 |
> |
/* sort our list */ |
269 |
> |
cbeamsort(1); |
270 |
> |
/* add view to nearby sections */ |
271 |
> |
if (!(n = comptodo(todo, vn))) |
272 |
> |
return(0); |
273 |
> |
while (n--) |
274 |
> |
addview(todo[n], vn, hr, vr); |
275 |
> |
return(1); |
276 |
|
} |
277 |
|
|
278 |
|
|
279 |
< |
beam_view(vo, vn) /* change beam view */ |
280 |
< |
VIEW *vo, *vn; |
279 |
> |
int |
280 |
> |
beam_sync(all) /* update beam list on server */ |
281 |
> |
int all; |
282 |
|
{ |
283 |
< |
struct cellact ca; |
284 |
< |
VOXL vlnew[8]; |
285 |
< |
int n, comn; |
286 |
< |
|
287 |
< |
if (!vn->type) { /* clear our beam list */ |
288 |
< |
set_voxels(vlnew, 0); |
423 |
< |
cbeamdel(cbeam, ncbeams); |
424 |
< |
ncbeams = 0; |
425 |
< |
return; |
426 |
< |
} |
427 |
< |
/* find our new voxels */ |
428 |
< |
n = get_voxels(vlnew, vn->vp); |
429 |
< |
/* set the new voxels */ |
430 |
< |
comn = set_voxels(vlnew, n); |
431 |
< |
if (!vo->type) |
432 |
< |
comn = 0; |
433 |
< |
ca.add = 1; /* update our beam list */ |
434 |
< |
for (ca.vi = n; ca.vi--; ) |
435 |
< |
if (comn & 1<<ca.vi) /* change which cells we see */ |
436 |
< |
mvview(ca.vi, vo, vn); |
437 |
< |
else /* else add all new cells */ |
438 |
< |
doview(&ca, vn); |
439 |
< |
/* inform server of new beams */ |
440 |
< |
cbeamadd(cbeam+ncbeams, xcbeams, vn, odev.hres, odev.vres); |
441 |
< |
/* sort list to put orphans at end */ |
442 |
< |
cbeamsort(0); |
443 |
< |
/* tell server to delete orphans */ |
444 |
< |
cbeamdel(cbeam+ncbeams, xcbeams); |
283 |
> |
/* sort list (put orphans at end) */ |
284 |
> |
cbeamsort(all < 0); |
285 |
> |
if (all) |
286 |
> |
cbeamop(DR_NEWSET, cbeam, ncbeams); |
287 |
> |
else |
288 |
> |
cbeamop(DR_ADJSET, cbeam, ncbeams+xcbeams); |
289 |
|
xcbeams = 0; /* truncate our list */ |
290 |
+ |
return(ncbeams); |
291 |
|
} |