Skip to content

Commit

Permalink
disable-legacy build: Do not include unused headers
Browse files Browse the repository at this point in the history
  • Loading branch information
amitdo committed Apr 4, 2019
1 parent 801bd66 commit 546014a
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 67 deletions.
2 changes: 2 additions & 0 deletions src/api/baseapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@
#include "globaloc.h" // for SavePixForCrash, signal_exit
#include "helpers.h" // for IntCastRounded, chomp_string
#include "imageio.h" // for IFF_TIFF_G4, IFF_TIFF, IFF_TIFF_G3
#ifndef DISABLED_LEGACY_ENGINE
#include "intfx.h" // for INT_FX_RESULT_STRUCT
#endif
#include "mutableiterator.h" // for MutableIterator
#include "normalis.h" // for kBlnBaselineOffset, kBlnXHeight
#include "ocrclass.h" // for ETEXT_DESC
Expand Down
12 changes: 8 additions & 4 deletions src/ccmain/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,29 @@ pkginclude_HEADERS = \

noinst_HEADERS = \
control.h \
docqual.h \
equationdetect.h \
fixspace.h \
mutableiterator.h \
output.h \
paragraphs.h \
paragraphs_internal.h \
paramsd.h \
pgedit.h \
reject.h \
tesseractclass.h \
tessvars.h \
werdit.h

if !DISABLED_LEGACY_ENGINE
noinst_HEADERS += \
docqual.h \
fixspace.h \
reject.h
endif

noinst_LTLIBRARIES = libtesseract_main.la

libtesseract_main_la_SOURCES = \
applybox.cpp \
control.cpp \
fixxht.cpp \
linerec.cpp \
ltrresultiterator.cpp \
mutableiterator.cpp \
Expand All @@ -77,6 +80,7 @@ libtesseract_main_la_SOURCES += \
docqual.cpp \
equationdetect.cpp \
fixspace.cpp \
fixxht.cpp \
osdetect.cpp \
par_control.cpp \
superscript.cpp \
Expand Down
2 changes: 2 additions & 0 deletions src/ccmain/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
#include "output.h"
#include "pageres.h" // for WERD_RES, PAGE_RES_IT, PAGE_RES, BLO...
#include "pgedit.h"
#ifndef DISABLED_LEGACY_ENGINE
#include "reject.h"
#endif
#include "sorthelper.h"
#include "tesseractclass.h"
#include "tessvars.h"
Expand Down
10 changes: 6 additions & 4 deletions src/ccmain/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
#include <cctype>
#include <cerrno>
#include <cstring>
#include "helpers.h"
#include "tessvars.h"
#include "control.h"
#include "reject.h"
#include "docqual.h"
#include "helpers.h"
#include "output.h"
#include "tesseractclass.h"
#include "tessvars.h"
#ifndef DISABLED_LEGACY_ENGINE
#include "docqual.h"
#include "reject.h"
#endif

#define EPAPER_EXT ".ep"
#define PAGE_YSIZE 3508
Expand Down
2 changes: 2 additions & 0 deletions src/ccmain/recogtraining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
#include "control.h"
#include "host.h" // for NearlyEqual
#include "ratngs.h"
#ifndef DISABLED_LEGACY_ENGINE
#include "reject.h"
#endif
#include "stopper.h"

