Merge pull request #2448 from stweil/pi

Remove local definition of M_PI
This commit is contained in:
zdenop 2019-05-21 11:47:51 +02:00 committed by GitHub
commit b96df3a33a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 55 additions and 60 deletions

View File

@ -16,6 +16,8 @@
* *
**********************************************************************/ **********************************************************************/
#define _USE_MATH_DEFINES // for M_PI
// Include automatically generated configuration file if running autoconf. // Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config_auto.h" #include "config_auto.h"

View File

@ -2,7 +2,6 @@
* File: points.cpp (Formerly coords.c) * File: points.cpp (Formerly coords.c)
* Description: Member functions for coordinate classes. * Description: Member functions for coordinate classes.
* Author: Ray Smith * Author: Ray Smith
* Created: Fri Mar 15 08:58:17 GMT 1991
* *
* (C) Copyright 1991, Hewlett-Packard Ltd. * (C) Copyright 1991, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License"); ** Licensed under the Apache License, Version 2.0 (the "License");
@ -17,11 +16,10 @@
* *
**********************************************************************/ **********************************************************************/
#ifdef _MSC_VER #define _USE_MATH_DEFINES // for M_PI
#define _USE_MATH_DEFINES
#endif // _MSC_VER
#include <algorithm> #include <algorithm>
#include <cmath> // for M_PI
#include <cstdlib> #include <cstdlib>
#include "helpers.h" #include "helpers.h"
#include "serialis.h" #include "serialis.h"

View File

@ -32,12 +32,6 @@
# endif # endif
#endif #endif
#if defined(_WIN32) || defined(__CYGWIN__)
# ifndef M_PI
# define M_PI 3.14159265358979323846
# endif
#endif
#if defined(_WIN32) || defined(__CYGWIN__) #if defined(_WIN32) || defined(__CYGWIN__)
# if defined(TESS_EXPORTS) # if defined(TESS_EXPORTS)
# define TESS_API __declspec(dllexport) # define TESS_API __declspec(dllexport)

View File

@ -15,8 +15,9 @@
** limitations under the License. ** limitations under the License.
*****************************************************************************/ *****************************************************************************/
#define _USE_MATH_DEFINES // for M_PI
#include <cfloat> // for FLT_MAX #include <cfloat> // for FLT_MAX
#include <cmath> #include <cmath> // for M_PI
#include <vector> // for std::vector #include <vector> // for std::vector
#include "cluster.h" #include "cluster.h"

View File

@ -16,8 +16,9 @@
*****************************************************************************/ *****************************************************************************/
//--------------------------Include Files---------------------------------- //--------------------------Include Files----------------------------------
#define _USE_MATH_DEFINES // for M_PI
#include "clusttool.h" #include "clusttool.h"
#include <cmath> // for std::isnan #include <cmath> // for M_PI, std::isnan
#include <locale> // for std::locale::classic #include <locale> // for std::locale::classic
#include <sstream> // for std::stringstream #include <sstream> // for std::stringstream
#include "emalloc.h" #include "emalloc.h"

View File

@ -17,10 +17,10 @@
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
Include Files and Type Defines Include Files and Type Defines
----------------------------------------------------------------------------*/ ----------------------------------------------------------------------------*/
#define _USE_MATH_DEFINES // for M_PI
#include "fpoint.h" #include "fpoint.h"
#include <cstdio> #include <cstdio>
#include <cmath> #include <cmath> // for M_PI
#include "platform.h" // M_PI
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
Public Code Public Code

View File

