<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>thmlgbf.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.15 -->
<center>
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> </center>
<hr><h1>thmlgbf.cpp</h1><div class="fragment"><pre>00001 <font class="comment">/***************************************************************************</font>
00002 <font class="comment"> thmlgbf.cpp - ThML to GBF filter</font>
00003 <font class="comment"> -------------------</font>
00004 <font class="comment"> begin : 1999-10-28</font>
00005 <font class="comment"> copyright : 2001 by CrossWire Bible Society</font>
00006 <font class="comment"> ***************************************************************************/</font>
00007
00008 <font class="comment">/***************************************************************************</font>
00009 <font class="comment"> * *</font>
00010 <font class="comment"> * This program is free software; you can redistribute it and/or modify *</font>
00011 <font class="comment"> * it under the terms of the GNU General Public License as published by *</font>
00012 <font class="comment"> * the Free Software Foundation; either version 2 of the License, or *</font>
00013 <font class="comment"> * (at your option) any later version. *</font>
00014 <font class="comment"> * *</font>
00015 <font class="comment"> ***************************************************************************/</font>
00016
00017 <font class="preprocessor">#include <stdlib.h></font>
00018 <font class="preprocessor">#include <string.h></font>
00019 <font class="preprocessor">#include <thmlgbf.h></font>
00020
00021
00022 ThMLGBF::ThMLGBF()
00023 {
00024 }
00025
00026
00027 <font class="keywordtype">char</font> ThMLGBF::ProcessText(<font class="keywordtype">char</font> *text, <font class="keywordtype">int</font> maxlen)
00028 {
00029 <font class="keywordtype">char</font> *to, *from, token[2048];
00030 <font class="keywordtype">int</font> tokpos = 0;
00031 <font class="keywordtype">bool</font> intoken = <font class="keyword">false</font>;
00032 <font class="keywordtype">int</font> len;
00033 <font class="keywordtype">bool</font> ampersand = <font class="keyword">false</font>;
00034 <font class="keywordtype">bool</font> sechead = <font class="keyword">false</font>;
00035 <font class="keywordtype">bool</font> title = <font class="keyword">false</font>;
00036
00037 len = strlen(text) + 1; <font class="comment">// shift string to right of buffer</font>
00038 <font class="keywordflow">if</font> (len < maxlen) {
00039 memmove(&text[maxlen - len], text, len);
00040 from = &text[maxlen - len];
00041 }
00042 <font class="keywordflow">else</font> from = text; <font class="comment">// -------------------------------</font>
00043 <font class="keywordflow">for</font> (to = text; *from; from++) {
00044 <font class="keywordflow">if</font> (*from == <font class="charliteral">'<'</font>) {
00045 intoken = <font class="keyword">true</font>;
00046 tokpos = 0;
00047 token[0] = 0;
00048 token[1] = 0;
00049 token[2] = 0;
00050 ampersand = <font class="keyword">false</font>;
00051 <font class="keywordflow">continue</font>;
00052 }
00053 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (*from == <font class="charliteral">'&'</font>) {
00054 intoken = <font class="keyword">true</font>;
00055 tokpos = 0;
00056 memset(token, 0, 2048);
00057 ampersand = <font class="keyword">true</font>;
00058 <font class="keywordflow">continue</font>;
00059 }
00060 <font class="keywordflow">if</font> (*from == <font class="charliteral">';'</font> && ampersand) {
00061 intoken = <font class="keyword">false</font>;
00062
00063 <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"nbsp"</font>, token, 4)) *to++ = <font class="charliteral">' '</font>;
00064 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"quot"</font>, token, 4)) *to++ = <font class="charliteral">'"'</font>;
00065 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"amp"</font>, token, 3)) *to++ = <font class="charliteral">'&'</font>;
00066 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"lt"</font>, token, 2)) *to++ = <font class="charliteral">'<'</font>;
00067 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"gt"</font>, token, 2)) *to++ = <font class="charliteral">'>'</font>;
00068 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"brvbar"</font>, token, 6)) *to++ = <font class="charliteral">'|'</font>;
00069 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"sect"</font>, token, 4)) *to++ = <font class="charliteral">'§'</font>;
00070 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"copy"</font>, token, 4)) *to++ = <font class="charliteral">'©'</font>;
00071 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"laquo"</font>, token, 5)) *to++ = <font class="charliteral">'«'</font>;
00072 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"reg"</font>, token, 3)) *to++ = <font class="charliteral">'®'</font>;
00073 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"acute"</font>, token, 5)) *to++ = <font class="charliteral">'´'</font>;
00074 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"para"</font>, token, 4)) *to++ = <font class="charliteral">'¶'</font>;
00075 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"raquo"</font>, token, 5)) *to++ = <font class="charliteral">'»'</font>;
00076
00077 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Aacute"</font>, token, 6)) *to++ = <font class="charliteral">'Á'</font>;
00078 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Agrave"</font>, token, 6)) *to++ = <font class="charliteral">'À'</font>;
00079 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Acirc"</font>, token, 5)) *to++ = <font class="charliteral">'Â'</font>;
00080 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Auml"</font>, token, 4)) *to++ = <font class="charliteral">'Ä'</font>;
00081 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Atilde"</font>, token, 6)) *to++ = <font class="charliteral">'Ã'</font>;
00082 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Aring"</font>, token, 5)) *to++ = <font class="charliteral">'Å'</font>;
00083 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"aacute"</font>, token, 6)) *to++ = <font class="charliteral">'á'</font>;
00084 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"agrave"</font>, token, 6)) *to++ = <font class="charliteral">'à'</font>;
00085 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"acirc"</font>, token, 5)) *to++ = <font class="charliteral">'â'</font>;
00086 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"auml"</font>, token, 4)) *to++ = <font class="charliteral">'ä'</font>;
00087 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"atilde"</font>, token, 6)) *to++ = <font class="charliteral">'ã'</font>;
00088 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"aring"</font>, token, 5)) *to++ = <font class="charliteral">'å'</font>;
00089 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Eacute"</font>, token, 6)) *to++ = <font class="charliteral">'É'</font>;
00090 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Egrave"</font>, token, 6)) *to++ = <font class="charliteral">'È'</font>;
00091 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Ecirc"</font>, token, 5)) *to++ = <font class="charliteral">'Ê'</font>;
00092 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Euml"</font>, token, 4)) *to++ = <font class="charliteral">'Ë'</font>;
00093 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"eacute"</font>, token, 6)) *to++ = <font class="charliteral">'é'</font>;
00094 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"egrave"</font>, token, 6)) *to++ = <font class="charliteral">'è'</font>;
00095 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"ecirc"</font>, token, 5)) *to++ = <font class="charliteral">'ê'</font>;
00096 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"euml"</font>, token, 4)) *to++ = <font class="charliteral">'ë'</font>;
00097 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Iacute"</font>, token, 6)) *to++ = <font class="charliteral">'Í'</font>;
00098 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Igrave"</font>, token, 6)) *to++ = <font class="charliteral">'Ì'</font>;
00099 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Icirc"</font>, token, 5)) *to++ = <font class="charliteral">'Î'</font>;
00100 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Iuml"</font>, token, 4)) *to++ = <font class="charliteral">'Ï'</font>;
00101 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"iacute"</font>, token, 6)) *to++ = <font class="charliteral">'í'</font>;
00102 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"igrave"</font>, token, 6)) *to++ = <font class="charliteral">'ì'</font>;
00103 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"icirc"</font>, token, 5)) *to++ = <font class="charliteral">'î'</font>;
00104 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"iuml"</font>, token, 4)) *to++ = <font class="charliteral">'ï'</font>;
00105 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Oacute"</font>, token, 6)) *to++ = <font class="charliteral">'Ó'</font>;
00106 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Ograve"</font>, token, 6)) *to++ = <font class="charliteral">'Ò'</font>;
00107 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Ocirc"</font>, token, 5)) *to++ = <font class="charliteral">'Ô'</font>;
00108 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Ouml"</font>, token, 4)) *to++ = <font class="charliteral">'Ö'</font>;
00109 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Otilde"</font>, token, 6)) *to++ = <font class="charliteral">'Õ'</font>;
00110 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"oacute"</font>, token, 6)) *to++ = <font class="charliteral">'ó'</font>;
00111 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"ograve"</font>, token, 6)) *to++ = <font class="charliteral">'ò'</font>;
00112 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"ocirc"</font>, token, 5)) *to++ = <font class="charliteral">'ô'</font>;
00113 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"ouml"</font>, token, 4)) *to++ = <font class="charliteral">'ö'</font>;
00114 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"otilde"</font>, token, 6)) *to++ = <font class="charliteral">'õ'</font>;
00115 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Uacute"</font>, token, 6)) *to++ = <font class="charliteral">'Ú'</font>;
00116 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Ugrave"</font>, token, 6)) *to++ = <font class="charliteral">'Ù'</font>;
00117 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Ucirc"</font>, token, 5)) *to++ = <font class="charliteral">'Û'</font>;
00118 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Uuml"</font>, token, 4)) *to++ = <font class="charliteral">'Ü'</font>;
00119 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"uacute"</font>, token, 6)) *to++ = <font class="charliteral">'ú'</font>;
00120 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"ugrave"</font>, token, 6)) *to++ = <font class="charliteral">'ù'</font>;
00121 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"ucirc"</font>, token, 5)) *to++ = <font class="charliteral">'û'</font>;
00122 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"uuml"</font>, token, 4)) *to++ = <font class="charliteral">'ü'</font>;
00123 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Yacute"</font>, token, 6)) *to++ = <font class="charliteral">'Ý'</font>;
00124 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"yacute"</font>, token, 6)) *to++ = <font class="charliteral">'ý'</font>;
00125 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"yuml"</font>, token, 4)) *to++ = <font class="charliteral">'ÿ'</font>;
00126
00127 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"deg"</font>, token, 3)) *to++ = <font class="charliteral">'°'</font>;
00128 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"plusmn"</font>, token, 6)) *to++ = <font class="charliteral">'±'</font>;
00129 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"sup2"</font>, token, 4)) *to++ = <font class="charliteral">'²'</font>;
00130 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"sup3"</font>, token, 4)) *to++ = <font class="charliteral">'³'</font>;
00131 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"sup1"</font>, token, 4)) *to++ = <font class="charliteral">'¹'</font>;
00132 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"nbsp"</font>, token, 4)) *to++ = <font class="charliteral">'º'</font>;
00133 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"pound"</font>, token, 5)) *to++ = <font class="charliteral">'£'</font>;
00134 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"cent"</font>, token, 4)) *to++ = <font class="charliteral">'¢'</font>;
00135 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"frac14"</font>, token, 6)) *to++ = <font class="charliteral">'¼'</font>;
00136 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"frac12"</font>, token, 6)) *to++ = <font class="charliteral">'½'</font>;
00137 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"frac34"</font>, token, 6)) *to++ = <font class="charliteral">'¾'</font>;
00138 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"iquest"</font>, token, 6)) *to++ = <font class="charliteral">'¿'</font>;
00139 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"iexcl"</font>, token, 5)) *to++ = <font class="charliteral">'¡'</font>;
00140 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"ETH"</font>, token, 3)) *to++ = <font class="charliteral">'Ð'</font>;
00141 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"eth"</font>, token, 3)) *to++ = <font class="charliteral">'ð'</font>;
00142 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"THORN"</font>, token, 5)) *to++ = <font class="charliteral">'Þ'</font>;
00143 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"thorn"</font>, token, 5)) *to++ = <font class="charliteral">'þ'</font>;
00144 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"AElig"</font>, token, 5)) *to++ = <font class="charliteral">'Æ'</font>;
00145 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"aelig"</font>, token, 5)) *to++ = <font class="charliteral">'æ'</font>;
00146 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Oslash"</font>, token, 6)) *to++ = <font class="charliteral">'Ø'</font>;
00147 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"curren"</font>, token, 6)) *to++ = <font class="charliteral">'¤'</font>;
00148 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Ccedil"</font>, token, 6)) *to++ = <font class="charliteral">'Ç'</font>;
00149 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"ccedil"</font>, token, 6)) *to++ = <font class="charliteral">'ç'</font>;
00150 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"szlig"</font>, token, 5)) *to++ = <font class="charliteral">'ß'</font>;
00151 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"Ntilde"</font>, token, 6)) *to++ = <font class="charliteral">'Ñ'</font>;
00152 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"ntilde"</font>, token, 6)) *to++ = <font class="charliteral">'ñ'</font>;
00153 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"yen"</font>, token, 3)) *to++ = <font class="charliteral">'¥'</font>;
00154 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"not"</font>, token, 3)) *to++ = <font class="charliteral">'¬'</font>;
00155 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"ordf"</font>, token, 4)) *to++ = <font class="charliteral">'ª'</font>;
00156 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"uml"</font>, token, 3)) *to++ = <font class="charliteral">'¨'</font>;
00157 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"shy"</font>, token, 3)) *to++ = <font class="charliteral">''</font>;
00158 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(<font class="stringliteral">"macr"</font>, token, 4)) *to++ = <font class="charliteral">'¯'</font>;
00159 <font class="keywordflow">continue</font>;
00160
00161 }
00162 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (*from == <font class="charliteral">'>'</font> && !ampersand) {
00163 intoken = <font class="keyword">false</font>;
00164 <font class="comment">// process desired tokens</font>
00165 <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"sync type=\"Strongs\" value=\""</font>, 27)) {
00166 *to++ = <font class="charliteral">'<'</font>;
00167 *to++ = <font class="charliteral">'W'</font>;
00168 <font class="keywordflow">for</font> (<font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> i = 27; token[i] != <font class="charliteral">'\"'</font>; i++)
00169 *to++ = token[i];
00170 *to++ = <font class="charliteral">'>'</font>;
00171 <font class="keywordflow">continue</font>;
00172 }
00173 <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"sync type=\"morph\" value=\""</font>, 25)) {
00174 *to++ = <font class="charliteral">'<'</font>;
00175 *to++ = <font class="charliteral">'W'</font>;
00176 *to++ = <font class="charliteral">'T'</font>;
00177 <font class="keywordflow">for</font> (<font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> i = 25; token[i] != <font class="charliteral">'\"'</font>; i++)
00178 *to++ = token[i];
00179 *to++ = <font class="charliteral">'>'</font>;
00180 <font class="keywordflow">continue</font>;
00181 }
00182 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"scripRef"</font>, 8)) {
00183 *to++ = <font class="charliteral">'<'</font>;
00184 *to++ = <font class="charliteral">'R'</font>;
00185 *to++ = <font class="charliteral">'X'</font>;
00186 *to++ = <font class="charliteral">'>'</font>;
00187 <font class="keywordflow">continue</font>;
00188 }
00189 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"/scripRef"</font>, 9)) {
00190 *to++ = <font class="charliteral">'<'</font>;
00191 *to++ = <font class="charliteral">'R'</font>;
00192 *to++ = <font class="charliteral">'x'</font>;
00193 *to++ = <font class="charliteral">'>'</font>;
00194 <font class="keywordflow">continue</font>;
00195 }
00196 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"note"</font>, 4)) {
00197 *to++ = <font class="charliteral">'<'</font>;
00198 *to++ = <font class="charliteral">'R'</font>;
00199 *to++ = <font class="charliteral">'F'</font>;
00200 *to++ = <font class="charliteral">'>'</font>;
00201 <font class="keywordflow">continue</font>;
00202 }
00203 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"/note"</font>, 5)) {
00204 *to++ = <font class="charliteral">'<'</font>;
00205 *to++ = <font class="charliteral">'R'</font>;
00206 *to++ = <font class="charliteral">'f'</font>;
00207 *to++ = <font class="charliteral">'>'</font>;
00208 <font class="keywordflow">continue</font>;
00209 }
00210 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"sup"</font>, 3)) {
00211 *to++ = <font class="charliteral">'<'</font>;
00212 *to++ = <font class="charliteral">'F'</font>;
00213 *to++ = <font class="charliteral">'S'</font>;
00214 *to++ = <font class="charliteral">'>'</font>;
00215 }
00216 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"/sup"</font>, 4)) {
00217 *to++ = <font class="charliteral">'<'</font>;
00218 *to++ = <font class="charliteral">'F'</font>;
00219 *to++ = <font class="charliteral">'s'</font>;
00220 *to++ = <font class="charliteral">'>'</font>;
00221 }
00222 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strnicmp(token, <font class="stringliteral">"font color=#ff0000"</font>, 18)) {
00223 *to++ = <font class="charliteral">'<'</font>;
00224 *to++ = <font class="charliteral">'F'</font>;
00225 *to++ = <font class="charliteral">'R'</font>;
00226 *to++ = <font class="charliteral">'>'</font>;
00227 <font class="keywordflow">continue</font>;
00228 }
00229 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strnicmp(token, <font class="stringliteral">"/font"</font>, 5)) {
00230 *to++ = <font class="charliteral">'<'</font>;
00231 *to++ = <font class="charliteral">'F'</font>;
00232 *to++ = <font class="charliteral">'r'</font>;
00233 *to++ = <font class="charliteral">'>'</font>;
00234 <font class="keywordflow">continue</font>;
00235 }
00236 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"div class=\"sechead\""</font>, 19)) {
00237 *to++ = <font class="charliteral">'<'</font>;
00238 *to++ = <font class="charliteral">'T'</font>;
00239 *to++ = <font class="charliteral">'S'</font>;
00240 *to++ = <font class="charliteral">'>'</font>;
00241 sechead = <font class="keyword">true</font>;
00242 <font class="keywordflow">continue</font>;
00243 }
00244 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (sechead && !strncmp(token, <font class="stringliteral">"/div"</font>, 19)) {
00245 *to++ = <font class="charliteral">'<'</font>;
00246 *to++ = <font class="charliteral">'T'</font>;
00247 *to++ = <font class="charliteral">'s'</font>;
00248 *to++ = <font class="charliteral">'>'</font>;
00249 sechead = <font class="keyword">false</font>;
00250 <font class="keywordflow">continue</font>;
00251 }
00252 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"div class=\"title\""</font>, 19)) {
00253 *to++ = <font class="charliteral">'<'</font>;
00254 *to++ = <font class="charliteral">'T'</font>;
00255 *to++ = <font class="charliteral">'T'</font>;
00256 *to++ = <font class="charliteral">'>'</font>;
00257 title = <font class="keyword">true</font>;
00258 <font class="keywordflow">continue</font>;
00259 }
00260 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (title && !strncmp(token, <font class="stringliteral">"/div"</font>, 19)) {
00261 *to++ = <font class="charliteral">'<'</font>;
00262 *to++ = <font class="charliteral">'T'</font>;
00263 *to++ = <font class="charliteral">'t'</font>;
00264 *to++ = <font class="charliteral">'>'</font>;
00265 title = <font class="keyword">false</font>;
00266 <font class="keywordflow">continue</font>;
00267 }
00268 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strnicmp(token, <font class="stringliteral">"br"</font>, 2)) {
00269 *to++ = <font class="charliteral">'<'</font>;
00270 *to++ = <font class="charliteral">'C'</font>;
00271 *to++ = <font class="charliteral">'L'</font>;
00272 *to++ = <font class="charliteral">'>'</font>;
00273 <font class="keywordflow">continue</font>;
00274 }
00275 <font class="keywordflow">else</font> <font class="keywordflow">switch</font>(*token) {
00276 <font class="keywordflow">case</font> <font class="charliteral">'I'</font>: <font class="comment">// font tags</font>
00277 <font class="keywordflow">case</font> <font class="charliteral">'i'</font>:
00278 *to++ = <font class="charliteral">'<'</font>;
00279 *to++ = <font class="charliteral">'F'</font>;
00280 *to++ = <font class="charliteral">'I'</font>;
00281 *to++ = <font class="charliteral">'>'</font>;
00282 <font class="keywordflow">continue</font>;
00283 <font class="keywordflow">case</font> <font class="charliteral">'B'</font>: <font class="comment">// bold start</font>
00284 <font class="keywordflow">case</font> <font class="charliteral">'b'</font>:
00285 *to++ = <font class="charliteral">'<'</font>;
00286 *to++ = <font class="charliteral">'F'</font>;
00287 *to++ = <font class="charliteral">'B'</font>;
00288 *to++ = <font class="charliteral">'>'</font>;
00289 <font class="keywordflow">continue</font>;
00290 <font class="keywordflow">case</font> <font class="charliteral">'/'</font>:
00291 <font class="keywordflow">switch</font>(token[1]) {
00292 <font class="keywordflow">case</font> <font class="charliteral">'P'</font>:
00293 <font class="keywordflow">case</font> <font class="charliteral">'p'</font>:
00294 *to++ = <font class="charliteral">'<'</font>;
00295 *to++ = <font class="charliteral">'C'</font>;
00296 *to++ = <font class="charliteral">'M'</font>;
00297 *to++ = <font class="charliteral">'>'</font>;
00298 <font class="keywordflow">continue</font>;
00299 <font class="keywordflow">case</font> <font class="charliteral">'I'</font>:
00300 <font class="keywordflow">case</font> <font class="charliteral">'i'</font>: <font class="comment">// italic end</font>
00301 *to++ = <font class="charliteral">'<'</font>;
00302 *to++ = <font class="charliteral">'F'</font>;
00303 *to++ = <font class="charliteral">'i'</font>;
00304 *to++ = <font class="charliteral">'>'</font>;
00305 <font class="keywordflow">continue</font>;
00306 <font class="keywordflow">case</font> <font class="charliteral">'B'</font>: <font class="comment">// bold start</font>
00307 <font class="keywordflow">case</font> <font class="charliteral">'b'</font>:
00308 *to++ = <font class="charliteral">'<'</font>;
00309 *to++ = <font class="charliteral">'F'</font>;
00310 *to++ = <font class="charliteral">'b'</font>;
00311 *to++ = <font class="charliteral">'>'</font>;
00312 <font class="keywordflow">continue</font>;
00313 }
00314 }
00315 <font class="keywordflow">continue</font>;
00316 }
00317 <font class="keywordflow">if</font> (intoken) {
00318 <font class="keywordflow">if</font> (tokpos < 2045)
00319 token[tokpos++] = *from;
00320 token[tokpos+2] = 0;
00321 }
00322 <font class="keywordflow">else</font> *to++ = *from;
00323 }
00324 *to++ = 0;
00325 *to = 0;
00326 <font class="keywordflow">return</font> 0;
00327 }
00328
00329
00330
</pre></div><hr><address align="right"><small>Generated on Thu Jun 20 22:13:01 2002 for The Sword Project by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0
width=110 height=53></a>1.2.15 </small></address>
</body>
</html>