Пример #1
0
void qh_fprintf(qhT *qh, FILE *fp, int msgcode, const char *fmt, ... ) {
    va_list args;

    if (!fp) {
        if(!qh){
            qh_fprintf_stderr(6241, "userprintf_r.c: fp and qh not defined for qh_fprintf '%s'", fmt);
            qh_exit(qhmem_ERRqhull);  /* can not use qh_errexit() */
        }
        /* could use qh->qhmem.ferr, but probably better to be cautious */
        qh_fprintf_stderr(6232, "Qhull internal error (userprintf_r.c): fp is 0.  Wrong qh_fprintf called.\n");
        qh_errexit(qh, 6232, NULL, NULL);
    }
    va_start(args, fmt);
    if (qh && qh->ANNOTATEoutput) {
      /* CHANGE TO SOURCE */
      /* fprintf(fp, "[QH%.4d]", msgcode); */
      REprintf("[QH%.4d]", msgcode);
    }else if (msgcode >= MSG_ERROR && msgcode < MSG_STDERR ) {
      /* CHANGE TO SOURCE */
      /* fprintf(fp, "QH%.4d ", msgcode); */
      REvprintf(fmt, args);
    }
    /* CHANGE TO SOURCE */
    /* vfprintf(fp, fmt, args); */
    if (fp && (fp != qh_FILEstderr)) {
        vfprintf(fp, fmt, args);
    }
    va_end(args);

    /* Place debugging traps here. Use with option 'Tn' */

} /* qh_fprintf */
Пример #2
0
void qh_fprintf_rbox(FILE *fp, int msgcode, const char *fmt, ... ) {
    va_list args;

    if (!fp) {
        qh_fprintf_stderr(6231, "Qhull internal error (userprintf_rbox.c): fp is 0.  Wrong qh_fprintf_rbox called.\n");
        qh_errexit_rbox(6231);
    }
    if (msgcode >= MSG_ERROR && msgcode < MSG_STDERR)
      fprintf(fp, "QH%.4d ", msgcode);
    va_start(args, fmt);
    vfprintf(fp, fmt, args);
    va_end(args);
} /* qh_fprintf_rbox */
Пример #3
0
/*-<a                             href="qh-mem.htm#TOC"
  >--------------------------------</a><a name="memcheck">-</a>

  qh_memcheck( )
*/
void qh_memcheck(void) {
    int i, count, totfree= 0;
    void *object;

    if (qhmem.ferr == 0 || qhmem.IStracing < 0 || qhmem.IStracing > 10 || (((qhmem.ALIGNmask+1) & qhmem.ALIGNmask) != 0)) {
        qh_fprintf_stderr(6244, "qh_memcheck error: either qhmem is overwritten or qhmem is not initialized.  Call qh_meminit() or qh_new_qhull() before calling qh_mem routines.  ferr 0x%x IsTracing %d ALIGNmask 0x%x", qhmem.ferr, qhmem.IStracing, qhmem.ALIGNmask);
        qh_exit(qhmem_ERRqhull);  /* can not use qh_errexit() */
    }
    if (qhmem.IStracing != 0)
        qh_fprintf(qhmem.ferr, 8143, "qh_memcheck: check size of freelists on qhmem\nqh_memcheck: A segmentation fault indicates an overwrite of qhmem\n");
    for (i=0; i < qhmem.TABLEsize; i++) {
        count=0;
        for (object= qhmem.freelists[i]; object; object= *((void **)object))
            count++;
        totfree += qhmem.sizetable[i] * count;
    }
    if (totfree != qhmem.totfree) {
        qh_fprintf(qhmem.ferr, 6211, "Qhull internal error (qh_memcheck): totfree %d not equal to freelist total %d\n", qhmem.totfree, totfree);
        qh_errexit(qhmem_ERRqhull, NULL, NULL);
    }
    if (qhmem.IStracing != 0)
        qh_fprintf(qhmem.ferr, 8144, "qh_memcheck: total size of freelists totfree is the same as qhmem.totfree\n", totfree);
} /* memcheck */
Пример #4
0
void qh_fprintf(FILE *fp, int msgcode, const char *fmt, ... ) {
    va_list args;

    if (!fp) {
        /* could use qhmem.ferr, but probably better to be cautious */
        qh_fprintf_stderr(6232, "Qhull internal error (userprintf.c): fp is 0.  Wrong qh_fprintf called.\n");
        qh_errexit(6232, NULL, NULL);
    }
    va_start(args, fmt);
#if qh_QHpointer
    if (qh_qh && qh ANNOTATEoutput) {
#else
    if (qh ANNOTATEoutput) {
#endif
      fprintf(fp, "[QH%.4d]", msgcode);
    }else if (msgcode >= MSG_ERROR && msgcode < MSG_STDERR ) {
      fprintf(fp, "QH%.4d ", msgcode);
    }
    vfprintf(fp, fmt, args);
    va_end(args);

    /* Place debugging traps here. Use with option 'Tn' */

} /* qh_fprintf */