training: Move declarations from cpp files to h file

That fixes several warnings from clang++ like the following one:

    src/training/commontraining.cpp:95:1: warning: no previous extern declaration for non-static variable 'FLAGS_D' [-Wmissing-variable-declarations]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2019-05-26 08:51:38 +02:00 committed by zdenop
parent 6dfb049ccf
commit 66e5689167
6 changed files with 17 additions and 25 deletions

View File

@ -32,7 +32,6 @@
static STRING_PARAM_FLAG(classifier, "", "Classifier to test"); static STRING_PARAM_FLAG(classifier, "", "Classifier to test");
static STRING_PARAM_FLAG(lang, "eng", "Language to test"); static STRING_PARAM_FLAG(lang, "eng", "Language to test");
static STRING_PARAM_FLAG(tessdata_dir, "", "Directory of traineddata files"); static STRING_PARAM_FLAG(tessdata_dir, "", "Directory of traineddata files");
DECLARE_INT_PARAM_FLAG(debug_level);
enum ClassifierName { enum ClassifierName {
CN_PRUNER, CN_PRUNER,

View File

@ -1,13 +1,9 @@
/****************************************************************************** /******************************************************************************
** Filename: cntraining.cpp ** Filename: cntraining.cpp
** Purpose: Generates a normproto and pffmtable. ** Purpose: Generates a normproto and pffmtable.
** Author: Dan Johnson ** Author: Dan Johnson
** Revisment: Christy Russon ** Revisment: Christy Russon
** History: Fri Aug 18 08:53:50 1989, DSJ, Created. **
** 5/25/90, DSJ, Adapted to multiple feature types.
** Tuesday, May 17, 1998 Changes made to make feature specific and
** simplify structures. First step in simplifying training process.
**
** (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.
@ -37,8 +33,6 @@
#define PROGRAM_FEATURE_TYPE "cn" #define PROGRAM_FEATURE_TYPE "cn"
DECLARE_STRING_PARAM_FLAG(D);
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
Private Function Prototypes Private Function Prototypes
----------------------------------------------------------------------------*/ ----------------------------------------------------------------------------*/
@ -54,15 +48,14 @@ static void WriteProtos(FILE* File, uint16_t N, LIST ProtoList,
----------------------------------------------------------------------------*/ ----------------------------------------------------------------------------*/
/* global variable to hold configuration parameters to control clustering */ /* global variable to hold configuration parameters to control clustering */
//-M 0.025 -B 0.05 -I 0.8 -C 1e-3 //-M 0.025 -B 0.05 -I 0.8 -C 1e-3
CLUSTERCONFIG CNConfig = static const CLUSTERCONFIG CNConfig = {
{
elliptical, 0.025, 0.05, 0.8, 1e-3, 0 elliptical, 0.025, 0.05, 0.8, 1e-3, 0
}; };
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
Public Code Public Code
----------------------------------------------------------------------------*/ ----------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
/** /**
* This program reads in a text file consisting of feature * This program reads in a text file consisting of feature
* samples from a training page in the following format: * samples from a training page in the following format:

View File

@ -62,6 +62,16 @@
#endif #endif
// Flags from commontraining.cpp
DECLARE_INT_PARAM_FLAG(debug_level);
DECLARE_STRING_PARAM_FLAG(D);
DECLARE_STRING_PARAM_FLAG(O);
DECLARE_STRING_PARAM_FLAG(U);
DECLARE_STRING_PARAM_FLAG(X);
DECLARE_STRING_PARAM_FLAG(fonts_dir);
DECLARE_STRING_PARAM_FLAG(fontconfig_tmpdir);
DECLARE_STRING_PARAM_FLAG(test_ch);
namespace tesseract { namespace tesseract {
// Parse commandline flags and values. Prints the usage string and exits on // Parse commandline flags and values. Prints the usage string and exits on

View File

@ -60,8 +60,6 @@ using tesseract::ShapeTable;
// Max length of a fake shape label. // Max length of a fake shape label.
const int kMaxShapeLabelLength = 10; const int kMaxShapeLabelLength = 10;
DECLARE_STRING_PARAM_FLAG(test_ch);
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
Public Code Public Code
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/

View File

@ -31,9 +31,6 @@
#include "pango/pangocairo.h" #include "pango/pangocairo.h"
#include "util.h" #include "util.h"
DECLARE_STRING_PARAM_FLAG(fonts_dir);
DECLARE_STRING_PARAM_FLAG(fontconfig_tmpdir);
using char32 = signed int; using char32 = signed int;
namespace tesseract { namespace tesseract {

View File

@ -21,11 +21,6 @@
STRING_PARAM_FLAG(script_dir, "", STRING_PARAM_FLAG(script_dir, "",
"Directory name for input script unicharsets/xheights"); "Directory name for input script unicharsets/xheights");
// Flags from commontraining.cpp
DECLARE_STRING_PARAM_FLAG(U);
DECLARE_STRING_PARAM_FLAG(O);
DECLARE_STRING_PARAM_FLAG(X);
int main(int argc, char** argv) { int main(int argc, char** argv) {
tesseract::CheckSharedLibraryVersion(); tesseract::CheckSharedLibraryVersion();
tesseract::ParseCommandLineFlags(argv[0], &argc, &argv, true); tesseract::ParseCommandLineFlags(argv[0], &argc, &argv, true);