tesseract  4.0.0-1-g2a2b
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)
 
#define ASSERT_HOST_MSG(x, ...)
 

Enumerations

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

Functions

void signal_exit (int signal_code)
 
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

◆ ASSERT_HOST

#define ASSERT_HOST (   x)
Value:
if (!(x)) \
{ \
ASSERT_FAILED.error(#x, ABORT, "in file %s, line %d", \
__FILE__, __LINE__); \
}
Definition: errcode.h:30

Definition at line 84 of file errcode.h.

◆ ASSERT_HOST_MSG

#define ASSERT_HOST_MSG (   x,
  ... 
)
Value:
if (!(x)) { \
tprintf(__VA_ARGS__); \
ASSERT_FAILED.error(#x, ABORT, "in file %s, line %d", __FILE__, __LINE__); \
}
Definition: errcode.h:30

Definition at line 90 of file errcode.h.

◆ FILE_ABORT

#define FILE_ABORT   3

Definition at line 37 of file errcode.h.

◆ LIST_ABORT

#define LIST_ABORT   1

Definition at line 35 of file errcode.h.

◆ LOC_ADAPTIVE

#define LOC_ADAPTIVE   24

Definition at line 55 of file errcode.h.

◆ LOC_DOC_BLK_REJ

#define LOC_DOC_BLK_REJ   22

Definition at line 53 of file errcode.h.

◆ LOC_EDGE_PROG

#define LOC_EDGE_PROG   4

Definition at line 44 of file errcode.h.

◆ LOC_FUZZY_SPACE

#define LOC_FUZZY_SPACE   14

Definition at line 50 of file errcode.h.

◆ LOC_INIT

#define LOC_INIT   3

Definition at line 43 of file errcode.h.

◆ LOC_MM_ADAPT

#define LOC_MM_ADAPT   21

Definition at line 52 of file errcode.h.

◆ LOC_PASS1

#define LOC_PASS1   7

Definition at line 47 of file errcode.h.

◆ LOC_PASS2

#define LOC_PASS2   8

Definition at line 48 of file errcode.h.

◆ LOC_TEXT_ORD_ROWS

#define LOC_TEXT_ORD_ROWS   5

Definition at line 45 of file errcode.h.

◆ LOC_TEXT_ORD_WORDS

#define LOC_TEXT_ORD_WORDS   6

Definition at line 46 of file errcode.h.

◆ LOC_UNUSED0

#define LOC_UNUSED0   0

Definition at line 40 of file errcode.h.

◆ LOC_UNUSED1

#define LOC_UNUSED1   1

Definition at line 41 of file errcode.h.

◆ LOC_UNUSED2

#define LOC_UNUSED2   2

Definition at line 42 of file errcode.h.

◆ LOC_WRITE_RESULTS

#define LOC_WRITE_RESULTS   23

Definition at line 54 of file errcode.h.

◆ MEMORY_ABORT

#define MEMORY_ABORT   2

Definition at line 36 of file errcode.h.

◆ NO_ABORT_CODE

#define NO_ABORT_CODE   0

Definition at line 34 of file errcode.h.

◆ SUBLOC_FIX_XHT

#define SUBLOC_FIX_XHT   3

Definition at line 60 of file errcode.h.

◆ SUBLOC_NORM

#define SUBLOC_NORM   0

Definition at line 59 of file errcode.h.

◆ SUBSUBLOC_NN

#define SUBSUBLOC_NN   2

Definition at line 67 of file errcode.h.

◆ SUBSUBLOC_OTHER

#define SUBSUBLOC_OTHER   0

Definition at line 65 of file errcode.h.

◆ SUBSUBLOC_TESS

#define SUBSUBLOC_TESS   1

Definition at line 66 of file errcode.h.

Enumeration Type Documentation

◆ TessErrorLogCode

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:27
Definition: errcode.h:30

Function Documentation

◆ set_global_loc_code()

void set_global_loc_code ( int  loc_code)

Definition at line 80 of file globaloc.cpp.

80  {
81  // global_loc_code = loc_code;
82 }

◆ set_global_subloc_code()

void set_global_subloc_code ( int  loc_code)

Definition at line 85 of file globaloc.cpp.

85  {
86  // global_subloc_code = loc_code;
87 }

◆ set_global_subsubloc_code()

void set_global_subsubloc_code ( int  loc_code)

Definition at line 90 of file globaloc.cpp.

90  {
91  // global_subsubloc_code = loc_code;
92 }

◆ signal_exit()

void signal_exit ( int  signal_code)

Definition at line 53 of file globaloc.cpp.

53  {
54  tprintf("Received signal %d!\n", signal_code);
55 #ifdef __linux__
56 #ifndef ANDROID
57  int thread_id = syscall(SYS_gettid) % kMaxNumThreadPixes;
58 #else
59  int thread_id = gettid() % kMaxNumThreadPixes;
60 #endif
61  if (global_crash_pixes[thread_id] != nullptr) {
62  fprintf(stderr, "Crash caused by image with resolution %d\n",
63  pixGetYRes(global_crash_pixes[thread_id]));
64  fprintf(stderr, "<Cut here>\n");
65  pixWriteStreamPng(stderr, global_crash_pixes[thread_id], 0.0);
66  fprintf(stderr, "\n<End cut>\n");
67  }
68  // Raise an uncaught signal, so as to get a useful stack trace.
69  raise(SIGILL);
70 #else
71  abort();
72 #endif
73 }
const int kMaxNumThreadPixes
Definition: globaloc.cpp:31
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:37

Variable Documentation

◆ ASSERT_FAILED

const ERRCODE ASSERT_FAILED = "Assert failed"

Definition at line 82 of file errcode.h.