diff options
author | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2012-05-07 18:08:37 +0400 |
---|---|---|
committer | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2012-05-07 18:08:37 +0400 |
commit | 0ea2bc6fac24c9f927e544432acaac79ea066e12 (patch) | |
tree | 1f6e34a526690467444754d5c75edf489b6046b2 /scripts/ems | |
parent | 245be8f63d728ac63f645830221ad7d52a93b466 (diff) |
Use const instead of #define macros if possible.
Diffstat (limited to 'scripts/ems')
-rw-r--r-- | scripts/ems/biconcor/Alignment.cpp | 6 | ||||
-rw-r--r-- | scripts/ems/biconcor/Alignment.h | 1 | ||||
-rw-r--r-- | scripts/ems/biconcor/SuffixArray.cpp | 6 | ||||
-rw-r--r-- | scripts/ems/biconcor/SuffixArray.h | 2 | ||||
-rw-r--r-- | scripts/ems/biconcor/TargetCorpus.cpp | 9 | ||||
-rw-r--r-- | scripts/ems/biconcor/TargetCorpus.h | 1 | ||||
-rw-r--r-- | scripts/ems/biconcor/Vocabulary.cpp | 8 | ||||
-rw-r--r-- | scripts/ems/biconcor/Vocabulary.h | 3 | ||||
-rw-r--r-- | scripts/ems/biconcor/biconcor.cpp | 2 |
9 files changed, 32 insertions, 6 deletions
diff --git a/scripts/ems/biconcor/Alignment.cpp b/scripts/ems/biconcor/Alignment.cpp index 979037ee6..b344e6221 100644 --- a/scripts/ems/biconcor/Alignment.cpp +++ b/scripts/ems/biconcor/Alignment.cpp @@ -3,6 +3,12 @@ #include <stdlib.h> #include <cstring> +namespace { + +const int LINE_MAX_LENGTH = 10000; + +} // namespace + using namespace std; void Alignment::Create( string fileName ) diff --git a/scripts/ems/biconcor/Alignment.h b/scripts/ems/biconcor/Alignment.h index 03e1782f1..0e75b1bd0 100644 --- a/scripts/ems/biconcor/Alignment.h +++ b/scripts/ems/biconcor/Alignment.h @@ -1,6 +1,5 @@ #pragma once -#define LINE_MAX_LENGTH 10000 #include "Vocabulary.h" class Alignment diff --git a/scripts/ems/biconcor/SuffixArray.cpp b/scripts/ems/biconcor/SuffixArray.cpp index e7214bf43..91e902209 100644 --- a/scripts/ems/biconcor/SuffixArray.cpp +++ b/scripts/ems/biconcor/SuffixArray.cpp @@ -3,6 +3,12 @@ #include <stdlib.h> #include <cstring> +namespace { + +const int LINE_MAX_LENGTH = 10000; + +} // namespace + using namespace std; void SuffixArray::Create( string fileName ) diff --git a/scripts/ems/biconcor/SuffixArray.h b/scripts/ems/biconcor/SuffixArray.h index 2b8f9b7ff..509a247b0 100644 --- a/scripts/ems/biconcor/SuffixArray.h +++ b/scripts/ems/biconcor/SuffixArray.h @@ -1,7 +1,5 @@ #pragma once -#define LINE_MAX_LENGTH 10000 - #include "Vocabulary.h" class SuffixArray diff --git a/scripts/ems/biconcor/TargetCorpus.cpp b/scripts/ems/biconcor/TargetCorpus.cpp index 78c67987f..a94bcb3c0 100644 --- a/scripts/ems/biconcor/TargetCorpus.cpp +++ b/scripts/ems/biconcor/TargetCorpus.cpp @@ -1,8 +1,17 @@ #include "TargetCorpus.h" + #include <string> #include <stdlib.h> #include <cstring> +namespace { + +const int LINE_MAX_LENGTH = 10000; + +} // namespace + +using namespace std; + void TargetCorpus::Create( string fileName ) { ifstream textFile; diff --git a/scripts/ems/biconcor/TargetCorpus.h b/scripts/ems/biconcor/TargetCorpus.h index 40c59b947..aa9a1aa41 100644 --- a/scripts/ems/biconcor/TargetCorpus.h +++ b/scripts/ems/biconcor/TargetCorpus.h @@ -1,6 +1,5 @@ #pragma once -#define LINE_MAX_LENGTH 10000 #include "Vocabulary.h" class TargetCorpus diff --git a/scripts/ems/biconcor/Vocabulary.cpp b/scripts/ems/biconcor/Vocabulary.cpp index 6a9bea7e3..844117a05 100644 --- a/scripts/ems/biconcor/Vocabulary.cpp +++ b/scripts/ems/biconcor/Vocabulary.cpp @@ -1,6 +1,14 @@ // $Id: Vocabulary.cpp 1565 2008-02-22 14:42:01Z bojar $
#include "Vocabulary.h"
+namespace {
+
+const int MAX_LENGTH = 10000;
+
+} // namespace
+
+using namespace std;
+
// as in beamdecoder/tables.cpp
vector<WORD_ID> Vocabulary::Tokenize( const char input[] )
{
diff --git a/scripts/ems/biconcor/Vocabulary.h b/scripts/ems/biconcor/Vocabulary.h index dc0175387..783330020 100644 --- a/scripts/ems/biconcor/Vocabulary.h +++ b/scripts/ems/biconcor/Vocabulary.h @@ -10,11 +10,10 @@ #include <queue> #include <map> #include <cmath> +#include <vector> using namespace std; -#define MAX_LENGTH 10000 - #define SAFE_GETLINE(_IS, _LINE, _SIZE, _DELIM) { \ _IS.getline(_LINE, _SIZE, _DELIM); \ if(_IS.fail() && !_IS.bad() && !_IS.eof()) _IS.clear(); \ diff --git a/scripts/ems/biconcor/biconcor.cpp b/scripts/ems/biconcor/biconcor.cpp index 0b6218623..a25e63cb7 100644 --- a/scripts/ems/biconcor/biconcor.cpp +++ b/scripts/ems/biconcor/biconcor.cpp @@ -118,4 +118,6 @@ int main(int argc, char* argv[]) ppCollection.GetCollection( queryString ); ppCollection.PrintHTML(); } + + return 0; } |