www.pudn.com > xvoice-0.8.1.rar > Error.h
#ifndef _ERROR_H #define _ERROR_H #include "MainWin.h" #includeclass fstring : public string // error reporting { public: void appendf(const char*, ...); void vappendf(const char* fmt, va_list ap); fstring() {}; fstring(const char *s) : string(s){}; fstring(size_type n, char c) : string(n,c){}; }; enum { /* * Due to missing files, bad syntax or environment variables etc. We * try to handle these gracefully. */ E_CONFIG, /* * Probably due to XVoice bugs, e.g. trying to enable the same * vocabulary twice. Probably not recoverable. */ E_SEVERE, /* * Outside of our control, e.g. memory or voice engine. Not * recoverable. */ E_FATAL }; /* * macro varargs are not portable, but they should be. * the alternatives are ugly. */ #define LogMessage(sev, fmt, args...) do { \ fprintf(stderr, "%s: ", __FUNCTION__);\ fprintf(stderr , fmt , ## args); \ gMainWin->errorMsg(sev, __FUNCTION__ , fmt , ## args); \ } while (0) #ifdef DEBUG #define dbgprintf(x) do { \ printf("%s: ", __FUNCTION__);\ printf ## x ;\ } while (0); #else #define dbgprintf(x) #endif #endif /* _ERROR_H */