diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /dviware/dvi2bitmap/DviError.cc |
Initial commit
Diffstat (limited to 'dviware/dvi2bitmap/DviError.cc')
-rw-r--r-- | dviware/dvi2bitmap/DviError.cc | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/dviware/dvi2bitmap/DviError.cc b/dviware/dvi2bitmap/DviError.cc new file mode 100644 index 0000000000..ba5b126d3f --- /dev/null +++ b/dviware/dvi2bitmap/DviError.cc @@ -0,0 +1,45 @@ +/* This file is part of dvi2bitmap; see README for copyrights and licence */ + +#include <config.h> + +#ifdef HAVE_CSTD_INCLUDE +#include <cstdio> +#include <cstdarg> +#include <cstring> // for strlen +#else +#include <stdio.h> +#include <stdarg.h> +#include <string.h> +#endif +#include <string> +#include <iostream> + +#include "DviError.h" + +DviError::DviError(const char *fmt,...) +{ + char *p = new char[2*STD::strlen(fmt)]; + va_list ap; + va_start(ap,fmt); + STD::vsprintf (p, fmt, ap); + va_end(ap); + problem_ = p; + delete[] p; +} + +void DviError::print() const { + STD::cerr << "DVI error: " << problem_ << STD::endl; } +void DviBug::print() const { + STD::cerr << "BUG: " << problem_ << STD::endl; } + +DviBug::DviBug(const char *fmt,...) +{ + char *p = new char[2*STD::strlen(fmt)]; + va_list ap; + va_start(ap,fmt); + vsprintf (p, fmt, ap); + va_end(ap); + problem_ = p; + delete[] p; +} + |