blob: 9c26fcb5a562a2f466d4b265380bc068f94b8f02 (
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
|
<!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>gbfhtml.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>gbfhtml.cpp</h1><div class="fragment"><pre>00001 <font class="comment">/***************************************************************************</font>
00002 <font class="comment"> gbfhtml.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 <gbfhtml.h></font>
00021
00022
00023 GBFHTML::GBFHTML()
00024 {
00025 }
00026
00027
00028 <font class="keywordtype">char</font> GBFHTML::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, token[2048];
00031 <font class="keywordtype">int</font> tokpos = 0;
00032 <font class="keywordtype">bool</font> intoken = <font class="keyword">false</font>;
00033 <font class="keywordtype">bool</font> hasFootnotePreTag = <font class="keyword">false</font>;
00034 <font class="keywordtype">bool</font> isRightJustified = <font class="keyword">false</font>;
00035 <font class="keywordtype">bool</font> isCentered = <font class="keyword">false</font>;
00036 <font class="keywordtype">int</font> len;
00037 <font class="keyword">const</font> <font class="keywordtype">char</font> *tok;
00038
00039 len = strlen(text) + 1; <font class="comment">// shift string to right of buffer</font>
00040 <font class="keywordflow">if</font> (len < maxlen) {
00041 memmove(&text[maxlen - len], text, len);
00042 from = &text[maxlen - len];
00043 }
00044 <font class="keywordflow">else</font>
00045 from = text; <font class="comment">// -------------------------------</font>
00046
00047 <font class="keywordflow">for</font> (to = text; *from; from++)
00048 {
00049 <font class="keywordflow">if</font> (*from == <font class="charliteral">'\n'</font>) {
00050 *from = <font class="charliteral">' '</font>;
00051 }
00052 <font class="keywordflow">if</font> (*from == <font class="charliteral">'<'</font>) {
00053 intoken = <font class="keyword">true</font>;
00054 tokpos = 0;
00055 token[0] = 0;
00056 token[1] = 0;
00057 token[2] = 0;
00058 <font class="keywordflow">continue</font>;
00059 }
00060 <font class="keywordflow">if</font> (*from == <font class="charliteral">'>'</font>) {
00061 intoken = <font class="keyword">false</font>;
00062 <font class="comment">// process desired tokens</font>
00063 <font class="keywordflow">switch</font> (*token) {
00064 <font class="keywordflow">case</font> <font class="charliteral">'W'</font>: <font class="comment">// Strongs</font>
00065 <font class="keywordflow">switch</font>(token[1])
00066 {
00067 <font class="keywordflow">case</font> <font class="charliteral">'G'</font>: <font class="comment">// Greek</font>
00068 <font class="keywordflow">case</font> <font class="charliteral">'H'</font>: <font class="comment">// Hebrew</font>
00069 <font class="keywordflow">case</font> <font class="charliteral">'T'</font>: <font class="comment">// Tense</font>
00070 *to++ = <font class="charliteral">' '</font>;
00071 *to++ = <font class="charliteral">'<'</font>;
00072 *to++ = <font class="charliteral">'s'</font>;
00073 *to++ = <font class="charliteral">'m'</font>;
00074 *to++ = <font class="charliteral">'a'</font>;
00075 *to++ = <font class="charliteral">'l'</font>;
00076 *to++ = <font class="charliteral">'l'</font>;
00077 *to++ = <font class="charliteral">'>'</font>;
00078 *to++ = <font class="charliteral">'<'</font>;
00079 *to++ = <font class="charliteral">'e'</font>;
00080 *to++ = <font class="charliteral">'m'</font>;
00081 *to++ = <font class="charliteral">'>'</font>;
00082 <font class="keywordflow">for</font> (tok = token+2; *tok; tok++)
00083 *to++ = *tok;
00084 *to++ = <font class="charliteral">'<'</font>;
00085 *to++ = <font class="charliteral">'/'</font>;
00086 *to++ = <font class="charliteral">'e'</font>;
00087 *to++ = <font class="charliteral">'m'</font>;
00088 *to++ = <font class="charliteral">'>'</font>;
00089 *to++ = <font class="charliteral">'<'</font>;
00090 *to++ = <font class="charliteral">'/'</font>;
00091 *to++ = <font class="charliteral">'s'</font>;
00092 *to++ = <font class="charliteral">'m'</font>;
00093 *to++ = <font class="charliteral">'a'</font>;
00094 *to++ = <font class="charliteral">'l'</font>;
00095 *to++ = <font class="charliteral">'l'</font>;
00096 *to++ = <font class="charliteral">'>'</font>;
00097 *to++ = <font class="charliteral">' '</font>;
00098 <font class="keywordflow">continue</font>;
00099 }
00100 <font class="keywordflow">break</font>;
00101 <font class="keywordflow">case</font> <font class="charliteral">'R'</font>:
00102 <font class="keywordflow">switch</font>(token[1])
00103 {
00104 <font class="keywordflow">case</font> <font class="charliteral">'X'</font>:
00105 *to++ = <font class="charliteral">'<'</font>;
00106 *to++ = <font class="charliteral">'a'</font>;
00107 *to++ = <font class="charliteral">' '</font>;
00108 *to++ = <font class="charliteral">'h'</font>;
00109 *to++ = <font class="charliteral">'r'</font>;
00110 *to++ = <font class="charliteral">'e'</font>;
00111 *to++ = <font class="charliteral">'f'</font>;
00112 *to++ = <font class="charliteral">'='</font>;
00113 *to++ = <font class="charliteral">'\"'</font>;
00114 <font class="keywordflow">for</font> (tok = token + 3; *tok; tok++) {
00115 <font class="keywordflow">if</font>(*tok != <font class="charliteral">'<'</font> && *tok+1 != <font class="charliteral">'R'</font> && *tok+2 != <font class="charliteral">'x'</font>) {
00116 *to++ = *tok;
00117 }
00118 <font class="keywordflow">else</font> {
00119 <font class="keywordflow">break</font>;
00120 }
00121 }
00122 *to++ = <font class="charliteral">'\"'</font>;
00123 *to++ = <font class="charliteral">'>'</font>;
00124 <font class="keywordflow">continue</font>;
00125 <font class="keywordflow">case</font> <font class="charliteral">'x'</font>:
00126 *to++ = <font class="charliteral">'<'</font>;
00127 *to++ = <font class="charliteral">'/'</font>;
00128 *to++ = <font class="charliteral">'a'</font>;
00129 *to++ = <font class="charliteral">'>'</font>;
00130 <font class="keywordflow">continue</font>;
00131 <font class="keywordflow">case</font> <font class="charliteral">'B'</font>: <font class="comment">//word(s) explained in footnote</font>
00132 *to++ = <font class="charliteral">'<'</font>;
00133 *to++ = <font class="charliteral">'i'</font>;
00134 *to++ = <font class="charliteral">'>'</font>;
00135 hasFootnotePreTag = <font class="keyword">true</font>; <font class="comment">//we have the RB tag</font>
00136 <font class="keywordflow">continue</font>;
00137 <font class="keywordflow">case</font> <font class="charliteral">'F'</font>: <font class="comment">// footnote begin</font>
00138 <font class="keywordflow">if</font> (hasFootnotePreTag) {
00139 *to++ = <font class="charliteral">'<'</font>;
00140 *to++ = <font class="charliteral">'/'</font>;
00141 *to++ = <font class="charliteral">'i'</font>;
00142 *to++ = <font class="charliteral">'>'</font>;
00143 *to++ = <font class="charliteral">' '</font>;
00144 }
00145 *to++ = <font class="charliteral">'<'</font>;
00146 *to++ = <font class="charliteral">'f'</font>;
00147 *to++ = <font class="charliteral">'o'</font>;
00148 *to++ = <font class="charliteral">'n'</font>;
00149 *to++ = <font class="charliteral">'t'</font>;
00150 *to++ = <font class="charliteral">' '</font>;
00151 *to++ = <font class="charliteral">'c'</font>;
00152 *to++ = <font class="charliteral">'o'</font>;
00153 *to++ = <font class="charliteral">'l'</font>;
00154 *to++ = <font class="charliteral">'o'</font>;
00155 *to++ = <font class="charliteral">'r'</font>;
00156 *to++ = <font class="charliteral">'='</font>;
00157 *to++ = <font class="charliteral">'\"'</font>;
00158 *to++ = <font class="charliteral">'#'</font>;
00159 *to++ = <font class="charliteral">'8'</font>;
00160 *to++ = <font class="charliteral">'0'</font>;
00161 *to++ = <font class="charliteral">'0'</font>;
00162 *to++ = <font class="charliteral">'0'</font>;
00163 *to++ = <font class="charliteral">'0'</font>;
00164 *to++ = <font class="charliteral">'0'</font>;
00165 *to++ = <font class="charliteral">'\"'</font>;
00166 *to++ = <font class="charliteral">'>'</font>;
00167
00168 *to++ = <font class="charliteral">' '</font>;
00169 *to++ = <font class="charliteral">'<'</font>;
00170 *to++ = <font class="charliteral">'s'</font>;
00171 *to++ = <font class="charliteral">'m'</font>;
00172 *to++ = <font class="charliteral">'a'</font>;
00173 *to++ = <font class="charliteral">'l'</font>;
00174 *to++ = <font class="charliteral">'l'</font>;
00175 *to++ = <font class="charliteral">'>'</font>;
00176 *to++ = <font class="charliteral">'('</font>;
00177
00178 <font class="keywordflow">continue</font>;
00179 <font class="keywordflow">case</font> <font class="charliteral">'f'</font>: <font class="comment">// footnote end</font>
00180 *to++ = <font class="charliteral">')'</font>;
00181 *to++ = <font class="charliteral">'<'</font>;
00182 *to++ = <font class="charliteral">'/'</font>;
00183 *to++ = <font class="charliteral">'s'</font>;
00184 *to++ = <font class="charliteral">'m'</font>;
00185 *to++ = <font class="charliteral">'a'</font>;
00186 *to++ = <font class="charliteral">'l'</font>;
00187 *to++ = <font class="charliteral">'l'</font>;
00188 *to++ = <font class="charliteral">'>'</font>;
00189 *to++ = <font class="charliteral">' '</font>;
00190 *to++ = <font class="charliteral">'<'</font>;
00191 *to++ = <font class="charliteral">'/'</font>;
00192 *to++ = <font class="charliteral">'f'</font>;
00193 *to++ = <font class="charliteral">'o'</font>;
00194 *to++ = <font class="charliteral">'n'</font>;
00195 *to++ = <font class="charliteral">'t'</font>;
00196 *to++ = <font class="charliteral">'>'</font>;
00197 hasFootnotePreTag = <font class="keyword">false</font>;
00198 <font class="keywordflow">continue</font>;
00199 }
00200 <font class="keywordflow">break</font>;
00201
00202 <font class="keywordflow">case</font> <font class="charliteral">'F'</font>: <font class="comment">// font tags</font>
00203 <font class="keywordflow">switch</font>(token[1])
00204 {
00205 <font class="keywordflow">case</font> <font class="charliteral">'I'</font>: <font class="comment">// italic start</font>
00206 *to++ = <font class="charliteral">'<'</font>;
00207 *to++ = <font class="charliteral">'i'</font>;
00208 *to++ = <font class="charliteral">'>'</font>;
00209 <font class="keywordflow">continue</font>;
00210 <font class="keywordflow">case</font> <font class="charliteral">'i'</font>: <font class="comment">// italic end</font>
00211 *to++ = <font class="charliteral">'<'</font>;
00212 *to++ = <font class="charliteral">'/'</font>;
00213 *to++ = <font class="charliteral">'i'</font>;
00214 *to++ = <font class="charliteral">'>'</font>;
00215 <font class="keywordflow">continue</font>;
00216 <font class="keywordflow">case</font> <font class="charliteral">'B'</font>: <font class="comment">// bold start</font>
00217 *to++ = <font class="charliteral">'<'</font>;
00218 *to++ = <font class="charliteral">'b'</font>;
00219 *to++ = <font class="charliteral">'>'</font>;
00220 <font class="keywordflow">continue</font>;
00221 <font class="keywordflow">case</font> <font class="charliteral">'b'</font>: <font class="comment">// bold end</font>
00222 *to++ = <font class="charliteral">'<'</font>;
00223 *to++ = <font class="charliteral">'/'</font>;
00224 *to++ = <font class="charliteral">'b'</font>;
00225 *to++ = <font class="charliteral">'>'</font>;
00226 <font class="keywordflow">continue</font>;
00227 <font class="keywordflow">case</font> <font class="charliteral">'R'</font>: <font class="comment">// words of Jesus begin</font>
00228 *to++ = <font class="charliteral">'<'</font>;
00229 *to++ = <font class="charliteral">'f'</font>;
00230 *to++ = <font class="charliteral">'o'</font>;
00231 *to++ = <font class="charliteral">'n'</font>;
00232 *to++ = <font class="charliteral">'t'</font>;
00233 *to++ = <font class="charliteral">' '</font>;
00234 *to++ = <font class="charliteral">'c'</font>;
00235 *to++ = <font class="charliteral">'o'</font>;
00236 *to++ = <font class="charliteral">'l'</font>;
00237 *to++ = <font class="charliteral">'o'</font>;
00238 *to++ = <font class="charliteral">'r'</font>;
00239 *to++ = <font class="charliteral">'='</font>;
00240 *to++ = <font class="charliteral">'#'</font>;
00241 *to++ = <font class="charliteral">'F'</font>;
00242 *to++ = <font class="charliteral">'F'</font>;
00243 *to++ = <font class="charliteral">'0'</font>;
00244 *to++ = <font class="charliteral">'0'</font>;
00245 *to++ = <font class="charliteral">'0'</font>;
00246 *to++ = <font class="charliteral">'0'</font>;
00247 *to++ = <font class="charliteral">'>'</font>;
00248 <font class="keywordflow">continue</font>;
00249 <font class="keywordflow">case</font> <font class="charliteral">'r'</font>: <font class="comment">// words of Jesus end</font>
00250 *to++ = <font class="charliteral">'<'</font>;
00251 *to++ = <font class="charliteral">'/'</font>;
00252 *to++ = <font class="charliteral">'f'</font>;
00253 *to++ = <font class="charliteral">'o'</font>;
00254 *to++ = <font class="charliteral">'n'</font>;
00255 *to++ = <font class="charliteral">'t'</font>;
00256 *to++ = <font class="charliteral">'>'</font>;
00257 <font class="keywordflow">continue</font>;
00258 <font class="keywordflow">case</font> <font class="charliteral">'U'</font>: <font class="comment">// Underline start</font>
00259 *to++ = <font class="charliteral">'<'</font>;
00260 *to++ = <font class="charliteral">'u'</font>;
00261 *to++ = <font class="charliteral">'>'</font>;
00262 <font class="keywordflow">continue</font>;
00263 <font class="keywordflow">case</font> <font class="charliteral">'u'</font>: <font class="comment">// Underline end</font>
00264 *to++ = <font class="charliteral">'<'</font>;
00265 *to++ = <font class="charliteral">'/'</font>;
00266 *to++ = <font class="charliteral">'u'</font>;
00267 *to++ = <font class="charliteral">'>'</font>;
00268 <font class="keywordflow">continue</font>;
00269 <font class="keywordflow">case</font> <font class="charliteral">'O'</font>: <font class="comment">// Old Testament quote begin</font>
00270 *to++ = <font class="charliteral">'<'</font>;
00271 *to++ = <font class="charliteral">'c'</font>;
00272 *to++ = <font class="charliteral">'i'</font>;
00273 *to++ = <font class="charliteral">'t'</font>;
00274 *to++ = <font class="charliteral">'e'</font>;
00275 *to++ = <font class="charliteral">'>'</font>;
00276 <font class="keywordflow">continue</font>;
00277 <font class="keywordflow">case</font> <font class="charliteral">'o'</font>: <font class="comment">// Old Testament quote end</font>
00278 *to++ = <font class="charliteral">'<'</font>;
00279 *to++ = <font class="charliteral">'/'</font>;
00280 *to++ = <font class="charliteral">'c'</font>;
00281 *to++ = <font class="charliteral">'i'</font>;
00282 *to++ = <font class="charliteral">'t'</font>;
00283 *to++ = <font class="charliteral">'e'</font>;
00284 *to++ = <font class="charliteral">'>'</font>;
00285 <font class="keywordflow">continue</font>;
00286 <font class="keywordflow">case</font> <font class="charliteral">'S'</font>: <font class="comment">// Superscript begin</font>
00287 *to++ = <font class="charliteral">'<'</font>;
00288 *to++ = <font class="charliteral">'s'</font>;
00289 *to++ = <font class="charliteral">'u'</font>;
00290 *to++ = <font class="charliteral">'p'</font>;
00291 *to++ = <font class="charliteral">'>'</font>;
00292 <font class="keywordflow">continue</font>;
00293 <font class="keywordflow">case</font> <font class="charliteral">'s'</font>: <font class="comment">// Superscript end</font>
00294 *to++ = <font class="charliteral">'<'</font>;
00295 *to++ = <font class="charliteral">'/'</font>;
00296 *to++ = <font class="charliteral">'s'</font>;
00297 *to++ = <font class="charliteral">'u'</font>;
00298 *to++ = <font class="charliteral">'p'</font>;
00299 *to++ = <font class="charliteral">'>'</font>;
00300 <font class="keywordflow">continue</font>;
00301 <font class="keywordflow">case</font> <font class="charliteral">'V'</font>: <font class="comment">// Subscript begin</font>
00302 *to++ = <font class="charliteral">'<'</font>;
00303 *to++ = <font class="charliteral">'s'</font>;
00304 *to++ = <font class="charliteral">'u'</font>;
00305 *to++ = <font class="charliteral">'b'</font>;
00306 *to++ = <font class="charliteral">'>'</font>;
00307 <font class="keywordflow">continue</font>;
00308 <font class="keywordflow">case</font> <font class="charliteral">'v'</font>: <font class="comment">// Subscript end</font>
00309 *to++ = <font class="charliteral">'<'</font>;
00310 *to++ = <font class="charliteral">'/'</font>;
00311 *to++ = <font class="charliteral">'s'</font>;
00312 *to++ = <font class="charliteral">'u'</font>;
00313 *to++ = <font class="charliteral">'b'</font>;
00314 *to++ = <font class="charliteral">'>'</font>;
00315 <font class="keywordflow">continue</font>;
00316 <font class="keywordflow">case</font> <font class="charliteral">'N'</font>:
00317 *to++ = <font class="charliteral">'<'</font>;
00318 *to++ = <font class="charliteral">'f'</font>;
00319 *to++ = <font class="charliteral">'o'</font>;
00320 *to++ = <font class="charliteral">'n'</font>;
00321 *to++ = <font class="charliteral">'t'</font>;
00322 *to++ = <font class="charliteral">' '</font>;
00323 *to++ = <font class="charliteral">'f'</font>;
00324 *to++ = <font class="charliteral">'a'</font>;
00325 *to++ = <font class="charliteral">'c'</font>;
00326 *to++ = <font class="charliteral">'e'</font>;
00327 *to++ = <font class="charliteral">'='</font>;
00328 *to++ = <font class="charliteral">'"'</font>;
00329 <font class="keywordflow">for</font> (tok = token + 2; *tok; tok++)
00330 *to++ = *tok;
00331 *to++ = <font class="charliteral">'"'</font>;
00332 *to++ = <font class="charliteral">'>'</font>;
00333 <font class="keywordflow">continue</font>;
00334 <font class="keywordflow">case</font> <font class="charliteral">'n'</font>:
00335 *to++ = <font class="charliteral">'<'</font>;
00336 *to++ = <font class="charliteral">'/'</font>;
00337 *to++ = <font class="charliteral">'f'</font>;
00338 *to++ = <font class="charliteral">'o'</font>;
00339 *to++ = <font class="charliteral">'n'</font>;
00340 *to++ = <font class="charliteral">'t'</font>;
00341 *to++ = <font class="charliteral">'>'</font>;
00342 <font class="keywordflow">continue</font>;
00343 }
00344 <font class="keywordflow">break</font>;
00345 <font class="keywordflow">case</font> <font class="charliteral">'C'</font>: <font class="comment">// special character tags</font>
00346 <font class="keywordflow">switch</font>(token[1])
00347 {
00348 <font class="keywordflow">case</font> <font class="charliteral">'A'</font>: <font class="comment">// ASCII value</font>
00349 *to++ = (char)atoi(&token[2]);
00350 <font class="keywordflow">continue</font>;
00351 <font class="keywordflow">case</font> <font class="charliteral">'G'</font>:
00352 <font class="comment">//*to++ = ' ';</font>
00353 <font class="keywordflow">continue</font>;
00354 <font class="keywordflow">case</font> <font class="charliteral">'L'</font>: <font class="comment">// line break</font>
00355 *to++ = <font class="charliteral">'<'</font>;
00356 *to++ = <font class="charliteral">'b'</font>;
00357 *to++ = <font class="charliteral">'r'</font>;
00358 *to++ = <font class="charliteral">' '</font>;
00359 *to++ = <font class="charliteral">'/'</font>;
00360 *to++ = <font class="charliteral">'>'</font>;
00361 *to++ = <font class="charliteral">' '</font>;
00362 <font class="keywordflow">continue</font>;
00363 <font class="keywordflow">case</font> <font class="charliteral">'M'</font>: <font class="comment">// new paragraph</font>
00364 *to++ = <font class="charliteral">'<'</font>;
00365 *to++ = <font class="charliteral">'b'</font>;
00366 *to++ = <font class="charliteral">'r'</font>;
00367 *to++ = <font class="charliteral">' '</font>;
00368 *to++ = <font class="charliteral">'/'</font>;
00369 *to++ = <font class="charliteral">'>'</font>;
00370 <font class="keywordflow">continue</font>;
00371 <font class="keywordflow">case</font> <font class="charliteral">'T'</font>:
00372 <font class="comment">//*to++ = ' ';</font>
00373 <font class="keywordflow">continue</font>;
00374 }
00375 <font class="keywordflow">break</font>;
00376 <font class="keywordflow">case</font> <font class="charliteral">'J'</font>: <font class="comment">//Justification</font>
00377 <font class="keywordflow">switch</font>(token[1])
00378 {
00379 <font class="keywordflow">case</font> <font class="charliteral">'R'</font>: <font class="comment">//right</font>
00380 *to++ = <font class="charliteral">'<'</font>;
00381 *to++ = <font class="charliteral">'d'</font>;
00382 *to++ = <font class="charliteral">'i'</font>;
00383 *to++ = <font class="charliteral">'v'</font>;
00384 *to++ = <font class="charliteral">' '</font>;
00385 *to++ = <font class="charliteral">'a'</font>;
00386 *to++ = <font class="charliteral">'l'</font>;
00387 *to++ = <font class="charliteral">'i'</font>;
00388 *to++ = <font class="charliteral">'g'</font>;
00389 *to++ = <font class="charliteral">'n'</font>;
00390 *to++ = <font class="charliteral">'='</font>;
00391 *to++ = <font class="charliteral">'\"'</font>;
00392 *to++ = <font class="charliteral">'r'</font>;
00393 *to++ = <font class="charliteral">'i'</font>;
00394 *to++ = <font class="charliteral">'g'</font>;
00395 *to++ = <font class="charliteral">'h'</font>;
00396 *to++ = <font class="charliteral">'t'</font>;
00397 *to++ = <font class="charliteral">'\"'</font>;
00398 *to++ = <font class="charliteral">'>'</font>;
00399 isRightJustified = <font class="keyword">true</font>;
00400 <font class="keywordflow">continue</font>;
00401
00402 <font class="keywordflow">case</font> <font class="charliteral">'C'</font>: <font class="comment">//center</font>
00403 *to++ = <font class="charliteral">'<'</font>;
00404 *to++ = <font class="charliteral">'d'</font>;
00405 *to++ = <font class="charliteral">'i'</font>;
00406 *to++ = <font class="charliteral">'v'</font>;
00407 *to++ = <font class="charliteral">' '</font>;
00408 *to++ = <font class="charliteral">'a'</font>;
00409 *to++ = <font class="charliteral">'l'</font>;
00410 *to++ = <font class="charliteral">'i'</font>;
00411 *to++ = <font class="charliteral">'g'</font>;
00412 *to++ = <font class="charliteral">'n'</font>;
00413 *to++ = <font class="charliteral">'='</font>;
00414 *to++ = <font class="charliteral">'\"'</font>;
00415 *to++ = <font class="charliteral">'c'</font>;
00416 *to++ = <font class="charliteral">'e'</font>;
00417 *to++ = <font class="charliteral">'n'</font>;
00418 *to++ = <font class="charliteral">'t'</font>;
00419 *to++ = <font class="charliteral">'e'</font>;
00420 *to++ = <font class="charliteral">'r'</font>;
00421 *to++ = <font class="charliteral">'\"'</font>;
00422 *to++ = <font class="charliteral">'>'</font>;
00423 isCentered = <font class="keyword">true</font>;
00424 <font class="keywordflow">continue</font>;
00425
00426 <font class="keywordflow">case</font> <font class="charliteral">'L'</font>: <font class="comment">//left, reset right and center</font>
00427 <font class="keywordflow">if</font> (isCentered) {
00428 *to++ = <font class="charliteral">'<'</font>;
00429 *to++ = <font class="charliteral">'/'</font>;
00430 *to++ = <font class="charliteral">'c'</font>;
00431 *to++ = <font class="charliteral">'e'</font>;
00432 *to++ = <font class="charliteral">'n'</font>;
00433 *to++ = <font class="charliteral">'t'</font>;
00434 *to++ = <font class="charliteral">'e'</font>;
00435 *to++ = <font class="charliteral">'r'</font>;
00436 *to++ = <font class="charliteral">'>'</font>;
00437 isCentered = <font class="keyword">false</font>;
00438 }
00439 <font class="keywordflow">if</font> (isRightJustified) {
00440 *to++ = <font class="charliteral">'<'</font>;
00441 *to++ = <font class="charliteral">'/'</font>;
00442 *to++ = <font class="charliteral">'d'</font>;
00443 *to++ = <font class="charliteral">'i'</font>;
00444 *to++ = <font class="charliteral">'v'</font>;
00445 *to++ = <font class="charliteral">'>'</font>;
00446 isRightJustified = <font class="keyword">false</font>;
00447 }
00448 <font class="keywordflow">continue</font>;
00449 }
00450 <font class="keywordflow">break</font>;
00451 <font class="keywordflow">case</font> <font class="charliteral">'T'</font>: <font class="comment">// title formatting</font>
00452 <font class="keywordflow">switch</font>(token[1])
00453 {
00454 <font class="keywordflow">case</font> <font class="charliteral">'T'</font>: <font class="comment">// Book title begin</font>
00455 *to++ = <font class="charliteral">'<'</font>;
00456 *to++ = <font class="charliteral">'b'</font>;
00457 *to++ = <font class="charliteral">'i'</font>;
00458 *to++ = <font class="charliteral">'g'</font>;
00459 *to++ = <font class="charliteral">'>'</font>;
00460 <font class="keywordflow">continue</font>;
00461 <font class="keywordflow">case</font> <font class="charliteral">'t'</font>:
00462 *to++ = <font class="charliteral">'<'</font>;
00463 *to++ = <font class="charliteral">'/'</font>;
00464 *to++ = <font class="charliteral">'b'</font>;
00465 *to++ = <font class="charliteral">'i'</font>;
00466 *to++ = <font class="charliteral">'g'</font>;
00467 *to++ = <font class="charliteral">'>'</font>;
00468 <font class="keywordflow">continue</font>;<font class="comment">/*</font>
00469 <font class="comment"> case 'S':</font>
00470 <font class="comment"> *to++ = '<';</font>
00471 <font class="comment"> *to++ = 'b';</font>
00472 <font class="comment"> *to++ = 'r';</font>
00473 <font class="comment"> *to++ = ' ';</font>
00474 <font class="comment"> *to++ = '/';</font>
00475 <font class="comment"> *to++ = '>';</font>
00476 <font class="comment"> *to++ = '<';</font>
00477 <font class="comment"> *to++ = 'b';</font>
00478 <font class="comment"> *to++ = 'i';</font>
00479 <font class="comment"> *to++ = 'g';</font>
00480 <font class="comment"> *to++ = '>';</font>
00481 <font class="comment"> continue;</font>
00482 <font class="comment"> case 's':</font>
00483 <font class="comment"> *to++ = '<';</font>
00484 <font class="comment"> *to++ = '/';</font>
00485 <font class="comment"> *to++ = 'b';</font>
00486 <font class="comment"> *to++ = 'i';</font>
00487 <font class="comment"> *to++ = 'g';</font>
00488 <font class="comment"> *to++ = '>';</font>
00489 <font class="comment"> *to++ = '<';</font>
00490 <font class="comment"> *to++ = 'b';</font>
00491 <font class="comment"> *to++ = 'r';</font>
00492 <font class="comment"> *to++ = ' ';</font>
00493 <font class="comment"> *to++ = '/';</font>
00494 <font class="comment"> *to++ = '>';</font>
00495 <font class="comment"> continue;*/</font>
00496 }
00497 <font class="keywordflow">break</font>;
00498
00499 <font class="keywordflow">case</font> <font class="charliteral">'P'</font>: <font class="comment">// special formatting</font>
00500 <font class="keywordflow">switch</font>(token[1])
00501 {
00502 <font class="keywordflow">case</font> <font class="charliteral">'P'</font>: <font class="comment">// Poetry begin</font>
00503 *to++ = <font class="charliteral">'<'</font>;
00504 *to++ = <font class="charliteral">'c'</font>;
00505 *to++ = <font class="charliteral">'i'</font>;
00506 *to++ = <font class="charliteral">'t'</font>;
00507 *to++ = <font class="charliteral">'e'</font>;
00508 *to++ = <font class="charliteral">'>'</font>;
00509 <font class="keywordflow">continue</font>;
00510 <font class="keywordflow">case</font> <font class="charliteral">'p'</font>:
00511 *to++ = <font class="charliteral">'<'</font>;
00512 *to++ = <font class="charliteral">'/'</font>;
00513 *to++ = <font class="charliteral">'c'</font>;
00514 *to++ = <font class="charliteral">'i'</font>;
00515 *to++ = <font class="charliteral">'t'</font>;
00516 *to++ = <font class="charliteral">'e'</font>;
00517 *to++ = <font class="charliteral">'>'</font>;
00518 <font class="keywordflow">continue</font>;
00519 }
00520 <font class="keywordflow">break</font>;
00521 }
00522 <font class="keywordflow">continue</font>;
00523 }
00524 <font class="keywordflow">if</font> (intoken) {
00525 <font class="keywordflow">if</font> (tokpos < 2045) {
00526 token[tokpos++] = *from;
00527 token[tokpos+2] = 0;
00528 }
00529 }
00530 <font class="keywordflow">else</font>
00531 *to++ = *from;
00532 }
00533 *to++ = 0;
00534 *to = 0;
00535 <font class="keywordflow">return</font> 0;
00536 }
</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>
|