Skip to content

Commit

Permalink
Clean some include statements
Browse files Browse the repository at this point in the history
The changes are based on an analysis done with include-what-you-use.

Replace also some standard header files by the corresponding
standard C++ header files.

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Jun 23, 2018
1 parent 15f64e0 commit 1a15178
Show file tree
Hide file tree
Showing 22 changed files with 143 additions and 100 deletions.
1 change: 0 additions & 1 deletion src/arch/dotproductavx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ double DotProductAVX(const double* u, const double* v, int n) {
#include <immintrin.h>
#include <cstdint>
#include "dotproductavx.h"
#include "host.h"

namespace tesseract {

Expand Down
1 change: 0 additions & 1 deletion src/arch/dotproductsse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ int32_t IntDotProductSSE(const int8_t* u, const int8_t* v, int n) {
#include <smmintrin.h>
#include <cstdint>
#include "dotproductsse.h"
#include "host.h"

namespace tesseract {

Expand Down
2 changes: 0 additions & 2 deletions src/arch/dotproductsse.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#ifndef TESSERACT_ARCH_DOTPRODUCTSSE_H_
#define TESSERACT_ARCH_DOTPRODUCTSSE_H_

#include "host.h"

namespace tesseract {

// Computes and returns the dot product of the n-vectors u and v.
Expand Down
8 changes: 5 additions & 3 deletions src/arch/intsimdmatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
///////////////////////////////////////////////////////////////////////

#include "intsimdmatrix.h"
#include "intsimdmatrixavx2.h"
#include "intsimdmatrixsse.h"
#include "simddetect.h"
#include "genericvector.h" // for GenericVector
#include "intsimdmatrixavx2.h" // for IntSimdMatrixAVX2
#include "intsimdmatrixsse.h" // for IntSimdMatrixSSE
#include "matrix.h" // for GENERIC_2D_ARRAY
#include "simddetect.h" // for SIMDDetect

namespace tesseract {

Expand Down
5 changes: 3 additions & 2 deletions src/arch/intsimdmatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@

#include <cstdint>
#include <vector>
#include "genericvector.h"
#include "matrix.h"

template <class T> class GENERIC_2D_ARRAY;
template <typename T> class GenericVector;

namespace tesseract {

Expand Down
1 change: 0 additions & 1 deletion src/arch/simddetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
///////////////////////////////////////////////////////////////////////

#include "simddetect.h"
#include "tprintf.h"

#undef X86_BUILD
#if defined(__x86_64__) || defined(__i386__) || defined(_WIN32)
Expand Down
8 changes: 5 additions & 3 deletions src/ccmain/ltrresultiterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@
#ifndef TESSERACT_CCMAIN_LTR_RESULT_ITERATOR_H_
#define TESSERACT_CCMAIN_LTR_RESULT_ITERATOR_H_

#include "platform.h"
#include "pageiterator.h"
#include "unichar.h"
#include "pageiterator.h" // for PageIterator
#include "platform.h" // for TESS_API
#include "publictypes.h" // for PageIteratorLevel
#include "unichar.h" // for StrongScriptDirection

class BLOB_CHOICE_IT;
class PAGE_RES;
class WERD_RES;

namespace tesseract {
Expand Down
13 changes: 9 additions & 4 deletions src/ccstruct/blamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@
///////////////////////////////////////////////////////////////////////

#include "blamer.h"
#include "blobs.h"
#include "matrix.h"
#include "normalis.h"
#include "pageres.h"
#include <math.h> // for abs
#include <stdlib.h> // for abs
#include "blobs.h" // for TPOINT, TWERD, TBLOB
#include "errcode.h" // for ASSERT_HOST
#include "matrix.h" // for MATRIX
#include "normalis.h" // for DENORM
#include "pageres.h" // for WERD_RES
#include "tesscallback.h" // for TessResultCallback2
#include "unicharset.h" // for UNICHARSET

// Names for each value of IncorrectResultReason enum. Keep in sync.
const char kBlameCorrect[] = "corr";
Expand Down
21 changes: 13 additions & 8 deletions src/ccstruct/blobbox.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**********************************************************************
* File: blobbox.cpp (Formerly blobnbox.c)
* Description: Code for the textord blob class.
* Author: Ray Smith
* Created: Thu Jul 30 09:08:51 BST 1992
* Author: Ray Smith
* Created: Thu Jul 30 09:08:51 BST 1992
*
* (C) Copyright 1992, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -23,12 +23,17 @@
#endif

#include "blobbox.h"
#include "allheaders.h"
#include "blobs.h"
#include "helpers.h"
#include "normalis.h"

#include <algorithm>
#include <stdint.h> // for INT32_MAX, INT16_MAX
#include <algorithm> // for max, min
#include "allheaders.h" // for pixGetHeight, pixGetPixel
#include "blobs.h" // for TPOINT
#include "coutln.h" // for C_OUTLINE_IT, C_OUTLINE, C_OUTLINE_LIST
#include "environ.h" // for l_uint32
#include "helpers.h" // for UpdateRange, IntCastRounded
#include "host.h" // for NearlyEqual, TRUE
#include "ipoints.h" // for operator+=, ICOORD::rotate

struct Pix;

#define PROJECTION_MARGIN 10 //arbitrary
#define EXTERN
Expand Down
20 changes: 13 additions & 7 deletions src/ccstruct/coutln.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,20 @@
*
**********************************************************************/

#include <algorithm>
#include <cstring>

#include "coutln.h"

#include "allheaders.h"
#include "blobs.h"
#include "normalis.h"
#include <algorithm> // for max, min
#include <cmath> // for abs
#include <cstdlib> // for abs
#include <cstring> // for memset, memcpy, memmove
#include "allheaders.h" // for pixSetPixel, pixGetData, pixRasterop, pixGe...
#include "arrayaccess.h" // for GET_DATA_BYTE
#include "blobs.h" // for TPOINT
#include "crakedge.h" // for CRACKEDGE
#include "environ.h" // for l_uint32
#include "errcode.h" // for ASSERT_HOST
#include "helpers.h" // for ClipToRange, IntCastRounded, Modulo
#include "normalis.h" // for DENORM
#include "pix.h" // for Pix (ptr only), PIX_DST, PIX_NOT

// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
Expand Down
23 changes: 15 additions & 8 deletions src/ccstruct/coutln.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,24 @@
*
**********************************************************************/

#ifndef COUTLN_H
#define COUTLN_H
#ifndef COUTLN_H
#define COUTLN_H

#include "crakedge.h"
#include "mod128.h"
#include "bits16.h"
#include "rect.h"
#include "blckerr.h"
#include "scrollview.h"
#include <cstdint> // for int16_t, int32_t
#include "bits16.h" // for BITS16
#include "elst.h" // for ELIST_ITERATOR, ELISTIZEH, ELIST_LINK
#include "ipoints.h" // for operator+=
#include "memry.h" // for free_mem
#include "mod128.h" // for DIR128, DIRBITS
#include "platform.h" // for DLLSYM
#include "points.h" // for ICOORD, FCOORD
#include "rect.h" // for TBOX
#include "scrollview.h" // for ScrollView, ScrollView::Color

class CRACKEDGE;
class C_OUTLINE;
class DENORM;
struct Pix;

#define INTERSECTING INT16_MAX//no winding number

Expand Down
2 changes: 1 addition & 1 deletion src/ccstruct/dppoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#ifndef TESSERACT_CCSTRUCT_DPPOINT_H_
#define TESSERACT_CCSTRUCT_DPPOINT_H_

#include "host.h"
#include <cstdint>

namespace tesseract {

Expand Down
5 changes: 2 additions & 3 deletions src/ccstruct/fontinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,16 @@
#ifndef TESSERACT_CCSTRUCT_FONTINFO_H_
#define TESSERACT_CCSTRUCT_FONTINFO_H_

#include <cstdint> // for uint16_t, uint32_t
#include <cstdio> // for FILE
#include "errcode.h"
#include "genericvector.h"
#include "host.h"
#include "unichar.h"

template <typename T> class UnicityTable;

namespace tesseract {

class BitVector;

// Simple struct to hold a font and a score. The scores come from the low-level
// integer matcher, so they are in the uint16_t range. Fonts are an index to
// fontinfo_table.
Expand Down
13 changes: 8 additions & 5 deletions src/ccstruct/imagedata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@
#include <thread>
#endif

#include "allheaders.h"
#include "boxread.h"
#include "callcpp.h"
#include "helpers.h"
#include "tprintf.h"
#include "allheaders.h" // for pixDestroy, pixGetHeight, pixGetWidth, lept_...
#include "boxread.h" // for ReadMemBoxes
#include "callcpp.h" // for window_wait
#include "helpers.h" // for IntCastRounded, TRand, ClipToRange, Modulo
#include "rect.h" // for TBOX
#include "scrollview.h" // for ScrollView, ScrollView::CYAN, ScrollView::NONE
#include "serialis.h" // for TFile
#include "tprintf.h" // for tprintf

// Number of documents to read ahead while training. Doesn't need to be very
// large.
Expand Down
16 changes: 9 additions & 7 deletions src/ccstruct/imagedata.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@
#ifndef TESSERACT_IMAGE_IMAGEDATA_H_
#define TESSERACT_IMAGE_IMAGEDATA_H_

#include "genericvector.h" // for GenericVector, PointerVector, FileReader
#include "points.h" // for FCOORD
#include "strngs.h" // for STRING
#include "svutil.h" // for SVAutoLock, SVMutex

#include "genericvector.h"
#include "normalis.h"
#include "rect.h"
#include "strngs.h"
#include "svutil.h"

class ScrollView;
class TBOX;
struct Pix;

namespace tesseract {

class TFile;

// Amount of padding to apply in output pixels in feature mode.
const int kFeaturePadding = 2;
// Number of pixels to pad around text boxes.
Expand Down Expand Up @@ -118,7 +120,7 @@ class ImageData {
// Reads from the given file. Returns false in case of error.
bool DeSerialize(TFile* fp);
// As DeSerialize, but only seeks past the data - hence a static method.
static bool SkipDeSerialize(tesseract::TFile* fp);
static bool SkipDeSerialize(TFile* fp);

// Other accessors.
const STRING& imagefilename() const {
Expand Down
11 changes: 6 additions & 5 deletions src/ccstruct/ipoints.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**********************************************************************
* File: ipoints.h (Formerly icoords.h)
* Description: Inline functions for coords.h.
* Author: Ray Smith
* Created: Fri Jun 21 15:14:21 BST 1991
* Author: Ray Smith
* Created: Fri Jun 21 15:14:21 BST 1991
*
* (C) Copyright 1991, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -17,10 +17,11 @@
*
**********************************************************************/

#ifndef IPOINTS_H
#define IPOINTS_H
#ifndef IPOINTS_H
#define IPOINTS_H

#include <math.h>
#include <cmath>
#include "points.h" // ICOORD

/**********************************************************************
* operator!
Expand Down
23 changes: 19 additions & 4 deletions src/ccstruct/pageres.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,26 @@
*
**********************************************************************/

#include <stdlib.h>
#include <cassert>
#include "blamer.h"
#include "pageres.h"
#include "blobs.h"
#include <cassert> // for assert
#include <cstdint> // for INT32_MAX
#include <cstring> // for strlen
#include "blamer.h" // for BlamerBundle
#include "blobs.h" // for TWERD, TBLOB
#include "boxword.h" // for BoxWord
#include "errcode.h" // for ASSERT_HOST
#include "host.h" // for TRUE, FALSE
#include "ocrblock.h" // for BLOCK_IT, BLOCK, BLOCK_LIST (ptr only)
#include "ocrrow.h" // for ROW, ROW_IT
#include "pdblock.h" // for PDBLK
#include "polyblk.h" // for POLY_BLOCK
#include "publictypes.h" // for OcrEngineMode, OEM_LSTM_ONLY
#include "seam.h" // for SEAM, start_seam_list
#include "stepblob.h" // for C_BLOB_IT, C_BLOB, C_BLOB_LIST
#include "tesscallback.h" // for NewPermanentTessCallback, TessResultCallback2
#include "tprintf.h" // for tprintf

struct Pix;

ELISTIZE (BLOCK_RES)
CLISTIZE (BLOCK_RES) ELISTIZE (ROW_RES) ELISTIZE (WERD_RES)
Expand Down
17 changes: 13 additions & 4 deletions src/ccstruct/polyaprx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,22 @@
*
**********************************************************************/

#include <stdio.h>
#define FASTEDGELENGTH 256
#include "polyaprx.h"
#include "params.h"
#include "tprintf.h"
#include <cstdint> // for INT16_MAX, int8_t
#include "blobs.h" // for EDGEPT, TPOINT, VECTOR, TESSLINE
#include "coutln.h" // for C_OUTLINE
#include "errcode.h" // for ASSERT_HOST
#include "host.h" // for FALSE, TRUE
#include "ipoints.h" // for operator+=, operator*=
#include "mod128.h" // for DIR128
#include "params.h" // for BoolParam, BOOL_VAR
#include "points.h" // for ICOORD
#include "rect.h" // for TBOX
#include "tprintf.h" // for tprintf
#include "vecfuncs.h" // for LENGTH, point_diff, CROSS

#define EXTERN
#define FASTEDGELENGTH 256

EXTERN BOOL_VAR(poly_debug, FALSE, "Debug old poly");
EXTERN BOOL_VAR(poly_wide_objects_better, TRUE,
Expand Down
7 changes: 3 additions & 4 deletions src/ccutil/memry.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
*
**********************************************************************/

#ifndef MEMRY_H
#define MEMRY_H
#ifndef MEMRY_H
#define MEMRY_H

#include <stddef.h>
#include "host.h"
#include <cstdint>

// allocate string
extern char *alloc_string(int32_t count);
Expand Down
14 changes: 6 additions & 8 deletions src/ccutil/strngs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@
**********************************************************************/

#include "strngs.h"

#include <cassert>

#include "errcode.h"
#include "genericvector.h"
#include "helpers.h"
#include "serialis.h"
#include "tprintf.h"
#include <cassert> // for assert
#include "errcode.h" // for ASSERT_HOST
#include "genericvector.h" // for GenericVector
#include "helpers.h" // for ReverseN
#include "memry.h" // for alloc_string, free_string
#include "serialis.h" // for TFile

using tesseract::TFile;

Expand Down
Loading

0 comments on commit 1a15178

Please sign in to comment.