Skip to content

Commit

Permalink
Merge pull request #2448 from stweil/pi
Browse files Browse the repository at this point in the history
Remove local definition of M_PI
  • Loading branch information
zdenop authored May 21, 2019
2 parents d6c1fa7 + d2ca81e commit b96df3a
Show file tree
Hide file tree
Showing 18 changed files with 55 additions and 60 deletions.
2 changes: 2 additions & 0 deletions src/api/baseapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 2 additions & 4 deletions src/ccstruct/points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -17,11 +16,10 @@
*
**********************************************************************/

#ifdef _MSC_VER
#define _USE_MATH_DEFINES
#endif // _MSC_VER
#define _USE_MATH_DEFINES // for M_PI

#include <algorithm>
#include <cmath> // for M_PI
#include <cstdlib>
#include "helpers.h"
#include "serialis.h"
Expand Down
6 changes: 0 additions & 6 deletions src/ccutil/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/classify/cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
** limitations under the License.
*****************************************************************************/

#define _USE_MATH_DEFINES // for M_PI
#include <cfloat> // for FLT_MAX
#include <cmath>
#include <cmath> // for M_PI
#include <vector> // for std::vector

#include "cluster.h"
Expand Down
3 changes: 2 additions & 1 deletion src/classify/clusttool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
*****************************************************************************/

//--------------------------Include Files----------------------------------
#define _USE_MATH_DEFINES // for M_PI
#include "clusttool.h"
#include <cmath> // for std::isnan
#include <cmath> // for M_PI, std::isnan
#include <locale> // for std::locale::classic
#include <sstream> // for std::stringstream
#include "emalloc.h"
Expand Down
4 changes: 2 additions & 2 deletions src/classify/fpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
/*----------------------------------------------------------------------------
Include Files and Type Defines
----------------------------------------------------------------------------*/
#define _USE_MATH_DEFINES // for M_PI
#include "fpoint.h"
#include <cstdio>
#include <cmath>
#include "platform.h" // M_PI
#include <cmath> // for M_PI

/*----------------------------------------------------------------------------
Public Code
Expand Down
3 changes: 2 additions & 1 deletion src/classify/intfeaturespace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -17,7 +16,9 @@
//
///////////////////////////////////////////////////////////////////////

#define _USE_MATH_DEFINES // for M_PI
#include "intfeaturespace.h"
#include <cmath> // for M_PI
#include "intfx.h"

namespace tesseract {
Expand Down
17 changes: 8 additions & 9 deletions src/classify/intfx.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
/******************************************************************************
** Filename: intfx.c
** Purpose: Integer character normalization & feature extraction
** Author: Robert Moss, [email protected] (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, [email protected] (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
Expand All @@ -21,7 +17,10 @@
/**----------------------------------------------------------------------------
Include Files and Type Defines
----------------------------------------------------------------------------**/

#define _USE_MATH_DEFINES // for M_PI
#include "intfx.h"
#include <cmath> // for M_PI
#include "allheaders.h"
#include "ccutil.h"
#include "classify.h"
Expand Down Expand Up @@ -49,7 +48,7 @@ tesseract::CCUtilMutex atan_table_mutex;
/**----------------------------------------------------------------------------
Public Code
----------------------------------------------------------------------------**/
/*---------------------------------------------------------------------------*/

void InitIntegerFX() {
static bool atan_table_init = false;
atan_table_mutex.Lock();
Expand Down
3 changes: 2 additions & 1 deletion src/classify/intproto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
Include Files and Type Defines
-----------------------------------------------------------------------------*/

#define _USE_MATH_DEFINES // for M_PI
#include <algorithm>
#include <cmath> // for std::floor
#include <cmath> // for M_PI, std::floor
#include <cstdio>
#include <cassert>

Expand Down
15 changes: 8 additions & 7 deletions src/classify/mfx.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -17,16 +17,17 @@
/*----------------------------------------------------------------------------
Include Files and Type Defines
----------------------------------------------------------------------------*/

#define _USE_MATH_DEFINES // for M_PI
#include "mfx.h"
#include <cmath> // 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 <cmath>

/*----------------------------------------------------------------------------
Variables
----------------------------------------------------------------------------*/
Expand Down
6 changes: 3 additions & 3 deletions src/classify/protos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
/*----------------------------------------------------------------------
I n c l u d e s
----------------------------------------------------------------------*/
#define _USE_MATH_DEFINES // for M_PI
#include "protos.h"
#include <cmath> // for M_PI
#include <cstdio>
#include "emalloc.h"
#include "callcpp.h"
#include "tprintf.h"
#include "classify.h"
#include "params.h"
#include "intproto.h"

#include <cstdio>
#include <cmath>

#define PROTO_INCREMENT 32
#define CONFIG_INCREMENT 16

Expand Down
3 changes: 2 additions & 1 deletion src/classify/trainingsample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
//
///////////////////////////////////////////////////////////////////////

#define _USE_MATH_DEFINES // for M_PI
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif

#include "trainingsample.h"

#include <cmath>
#include <cmath> // for M_PI
#include "allheaders.h"
#include "helpers.h"
#include "intfeaturemap.h"
Expand Down
9 changes: 3 additions & 6 deletions src/textord/baselinedetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// Description: Initial Baseline Determination.
// Copyright 2012 Google Inc. All Rights Reserved.
// Author: [email protected] (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.
Expand All @@ -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"
Expand All @@ -28,8 +25,8 @@
#include "baselinedetect.h"

#include <algorithm>
#include <cfloat> // for FLT_MAX
#include <cmath>
#include <cfloat> // for FLT_MAX
#include <cmath> // for M_PI
#include "allheaders.h"
#include "blobbox.h"
#include "detlinefit.h"
Expand Down
2 changes: 1 addition & 1 deletion src/textord/tordmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -17,6 +16,7 @@
*
**********************************************************************/

#define _USE_MATH_DEFINES // for M_PI
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
Expand Down
11 changes: 3 additions & 8 deletions src/training/commontraining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <algorithm>
#include <cmath> // for M_PI

#ifdef DISABLED_LEGACY_ENGINE

#include <algorithm>
#include <cmath>

#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");
Expand All @@ -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
Expand All @@ -59,9 +57,6 @@ void ParseArguments(int* argc, char ***argv) {

#else

#include <algorithm>
#include <cmath>

#include "allheaders.h"
#include "ccutil.h"
#include "classify.h"
Expand Down
13 changes: 8 additions & 5 deletions src/training/mergenf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <algorithm>
#include <cfloat> // for FLT_MAX
#include <cmath> // for M_PI
#include <cstdio>
#include <cstring>

#include "mergenf.h"
#include "clusttool.h"
#include "cluster.h"
Expand All @@ -24,11 +32,6 @@
#include "intproto.h"
#include "params.h"

#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>

/*-------------------once in subfeat---------------------------------*/
double_VAR(training_angle_match_scale, 1.0, "Angle Match Scale ...");

Expand Down
5 changes: 3 additions & 2 deletions src/training/mftraining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <cmath> // for M_PI
#include <cstring>
#include <cstdio>
#define _USE_MATH_DEFINES
#include <cmath>

#include "classify.h"
#include "cluster.h"
Expand Down
4 changes: 2 additions & 2 deletions src/wordrec/chop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
I n c l u d e s
----------------------------------------------------------------------*/

#define _USE_MATH_DEFINES // for M_PI
#include <cmath> // for M_PI
#include "chop.h"
#include "outlines.h"
#include "callcpp.h"
#include "plotedges.h"
#include "wordrec.h"

#include <cmath>

// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
Expand Down

0 comments on commit b96df3a

Please sign in to comment.