| 1 |
#include "MeaningsFile.h" |
| 2 |
#include "Arguments.h" |
| 3 |
#include "WordsFile.h" |
| 4 |
#include <iostream> |
| 5 |
#include <string> |
| 6 |
#include <fstream> |
| 7 |
using namespace std; |
| 8 |
using namespace AiksaurusImpl; |
| 9 |
int main(int argc, const char** argv) |
| 10 |
{ |
| 11 |
Arguments A(argc, argv); |
| 12 |
|
| 13 |
string wfile; |
| 14 |
string mfile; |
| 15 |
string ofile; |
| 16 |
A.get("-m", mfile, "meanings.dat"); |
| 17 |
A.get("-w", wfile, "words.dat"); |
| 18 |
A.get("-o", ofile, "mrec.45"); |
| 19 |
|
| 20 |
MeaningsFile mf(mfile.c_str()); |
| 21 |
|
| 22 |
WordsFile wf(wfile.c_str()); |
| 23 |
|
| 24 |
if (wf.getError().isError()) |
| 25 |
{ |
| 26 |
cerr << wf.getError().getDescription() << endl; |
| 27 |
exit(1); |
| 28 |
} |
| 29 |
|
| 30 |
ofstream fout(ofile.c_str()); |
| 31 |
|
| 32 |
for(int n = 0; ;++n) |
| 33 |
{ |
| 34 |
int* words = mf.getWords(n); |
| 35 |
if (words[0] == -1) |
| 36 |
break; |
| 37 |
|
| 38 |
for(int i = 0;words[i] != -1;++i) |
| 39 |
{ |
| 40 |
wf.loadWord(words[i]); |
| 41 |
if (wf.getError().isError()) |
| 42 |
{ |
| 43 |
cout << wf.getError().getDescription() << endl; |
| 44 |
return 0; |
| 45 |
} |
| 46 |
|
| 47 |
fout << wf.getWord() << ' '; |
| 48 |
} |
| 49 |
|
| 50 |
fout << endl; |
| 51 |
} |
| 52 |
|
| 53 |
return 0; |
| 54 |
} |