[sword-cvs] sword/src/modules/filters gbfosis.cpp,1.13,1.14 latin1utf16.cpp,1.6,1.7 latin1utf8.cpp,1.11,1.12 osismorph.cpp,1.2,1.3 osisstrongs.cpp,1.2,1.3 thmlosis.cpp,1.22,1.23 unicodertf.cpp,1.11,1.12 utf8greekaccents.cpp,1.6,1.7 utf8utf16.cpp,1.7,1.8
sword@www.crosswire.org
sword@www.crosswire.org
Wed, 26 Feb 2003 17:56:33 -0700
Update of /usr/local/cvsroot/sword/src/modules/filters
In directory www:/tmp/cvs-serv19819/src/modules/filters
Modified Files:
gbfosis.cpp latin1utf16.cpp latin1utf8.cpp osismorph.cpp
osisstrongs.cpp thmlosis.cpp unicodertf.cpp
utf8greekaccents.cpp utf8utf16.cpp
Log Message:
Index: gbfosis.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/gbfosis.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** gbfosis.cpp 22 Nov 2002 04:46:03 -0000 1.13
--- gbfosis.cpp 27 Feb 2003 00:56:31 -0000 1.14
***************
*** 30,35 ****
! char GBFOSIS::ProcessText(char *text, int maxlen, const SWKey *key, const SWModule *module) {
!
char *to, *from, token[2048]; // cheese. Fix.
int tokpos = 0;
--- 30,35 ----
! char GBFOSIS::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
! /*
char *to, *from, token[2048]; // cheese. Fix.
int tokpos = 0;
***************
*** 170,181 ****
for (c = src;((*c) && (*c != '"')); c++);
! /* uncomment for SWORD absolute path logic
! if (*(c+1) == '/') {
! pushString(buf, "file:");
! pushString(buf, module->getConfigEntry("AbsoluteDataPath"));
! if (*((*buf)-1) == '/')
! c++; // skip '/'
! }
! end of uncomment for asolute path logic */
for (c++;((*c) && (*c != '"')); c++)
--- 170,181 ----
for (c = src;((*c) && (*c != '"')); c++);
! // uncomment for SWORD absolute path logic
! // if (*(c+1) == '/') {
! // pushString(buf, "file:");
! // pushString(buf, module->getConfigEntry("AbsoluteDataPath"));
! // if (*((*buf)-1) == '/')
! // c++; // skip '/'
! // }
! // end of uncomment for asolute path logic
for (c++;((*c) && (*c != '"')); c++)
***************
*** 355,383 ****
}
! /*
! else if (vkey->Chapter()) {
! sprintf(ref, "\t<div type=\"chapter\" osisID=\"%s\">", vkey->getOSISRef());
! }
! else sprintf(ref, "\t<div type=\"book\" osisID=\"%s\">", vkey->getOSISRef());
! */
}
}
*to++ = 0;
*to = 0;
return 0;
}
- void GBFOSIS::pushString(char **buf, const char *format, ...) {
- va_list argptr;
-
- va_start(argptr, format);
- *buf += vsprintf(*buf, format, argptr);
- va_end(argptr);
-
- // *buf += strlen(*buf);
- }
-
-
const char *GBFOSIS::convertToOSIS(const char *inRef, const SWKey *key) {
static std::string outRef;
--- 355,373 ----
}
! //
! // else if (vkey->Chapter()) {
! // sprintf(ref, "\t<div type=\"chapter\" osisID=\"%s\">", vkey->getOSISRef());
! // }
! // else sprintf(ref, "\t<div type=\"book\" osisID=\"%s\">", vkey->getOSISRef());
! //
}
}
*to++ = 0;
*to = 0;
+ */
return 0;
}
const char *GBFOSIS::convertToOSIS(const char *inRef, const SWKey *key) {
static std::string outRef;
***************
*** 425,449 ****
! void QuoteStack::handleQuote(char *buf, char *quotePos, char **to) {
//QuoteInstance(char startChar = '\"', char level = 1, string uniqueID = "", char continueCount = 0) {
if (!quotes.empty()) {
QuoteInstance last = quotes.top();
if (last.startChar == *quotePos) {
! GBFOSIS::pushString(to, "</quote>");
quotes.pop();
}
else {
quotes.push(QuoteInstance(*quotePos, last.level+1));
! quotes.top().pushStartStream(to);
}
}
else {
quotes.push(QuoteInstance(*quotePos));
! quotes.top().pushStartStream(to);
}
}
! void QuoteStack::QuoteInstance::pushStartStream(char **to) {
! GBFOSIS::pushString(to, "<quote level=\"%d\">", level);
}
--- 415,439 ----
! void QuoteStack::handleQuote(char *buf, char *quotePos, SWBuf &text) {
//QuoteInstance(char startChar = '\"', char level = 1, string uniqueID = "", char continueCount = 0) {
if (!quotes.empty()) {
QuoteInstance last = quotes.top();
if (last.startChar == *quotePos) {
! text += "</quote>";
quotes.pop();
}
else {
quotes.push(QuoteInstance(*quotePos, last.level+1));
! quotes.top().pushStartStream(text);
}
}
else {
quotes.push(QuoteInstance(*quotePos));
! quotes.top().pushStartStream(text);
}
}
! void QuoteStack::QuoteInstance::pushStartStream(SWBuf &text) {
! text.appendFormatted("<quote level=\"%d\">", level);
}
Index: latin1utf16.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/latin1utf16.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** latin1utf16.cpp 26 Feb 2003 05:44:29 -0000 1.6
--- latin1utf16.cpp 27 Feb 2003 00:56:31 -0000 1.7
***************
*** 24,28 ****
SWBuf orig = text;
! from = orig.c_str();
for (text = ""; *from; from++) {
--- 24,28 ----
SWBuf orig = text;
! from = (const unsigned char *)orig.c_str();
for (text = ""; *from; from++) {
Index: latin1utf8.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/latin1utf8.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** latin1utf8.cpp 26 Feb 2003 05:44:29 -0000 1.11
--- latin1utf8.cpp 27 Feb 2003 00:56:31 -0000 1.12
***************
*** 25,29 ****
SWBuf orig = text;
! from = orig.c_str();
for (text = ""; *from; from++) {
--- 25,29 ----
SWBuf orig = text;
! from = (const unsigned char *)orig.c_str();
for (text = ""; *from; from++) {
Index: osismorph.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/osismorph.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** osismorph.cpp 26 Feb 2003 19:21:52 -0000 1.2
--- osismorph.cpp 27 Feb 2003 00:56:31 -0000 1.3
***************
*** 49,59 ****
int tokpos = 0;
bool intoken = false;
- int len;
bool lastspace = false;
SWBuf orig = text;
from = orig.c_str();
- len = strlen(text) + 1; // shift string to right of buffer
-
for (text = ""; *from; from++) {
if (*from == '<') {
--- 49,56 ----
***************
*** 80,85 ****
// if not a morph tag token, keep token in text
text += '<';
! for (char *tok = token; *tok; tok++)
! text += *tok;
text += '>';
continue;
--- 77,81 ----
// if not a morph tag token, keep token in text
text += '<';
! text += token;
text += '>';
continue;
Index: osisstrongs.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/osisstrongs.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** osisstrongs.cpp 26 Feb 2003 19:21:52 -0000 1.2
--- osisstrongs.cpp 27 Feb 2003 00:56:31 -0000 1.3
***************
*** 91,95 ****
module->getEntryAttributes()["Word"][wordstr]["Strongs"] = val;
tmp = "";
! tmp.append(textStart, (int)(textEnd - textStart));
module->getEntryAttributes()["Word"][wordstr]["Text"] = tmp;
newText = true;
--- 91,95 ----
module->getEntryAttributes()["Word"][wordstr]["Strongs"] = val;
tmp = "";
! tmp.append(text.c_str()+textStart, text.c_str()+((int)(textEnd - textStart)));
module->getEntryAttributes()["Word"][wordstr]["Text"] = tmp;
newText = true;
Index: thmlosis.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/thmlosis.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** thmlosis.cpp 26 Jan 2003 09:57:45 -0000 1.22
--- thmlosis.cpp 27 Feb 2003 00:56:31 -0000 1.23
***************
*** 30,36 ****
! char ThMLOSIS::ProcessText(char *text, int maxlen, const SWKey *key, const SWModule *module) {
! char *to, *from, token[2048]; // cheese. Fix.
int tokpos = 0;
bool intoken = false;
--- 30,38 ----
! char ThMLOSIS::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
! /*
! const char *from;
! char token[2048]; // cheese. Fix.
int tokpos = 0;
bool intoken = false;
***************
*** 53,69 ****
std::string divEnd = "";
! len = strlen(text) + 1; // shift string to right of buffer
! if (len < maxlen) {
! memmove(&text[maxlen - len], text, len);
! from = &text[maxlen - len];
! }
! else from = text;
!
! textStart = from;
wordStart = text;
! // -------------------------------
- for (to = text; *from; from++) {
if (*from == '<') {
intoken = true;
--- 55,66 ----
std::string divEnd = "";
!
wordStart = text;
! SWBuf orig = text;
! from = orig.c_str();
!
! for (text = ""; *from; from++) {
if (*from == '<') {
intoken = true;
***************
*** 122,145 ****
handled = true;
}
! /* Usage of italics to represent transChange isn't domaninant;
! solution: mark in OSIS instead, assume no semantics other than emphasis
! of italicized text
! if (!strcmp(module->Type(), "Biblical Texts")) {
! // Italics assume transchange for Biblical texts
! if (!stricmp(token, "i")) {
! pushString(&to, "<transChange type=\"added\">");
! newText = true;
! lastspace = false;
! handled = true;
! }
! else if (!stricmp(token, "/i")) {
! pushString(&to, "</transChange>");
! lastspace = false;
! handled = true;
! }
! }
! else {
! // otherwise, italics are just italics
! */
if (!stricmp(token, "i")) {
pushString(&to, "<hi type=\"i\">");
--- 119,142 ----
handled = true;
}
! // Usage of italics to represent transChange isn't domaninant;
! // solution: mark in OSIS instead, assume no semantics other than emphasis
! // of italicized text
! // if (!strcmp(module->Type(), "Biblical Texts")) {
! // // Italics assume transchange for Biblical texts
! // if (!stricmp(token, "i")) {
! // pushString(&to, "<transChange type=\"added\">");
! // newText = true;
! // lastspace = false;
! // handled = true;
! // }
! // else if (!stricmp(token, "/i")) {
! // pushString(&to, "</transChange>");
! // lastspace = false;
! // handled = true;
! // }
! // }
! // else {
! // // otherwise, italics are just italics
! //-- end italics for transchange
if (!stricmp(token, "i")) {
pushString(&to, "<hi type=\"i\">");
***************
*** 191,202 ****
for (c = src;((*c) && (*c != '"')); c++);
! /* uncomment for SWORD absolute path logic
! if (*(c+1) == '/') {
! pushString(buf, "file:");
! pushString(buf, module->getConfigEntry("AbsoluteDataPath"));
! if (*((*buf)-1) == '/')
! c++; // skip '/'
! }
! end of uncomment for asolute path logic */
for (c++;((*c) && (*c != '"')); c++)
--- 188,199 ----
for (c = src;((*c) && (*c != '"')); c++);
! // uncomment for SWORD absolute path logic
! // if (*(c+1) == '/') {
! // pushString(buf, "file:");
! // pushString(buf, module->getConfigEntry("AbsoluteDataPath"));
! // if (*((*buf)-1) == '/')
! // c++; // skip '/'
! // }
! // end of uncomment for asolute path logic
for (c++;((*c) && (*c != '"')); c++)
***************
*** 353,368 ****
*to++ = 0;
*to = 0;
return 0;
- }
-
-
- void ThMLOSIS::pushString(char **buf, const char *format, ...) {
- va_list argptr;
-
- va_start(argptr, format);
- *buf += vsprintf(*buf, format, argptr);
- va_end(argptr);
-
- // *buf += strlen(*buf);
}
--- 350,355 ----
*to++ = 0;
*to = 0;
+ */
return 0;
}
Index: unicodertf.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/unicodertf.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** unicodertf.cpp 26 Feb 2003 19:41:57 -0000 1.11
--- unicodertf.cpp 27 Feb 2003 00:56:31 -0000 1.12
***************
*** 18,31 ****
char UnicodeRTF::processText(SWBuf &text, const SWKey *key, const SWModule *module)
{
! unsigned char *from;
! int len;
char digit[10];
short ch; // must be signed per unicode spec (negative is ok for big numbers > 32768)
SWBuf orig = text;
! len = strlenw(text.c_str()) + 2; // shift string to right of buffer
! #warning is this right? I needed to cast "const" away.
! from = (unsigned char*)orig.c_str();
// -------------------------------
--- 18,29 ----
char UnicodeRTF::processText(SWBuf &text, const SWKey *key, const SWModule *module)
{
! const unsigned char *from;
char digit[10];
short ch; // must be signed per unicode spec (negative is ok for big numbers > 32768)
+ unsigned char from2[7];
SWBuf orig = text;
! from = (const unsigned char *)orig.c_str();
// -------------------------------
***************
*** 41,61 ****
}
if ((*from & 128) && ((*from & 64) != 64)) {
! // error
! *from = 'x';
continue;
}
! *from <<= 1;
int subsequent;
! for (subsequent = 1; (*from & 128); subsequent++) {
! *from <<= 1;
! from[subsequent] &= 63;
ch <<= 6;
! ch |= from[subsequent];
}
subsequent--;
! *from <<=1;
char significantFirstBits = 8 - (2+subsequent);
! ch |= (((short)*from) << (((6*subsequent)+significantFirstBits)-8));
from += subsequent;
text += '\\';
--- 39,61 ----
}
if ((*from & 128) && ((*from & 64) != 64)) {
! // error, should never get here
! // *from = 'x';
continue;
}
! from2[0] = *from;
! from2[0] <<= 1;
int subsequent;
! for (subsequent = 1; (*from & 128) && (subsequent < 7); subsequent++) {
! from2[0] <<= 1;
! from2[subsequent] = from[subsequent];
! from2[subsequent] &= 63;
ch <<= 6;
! ch |= from2[subsequent];
}
subsequent--;
! from2[0] <<= 1;
char significantFirstBits = 8 - (2+subsequent);
! ch |= (((short)from2[0]) << (((6*subsequent)+significantFirstBits)-8));
from += subsequent;
text += '\\';
Index: utf8greekaccents.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/utf8greekaccents.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** utf8greekaccents.cpp 1 Oct 2002 19:52:40 -0000 1.6
--- utf8greekaccents.cpp 27 Feb 2003 00:56:31 -0000 1.7
***************
*** 35,40 ****
}
! char UTF8GreekAccents::ProcessText(char *text, int maxlen, const SWKey *key, const SWModule *module)
! {
if (!option) {
unsigned char *to, *from;
--- 35,40 ----
}
! char UTF8GreekAccents::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
! /*
if (!option) {
unsigned char *to, *from;
***************
*** 244,247 ****
--- 244,248 ----
*to = 0;
}
+ */
return 0;
}
Index: utf8utf16.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/utf8utf16.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** utf8utf16.cpp 26 Feb 2003 05:44:29 -0000 1.7
--- utf8utf16.cpp 27 Feb 2003 00:56:31 -0000 1.8
***************
*** 29,33 ****
SWBuf orig = text;
! from = orig.c_str();
for (text = ""; *from; from++) {
--- 29,33 ----
SWBuf orig = text;
! from = (const unsigned char *)orig.c_str();
for (text = ""; *from; from++) {