summaryrefslogtreecommitdiff
path: root/lib/generic.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/generic.cc')
-rw-r--r--lib/generic.cc43
1 files changed, 28 insertions, 15 deletions
diff --git a/lib/generic.cc b/lib/generic.cc
index fb55cc4..f69aba3 100644
--- a/lib/generic.cc
+++ b/lib/generic.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: generic.cc,v 1.8 2003-12-04 04:09:02 pixel Exp $ */
+/* $Id: generic.cc,v 1.9 2004-07-22 23:38:32 pixel Exp $ */
#include <stdio.h>
#include <stdarg.h>
@@ -30,46 +30,59 @@
#endif
char verbosity = 0;
-
-char * heads[] = {"EE", "--", "WW", "II"};
+static char * heads[] = {"EE", "--", "WW", "II"};
+printer_t * printer = 0;
void Base::printm(int level, const ugly_string & m, ...) {
va_list ap;
+ bool display = true;
if (verbosity < level) {
return;
}
- if (level >= 0) {
- fprintf(stderr, "(%s) ", heads[level]);
- }
+ va_start(ap, m);
+
+ if (printer)
+ display = printer->printm(level, m.p, ap);
+
+ if (display) {
+ if (level >= 0) {
+ fprintf(stderr, "(%s) ", heads[level]);
+ }
- va_start(ap, m);
#ifdef HAVE_GMP
- gmp_vfprintf(stderr, m.p, ap);
+ gmp_vfprintf(stderr, m.p, ap);
#else
- vfprintf(stderr, m.p, ap);
+ vfprintf(stderr, m.p, ap);
#endif
+ }
va_end(ap);
}
void Base::printm(int level, const char * m, ...) {
va_list ap;
+ bool display = true;
if (verbosity < level) {
return;
}
- if (level >= 0) {
- fprintf(stderr, "(%s) ", heads[level]);
- }
-
va_start(ap, m);
+ if (printer)
+ display = printer->printm(level, m, ap);
+
+ if (display) {
+ if (level >= 0) {
+ fprintf(stderr, "(%s) ", heads[level]);
+ }
+
#ifdef HAVE_GMP
- gmp_vfprintf(stderr, m, ap);
+ gmp_vfprintf(stderr, m, ap);
#else
- vfprintf(stderr, m, ap);
+ vfprintf(stderr, m, ap);
#endif
+ }
va_end(ap);
}