From 7a00574163029c0c2b649878c95d5acbd083564a Mon Sep 17 00:00:00 2001 From: "Roberto C. Sanchez" Date: Mon, 12 May 2014 08:21:30 -0400 Subject: Imported Upstream version 1.7.2+dfsg --- utilities/vpl2mod.cpp | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'utilities/vpl2mod.cpp') diff --git a/utilities/vpl2mod.cpp b/utilities/vpl2mod.cpp index e2fca09..c696541 100644 --- a/utilities/vpl2mod.cpp +++ b/utilities/vpl2mod.cpp @@ -1,5 +1,10 @@ -/* - * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org) +/****************************************************************************** + * + * vpl2mod.cpp - Utility to import VPL formatted modules + * + * $Id: vpl2mod.cpp 2921 2013-07-28 17:21:44Z scribe $ + * + * Copyright 2000-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 @@ -36,8 +41,7 @@ #include #include #include -#include -#include +#include #include #ifndef NO_SWORD_NAMESPACE @@ -45,10 +49,10 @@ using sword::FileMgr; using sword::SWMgr; using sword::RawText; using sword::VerseKey; +using sword::SWBuf; using sword::SW_POSITION; #endif -using std::string; char readline(int fd, char **buf) { char ch; @@ -130,14 +134,14 @@ char *parseVReg(char *buf) { bool isKJVRef(const char *buf) { VerseKey vk, test; - vk.AutoNormalize(0); - vk.Headings(1); // turn on mod/testmnt/book/chap headings - vk.Persist(1); + vk.setAutoNormalize(false); + vk.setIntros(true); // turn on mod/testmnt/book/chap headings + vk.setPersist(true); // lets do some tests on the verse -------------- vk = buf; test = buf; - if (vk.Testament() && vk.Book() && vk.Chapter() && vk.Verse()) { // if we're not a heading + if (vk.getTestament() && vk.getBook() && vk.getChapter() && vk.getVerse()) { // if we're not a heading // std::cerr << (const char*)vk << " == " << (const char*)test << std::endl; return (vk == test); } @@ -213,9 +217,9 @@ int main(int argc, char **argv) { char *buffer = 0; RawText mod(argv[2]); // open our datapath with our RawText driver. VerseKey vk; - vk.AutoNormalize(0); - vk.Headings(1); // turn on mod/testmnt/book/chap headings - vk.Persist(1); + vk.setAutoNormalize(false); + vk.setIntros(true); // turn on mod/testmnt/book/chap headings + vk.setPersist(true); mod.setKey(vk); @@ -225,7 +229,7 @@ int main(int argc, char **argv) { if (ntonly) vk = "Matthew 1:1"; int successive = 0; //part of hack below - while ((!mod.Error()) && (!readline(fd, &buffer))) { + while ((!mod.popError()) && (!readline(fd, &buffer))) { if (*buffer == '|') // comments, ignore line continue; if (vref) { @@ -236,11 +240,11 @@ int main(int argc, char **argv) { } vk = buffer; - if (vk.Error()) { + if (vk.popError()) { std::cerr << "Error parsing key: " << buffer << "\n"; exit(-5); } - string orig = mod.getRawEntry(); + SWBuf orig = mod.getRawEntry(); if (!isKJVRef(buffer)) { VerseKey origVK = vk; @@ -248,7 +252,7 @@ int main(int argc, char **argv) { do { vk--; } - while (!vk.Error() && !isKJVRef(vk)); */ + while (!vk.popError() && !isKJVRef(vk)); */ //hack to replace above: successive++; vk -= successive; @@ -261,7 +265,7 @@ int main(int argc, char **argv) { orig += ") "; orig += verseText; orig += " ] "; - verseText = orig.c_str(); + verseText = orig; } else { successive = 0; -- cgit v1.2.3