00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef ERRCODE_H
00021 #define ERRCODE_H
00022
00023 #include "host.h"
00024
00025
00026 enum TessErrorLogCode {
00027 DBG = -1,
00028 TESSLOG = 0,
00029 TESSEXIT = 1,
00030 ABORT = 2
00031 };
00032
00033
00034 #define NO_ABORT_CODE 0
00035 #define LIST_ABORT 1
00036 #define MEMORY_ABORT 2
00037 #define FILE_ABORT 3
00038
00039
00040 #define LOC_UNUSED0 0
00041 #define LOC_UNUSED1 1
00042 #define LOC_UNUSED2 2
00043 #define LOC_INIT 3
00044 #define LOC_EDGE_PROG 4
00045 #define LOC_TEXT_ORD_ROWS 5
00046 #define LOC_TEXT_ORD_WORDS 6
00047 #define LOC_PASS1 7
00048 #define LOC_PASS2 8
00049
00050 #define LOC_FUZZY_SPACE 14
00051
00052 #define LOC_MM_ADAPT 21
00053 #define LOC_DOC_BLK_REJ 22
00054 #define LOC_WRITE_RESULTS 23
00055 #define LOC_ADAPTIVE 24
00056
00057
00058
00059 #define SUBLOC_NORM 0
00060 #define SUBLOC_FIX_XHT 3
00061
00062
00063
00064
00065 #define SUBSUBLOC_OTHER 0
00066 #define SUBSUBLOC_TESS 1
00067 #define SUBSUBLOC_NN 2
00068
00069 class DLLSYM ERRCODE {
00070 const char *message;
00071 public:
00072 void error(
00073 const char *caller,
00074 TessErrorLogCode action,
00075 const char *format, ...
00076 ) const;
00077 ERRCODE(const char *string) {
00078 message = string;
00079 }
00080 };
00081
00082 const ERRCODE ASSERT_FAILED = "Assert failed";
00083
00084 #define ASSERT_HOST(x) if (!(x)) \
00085 { \
00086 ASSERT_FAILED.error(#x,ABORT,"in file %s, line %d", \
00087 __FILE__,__LINE__); \
00088 }
00089
00090 void signal_exit(
00091 int signal_code
00092 );
00093 extern "C"
00094 {
00095 void err_exit();
00096
00097 void signal_termination_handler(int sig);
00098 };
00099
00100 void set_global_loc_code(int loc_code);
00101
00102 void set_global_subloc_code(int loc_code);
00103
00104 void set_global_subsubloc_code(int loc_code);
00105 #endif