namespace tesseract {
Expand Down
10 changes: 4 additions & 6 deletions src/ccmain/tessedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,22 @@

#include "basedir.h"
#include "control.h"
# include "matchdefs.h"
#include "pageres.h"
#include "params.h"
#include "pgedit.h"
#include "reject.h"
#include "stopper.h"
#include "tesseractclass.h"
#include "tessvars.h"
#include "tprintf.h"
#ifndef DISABLED_LEGACY_ENGINE
# include "chop.h"
# include "intmatcher.h"
# include "reject.h"
#endif
#ifndef ANDROID_BUILD
# include "lstmrecognizer.h"
#endif
#include "params.h"
#include "tesseractclass.h"
#ifdef DISABLED_LEGACY_ENGINE
# include "matchdefs.h"
#endif

// config under api
#define API_CONFIG "configs/api_config"
Expand Down
6 changes: 6 additions & 0 deletions src/ccmain/tesseractclass.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
#include "control.h" // for ACCEPTABLE_WERD_TYPE
#include "debugpixa.h" // for DebugPixa
#include "devanagari_processing.h" // for ShiroRekhaSplitter
#ifndef DISABLED_LEGACY_ENGINE
#include "docqual.h" // for GARBAGE_LEVEL
#endif
#include "genericvector.h" // for GenericVector, PointerVector
#include "pageres.h" // for WERD_RES (ptr only), PAGE_RES (pt...
#include "params.h" // for BOOL_VAR_H, BoolParam, DoubleParam
Expand Down Expand Up @@ -659,10 +661,12 @@ class Tesseract : public Wordrec {
float blob_noise_score(TBLOB *blob);
void break_noisiest_blob_word(WERD_RES_LIST &words);
//// docqual.cpp ////////////////////////////////////////////////////////
#ifndef DISABLED_LEGACY_ENGINE
GARBAGE_LEVEL garbage_word(WERD_RES* word, bool ok_dict_word);
bool potential_word_crunch(WERD_RES* word,
GARBAGE_LEVEL garbage_level,
bool ok_dict_word);
#endif
void tilde_crunch(PAGE_RES_IT &page_res_it);
void unrej_good_quality_words( //unreject potential
PAGE_RES_IT &page_res_it);
Expand All @@ -679,7 +683,9 @@ class Tesseract : public Wordrec {
void unrej_good_chs(WERD_RES *word, ROW *row);
int16_t count_outline_errs(char c, int16_t outline_count);
int16_t word_outline_errs(WERD_RES *word);
#ifndef DISABLED_LEGACY_ENGINE
bool terrible_word_crunch(WERD_RES* word, GARBAGE_LEVEL garbage_level);
#endif
CRUNCH_MODE word_deletable(WERD_RES *word, int16_t &delete_mode);
int16_t failure_count(WERD_RES *word);
bool noise_outlines(TWERD* word);
Expand Down
37 changes: 20 additions & 17 deletions src/wordrec/tface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@
*
**********************************************************************/

#include <cmath>

#include "wordrec.h"

#ifndef DISABLED_LEGACY_ENGINE
#include "callcpp.h"
#include "chop.h"
#include "pageres.h"
#include "wordrec.h"
#include "featdefs.h"
#include "pageres.h"
#include "params_model.h"

#include <cmath>
#endif

namespace tesseract {

Expand Down Expand Up @@ -77,7 +80,19 @@ void Wordrec::program_editdown(int32_t elasped_time) {
}


/**
* @name dict_word()
*
* Test the dictionaries, returning NO_PERM (0) if not found, or one
* of the PermuterType values if found, according to the dictionary.
*/
int Wordrec::dict_word(const WERD_CHOICE &word) {
return getDict().valid_word(word);
}


#ifndef DISABLED_LEGACY_ENGINE

/**
* @name set_pass1
*
Expand Down Expand Up @@ -114,21 +129,8 @@ void Wordrec::cc_recog(WERD_RES *word) {
getDict().word_to_debug.string());
ASSERT_HOST(word->StatesAllValid());
}
#endif // ndef DISABLED_LEGACY_ENGINE


/**
* @name dict_word()
*
* Test the dictionaries, returning NO_PERM (0) if not found, or one
* of the PermuterType values if found, according to the dictionary.
*/
int Wordrec::dict_word(const WERD_CHOICE &word) {
return getDict().valid_word(word);
}


#ifndef DISABLED_LEGACY_ENGINE
/**
* @name call_matcher
*
Expand All @@ -148,6 +150,7 @@ BLOB_CHOICE_LIST *Wordrec::call_matcher(TBLOB *tessblob) {
}
return ratings;
}

#endif // ndef DISABLED_LEGACY_ENGINE

} // namespace tesseract
72 changes: 36 additions & 36 deletions src/wordrec/wordrec.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,12 @@

#ifdef DISABLED_LEGACY_ENGINE

#include "config_auto.h"

#include <cstdint> // for int16_t, int32_t
#include "callcpp.h" // for C_COL
#include "chop.h" // for PointHeap, MAX_NUM_POINTS
#include "classify.h" // for Classify
#include "elst.h" // for ELIST_ITERATOR, ELISTIZEH, ELIST_LINK
#include "findseam.h" // for SeamQueue, SeamPile
#include "genericvector.h" // for GenericVector
#include "oldlist.h" // for LIST
#include "params.h" // for INT_VAR_H, IntParam, BOOL_VAR_H, BoolP...
#include "points.h" // for ICOORD
#include "ratngs.h" // for BLOB_CHOICE_LIST (ptr only), BLOB_CHOI...
#include "seam.h" // for SEAM (ptr only), PRIORITY
#include "stopper.h" // for DANGERR

class EDGEPT_CLIST;
class MATRIX;
class STRING;
class TBOX;
class UNICHARSET;
class WERD_RES;
#include "ratngs.h" // for WERD_CHOICE

namespace tesseract { class LMPainPoints; }
namespace tesseract { class TessdataManager; }
namespace tesseract { struct BestChoiceBundle; }

struct BlamerBundle;
struct EDGEPT;
struct MATRIX_COORD;
struct SPLIT;
struct TBLOB;
struct TESSLINE;
struct TWERD;

namespace tesseract {

Expand Down Expand Up @@ -87,20 +59,48 @@ class Wordrec : public Classify {

#else // DISABLED_LEGACY_ENGINE not defined

#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif

#include <cstdint> // for int16_t, int32_t
#include <memory>
#include "associate.h"
#include "classify.h"
#include "callcpp.h" // for C_COL
#include "chop.h" // for PointHeap, MAX_NUM_POINTS
#include "classify.h" // for Classify
#include "dict.h"
#include "elst.h" // for ELIST_ITERATOR, ELISTIZEH, ELIST_LINK
#include "findseam.h" // for SeamQueue, SeamPile
#include "genericvector.h" // for GenericVector
#include "language_model.h"
#include "ratngs.h"
#include "matrix.h"
#include "seam.h"
#include "findseam.h"
#include "callcpp.h"

#include <memory>
#include "oldlist.h" // for LIST
#include "params.h" // for INT_VAR_H, IntParam, BOOL_VAR_H, BoolP...
#include "points.h" // for ICOORD
#include "ratngs.h" // for BLOB_CHOICE_LIST (ptr only), BLOB_CHOI...
#include "seam.h" // for SEAM (ptr only), PRIORITY
#include "stopper.h" // for DANGERR

class EDGEPT_CLIST;
class MATRIX;
class STRING;
class TBOX;
class UNICHARSET;
class WERD_RES;

namespace tesseract { class LMPainPoints; }
namespace tesseract { class TessdataManager; }
namespace tesseract { struct BestChoiceBundle; }

struct BlamerBundle;
struct EDGEPT;
struct MATRIX_COORD;
struct SPLIT;
struct TBLOB;
struct TESSLINE;
struct TWERD;

namespace tesseract {

// A class for storing which nodes are to be processed by the segmentation
Expand Down

0 comments on commit 546014a

Please sign in to comment.