Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/giza-pp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorredpony <redpony@ca354974-eb3a-0410-8f5c-d3948404989b>2009-09-07 21:04:27 +0400
committerredpony <redpony@ca354974-eb3a-0410-8f5c-d3948404989b>2009-09-07 21:04:27 +0400
commitdf54e991d19f4aeadec0582013cdf688cbb1831b (patch)
treee2e051163c37acff5f7eb5de5a4957e866096cce
parentcae5e536a3943a31b45ff962d2c016dfe5fcd2a6 (diff)
remove use of deprecated classes
-rw-r--r--GIZA++-v2/D4Tables.h6
-rw-r--r--GIZA++-v2/D5Tables.h2
-rw-r--r--GIZA++-v2/Makefile16
-rw-r--r--GIZA++-v2/Parameter.cpp6
-rw-r--r--GIZA++-v2/WordClasses.h3
-rw-r--r--GIZA++-v2/getSentence.cpp8
-rw-r--r--GIZA++-v2/main.cpp2
-rw-r--r--GIZA++-v2/model1.h2
-rw-r--r--GIZA++-v2/parse.cpp6
-rw-r--r--GIZA++-v2/plain2snt.cpp6
-rw-r--r--GIZA++-v2/reports.cpp2
-rw-r--r--GIZA++-v2/snt2cooc.cpp6
-rw-r--r--GIZA++-v2/snt2plain.cpp6
-rw-r--r--GIZA++-v2/vocab.cpp2
-rw-r--r--GIZA++-v2/vocab.h3
15 files changed, 38 insertions, 38 deletions
diff --git a/GIZA++-v2/D4Tables.h b/GIZA++-v2/D4Tables.h
index a6d1335..e047bcc 100644
--- a/GIZA++-v2/D4Tables.h
+++ b/GIZA++-v2/D4Tables.h
@@ -120,7 +120,7 @@ class compareb1
inline void tokenize(const string&in,Vector<string>&out)
{
string s;
- istrstream l(in.c_str());
+ istringstream l(in);
while(l>>s)
out.push_back(s);
}
@@ -385,7 +385,7 @@ class d4model
int value;
double count;
getline(file,line);
- istrstream twonumbers(line.c_str());
+ istringstream twonumbers(line);
if(twonumbers >> value >> count)
{
if( D1.count(k)==0 )
@@ -444,7 +444,7 @@ class d4model
int value;
double count;
getline(file,line);
- istrstream twonumbers(line.c_str());
+ istringstream twonumbers(line);
if(twonumbers >> value >> count)
{
if( Db1.count(k)==0 )
diff --git a/GIZA++-v2/D5Tables.h b/GIZA++-v2/D5Tables.h
index c662795..c69992b 100644
--- a/GIZA++-v2/D5Tables.h
+++ b/GIZA++-v2/D5Tables.h
@@ -194,7 +194,7 @@ class d5model
{
if(l.length()&&l[0]=='#')
continue;
- istrstream is(l.c_str());
+ istringstream is(l.c_str());
string E,F;
int v1,v2,ii;
double prob,count;
diff --git a/GIZA++-v2/Makefile b/GIZA++-v2/Makefile
index b94448d..236e672 100644
--- a/GIZA++-v2/Makefile
+++ b/GIZA++-v2/Makefile
@@ -2,10 +2,11 @@
INSTALLDIR ?= /usr/local/bin/
-CXX = g++
+#CXX = g++
-CFLAGS = $(CFLAGS_GLOBAL) -Wall -W -Wno-deprecated
-CFLAGS_OPT = $(CFLAGS) -O3 -DNDEBUG -DWORDINDEX_WITH_4_BYTE -DBINARY_SEARCH_FOR_TTABLE
+CFLAGS = $(CFLAGS_GLOBAL) -Wall
+CFLAGS_OPT = $(CFLAGS) -O3 -DNDEBUG -DWORDINDEX_WITH_4_BYTE -DBINARY_SEARCH_FOR_TTABLE -O3 -DNDEBUG -DWORDINDEX_WITH_4_BYTE -ffast-math
+#CFLAGS_OPT = $(CFLAGS) -O3 -DNDEBUG -DWORDINDEX_WITH_4_BYTE -DBINARY_SEARCH_FOR_TTABLE -O3 -static -DNDEBUG -DWORDINDEX_WITH_4_BYTE
CFLAGS_PRF = $(CFLAGS) -O2 -pg -DNDEBUG -DWORDINDEX_WITH_4_BYTE
CFLAGS_DBG = $(CFLAGS) -g -DDEBUG -DWORDINDEX_WITH_4_BYTE
CFLAGS_NRM = $(CFLAGS) -DWORDINDEX_WITH_4_BYTE
@@ -133,14 +134,11 @@ dependencies:
-include dependencies
snt2plain.out: snt2plain.cpp
- $(CXX) -O3 -Wno-deprecated -W -Wall snt2plain.cpp -o snt2plain.out
+ $(CXX) $(LDFLAGS) -O3 -Wno-deprecated -W -Wall snt2plain.cpp -o snt2plain.out
plain2snt.out: plain2snt.cpp
- $(CXX) -O3 -Wno-deprecated -W -Wall plain2snt.cpp -o plain2snt.out
+ $(CXX) $(LDFLAGS) -O3 -Wno-deprecated -W -Wall plain2snt.cpp -o plain2snt.out
snt2cooc.out: snt2cooc.cpp
- $(CXX) -O3 -g -W -Wall -Wno-deprecated snt2cooc.cpp -o snt2cooc.out
-
-small_snt2cooc.out: small_snt2cooc.cpp
- $(CXX) -O3 -g small_snt2cooc.cpp -o small_snt2cooc.out
+ $(CXX) $(LDFLAGS) -O3 -g -W -Wall -Wno-deprecated snt2cooc.cpp -o snt2cooc.out
diff --git a/GIZA++-v2/Parameter.cpp b/GIZA++-v2/Parameter.cpp
index 94a97e9..8379a25 100644
--- a/GIZA++-v2/Parameter.cpp
+++ b/GIZA++-v2/Parameter.cpp
@@ -23,7 +23,7 @@ USA.
#include "Parameter.h"
#include <fstream>
#include <unistd.h>
-#include <strstream>
+#include <sstream>
bool absolutePathNames=0;
@@ -37,7 +37,7 @@ bool writeParameters(ofstream&of,const ParSet&parset,int level)
{
if(((*i)->getLevel()==level||level==-1)&&(*i)->onlyCopy==0)
{
- ostrstream os;
+ ostringstream os;
(*i)->printValue(os);
os << ends;
string s(os.str());
@@ -63,7 +63,7 @@ bool readParameters(ifstream&f,const ParSet&parset,int verb,int level)
if(!f)return 0;
while(getline(f,s))
{
- istrstream eingabe(s.c_str());
+ istringstream eingabe(s);
string s1,s2;
eingabe>>s1>>s2;
if(makeSetCommand(s1,s2,parset,verb,level)==0)
diff --git a/GIZA++-v2/WordClasses.h b/GIZA++-v2/WordClasses.h
index d8431f8..3693906 100644
--- a/GIZA++-v2/WordClasses.h
+++ b/GIZA++-v2/WordClasses.h
@@ -48,7 +48,8 @@ class WordClasses
while(getline(in,sline))
{
string word,wclass;
- istrstream iline(sline.c_str());
+ //istringstream iline(sline.c_str());
+ istringstream iline(sline);
iline>>word>>wclass;
maxword=max(m(word),maxword);
assert(Sw2c.count(word)==0);
diff --git a/GIZA++-v2/getSentence.cpp b/GIZA++-v2/getSentence.cpp
index 78aafcf..125a6f7 100644
--- a/GIZA++-v2/getSentence.cpp
+++ b/GIZA++-v2/getSentence.cpp
@@ -32,7 +32,7 @@ USA.
#include "getSentence.h"
#include <iostream>
-#include <strstream>
+#include <sstream>
#include "Parameter.h"
#include "errno.h"
@@ -201,7 +201,7 @@ bool sentenceHandler::readNextSentence(sentPair& sent)
sent.clear();
if (getline(*inputFile, line)){
- istrstream buffer(line.c_str());
+ istringstream buffer(line);
buffer >> sent.noOcc;
if( sent.noOcc<0 )
{
@@ -226,7 +226,7 @@ bool sentenceHandler::readNextSentence(sentPair& sent)
fail = true ;;
}
if (getline(*inputFile, line)){
- istrstream buffer(line.c_str());
+ istringstream buffer(line);
WordIndex w; // w is a local variabe for token id
sent.eSent.push_back(0); // each source word is assumed to have 0 ==
// a null word (id 0) at the begining of the sentence.
@@ -246,7 +246,7 @@ bool sentenceHandler::readNextSentence(sentPair& sent)
fail = true ;
}
if (getline(*inputFile, line)){
- istrstream buffer(line.c_str());
+ istringstream buffer(line);
WordIndex w; // w is a local variabe for token id
sent.fSent.push_back(0); //0 is inserted for program uniformity
while(buffer>>w){ // read target sentece , word by word .
diff --git a/GIZA++-v2/main.cpp b/GIZA++-v2/main.cpp
index 6032ebe..93e8669 100644
--- a/GIZA++-v2/main.cpp
+++ b/GIZA++-v2/main.cpp
@@ -20,7 +20,7 @@ USA.
*/
-#include <strstream>
+#include <sstream>
#include "getSentence.h"
#include "TTables.h"
#include "model1.h"
diff --git a/GIZA++-v2/model1.h b/GIZA++-v2/model1.h
index 7157f5e..1dceb65 100644
--- a/GIZA++-v2/model1.h
+++ b/GIZA++-v2/model1.h
@@ -25,7 +25,7 @@ USA.
#include <cassert>
#include <iostream>
-#include <strstream>
+#include <sstream>
#include <algorithm>
#include <functional>
#include <map>
diff --git a/GIZA++-v2/parse.cpp b/GIZA++-v2/parse.cpp
index c82f6b7..ebb136e 100644
--- a/GIZA++-v2/parse.cpp
+++ b/GIZA++-v2/parse.cpp
@@ -22,7 +22,7 @@ USA.
/* FJO 01/2001: completely reorganized parameter processing */
-#include <strstream>
+#include <sstream>
#include <string>
#include <fstream>
#include "defs.h"
@@ -71,7 +71,7 @@ void parseConfigFile (char * fname )
while(getline(Config_File, line)){
- istrstream buffer(line.c_str());
+ istringstream buffer(line);
word = attrib = attribval = "" ;
buffer >> word ;
if (word != "//"){ // if line does not start with "//" (i.e. not a comment)
@@ -81,7 +81,7 @@ void parseConfigFile (char * fname )
}
if(!(buffer >> attribval))
{
- istrstream buffer2(line.c_str());
+ istringstream buffer2(line);
buffer2>>attrib;
buffer2>>attribval;
}
diff --git a/GIZA++-v2/plain2snt.cpp b/GIZA++-v2/plain2snt.cpp
index b43d2cb..66ae677 100644
--- a/GIZA++-v2/plain2snt.cpp
+++ b/GIZA++-v2/plain2snt.cpp
@@ -1,6 +1,6 @@
#include <iostream>
#include <string>
-#include <strstream>
+#include <sstream>
#include <fstream>
#include <map>
#include <vector>
@@ -64,7 +64,7 @@ int main(int argc,char**argv)
while(getline(i1,line1) && getline(i2,line2) )
{
vector<string> t1,t2;
- istrstream ii1(line1.c_str());
+ istringstream ii1(line1);
while(ii1>>word)
{
t1.push_back(word);
@@ -75,7 +75,7 @@ int main(int argc,char**argv)
id1[word]=iid1.size()-1;
}
}
- istrstream ii2(line2.c_str());
+ istringstream ii2(line2);
while(ii2>>word)
{
t2.push_back(word);
diff --git a/GIZA++-v2/reports.cpp b/GIZA++-v2/reports.cpp
index 4d5873a..621e21a 100644
--- a/GIZA++-v2/reports.cpp
+++ b/GIZA++-v2/reports.cpp
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
*/
-#include <strstream>
+#include <sstream>
#include <time.h>
#include <set>
#include "defs.h"
diff --git a/GIZA++-v2/snt2cooc.cpp b/GIZA++-v2/snt2cooc.cpp
index f8b9c7e..c6af6d4 100644
--- a/GIZA++-v2/snt2cooc.cpp
+++ b/GIZA++-v2/snt2cooc.cpp
@@ -1,6 +1,6 @@
#include <iostream>
#include <string>
-#include <strstream>
+#include <sstream>
#include <fstream>
#include <map>
#include <vector>
@@ -16,7 +16,7 @@ void readVoc(istream&in,map<string,string>&voc)
if( !in )cerr <<"Vocabulary does not exist.\n";
while(getline(in,line))
{
- istrstream eingabe(line.c_str());
+ istringstream eingabe(line);
if( !(eingabe>>s1>>s2))
cerr << "ERROR in vocabulary '" << line << "'\n";
voc[s1]=s2;
@@ -50,7 +50,7 @@ int main(int argc,char **argv)
int totalElems=0;
while(getline(t,line1)&&getline(t,line2)&&getline(t,line3))
{
- istrstream eingabe1(line1.c_str()),eingabe2(line2.c_str()),eingabe3(line3.c_str());
+ istringstream eingabe1(line1),eingabe2(line2),eingabe3(line3);
double count;
string word;
eingabe1>>count;
diff --git a/GIZA++-v2/snt2plain.cpp b/GIZA++-v2/snt2plain.cpp
index e83272f..3eb99ad 100644
--- a/GIZA++-v2/snt2plain.cpp
+++ b/GIZA++-v2/snt2plain.cpp
@@ -1,6 +1,6 @@
#include <iostream>
#include <string>
-#include <strstream>
+#include <sstream>
#include <fstream>
#include <map>
#include <vector>
@@ -15,7 +15,7 @@ void readVoc(istream&in,map<string,string>&voc)
if( !in )cerr <<"Vocabulary does not exist.\n";
while(getline(in,line))
{
- istrstream eingabe(line.c_str());
+ istringstream eingabe(line);
if( !(eingabe>>s1>>s2))
cerr << "ERROR in vocabulary '" << line << "'\n";
voc[s1]=s2;
@@ -51,7 +51,7 @@ int main(int argc,char **argv)
int printed=0;
while(getline(t,line1)&&getline(t,line2)&&getline(t,line3))
{
- istrstream eingabe1(line1.c_str()),eingabe2(line2.c_str()),eingabe3(line3.c_str());
+ istringstream eingabe1(line1),eingabe2(line2),eingabe3(line3);
double count;
string word;
eingabe1>>count;
diff --git a/GIZA++-v2/vocab.cpp b/GIZA++-v2/vocab.cpp
index 9ad171c..a91c572 100644
--- a/GIZA++-v2/vocab.cpp
+++ b/GIZA++-v2/vocab.cpp
@@ -44,7 +44,7 @@ void vcbList::readVocabList()
s2i[entry.word]=list.size()-1;
while(getline(vFile, line)){
- istrstream buffer(line.c_str());
+ istringstream buffer(line);
if(!(buffer >> word_id >> word >> freq))
cerr << "ERROR: reading vocabulary; " << word_id << ' ' << word << ' ' << freq << endl;
if (word_id == 0){
diff --git a/GIZA++-v2/vocab.h b/GIZA++-v2/vocab.h
index ab637c2..988edc6 100644
--- a/GIZA++-v2/vocab.h
+++ b/GIZA++-v2/vocab.h
@@ -26,7 +26,7 @@ USA.
#include "Vector.h"
#include <fstream>
-#include <strstream>
+#include <sstream>
#include <map>
class WordEntry {
@@ -100,4 +100,5 @@ class vcbList{
}
};
+
#endif