Remove UnicharAmbigs for builds without legacy code

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2019-09-15 15:36:58 +02:00
parent 2134cd7867
commit 627faa6f9c
8 changed files with 23 additions and 19 deletions

View File

@ -20,7 +20,7 @@ pkginclude_HEADERS = \
unichar.h
noinst_HEADERS = \
ambigs.h bits16.h ccutil.h clst.h doubleptr.h elst2.h \
bits16.h ccutil.h clst.h doubleptr.h elst2.h \
elst.h errcode.h fileerr.h \
genericheap.h globaloc.h host.h \
kdpair.h lsterr.h \
@ -29,6 +29,7 @@ noinst_HEADERS = \
unicharcompress.h unicharmap.h unicharset.h unicity_table.h unicodes.h
if !DISABLED_LEGACY_ENGINE
noinst_HEADERS += ambigs.h
noinst_HEADERS += bitvector.h
noinst_HEADERS += indexmapbidi.h
noinst_HEADERS += universalambigs.h

View File

@ -217,19 +217,6 @@ class UnicharAmbigs {
} // namespace tesseract
#else
namespace tesseract {
class UnicharAmbigs {
public:
UnicharAmbigs() = default;
~UnicharAmbigs() = default;
};
} // namespace tesseract
#endif // !defined(DISABLED_LEGACY_ENGINE)
#endif // TESSERACT_CCUTIL_AMBIGS_H_

View File

@ -24,7 +24,9 @@
#include <semaphore.h>
#endif
#ifndef DISABLED_LEGACY_ENGINE
#include "ambigs.h"
#endif
#include "errcode.h"
#ifdef _WIN32
#include "host.h" // windows.h for HANDLE, ...
@ -53,7 +55,9 @@ class CCUtil {
STRING lang;
STRING language_data_path_prefix;
UNICHARSET unicharset;
#ifndef DISABLED_LEGACY_ENGINE
UnicharAmbigs unichar_ambigs;
#endif
STRING imagefile; // image file name
STRING directory; // main directory

View File

@ -166,8 +166,6 @@ Dict::Dict(CCUtil* ccutil)
" are specified, since overly generic patterns can result in"
" dawg search exploring an overly large number of options.",
getCCUtil()->params()) {
dang_ambigs_table_ = nullptr;
replace_ambigs_table_ = nullptr;
reject_offset_ = 0.0;
go_deeper_fxn_ = nullptr;
hyphen_word_ = nullptr;

View File

@ -19,7 +19,9 @@
#ifndef TESSERACT_DICT_DICT_H_
#define TESSERACT_DICT_DICT_H_
#ifndef DISABLED_LEGACY_ENGINE
#include "ambigs.h"
#endif
#include "dawg.h"
#include "dawg_cache.h"
#include "ratngs.h"
@ -100,10 +102,11 @@ class Dict {
UNICHARSET& getUnicharset() {
return getCCUtil()->unicharset;
}
#ifndef DISABLED_LEGACY_ENGINE
const UnicharAmbigs &getUnicharAmbigs() const {
return getCCUtil()->unichar_ambigs;
}
#endif
// Returns true if unichar_id is a word compounding character like - or /.
inline bool compound_marker(UNICHAR_ID unichar_id) {
const UNICHARSET& unicharset = getUnicharset();
@ -517,9 +520,11 @@ class Dict {
* Each entry i in the table stores a set of amibiguities whose
* wrong ngram starts with unichar id i.
*/
UnicharAmbigs *dang_ambigs_table_;
#ifndef DISABLED_LEGACY_ENGINE
UnicharAmbigs* dang_ambigs_table_ = nullptr;
/** Same as above, but for ambiguities with replace flag set. */
UnicharAmbigs *replace_ambigs_table_;
UnicharAmbigs* replace_ambigs_table_ = nullptr;
#endif
/** Additional certainty padding allowed before a word is rejected. */
float reject_offset_;
// Cached UNICHAR_IDs:

View File

@ -21,7 +21,9 @@
#include <cmath>
#include "stopper.h"
#ifndef DISABLED_LEGACY_ENGINE
#include "ambigs.h"
#endif
#include "ccutil.h"
#include "dict.h"
#include "helpers.h"

View File

@ -19,6 +19,10 @@ if !NO_TESSDATA_PREFIX
AM_CXXFLAGS += -DTESSDATA_PREFIX=@datadir@
endif
if DISABLED_LEGACY_ENGINE
AM_CPPFLAGS += -DDISABLED_LEGACY_ENGINE
endif
if VISIBILITY
AM_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
AM_CPPFLAGS += -DTESS_EXPORTS

View File

@ -17,6 +17,9 @@ AM_CPPFLAGS += -DTESS_EXPORTS \
-fvisibility=hidden -fvisibility-inlines-hidden
endif
if DISABLED_LEGACY_ENGINE
AM_CPPFLAGS += -DDISABLED_LEGACY_ENGINE
endif
noinst_HEADERS = \
alignedblob.h baselinedetect.h bbgrid.h blkocc.h blobgrid.h \