ccutil/errcode.h

Go to the documentation of this file.
00001 
00020 #ifndef           ERRCODE_H
00021 #define           ERRCODE_H
00022 
00023 #include          "host.h"
00024 
00025 /*Control parameters for error()*/
00026 #define DBG         -1           /*log without alert */
00027 #define LOG         0            /*alert user */
00028 #define EXIT        1            /*exit after erro */
00029 #define ABORT       2            /*abort after error */
00030 
00031 /* Explicit Error Abort codes */
00032 #define NO_ABORT_CODE      0
00033 #define LIST_ABORT      1
00034 #define MEMORY_ABORT    2
00035 #define FILE_ABORT      3
00036 
00037 /* Location of code at error codes Reserve 0..2 (status codes 0..23 for UNLV)*/
00038 #define LOC_UNUSED0        0
00039 #define LOC_UNUSED1        1
00040 #define LOC_UNUSED2        2
00041 #define LOC_INIT      3
00042 #define LOC_EDGE_PROG   4
00043 #define LOC_TEXT_ORD_ROWS 5
00044 #define LOC_TEXT_ORD_WORDS  6
00045 #define LOC_PASS1     7
00046 #define LOC_PASS2     8
00047 /* Reserve up to 8..13 for adding subloc 0/3 plus subsubloc 0/1/2 */
00048 #define LOC_FUZZY_SPACE   14
00049 /* Reserve up to 14..20 for adding subloc 0/3 plus subsubloc 0/1/2 */
00050 #define LOC_MM_ADAPT    21
00051 #define LOC_DOC_BLK_REJ   22
00052 #define LOC_WRITE_RESULTS 23
00053 #define LOC_ADAPTIVE    24
00054 /* DONT DEFINE ANY LOCATION > 31 !!! */
00055 
00056 /* Sub locatation determines whether pass2 was in normal mode or fix xht mode*/
00057 #define SUBLOC_NORM     0
00058 #define SUBLOC_FIX_XHT    3
00059 
00060 /* Sub Sub locatation determines whether match_word_pass2 was in Tess
00061   matcher, NN matcher or somewhere else */
00062 
00063 #define SUBSUBLOC_OTHER   0
00064 #define SUBSUBLOC_TESS    1
00065 #define SUBSUBLOC_NN    2
00066 
00071 class DLLSYM ERRCODE
00072 {
00073   const char *message;           //error message
00074   public:
00075     void error (                 //error print function
00076       const char *caller,        //function location
00077       INT8 action,               //action to take
00078       const char *format, ...    //fprintf format
00079       ) const;
00080     ERRCODE(const char *string) { 
00081       message = string;
00082     }                            //initialize with string
00083 };
00084 
00085 const ERRCODE ASSERT_FAILED = "Assert failed";
00086 
00087 #define ASSERT_HOST(x) if (!(x))                   \
00088 {                                            \
00089    ASSERT_FAILED.error(#x,LOG,"in file %s, line %d",     \
00090       __FILE__,__LINE__);                          \
00091 }
00092 
00093 void signal_exit(                 //
00094                  int signal_code  //Signal which
00095                 );
00096 extern "C"
00097 {
00098   void err_exit(); 
00099                                  //The real signal
00100   void signal_termination_handler(int sig); 
00101 };
00102 
00103 void set_global_loc_code(int loc_code); 
00104 
00105 void set_global_subloc_code(int loc_code); 
00106 
00107 void set_global_subsubloc_code(int loc_code); 
00108 #endif

Generated on Wed Feb 28 19:49:09 2007 for Tesseract by  doxygen 1.5.1