@ -3,7 +3,6 @@
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// File: intfeaturespace.cpp // File: intfeaturespace.cpp
// Description: Indexed feature space based on INT_FEATURE_STRUCT. // 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"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with 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 "intfeaturespace.h"
#include <cmath> // for M_PI
#include "intfx.h" #include "intfx.h"
namespace tesseract { namespace tesseract {

View File

@ -1,13 +1,9 @@
/****************************************************************************** /******************************************************************************
** Filename: intfx.c ** Filename: intfx.c
** Purpose: Integer character normalization & feature extraction ** Purpose: Integer character normalization & feature extraction
** Author: Robert Moss, rays@google.com (Ray Smith) ** 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.
** **
** (c) Copyright Hewlett-Packard Company, 1988. ** (c) Copyright Hewlett-Packard Company, 1988.
** Licensed under the Apache License, Version 2.0 (the "License"); ** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License. ** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at ** You may obtain a copy of the License at
@ -21,7 +17,10 @@
/**---------------------------------------------------------------------------- /**----------------------------------------------------------------------------
Include Files and Type Defines Include Files and Type Defines
----------------------------------------------------------------------------**/ ----------------------------------------------------------------------------**/
#define _USE_MATH_DEFINES // for M_PI
#include "intfx.h" #include "intfx.h"
#include <cmath> // for M_PI
#include "allheaders.h" #include "allheaders.h"
#include "ccutil.h" #include "ccutil.h"
#include "classify.h" #include "classify.h"
@ -49,7 +48,7 @@ tesseract::CCUtilMutex atan_table_mutex;
/**---------------------------------------------------------------------------- /**----------------------------------------------------------------------------
Public Code Public Code
----------------------------------------------------------------------------**/ ----------------------------------------------------------------------------**/
/*---------------------------------------------------------------------------*/
void InitIntegerFX() { void InitIntegerFX() {
static bool atan_table_init = false; static bool atan_table_init = false;
atan_table_mutex.Lock(); atan_table_mutex.Lock();

View File

@ -18,8 +18,9 @@
Include Files and Type Defines Include Files and Type Defines
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
#define _USE_MATH_DEFINES // for M_PI
#include <algorithm> #include <algorithm>
#include <cmath> // for std::floor #include <cmath> // for M_PI, std::floor
#include <cstdio> #include <cstdio>
#include <cassert> #include <cassert>

View File

@ -1,9 +1,9 @@
/****************************************************************************** /******************************************************************************
** Filename: mfx.c ** Filename: mfx.c
** Purpose: Micro feature extraction routines ** Purpose: Micro feature extraction routines
** Author: Dan Johnson ** 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"); ** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License. ** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at ** You may obtain a copy of the License at
@ -17,16 +17,17 @@
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
Include Files and Type Defines Include Files and Type Defines
----------------------------------------------------------------------------*/ ----------------------------------------------------------------------------*/
#define _USE_MATH_DEFINES // for M_PI
#include "mfx.h" #include "mfx.h"
#include <cmath> // for M_PI
#include "mfdefs.h" #include "mfdefs.h"
#include "mfoutline.h" #include "mfoutline.h"
#include "clusttool.h" //NEEDED #include "clusttool.h" //NEEDED
#include "intfx.h" #include "intfx.h"
#include "normalis.h" #include "normalis.h"
#include "params.h" #include "params.h"
#include <cmath>
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
Variables Variables
----------------------------------------------------------------------------*/ ----------------------------------------------------------------------------*/

View File

@ -19,7 +19,10 @@
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
I n c l u d e s I n c l u d e s
----------------------------------------------------------------------*/ ----------------------------------------------------------------------*/
#define _USE_MATH_DEFINES // for M_PI
#include "protos.h" #include "protos.h"
#include <cmath> // for M_PI
#include <cstdio>
#include "emalloc.h" #include "emalloc.h"
#include "callcpp.h" #include "callcpp.h"
#include "tprintf.h" #include "tprintf.h"
@ -27,9 +30,6 @@
#include "params.h" #include "params.h"
#include "intproto.h" #include "intproto.h"
#include <cstdio>
#include <cmath>
#define PROTO_INCREMENT 32 #define PROTO_INCREMENT 32
#define CONFIG_INCREMENT 16 #define CONFIG_INCREMENT 16

View File

@ -13,6 +13,7 @@
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
#define _USE_MATH_DEFINES // for M_PI
// Include automatically generated configuration file if running autoconf. // Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config_auto.h" #include "config_auto.h"
@ -20,7 +21,7 @@
#include "trainingsample.h" #include "trainingsample.h"
#include <cmath> #include <cmath> // for M_PI
#include "allheaders.h" #include "allheaders.h"
#include "helpers.h" #include "helpers.h"
#include "intfeaturemap.h" #include "intfeaturemap.h"

View File

@ -3,7 +3,6 @@
// Description: Initial Baseline Determination. // Description: Initial Baseline Determination.
// Copyright 2012 Google Inc. All Rights Reserved. // Copyright 2012 Google Inc. All Rights Reserved.
// Author: rays@google.com (Ray Smith) // 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"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with 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 // for M_PI
#define _USE_MATH_DEFINES
#endif // _MSC_VER
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config_auto.h" #include "config_auto.h"
@ -28,8 +25,8 @@
#include "baselinedetect.h" #include "baselinedetect.h"
#include <algorithm> #include <algorithm>
#include <cfloat> // for FLT_MAX #include <cfloat> // for FLT_MAX
#include <cmath> #include <cmath> // for M_PI
#include "allheaders.h" #include "allheaders.h"
#include "blobbox.h" #include "blobbox.h"
#include "detlinefit.h" #include "detlinefit.h"

View File

@ -2,7 +2,6 @@
* File: tordmain.cpp (Formerly textordp.c) * File: tordmain.cpp (Formerly textordp.c)
* Description: C++ top level textord code. * Description: C++ top level textord code.
* Author: Ray Smith * Author: Ray Smith
* Created: Tue Jul 28 17:12:33 BST 1992
* *
* (C) Copyright 1992, Hewlett-Packard Ltd. * (C) Copyright 1992, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License"); ** 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 #ifdef HAVE_CONFIG_H
#include "config_auto.h" #include "config_auto.h"
#endif #endif

View File

@ -11,18 +11,17 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#define _USE_MATH_DEFINES // for M_PI
#include "commontraining.h" #include "commontraining.h"
#include <algorithm>
#include <cmath> // for M_PI
#ifdef DISABLED_LEGACY_ENGINE #ifdef DISABLED_LEGACY_ENGINE
#include <algorithm>
#include <cmath>
#include "params.h" #include "params.h"
#include "tessopt.h" #include "tessopt.h"
#include "tprintf.h" #include "tprintf.h"
INT_PARAM_FLAG(debug_level, 0, "Level of Trainer debugging"); INT_PARAM_FLAG(debug_level, 0, "Level of Trainer debugging");
INT_PARAM_FLAG(load_images, 0, "Load images with tr files"); INT_PARAM_FLAG(load_images, 0, "Load images with tr files");
STRING_PARAM_FLAG(configfile, "", "File to load more configs from"); 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(output_trainer, "", "File to write trainer to");
STRING_PARAM_FLAG(test_ch, "", "UTF8 test character string"); STRING_PARAM_FLAG(test_ch, "", "UTF8 test character string");
/** /**
* This routine parses the command line arguments that were * This routine parses the command line arguments that were
* passed to the program and uses them to set relevant * passed to the program and uses them to set relevant
@ -59,9 +57,6 @@ void ParseArguments(int* argc, char ***argv) {
#else #else
#include <algorithm>
#include <cmath>
#include "allheaders.h" #include "allheaders.h"
#include "ccutil.h" #include "ccutil.h"
#include "classify.h" #include "classify.h"

View File

@ -14,6 +14,14 @@
** See the License for the specific language governing permissions and ** See the License for the specific language governing permissions and
** limitations under the License. ** 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 "mergenf.h"
#include "clusttool.h" #include "clusttool.h"
#include "cluster.h" #include "cluster.h"
@ -24,11 +32,6 @@
#include "intproto.h" #include "intproto.h"
#include "params.h" #include "params.h"
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
/*-------------------once in subfeat---------------------------------*/ /*-------------------once in subfeat---------------------------------*/
double_VAR(training_angle_match_scale, 1.0, "Angle Match Scale ..."); double_VAR(training_angle_match_scale, 1.0, "Angle Match Scale ...");

View File

@ -20,14 +20,15 @@
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
Include Files and Type Defines Include Files and Type Defines
----------------------------------------------------------------------------*/ ----------------------------------------------------------------------------*/
#define _USE_MATH_DEFINES // for M_PI
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config_auto.h" #include "config_auto.h"
#endif #endif
#include <cmath> // for M_PI
#include <cstring> #include <cstring>
#include <cstdio> #include <cstdio>
#define _USE_MATH_DEFINES
#include <cmath>
#include "classify.h" #include "classify.h"
#include "cluster.h" #include "cluster.h"

View File

@ -21,14 +21,14 @@
I n c l u d e s I n c l u d e s
----------------------------------------------------------------------*/ ----------------------------------------------------------------------*/
#define _USE_MATH_DEFINES // for M_PI
#include <cmath> // for M_PI
#include "chop.h" #include "chop.h"
#include "outlines.h" #include "outlines.h"
#include "callcpp.h" #include "callcpp.h"
#include "plotedges.h" #include "plotedges.h"
#include "wordrec.h" #include "wordrec.h"
#include <cmath>
// Include automatically generated configuration file if running autoconf. // Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config_auto.h" #include "config_auto.h"