From 55f0ca584221cb76585b12d605d06d9000b01ab8 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sat, 7 Jul 2018 12:00:25 +0200 Subject: [PATCH] Add missing include statements and clean some include statements The changes are based on an analysis done with include-what-you-use. Signed-off-by: Stefan Weil --- src/api/baseapi.cpp | 88 +++++++++++++++++++--------------- src/api/renderer.h | 1 - src/ccmain/control.cpp | 9 ++-- src/ccmain/fixspace.cpp | 31 ++++++++---- src/ccmain/tesseractclass.h | 36 ++++++++------ src/ccstruct/blamer.h | 3 +- src/ccstruct/boxread.cpp | 16 ++++--- src/ccstruct/points.h | 11 +++-- src/ccstruct/polyaprx.h | 5 +- src/ccstruct/quspline.cpp | 10 ++-- src/ccstruct/quspline.h | 8 ++-- src/ccstruct/rect.h | 24 ++++++---- src/ccstruct/split.h | 18 +++---- src/ccstruct/stepblob.cpp | 11 +++-- src/ccstruct/stepblob.h | 11 ++++- src/lstm/static_shape.h | 4 +- src/lstm/stridemap.cpp | 1 + src/textord/tordmain.cpp | 45 +++++++++++------ src/wordrec/chopper.cpp | 36 ++++++++------ src/wordrec/language_model.cpp | 30 ++++++++---- src/wordrec/language_model.h | 33 ++++++++----- src/wordrec/lm_consistency.h | 9 ++-- src/wordrec/lm_pain_points.h | 12 +++-- src/wordrec/lm_state.h | 18 +++---- src/wordrec/outlines.h | 11 +++-- src/wordrec/params_model.h | 8 ++-- src/wordrec/plotedges.h | 12 +++-- src/wordrec/render.h | 11 +++-- src/wordrec/segsearch.cpp | 24 ++++++---- src/wordrec/wordclass.cpp | 20 ++++---- src/wordrec/wordrec.h | 43 ++++++++++++----- 31 files changed, 372 insertions(+), 227 deletions(-) diff --git a/src/api/baseapi.cpp b/src/api/baseapi.cpp index e6d5c52b..c5c80a73 100644 --- a/src/api/baseapi.cpp +++ b/src/api/baseapi.cpp @@ -22,8 +22,9 @@ #include "config_auto.h" #endif +#include "baseapi.h" #ifdef __linux__ -#include +#include // for sigaction, SA_RESETHAND, SIGBUS, SIGFPE #endif #if defined(_WIN32) @@ -34,49 +35,58 @@ #include #include #else -#include +#include // for closedir, opendir, readdir, DIR, dirent #include -#include #include -#include +#include // for stat, S_IFDIR #include #endif // _WIN32 -#include -#include -#include -#include -#include -#include // std::unique_ptr -#include - -#include "allheaders.h" - -#include "baseapi.h" -#include "blobclass.h" -#include "resultiterator.h" -#include "mutableiterator.h" -#include "thresholder.h" -#include "tesseractclass.h" -#include "pageres.h" -#include "paragraphs.h" -#include "tessvars.h" -#include "control.h" -#include "dict.h" -#include "pgedit.h" -#include "paramsd.h" -#include "output.h" -#include "globaloc.h" -#include "globals.h" -#include "edgblob.h" -#include "equationdetect.h" -#include "makerow.h" -#include "otsuthr.h" -#include "osdetect.h" -#include "params.h" -#include "renderer.h" -#include "strngs.h" -#include "openclwrapper.h" +#include // for LC_ALL, LC_CTYPE, LC_NUMERIC +#include // for round, M_PI +#include // for int32_t +#include // for strcmp, strcpy +#include // for size_t +#include // for std::cin +#include // for std::unique_ptr +#include "allheaders.h" // for pixDestroy, boxCreate, boxaAddBox, box... +#include "blobclass.h" // for ExtractFontName +#include "boxword.h" // for BoxWord +#include "config_auto.h" // for PACKAGE_VERSION +#include "coutln.h" // for C_OUTLINE_IT, C_OUTLINE_LIST +#include "dawg_cache.h" // for DawgCache +#include "dict.h" // for Dict +#include "edgblob.h" // for extract_edges +#include "elst.h" // for ELIST_ITERATOR, ELISTIZE, ELISTIZEH +#include "environ.h" // for l_uint8, FALSE, TRUE +#include "equationdetect.h" // for EquationDetect +#include "errcode.h" // for ASSERT_HOST +#include "globaloc.h" // for SavePixForCrash, signal_exit +#include "helpers.h" // for IntCastRounded, chomp_string +#include "host.h" // for BOOL8 +#include "imageio.h" // for IFF_TIFF_G4, IFF_TIFF, IFF_TIFF_G3 +#include "intfx.h" // for INT_FX_RESULT_STRUCT +#include "mutableiterator.h" // for MutableIterator +#include "normalis.h" // for kBlnBaselineOffset, kBlnXHeight +#include "ocrclass.h" // for ETEXT_DESC +#include "openclwrapper.h" // for PERF_COUNT_END, PERF_COUNT_START, PERF... +#include "osdetect.h" // for OSResults, OSBestResult, OrientationId... +#include "pageres.h" // for PAGE_RES_IT, WERD_RES, PAGE_RES, CR_DE... +#include "paragraphs.h" // for DetectParagraphs +#include "params.h" // for BoolParam, IntParam, DoubleParam, Stri... +#include "pdblock.h" // for PDBLK +#include "points.h" // for FCOORD +#include "polyblk.h" // for POLY_BLOCK +#include "rect.h" // for TBOX +#include "renderer.h" // for TessResultRenderer +#include "resultiterator.h" // for ResultIterator +#include "stepblob.h" // for C_BLOB_IT, C_BLOB, C_BLOB_LIST +#include "strngs.h" // for STRING +#include "tessdatamanager.h" // for TessdataManager, kTrainedDataSuffix +#include "tesseractclass.h" // for Tesseract +#include "thresholder.h" // for ImageThresholder +#include "tprintf.h" // for tprintf +#include "werd.h" // for WERD, WERD_IT, W_FUZZY_NON, W_FUZZY_SP BOOL_VAR(stream_filelist, FALSE, "Stream a filelist from stdin"); diff --git a/src/api/renderer.h b/src/api/renderer.h index bffee1c8..30da61d2 100644 --- a/src/api/renderer.h +++ b/src/api/renderer.h @@ -23,7 +23,6 @@ // and hide includes of complex types in baseapi.cpp. #include "genericvector.h" #include "platform.h" -#include "publictypes.h" namespace tesseract { diff --git a/src/ccmain/control.cpp b/src/ccmain/control.cpp index ddfdeb90..bdb94020 100644 --- a/src/ccmain/control.cpp +++ b/src/ccmain/control.cpp @@ -23,14 +23,14 @@ #include "config_auto.h" #endif -#include -#include #include +#include // for int16_t, int32_t +#include // for fclose, fopen, FILE +#include // for clock #ifdef __UNIX__ #include #endif -#include -#include +#include #include "callcpp.h" #include "control.h" #ifndef DISABLED_LEGACY_ENGINE @@ -42,6 +42,7 @@ #include "lstmrecognizer.h" #include "ocrclass.h" #include "output.h" +#include "pageres.h" // for WERD_RES, PAGE_RES_IT, PAGE_RES, BLO... #include "pgedit.h" #include "reject.h" #include "sorthelper.h" diff --git a/src/ccmain/fixspace.cpp b/src/ccmain/fixspace.cpp index 482664a8..5d696acf 100644 --- a/src/ccmain/fixspace.cpp +++ b/src/ccmain/fixspace.cpp @@ -19,15 +19,30 @@ * **********************************************************************/ -#include -#include "reject.h" -#include "statistc.h" -#include "control.h" #include "fixspace.h" -#include "genblob.h" -#include "tessvars.h" -#include "globals.h" -#include "tesseractclass.h" +#include // for INT16_MAX, int16_t, int32_t +#include "blobs.h" // for TWERD, TBLOB, TESSLINE +#include "boxword.h" // for BoxWord +#include "errcode.h" // for ASSERT_HOST +#include "genblob.h" // for c_blob_comparator +#include "host.h" // for FALSE, TRUE +#include "normalis.h" // for kBlnXHeight, kBlnBaselineOffset +#include "ocrclass.h" // for ETEXT_DESC +#include "pageres.h" // for WERD_RES_IT, WERD_RES, WERD_RES_LIST +#include "params.h" // for IntParam, StringParam, BoolParam, Doub... +#include "ratngs.h" // for WERD_CHOICE, FREQ_DAWG_PERM, NUMBER_PERM +#include "rect.h" // for TBOX +#include "stepblob.h" // for C_BLOB_IT, C_BLOB_LIST, C_BLOB +#include "strngs.h" // for STRING +#include "tesseractclass.h" // for Tesseract, TesseractStats, WordData +#include "tessvars.h" // for debug_fp +#include "tprintf.h" // for tprintf +#include "unichar.h" // for UNICHAR_ID +#include "unicharset.h" // for UNICHARSET +#include "werd.h" // for WERD, W_EOL, W_FUZZY_NON, W_FUZZY_SP + +class BLOCK; +class ROW; #define PERFECT_WERDS 999 #define MAXSPACING 128 /*max expected spacing in pix */ diff --git a/src/ccmain/tesseractclass.h b/src/ccmain/tesseractclass.h index 9a6199ba..2be0982e 100644 --- a/src/ccmain/tesseractclass.h +++ b/src/ccmain/tesseractclass.h @@ -26,22 +26,28 @@ #ifndef TESSERACT_CCMAIN_TESSERACTCLASS_H_ #define TESSERACT_CCMAIN_TESSERACTCLASS_H_ -#include "allheaders.h" -#include "control.h" -#include "debugpixa.h" -#include "devanagari_processing.h" -#include "docqual.h" -#include "genericvector.h" -#include "ocrclass.h" -#include "params.h" -#include "textord.h" -#include "wordrec.h" -#ifdef DISABLED_LEGACY_ENGINE -#include "pageres.h" -#endif +#include // for int16_t, int32_t, uint16_t +#include // for FILE +#include "allheaders.h" // for pixDestroy, pixGetWidth, pixGetHe... +#include "control.h" // for ACCEPTABLE_WERD_TYPE +#include "debugpixa.h" // for DebugPixa +#include "devanagari_processing.h" // for ShiroRekhaSplitter +#include "docqual.h" // for GARBAGE_LEVEL +#include "genericvector.h" // for GenericVector, PointerVector +#include "host.h" // for BOOL8 +#include "pageres.h" // for WERD_RES (ptr only), PAGE_RES (pt... +#include "params.h" // for BOOL_VAR_H, BoolParam, DoubleParam +#include "points.h" // for FCOORD +#include "publictypes.h" // for OcrEngineMode, PageSegMode, OEM_L... +#include "ratngs.h" // for ScriptPos, WERD_CHOICE (ptr only) +#include "strngs.h" // for STRING +#include "tessdatamanager.h" // for TessdataManager +#include "textord.h" // for Textord +#include "unichar.h" // for UNICHAR_ID +#include "wordrec.h" // for Wordrec -class BLOB_CHOICE_LIST_CLIST; class BLOCK_LIST; +class ETEXT_DESC; struct OSResults; class PAGE_RES; class PAGE_RES_IT; @@ -169,7 +175,7 @@ class Tesseract : public Wordrec { Tesseract(); ~Tesseract(); - // Return appropriate dictionary + // Return appropriate dictionary Dict& getDict() override; // Clear as much used memory as possible without resetting the adaptive diff --git a/src/ccstruct/blamer.h b/src/ccstruct/blamer.h index 2a5059c5..865ad5f1 100644 --- a/src/ccstruct/blamer.h +++ b/src/ccstruct/blamer.h @@ -25,7 +25,6 @@ #include // for memcpy #include "boxword.h" // for BoxWord #include "genericvector.h" // for GenericVector -#include "matrix.h" // for MATRIX_COORD, MATRIX (ptr only) #include "params_training_featdef.h" // for ParamsTrainingBundle, ParamsTra... #include "ratngs.h" // for BLOB_CHOICE_LIST (ptr only) #include "rect.h" // for TBOX @@ -34,9 +33,11 @@ #include "unichar.h" // for UNICHAR_ID class DENORM; +class MATRIX; class UNICHARSET; class WERD_RES; +struct MATRIX_COORD; struct TWERD; template class TessResultCallback2; diff --git a/src/ccstruct/boxread.cpp b/src/ccstruct/boxread.cpp index 972fa2bb..b9bbf1da 100644 --- a/src/ccstruct/boxread.cpp +++ b/src/ccstruct/boxread.cpp @@ -18,13 +18,15 @@ **********************************************************************/ #include "boxread.h" -#include - -#include "fileerr.h" -#include "rect.h" -#include "strngs.h" -#include "tprintf.h" -#include "unichar.h" +#include // for strchr, strcmp, strrchr +#include "errcode.h" // for ERRCODE, TESSEXIT +#include "fileerr.h" // for CANTOPENFILE +#include "genericvector.h" // for GenericVector +#include "helpers.h" // for chomp_string +#include "rect.h" // for TBOX +#include "strngs.h" // for STRING +#include "tprintf.h" // for tprintf +#include "unichar.h" // for UNICHAR // Special char code used to identify multi-blob labels. static const char* kMultiBlobLabelCode = "WordStr"; diff --git a/src/ccstruct/points.h b/src/ccstruct/points.h index a434ebdd..00f7aff7 100644 --- a/src/ccstruct/points.h +++ b/src/ccstruct/points.h @@ -17,12 +17,13 @@ * **********************************************************************/ -#ifndef POINTS_H -#define POINTS_H +#ifndef POINTS_H +#define POINTS_H -#include -#include -#include "elst.h" +#include // for sqrt, atan2 +#include +#include "elst.h" +#include "platform.h" // for DLLSYM class FCOORD; diff --git a/src/ccstruct/polyaprx.h b/src/ccstruct/polyaprx.h index 5f9f7b56..2542d67b 100644 --- a/src/ccstruct/polyaprx.h +++ b/src/ccstruct/polyaprx.h @@ -20,8 +20,9 @@ #ifndef POLYAPRX_H #define POLYAPRX_H -#include "blobs.h" -#include "coutln.h" +class C_OUTLINE; +struct EDGEPT; +struct TESSLINE; // convert a chain-coded input to the old OUTLINE approximation TESSLINE* ApproximateOutline(bool allow_detailed_fx, C_OUTLINE *c_outline); diff --git a/src/ccstruct/quspline.cpp b/src/ccstruct/quspline.cpp index 3e628517..a3e82ba3 100644 --- a/src/ccstruct/quspline.cpp +++ b/src/ccstruct/quspline.cpp @@ -1,8 +1,7 @@ /********************************************************************** * File: quspline.cpp (Formerly qspline.c) * Description: Code for the QSPLINE class. - * Author: Ray Smith - * Created: Tue Oct 08 17:16:12 BST 1991 + * Author: Ray Smith * * (C) Copyright 1991, Hewlett-Packard Ltd. ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,9 +16,12 @@ * **********************************************************************/ -#include "allheaders.h" -#include "quadlsq.h" #include "quspline.h" +#include "allheaders.h" // for pixRenderPolyline, pixGetDepth, pixGetHeight +#include "pix.h" // for L_CLEAR_PIXELS, L_SET_PIXELS, Pix (ptr only) +#include "points.h" // for ICOORD +#include "quadlsq.h" // for QLSQ +#include "quadratc.h" // for QUAD_COEFFS // Include automatically generated configuration file if running autoconf. #ifdef HAVE_CONFIG_H diff --git a/src/ccstruct/quspline.h b/src/ccstruct/quspline.h index 2b04e843..58e60d3b 100644 --- a/src/ccstruct/quspline.h +++ b/src/ccstruct/quspline.h @@ -20,11 +20,13 @@ #ifndef QUSPLINE_H #define QUSPLINE_H -#include "quadratc.h" -#include "serialis.h" -#include "rect.h" +#include // for int32_t +#include "scrollview.h" // for ScrollView, ScrollView::Color +class ICOORD; +class QUAD_COEFFS; class ROW; +class TBOX; struct Pix; class QSPLINE diff --git a/src/ccstruct/rect.h b/src/ccstruct/rect.h index 71c60ef4..978687ce 100644 --- a/src/ccstruct/rect.h +++ b/src/ccstruct/rect.h @@ -1,8 +1,8 @@ /********************************************************************** * File: rect.h (Formerly box.h) * Description: Bounding box class definition. - * Author: Phil Cheatle - * Created: Wed Oct 16 15:18:45 BST 1991 + * Author: Phil Cheatle + * Created: Wed Oct 16 15:18:45 BST 1991 * * (C) Copyright 1991, Hewlett-Packard Ltd. ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,14 +17,20 @@ * **********************************************************************/ -#ifndef RECT_H -#define RECT_H +#ifndef RECT_H +#define RECT_H -#include -#include "points.h" -#include "scrollview.h" -#include "strngs.h" -#include "tprintf.h" +#include // for std::max, std::min +#include // for ceil, floor +#include // for INT16_MAX +#include // for FILE +#include "ipoints.h" // for operator+=, operator-=, ICOORD::rotate +#include "platform.h" // for DLLSYM +#include "points.h" // for ICOORD, FCOORD +#include "scrollview.h" // for ScrollView, ScrollView::Color +#include "tprintf.h" // for tprintf + +class STRING; class DLLSYM TBOX { // bounding box public: diff --git a/src/ccstruct/split.h b/src/ccstruct/split.h index 440786e8..ef5848eb 100644 --- a/src/ccstruct/split.h +++ b/src/ccstruct/split.h @@ -1,14 +1,10 @@ /* -*-C-*- ******************************************************************************** * - * File: split.h (Formerly split.h) + * File: split.h * Description: - * Author: Mark Seaman, SW Productivity - * Created: Fri Oct 16 14:37:00 1987 - * Modified: Mon May 13 10:49:23 1991 (Mark Seaman) marks@hpgrlt - * Language: C - * Package: N/A - * Status: Reusable Software Component + * Author: Mark Seaman, SW Productivity + * Status: Reusable Software Component * * (c) Copyright 1987, Hewlett-Packard Company. ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,8 +24,12 @@ /*---------------------------------------------------------------------- I n c l u d e s ----------------------------------------------------------------------*/ -#include "blobs.h" -#include "scrollview.h" + +#include "blobs.h" // for EDGEPT, TBLOB, TESSLINE +#include "params.h" // for BOOL_VAR_H, BoolParam +#include "rect.h" // for TBOX + +class ScrollView; /*---------------------------------------------------------------------- T y p e s diff --git a/src/ccstruct/stepblob.cpp b/src/ccstruct/stepblob.cpp index 664aa4a3..af77122e 100644 --- a/src/ccstruct/stepblob.cpp +++ b/src/ccstruct/stepblob.cpp @@ -17,14 +17,19 @@ * **********************************************************************/ -#include "stepblob.h" -#include "allheaders.h" - // Include automatically generated configuration file if running autoconf. #ifdef HAVE_CONFIG_H #include "config_auto.h" #endif +#include "stepblob.h" +#include "allheaders.h" // for pixCreate, pixGetDepth +#include "genericvector.h" // for GenericVector +#include "host.h" // for TRUE, FALSE +#include "ipoints.h" // for operator+= + +class DENORM; + // Max perimeter to width ratio for a baseline position above box bottom. const double kMaxPerimeterWidthRatio = 8.0; diff --git a/src/ccstruct/stepblob.h b/src/ccstruct/stepblob.h index 4a80cbcb..eb798fac 100644 --- a/src/ccstruct/stepblob.h +++ b/src/ccstruct/stepblob.h @@ -20,11 +20,18 @@ #ifndef STEPBLOB_H #define STEPBLOB_H -#include "coutln.h" -#include "rect.h" +#include // for int32_t, int16_t +#include "coutln.h" // for C_OUTLINE_LIST, C_OUTLINE +#include "elst.h" // for ELIST_ITERATOR, ELISTIZEH, ELIST_LINK +#include "points.h" // for FCOORD, ICOORD (ptr only) +#include "rect.h" // for TBOX +#include "scrollview.h" // for ScrollView, ScrollView::Color class C_BLOB; +class DENORM; + struct Pix; + ELISTIZEH(C_BLOB) class C_BLOB:public ELIST_LINK diff --git a/src/lstm/static_shape.h b/src/lstm/static_shape.h index 78b31a15..8309bc4b 100644 --- a/src/lstm/static_shape.h +++ b/src/lstm/static_shape.h @@ -15,10 +15,12 @@ // See the License for the specific language governing permissions and // limitations under the License. /////////////////////////////////////////////////////////////////////// + #ifndef TESSERACT_LSTM_STATIC_SHAPE_H_ #define TESSERACT_LSTM_STATIC_SHAPE_H_ -#include "tprintf.h" +#include "serialis.h" // for TFile +#include "tprintf.h" // for tprintf namespace tesseract { diff --git a/src/lstm/stridemap.cpp b/src/lstm/stridemap.cpp index 26a2cf66..9ce93b49 100644 --- a/src/lstm/stridemap.cpp +++ b/src/lstm/stridemap.cpp @@ -17,6 +17,7 @@ /////////////////////////////////////////////////////////////////////// #include "stridemap.h" +#include // for assert namespace tesseract { diff --git a/src/textord/tordmain.cpp b/src/textord/tordmain.cpp index 5d5f5360..820bb4bb 100644 --- a/src/textord/tordmain.cpp +++ b/src/textord/tordmain.cpp @@ -21,22 +21,39 @@ #include "config_auto.h" #endif -#include // for FLT_MAX -#include "globaloc.h" -#include "blread.h" -#include "blobbox.h" -#include "ccstruct.h" -#include "edgblob.h" -#include "drawtord.h" -#include "makerow.h" -#include "wordseg.h" -#include "textord.h" #include "tordmain.h" +#include // for FLT_MAX +#include // for ceil, floor, M_PI +#include // for INT16_MAX, uint32_t, int32_t, int16_t +#include "allheaders.h" // for pixDestroy, pixGetHeight, boxCreate +#include "arrayaccess.h" // for GET_DATA_BYTE +#include "blobbox.h" // for BLOBNBOX_IT, BLOBNBOX, TO_BLOCK, TO_B... +#include "ccstruct.h" // for CCStruct, CCStruct::kXHeightFraction +#include "clst.h" // for CLISTIZE +#include "coutln.h" // for C_OUTLINE_IT, C_OUTLINE_LIST, C_OUTLINE +#include "drawtord.h" // for plot_box_list, to_win, create_to_win +#include "edgblob.h" // for extract_edges +#include "errcode.h" // for set_global_loc_code, ASSERT_HOST, LOC... +#include "genericvector.h" // for PointerVector, GenericVector +#include "makerow.h" // for textord_test_x, textord_test_y, texto... +#include "morph.h" // for L_BOUNDARY_BG +#include "ocrblock.h" // for BLOCK_IT, BLOCK, BLOCK_LIST (ptr only) +#include "ocrrow.h" // for ROW, ROW_IT, ROW_LIST, tweak_row_base... +#include "params.h" // for DoubleParam, BoolParam, IntParam +#include "pdblock.h" // for PDBLK +#include "points.h" // for FCOORD, ICOORD +#include "polyblk.h" // for POLY_BLOCK +#include "quadratc.h" // for QUAD_COEFFS +#include "quspline.h" // for QSPLINE, tweak_row_baseline +#include "rect.h" // for TBOX +#include "scrollview.h" // for ScrollView, ScrollView::WHITE +#include "statistc.h" // for STATS +#include "stepblob.h" // for C_BLOB_IT, C_BLOB, C_BLOB_LIST +#include "textord.h" // for Textord, WordWithBox, WordGrid, WordS... +#include "tprintf.h" // for tprintf +#include "werd.h" // for WERD_IT, WERD, WERD_LIST, W_DONT_CHOP -#include "allheaders.h" - -#undef EXTERN -#define EXTERN +struct Box; #define MAX_NEAREST_DIST 600 //for block skew stats diff --git a/src/wordrec/chopper.cpp b/src/wordrec/chopper.cpp index ed92fc97..f7816f71 100644 --- a/src/wordrec/chopper.cpp +++ b/src/wordrec/chopper.cpp @@ -27,22 +27,30 @@ I n c l u d e s ----------------------------------------------------------------------*/ -#include - #include "chopper.h" +#include "blamer.h" // for BlamerBundle, IRR_CORRECT +#include "blobs.h" // for TPOINT, TBLOB, EDGEPT, TESSLINE, divisible_blob +#include "callcpp.h" // for Red +#include "dict.h" // for Dict +#include "host.h" // for FALSE, TRUE +#include "lm_pain_points.h" // for LMPainPoints +#include "lm_state.h" // for BestChoiceBundle +#include "matrix.h" // for MATRIX +#include "normalis.h" // for DENORM +#include "pageres.h" // for WERD_RES +#include "params.h" // for IntParam, BoolParam +#include "ratngs.h" // for BLOB_CHOICE (ptr only), BLOB_CHOICE_LIST (ptr ... +#include "rect.h" // for TBOX +#include "render.h" // for display_blob +#include "seam.h" // for SEAM +#include "split.h" // for remove_edgept +#include "stopper.h" // for DANGERR +#include "tprintf.h" // for tprintf +#include "wordrec.h" // for Wordrec, SegSearchPending (ptr only) -#include "associate.h" -#include "blobs.h" -#include "callcpp.h" -#include "findseam.h" -#include "globals.h" -#include "render.h" -#include "pageres.h" -#include "seam.h" -#include "stopper.h" -#include "structures.h" -#include "unicharset.h" -#include "wordrec.h" +class CHAR_FRAGMENT; + +template class GenericVector; // Include automatically generated configuration file if running autoconf. #ifdef HAVE_CONFIG_H diff --git a/src/wordrec/language_model.cpp b/src/wordrec/language_model.cpp index 09b4bfaf..5f11b5c0 100644 --- a/src/wordrec/language_model.cpp +++ b/src/wordrec/language_model.cpp @@ -18,21 +18,31 @@ // /////////////////////////////////////////////////////////////////////// -#include - #include "language_model.h" +#include // for assert +#include // for log2, pow +#include "blamer.h" // for BlamerBundle +#include "ccutil.h" // for CCUtil +#include "dawg.h" // for NO_EDGE, Dawg, Dawg::kPatternUn... +#include "errcode.h" // for ASSERT_HOST +#include "lm_state.h" // for ViterbiStateEntry, ViterbiState... +#include "matrix.h" // for MATRIX_COORD +#include "pageres.h" // for WERD_RES +#include "params.h" // for IntParam, BoolParam, DoubleParam +#include "params_training_featdef.h" // for ParamsTrainingHypothesis, PTRAI... +#include "tprintf.h" // for tprintf +#include "unichar.h" // for UNICHAR_ID, INVALID_UNICHAR_ID +#include "unicharset.h" // for UNICHARSET +#include "unicity_table.h" // for UnicityTable -#include "dawg.h" -#include "intproto.h" -#include "helpers.h" -#include "lm_state.h" -#include "lm_pain_points.h" -#include "matrix.h" -#include "params.h" -#include "params_training_featdef.h" +template class GenericVector; +template class UnicityTable; namespace tesseract { +class LMPainPoints; +struct FontInfo; + #if (defined(_MSC_VER) && _MSC_VER < 1900) || defined(ANDROID) static inline double log2(double n) { return log(n) / log(2.0); diff --git a/src/wordrec/language_model.h b/src/wordrec/language_model.h index 9b5552e5..055ab0b1 100644 --- a/src/wordrec/language_model.h +++ b/src/wordrec/language_model.h @@ -22,21 +22,30 @@ #ifndef TESSERACT_WORDREC_LANGUAGE_MODEL_H_ #define TESSERACT_WORDREC_LANGUAGE_MODEL_H_ -#include "associate.h" -#include "dawg.h" -#include "dict.h" -#include "fontinfo.h" -#include "intproto.h" -#include "lm_consistency.h" -#include "lm_pain_points.h" -#include "lm_state.h" -#include "matrix.h" -#include "params.h" -#include "pageres.h" -#include "params_model.h" +#include // for exp +#include "associate.h" // for AssociateStats (ptr only), AssociateUtils +#include "dawg.h" // for DawgPositionVector +#include "dict.h" // for DawgArgs, Dict +#include "lm_consistency.h" // for LMConsistencyInfo +#include "lm_state.h" // for ViterbiStateEntry, LanguageModelFlagsType +#include "params.h" // for DoubleParam, double_VAR_H, IntParam, Boo... +#include "params_model.h" // for ParamsModel +#include "ratngs.h" // for BLOB_CHOICE (ptr only), BLOB_CHOICE_LIST... +#include "stopper.h" // for DANGERR +#include "strngs.h" // for STRING + +class UNICHARSET; +class WERD_RES; + +struct BlamerBundle; + +template class UnicityTable; namespace tesseract { +class LMPainPoints; +struct FontInfo; + // This class that contains the data structures and functions necessary // to represent and use the knowledge about the language. class LanguageModel { diff --git a/src/wordrec/lm_consistency.h b/src/wordrec/lm_consistency.h index 8f2cf418..e45a1fc5 100644 --- a/src/wordrec/lm_consistency.h +++ b/src/wordrec/lm_consistency.h @@ -21,10 +21,11 @@ #ifndef TESSERACT_WORDREC_LM_CONSISTENCY_H_ #define TESSERACT_WORDREC_LM_CONSISTENCY_H_ -#include "dawg.h" -#include "dict.h" -#include "host.h" -#include "ratngs.h" +#include // for INT16_MAX +#include "dawg.h" // for EDGE_REF, NO_EDGE +#include "dict.h" // for XH_GOOD, XH_INCONSISTENT, XHeightConsi... + +class BLOB_CHOICE; namespace tesseract { diff --git a/src/wordrec/lm_pain_points.h b/src/wordrec/lm_pain_points.h index 68eca593..19b368aa 100644 --- a/src/wordrec/lm_pain_points.h +++ b/src/wordrec/lm_pain_points.h @@ -23,13 +23,17 @@ #ifndef TESSERACT_WORDREC_PAIN_POINTS_H_ #define TESSERACT_WORDREC_PAIN_POINTS_H_ -#include "associate.h" -#include "dict.h" -#include "genericheap.h" -#include "lm_state.h" +#include "genericheap.h" // for GenericHeap +#include "matrix.h" // for MATRIX_COORD (ptr only), MatrixCoordPair +#include "stopper.h" // for DANGERR + +class WERD_RES; namespace tesseract { +class Dict; +struct ViterbiStateEntry; + // Heap of pain points used for determining where to chop/join. using PainPointHeap = GenericHeap; diff --git a/src/wordrec/lm_state.h b/src/wordrec/lm_state.h index efb21aad..299ded23 100644 --- a/src/wordrec/lm_state.h +++ b/src/wordrec/lm_state.h @@ -22,14 +22,16 @@ #ifndef TESSERACT_WORDREC_LANGUAGE_MODEL_DEFS_H_ #define TESSERACT_WORDREC_LANGUAGE_MODEL_DEFS_H_ -#include "associate.h" -#include "elst.h" -#include "dawg.h" -#include "lm_consistency.h" -#include "matrix.h" -#include "ratngs.h" -#include "stopper.h" -#include "strngs.h" +#include "associate.h" // for AssociateStats +#include "dawg.h" // for DawgPositionVector +#include "elst.h" // for ELIST_ITERATOR, ELISTIZEH, ELIST_LINK +#include "genericvector.h" // for PointerVector +#include "lm_consistency.h" // for LMConsistencyInfo +#include "ratngs.h" // for BLOB_CHOICE, PermuterType +#include "stopper.h" // for DANGERR +#include "strngs.h" // for STRING +#include "unichar.h" // for UNICHAR_ID +#include "unicharset.h" // for UNICHARSET namespace tesseract { diff --git a/src/wordrec/outlines.h b/src/wordrec/outlines.h index 14dac384..9d5725c6 100644 --- a/src/wordrec/outlines.h +++ b/src/wordrec/outlines.h @@ -1,7 +1,7 @@ /* -*-C-*- ******************************************************************************** * - * File: outlines.h (Formerly outlines.h) + * File: outlines.h * Description: Combinatorial Splitter * Author: Mark Seaman, OCR Technology * Created: Thu Jul 27 11:27:55 1989 @@ -22,13 +22,14 @@ ** limitations under the License. * *********************************************************************************/ + #ifndef OUTLINES_H #define OUTLINES_H -#include "blobs.h" -#include "chop.h" - -#include +#include // for abs +#include "blobs.h" // for TPOINT +#include "params.h" // for IntParam +#include "wordrec.h" // for Wordrec /*---------------------------------------------------------------------- C o n s t a n t s diff --git a/src/wordrec/params_model.h b/src/wordrec/params_model.h index 6414d2b8..4d373eea 100644 --- a/src/wordrec/params_model.h +++ b/src/wordrec/params_model.h @@ -20,12 +20,14 @@ #ifndef TESSERACT_WORDREC_PARAMS_MODEL_H_ #define TESSERACT_WORDREC_PARAMS_MODEL_H_ -#include "params_training_featdef.h" -#include "ratngs.h" -#include "strngs.h" +#include "genericvector.h" // for GenericVector +#include "params_training_featdef.h" // for PTRAIN_NUM_FEATURE_TYPES +#include "strngs.h" // for STRING namespace tesseract { +class TFile; + // Represents the learned weights for a given language. class ParamsModel { public: diff --git a/src/wordrec/plotedges.h b/src/wordrec/plotedges.h index 91521de7..21b3fb8d 100644 --- a/src/wordrec/plotedges.h +++ b/src/wordrec/plotedges.h @@ -1,7 +1,7 @@ /* -*-C-*- ******************************************************************************** * - * File: plotedges.h (Formerly plotedges.h) + * File: plotedges.h * Description: Convert the various data type into line lists * Author: Mark Seaman, OCR Technology * Created: Fri Jul 28 13:14:48 1989 @@ -22,12 +22,16 @@ ** limitations under the License. * *********************************************************************************/ + #ifndef PLOTEDGES_H #define PLOTEDGES_H -#include "callcpp.h" -#include "oldlist.h" -#include "blobs.h" +#include "oldlist.h" // for LIST + +class ScrollView; + +struct EDGEPT; +struct TBLOB; /*---------------------------------------------------------------------- V a r i a b l e s diff --git a/src/wordrec/render.h b/src/wordrec/render.h index 3faa398d..9346d01a 100644 --- a/src/wordrec/render.h +++ b/src/wordrec/render.h @@ -25,9 +25,14 @@ #ifndef RENDER_H #define RENDER_H -#include "host.h" -#include "callcpp.h" -#include "blobs.h" +#include "callcpp.h" // for C_COL +#include "params.h" // for BOOL_VAR_H, BoolParam + +class ScrollView; + +struct EDGEPT; +struct TBLOB; +struct TESSLINE; /*---------------------------------------------------------------------- V a r i a b l e s diff --git a/src/wordrec/segsearch.cpp b/src/wordrec/segsearch.cpp index 21c23a18..7fb131d5 100644 --- a/src/wordrec/segsearch.cpp +++ b/src/wordrec/segsearch.cpp @@ -17,16 +17,20 @@ // /////////////////////////////////////////////////////////////////////// -#include "wordrec.h" - -#include "associate.h" -#include "language_model.h" -#include "matrix.h" -#include "params.h" -#include "lm_pain_points.h" -#include "ratngs.h" - -#include +#include // for INT32_MAX +#include "blamer.h" // for BlamerBundle +#include "errcode.h" // for ASSERT_HOST +#include "genericvector.h" // for GenericVector +#include "lm_pain_points.h" // for LMPainPoints, LM_PPTYPE_SHAPE, LMPainPoi... +#include "lm_state.h" // for BestChoiceBundle, ViterbiStateEntry +#include "matrix.h" // for MATRIX_COORD, MATRIX +#include "pageres.h" // for WERD_RES +#include "params.h" // for BoolParam, IntParam, DoubleParam +#include "ratngs.h" // for BLOB_CHOICE_LIST, BLOB_CHOICE_IT +#include "strngs.h" // for STRING +#include "tesscallback.h" // for TessResultCallback2 +#include "tprintf.h" // for tprintf +#include "wordrec.h" // for Wordrec, SegSearchPending (ptr only) namespace tesseract { diff --git a/src/wordrec/wordclass.cpp b/src/wordrec/wordclass.cpp index 4f72dc1d..136cad63 100644 --- a/src/wordrec/wordclass.cpp +++ b/src/wordrec/wordclass.cpp @@ -4,11 +4,6 @@ * File: wordclass.cpp (Formerly wordclass.c) * Description: Word classifier * Author: Mark Seaman, OCR Technology - * Created: Tue Jan 30 14:03:25 1990 - * Modified: Fri Jul 12 16:03:06 1991 (Mark Seaman) marks@hpgrlt - * Language: C - * Package: N/A - * Status: Experimental (Do Not Distribute) * * (c) Copyright 1990, Hewlett-Packard Company. ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,13 +20,16 @@ /*---------------------------------------------------------------------- I N C L U D E S ----------------------------------------------------------------------*/ -#include -#include -#include "associate.h" -#include "render.h" -#include "callcpp.h" -#include "wordrec.h" +#include "blamer.h" // for blamer_bundle +#include "callcpp.h" // for window_wait, C_COL +#include "params.h" // for BoolParam +#include "render.h" // for display_blob, blob_window, wordrec_blob_pause +#include "wordrec.h" // for Wordrec + +class BLOB_CHOICE_LIST; + +struct TBLOB; // Include automatically generated configuration file if running autoconf. #ifdef HAVE_CONFIG_H diff --git a/src/wordrec/wordrec.h b/src/wordrec/wordrec.h index 04e21042..c4599655 100644 --- a/src/wordrec/wordrec.h +++ b/src/wordrec/wordrec.h @@ -19,24 +19,43 @@ #ifndef TESSERACT_WORDREC_WORDREC_H_ #define TESSERACT_WORDREC_WORDREC_H_ -// Include automatically generated configuration file if running autoconf. -#ifdef HAVE_CONFIG_H -#include "config_auto.h" -#endif - - #ifdef DISABLED_LEGACY_ENGINE -#include "classify.h" -#include "dict.h" -#include "ratngs.h" -#include "matrix.h" -#include "callcpp.h" +#include "config_auto.h" -#include +#include // 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; +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 { /* ccmain/tstruct.cpp */