1 #ifndef FTAERR_HPP 2 #define FTAERR_HPP 3 4 #include <corelib/ncbistl.hpp> 5 #include <stdio.h> 6 #include <stdarg.h> 7 8 USING_NCBI_SCOPE; 9 10 #ifndef THIS_MODULE 11 # define THIS_MODULE "" 12 #endif 13 14 #define PREFIX_ACCESSION 01 15 #define PREFIX_LOCUS 02 16 #define PREFIX_FEATURE 04 17 18 /* Here: LOG - for logfile, MSG - for stderr 19 */ 20 #define EO_MSG_CODES 0001 /* Show string codes gotten 21 * from .msg file */ 22 #define EO_LOG_CODES 0002 /* Show string codes gotten 23 * from .msg file */ 24 #define EO_LOGTO_USRFILE 0004 /* Has no effect */ 25 #define EO_MSG_MSGTEXT 0010 /* Has no effect */ 26 #define EO_MSG_FILELINE 0020 /* Code file name and 27 line number */ 28 #define EO_LOG_FILELINE 0040 /* Code file name and 29 line number */ 30 31 #define EO_LOG_USRFILE EO_LOGTO_USRFILE /* Has no effect */ 32 #define EO_SHOW_CODES (EO_MSG_CODES | EO_LOG_CODES) 33 #define EO_SHOW_FILELINE (EO_MSG_FILELINE | EO_LOG_FILELINE) 34 35 /* From standard C Toolkit ErrPost system: 36 * 37 #define EO_LOG_SEVERITY 0x00000001L 38 #define EO_LOG_CODES 0x00000002L 39 #define EO_LOG_FILELINE 0x00000004L 40 #define EO_LOG_USERSTR 0x00000008L 41 #define EO_LOG_ERRTEXT 0x00000010L 42 #define EO_LOG_MSGTEXT 0x00000020L 43 #define EO_MSG_SEVERITY 0x00000100L 44 #define EO_MSG_CODES 0x00000200L 45 #define EO_MSG_FILELINE 0x00000400L 46 #define EO_MSG_USERSTR 0x00000800L 47 #define EO_MSG_ERRTEXT 0x00001000L 48 #define EO_MSG_MSGTEXT 0x00002000L 49 #define EO_LOGTO_STDOUT 0x00010000L 50 #define EO_LOGTO_STDERR 0x00020000L 51 #define EO_LOGTO_TRACE 0x00040000L 52 #define EO_LOGTO_USRFILE 0x00080000L 53 #define EO_XLATE_CODES 0x01000000L 54 #define EO_WAIT_KEY 0x02000000L 55 #define EO_PROMPT_ABORT 0x04000000L 56 #define EO_BEEP 0x08000000L 57 */ 58 BEGIN_NCBI_SCOPE 59 60 enum ErrSev { 61 SEV_NONE = 0, 62 SEV_INFO, 63 SEV_WARNING, 64 SEV_ERROR, 65 SEV_REJECT, 66 SEV_FATAL, 67 SEV_MAX 68 }; 69 70 void FtaErrInit(void); 71 void FtaErrFini(void); 72 73 void ErrSetOptFlags(int flags); 74 NCBI_DEPRECATED void ErrSetFatalLevel(ErrSev sev); 75 bool ErrSetLog(const char *logfile); 76 NCBI_DEPRECATED void ErrClear(void); 77 void ErrLogPrintStr(const char *str); 78 ErrSev ErrSetLogLevel(ErrSev sev); 79 ErrSev ErrSetMessageLevel(ErrSev sev); 80 void Nlm_ErrPostEx(ErrSev sev, int lev1, int lev2, const char *fmt, ...); 81 void Nlm_ErrPostStr(ErrSev sev, int lev1, int lev2, const char *str); 82 int Nlm_ErrSetContext(const char *module, const char *fname, int line); 83 84 void FtaInstallPrefix(int prefix, const char *name, const char *location); 85 void FtaDeletePrefix(int prefix); 86 87 /* 88 #define ErrPostEx(sev, err_code, ...) \ 89 ( CNcbiDiag(DIAG_COMPILE_INFO, (EDiagSev) sev).GetRef() \ 90 << ErrCode(err_code) << FtaErrMessage(__VA_ARGS__) << Endm ) 91 */ 92 #define ErrPostEx (Nlm_ErrSetContext((const char *) THIS_MODULE, \ 93 (const char *) __FILE__, \ 94 __LINE__) ? 0 : \ 95 Nlm_ErrPostEx) 96 97 #define ErrPostStr ErrPostEx 98 99 END_NCBI_SCOPE 100 101 #endif //FTAERR_HPP 102