[sword-cvs] sword/src/modules/filters gbfhtmlhref.cpp,1.13,1.14 gbfplain.cpp,1.14,1.15 gbfrtf.cpp,1.30,1.31 plainfootnotes.cpp,1.8,1.9 plainhtml.cpp,1.6,1.7

sword@www.crosswire.org sword@www.crosswire.org
Thu, 20 Feb 2003 05:31:56 -0700


Update of /usr/local/cvsroot/sword/src/modules/filters
In directory www:/tmp/cvs-serv22664/src/modules/filters

Modified Files:
	gbfhtmlhref.cpp gbfplain.cpp gbfrtf.cpp plainfootnotes.cpp 
	plainhtml.cpp 
Log Message:
some more filters updated to SWBuf
needs review

Index: gbfhtmlhref.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/gbfhtmlhref.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** gbfhtmlhref.cpp	26 Jan 2003 07:50:26 -0000	1.13
--- gbfhtmlhref.cpp	20 Feb 2003 12:31:54 -0000	1.14
***************
*** 16,26 ****
   ***************************************************************************/
  
- #include <stdlib.h>
- #include <string.h>
  #include <gbfhtmlhref.h>
- #include <ctype.h>
- #include <string>
- 
- using std::string;
  
  SWORD_NAMESPACE_START
