diff --git a/src/api/baseapi.cpp b/src/api/baseapi.cpp index 5311a17de..a29119fcb 100644 --- a/src/api/baseapi.cpp +++ b/src/api/baseapi.cpp @@ -16,6 +16,8 @@ * **********************************************************************/ +#define _USE_MATH_DEFINES // for M_PI + // Include automatically generated configuration file if running autoconf. #ifdef HAVE_CONFIG_H #include "config_auto.h" diff --git a/src/ccstruct/points.cpp b/src/ccstruct/points.cpp index f70960156..9d58a7712 100644 --- a/src/ccstruct/points.cpp +++ b/src/ccstruct/points.cpp @@ -2,7 +2,6 @@ * File: points.cpp (Formerly coords.c) * Description: Member functions for coordinate classes. * Author: Ray Smith - * Created: Fri Mar 15 08:58:17 GMT 1991 * * (C) Copyright 1991, Hewlett-Packard Ltd. ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,11 +16,10 @@ * **********************************************************************/ -#ifdef _MSC_VER -#define _USE_MATH_DEFINES -#endif // _MSC_VER +#define _USE_MATH_DEFINES // for M_PI #include +#include // for M_PI #include #include "helpers.h" #include "serialis.h" diff --git a/src/ccutil/platform.h b/src/ccutil/platform.h index 0c7c300f6..99424bc8b 100644 --- a/src/ccutil/platform.h +++ b/src/ccutil/platform.h @@ -32,12 +32,6 @@ # endif #endif -#if defined(_WIN32) || defined(__CYGWIN__) -# ifndef M_PI -# define M_PI 3.14159265358979323846 -# endif -#endif - #if defined(_WIN32) || defined(__CYGWIN__) # if defined(TESS_EXPORTS) # define TESS_API __declspec(dllexport) diff --git a/src/classify/cluster.cpp b/src/classify/cluster.cpp index 660efb2d4..b4e23d846 100644 --- a/src/classify/cluster.cpp +++ b/src/classify/cluster.cpp @@ -15,8 +15,9 @@ ** limitations under the License. *****************************************************************************/ +#define _USE_MATH_DEFINES // for M_PI #include // for FLT_MAX -#include +#include // for M_PI #include // for std::vector #include "cluster.h" diff --git a/src/classify/clusttool.cpp b/src/classify/clusttool.cpp index 172c32cec..f7ac876c8 100644 --- a/src/classify/clusttool.cpp +++ b/src/classify/clusttool.cpp @@ -16,8 +16,9 @@ *****************************************************************************/ //--------------------------Include Files---------------------------------- +#define _USE_MATH_DEFINES // for M_PI #include "clusttool.h" -#include // for std::isnan +#include // for M_PI, std::isnan #include // for std::locale::classic #include // for std::stringstream #include "emalloc.h" diff --git a/src/classify/fpoint.cpp b/src/classify/fpoint.cpp index 8ea4a1ac9..333b1fc70 100644 --- a/src/classify/fpoint.cpp +++ b/src/classify/fpoint.cpp @@ -17,10 +17,10 @@ /*---------------------------------------------------------------------------- Include Files and Type Defines ----------------------------------------------------------------------------*/ +#define _USE_MATH_DEFINES // for M_PI #include "fpoint.h" #include -#include -#include "platform.h" // M_PI +#include // for M_PI /*---------------------------------------------------------------------------- Public Code diff --git a/src/classify/intfeaturespace.cpp b/src/classify/intfeaturespace.cpp index 0e14d9284..9ddd97776 100644 --- a/src/classify/intfeaturespace.cpp +++ b/src/classify/intfeaturespace.cpp @@ -3,7 +3,6 @@ /////////////////////////////////////////////////////////////////////// // File: intfeaturespace.cpp // Description: Indexed feature space based on INT_FEATURE_STRUCT. -// Created: Wed Mar 24 11:21:27 PDT 2010 // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -17,7 +16,9 @@ // /////////////////////////////////////////////////////////////////////// +#define _USE_MATH_DEFINES // for M_PI #include "intfeaturespace.h" +#include // for M_PI #include "intfx.h" namespace tesseract { diff --git a/src/classify/intfx.cpp b/src/classify/intfx.cpp index 93311819a..02d1d3cec 100644 --- a/src/classify/intfx.cpp +++ b/src/classify/intfx.cpp @@ -1,13 +1,9 @@ /****************************************************************************** - ** Filename: intfx.c - ** Purpose: Integer character normalization & feature extraction - ** Author: Robert Moss, rays@google.com (Ray Smith) - ** History: Tue May 21 15:51:57 MDT 1991, RWM, Created. - ** Tue Feb 28 10:42:00 PST 2012, vastly rewritten to allow - greyscale fx and non-linear - normalization. + ** Filename: intfx.c + ** Purpose: Integer character normalization & feature extraction + ** Author: Robert Moss, rays@google.com (Ray Smith) ** - ** (c) Copyright Hewlett-Packard Company, 1988. + ** (c) Copyright Hewlett-Packard Company, 1988. ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at @@ -21,7 +17,10 @@ /**---------------------------------------------------------------------------- Include Files and Type Defines ----------------------------------------------------------------------------**/ + +#define _USE_MATH_DEFINES // for M_PI #include "intfx.h" +#include // for M_PI #include "allheaders.h" #include "ccutil.h" #include "classify.h" @@ -49,7 +48,7 @@ tesseract::CCUtilMutex atan_table_mutex; /**---------------------------------------------------------------------------- Public Code ----------------------------------------------------------------------------**/ -/*---------------------------------------------------------------------------*/ + void InitIntegerFX() { static bool atan_table_init = false; atan_table_mutex.Lock(); diff --git a/src/classify/intproto.cpp b/src/classify/intproto.cpp index 45690e35e..f1982b822 100644 --- a/src/classify/intproto.cpp +++ b/src/classify/intproto.cpp @@ -18,8 +18,9 @@ Include Files and Type Defines -----------------------------------------------------------------------------*/ +#define _USE_MATH_DEFINES // for M_PI #include -#include // for std::floor +#include // for M_PI, std::floor #include #include diff --git a/src/classify/mfx.cpp b/src/classify/mfx.cpp index f88b5b75e..ac46a0142 100644 --- a/src/classify/mfx.cpp +++ b/src/classify/mfx.cpp @@ -1,9 +1,9 @@ /****************************************************************************** - ** Filename: mfx.c - ** Purpose: Micro feature extraction routines - ** Author: Dan Johnson + ** Filename: mfx.c + ** Purpose: Micro feature extraction routines + ** Author: Dan Johnson ** - ** (c) Copyright Hewlett-Packard Company, 1988. + ** (c) Copyright Hewlett-Packard Company, 1988. ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at @@ -17,16 +17,17 @@ /*---------------------------------------------------------------------------- Include Files and Type Defines ----------------------------------------------------------------------------*/ + +#define _USE_MATH_DEFINES // for M_PI #include "mfx.h" +#include // for M_PI #include "mfdefs.h" #include "mfoutline.h" -#include "clusttool.h" //NEEDED +#include "clusttool.h" //NEEDED #include "intfx.h" #include "normalis.h" #include "params.h" -#include - /*---------------------------------------------------------------------------- Variables ----------------------------------------------------------------------------*/ diff --git a/src/classify/protos.cpp b/src/classify/protos.cpp index c4a67c0e1..61f368d62 100644 --- a/src/classify/protos.cpp +++ b/src/classify/protos.cpp @@ -19,7 +19,10 @@ /*---------------------------------------------------------------------- I n c l u d e s ----------------------------------------------------------------------*/ +#define _USE_MATH_DEFINES // for M_PI #include "protos.h" +#include // for M_PI +#include #include "emalloc.h" #include "callcpp.h" #include "tprintf.h" @@ -27,9 +30,6 @@ #include "params.h" #include "intproto.h" -#include -#include - #define PROTO_INCREMENT 32 #define CONFIG_INCREMENT 16 diff --git a/src/classify/trainingsample.cpp b/src/classify/trainingsample.cpp index 7db95053a..3b2729940 100644 --- a/src/classify/trainingsample.cpp +++ b/src/classify/trainingsample.cpp @@ -13,6 +13,7 @@ // /////////////////////////////////////////////////////////////////////// +#define _USE_MATH_DEFINES // for M_PI // Include automatically generated configuration file if running autoconf. #ifdef HAVE_CONFIG_H #include "config_auto.h" @@ -20,7 +21,7 @@ #include "trainingsample.h" -#include +#include // for M_PI #include "allheaders.h" #include "helpers.h" #include "intfeaturemap.h" diff --git a/src/textord/baselinedetect.cpp b/src/textord/baselinedetect.cpp index 92536ae87..84fddbb12 100644 --- a/src/textord/baselinedetect.cpp +++ b/src/textord/baselinedetect.cpp @@ -3,7 +3,6 @@ // Description: Initial Baseline Determination. // Copyright 2012 Google Inc. All Rights Reserved. // Author: rays@google.com (Ray Smith) -// Created: Mon Apr 30 10:15:31 PDT 2012 // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -17,9 +16,7 @@ // /////////////////////////////////////////////////////////////////////// -#ifdef _MSC_VER -#define _USE_MATH_DEFINES -#endif // _MSC_VER +#define _USE_MATH_DEFINES // for M_PI #ifdef HAVE_CONFIG_H #include "config_auto.h" @@ -28,8 +25,8 @@ #include "baselinedetect.h" #include -#include // for FLT_MAX -#include +#include // for FLT_MAX +#include // for M_PI #include "allheaders.h" #include "blobbox.h" #include "detlinefit.h" diff --git a/src/textord/tordmain.cpp b/src/textord/tordmain.cpp index afb2263a0..893523241 100644 --- a/src/textord/tordmain.cpp +++ b/src/textord/tordmain.cpp @@ -2,7 +2,6 @@ * File: tordmain.cpp (Formerly textordp.c) * Description: C++ top level textord code. * Author: Ray Smith - * Created: Tue Jul 28 17:12:33 BST 1992 * * (C) Copyright 1992, Hewlett-Packard Ltd. ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,6 +16,7 @@ * **********************************************************************/ +#define _USE_MATH_DEFINES // for M_PI #ifdef HAVE_CONFIG_H #include "config_auto.h" #endif diff --git a/src/training/commontraining.cpp b/src/training/commontraining.cpp index 4ce5c173c..0e7747a33 100644 --- a/src/training/commontraining.cpp +++ b/src/training/commontraining.cpp @@ -11,18 +11,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +#define _USE_MATH_DEFINES // for M_PI #include "commontraining.h" +#include +#include // for M_PI #ifdef DISABLED_LEGACY_ENGINE -#include -#include - #include "params.h" #include "tessopt.h" #include "tprintf.h" - INT_PARAM_FLAG(debug_level, 0, "Level of Trainer debugging"); INT_PARAM_FLAG(load_images, 0, "Load images with tr files"); STRING_PARAM_FLAG(configfile, "", "File to load more configs from"); @@ -34,7 +33,6 @@ STRING_PARAM_FLAG(O, "", "File to write unicharset to"); STRING_PARAM_FLAG(output_trainer, "", "File to write trainer to"); STRING_PARAM_FLAG(test_ch, "", "UTF8 test character string"); - /** * This routine parses the command line arguments that were * passed to the program and uses them to set relevant @@ -59,9 +57,6 @@ void ParseArguments(int* argc, char ***argv) { #else -#include -#include - #include "allheaders.h" #include "ccutil.h" #include "classify.h" diff --git a/src/training/mergenf.cpp b/src/training/mergenf.cpp index 041a13b97..59106bd07 100644 --- a/src/training/mergenf.cpp +++ b/src/training/mergenf.cpp @@ -14,6 +14,14 @@ ** See the License for the specific language governing permissions and ** limitations under the License. ******************************************************************************/ + +#define _USE_MATH_DEFINES // for M_PI +#include +#include // for FLT_MAX +#include // for M_PI +#include +#include + #include "mergenf.h" #include "clusttool.h" #include "cluster.h" @@ -24,11 +32,6 @@ #include "intproto.h" #include "params.h" -#include -#include -#include -#include - /*-------------------once in subfeat---------------------------------*/ double_VAR(training_angle_match_scale, 1.0, "Angle Match Scale ..."); diff --git a/src/training/mftraining.cpp b/src/training/mftraining.cpp index fd2c115d0..b37ef0a57 100644 --- a/src/training/mftraining.cpp +++ b/src/training/mftraining.cpp @@ -20,14 +20,15 @@ /*---------------------------------------------------------------------------- Include Files and Type Defines ----------------------------------------------------------------------------*/ + +#define _USE_MATH_DEFINES // for M_PI #ifdef HAVE_CONFIG_H #include "config_auto.h" #endif +#include // for M_PI #include #include -#define _USE_MATH_DEFINES -#include #include "classify.h" #include "cluster.h" diff --git a/src/wordrec/chop.cpp b/src/wordrec/chop.cpp index 14a16010b..651ebd378 100644 --- a/src/wordrec/chop.cpp +++ b/src/wordrec/chop.cpp @@ -21,14 +21,14 @@ I n c l u d e s ----------------------------------------------------------------------*/ +#define _USE_MATH_DEFINES // for M_PI +#include // for M_PI #include "chop.h" #include "outlines.h" #include "callcpp.h" #include "plotedges.h" #include "wordrec.h" -#include - // Include automatically generated configuration file if running autoconf. #ifdef HAVE_CONFIG_H #include "config_auto.h"