diff options
Diffstat (limited to 'utilities/tei2mod.cpp')
-rw-r--r-- | utilities/tei2mod.cpp | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/utilities/tei2mod.cpp b/utilities/tei2mod.cpp index 531e01b..575d882 100644 --- a/utilities/tei2mod.cpp +++ b/utilities/tei2mod.cpp @@ -1,4 +1,26 @@ -/** +/****************************************************************************** + * + * tei2mod.cpp - Utility to import documents encoded as TEI + * + * $Id: tei2mod.cpp 2978 2013-09-10 14:39:31Z scribe $ + * + * Copyright 2008-2013 CrossWire Bible Society (http://www.crosswire.org) + * CrossWire Bible Society + * P. O. Box 2528 + * Tempe, AZ 85280-2528 + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + */ + +/****************************************************************************** * This program handles xml files of the form: * <TEI.2> * <text> @@ -26,22 +48,6 @@ * author DM Smith */ -/* - * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org) - * CrossWire Bible Society - * P. O. Box 2528 - * Tempe, AZ 85280-2528 - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - */ #ifdef _MSC_VER #pragma warning( disable: 4251 ) @@ -73,7 +79,7 @@ using namespace sword; using namespace std; #ifdef _ICU_ -UTF8NFC normalizer; +UTF8NFC *normalizer = 0; int normalized = 0; Latin1UTF8 converter; @@ -186,7 +192,7 @@ void normalizeInput(SWKey &key, SWBuf &text) { if (utf8State > 0) { SWBuf before = text; - normalizer.processText(text, (SWKey *)2); // note the hack of 2 to mimic a real key. TODO: remove all hacks + normalizer->processText(text, (SWKey *)2); // note the hack of 2 to mimic a real key. TODO: remove all hacks if (before != text) { normalized++; } @@ -352,6 +358,10 @@ void usage(const char *app, const char *error = 0) { } int main(int argc, char **argv) { +#ifdef _ICU_ + UTF8NFC normalizr; + normalizer = &normalizr; +#endif SWBuf program = argv[0]; fprintf(stderr, "You are running %s: $Rev: 2138 $\n", argv[0]); @@ -429,7 +439,7 @@ int main(int argc, char **argv) { usage(*argv, "ERROR: SWORD library not compiled with ZIP compression support.\n\tBe sure libzip is available when compiling SWORD library"); #endif } - else if (compType = "LZSS") { + else if (compType == "LZSS") { compressor = new LZSSCompress(); } @@ -480,7 +490,7 @@ int main(int argc, char **argv) { if (cipherKey.size()) { fprintf(stderr, "Adding cipher filter with phrase: %s\n", cipherKey.c_str() ); cipherFilter = new CipherFilter(cipherKey.c_str()); - module->AddRawFilter(cipherFilter); + module->addRawFilter(cipherFilter); } if (!module->isWritable()) { @@ -495,8 +505,8 @@ int main(int argc, char **argv) { exit(-2); } - currentKey = module->CreateKey(); - currentKey->Persist(1); + currentKey = module->createKey(); + currentKey->setPersist(true); module->setKey(*currentKey); (*module) = TOP; |