00001 /*<html><pre> -<a href="qh-user.htm" 00002 >-------------------------------</a><a name="TOP">-</a> 00003 00004 userprintf.c 00005 qh_fprintf() 00006 00007 see README.txt see COPYING.txt for copyright information. 00008 00009 If you recompile and load this file, then userprintf.o will not be loaded 00010 from qhull.a or qhull.lib 00011 00012 See libqhull.h for data structures, macros, and user-callable functions. 00013 See user.c for qhull-related, redefinable functions 00014 see user.h for user-definable constants 00015 See usermem.c for qh_exit(), qh_free(), and qh_malloc() 00016 see Qhull.cpp and RboxPoints.cpp for examples. 00017 00018 Please report any errors that you fix to qhull@qhull.org 00019 */ 00020 00021 #include "libqhull.h" 00022 00023 #include <stdarg.h> 00024 #include <stdio.h> 00025 #include <stdlib.h> 00026 00027 /*-<a href="qh-user.htm#TOC" 00028 >-------------------------------</a><a name="qh_fprintf">-</a> 00029 00030 qh_fprintf(fp, msgcode, format, list of args ) 00031 print arguments to *fp according to format 00032 Use qh_fprintf_rbox() for rboxlib.c 00033 00034 notes: 00035 same as fprintf() 00036 fgets() is not trapped like fprintf() 00037 exit qh_fprintf via qh_errexit() 00038 */ 00039 00040 void qh_fprintf(FILE *fp, int msgcode, const char *fmt, ... ) { 00041 va_list args; 00042 00043 if (!fp) { 00044 fprintf(stderr, "QH6232 Qhull internal error (userprintf.c): fp is 0. Wrong qh_fprintf called.\n"); 00045 qh_errexit(6232, NULL, NULL); 00046 } 00047 va_start(args, fmt); 00048 #if qh_QHpointer 00049 if (qh_qh && qh ANNOTATEoutput) { 00050 #else 00051 if (qh ANNOTATEoutput) { 00052 #endif 00053 fprintf(fp, "[QH%.4d]", msgcode); 00054 }else if (msgcode >= MSG_ERROR && msgcode < MSG_STDERR ) { 00055 fprintf(fp, "QH%.4d ", msgcode); 00056 } 00057 vfprintf(fp, fmt, args); 00058 va_end(args); 00059 00060 /* Place debugging traps here. Use with option 'Tn' */ 00061 00062 } /* qh_fprintf */ 00063