blob: 7892c5ef182f53e59778f440cf2a55741580f66e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
<!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>plainhtml.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>plainhtml.cpp</h1><div class="fragment"><pre>00001 <font class="comment">/***************************************************************************</font>
00002 <font class="comment"> rwphtml.cpp - description</font>
00003 <font class="comment"> -------------------</font>
00004 <font class="comment"> begin : Thu Jun 24 1999</font>
00005 <font class="comment"> copyright : (C) 1999 by Torsten Uhlmann</font>
00006 <font class="comment"> email : TUhlmann@gmx.de</font>
00007 <font class="comment"> ***************************************************************************/</font>
00008
00009 <font class="comment">/***************************************************************************</font>
00010 <font class="comment"> * *</font>
00011 <font class="comment"> * This program is free software; you can redistribute it and/or modify *</font>
00012 <font class="comment"> * it under the terms of the GNU General Public License as published by *</font>
00013 <font class="comment"> * the Free Software Foundation; either version 2 of the License, or *</font>
00014 <font class="comment"> * (at your option) any later version. *</font>
00015 <font class="comment"> * *</font>
00016 <font class="comment"> ***************************************************************************/</font>
00017
00018 <font class="preprocessor">#include <stdlib.h></font>
00019 <font class="preprocessor">#include <string.h></font>
00020 <font class="preprocessor">#include <plainhtml.h></font>
00021
00022
00023 PLAINHTML::PLAINHTML()
00024 {
00025 }
00026
00027
00028 <font class="keywordtype">char</font> PLAINHTML::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)
00029 {
00030 <font class="keywordtype">char</font> *to, *from;
00031 <font class="keywordtype">int</font> len;
00032 <font class="keywordtype">int</font> count = 0;
00033
00034 len = strlen(text) + 1; <font class="comment">// shift string to right of buffer</font>
00035 <font class="keywordflow">if</font> (len < maxlen) {
00036 memmove(&text[maxlen - len], text, len);
00037 from = &text[maxlen - len];
00038 }
00039 <font class="keywordflow">else</font> from = text; <font class="comment">// -------------------------------</font>
00040 <font class="keywordflow">for</font> (to = text; *from; from++)
00041 {
00042 <font class="keywordflow">if</font> ((*from == <font class="charliteral">'\n'</font>) && (from[1] == <font class="charliteral">'\n'</font>)) <font class="comment">// paragraph</font>
00043 {
00044 *to++ = <font class="charliteral">'<'</font>;
00045 *to++ = <font class="charliteral">'P'</font>;
00046 *to++ = <font class="charliteral">'>'</font>;
00047 from++;
00048 <font class="keywordflow">continue</font>;
00049 } <font class="keywordflow">else</font> {
00050 <font class="keywordflow">if</font> ((*from == <font class="charliteral">'\n'</font>)) <font class="comment">// && (from[1] != '\n')) // new line</font>
00051 {
00052 *to++ = <font class="charliteral">'<'</font>;
00053 *to++ = <font class="charliteral">'B'</font>;
00054 *to++ = <font class="charliteral">'R'</font>;
00055 *to++ = <font class="charliteral">'>'</font>;
00056 <font class="keywordflow">continue</font>;
00057 }
00058 }
00059
00060 <font class="keywordflow">if</font> (*from == <font class="charliteral">'{'</font>) {
00061 *to++ = <font class="charliteral">'<'</font>;
00062 *to++ = <font class="charliteral">'F'</font>;
00063 *to++ = <font class="charliteral">'O'</font>;
00064 *to++ = <font class="charliteral">'N'</font>;
00065 *to++ = <font class="charliteral">'T'</font>;
00066 *to++ = <font class="charliteral">' '</font>;
00067 *to++ = <font class="charliteral">'C'</font>;
00068 *to++ = <font class="charliteral">'O'</font>;
00069 *to++ = <font class="charliteral">'L'</font>;
00070 *to++ = <font class="charliteral">'O'</font>;
00071 *to++ = <font class="charliteral">'R'</font>;
00072 *to++ = <font class="charliteral">'='</font>;
00073 *to++ = <font class="charliteral">'#'</font>;
00074 *to++ = <font class="charliteral">'8'</font>;
00075 *to++ = <font class="charliteral">'0'</font>;
00076 *to++ = <font class="charliteral">'0'</font>;
00077 *to++ = <font class="charliteral">'0'</font>;
00078 *to++ = <font class="charliteral">'0'</font>;
00079 *to++ = <font class="charliteral">'0'</font>;
00080 *to++ = <font class="charliteral">'>'</font>;
00081
00082 *to++ = <font class="charliteral">'<'</font>;
00083 *to++ = <font class="charliteral">'S'</font>;
00084 *to++ = <font class="charliteral">'M'</font>;
00085 *to++ = <font class="charliteral">'A'</font>;
00086 *to++ = <font class="charliteral">'L'</font>;
00087 *to++ = <font class="charliteral">'L'</font>;
00088 *to++ = <font class="charliteral">'>'</font>;
00089 *to++ = <font class="charliteral">' '</font>;
00090 *to++ = <font class="charliteral">'('</font>;
00091 <font class="keywordflow">continue</font>;
00092 }
00093
00094 <font class="keywordflow">if</font> (*from == <font class="charliteral">'}'</font>)
00095 {
00096 *to++ = <font class="charliteral">')'</font>;
00097 *to++ = <font class="charliteral">' '</font>;
00098 *to++ = <font class="charliteral">'<'</font>;
00099 *to++ = <font class="charliteral">'/'</font>;
00100 *to++ = <font class="charliteral">'S'</font>;
00101 *to++ = <font class="charliteral">'M'</font>;
00102 *to++ = <font class="charliteral">'A'</font>;
00103 *to++ = <font class="charliteral">'L'</font>;
00104 *to++ = <font class="charliteral">'L'</font>;
00105 *to++ = <font class="charliteral">'>'</font>;
00106
00107 *to++ = <font class="charliteral">'<'</font>;
00108 *to++ = <font class="charliteral">'/'</font>;
00109 *to++ = <font class="charliteral">'F'</font>;
00110 *to++ = <font class="charliteral">'O'</font>;
00111 *to++ = <font class="charliteral">'N'</font>;
00112 *to++ = <font class="charliteral">'T'</font>;
00113 *to++ = <font class="charliteral">'>'</font>;
00114 <font class="keywordflow">continue</font>;
00115 }
00116
00117 <font class="keywordflow">if</font> ((*from == <font class="charliteral">' '</font>) && (count > 5000))
00118 {
00119 *to++ = <font class="charliteral">'<'</font>;
00120 *to++ = <font class="charliteral">'W'</font>;
00121 *to++ = <font class="charliteral">'B'</font>;
00122 *to++ = <font class="charliteral">'R'</font>;
00123 *to++ = <font class="charliteral">'>'</font>;
00124 count = 0;
00125 <font class="keywordflow">continue</font>;
00126 }
00127
00128 *to++ = *from;
00129 count++;
00130 }
00131 *to++ = 0;
00132 *to = 0;
00133 <font class="keywordflow">return</font> 0;
00134 }
</pre></div><hr><address align="right"><small>Generated on Thu Jun 20 22:12:59 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>
|