aboutsummaryrefslogtreecommitdiffstats
path: root/doc/api-documentation/html/thmllemma_8cpp-source.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/api-documentation/html/thmllemma_8cpp-source.html')
-rw-r--r--doc/api-documentation/html/thmllemma_8cpp-source.html111
1 files changed, 111 insertions, 0 deletions
diff --git a/doc/api-documentation/html/thmllemma_8cpp-source.html b/doc/api-documentation/html/thmllemma_8cpp-source.html
new file mode 100644
index 0000000..a5895e8
--- /dev/null
+++ b/doc/api-documentation/html/thmllemma_8cpp-source.html
@@ -0,0 +1,111 @@
+<!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>thmllemma.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> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; </center>
+<hr><h1>thmllemma.cpp</h1><div class="fragment"><pre>00001 <font class="comment">/******************************************************************************</font>
+00002 <font class="comment"> *</font>
+00003 <font class="comment"> * thmllemma - SWFilter decendant to hide or show lemmas</font>
+00004 <font class="comment"> * in a ThML module.</font>
+00005 <font class="comment"> */</font>
+00006
+00007
+00008 <font class="preprocessor">#include &lt;stdlib.h&gt;</font>
+00009 <font class="preprocessor">#include &lt;string.h&gt;</font>
+00010 <font class="preprocessor">#include &lt;thmllemma.h&gt;</font>
+00011 <font class="preprocessor">#ifndef __GNUC__</font>
+00012 <font class="preprocessor"></font><font class="preprocessor">#else</font>
+00013 <font class="preprocessor"></font><font class="preprocessor">#include &lt;unixstr.h&gt;</font>
+00014 <font class="preprocessor">#endif</font>
+00015 <font class="preprocessor"></font>
+00016
+00017 <font class="keyword">const</font> <font class="keywordtype">char</font> ThMLLemma::on[] = <font class="stringliteral">"On"</font>;
+00018 <font class="keyword">const</font> <font class="keywordtype">char</font> ThMLLemma::off[] = <font class="stringliteral">"Off"</font>;
+00019 <font class="keyword">const</font> <font class="keywordtype">char</font> ThMLLemma::optName[] = <font class="stringliteral">"Lemmas"</font>;
+00020 <font class="keyword">const</font> <font class="keywordtype">char</font> ThMLLemma::optTip[] = <font class="stringliteral">"Toggles Lemmas On and Off if they exist"</font>;
+00021
+00022 ThMLLemma::ThMLLemma() {
+00023 option = <font class="keyword">false</font>;
+00024 options.push_back(on);
+00025 options.push_back(off);
+00026 }
+00027
+00028
+00029 ThMLLemma::~ThMLLemma() {
+00030 }
+00031
+00032 <font class="keywordtype">void</font> ThMLLemma::setOptionValue(<font class="keyword">const</font> <font class="keywordtype">char</font> *ival)
+00033 {
+00034 option = (!stricmp(ival, on));
+00035 }
+00036
+00037 <font class="keyword">const</font> <font class="keywordtype">char</font> *ThMLLemma::getOptionValue()
+00038 {
+00039 <font class="keywordflow">return</font> (option) ? on:off;
+00040 }
+00041
+00042 <font class="keywordtype">char</font> ThMLLemma::ProcessText(<font class="keywordtype">char</font> *text, <font class="keywordtype">int</font> maxlen, <font class="keyword">const</font> <a class="code" href="class_s_w_key.html">SWKey</a> *key, <font class="keyword">const</font> <a class="code" href="class_s_w_module.html">SWModule</a> *module)
+00043 {
+00044 <font class="keywordflow">if</font> (!option) { <font class="comment">// if we don't want lemmas</font>
+00045 <font class="keywordtype">char</font> *to, *from, token[2048]; <font class="comment">// cheese. Fix.</font>
+00046 <font class="keywordtype">int</font> tokpos = 0;
+00047 <font class="keywordtype">bool</font> intoken = <font class="keyword">false</font>;
+00048 <font class="keywordtype">int</font> len;
+00049 <font class="keywordtype">bool</font> lastspace = <font class="keyword">false</font>;
+00050
+00051 len = strlen(text) + 1; <font class="comment">// shift string to right of buffer</font>
+00052 <font class="keywordflow">if</font> (len &lt; maxlen) {
+00053 memmove(&amp;text[maxlen - len], text, len);
+00054 from = &amp;text[maxlen - len];
+00055 }
+00056 <font class="keywordflow">else</font> from = text; <font class="comment">// -------------------------------</font>
+00057
+00058 <font class="keywordflow">for</font> (to = text; *from; from++) {
+00059 <font class="keywordflow">if</font> (*from == <font class="charliteral">'&lt;'</font>) {
+00060 intoken = <font class="keyword">true</font>;
+00061 tokpos = 0;
+00062 token[0] = 0;
+00063 token[1] = 0;
+00064 token[2] = 0;
+00065 <font class="keywordflow">continue</font>;
+00066 }
+00067 <font class="keywordflow">if</font> (*from == <font class="charliteral">'&gt;'</font>) { <font class="comment">// process tokens</font>
+00068 intoken = <font class="keyword">false</font>;
+00069 <font class="keywordflow">if</font> (!strnicmp(token, <font class="stringliteral">"sync type=\"lemma\" "</font>, 18)) { <font class="comment">// Lemma</font>
+00070 <font class="keywordflow">if</font> ((from[1] == <font class="charliteral">' '</font>) || (from[1] == <font class="charliteral">','</font>) || (from[1] == <font class="charliteral">';'</font>) || (from[1] == <font class="charliteral">'.'</font>) || (from[1] == <font class="charliteral">'?'</font>) || (from[1] == <font class="charliteral">'!'</font>) || (from[1] == <font class="charliteral">')'</font>) || (from[1] == <font class="charliteral">'\''</font>) || (from[1] == <font class="charliteral">'\"'</font>)) {
+00071 <font class="keywordflow">if</font> (lastspace)
+00072 to--;
+00073 }
+00074 <font class="keywordflow">continue</font>;
+00075 }
+00076 <font class="comment">// if not a lemma token, keep token in text</font>
+00077 *to++ = <font class="charliteral">'&lt;'</font>;
+00078 <font class="keywordflow">for</font> (<font class="keywordtype">char</font> *tok = token; *tok; tok++)
+00079 *to++ = *tok;
+00080 *to++ = <font class="charliteral">'&gt;'</font>;
+00081 <font class="keywordflow">continue</font>;
+00082 }
+00083 <font class="keywordflow">if</font> (intoken) {
+00084 <font class="keywordflow">if</font> (tokpos &lt; 2045)
+00085 token[tokpos++] = *from;
+00086 token[tokpos+2] = 0;
+00087 }
+00088 <font class="keywordflow">else</font> {
+00089 *to++ = *from;
+00090 lastspace = (*from == <font class="charliteral">' '</font>);
+00091 }
+00092 }
+00093 *to++ = 0;
+00094 *to = 0;
+00095 }
+00096 <font class="keywordflow">return</font> 0;
+00097 }
+</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>