--- 16,20 ----
***************
*** 64,68 ****
  
  
! bool GBFHTMLHREF::handleToken(char **buf, const char *token, DualStringMap &userData) {
  	const char *tok;
  	char val[128];
--- 58,62 ----
  
  
! bool GBFHTMLHREF::handleToken(SWBuf &buf, const char *token, DualStringMap &userData) {
  	const char *tok;
  	char val[128];
***************
*** 90,101 ****
  				*valto = 0;
  				if (atoi((!isdigit(*val))?val+1:val) < 5627) {
! 					pushString(buf, " <small><em>&lt;<a href=\"type=Strongs value=");
  					for (tok = val; *tok; tok++)
! 							*(*buf)++ = *tok;
! 					*(*buf)++ = '\"';
! 					*(*buf)++ = '>';
  					for (tok = (!isdigit(*val))?val+1:val; *tok; tok++)
! 							*(*buf)++ = *tok;
! 					pushString(buf, "</a>&gt;</em></small> ");
  					//cout << buf;
  					
--- 84,94 ----
  				*valto = 0;
  				if (atoi((!isdigit(*val))?val+1:val) < 5627) {
! 					buf += " <small><em>&lt;<a href=\"type=Strongs value=";
  					for (tok = val; *tok; tok++)
! 							buf += *tok;
! 					buf += "\">";
  					for (tok = (!isdigit(*val))?val+1:val; *tok; tok++)
! 							buf += *tok;
! 					buf += "</a>&gt;</em></small> ";
  					//cout << buf;
  					
***************
*** 115,175 ****
  					*valto++ = *num;
  				*valto = 0;
! 				pushString(buf, " <small><em>(<a href=\"type=morph class=Robinson value=");
  				for (tok = val; *tok; tok++)
  				// normal robinsons tense
! 						*(*buf)++ = *tok;
! 				*(*buf)++ = '\"';
! 				*(*buf)++ = '>';
  				for (tok = val; *tok; tok++)				
  					//if(*tok != '\"') 			
! 						*(*buf)++ = *tok;		
! 				pushString(buf, "</a>)</em></small> ");					
  			}
  		}
  		
  		else if (!strncmp(token, "WG", 2) || !strncmp(token, "WH", 2)) { // strong's numbers
! 			pushString(buf, " <small><em>&lt;<a href=\"type=Strongs value=");
  			for (tok = token+1; *tok; tok++)
  				//if(token[i] != '\"')
! 					*(*buf)++ = *tok;
! 			*(*buf)++ = '\"';
! 			*(*buf)++ = '>';
  			for (tok = token + 2; *tok; tok++)
  				//if(token[i] != '\"')
! 					*(*buf)++ = *tok;
! 			pushString(buf, "</a>&gt;</em></small>");
  		}
  
  		else if (!strncmp(token, "WTG", 3) || !strncmp(token, "WTH", 3)) { // strong's numbers tense
! 			pushString(buf, " <small><em>&lt;<a href=\"type=Strongs value=");
  			for (tok = token + 2; *tok; tok++)
  				if(*tok != '\"')
! 					*(*buf)++ = *tok;
! 			*(*buf)++ = '\"';
! 			*(*buf)++ = '>';
  			for (tok = token + 3; *tok; tok++)
  				if(*tok != '\"')
! 					*(*buf)++ = *tok;
! 			pushString(buf, "</a>)</em></small>");
  		}
  
  		else if (!strncmp(token, "WT", 2) && strncmp(token, "WTH", 3) && strncmp(token, "WTG", 3)) { // morph tags
! 			pushString(buf, " <small><em>(<a href=\"type=morph class=none value=");
  			for (tok = token + 2; *tok; tok++)
  				if(*tok != '\"')
! 					*(*buf)++ = *tok;
! 			*(*buf)++ = '\"';
! 			*(*buf)++ = '>';
  			for (tok = token + 2; *tok; tok++)				
  				if(*tok != '\"') 			
! 					*(*buf)++ = *tok;		
! 			pushString(buf, "</a>)</em></small>");
  		}
  
  		else if (!strncmp(token, "RX", 2)) {
! 			pushString(buf, "<a href=\"");
  			for (tok = token + 3; *tok; tok++) {
  			  if(*tok != '<' && *tok+1 != 'R' && *tok+2 != 'x') {
! 			    *(*buf)++ = *tok;
  			  }
  			  else {
--- 108,164 ----
  					*valto++ = *num;
  				*valto = 0;
! 				buf += " <small><em>(<a href=\"type=morph class=Robinson value=";
  				for (tok = val; *tok; tok++)
  				// normal robinsons tense
! 						buf += *tok;
! 				buf += "\">";
  				for (tok = val; *tok; tok++)				
  					//if(*tok != '\"') 			
! 						buf += *tok;		
! 				buf += "</a>)</em></small> ";					
  			}
  		}
  		
  		else if (!strncmp(token, "WG", 2) || !strncmp(token, "WH", 2)) { // strong's numbers
! 			buf += " <small><em>&lt;<a href=\"type=Strongs value=";
  			for (tok = token+1; *tok; tok++)
  				//if(token[i] != '\"')
! 					buf += *tok;
! 			buf += "\">";
  			for (tok = token + 2; *tok; tok++)
  				//if(token[i] != '\"')
! 					buf += *tok;
! 			buf += "</a>&gt;</em></small>";
  		}
  
  		else if (!strncmp(token, "WTG", 3) || !strncmp(token, "WTH", 3)) { // strong's numbers tense
! 			buf += " <small><em>&lt;<a href=\"type=Strongs value=";
  			for (tok = token + 2; *tok; tok++)
  				if(*tok != '\"')
! 					buf += *tok;
! 			buf += "\">";
  			for (tok = token + 3; *tok; tok++)
  				if(*tok != '\"')
! 					buf += *tok;
! 			buf += "</a>)</em></small>";
  		}
  
  		else if (!strncmp(token, "WT", 2) && strncmp(token, "WTH", 3) && strncmp(token, "WTG", 3)) { // morph tags
! 			buf += " <small><em>(<a href=\"type=morph class=none value=";
  			for (tok = token + 2; *tok; tok++)
  				if(*tok != '\"')
! 					buf += *tok;
! 			buf += "\">";
  			for (tok = token + 2; *tok; tok++)				
  				if(*tok != '\"') 			
! 					buf += *tok;		
! 			buf += "</a>)</em></small>";
  		}
  
  		else if (!strncmp(token, "RX", 2)) {
! 			buf += "<a href=\"";
  			for (tok = token + 3; *tok; tok++) {
  			  if(*tok != '<' && *tok+1 != 'R' && *tok+2 != 'x') {
! 			    buf += *tok;
  			  }
  			  else {
***************
*** 177,186 ****
  			  }
  			}
! 			*(*buf)++ = '\"';
! 			*(*buf)++ = '>';
  		}
  
  		else if (!strncmp(token, "RB", 2)) {
! 			pushString(buf, "<i>");
  			userData["hasFootnotePreTag"] = "true";
  		}
--- 166,174 ----
  			  }
  			}
! 			buf += "\">";
  		}
  
  		else if (!strncmp(token, "RB", 2)) {
! 			buf += "<i>";
  			userData["hasFootnotePreTag"] = "true";
  		}
***************
*** 189,208 ****
  			if(userData["hasFootnotePreTag"] == "true") {
  				userData["hasFootnotePreTag"] = "false";
! 				pushString(buf, "</i> ");
  			}
