35 # pragma warning( disable : 4127) 36 # pragma warning( disable : 4706) 70 oldsize= sizep->
i - 1;
71 if (nth < 0 || nth > oldsize) {
72 qh_fprintf(qh, qh->
qhmem.
ferr, 6171,
"qhull internal error (qh_setaddnth): nth %d is out-of-bounds for set:\n", nth);
79 for (i=oldsize-nth+1; i--; )
80 (newp--)->
p= (oldp--)->p;
107 else if (elem == newelem)
142 count= (sizep->
i)++ - 1;
144 (endp++)->p= newelem;
174 if (!(size= sizep->
i))
175 size= (*setp)->maxsize;
178 if (size + sizeA > (*setp)->maxsize) {
185 sizep->
i= size+sizeA+1;
186 memcpy((
char *)&((*setp)->e[size].p), (
char *)&(setA->
e[0].
p), (
size_t)(sizeA+1) *
SETelemsize);
216 count= (sizep->
i)++ - 1;
241 maxsize=
set->maxsize;
242 if (size > maxsize || !maxsize) {
243 qh_fprintf(qh, qh->
qhmem.
ferr, 6172,
"qhull internal error (qh_setcheck): actual size %d of %s%d is greater than max size %d\n",
244 size, tname,
id, maxsize);
246 }
else if (set->e[size].p) {
247 qh_fprintf(qh, qh->
qhmem.
ferr, 6173,
"qhull internal error (qh_setcheck): %s%d(size %d max %d) is not null terminated.\n",
248 tname,
id, size-1, maxsize);
278 void **destp, **elemp, **endp, **firstp;
283 destp= elemp= firstp=
SETaddr_(
set,
void);
286 if (!(*destp++ = *elemp++)) {
319 memcpy((
char *)&(newset->
e[0].
p), (
char *)&(set->e[0].p), (
size_t)(size+1) *
SETelemsize);
352 while (elemp->
p != oldelem && elemp->
p)
357 sizep->
i=
set->maxsize;
390 if (!
set || !(set->e[0].p))
393 if ((setsize= sizep->
i)) {
394 returnvalue=
set->e[setsize - 2].p;
395 set->e[setsize - 2].p= NULL;
398 maxsize=
set->maxsize;
399 returnvalue=
set->e[maxsize - 1].p;
400 set->e[maxsize - 1].p= NULL;
431 sizep->
i=
set->maxsize;
432 if (nth < 0 || nth >= sizep->
i) {
433 qh_fprintf(qh, qh->
qhmem.
ferr, 6174,
"qhull internal error (qh_setdelnth): nth %d is out-of-bounds for set:\n", nth);
471 if (nth < 0 || (sizep->
i && nth >= sizep->
i-1) || nth >= set->maxsize) {
472 qh_fprintf(qh, qh->
qhmem.
ferr, 6175,
"qhull internal error (qh_setdelnthsorted): nth %d is out-of-bounds for set:\n", nth);
479 while (((newp++)->p= (oldp++)->p))
482 sizep->
i= set->maxsize;
511 while(newp->
p != oldelem && newp->
p)
515 while (((newp++)->p= (oldp++)->p))
519 sizep->
i=
set->maxsize;
542 void *elem, **elemp, *newElem;
551 memcpy(newElem, elem, (
size_t)elemsize);
570 return (n ? &set->e[n-1].p : &sizep->
p);
588 void **elemAp, **elemBp;
589 int sizeA= 0, sizeB= 0;
603 if (!memcmp((
char *)elemAp, (
char *)elemBp, sizeA*
SETelemsize))
630 void **elemA, **elemB;
636 if (*elemA == skipelemA) {
641 if (*elemB == skipelemB) {
645 }
else if (*elemA != *elemB) {
647 if (!(skipelemB= *elemB++))
652 if (*elemA++ != *elemB++)
655 if (skip != 2 || *elemB)
678 void **elemA, **elemB, **skipAp, **skipBp;
691 if (*elemA++ != *elemB++)
828 if (size > set->maxsize)
831 for (i=0; i < size; i++) {
832 if (*elem++ == atelem)
857 setT *newset, *
set, **setp, *oldset;
869 memcpy((
char *)newp, (
char *)oldp, (
size_t)(size+1) *
SETelemsize);
901 return SETelem_(
set, set->maxsize - 1);
937 if (sizereceived > size)
942 set->maxsize= setsize;
943 set->e[setsize].i= 1;
970 int tailsize= size - nth -1, newsize;
973 qh_fprintf(qh, qh->
qhmem.
ferr, 6176,
"qhull internal error (qh_setnew_delnthsorted): nth %d is out-of-bounds for set:\n", nth);
977 newsize= size-1 + prepend;
981 newp=
SETaddr_(newset,
void) + prepend;
1004 memcpy((
char *)newp, (
char *)oldp, (
size_t)nth *
SETelemsize);
1032 memcpy((
char *)newp, (
char *)oldp, (
size_t)tailsize *
SETelemsize);
1053 qh_fprintf(qh, fp, 9346,
"%s set is null\n",
string);
1056 qh_fprintf(qh, fp, 9347,
"%s set=%p maxsize=%d size=%d elems=",
1057 string,
set, set->maxsize, size);
1058 if (size > set->maxsize)
1059 size=
set->maxsize+1;
1060 for (k=0; k < size; k++)
1061 qh_fprintf(qh, fp, 9348,
" %p", set->e[k].p);
1084 while (*elemp != oldelem && *elemp)
1089 qh_fprintf(qh, qh->
qhmem.
ferr, 6177,
"qhull internal error (qh_setreplace): elem %p not found in set\n",
1118 if ((size= sizep->
i)) {
1120 if (size > set->maxsize) {
1121 qh_fprintf(qh, qh->
qhmem.
ferr, 6178,
"qhull internal error (qh_setsize): current set size %d is greater than maximum size %d\n",
1122 size, set->maxsize);
1152 qh_fprintf(qh, qh->
qhmem.
ferr, 8123,
"qh_settemp: temp set %p of %d elements, depth %d\n",
1180 if (stackedset != *
set) {
1182 qh_fprintf(qh, qh->
qhmem.
ferr, 6179,
"qhull internal error (qh_settempfree): set %p(size %d) was not last temporary allocated(depth %d, set %p, size %d)\n",
1226 qh_fprintf(qh, qh->
qhmem.
ferr, 6180,
"qhull internal error (qh_settemppop): pop from empty temporary stack\n");
1230 qh_fprintf(qh, qh->
qhmem.
ferr, 8124,
"qh_settemppop: depth %d temp set %p of %d elements\n",
1249 qh_fprintf(qh, qh->
qhmem.
ferr, 6267,
"qhull error (qh_settemppush): can not push a NULL temp\n");
1254 qh_fprintf(qh, qh->
qhmem.
ferr, 8125,
"qh_settemppush: depth %d temp set %p of %d elements\n",
1277 if (size < 0 || size > set->maxsize) {
1278 qh_fprintf(qh, qh->
qhmem.
ferr, 6181,
"qhull internal error (qh_settruncate): size %d out of bounds for set:\n", size);
1282 set->e[
set->maxsize].i= size+1;
1283 set->e[size].p= NULL;
1330 if (idx < 0 || idx >= size || size > set->maxsize) {
1331 qh_fprintf(qh, qh->
qhmem.
ferr, 6182,
"qhull internal error (qh_setzero): index %d or size %d out of bounds for set:\n", idx, size);
1335 set->e[
set->maxsize].i= size+1;
1336 count= size - idx + 1;
void * qh_setdelnthsorted(qhT *qh, setT *set, int nth)
void * qh_setdelnth(qhT *qh, setT *set, int nth)
setT * qh_setnew_delnthsorted(qhT *qh, setT *set, int size, int nth, int prepend)
void qh_settruncate(qhT *qh, setT *set, int size)
void qh_settempfree(qhT *qh, setT **set)
void qh_setreplace(qhT *qh, setT *set, void *oldelem, void *newelem)
void qh_setprint(qhT *qh, FILE *fp, const char *string, setT *set)
void qh_setappend_set(qhT *qh, setT **setp, setT *setA)
void qh_errexit(qhT *qh, int exitcode, facetT *, ridgeT *)
int qh_setin(setT *set, void *setelem)
#define qh_memalloc_(insize, freelistp, object, type)
#define FOREACHelem_(set)
int qh_setequal(setT *setA, setT *setB)
void qh_setlarger(qhT *qh, setT **oldsetp)
void qh_setfree2(qhT *qh, setT **setp, int elemsize)
void qh_setappend(qhT *qh, setT **setp, void *newelem)
void qh_setaddsorted(qhT *qh, setT **setp, void *newelem)
setT * qh_settemp(qhT *qh, int setsize)
void qh_fprintf(qhT *qh, FILE *fp, int msgcode, const char *fmt,...)
void qh_settempfree_all(qhT *qh)
int qh_setequal_except(setT *setA, void *skipelemA, setT *setB, void *skipelemB)
void * qh_setlast(setT *set)
int qh_setequal_skip(setT *setA, int skipA, setT *setB, int skipB)
setT * qh_settemppop(qhT *qh)
void ** qh_setendpointer(setT *set)
#define SETelemaddr_(set, n, type)
#define SETsizeaddr_(set)
void * qh_setdelsorted(setT *set, void *oldelem)
#define SETreturnsize_(set, size)
void qh_setcompact(qhT *qh, setT *set)
#define FOREACHset_(sets)
#define qh_memfree_(object, insize, freelistp)
void qh_setcheck(qhT *qh, setT *set, const char *tname, unsigned id)
void qh_setappend2ndlast(qhT *qh, setT **setp, void *newelem)
void qh_setfree(qhT *qh, setT **setp)
setT * qh_setcopy(qhT *qh, setT *set, int extra)
void qh_memfree(void *object, int insize)
int qh_setsize(qhT *qh, setT *set)
void qh_setfreelong(qhT *qh, setT **setp)
void qh_setaddnth(qhT *qh, setT **setp, int nth, void *newelem)
void * qh_setdellast(setT *set)
void qh_settemppush(qhT *qh, setT *set)
setT * qh_setduplicate(qhT *qh, setT *set, int elemsize)
int qh_setunique(qhT *qh, setT **set, void *elem)
int qh_setindex(setT *set, void *atelem)
void * qh_memalloc(int insize)
#define SETaddr_(set, type)
setT * qh_setnew(qhT *qh, int setsize)
void qh_setzero(qhT *qh, setT *set, int idx, int size)
void * qh_setdel(setT *set, void *oldelem)