userprintf_rbox_r.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*<html><pre> -<a href="qh-user_r.htm"
  2. >-------------------------------</a><a name="TOP">-</a>
  3. userprintf_rbox_r.c
  4. user redefinable function -- qh_fprintf_rbox
  5. see README.txt see COPYING.txt for copyright information.
  6. If you recompile and load this file, then userprintf_rbox_r.o will not be loaded
  7. from qhull.a or qhull.lib
  8. See libqhull_r.h for data structures, macros, and user-callable functions.
  9. See user_r.c for qhull-related, redefinable functions
  10. see user_r.h for user-definable constants
  11. See usermem_r.c for qh_exit(), qh_free(), and qh_malloc()
  12. see Qhull.cpp and RboxPoints.cpp for examples.
  13. Please report any errors that you fix to qhull@qhull.org
  14. */
  15. #include "libqhull_r.h"
  16. #include <stdarg.h>
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. /*-<a href="qh-user_r.htm#TOC"
  20. >-------------------------------</a><a name="qh_fprintf_rbox">-</a>
  21. qh_fprintf_rbox(qh, fp, msgcode, format, list of args )
  22. print arguments to *fp according to format
  23. Use qh_fprintf_rbox() for rboxlib_r.c
  24. notes:
  25. same as fprintf()
  26. fgets() is not trapped like fprintf()
  27. exit qh_fprintf_rbox via qh_errexit_rbox()
  28. */
  29. void qh_fprintf_rbox(qhT *qh, FILE *fp, int msgcode, const char *fmt, ... ) {
  30. va_list args;
  31. if (!fp) {
  32. qh_fprintf_stderr(6231, "qhull internal error (userprintf_rbox_r.c): fp is 0. Wrong qh_fprintf_rbox called.\n");
  33. qh_errexit_rbox(qh, qh_ERRqhull);
  34. }
  35. if (msgcode >= MSG_ERROR && msgcode < MSG_STDERR)
  36. fprintf(fp, "QH%.4d ", msgcode);
  37. va_start(args, fmt);
  38. vfprintf(fp, fmt, args);
  39. va_end(args);
  40. } /* qh_fprintf_rbox */