From 802f42e8217fe6210084761ef056b8fc0dfaed6e Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sat, 30 Mar 2019 13:45:50 +0100 Subject: [PATCH] Remove BOOL8, TRUE, FALSE from host.h Remove unneeded include statements for host.h, add required ones and update the comments for the remaining include statements. Signed-off-by: Stefan Weil --- src/ccstruct/blobbox.h | 1 + src/ccstruct/boxword.cpp | 2 +- src/ccstruct/imagedata.cpp | 2 +- src/ccstruct/polyblk.cpp | 1 + src/ccstruct/rejctmap.cpp | 2 -- src/ccstruct/statistc.h | 2 -- src/ccutil/bitvector.h | 5 +---- src/ccutil/errcode.h | 2 +- src/ccutil/globaloc.h | 8 +++----- src/ccutil/host.h | 12 ------------ src/ccutil/params.cpp | 5 ++--- src/ccutil/params.h | 11 +++++------ src/ccutil/unicharmap.cpp | 2 -- src/ccutil/unicodes.cpp | 2 -- src/classify/clusttool.h | 1 - src/classify/fpoint.h | 1 - src/classify/kdtree.h | 3 ++- src/cutil/bitvec.h | 4 ++-- src/cutil/callcpp.h | 1 - src/dict/dawg.h | 2 ++ src/dict/dict.h | 1 - src/dict/matchdefs.h | 2 -- src/lstm/ctc.cpp | 1 - src/textord/imagefind.h | 2 -- src/training/dawg2wordlist.cpp | 2 -- src/training/mergenf.cpp | 1 - src/training/pango_font_info.h | 1 - src/training/stringrenderer.h | 2 -- src/training/tessopt.h | 2 +- 29 files changed, 23 insertions(+), 60 deletions(-) diff --git a/src/ccstruct/blobbox.h b/src/ccstruct/blobbox.h index b5ea5505f7..8e184b536b 100644 --- a/src/ccstruct/blobbox.h +++ b/src/ccstruct/blobbox.h @@ -25,6 +25,7 @@ #include "elst.h" // for ELIST_ITERATOR, ELISTIZEH, ELIST_LINK #include "elst2.h" // for ELIST2_ITERATOR, ELIST2IZEH, ELIST2_LINK #include "errcode.h" // for ASSERT_HOST +#include "host.h" // for PRId32 #include "ocrblock.h" // for BLOCK #include "params.h" // for DoubleParam, double_VAR_H #include "pdblock.h" // for PDBLK diff --git a/src/ccstruct/boxword.cpp b/src/ccstruct/boxword.cpp index 41971d7865..eb37b2c066 100644 --- a/src/ccstruct/boxword.cpp +++ b/src/ccstruct/boxword.cpp @@ -2,7 +2,6 @@ // File: boxword.cpp // Description: Class to represent the bounding boxes of the output. // Author: Ray Smith -// Created: Tue May 25 14:18:14 PDT 2010 // // (C) Copyright 2010, Google Inc. // Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,6 +18,7 @@ #include "blobs.h" #include "boxword.h" +#include "host.h" // for NearlyEqual #include "normalis.h" #include "ocrblock.h" #include "pageres.h" diff --git a/src/ccstruct/imagedata.cpp b/src/ccstruct/imagedata.cpp index 5056d1fa30..6c72ed1872 100644 --- a/src/ccstruct/imagedata.cpp +++ b/src/ccstruct/imagedata.cpp @@ -3,7 +3,6 @@ // Description: Class to hold information about a single multi-page tiff // training file and its corresponding boxes or text file. // Author: Ray Smith -// Created: Tue May 28 08:56:06 PST 2013 // // (C) Copyright 2013, Google Inc. // Licensed under the Apache License, Version 2.0 (the "License"); @@ -34,6 +33,7 @@ #include "boxread.h" // for ReadMemBoxes #include "callcpp.h" // for window_wait #include "helpers.h" // for IntCastRounded, TRand, ClipToRange, Modulo +#include "host.h" // for PRId64 #include "rect.h" // for TBOX #include "scrollview.h" // for ScrollView, ScrollView::CYAN, ScrollView::NONE #include "serialis.h" // for TFile diff --git a/src/ccstruct/polyblk.cpp b/src/ccstruct/polyblk.cpp index 43d1972394..7aacc2f771 100644 --- a/src/ccstruct/polyblk.cpp +++ b/src/ccstruct/polyblk.cpp @@ -21,6 +21,7 @@ #include #include // std::unique_ptr #include "elst.h" +#include "host.h" // for PRId32 // Include automatically generated configuration file if running autoconf. #ifdef HAVE_CONFIG_H diff --git a/src/ccstruct/rejctmap.cpp b/src/ccstruct/rejctmap.cpp index 85a3cd9884..a368a41367 100644 --- a/src/ccstruct/rejctmap.cpp +++ b/src/ccstruct/rejctmap.cpp @@ -2,7 +2,6 @@ * File: rejctmap.cpp (Formerly rejmap.c) * Description: REJ and REJMAP class functions. * Author: Phil Cheatle - * Created: Thu Jun 9 13:46:38 BST 1994 * * (C) Copyright 1994, Hewlett-Packard Ltd. ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,7 +16,6 @@ * **********************************************************************/ -#include "host.h" #include "rejctmap.h" #include "params.h" diff --git a/src/ccstruct/statistc.h b/src/ccstruct/statistc.h index b2a036dda3..07c821bbff 100644 --- a/src/ccstruct/statistc.h +++ b/src/ccstruct/statistc.h @@ -2,7 +2,6 @@ * File: statistc.h (Formerly stats.h) * Description: Class description for STATS class. * Author: Ray Smith - * Created: Mon Feb 04 16:19:07 GMT 1991 * * (C) Copyright 1991, Hewlett-Packard Ltd. ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +20,6 @@ #define TESSERACT_CCSTRUCT_STATISTC_H_ #include -#include "host.h" #include "kdpair.h" #include "scrollview.h" diff --git a/src/ccutil/bitvector.h b/src/ccutil/bitvector.h index 9f105145a1..972bbf24a0 100644 --- a/src/ccutil/bitvector.h +++ b/src/ccutil/bitvector.h @@ -1,10 +1,7 @@ -// Copyright 2011 Google Inc. All Rights Reserved. -// Author: rays@google.com (Ray Smith) /////////////////////////////////////////////////////////////////////// // File: bitvector.h // Description: Class replacement for BITVECTOR. // Author: Ray Smith -// Created: Mon Jan 10 17:44:01 PST 2011 // // (C) Copyright 2011, Google Inc. // Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,8 +20,8 @@ #define TESSERACT_CCUTIL_BITVECTOR_H_ #include +#include // for uint8_t #include -#include "host.h" namespace tesseract { diff --git a/src/ccutil/errcode.h b/src/ccutil/errcode.h index 4e7739ffa9..8783cdd783 100644 --- a/src/ccutil/errcode.h +++ b/src/ccutil/errcode.h @@ -19,7 +19,7 @@ #ifndef ERRCODE_H #define ERRCODE_H -#include "host.h" +#include "platform.h" // for TESS_API /*Control parameters for error()*/ enum TessErrorLogCode { diff --git a/src/ccutil/globaloc.h b/src/ccutil/globaloc.h index 1118fbc94b..67c760e1f9 100644 --- a/src/ccutil/globaloc.h +++ b/src/ccutil/globaloc.h @@ -2,7 +2,6 @@ * File: globaloc.h (Formerly error.h) * Description: Header file for generic error handler class * Author: Ray Smith - * Created: Tue May 1 16:23:36 BST 1990 * * (C) Copyright 1990, Hewlett-Packard Ltd. ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,10 +16,8 @@ * **********************************************************************/ -#ifndef GLOBALOC_H -#define GLOBALOC_H - -#include "host.h" +#ifndef GLOBALOC_H +#define GLOBALOC_H // Saves a clone of the given pix, and notes its resolution in thread-specific // data, so that the image can be written prior to a crash. @@ -36,4 +33,5 @@ void set_global_loc_code(int loc_code); void set_global_subloc_code(int loc_code); void set_global_subsubloc_code(int loc_code); + #endif diff --git a/src/ccutil/host.h b/src/ccutil/host.h index 148399f29c..821292df23 100644 --- a/src/ccutil/host.h +++ b/src/ccutil/host.h @@ -30,9 +30,6 @@ #include // PRId32, ... #include // int32_t, ... -// definitions of portable data types (numbers and characters) -using BOOL8 = unsigned char; - #if defined(_WIN32) /* MinGW defines the standard PRI... macros, but MSVS doesn't. */ @@ -47,15 +44,6 @@ using BOOL8 = unsigned char; #endif /* _WIN32 */ -// Defines -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - // Return true if x is within tolerance of y template bool NearlyEqual(T x, T y, T tolerance) { T diff = x - y; diff --git a/src/ccutil/params.cpp b/src/ccutil/params.cpp index a9cc25d88a..864d8d4d1d 100644 --- a/src/ccutil/params.cpp +++ b/src/ccutil/params.cpp @@ -2,7 +2,6 @@ * File: params.cpp * Description: Initialization and setting of Tesseract parameters. * Author: Ray Smith - * Created: Fri Feb 22 16:22:34 GMT 1991 * * (C) Copyright 1991, Hewlett-Packard Ltd. ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -153,7 +152,7 @@ bool ParamUtils::GetParamAsString(const char *name, auto *bp = FindParam(name, GlobalParams()->bool_params, member_params->bool_params); if (bp != nullptr) { - *value = BOOL8(*bp) ? "1": "0"; + *value = bool(*bp) ? "1": "0"; return true; } // Look for the parameter among double parameters. @@ -179,7 +178,7 @@ void ParamUtils::PrintParams(FILE *fp, const ParamsVectors *member_params) { } for (i = 0; i < vec->bool_params.size(); ++i) { fprintf(fp, "%s\t%d\t%s\n", vec->bool_params[i]->name_str(), - (BOOL8)(*vec->bool_params[i]), vec->bool_params[i]->info_str()); + bool(*vec->bool_params[i]), vec->bool_params[i]->info_str()); } for (int i = 0; i < vec->string_params.size(); ++i) { fprintf(fp, "%s\t%s\t%s\n", vec->string_params[i]->name_str(), diff --git a/src/ccutil/params.h b/src/ccutil/params.h index 5cef181683..49f6f32046 100644 --- a/src/ccutil/params.h +++ b/src/ccutil/params.h @@ -22,7 +22,6 @@ #include #include "genericvector.h" -#include "host.h" // for BOOL8 #include "strngs.h" namespace tesseract { @@ -180,9 +179,9 @@ class BoolParam : public Param { vec->bool_params.push_back(this); } ~BoolParam() { ParamUtils::RemoveParam(this, params_vec_); } - operator BOOL8() const { return value_; } - void operator=(BOOL8 value) { value_ = value; } - void set_value(BOOL8 value) { value_ = value; } + operator bool() const { return value_; } + void operator=(bool value) { value_ = value; } + void set_value(bool value) { value_ = value; } void ResetToDefault() { value_ = default_; } void ResetFrom(const ParamsVectors* vec) { for (int i = 0; i < vec->bool_params.size(); ++i) { @@ -196,8 +195,8 @@ class BoolParam : public Param { } private: - BOOL8 value_; - BOOL8 default_; + bool value_; + bool default_; // Pointer to the vector that contains this param (not owned by this class). GenericVector* params_vec_; }; diff --git a/src/ccutil/unicharmap.cpp b/src/ccutil/unicharmap.cpp index 4f7b266f40..03ff4d4dca 100644 --- a/src/ccutil/unicharmap.cpp +++ b/src/ccutil/unicharmap.cpp @@ -2,7 +2,6 @@ // File: unicharmap.cpp // Description: Unicode character/ligature to integer id class. // Author: Thomas Kielbus -// Created: Wed Jun 28 17:05:01 PDT 2006 // // (C) Copyright 2006, Google Inc. // Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,7 +18,6 @@ #include #include "unichar.h" -#include "host.h" #include "unicharmap.h" UNICHARMAP::UNICHARMAP() : diff --git a/src/ccutil/unicodes.cpp b/src/ccutil/unicodes.cpp index a5c7b8bd0d..e57a311cc7 100644 --- a/src/ccutil/unicodes.cpp +++ b/src/ccutil/unicodes.cpp @@ -2,7 +2,6 @@ * File: unicodes.cpp * Description: Unicode related machinery * Author: David Eger - * Created: Wed Jun 15 16:37:50 PST 2011 * * (C) Copyright 2011, Google, Inc. ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,7 +17,6 @@ **********************************************************************/ #include "unicodes.h" -#include "host.h" // for nullptr namespace tesseract { diff --git a/src/classify/clusttool.h b/src/classify/clusttool.h index 5103cc8693..3165d8ab05 100644 --- a/src/classify/clusttool.h +++ b/src/classify/clusttool.h @@ -21,7 +21,6 @@ //--------------------------Include Files--------------------------------------- #include #include "cluster.h" -#include "host.h" #include "serialis.h" /*------------------------------------------------------------------------- diff --git a/src/classify/fpoint.h b/src/classify/fpoint.h index bce12e6583..93f5a20fed 100644 --- a/src/classify/fpoint.h +++ b/src/classify/fpoint.h @@ -24,7 +24,6 @@ ----------------------------------------------------------------------------**/ #include #include -#include "host.h" /* define data structure to hold 2D points or vectors using floating point */ typedef struct { diff --git a/src/classify/kdtree.h b/src/classify/kdtree.h index 0aa2b1b297..8aeb300e75 100644 --- a/src/classify/kdtree.h +++ b/src/classify/kdtree.h @@ -14,13 +14,13 @@ ** See the License for the specific language governing permissions and ** limitations under the License. *****************************************************************************/ + #ifndef KDTREE_H #define KDTREE_H /*----------------------------------------------------------------------------- Include Files and Type Defines -----------------------------------------------------------------------------*/ -#include "host.h" #include "ocrfeatures.h" typedef void (*void_proc)(...); @@ -92,4 +92,5 @@ void Walk(KDTREE *tree, void_proc action, void *context, void InsertNodes(KDTREE *tree, KDNODE *nodes); void FreeSubTree(KDNODE *SubTree); + #endif diff --git a/src/cutil/bitvec.h b/src/cutil/bitvec.h index 5068006633..9366e32d3c 100644 --- a/src/cutil/bitvec.h +++ b/src/cutil/bitvec.h @@ -2,7 +2,6 @@ ** Filename: bitvec.h ** Purpose: Routines for manipulating bit vectors ** Author: Dan Johnson - ** History: Wed Mar 7 17:52:45 1990, DSJ, Created. ** ** (c) Copyright Hewlett-Packard Company, 1988. ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,10 +14,11 @@ ** See the License for the specific language governing permissions and ** limitations under the License. ******************************************************************************/ + #ifndef BITVEC_H #define BITVEC_H -#include "host.h" +#include // for uint32_t /*----------------------------------------------------------------------------- Include Files and Type Defines diff --git a/src/cutil/callcpp.h b/src/cutil/callcpp.h index eacbea601c..65b3e5fff2 100644 --- a/src/cutil/callcpp.h +++ b/src/cutil/callcpp.h @@ -20,7 +20,6 @@ #ifndef CALLCPP_H #define CALLCPP_H -#include "host.h" #include "params.h" #include "unichar.h" diff --git a/src/dict/dawg.h b/src/dict/dawg.h index cd8223656b..127e73da60 100644 --- a/src/dict/dawg.h +++ b/src/dict/dawg.h @@ -26,8 +26,10 @@ I n c l u d e s ----------------------------------------------------------------------*/ +#include // for PRId64 #include #include "elst.h" +#include "host.h" // for PRId64 #include "params.h" #include "ratngs.h" #include "tesscallback.h" diff --git a/src/dict/dict.h b/src/dict/dict.h index 543f38f545..5201fe1e8a 100644 --- a/src/dict/dict.h +++ b/src/dict/dict.h @@ -22,7 +22,6 @@ #include "ambigs.h" #include "dawg.h" #include "dawg_cache.h" -#include "host.h" #include "ratngs.h" #include "stopper.h" #include "trie.h" diff --git a/src/dict/matchdefs.h b/src/dict/matchdefs.h index fe4a97091d..24737f060f 100644 --- a/src/dict/matchdefs.h +++ b/src/dict/matchdefs.h @@ -2,7 +2,6 @@ ** Filename: matchdefs.h ** Purpose: Generic interface definitions for feature matchers. ** Author: Dan Johnson - ** History: Fri Jan 19 09:21:25 1990, DSJ, Created. ** ** (c) Copyright Hewlett-Packard Company, 1988. ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +21,6 @@ /**---------------------------------------------------------------------------- Include Files and Type Defines ----------------------------------------------------------------------------**/ -#include "host.h" #include #include "unichar.h" diff --git a/src/lstm/ctc.cpp b/src/lstm/ctc.cpp index 53489dfec3..7f5714e2ee 100644 --- a/src/lstm/ctc.cpp +++ b/src/lstm/ctc.cpp @@ -22,7 +22,6 @@ #include #include "genericvector.h" -#include "host.h" #include "matrix.h" #include "networkio.h" diff --git a/src/textord/imagefind.h b/src/textord/imagefind.h index 36825d5e99..65be65dde8 100644 --- a/src/textord/imagefind.h +++ b/src/textord/imagefind.h @@ -3,7 +3,6 @@ // Description: Class to find image and drawing regions in an image // and create a corresponding list of empty blobs. // Author: Ray Smith -// Created: Fri Aug 01 10:50:01 PDT 2008 // // (C) Copyright 2008, Google Inc. // Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +21,6 @@ #define TESSERACT_TEXTORD_IMAGEFIND_H_ #include "debugpixa.h" -#include "host.h" struct Boxa; struct Pix; diff --git a/src/training/dawg2wordlist.cpp b/src/training/dawg2wordlist.cpp index def4d78465..cb0b54dd2e 100644 --- a/src/training/dawg2wordlist.cpp +++ b/src/training/dawg2wordlist.cpp @@ -2,7 +2,6 @@ // File: dawg2wordlist.cpp // Description: Program to create a word list from a DAWG and unicharset. // Author: David Eger -// Created: Thu 22 Dec 2011 // // (C) Copyright 2011, Google Inc. // Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,7 +18,6 @@ #include "commontraining.h" // CheckSharedLibraryVersion #include "dawg.h" -#include "host.h" #include "serialis.h" #include "tesscallback.h" #include "trie.h" diff --git a/src/training/mergenf.cpp b/src/training/mergenf.cpp index 029f029c62..98f84b419e 100644 --- a/src/training/mergenf.cpp +++ b/src/training/mergenf.cpp @@ -15,7 +15,6 @@ ** limitations under the License. ******************************************************************************/ #include "mergenf.h" -#include "host.h" #include "clusttool.h" #include "cluster.h" #include "oldlist.h" diff --git a/src/training/pango_font_info.h b/src/training/pango_font_info.h index a7a7e0dc90..810b16a57b 100644 --- a/src/training/pango_font_info.h +++ b/src/training/pango_font_info.h @@ -26,7 +26,6 @@ #include #include "commandlineflags.h" -#include "host.h" #include "pango/pango-font.h" #include "pango/pango.h" #include "pango/pangocairo.h" diff --git a/src/training/stringrenderer.h b/src/training/stringrenderer.h index 718ecfd288..b1bb8c0922 100644 --- a/src/training/stringrenderer.h +++ b/src/training/stringrenderer.h @@ -11,7 +11,6 @@ * be set using respective set_* methods. * * Author: Ranjith Unnikrishnan - * Created: Mon Nov 18 2013 * * (C) Copyright 2013, Google Inc. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -33,7 +32,6 @@ #include #include -#include "host.h" #include "pango_font_info.h" #include "pango/pango-layout.h" #include "pango/pangocairo.h" diff --git a/src/training/tessopt.h b/src/training/tessopt.h index 925f8f6d5a..42b27f99e4 100644 --- a/src/training/tessopt.h +++ b/src/training/tessopt.h @@ -19,7 +19,7 @@ #ifndef TESSERACT_TRAINING_TESSOPT_H_ #define TESSERACT_TRAINING_TESSOPT_H_ -#include "host.h" +#include // for int32_t extern int tessoptind; extern char *tessoptarg;