From 20263805178077fde0038a47e6b4310d7fe62142 Mon Sep 17 00:00:00 2001 From: Teus Benschop Date: Wed, 17 Oct 2018 14:17:24 +0200 Subject: New upstream version 1.7.4 --- examples/Makefile.in | 2 +- examples/cmdline/Makefile.in | 2 +- examples/tasks/Makefile.in | 2 +- examples/tasks/parallelbibles.cpp | 69 +++++++++++++++++++++++++++++++++++---- 4 files changed, 66 insertions(+), 9 deletions(-) (limited to 'examples') diff --git a/examples/Makefile.in b/examples/Makefile.in index 016b881..385c119 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.13.4 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. diff --git a/examples/cmdline/Makefile.in b/examples/cmdline/Makefile.in index a6fa444..7ee0d78 100644 --- a/examples/cmdline/Makefile.in +++ b/examples/cmdline/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.13.4 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. diff --git a/examples/tasks/Makefile.in b/examples/tasks/Makefile.in index 3b08667..e9d3d12 100644 --- a/examples/tasks/Makefile.in +++ b/examples/tasks/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.13.4 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. diff --git a/examples/tasks/parallelbibles.cpp b/examples/tasks/parallelbibles.cpp index dd57f86..86e692c 100644 --- a/examples/tasks/parallelbibles.cpp +++ b/examples/tasks/parallelbibles.cpp @@ -33,13 +33,19 @@ using namespace sword; using namespace std; +const bool o = 1; void parallelDisplay(vectormodules, const char *key) { + //cout << "Start key:" << key; + // We'll use the first module's key as our master key to position all other modules. VerseKey *master = (VerseKey *)modules[0]->createKey(); master->setText(key); + + //cout << "\t key:" << master->getText(); + int curVerse = master->getVerse(); int curChapter = master->getChapter(); int curBook = master->getBook(); @@ -49,15 +55,66 @@ void parallelDisplay(vectormodules, const char *key) { && !master->popError(); (*master)++) { - cout << "getVerse() == curVerse ? "currentverse":"verse") << "\">"; + if(o) cout << "getVerse() == curVerse ? "currentverse":"verse") << "\">"; + for (vector::iterator module = modules.begin(); module != modules.end(); ++module) { + //cout << "\n\n====================\nfromKey" << master->getOSISRef(); + (*module)->setKey(master); + VerseKey slave((*module)->getKey()); + + //cout << "setKey" << (*module)->getName() << slave.getBookName() << slave.getRangeText() << slave.getShortText(); + + if(o) cout << "" << ""; + + //cout << "[" << (int)slave.getBook() << " " << (int)master->getBook() << " " << (int)slave.getTestament() << " " << (int)master->getTestament() << "]"; + + if (!(*module)->popError()) { - cout << "" << "" << master->getVerse() << " "; - cout << (*module)->renderText() << ""; + + if(strcmp(slave.getBookName(), master->getBookName())) { + if(o) cout << slave.getShortText(); + } + else if(slave.getChapter() != master->getChapter()) { + if(o) cout << slave.getChapter() << ":" << slave.getVerse(); + } + else { + if(o) cout << slave.getVerse(); + } + + if(slave.isBoundSet()) { + if(o) cout << "-"; + if(slave.getUpperBound().getBook() != slave.getLowerBound().getBook()) { + if(o) cout << slave.getUpperBound().getShortText(); + } + else if(slave.getUpperBound().getChapter() != slave.getLowerBound().getChapter()) { + if(o) cout << slave.getUpperBound().getChapter() << ":" << slave.getUpperBound().getVerse(); + } + else { + if(o) cout << slave.getUpperBound().getVerse(); + } + } + + if(o) cout << " "; + + + if(slave.isBoundSet()) { + VerseKey temp(slave); + for(int i = slave.getLowerBound().getIndex(); i <= slave.getUpperBound().getIndex(); ++i) { + if(i > 0) if(o) cout << " "; + temp.setIndex(i); + (*module)->setKey(temp); + if(o) cout << (*module)->renderText(); + } + } + else { + if(o) cout << (*module)->renderText(); + } + + if(o) cout << ""; } } - cout << ""; + if(o) cout << ""; } delete master; } @@ -171,9 +228,9 @@ int main(int argc, char **argv) { modules.push_back(bible); } - outputHeader(modules, argv[argc-1]); + if(o) outputHeader(modules, argv[argc-1]); parallelDisplay(modules, argv[argc-1]); - outputFooter(modules); + if(o) outputFooter(modules); return 0; } -- cgit v1.2.3