diff options
Diffstat (limited to 'flashtools')
-rw-r--r-- | flashtools/flash.cpp | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/flashtools/flash.cpp b/flashtools/flash.cpp index 2ee86b9..52b5dea 100644 --- a/flashtools/flash.cpp +++ b/flashtools/flash.cpp @@ -188,6 +188,12 @@ void outputCSV(const vector<Word> &wordList) { // output header cout << "FreqKJV|" + << "Greek|" + << "Strongs|" + << "TranslationInAV" + << "\n"; +/* + << "FreqKJV|" << "PointedHeb|" << "Meaning|" << "Strongs|" @@ -205,6 +211,7 @@ void outputCSV(const vector<Word> &wordList) { << "FullMeaning|" << "TranslationInAV" << "\n"; +*/ for (vector<Word>::const_iterator it = wordList.begin(); it != wordList.end(); it++) { const Word &w = (*it); @@ -213,9 +220,13 @@ void outputCSV(const vector<Word> &wordList) { if (gh == 'G' || gh == 'H') { s << 1; } - s = itoa(atoi(s.c_str())).c_str(); -// cout << w->freq << "|" << escapedUTF8(w->utf8).c_str() << "|" << w->strong << "|" << prettyKJVFreq(w->kjvFreq).c_str() << "\n"; + s = itoa(atoi(s.c_str())).c_str(); cout + << w.freq << "|" + << escapedUTF8(w.utf8).c_str() << "|" + << w.strong << "|" + << prettyKJVFreq(w.kjvFreq).c_str() +/* << w.freq << "|" << hebrew[s]["UTF8"] << "|" << hebrew[s]["Meaning"] << "|" @@ -233,6 +244,7 @@ void outputCSV(const vector<Word> &wordList) { << hebrew[s]["Notes"] << "|" << hebrew[s]["FullMeaning"] << "|" << hebrew[s]["TranslationInAV"] +*/ << "\n"; } std::cout << std::endl; @@ -321,23 +333,22 @@ void outputFlash(const vector<Word> &wordList, const char *outputDir = ".", bool * (useful for generating complete OT or NT strongs word lists) * */ -vector<Word> processWords(const char *range, bool addAll = true) { +vector<Word> processWords(const char *range, bool addAll = true, SWBuf modName = "KJV") { SWMgr manager; map<SWBuf, Word> wordList; - SWModule *tmpBible = manager.getModule("KJV"); + SWModule *tmpBible = manager.getModule(modName); if (!tmpBible) { cerr << "Unable to locate KJV module" << endl; exit(1); } SWModule &bible = *tmpBible; - VerseKey parser; - ListKey r = parser.ParseVerseList(range, 0, true); - r.Persist(true); - bible.setKey(r); - for (bible = TOP; !bible.Error(); bible++) { - bible.RenderText(); // force an entry lookup to resolve key to something in the index + VerseKey *parser = (VerseKey *)bible.createKey(); + ListKey r = parser->parseVerseList(range, 0, true); + for (r = TOP; !r.popError(); r++) { + bible.setKey(r); + bible.renderText(); // force an entry lookup to resolve key to something in the index AttributeList &words = bible.getEntryAttributes()["Word"]; for (AttributeList::iterator word = words.begin(); word != words.end(); word++) { @@ -389,13 +400,13 @@ vector<Word> processWords(const char *range, bool addAll = true) { // this assures we have an entry for every word, even if it is not // present in the module r = TOP; - if (VerseKey(r).Testament() == 1) { + if (VerseKey(r).getTestament() == 1) { for (SectionMap::iterator it = hebrew.Sections.begin(); it != hebrew.Sections.end(); it++) { wordList[(SWBuf)"H0"+it->first].utf8; // just access to be sure created. We'll add later. } } r = BOTTOM; - if (VerseKey(r).Testament() == 2) { + if (VerseKey(r).getTestament() == 2) { for (SectionMap::iterator it = greek.Sections.begin(); it != greek.Sections.end(); it++) { wordList[(SWBuf)"G"+it->first].utf8; } @@ -428,6 +439,8 @@ vector<Word> processWords(const char *range, bool addAll = true) { } sort(sorted.begin(), sorted.end(), compareFreq); + delete parser; + return sorted; } @@ -443,6 +456,7 @@ void usage(const char *app, const char *error = 0) { fprintf(stderr, " -d <m|k>\t\t definition to use (default k):\n"); fprintf(stderr, "\t\t\t\t m - short meaning; k - KJV collation\n"); fprintf(stderr, " -r <\"range\">\t\t verse range\n"); + fprintf(stderr, " -m <\"module name\">\t\t module name to use (default \"KJV\")\n"); fprintf(stderr, " -f <fontName>\t\t include special font name for lesson\n"); fprintf(stderr, " -h\t\t\t display this help message\n\n"); exit(-1); @@ -450,8 +464,9 @@ void usage(const char *app, const char *error = 0) { int main(int argc, char **argv) { + const int REQUIRED = 0; // Let's test our command line arguments - if (argc < 1) { + if (argc < REQUIRED+1) { // this never happens since we don't have any required argument count usage(*argv); } @@ -462,6 +477,7 @@ int main(int argc, char **argv) { SWBuf range = "Mat-Rev"; SWBuf fontName = ""; SWBuf outDir = "."; + SWBuf modName = "KJV"; int count = 25; for (int i = 1; i < argc; i++) { @@ -486,6 +502,10 @@ int main(int argc, char **argv) { if (i+1 < argc) range = argv[++i]; else usage(*argv, "-r requires <\"range\">"); } + else if (!strcmp(argv[i], "-m")) { + if (i+1 < argc) modName = argv[++i]; + else usage(*argv, "-m requires <\"module name\">"); + } else if (!strcmp(argv[i], "-f")) { if (i+1 < argc) fontName = argv[++i]; else usage(*argv, "-f requires <\"fontName\">"); @@ -504,10 +524,10 @@ int main(int argc, char **argv) { } if (csv) { - outputCSV(processWords(range)); + outputCSV(processWords(range, true, modName)); } else { - outputFlash(processWords(range), outDir, (def == 'k'), count, (fontName.length()?fontName.c_str():0)); + outputFlash(processWords(range, true, modName), outDir, (def == 'k'), count, (fontName.length()?fontName.c_str():0)); } return 0; |