5 |
|
* Routines for tracking beam compuatations |
6 |
|
*/ |
7 |
|
|
8 |
+ |
#include <string.h> |
9 |
+ |
|
10 |
|
#include "rholo.h" |
11 |
|
#include "view.h" |
12 |
|
|
90 |
|
if (b->nrm > n) { /* (re)allocate packet holder */ |
91 |
|
n = b->nrm; |
92 |
|
if (p == NULL) p = (PACKHEAD *)malloc(packsiz(n)); |
93 |
< |
else p = (PACKHEAD *)realloc((char *)p, packsiz(n)); |
93 |
> |
else p = (PACKHEAD *)realloc((void *)p, packsiz(n)); |
94 |
|
CHECK(p==NULL, SYSTEM, "out of memory in dispbeam"); |
95 |
|
} |
96 |
|
/* assign packet fields */ |
97 |
< |
bcopy((char *)hdbray(b), (char *)packra(p), b->nrm*sizeof(RAYVAL)); |
97 |
> |
memcpy((void *)packra(p), (void *)hdbray(b), b->nrm*sizeof(RAYVAL)); |
98 |
|
p->nr = p->nc = b->nrm; |
99 |
|
for (p->hd = 0; hdlist[p->hd] != hb->h; p->hd++) |
100 |
|
if (hdlist[p->hd] == NULL) |
120 |
|
/* search for common members */ |
121 |
|
for (csm = clist+nents; csm-- > clist; ) |
122 |
|
csm->nc = -1; |
123 |
< |
qsort((char *)clist, nents, sizeof(PACKHEAD), beamidcmp); |
123 |
> |
qsort((void *)clist, nents, sizeof(PACKHEAD), beamidcmp); |
124 |
|
for (i = 0; i < complen; i++) { |
125 |
< |
csm = (PACKHEAD *)bsearch((char *)(complist+i), (char *)clist, |
125 |
> |
csm = (PACKHEAD *)bsearch((void *)(complist+i), (void *)clist, |
126 |
|
nents, sizeof(PACKHEAD), beamidcmp); |
127 |
|
if (csm == NULL) |
128 |
|
continue; |
168 |
|
complist = (PACKHEAD *)malloc(nents*sizeof(PACKHEAD)); |
169 |
|
if (complist == NULL) |
170 |
|
goto memerr; |
171 |
< |
bcopy((char *)clist, (char *)complist, nents*sizeof(PACKHEAD)); |
171 |
> |
memcpy((void *)complist, (void *)clist, nents*sizeof(PACKHEAD)); |
172 |
|
break; |
173 |
|
case BS_ADD: /* add to computation set */ |
174 |
|
case BS_MAX: /* maximum of quantities */ |
176 |
|
if (nents <= 0) |
177 |
|
return; |
178 |
|
sortcomplist(); /* sort updated list & new entries */ |
179 |
< |
qsort((char *)clist, nents, sizeof(PACKHEAD), beamcmp); |
179 |
> |
qsort((void *)clist, nents, sizeof(PACKHEAD), beamcmp); |
180 |
|
/* what can't we satisfy? */ |
181 |
|
for (i = nents, csm = clist; i-- && csm->nr > csm->nc; csm++) |
182 |
|
; |
262 |
|
|
263 |
|
ambient_list() /* compute ambient beam list */ |
264 |
|
{ |
265 |
< |
int4 wtotal, minrt; |
265 |
> |
int32 wtotal, minrt; |
266 |
|
double frac; |
267 |
|
int i; |
268 |
|
register int j, k; |
389 |
|
#endif |
390 |
|
} |
391 |
|
if (lastin < 0 || listpos*4 >= complen*3) |
392 |
< |
qsort((char *)complist, complen, sizeof(PACKHEAD), beamcmp); |
392 |
> |
qsort((void *)complist, complen, sizeof(PACKHEAD), beamcmp); |
393 |
|
else if (listpos) { /* else sort and merge sublist */ |
394 |
|
list2 = (PACKHEAD *)malloc(listpos*sizeof(PACKHEAD)); |
395 |
|
CHECK(list2==NULL, SYSTEM, "out of memory in sortcomplist"); |
396 |
< |
bcopy((char *)complist,(char *)list2,listpos*sizeof(PACKHEAD)); |
397 |
< |
qsort((char *)list2, listpos, sizeof(PACKHEAD), beamcmp); |
396 |
> |
memcpy((void *)list2,(void *)complist,listpos*sizeof(PACKHEAD)); |
397 |
> |
qsort((void *)list2, listpos, sizeof(PACKHEAD), beamcmp); |
398 |
|
mergeclists(complist, list2, listpos, |
399 |
|
complist+listpos, complen-listpos); |
400 |
|
free((void *)list2); |
407 |
|
complist = NULL; |
408 |
|
complen = 0; |
409 |
|
} else if (i < complen-1) { |
410 |
< |
list2 = (PACKHEAD *)realloc((char *)complist, |
410 |
> |
list2 = (PACKHEAD *)realloc((void *)complist, |
411 |
|
(i+1)*sizeof(PACKHEAD)); |
412 |
|
if (list2 != NULL) |
413 |
|
complist = list2; |