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 <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2019-03-30 13:45:50 +01:00
parent be96b7b660
commit 802f42e821
29 changed files with 23 additions and 60 deletions

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -21,6 +21,7 @@
#include <cstdio>
#include <memory> // std::unique_ptr
#include "elst.h"
#include "host.h" // for PRId32
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H

View File

@ -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"

View File

@ -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 <cstdio>
#include "host.h"
#include "kdpair.h"
#include "scrollview.h"

View File

@ -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 <cassert>
#include <cstdint> // for uint8_t
#include <cstdio>
#include "host.h"
namespace tesseract {

View File

@ -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 {

View File

@ -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

View File

@ -30,9 +30,6 @@
#include <cinttypes> // PRId32, ...
#include <cstdint> // 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<class T> bool NearlyEqual(T x, T y, T tolerance) {
T diff = x - y;

View File

@ -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<BoolParam>(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(),

View File

@ -22,7 +22,6 @@
#include <cstdio>
#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<BoolParam>(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<BoolParam*>* params_vec_;
};

View File

@ -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 <cassert>
#include "unichar.h"
#include "host.h"
#include "unicharmap.h"
UNICHARMAP::UNICHARMAP() :

View File

@ -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 {

View File

@ -21,7 +21,6 @@
//--------------------------Include Files---------------------------------------
#include <cstdio>
#include "cluster.h"
#include "host.h"
#include "serialis.h"
/*-------------------------------------------------------------------------

View File

@ -24,7 +24,6 @@
----------------------------------------------------------------------------**/
#include <cmath>
#include <cstdio>
#include "host.h"
/* define data structure to hold 2D points or vectors using floating point */
typedef struct {

View File

@ -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

View File

@ -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 <cstdint> // for uint32_t
/*-----------------------------------------------------------------------------
Include Files and Type Defines

View File

@ -20,7 +20,6 @@
#ifndef CALLCPP_H
#define CALLCPP_H
#include "host.h"
#include "params.h"
#include "unichar.h"

View File

@ -26,8 +26,10 @@
I n c l u d e s
----------------------------------------------------------------------*/
#include <cinttypes> // for PRId64
#include <memory>
#include "elst.h"
#include "host.h" // for PRId64
#include "params.h"
#include "ratngs.h"
#include "tesscallback.h"

View File

@ -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"

View File

@ -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 <cstdio>
#include "unichar.h"

View File

@ -22,7 +22,6 @@
#include <memory>
#include "genericvector.h"
#include "host.h"
#include "matrix.h"
#include "networkio.h"

View File

@ -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;

View File

@ -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"

View File

@ -15,7 +15,6 @@
** limitations under the License.
******************************************************************************/
#include "mergenf.h"
#include "host.h"
#include "clusttool.h"
#include "cluster.h"
#include "oldlist.h"

View File

@ -26,7 +26,6 @@
#include <vector>
#include "commandlineflags.h"
#include "host.h"
#include "pango/pango-font.h"
#include "pango/pango.h"
#include "pango/pangocairo.h"

View File

@ -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 <unordered_map>
#include <vector>
#include "host.h"
#include "pango_font_info.h"
#include "pango/pango-layout.h"
#include "pango/pangocairo.h"

View File

@ -19,7 +19,7 @@
#ifndef TESSERACT_TRAINING_TESSOPT_H_
#define TESSERACT_TRAINING_TESSOPT_H_
#include "host.h"
#include <cstdint> // for int32_t
extern int tessoptind;
extern char *tessoptarg;