33 void qh_fprintf(FILE *fp,
int msgcode,
const char *
fmt, ... );
35 # pragma warning( disable : 4127) 36 # pragma warning( disable : 4706) 70 oldsize= sizep->
i - 1;
71 if (nth < 0 || nth > oldsize) {
72 qh_fprintf(
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(
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(
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(
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(
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(
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(fp, 9346,
"%s set is null\n",
string);
1056 qh_fprintf(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++)
1084 while (*elemp != oldelem && *elemp)
1089 qh_fprintf(
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(
qhmem.
ferr, 6178,
"qhull internal error (qh_setsize): current set size %d is greater than maximum size %d\n",
1122 size, set->maxsize);
1180 if (stackedset != *
set) {
1182 qh_fprintf(
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(
qhmem.
ferr, 6180,
"qhull internal error (qh_settemppop): pop from empty temporary stack\n");
1277 if (size < 0 || size > set->maxsize) {
1278 qh_fprintf(
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(
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;
setT * qh_setduplicate(setT *set, int elemsize)
void qh_settempfree_all(void)
void qh_settruncate(setT *set, int size)
void qh_setappend2ndlast(setT **setp, void *newelem)
void qh_setcompact(setT *set)
void qh_setreplace(setT *set, void *oldelem, void *newelem)
void qh_setcheck(setT *set, const char *tname, unsigned id)
void qh_setaddsorted(setT **setp, void *newelem)
#define qh_memalloc_(insize, freelistp, object, type)
#define FOREACHelem_(set)
int qh_setindex(setT *set, void *atelem)
void * qh_setdelnthsorted(setT *set, int nth)
setT * qh_settemppop(void)
int qh_setin(setT *set, void *setelem)
int qh_setequal_except(setT *setA, void *skipelemA, setT *setB, void *skipelemB)
void * qh_setlast(setT *set)
void qh_settempfree(setT **set)
void qh_setappend_set(setT **setp, setT *setA)
void qh_setprint(FILE *fp, const char *string, setT *set)
#define SETelemaddr_(set, n, type)
setT * qh_setnew_delnthsorted(setT *set, int size, int nth, int prepend)
#define SETsizeaddr_(set)
void qh_fprintf(FILE *fp, int msgcode, const char *fmt,...)
void qh_settemppush(setT *set)
void * qh_setdelnth(setT *set, int nth)
void qh_setzero(setT *set, int idx, int size)
#define SETreturnsize_(set, size)
void qh_setfree(setT **setp)
#define FOREACHset_(sets)
void qh_setaddnth(setT **setp, int nth, void *newelem)
void ** qh_setendpointer(setT *set)
void qh_setappend(setT **setp, void *newelem)
#define qh_memfree_(object, insize, freelistp)
void qh_errexit(int exitcode, facetT *, ridgeT *)
void * qh_setdellast(setT *set)
void qh_memfree(void *object, int insize)
void * qh_setdelsorted(setT *set, void *oldelem)
void * qh_setdel(setT *set, void *oldelem)
int qh_setunique(setT **set, void *elem)
int qh_setequal_skip(setT *setA, int skipA, setT *setB, int skipB)
setT * qh_settemp(int setsize)
void qh_setfreelong(setT **setp)
int qh_setequal(setT *setA, setT *setB)
void * qh_memalloc(int insize)
int qh_setsize(setT *set)
setT * qh_setnew(int setsize)
void qh_setfree2(setT **setp, int elemsize)
void qh_setlarger(setT **oldsetp)
#define SETaddr_(set, type)
setT * qh_setcopy(setT *set, int extra)