1 | /*<html><pre> -<a href="qh-user.htm"
|
---|
2 | >-------------------------------</a><a name="TOP">-</a>
|
---|
3 |
|
---|
4 | userprintf.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.o will not be loaded
|
---|
10 | from qhull.a or qhull.lib
|
---|
11 |
|
---|
12 | See libqhull.h for data structures, macros, and user-callable functions.
|
---|
13 | See user.c for qhull-related, redefinable functions
|
---|
14 | see user.h for user-definable constants
|
---|
15 | See usermem.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.h"
|
---|
22 |
|
---|
23 | #include <stdarg.h>
|
---|
24 | #include <stdio.h>
|
---|
25 | #include <stdlib.h>
|
---|
26 |
|
---|
27 | /*-<a href="qh-user.htm#TOC"
|
---|
28 | >-------------------------------</a><a name="qh_fprintf">-</a>
|
---|
29 |
|
---|
30 | qh_fprintf(fp, msgcode, format, list of args )
|
---|
31 | print arguments to *fp according to format
|
---|
32 | Use qh_fprintf_rbox() for rboxlib.c
|
---|
33 |
|
---|
34 | notes:
|
---|
35 | same as fprintf()
|
---|
36 | fgets() is not trapped like fprintf()
|
---|
37 | exit qh_fprintf via qh_errexit()
|
---|
38 | */
|
---|
39 |
|
---|
40 | void qh_fprintf(FILE *fp, int msgcode, const char *fmt, ... ) {
|
---|
41 | va_list args;
|
---|
42 |
|
---|
43 | if (!fp) {
|
---|
44 | fprintf(stderr, "QH6232 Qhull internal error (userprintf.c): fp is 0. Wrong qh_fprintf called.\n");
|
---|
45 | qh_errexit(6232, NULL, NULL);
|
---|
46 | }
|
---|
47 | va_start(args, fmt);
|
---|
48 | #if qh_QHpointer
|
---|
49 | if (qh_qh && qh ANNOTATEoutput) {
|
---|
50 | #else
|
---|
51 | if (qh ANNOTATEoutput) {
|
---|
52 | #endif
|
---|
53 | fprintf(fp, "[QH%.4d]", msgcode);
|
---|
54 | }else if (msgcode >= MSG_ERROR && msgcode < MSG_STDERR ) {
|
---|
55 | fprintf(fp, "QH%.4d ", msgcode);
|
---|
56 | }
|
---|
57 | vfprintf(fp, fmt, args);
|
---|
58 | va_end(args);
|
---|
59 |
|
---|
60 | /* Place debugging traps here. Use with option 'Tn' */
|
---|
61 |
|
---|
62 | } /* qh_fprintf */
|
---|
63 |
|
---|