[sword-cvs] sword/src/modules/filters latin1utf16.cpp,1.5,1.6 latin1utf8.cpp,1.10,1.11 scsuutf8.cpp,1.7,1.8 thmlheadings.cpp,1.5,1.6 thmlhtmlhref.cpp,1.24,1.25 thmlmorph.cpp,1.5,1.6 utf8utf16.cpp,1.6,1.7
sword@www.crosswire.org
sword@www.crosswire.org
Tue, 25 Feb 2003 22:44:31 -0700
Update of /usr/local/cvsroot/sword/src/modules/filters
In directory www:/tmp/cvs-serv1525/src/modules/filters
Modified Files:
latin1utf16.cpp latin1utf8.cpp scsuutf8.cpp thmlheadings.cpp
thmlhtmlhref.cpp thmlmorph.cpp utf8utf16.cpp
Log Message:
no message
Index: latin1utf16.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/latin1utf16.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** latin1utf16.cpp 1 Oct 2002 19:52:40 -0000 1.5
--- latin1utf16.cpp 26 Feb 2003 05:44:29 -0000 1.6
***************
*** 16,124 ****
! char Latin1UTF16::ProcessText(char *text, int maxlen, const SWKey *key, const SWModule *module)
! {
! unsigned char *from;
! unsigned short *to;
int len;
if ((unsigned long)key < 2) // hack, we're en(1)/de(0)ciphering
return -1;
- len = strlen(text) + 1; // shift string to right of buffer
- if (len < maxlen) {
- memmove(&text[maxlen - len], text, len);
- from = (unsigned char*)&text[maxlen - len];
- }
- else
- from = (unsigned char*)text;
- // -------------------------------
! for (to = (unsigned short*)text; *from; from++) {
! switch (*from) {
case 0x80: // ''
! *to++ = 0x20AC;
break;
case 0x82: // ''
! *to++ = 0x201A;
break;
case 0x83: // ''
! *to++ = 0x0192;
break;
case 0x84: // ''
! *to++ = 0x201E;
break;
case 0x85: // ''
! *to++ = 0x2026;
break;
case 0x86: // ''
! *to++ = 0x2020;
break;
case 0x87: // ''
! *to++ = 0x2021;
break;
case 0x88: // ''
! *to++ = 0x02C6;
break;
case 0x89: // ''
! *to++ = 0x2030;
break;
case 0x8A: // ''
! *to++ = 0x0160;
break;
case 0x8B: // ''
! *to++ = 0x2039;
break;
case 0x8C: // ''
! *to++ = 0x0152;
break;
case 0x8E: // ''
! *to++ = 0x017D;
break;
case 0x91: // ''
! *to++ = 0x2018;
break;
case 0x92: // ''
! *to++ = 0x2019;
break;
case 0x93: // ''
! *to++ = 0x201C;
break;
case 0x94: // ''
! *to++ = 0x201D;
break;
case 0x95: // ''
! *to++ = 0x2022;
break;
case 0x96: // ''
! *to++ = 0x2013;
break;
case 0x97: // ''
! *to++ = 0x2014;
break;
case 0x98: // ''
! *to++ = 0x02DC;
break;
case 0x99: // ''
! *to++ = 0x2122;
break;
case 0x9A: // ''
! *to++ = 0x0161;
break;
case 0x9B: // ''
! *to++ = 0x203A;
break;
case 0x9C: // ''
! *to++ = 0x0153;
break;
case 0x9E: // ''
! *to++ = 0x017E;
break;
case 0x9F: // ''
! *to++ = 0x0178;
break;
! default:
! *to++ = (unsigned short)*from;
! }
}
- *to = 0;
return 0;
}
--- 16,117 ----
! char Latin1UTF16::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
! const unsigned char *from;
int len;
if ((unsigned long)key < 2) // hack, we're en(1)/de(0)ciphering
return -1;
! SWBuf orig = text;
! from = orig.c_str();
!
! for (text = ""; *from; from++) {
! text.setSize(text.size()+2);
! switch (*from) {
case 0x80: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x20AC;
break;
case 0x82: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x201A;
break;
case 0x83: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x0192;
break;
case 0x84: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x201E;
break;
case 0x85: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2026;
break;
case 0x86: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2020;
break;
case 0x87: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2021;
break;
case 0x88: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x02C6;
break;
case 0x89: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2030;
break;
case 0x8A: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x0160;
break;
case 0x8B: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2039;
break;
case 0x8C: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x0152;
break;
case 0x8E: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x017D;
break;
case 0x91: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2018;
break;
case 0x92: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2019;
break;
case 0x93: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x201C;
break;
case 0x94: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x201D;
break;
case 0x95: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2022;
break;
case 0x96: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2013;
break;
case 0x97: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2014;
break;
case 0x98: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x02DC;
break;
case 0x99: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2122;
break;
case 0x9A: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x0161;
break;
case 0x9B: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x203A;
break;
case 0x9C: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x0153;
break;
case 0x9E: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x017E;
break;
case 0x9F: // ''
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x0178;
break;
! default:
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) *from;
! }
}
return 0;
}
Index: latin1utf8.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/latin1utf8.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** latin1utf8.cpp 1 Nov 2002 15:59:49 -0000 1.10
--- latin1utf8.cpp 26 Feb 2003 05:44:29 -0000 1.11
***************
*** 17,180 ****
! char Latin1UTF8::ProcessText(char *text, int maxlen, const SWKey *key, const SWModule *module)
{
! unsigned char *to, *from;
! int len;
if ((unsigned long)key < 2) // hack, we're en(1)/de(0)ciphering
return -1;
- len = strlen(text) + 1;
- // shift string to right of buffer
- if (len < maxlen) {
- memmove(&text[maxlen - len], text, len);
- from = (unsigned char*)&text[maxlen - len];
- }
- else
- from = (unsigned char*)text; // -------------------------------
-
! for (to = (unsigned char*)text; *from; from++) {
if (*from < 0x80) {
! *to++ = *from;
}
else if (*from < 0xc0) {
switch(*from) {
case 0x80: // ''
! *to++ = 0xe2; // ''
! *to++ = 0x82; // ''
! *to++ = 0xac; // ''
break;
case 0x82: // ''
! *to++ = 0xe2; // ''
! *to++ = 0x80; // ''
! *to++ = 0x9a; // ''
break;
case 0x83: // ''
! *to++ = 0xc6; // ''
! *to++ = 0x92; // ''
break;
case 0x84: // ''
! *to++ = 0xe2; // ''
! *to++ = 0x80; // ''
! *to++ = 0x9e; // ''
break;
case 0x85: // ''
! *to++ = 0xe2; // ''
! *to++ = 0x80; // ''
! *to++ = 0xa6; // ''
break;
case 0x86: // ''
! *to++ = 0xe2; // ''
! *to++ = 0x80; // ''
! *to++ = 0xa0; // ''
break;
case 0x87: // ''
! *to++ = 0xe2; // ''
! *to++ = 0x80; // ''
! *to++ = 0xa1; // ''
break;
case 0x88: // ''
! *to++ = 0xcb; // ''
! *to++ = 0x86; // ''
break;
case 0x89: // ''
! *to++ = 0xe2; // ''
! *to++ = 0x80; // ''
! *to++ = 0xb0; // ''
break;
case 0x8A: // ''
! *to++ = 0xc5; // ''
! *to++ = 0xa0; // ''
break;
case 0x8B: // ''
! *to++ = 0xe2; // ''
! *to++ = 0x80; // ''
! *to++ = 0xb9; // ''
break;
case 0x8C: // ''
! *to++ = 0xc5; // ''
! *to++ = 0x92; // ''
break;
case 0x8E: // ''
! *to++ = 0xc5; // ''
! *to++ = 0xbd; // ''
break;
case 0x91: // ''
! *to++ = 0xe2; // ''
! *to++ = 0x80; // ''
! *to++ = 0x98; // ''
break;
case 0x92: // ''
! *to++ = 0xe2; // ''
! *to++ = 0x80; // ''
! *to++ = 0x99; // ''
break;
case 0x93: // ''
! *to++ = 0xe2; // ''
! *to++ = 0x80; // ''
! *to++ = 0x9c; // ''
break;
case 0x94: // ''
! *to++ = 0xe2; // ''
! *to++ = 0x80; // ''
! *to++ = 0x9d; // ''
break;
case 0x95: // ''
! *to++ = 0xe2; // ''
! *to++ = 0x80; // ''
! *to++ = 0xa2; // ''
break;
case 0x96: // ''
! *to++ = 0xe2; // ''
! *to++ = 0x80; // ''
! *to++ = 0x93; // ''
break;
case 0x97: // ''
! *to++ = 0xe2; // ''
! *to++ = 0x80; // ''
! *to++ = 0x94; // ''
break;
case 0x98: // ''
! *to++ = 0xcb; // ''
! *to++ = 0x9c; // ''
break;
case 0x99: // ''
! *to++ = 0xe2; // ''
! *to++ = 0x84; // ''
! *to++ = 0xa2; // ''
break;
case 0x9A: // ''
! *to++ = 0xc5; // ''
! *to++ = 0xa1; // ''
break;
case 0x9B: // ''
! *to++ = 0xe2; // ''
! *to++ = 0x80; // ''
! *to++ = 0xba; // ''
break;
case 0x9C: // ''
! *to++ = 0xc5; // ''
! *to++ = 0x93; // ''
break;
case 0x9E: // ''
! *to++ = 0xc5; // ''
! *to++ = 0xbe; // ''
break;
case 0x9F: // ''
! *to++ = 0xc5; // ''
! *to++ = 0xb8; // ''
break;
default:
! *to++ = 0xC2;
! *to++ = *from;
}
}
else {
! *to++ = 0xC3;
! *to++ = (*from - 0x40);
}
}
- *to++ = 0;
- *to = 0;
return 0;
}
--- 17,171 ----
! char Latin1UTF8::processText(SWBuf &text, const SWKey *key, const SWModule *module)
{
! const unsigned char *from;
!
if ((unsigned long)key < 2) // hack, we're en(1)/de(0)ciphering
return -1;
+ SWBuf orig = text;
+ from = orig.c_str();
! for (text = ""; *from; from++) {
if (*from < 0x80) {
! text += *from;
}
else if (*from < 0xc0) {
switch(*from) {
case 0x80: // ''
! text += 0xe2; // ''
! text += 0x82; // ''
! text += 0xac; // ''
break;
case 0x82: // ''
! text += 0xe2; // ''
! text += 0x80; // ''
! text += 0x9a; // ''
break;
case 0x83: // ''
! text += 0xc6; // ''
! text += 0x92; // ''
break;
case 0x84: // ''
! text += 0xe2; // ''
! text += 0x80; // ''
! text += 0x9e; // ''
break;
case 0x85: // ''
! text += 0xe2; // ''
! text += 0x80; // ''
! text += 0xa6; // ''
break;
case 0x86: // ''
! text += 0xe2; // ''
! text += 0x80; // ''
! text += 0xa0; // ''
break;
case 0x87: // ''
! text += 0xe2; // ''
! text += 0x80; // ''
! text += 0xa1; // ''
break;
case 0x88: // ''
! text += 0xcb; // ''
! text += 0x86; // ''
break;
case 0x89: // ''
! text += 0xe2; // ''
! text += 0x80; // ''
! text += 0xb0; // ''
break;
case 0x8A: // ''
! text += 0xc5; // ''
! text += 0xa0; // ''
break;
case 0x8B: // ''
! text += 0xe2; // ''
! text += 0x80; // ''
! text += 0xb9; // ''
break;
case 0x8C: // ''
! text += 0xc5; // ''
! text += 0x92; // ''
break;
case 0x8E: // ''
! text += 0xc5; // ''
! text += 0xbd; // ''
break;
case 0x91: // ''
! text += 0xe2; // ''
! text += 0x80; // ''
! text += 0x98; // ''
break;
case 0x92: // ''
! text += 0xe2; // ''
! text += 0x80; // ''
! text += 0x99; // ''
break;
case 0x93: // ''
! text += 0xe2; // ''
! text += 0x80; // ''
! text += 0x9c; // ''
break;
case 0x94: // ''
! text += 0xe2; // ''
! text += 0x80; // ''
! text += 0x9d; // ''
break;
case 0x95: // ''
! text += 0xe2; // ''
! text += 0x80; // ''
! text += 0xa2; // ''
break;
case 0x96: // ''
! text += 0xe2; // ''
! text += 0x80; // ''
! text += 0x93; // ''
break;
case 0x97: // ''
! text += 0xe2; // ''
! text += 0x80; // ''
! text += 0x94; // ''
break;
case 0x98: // ''
! text += 0xcb; // ''
! text += 0x9c; // ''
break;
case 0x99: // ''
! text += 0xe2; // ''
! text += 0x84; // ''
! text += 0xa2; // ''
break;
case 0x9A: // ''
! text += 0xc5; // ''
! text += 0xa1; // ''
break;
case 0x9B: // ''
! text += 0xe2; // ''
! text += 0x80; // ''
! text += 0xba; // ''
break;
case 0x9C: // ''
! text += 0xc5; // ''
! text += 0x93; // ''
break;
case 0x9E: // ''
! text += 0xc5; // ''
! text += 0xbe; // ''
break;
case 0x9F: // ''
! text += 0xc5; // ''
! text += 0xb8; // ''
break;
default:
! text += 0xC2;
! text += *from;
}
}
else {
! text += 0xC3;
! text += (*from - 0x40);
}
}
return 0;
}
Index: scsuutf8.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/scsuutf8.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** scsuutf8.cpp 1 Oct 2002 19:52:40 -0000 1.7
--- scsuutf8.cpp 26 Feb 2003 05:44:29 -0000 1.8
***************
*** 62,67 ****
}
! char SCSUUTF8::ProcessText(char *text, int len, const SWKey *key, const SWModule *module)
! {
unsigned char *to, *from;
unsigned long buflen = len * FILTERPAD;
--- 62,67 ----
}
! char SCSUUTF8::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
! /*
unsigned char *to, *from;
unsigned long buflen = len * FILTERPAD;
***************
*** 108,112 ****
if (!len)
! return 0;
memmove(&text[buflen - len], text, len);
--- 108,112 ----
if (!len)
! return 0;
memmove(&text[buflen - len], text, len);
***************
*** 119,211 ****
! if (i >= len) break;
! c = from[i++];
! if (c >= 0x80)
{
to = UTF8Output (c - 0x80 + slide[active], to);
}
! else if (c >= 0x20 && c <= 0x7F)
{
to = UTF8Output (c, to);
}
! else if (c == 0x0 || c == 0x9 || c == 0xA || c == 0xC || c == 0xD)
{
to = UTF8Output (c, to);
}
! else if (c >= 0x1 && c <= 0x8) /* SQn */
{
! if (i >= len) break;
! /* single quote */ d = from[i++];
to = UTF8Output (d < 0x80 ? d + start [c - 0x1] :
d - 0x80 + slide [c - 0x1], to);
}
! else if (c >= 0x10 && c <= 0x17) /* SCn */
{
! /* change window */ active = c - 0x10;
}
! else if (c >= 0x18 && c <= 0x1F) /* SDn */
{
! /* define window */ active = c - 0x18;
! if (i >= len) break;
slide [active] = win [from[i++]];
}
! else if (c == 0xB) /* SDX */
{
! if (i >= len) break;
! c = from[i++];
! if (i >= len) break;
! d = from[i++];
slide [active = c>>5] = 0x10000 + (((c & 0x1F) << 8 | d) << 7);
}
! else if (c == 0xE) /* SQU */
{
! if (i >= len) break;
! /* SQU */ c = from[i++];
! if (i >= len) break;
! to = UTF8Output (c << 8 | from[i++], to);
! }
! else if (c == 0xF) /* SCU */
{
! /* change to Unicode mode */ mode = 1;
while (mode)
{
! if (i >= len) break;
! c = from[i++];
! if (c <= 0xDF || c >= 0xF3)
{
! if (i >= len) break;
to = UTF8Output (c << 8 | from[i++], to);
}
! else if (c == 0xF0) /* UQU */
{
! if (i >= len) break;
c = from[i++];
! if (i >= len) break;
! to = UTF8Output (c << 8 | from[i++], to);
}
! else if (c >= 0xE0 && c <= 0xE7) /* UCn */
{
active = c - 0xE0; mode = 0;
}
! else if (c >= 0xE8 && c <= 0xEF) /* UDn */
{
! if (i >= len) break;
slide [active=c-0xE8] = win [from[i++]]; mode = 0;
}
! else if (c == 0xF1) /* UDX */
{
! if (i >= len) break;
c = from[i++];
! if (i >= len) break;
! d = from[i++];
slide [active = c>>5] =
--- 119,211 ----
! if (i >= len) break;
! c = from[i++];
! if (c >= 0x80)
{
to = UTF8Output (c - 0x80 + slide[active], to);
}
! else if (c >= 0x20 && c <= 0x7F)
{
to = UTF8Output (c, to);
}
! else if (c == 0x0 || c == 0x9 || c == 0xA || c == 0xC || c == 0xD)
{
to = UTF8Output (c, to);
}
! else if (c >= 0x1 && c <= 0x8) // SQn
{
! if (i >= len) break;
! d = from[i++]; // single quote
to = UTF8Output (d < 0x80 ? d + start [c - 0x1] :
d - 0x80 + slide [c - 0x1], to);
}
! else if (c >= 0x10 && c <= 0x17) // SCn
{
! active = c - 0x10; // change window
}
! else if (c >= 0x18 && c <= 0x1F) // SDn
{
! active = c - 0x18; // define window
! if (i >= len) break;
slide [active] = win [from[i++]];
}
! else if (c == 0xB) // SDX
{
! if (i >= len) break;
! c = from[i++];
! if (i >= len) break;
! d = from[i++];
slide [active = c>>5] = 0x10000 + (((c & 0x1F) << 8 | d) << 7);
}
! else if (c == 0xE) // SQU
{
! if (i >= len) break;
! c = from[i++]; // SQU
! if (i >= len) break;
! to = UTF8Output (c << 8 | from[i++], to);
! }
! else if (c == 0xF) // SCU
{
! mode = 1; // change to Unicode mode
while (mode)
{
! if (i >= len) break;
! c = from[i++];
! if (c <= 0xDF || c >= 0xF3)
{
! if (i >= len) break;
to = UTF8Output (c << 8 | from[i++], to);
}
! else if (c == 0xF0) // UQU
{
! if (i >= len) break;
c = from[i++];
! if (i >= len) break;
! to = UTF8Output (c << 8 | from[i++], to);
}
! else if (c >= 0xE0 && c <= 0xE7) // UCn
{
active = c - 0xE0; mode = 0;
}
! else if (c >= 0xE8 && c <= 0xEF) // UDn
{
! if (i >= len) break;
slide [active=c-0xE8] = win [from[i++]]; mode = 0;
}
! else if (c == 0xF1) // UDX
{
! if (i >= len) break;
c = from[i++];
! if (i >= len) break;
! d = from[i++];
slide [active = c>>5] =
***************
*** 220,223 ****
--- 220,224 ----
*to++ = 0;
*to = 0;
+ */
return 0;
}
Index: thmlheadings.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/thmlheadings.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** thmlheadings.cpp 1 Oct 2002 19:52:40 -0000 1.5
--- thmlheadings.cpp 26 Feb 2003 05:44:29 -0000 1.6
***************
*** 42,62 ****
}
! char ThMLHeadings::ProcessText(char *text, int maxlen, const SWKey *key, const SWModule *module)
{
if (!option) { // if we don't want headings
! char *to, *from, token[2048]; // cheese. Fix.
int tokpos = 0;
bool intoken = false;
- int len;
bool hide = false;
! 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; // -------------------------------
! for (to = text; *from; from++) {
if (*from == '<') {
intoken = true;
--- 42,58 ----
}
! char ThMLHeadings::processText(SWBuf &text, const SWKey *key, const SWModule *module)
{
if (!option) { // if we don't want headings
! const char *from;
! char token[2048]; // cheese. Fix.
int tokpos = 0;
bool intoken = false;
bool hide = false;
! SWBuf orig = text;
! from = orig.c_str();
! for (text = ""; *from; from++) {
if (*from == '<') {
intoken = true;
***************
*** 78,91 ****
}
else if (hide && !strnicmp(token, "/div", 4)) {
! hide = false;
! continue;
}
// if not a heading token, keep token in text
if (!hide) {
! *to++ = '<';
! for (char *tok = token; *tok; tok++)
! *to++ = *tok;
! *to++ = '>';
}
continue;
--- 74,86 ----
}
else if (hide && !strnicmp(token, "/div", 4)) {
! hide = false;
! continue;
}
// if not a heading token, keep token in text
if (!hide) {
! text += '<';
! text += token;
! text += '>';
}
continue;
***************
*** 98,107 ****
else {
if (!hide) {
! *to++ = *from;
}
}
}
- *to++ = 0;
- *to = 0;
}
return 0;
--- 93,100 ----
else {
if (!hide) {
! text += *from;
}
}
}
}
return 0;
Index: thmlhtmlhref.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/thmlhtmlhref.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** thmlhtmlhref.cpp 21 Feb 2003 03:29:01 -0000 1.24
--- thmlhtmlhref.cpp 26 Feb 2003 05:44:29 -0000 1.25
***************
*** 199,203 ****
else { // like "<scripRef>John 3:16</scripRef>"
! buf += "<a href=\"passage=");
//char *strbuf = (char *)userData["lastTextNode"].c_str();
buf += userData["lastTextNode"].c_str();
--- 199,203 ----
else { // like "<scripRef>John 3:16</scripRef>"
! buf += "<a href=\"passage=";
//char *strbuf = (char *)userData["lastTextNode"].c_str();
buf += userData["lastTextNode"].c_str();
Index: thmlmorph.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/thmlmorph.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** thmlmorph.cpp 22 Feb 2003 10:52:06 -0000 1.5
--- thmlmorph.cpp 26 Feb 2003 05:44:29 -0000 1.6
***************
*** 68,72 ****
}
if (intoken) {
! token += *from
}
else {
--- 68,72 ----
}
if (intoken) {
! token += *from;
}
else {
Index: utf8utf16.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/utf8utf16.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** utf8utf16.cpp 1 Oct 2002 19:52:40 -0000 1.6
--- utf8utf16.cpp 26 Feb 2003 05:44:29 -0000 1.7
***************
*** 16,83 ****
! char UTF8UTF16::ProcessText(char *text, int maxlen, const SWKey *key, const SWModule *module)
! {
! unsigned char *from;
! unsigned short *to;
! int len;
! unsigned long uchar;
! unsigned char significantFirstBits, subsequent;
! unsigned short schar;
if ((unsigned long)key < 2) // hack, we're en(1)/de(0)ciphering
return -1;
! len = strlen(text) + 1; // shift string to right of buffer
! if (len < maxlen) {
! memmove(&text[maxlen - len], text, len);
! from = (unsigned char*)&text[maxlen - len];
! }
! else
! from = (unsigned char*)text;
!
!
! // -------------------------------
! for (to = (unsigned short*)text; *from; from++) {
! uchar = 0;
! if ((*from & 128) != 128) {
! // if (*from != ' ')
! uchar = *from;
! }
! else if ((*from & 128) && ((*from & 64) != 64)) {
! // error, do nothing
! continue;
! }
! else {
! *from <<= 1;
! for (subsequent = 1; (*from & 128); subsequent++) {
! *from <<= 1;
! from[subsequent] &= 63;
! uchar <<= 6;
! uchar |= from[subsequent];
! }
! subsequent--;
! *from <<=1;
! significantFirstBits = 8 - (2+subsequent);
!
! uchar |= (((short)*from) << (((6*subsequent)+significantFirstBits)-8));
! from += subsequent;
! }
! if (uchar < 0x1ffff) {
! *to++ = (unsigned short)uchar;
! }
! else {
! uchar -= 0x10000;
! schar = 0xD800 | (uchar & 0x03ff);
! uchar >>= 10;
! uchar |= 0xDC00;
! *to++ = (unsigned short)schar;
! *to++ = (unsigned short)uchar;
! }
! }
! *to = (unsigned short)0;
! return 0;
}
--- 16,77 ----
! char UTF8UTF16::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
! const unsigned char *from;
! int len;
! unsigned long uchar, uchars[10];
! unsigned char significantFirstBits, subsequent;
! unsigned short schar;
if ((unsigned long)key < 2) // hack, we're en(1)/de(0)ciphering
return -1;
!
! SWBuf orig = text;
! from = orig.c_str();
! for (text = ""; *from; from++) {
! uchar = 0;
! if ((*from & 128) != 128) {
! //if (*from != ' ')
! uchar = *from;
! }
! else if ((*from & 128) && ((*from & 64) != 64)) {
! // error, do nothing
! continue;
! }
! else {
! uchars[0] = *from;
! uchars[0] <<= 1;
! for (subsequent = 1; (uchars[0] & 128) && (subsequent < 10); subsequent++) {
! uchars[0] <<= 1;
! uchars[subsequent] = from[subsequent];
! uchars[subsequent] &= 63;
! uchar <<= 6;
! uchar |= uchars[subsequent];
! }
! subsequent--;
! uchars[0] <<=1;
! significantFirstBits = 8 - (2+subsequent);
!
! uchar |= (((short)uchars[0]) << (((6*subsequent)+significantFirstBits)-8));
! from += subsequent;
! }
! if (uchar < 0x1ffff) {
! text.setSize(text.size()+2);
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short)uchar;
! }
! else {
! uchar -= 0x10000;
! schar = 0xD800 | (uchar & 0x03ff);
! uchar >>= 10;
! uchar |= 0xDC00;
! text.setSize(text.size()+4);
! *((unsigned short *)(text.getRawData()+(text.size()-4))) = (unsigned short)schar;
! *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short)uchar;
! }
! }
! return 0;
}