! 			pushString(buf, "<font color=\"#800000\"><small> (");
  		}
  
  		else if (!strncmp(token, "FN", 2)) {
! 			pushString(buf, "<font face=\"");
  			for (tok = token + 2; *tok; tok++)				
  				if(*tok != '\"') 			
! 					*(*buf)++ = *tok;
! 			*(*buf)++ = '\"';
! 			*(*buf)++ = '>';
  		}
  
  		else if (!strncmp(token, "CA", 2)) {	// ASCII value
! 			*(*buf)++ = (char)atoi(&token[2]);
  		}
  		
--- 177,195 ----
  			if(userData["hasFootnotePreTag"] == "true") {
  				userData["hasFootnotePreTag"] = "false";
! 				buf += "</i> ";
  			}
! 			buf += "<font color=\"#800000\"><small> (";
  		}
  
  		else if (!strncmp(token, "FN", 2)) {
! 			buf += "<font face=\"";
  			for (tok = token + 2; *tok; tok++)				
  				if(*tok != '\"') 			
! 					buf += *tok;
! 			buf += "\">";
  		}
  
  		else if (!strncmp(token, "CA", 2)) {	// ASCII value
! 			buf += (char)atoi(&token[2]);
  		}
  		

Index: gbfplain.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/gbfplain.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** gbfplain.cpp	1 Oct 2002 19:52:40 -0000	1.14
--- gbfplain.cpp	20 Feb 2003 12:31:54 -0000	1.15
***************
*** 16,34 ****
  
  
! char GBFPlain::ProcessText(char *text, int maxlen, const SWKey *key, const SWModule *module)
  {
! 	char *to, *from, token[2048];
  	int tokpos = 0;
  	bool intoken = false;
! 	int len;
! 
! 	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;
--- 16,28 ----
  
  
! char GBFPlain::processText (SWBuf &text, const SWKey *key, const SWModule *module)
  {
! 	char token[2048];
  	int tokpos = 0;
  	bool intoken = false;
! 	const char *from;
! 	SWBuf orig = text;
! 	from = orig.c_str();
! 	for (text = ""; *from; from++) {
  		if (*from == '<') {
  			intoken = true;
***************
*** 48,57 ****
  					case 'H':               // Hebrew
  					case 'T':               // Tense
! 						*to++ = ' ';
! 						*to++ = '<';
  						for (char *tok = token + 2; *tok; tok++)
! 							*to++ = *tok;
! 						*to++ = '>';
! 						*to++ = ' ';
  						continue;
  				}
--- 42,49 ----
  					case 'H':               // Hebrew
  					case 'T':               // Tense
! 						text += " <";
  						for (char *tok = token + 2; *tok; tok++)
! 							text += *tok;
! 						text += "> ";
  						continue;
  				}
***************
*** 60,69 ****
  				switch(token[1]) {
  				case 'F':               // footnote begin
! 					*to++ = ' ';
! 					*to++ = '[';
  					continue;
  				case 'f':               // footnote end
! 					*to++ = ']';
! 					*to++ = ' ';
  					continue;
  				}
--- 52,59 ----
  				switch(token[1]) {
  				case 'F':               // footnote begin
! 					text += " [";
  					continue;
  				case 'f':               // footnote end
! 					text += "] ";
  					continue;
  				}
***************
*** 72,79 ****
  				switch(token[1]) {
  				case 'A':               // ASCII value
! 					*to++ = (char)atoi(&token[2]);
  					continue;
  				case 'G':
! 					*to++ = '>';
  					continue;
  /*								Bug in WEB
--- 62,69 ----
  				switch(token[1]) {
  				case 'A':               // ASCII value
! 					text += (char)atoi(&token[2]);
  					continue;
  				case 'G':
! 					text += ">";
  					continue;
  /*								Bug in WEB
***************
*** 84,92 ****
  				case 'L':	//        Bug in WEB.  Use above entry when fixed
  				case 'N':               // new line
! 					*to++ = '\n';
  					continue;
  				case 'M':               // new paragraph
! 					*to++ = '\n';
! 					*to++ = '\n';
  					continue;
  				}
--- 74,81 ----
  				case 'L':	//        Bug in WEB.  Use above entry when fixed
  				case 'N':               // new line
! 					text += '\n';
  					continue;
  				case 'M':               // new paragraph
! 					text += "\n\n";
  					continue;
  				}
***************
*** 100,107 ****
  				token[tokpos+2] = 0;
  		}
! 		else	*to++ = *from;
  	}
- 	*to++ = 0;
-  	*to = 0;
  	return 0;
  }
--- 89,94 ----
  				token[tokpos+2] = 0;
  		}
! 		else	text += *from;
  	}
  	return 0;
  }

Index: gbfrtf.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/gbfrtf.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** gbfrtf.cpp	11 Feb 2003 23:37:53 -0000	1.30
--- gbfrtf.cpp	20 Feb 2003 12:31:54 -0000	1.31
***************
*** 5,15 ****
  
  
- #include <stdlib.h>
- #include <string.h>
  #include <gbfrtf.h>
  #include <ctype.h>
- #include <string>
- 
- using std::string;
  
  SWORD_NAMESPACE_START
--- 5,10 ----
***************
*** 19,25 ****
  
  
! char GBFRTF::ProcessText(char *text, int maxlen, const SWKey *key, const SWModule *module)
  {
- 	unsigned char *to, *from;
  	char token[2048];
  	char val[128];
--- 14,19 ----
  
  
! char GBFRTF::processText(SWBuf &text, const SWKey *key, const SWModule *module)
  {
  	char token[2048];
  	char val[128];
***************
*** 30,35 ****
  	int len;
  	const char *tok;
! 	string strongnum;
! 	string strongtense;
  	bool hideText = false;
  	int wordLen = 0;
--- 24,29 ----
  	int len;
  	const char *tok;
! 	SWBuf strongnum;
! 	SWBuf strongtense;
  	bool hideText = false;
  	int wordLen = 0;
***************
*** 37,47 ****
  	int i;
  
! 	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 == '<') {
  			wordLen = wordCount;
--- 31,38 ----
  	int i;
  
! 	const char *from;
! 	SWBuf orig = text;
! 	from = orig.c_str();
! 	for (text = ""; *from; from++) {
  		if (*from == '<') {
  			wordLen = wordCount;
***************
*** 77,96 ****
  					if (atoi((!isdigit(*val))?val+1:val) < 5627) {
  						// normal strongs number
! 						strongnum += '{';
! 						strongnum += '\\';
! 						strongnum += 'c';
! 						strongnum += 'f';
! 						strongnum += '3';
! 						strongnum += ' ';
! 						strongnum += '\\';
! 						strongnum += 's';
! 						strongnum += 'u';
! 						strongnum += 'b';
! 						strongnum += ' ';
! 						strongnum += '<';
  						for (tok = (!isdigit(*val))?val+1:val; *tok; tok++)
  							strongnum += *tok;
! 						strongnum += '>';
! 						strongnum += '}';
  					}
  					/*	forget these for now
--- 68,75 ----
  					if (atoi((!isdigit(*val))?val+1:val) < 5627) {
  						// normal strongs number
! 						strongnum += "{\\cf3 \\sub <";
  						for (tok = (!isdigit(*val))?val+1:val; *tok; tok++)
  							strongnum += *tok;
! 						strongnum += ">}";
  					}
  					/*	forget these for now
***************
*** 109,128 ****
  					*valto = 0;
  					// normal robinsons tense
! 					strongtense += '{';
! 					strongtense += '\\';
! 					strongtense += 'c';
! 					strongtense += 'f';
! 					strongtense += '4';
! 					strongtense += ' ';
! 					strongtense += '\\';
! 					strongtense += 's';
! 					strongtense += 'u';
! 					strongtense += 'b';
! 					strongtense += ' ';
! 					strongtense += '(';
  					for (tok = val; *tok; tok++)
  						strongtense += *tok;
! 					strongtense += ')';
! 					strongtense += '}';
  				}
  				continue;
--- 88,95 ----
  					*valto = 0;
  					// normal robinsons tense
! 					strongtense += "{\\cf4 \\sub (";
  					for (tok = val; *tok; tok++)
  						strongtense += *tok;
! 					strongtense += ")}";
  				}
  				continue;
***************
*** 131,138 ****
  				if (token[1] == 'w') {
  					if ((wordCount > 0) || (strongnum != "{\\cf3 \\sub <3588>}")) {
! 						for (i = 0; i < strongnum.length(); i++)
! 							*to++ = strongnum[i];
! 					for (i = 0; i < strongtense.length(); i++)
! 						*to++ = strongtense[i];
  					}
  				}
--- 98,105 ----
  				if (token[1] == 'w') {
  					if ((wordCount > 0) || (strongnum != "{\\cf3 \\sub <3588>}")) {
! 						//for (i = 0; i < strongnum.length(); i++)
! 							text += strongnum;
! 					//for (i = 0; i < strongtense.length(); i++)
! 						text += strongtense;
  					}
  				}
***************
*** 143,182 ****
  				case 'G':               // Greek
  				case 'H':               // Hebrew
! 					*to++ = '{';
! 					*to++ = '\\';
! 					*to++ = 'c';
! 					*to++ = 'f';
! 					*to++ = '3';
! 					*to++ = ' ';
! 					*to++ = '\\';
! 					*to++ = 's';
! 					*to++ = 'u';
! 					*to++ = 'b';
! 					*to++ = ' ';
! 					*to++ = '<';
  					for (tok = token + 2; *tok; tok++)
! 						*to++ = *tok;
! 					*to++ = '>';
! 					*to++ = '}';
  					continue;
  
  				case 'T':               // Tense
! 					*to++ = '{';
! 					*to++ = '\\';
! 					*to++ = 'c';
! 					*to++ = 'f';
! 					*to++ = '4';
! 					*to++ = ' ';
! 					*to++ = '\\';
! 					*to++ = 's';
! 					*to++ = 'u';
! 					*to++ = 'b';
! 					*to++ = ' ';
! 					*to++ = '(';
  					bool separate = false;
  					for (tok = token + 2; *tok; tok++) {
  						if (separate) {
! 							*to++ = ';';
! 							*to++ = ' ';
  							separate = false;
  						}
--- 110,125 ----
  				case 'G':               // Greek
  				case 'H':               // Hebrew
! 					text += "{\\cf3 \\sub <";
  					for (tok = token + 2; *tok; tok++)
! 						text += *tok;
! 					text += ">}";
  					continue;
  
  				case 'T':               // Tense
! 					text += "{\\cf4 \\sub (";
  					bool separate = false;
  					for (tok = token + 2; *tok; tok++) {
  						if (separate) {
! 							text += "; ";
  							separate = false;
  						}
***************
*** 186,190 ****
  							for (tok++; *tok; tok++) {
  								if (isdigit(*tok)) {
! 									*to++ = *tok;
  									separate = true;
  								}
--- 129,133 ----
  							for (tok++; *tok; tok++) {
  								if (isdigit(*tok)) {
! 									text += *tok;
  									separate = true;
  								}
***************
*** 197,206 ****
  						default:
  							for (; *tok; tok++) {
! 							       *to++ = *tok;
  							}
  						}
  					}
! 					*to++ = ')';
! 					*to++ = '}';
  					continue;
  				}
--- 140,148 ----
  						default:
  							for (; *tok; tok++) {
! 							       text += *tok;
  							}
  						}
  					}
! 					text += ")}";
  					continue;
  				}
***************
*** 209,247 ****
  				switch(token[1]) {
  				case 'X':
! 				  *to++ = '<';
! 				  *to++ = 'a';
! 				  *to++ = ' ';
! 				  *to++ = 'h';
! 				  *to++ = 'r';
! 				  *to++ = 'e';
! 				  *to++ = 'f';
! 				  *to++ = '=';
! 				  *to++ = '"';
! 				  *to++ = '"';
! 				  *to++ = '>';
  				  continue;
  				case 'x':
! 				  *to++ = '<';
! 				  *to++ = '/';
! 				  *to++ = 'a';
! 				  *to++ = '>';
  				  continue;
  				case 'F':               // footnote begin
! 					*to++ = '{';
! 					*to++ = '\\';
! 					*to++ = 'i';
! 					*to++ = '1';
! 					*to++ = ' ';
! 					*to++ = '\\';
! 					*to++ = 's';
! 					*to++ = 'u';
! 					*to++ = 'b';
! 					*to++ = ' ';
! 					*to++ = '(';
  					continue;
  				case 'f':               // footnote end
! 					*to++ = ')';
! 					*to++ = ' ';
! 					*to++ = '}';
  					continue;
  				}
--- 151,164 ----
  				switch(token[1]) {
  				case 'X':
! 					text += "<a href=\"\">";
  				  continue;
  				case 'x':
! 					text += "</a>";
  				  continue;
  				case 'F':               // footnote begin
! 					text += "{\\i1 \\sub (";
  					continue;
  				case 'f':               // footnote end
! 					text += ") }";
  					continue;
  				}
***************
*** 250,358 ****
  				switch(token[1]) {
  				case 'I':		// italic start
! 					*to++ = '\\';
! 					*to++ = 'i';
! 					*to++ = '1';
! 					*to++ = ' ';
  					continue;
  				case 'i':		// italic end
! 					*to++ = '\\';
! 					*to++ = 'i';
! 					*to++ = '0';
! 					*to++ = ' ';
  					continue;
  				case 'B':		// bold start
! 					*to++ = '\\';
! 					*to++ = 'b';
! 					*to++ = '1';
! 					*to++ = ' ';
  					continue;
  				case 'b':		// bold end
! 					*to++ = '\\';
! 					*to++ = 'b';
! 					*to++ = '0';
! 					*to++ = ' ';
  					continue;
  				case 'N':
! 					   *to++ = '{';
  					   if (!strnicmp(token+2, "Symbol", 6)) {
! 					  *to++ = '\\';
! 					  *to++ = 'f';
! 					  *to++ = '7';
! 					  *to++ = ' ';
  					}
  					continue;
  				case 'n':
! 					*to++ = '}';
  					continue;
  				case 'S':
! 					*to++ = '{';
! 					*to++ = '\\';
! 					*to++ = 's';
! 					*to++ = 'u';
! 					*to++ = 'p';
! 					*to++ = 'e';
! 					*to++ = 'r';
! 					*to++ = ' ';
  					continue;
  				case 's':
! 					*to++ = '}';
  					continue;
  				case 'R':
! 					*to++ = '{';
! 					*to++ = '\\';
! 					*to++ = 'c';
! 					*to++ = 'f';
! 					*to++ = '6';
! 					*to++ = ' ';
  					continue;
  				case 'r':
! 					*to++ = '}';
  					continue;
  				case 'O':
  				case 'C':
! 					*to++ = '\\';
! 					*to++ = 's';
! 					*to++ = 'c';
! 					*to++ = 'a';
! 					*to++ = 'p';
! 					*to++ = 's';
! 					*to++ = '1';
! 					*to++ = ' ';
  					continue;
  				case 'o':
  				case 'c':
! 					*to++ = '\\';
! 					*to++ = 's';
! 					*to++ = 'c';
! 					*to++ = 'a';
! 					*to++ = 'p';
! 					*to++ = 's';
! 					*to++ = '0';
! 					*to++ = ' ';
  					continue;
  				case 'V':
! 					*to++ = '{';
! 					*to++ = '\\';
! 					*to++ = 's';
! 					*to++ = 'u';
! 					*to++ = 'b';
! 					*to++ = ' ';
  					continue;
  				case 'v':
! 					*to++ = '}';
  					continue;
  				case 'U':
! 					*to++ = '\\';
! 					*to++ = 'u';
! 					*to++ = 'l';
! 					*to++ = '1';
! 					*to++ = ' ';
  					continue;
  				case 'u':
! 					*to++ = '\\';
! 					*to++ = 'u';
! 					*to++ = 'l';
! 					*to++ = '0';
! 					*to++ = ' ';
  					continue;
  				}
--- 167,221 ----
  				switch(token[1]) {
  				case 'I':		// italic start
! 					text += "\\i1 ";
  					continue;
  				case 'i':		// italic end
! 					text += "\\i0 ";
  					continue;
  				case 'B':		// bold start
! 					text += "\\b1 ";
  					continue;
  				case 'b':		// bold end
! 					text += "\\b0 ";
  					continue;
  				case 'N':
! 					text += '{';
  					   if (!strnicmp(token+2, "Symbol", 6)) {
! 						   text += "\\f7 ";
  					}
  					continue;
  				case 'n':
! 					text += '}';
  					continue;
  				case 'S':
! 					text += "{\\super ";
  					continue;
  				case 's':
! 					text += '}';
  					continue;
  				case 'R':
! 					text += "{\\cf6 ";
  					continue;
  				case 'r':
! 					text += '}';
  					continue;
  				case 'O':
  				case 'C':
! 					text += "\\scaps1 ";
  					continue;
  				case 'o':
  				case 'c':
! 					text += "\\scaps0 ";
  					continue;
  				case 'V':
! 					text += "{\\sub ";
  					continue;
  				case 'v':
! 					text += '}';
  					continue;
  				case 'U':
! 					text += "\\ul1 ";
  					continue;
  				case 'u':
! 					text += "\\ul0 ";
  					continue;
  				}
***************
*** 361,386 ****
  				switch(token[1]) {
  				case 'A':               // ASCII value
! 					*to++ = (char)atoi(&token[2]);
  					continue;
  				case 'G':
! 					*to++ = '>';
  					continue;
  				case 'L':               // line break
! 					*to++ = '\\';
! 					*to++ = 'l';
! 					*to++ = 'i';
! 					*to++ = 'n';
! 					*to++ = 'e';
! 					*to++ = ' ';
  					continue;
  				case 'M':               // new paragraph
! 					*to++ = '\\';
! 					*to++ = 'p';
! 					*to++ = 'a';
! 					*to++ = 'r';
! 					*to++ = ' ';
  					continue;
  				case 'T':
! 					*to++ = '<';
  				}
  				break;
--- 224,240 ----
  				switch(token[1]) {
  				case 'A':               // ASCII value
! 					text += (char)atoi(&token[2]);
  					continue;
  				case 'G':
! 					text += '>';
  					continue;
  				case 'L':               // line break
! 					text += "\\line ";
  					continue;
  				case 'M':               // new paragraph
! 					text += "\\par ";
  					continue;
  				case 'T':
! 					text += '<';
  				}
  				break;
***************
*** 389,426 ****
  			    {
  			    case 'T':               // Book title begin
! 			      *to++ = '{';
! 			      *to++ = '\\';
! 				 *to++ = 'l';
! 				 *to++ = 'a';
! 				 *to++ = 'r';
! 				 *to++ = 'g';
! 				 *to++ = 'e';
! 				 *to++ = ' ';
  				 continue;
  			    case 't':
! 				 *to++ = '}';
  				 continue;
  			    case 'S':
! 				 *to++ = '\\';
! 				 *to++ = 'p';
! 				 *to++ = 'a';
! 				 *to++ = 'r';
! 				 *to++ = ' ';
! 				 *to++ = '{';
! 			      *to++ = '\\';
! 			      *to++ = 'i';
! 			      *to++ = '1';
! 			      *to++ = '\\';
! 			      *to++ = 'b';
! 			      *to++ = '1';
! 			      *to++ = ' ';
  			      continue;
  			    case 's':
! 			      *to++ = '}';
! 			      *to++ = '\\';
! 			      *to++ = 'p';
! 			      *to++ = 'a';
! 			      *to++ = 'r';
! 			      *to++ = ' ';
  			      continue;
  			    }
--- 243,256 ----
  			    {
  			    case 'T':               // Book title begin
! 					text += "{\\large ";
  				 continue;
  			    case 't':
! 				 text += '}';
  				 continue;
  			    case 'S':
! 					text += "\\par {\\i1\\b1 ";
  			      continue;
  			    case 's':
! 					text += "}\\par ";
  			      continue;
  			    }
***************
*** 438,447 ****
  			if (!hideText) {
  				wordCount++;
! 				*to++ = *from;
  			}
  		}
  	}
- 	*to++ = 0;
- 	*to = 0;
  	return 0;
  }
--- 268,275 ----
  			if (!hideText) {
  				wordCount++;
! 				text += *from;
  			}
  		}
  	}
  	return 0;
  }

Index: plainfootnotes.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/plainfootnotes.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** plainfootnotes.cpp	1 Oct 2002 19:52:40 -0000	1.8
--- plainfootnotes.cpp	20 Feb 2003 12:31:54 -0000	1.9
***************
*** 54,58 ****
  
  
! char PLAINFootnotes::ProcessText(char *text, int maxlen, const SWKey *key, const SWModule *module)
  {
  	char token[2048];
--- 54,58 ----
  
  
! char PLAINFootnotes::processText(SWBuf &text, const SWKey *key, const SWModule *module)
  {
  	char token[2048];
***************
*** 62,79 ****
  
  	if (!option) {	// if we don't want footnotes
- 		char *to, *from;
- 		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 == '{') // Footnote start
  			{
  				hide = true;
--- 62,72 ----
  
  	if (!option) {	// if we don't want footnotes
  		bool hide = false;
  
! 		const char *from;
! 		SWBuf orig = text;
! 		from = orig.c_str();
! 		for (text = ""; *from; from++) {
! 		 if (*from == '{') // Footnote start
  			{
  				hide = true;
***************
*** 92,102 ****
  			else	{
  				if (!hide) {
! 					*to++ = *from;
  					lastspace = (*from == ' ');
  				}
  			}
  		}
- 		*to++ = 0;
- 		*to = 0;
  	}
  	return 0;
--- 85,93 ----
  			else	{
  				if (!hide) {
! 					text = *from;
  					lastspace = (*from == ' ');
  				}
  			}
  		}
  	}
  	return 0;

Index: plainhtml.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/plainhtml.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** plainhtml.cpp	1 Oct 2002 19:52:40 -0000	1.6
--- plainhtml.cpp	20 Feb 2003 12:31:54 -0000	1.7
***************
*** 16,21 ****
   ***************************************************************************/
  
- #include <stdlib.h>
- #include <string.h>
  #include <plainhtml.h>
  
--- 16,19 ----
***************
*** 27,49 ****
  
  
! char PLAINHTML::ProcessText(char *text, int maxlen, const SWKey *key, const SWModule *module)
  {
- 	char *to, *from;
- 	int len;
  	int count = 0;
  
! 	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 == '\n') && (from[1] == '\n')) // paragraph
  		{
! 			*to++ = '<';
! 			*to++ = 'P';
! 			*to++ = '>';
  			from++;
  			continue;
--- 25,40 ----
  
  
! char PLAINHTML::processText(SWBuf &text, const SWKey *key, const SWModule *module)
  {
  	int count = 0;
  
! 	const char *from;
! 	SWBuf orig = text;
! 	from = orig.c_str();
! 	for (text = ""; *from; from++)
  	{
  		if ((*from == '\n') && (from[1] == '\n')) // paragraph
  		{
! 			text += "<P>";
  			from++;
  			continue;
***************
*** 51,58 ****
  			if ((*from == '\n')) // && (from[1] != '\n')) // new line
  			{
! 				*to++ = '<';
! 				*to++ = 'B';
! 				*to++ = 'R';
! 				*to++ = '>';
  				continue;
  			}
--- 42,46 ----
  			if ((*from == '\n')) // && (from[1] != '\n')) // new line
  			{
! 				text += "<BR>";
  				continue;
  			}
***************
*** 60,93 ****
  		
  		if (*from == '{') {
! 		  *to++ = '<';
! 	  	*to++ = 'F';
!   		*to++ = 'O';
! 			*to++ = 'N';
! 			*to++ = 'T';
! 			*to++ = ' ';
! 			*to++ = 'C';
! 			*to++ = 'O';
! 			*to++ = 'L';
! 			*to++ = 'O';
! 			*to++ = 'R';
! 			*to++ = '=';
! 			*to++ = '#';
! 			*to++ = '8';
! 			*to++ = '0';
! 			*to++ = '0';
! 			*to++ = '0';
! 			*to++ = '0';
! 			*to++ = '0';
! 			*to++ = '>';
! 
! 			*to++ = '<';
! 			*to++ = 'S';
! 			*to++ = 'M';
! 			*to++ = 'A';
! 			*to++ = 'L';
! 			*to++ = 'L';
! 			*to++ = '>';
! 			*to++ = ' ';
! 			*to++ = '(';
  			continue;
  		}
--- 48,52 ----
  		
  		if (*from == '{') {
! 			text += "<FONT COLOR=#80000><SMALL> (";
  			continue;
  		}
***************
*** 95,116 ****
  		if (*from == '}')
  		{
! 			*to++ = ')';
! 			*to++ = ' ';
! 			*to++ = '<';
! 			*to++ = '/';
! 			*to++ = 'S';
! 			*to++ = 'M';
! 			*to++ = 'A';
! 			*to++ = 'L';
! 			*to++ = 'L';
! 			*to++ = '>';
! 			
! 			*to++ = '<';
! 			*to++ = '/';
!   		*to++ = 'F';
! 			*to++ = 'O';
! 			*to++ = 'N';
! 			*to++ = 'T';
! 			*to++ = '>';
  			continue;
  		}
--- 54,58 ----
  		if (*from == '}')
  		{
! 			text += ") </SMALL></FONT>";
  			continue;
  		}
***************
*** 118,135 ****
  		if ((*from == ' ') && (count > 5000))
  		{
! 			*to++ = '<';
! 			*to++ = 'W';
! 			*to++ = 'B';
! 			*to++ = 'R';
! 			*to++ = '>';
  			count = 0;
  			continue;
  		}
  
! 		*to++ = *from;
  		count++;
  	}
- 	*to++ = 0;
- 	*to = 0;
  	return 0;
  }
--- 60,71 ----
  		if ((*from == ' ') && (count > 5000))
  		{
! 			text += "<WBR>";
  			count = 0;
  			continue;
  		}
  
! 		text += *from;
  		count++;
  	}
  	return 0;
  }