Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
errcode.h File Reference
#include "host.h"

Go to the source code of this file.

Classes

class  ERRCODE
 

Macros

#define NO_ABORT_CODE   0
 
#define LIST_ABORT   1
 
#define MEMORY_ABORT   2
 
#define FILE_ABORT   3
 
#define LOC_UNUSED0   0
 
#define LOC_UNUSED1   1
 
#define LOC_UNUSED2   2
 
#define LOC_INIT   3
 
#define LOC_EDGE_PROG   4
 
#define LOC_TEXT_ORD_ROWS   5
 
#define LOC_TEXT_ORD_WORDS   6
 
#define LOC_PASS1   7
 
#define LOC_PASS2   8
 
#define LOC_FUZZY_SPACE   14
 
#define LOC_MM_ADAPT   21
 
#define LOC_DOC_BLK_REJ   22
 
#define LOC_WRITE_RESULTS   23
 
#define LOC_ADAPTIVE   24
 
#define SUBLOC_NORM   0
 
#define SUBLOC_FIX_XHT   3
 
#define SUBSUBLOC_OTHER   0
 
#define SUBSUBLOC_TESS   1
 
#define SUBSUBLOC_NN   2
 
#define ASSERT_HOST(x)
 

Enumerations

enum  TessErrorLogCode { DBG = -1, TESSLOG = 0, TESSEXIT = 1, ABORT = 2 }
 

Functions

void signal_exit (int signal_code)
 
void err_exit ()
 
void signal_termination_handler (int sig)
 
void set_global_loc_code (int loc_code)
 
void set_global_subloc_code (int loc_code)
 
void set_global_subsubloc_code (int loc_code)
 

Variables

const ERRCODE ASSERT_FAILED = "Assert failed"
 

Macro Definition Documentation

#define ASSERT_HOST (   x)
Value:
if (!(x)) \
{ \
ASSERT_FAILED.error(#x,ABORT,"in file %s, line %d", \
__FILE__,__LINE__); \
}
const ERRCODE ASSERT_FAILED
Definition: errcode.h:82
Definition: errcode.h:30
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:41

Definition at line 84 of file errcode.h.

#define FILE_ABORT   3

Definition at line 37 of file errcode.h.

#define LIST_ABORT   1

Definition at line 35 of file errcode.h.

#define LOC_ADAPTIVE   24

Definition at line 55 of file errcode.h.

#define LOC_DOC_BLK_REJ   22

Definition at line 53 of file errcode.h.

#define LOC_EDGE_PROG   4

Definition at line 44 of file errcode.h.

#define LOC_FUZZY_SPACE   14

Definition at line 50 of file errcode.h.

#define LOC_INIT   3

Definition at line 43 of file errcode.h.

#define LOC_MM_ADAPT   21

Definition at line 52 of file errcode.h.

#define LOC_PASS1   7

Definition at line 47 of file errcode.h.

#define LOC_PASS2   8

Definition at line 48 of file errcode.h.

#define LOC_TEXT_ORD_ROWS   5

Definition at line 45 of file errcode.h.

#define LOC_TEXT_ORD_WORDS   6

Definition at line 46 of file errcode.h.

#define LOC_UNUSED0   0

Definition at line 40 of file errcode.h.

#define LOC_UNUSED1   1

Definition at line 41 of file errcode.h.

#define LOC_UNUSED2   2

Definition at line 42 of file errcode.h.

#define LOC_WRITE_RESULTS   23

Definition at line 54 of file errcode.h.

#define MEMORY_ABORT   2

Definition at line 36 of file errcode.h.

#define NO_ABORT_CODE   0

Definition at line 34 of file errcode.h.

#define SUBLOC_FIX_XHT   3

Definition at line 60 of file errcode.h.

#define SUBLOC_NORM   0

Definition at line 59 of file errcode.h.

#define SUBSUBLOC_NN   2

Definition at line 67 of file errcode.h.

#define SUBSUBLOC_OTHER   0

Definition at line 65 of file errcode.h.

#define SUBSUBLOC_TESS   1

Definition at line 66 of file errcode.h.

Enumeration Type Documentation

Enumerator
DBG 
TESSLOG 
TESSEXIT 
ABORT 

Definition at line 26 of file errcode.h.

26  {
27  DBG = -1, /*log without alert */
28  TESSLOG = 0, /*alert user */
29  TESSEXIT = 1, /*exit after erro */
30  ABORT = 2 /*abort after error */
31 };
Definition: errcode.h:30
Definition: errcode.h:27

Function Documentation

void err_exit ( )

Definition at line 73 of file globaloc.cpp.

73  {
74  signal_exit (-1);
75 }
void signal_exit(int signal_code)
Definition: globaloc.cpp:33
void set_global_loc_code ( int  loc_code)

Definition at line 100 of file globaloc.cpp.

100  {
101  // global_loc_code = loc_code;
102 
103 }
void set_global_subloc_code ( int  loc_code)

Definition at line 106 of file globaloc.cpp.

106  {
107  // global_subloc_code = loc_code;
108 
109 }
void set_global_subsubloc_code ( int  loc_code)

Definition at line 112 of file globaloc.cpp.

112  {
113  // global_subsubloc_code = loc_code;
114 
115 }
void signal_exit ( int  signal_code)

Definition at line 33 of file globaloc.cpp.

35  {
36  /*int exit_status;
37 
38  if ((global_loc_code == LOC_PASS2) || (global_loc_code == LOC_FUZZY_SPACE))
39  global_loc_code += global_subloc_code + global_subsubloc_code;
40 
41  if (signal_code < 0) {
42  exit_status = global_loc_code * 8 + global_abort_code * 2 + 1;
43  tprintf ("Signal_exit %d ABORT. LocCode: %d AbortCode: %d\n",
44  exit_status, global_loc_code, global_abort_code);
45  }
46  else {
47  exit_status = global_loc_code * 8 + signal_code * 2;
48  tprintf ("Signal_exit %d SIGNAL ABORT. LocCode: %d SignalCode: %d\n",
49  exit_status, global_loc_code, signal_code);
50  }
51 
52  exit(exit_status);*/
53  exit(signal_code);
54 }
void signal_termination_handler ( int  sig)

Definition at line 78 of file globaloc.cpp.

78  {
79  const ERRCODE SIGNAL_HANDLER_ERR = "Signal_termination_handler called";
80  SIGNAL_HANDLER_ERR.error("signal_termination_handler", ABORT, "Code %d", sig);
81  switch (sig) {
82  case SIGABRT:
83  signal_exit (-1); //use abort code
84  // case SIGBUS:
85  case SIGSEGV:
86  signal_exit (0);
87  case SIGFPE:
88  signal_exit (1); //floating point
89  case SIGTERM:
90  signal_exit (2); //timeout by cmdtimer
91  default:
92  signal_exit (3); //Anything else
93  }
94 }
Definition: errcode.h:30
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:41
void signal_exit(int signal_code)
Definition: globaloc.cpp:33

Variable Documentation

const ERRCODE ASSERT_FAILED = "Assert failed"

Definition at line 82 of file errcode.h.