userprintf_r.c
Go to the documentation of this file.
1 /*<html><pre> -<a href="qh-user_r.htm"
2  >-------------------------------</a><a name="TOP">-</a>
3 
4  userprintf_r.c
5  qh_fprintf()
6 
7  see README.txt see COPYING.txt for copyright information.
8 
9  If you recompile and load this file, then userprintf_r.o will not be loaded
10  from qhull.a or qhull.lib
11 
12  See libqhull_r.h for data structures, macros, and user-callable functions.
13  See user_r.c for qhull-related, redefinable functions
14  see user_r.h for user-definable constants
15  See usermem_r.c for qh_exit(), qh_free(), and qh_malloc()
16  see Qhull.cpp and RboxPoints.cpp for examples.
17 
18  Please report any errors that you fix to qhull@qhull.org
19 */
20 
21 #include "libqhull_r.h"
22 
23 #include <stdarg.h>
24 #include <stdio.h>
25 #include <stdlib.h>
26 
27 /*-<a href="qh-user_r.htm#TOC"
28  >-------------------------------</a><a name="qh_fprintf">-</a>
29 
30  qh_fprintf(qh, fp, msgcode, format, list of args )
31  print arguments to *fp according to format
32  Use qh_fprintf_rbox() for rboxlib_r.c
33 
34  notes:
35  same as fprintf()
36  fgets() is not trapped like fprintf()
37  exit qh_fprintf via qh_errexit()
38  may be called for errors in qh_initstatistics and qh_meminit
39 */
40 
41 void qh_fprintf(qhT *qh, FILE *fp, int msgcode, const char *fmt, ... ) {
42  va_list args;
43 
44  if (!fp) {
45  if(!qh){
46  qh_fprintf_stderr(6241, "userprintf_r.c: fp and qh not defined for qh_fprintf '%s'", fmt);
47  qh_exit(qhmem_ERRqhull); /* can not use qh_errexit() */
48  }
49  /* could use qh->qhmem.ferr, but probably better to be cautious */
50  qh_fprintf_stderr(6232, "Qhull internal error (userprintf_r.c): fp is 0. Wrong qh_fprintf called.\n");
51  qh_errexit(qh, 6232, NULL, NULL);
52  }
53  va_start(args, fmt);
54  if (qh && qh->ANNOTATEoutput) {
55  fprintf(fp, "[QH%.4d]", msgcode);
56  }else if (msgcode >= MSG_ERROR && msgcode < MSG_STDERR ) {
57  fprintf(fp, "QH%.4d ", msgcode);
58  }
59  vfprintf(fp, fmt, args);
60  va_end(args);
61 
62  /* Place debugging traps here. Use with option 'Tn' */
63 
64 } /* qh_fprintf */
65 
Definition: libqhull.h:465
void qh_fprintf_stderr(int msgcode, const char *fmt,...)
Definition: usermem.c:57
#define MSG_ERROR
Definition: user.h:74
#define qh
Definition: libqhull.h:457
#define MSG_STDERR
Definition: user.h:76
#define qhmem_ERRqhull
Definition: mem.h:63
void qh_fprintf(qhT *qh, FILE *fp, int msgcode, const char *fmt,...)
Definition: userprintf_r.c:41
void qh_exit(int exitcode)
boolT ANNOTATEoutput
Definition: libqhull.h:481
fmt
Definition: obb.py:126
void qh_errexit(int exitcode, facetT *facet, ridgeT *ridge)
Definition: user.c:213


hpp-fcl
Author(s):
autogenerated on Fri Jun 2 2023 02:39:02