aboutsummaryrefslogblamecommitdiffstats
path: root/doc/api-documentation/html/gbf_8cpp-source.html
blob: 72513b7fb202b69b400769e5c803db0cbb9e12b7 (plain) (tree)
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
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749












































































































































































































































































































































































































































































































































































































































































































































































                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
<!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>gbf.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>gbf.cpp</h1><div class="fragment"><pre>00001 <font class="keyword">enum</font> TToken {
00002 tokNull, tokEOF, tokHeader, tokContent, tokTail, tokStyle,
00003               tokWord, tokSpace, tokSync, tokControl, tokChar, tokFont};
00004 
00005 <font class="keyword">enum</font> TCharacterAttribute { caBold, caSmallCaps, caItalic, caOTQuote, caRed,
00006                             caSuperscript, caUnderline, caSubscript};
00007 
00008 <font class="comment">//    TCharAttribs = set of TCharacterAttribute;</font>
00009 
00010 
00011 <font class="keyword">struct </font>TBookNameRec {
00012         string Name, Abbr;
00013         <font class="keywordtype">char</font> Num;
00014 }
00015 
00016 <font class="keyword">const</font> <font class="keyword">struct </font>TBookNameRec TBookAbbr[116] = {
00017         {<font class="stringliteral">"1 Chronicles"</font>,    <font class="stringliteral">"1CH"</font>, 13},   <font class="comment">//0</font>
00018         {<font class="stringliteral">"1 Corinthians"</font>,   <font class="stringliteral">"1CO"</font>, 70},   <font class="comment">//1</font>
00019         {<font class="stringliteral">"1 Esdras"</font>,        <font class="stringliteral">"1E"</font>, 52},    <font class="comment">//2</font>
00020         {<font class="stringliteral">"1 John"</font>,          <font class="stringliteral">"1J"</font>, 86},    <font class="comment">//3</font>
00021         {<font class="stringliteral">"1 Kings"</font>,         <font class="stringliteral">"1K"</font>, 11},    <font class="comment">//4</font>
00022         {<font class="stringliteral">"1 Maccabees"</font>,     <font class="stringliteral">"1M"</font>, 50},    <font class="comment">//5</font>
00023         {<font class="stringliteral">"1 Peter"</font>,         <font class="stringliteral">"1P"</font>, 84},    <font class="comment">//6</font>
00024         {<font class="stringliteral">"1 Samuel"</font>,        <font class="stringliteral">"1S"</font>, 9},     <font class="comment">//7</font>
00025         {<font class="stringliteral">"1 Thessalonians"</font>, <font class="stringliteral">"1TH"</font>, 76},   <font class="comment">//8</font>
00026         {<font class="stringliteral">"1 Timothy"</font>,       <font class="stringliteral">"1TI"</font>, 78},   <font class="comment">//9</font>
00027         {<font class="stringliteral">"2 Chronicles"</font>,    <font class="stringliteral">"2CH"</font>, 14},   <font class="comment">//10</font>
00028         {<font class="stringliteral">"2 Corinthians"</font>,   <font class="stringliteral">"2CO"</font>, 71},   <font class="comment">//11</font>
00029         {<font class="stringliteral">"2 Esdras"</font>,        <font class="stringliteral">"2E"</font>, 56},    <font class="comment">//12</font>
00030         {<font class="stringliteral">"2 John"</font>,          <font class="stringliteral">"2J"</font>, 87},    <font class="comment">//13</font>
00031         {<font class="stringliteral">"2 Kings"</font>,         <font class="stringliteral">"2K"</font>, 12},    <font class="comment">//14</font>
00032         {<font class="stringliteral">"2 Maccabees"</font>,     <font class="stringliteral">"2M"</font>, 51},    <font class="comment">//15</font>
00033         {<font class="stringliteral">"2 Peter"</font>,         <font class="stringliteral">"2P"</font>, 85},    <font class="comment">//16</font>
00034         {<font class="stringliteral">"2 Samuel"</font>,        <font class="stringliteral">"2S"</font>, 10},    <font class="comment">//17</font>
00035         {<font class="stringliteral">"2 Thessalonians"</font>, <font class="stringliteral">"2TH"</font>, 77},   <font class="comment">//18</font>
00036         {<font class="stringliteral">"2 Timothy"</font>,       <font class="stringliteral">"2TI"</font>, 79},   <font class="comment">//19</font>
00037         {<font class="stringliteral">"3 John"</font>,          <font class="stringliteral">"3J"</font>, 88},    <font class="comment">//20</font>
00038         {<font class="stringliteral">"3 Maccabees"</font>,     <font class="stringliteral">"3M"</font>, 55},    <font class="comment">//21</font>
00039         {<font class="stringliteral">"4 Maccabees"</font>,     <font class="stringliteral">"4M"</font>, 57},    <font class="comment">//22</font>
00040         {<font class="stringliteral">"1 Chronicles"</font>,    <font class="stringliteral">"1 CH"</font>, 13},   <font class="comment">//0</font>
00041         {<font class="stringliteral">"1 Corinthians"</font>,   <font class="stringliteral">"1 CO"</font>, 70},   <font class="comment">//1</font>
00042         {<font class="stringliteral">"1 Esdras"</font>,        <font class="stringliteral">"1 E"</font>, 52},    <font class="comment">//2</font>
00043         {<font class="stringliteral">"1 John"</font>,          <font class="stringliteral">"1 J"</font>, 86},    <font class="comment">//3</font>
00044         {<font class="stringliteral">"1 Kings"</font>,         <font class="stringliteral">"1 K"</font>, 11},    <font class="comment">//4</font>
00045         {<font class="stringliteral">"1 Maccabees"</font>,     <font class="stringliteral">"1 M"</font>, 50},    <font class="comment">//5</font>
00046         {<font class="stringliteral">"1 Peter"</font>,         <font class="stringliteral">"1 P"</font>, 84},    <font class="comment">//6</font>
00047         {<font class="stringliteral">"1 Samuel"</font>,        <font class="stringliteral">"1 S"</font>, 9},     <font class="comment">//7</font>
00048         {<font class="stringliteral">"1 Thessalonians"</font>, <font class="stringliteral">"1 TH"</font>, 76},   <font class="comment">//8</font>
00049         {<font class="stringliteral">"1 Timothy"</font>,       <font class="stringliteral">"1 TI"</font>, 78},   <font class="comment">//9</font>
00050         {<font class="stringliteral">"2 Chronicles"</font>,    <font class="stringliteral">"2 CH"</font>, 14},   <font class="comment">//10</font>
00051         {<font class="stringliteral">"2 Corinthians"</font>,   <font class="stringliteral">"2 CO"</font>, 71},   <font class="comment">//11</font>
00052         {<font class="stringliteral">"2 Esdras"</font>,        <font class="stringliteral">"2 E"</font>, 56},    <font class="comment">//12</font>
00053         {<font class="stringliteral">"2 John"</font>,          <font class="stringliteral">"2 J"</font>, 87},    <font class="comment">//13</font>
00054         {<font class="stringliteral">"2 Kings"</font>,         <font class="stringliteral">"2 K"</font>, 12},    <font class="comment">//14</font>
00055         {<font class="stringliteral">"2 Maccabees"</font>,     <font class="stringliteral">"2 M"</font>, 51},    <font class="comment">//15</font>
00056         {<font class="stringliteral">"2 Peter"</font>,         <font class="stringliteral">"2 P"</font>, 85},    <font class="comment">//16</font>
00057         {<font class="stringliteral">"2 Samuel"</font>,        <font class="stringliteral">"2 S"</font>, 10},    <font class="comment">//17</font>
00058         {<font class="stringliteral">"2 Thessalonians"</font>, <font class="stringliteral">"2 TH"</font>, 77},   <font class="comment">//18</font>
00059         {<font class="stringliteral">"2 Timothy"</font>,       <font class="stringliteral">"2 TI"</font>, 79},   <font class="comment">//19</font>
00060         {<font class="stringliteral">"3 John"</font>,          <font class="stringliteral">"3 J"</font>, 88},    <font class="comment">//20</font>
00061         {<font class="stringliteral">"3 Maccabees"</font>,     <font class="stringliteral">"3 M"</font>, 55},    <font class="comment">//21</font>
00062         {<font class="stringliteral">"4 Maccabees"</font>,     <font class="stringliteral">"4 M"</font>, 57},    <font class="comment">//22</font>
00063         {<font class="stringliteral">"Acts"</font>,            <font class="stringliteral">"AC"</font>, 68},    <font class="comment">//23</font>
00064         {<font class="stringliteral">"Amos"</font>,            <font class="stringliteral">"AM"</font>, 30},    <font class="comment">//24</font>
00065         {<font class="stringliteral">"Prayer of Asariah and the Song of the Three Jews"</font>, <font class="stringliteral">"AZ"</font>, 47},
00066         {<font class="stringliteral">"Baruch"</font>,          <font class="stringliteral">"BA"</font>, 45},    <font class="comment">//26</font>
00067         {<font class="stringliteral">"Bel and the Dragon"</font>,<font class="stringliteral">"BE"</font>, 49},  <font class="comment">//27</font>
00068         {<font class="stringliteral">"Colossians"</font>,      <font class="stringliteral">"CO"</font>, 75},    <font class="comment">//28</font>
00069         {<font class="stringliteral">"Daniel"</font>,          <font class="stringliteral">"DA"</font>, 27},    <font class="comment">//29</font>
00070         {<font class="stringliteral">"Deuteronomy"</font>,     <font class="stringliteral">"DE"</font>, 5},     <font class="comment">//30</font>
00071         {<font class="stringliteral">"Deuteronomy"</font>,     <font class="stringliteral">"DT"</font>, 5},     <font class="comment">//31</font>
00072         {<font class="stringliteral">"Ecclesiasties"</font>,   <font class="stringliteral">"EC"</font>, 21},    <font class="comment">//32</font>
00073         {<font class="stringliteral">"Esther"</font>,          <font class="stringliteral">"ES"</font>, 17},    <font class="comment">//33</font>
00074         {<font class="stringliteral">"Exodus"</font>,          <font class="stringliteral">"EX"</font>, 2},     <font class="comment">//34</font>
00075         {<font class="stringliteral">"Ezekiel"</font>,         <font class="stringliteral">"EZE"</font>, 26},   <font class="comment">//35</font>
00076         {<font class="stringliteral">"Ezra"</font>,            <font class="stringliteral">"EZR"</font>, 15},   <font class="comment">//36</font>
00077         {<font class="stringliteral">"Galatians"</font>,       <font class="stringliteral">"GA"</font>, 72},    <font class="comment">//37</font>
00078         {<font class="stringliteral">"Genesis"</font>,         <font class="stringliteral">"GE"</font>, 1},     <font class="comment">//38</font>
00079         {<font class="stringliteral">"Genesis"</font>,         <font class="stringliteral">"GN"</font>, 1},     <font class="comment">//39</font>
00080         {<font class="stringliteral">"Ephesians"</font>,       <font class="stringliteral">"EP"</font>, 73},    <font class="comment">//40</font>
00081         {<font class="stringliteral">"Esther (Greek}"</font>,  <font class="stringliteral">"GR"</font>, 42),    <font class="comment">//41</font>
00082         {<font class="stringliteral">"Habakkuk"</font>,        <font class="stringliteral">"HAB"</font>, 35},   <font class="comment">//42</font>
00083         {<font class="stringliteral">"Haggai"</font>,          <font class="stringliteral">"HAG"</font>, 37},   <font class="comment">//43</font>
00084         {<font class="stringliteral">"Hebrews"</font>,         <font class="stringliteral">"HE"</font>, 82},    <font class="comment">//44</font>
00085         {<font class="stringliteral">"Hosea"</font>,           <font class="stringliteral">"HO"</font>, 28},    <font class="comment">//45</font>
00086         {<font class="stringliteral">"Isaiah"</font>,          <font class="stringliteral">"IS"</font>, 23},    <font class="comment">//46</font>
00087         {<font class="stringliteral">"James"</font>,           <font class="stringliteral">"JA"</font>, 83},    <font class="comment">//47</font>
00088         {<font class="stringliteral">"Jeremiah"</font>,        <font class="stringliteral">"JE"</font>, 24},    <font class="comment">//48</font>
00089         {<font class="stringliteral">"Job"</font>,             <font class="stringliteral">"JOB"</font>, 18},   <font class="comment">//49</font>
00090         {<font class="stringliteral">"Joel"</font>,            <font class="stringliteral">"JOE"</font>, 29},   <font class="comment">//50</font>
00091         {<font class="stringliteral">"John"</font>,            <font class="stringliteral">"JOH"</font>, 67},   <font class="comment">//51</font>
00092         {<font class="stringliteral">"Jonah"</font>,           <font class="stringliteral">"JON"</font>, 32},   <font class="comment">//52</font>
00093         {<font class="stringliteral">"Joshua"</font>,          <font class="stringliteral">"JOS"</font>, 6},    <font class="comment">//53</font>
00094         {<font class="stringliteral">"Jude"</font>,            <font class="stringliteral">"JUDE"</font>, 89},  <font class="comment">//54</font>
00095         {<font class="stringliteral">"Judges"</font>,          <font class="stringliteral">"JUDG"</font>, 7},   <font class="comment">//55</font>
00096         {<font class="stringliteral">"Judith"</font>,          <font class="stringliteral">"JUDI"</font>, 41},  <font class="comment">//56</font>
00097         {<font class="stringliteral">"Lamentations"</font>,    <font class="stringliteral">"LA"</font>, 25},    <font class="comment">//57</font>
00098         {<font class="stringliteral">"Letter of Jeremiah"</font>,Abbr:<font class="stringliteral">"LET"</font>, 46},  <font class="comment">//58</font>
00099         {<font class="stringliteral">"Leviticus"</font>,       <font class="stringliteral">"LEV"</font>, 3},    <font class="comment">//59</font>
00100         {<font class="stringliteral">"Luke"</font>,            <font class="stringliteral">"LK"</font>, 66},    <font class="comment">//60</font>
00101         {<font class="stringliteral">"Leviticus"</font>,       <font class="stringliteral">"LV"</font>, 3},     <font class="comment">//61</font>
00102         {<font class="stringliteral">"Luke"</font>,            <font class="stringliteral">"LU"</font>, 66},    <font class="comment">//62</font>
00103         {<font class="stringliteral">"Malachi"</font>,         <font class="stringliteral">"MAL"</font>, 39},   <font class="comment">//63</font>
00104         {<font class="stringliteral">"Prayer of Manasseh"</font>,Abbr:<font class="stringliteral">"MAN"</font>, 53},  <font class="comment">//64</font>
00105         {<font class="stringliteral">"Mark"</font>,            <font class="stringliteral">"MAR"</font>, 65},   <font class="comment">//65</font>
00106         {<font class="stringliteral">"Matthew"</font>,         <font class="stringliteral">"MAT"</font>, 64},   <font class="comment">//66</font>
00107         {<font class="stringliteral">"Micah"</font>,           <font class="stringliteral">"MI"</font>, 33},    <font class="comment">//67</font>
00108         {<font class="stringliteral">"Nahum"</font>,           <font class="stringliteral">"NA"</font>, 34},    <font class="comment">//68</font>
00109         {<font class="stringliteral">"Nehemiah"</font>,        <font class="stringliteral">"NE"</font>, 16},    <font class="comment">//69</font>
00110         {<font class="stringliteral">"Numbers"</font>,         <font class="stringliteral">"NU"</font>, 4},     <font class="comment">//70</font>
00111         {<font class="stringliteral">"Obadiah"</font>,         <font class="stringliteral">"OB"</font>, 31},    <font class="comment">//71</font>
00112         {<font class="stringliteral">"Psalm 151"</font>,       <font class="stringliteral">"P1"</font>, 54},    <font class="comment">//72</font>
00113         {<font class="stringliteral">"Philemon"</font>,        <font class="stringliteral">"PHILE"</font>, 81}, <font class="comment">//73</font>
00114         {<font class="stringliteral">"Philippians"</font>,     <font class="stringliteral">"PHILI"</font>, 74}, <font class="comment">//74</font>
00115         {<font class="stringliteral">"Philemon"</font>,        <font class="stringliteral">"PHM"</font>, 81},   <font class="comment">//75</font>
00116         {<font class="stringliteral">"Philippians"</font>,     <font class="stringliteral">"PHP"</font>, 74},   <font class="comment">//76</font>
00117         {<font class="stringliteral">"Proverbs"</font>,        <font class="stringliteral">"PR"</font>, 20},    <font class="comment">//77</font>
00118         {<font class="stringliteral">"Psalms"</font>,          <font class="stringliteral">"PS"</font>, 19},    <font class="comment">//78</font>
00119         {<font class="stringliteral">"Revelation"</font>,      <font class="stringliteral">"RE"</font>, 90},    <font class="comment">//79</font>
00120         {<font class="stringliteral">"Romans"</font>,          <font class="stringliteral">"RM"</font>, 69},    <font class="comment">//80</font>
00121         {<font class="stringliteral">"Romans"</font>,          <font class="stringliteral">"RO"</font>, 69},    <font class="comment">//81</font>
00122         {<font class="stringliteral">"Ruth"</font>,            <font class="stringliteral">"RU"</font>, 8},     <font class="comment">//82</font>
00123         {<font class="stringliteral">"Sirach"</font>,          <font class="stringliteral">"SI"</font>, 44},    <font class="comment">//83</font>
00124         {<font class="stringliteral">"Song of Solomon"</font>, <font class="stringliteral">"SOL"</font>, 22},   <font class="comment">//84</font>
00125         {<font class="stringliteral">"Song of Solomon"</font>, <font class="stringliteral">"SON"</font>, 22},   <font class="comment">//85</font>
00126         {<font class="stringliteral">"Song of Solomon"</font>, <font class="stringliteral">"SS"</font>, 22},    <font class="comment">//86</font>
00127         {<font class="stringliteral">"Susanna"</font>,         <font class="stringliteral">"SU"</font>, 48},    <font class="comment">//87</font>
00128         {<font class="stringliteral">"Titus"</font>,           <font class="stringliteral">"TI"</font>, 80},    <font class="comment">//88</font>
00129         {<font class="stringliteral">"Tobit"</font>,           <font class="stringliteral">"TO"</font>, 40},    <font class="comment">//89</font>
00130         {<font class="stringliteral">"Wisdom"</font>,          <font class="stringliteral">"WI"</font>, 43},    <font class="comment">//90</font>
00131         {<font class="stringliteral">"Zechariah"</font>,       <font class="stringliteral">"ZEC"</font>, 38},   <font class="comment">//91</font>
00132         {<font class="stringliteral">"Zephaniah"</font>,       <font class="stringliteral">"ZEP"</font>, 36}    <font class="comment">//92</font>
00133         },
00134 
00135 string BookFileName[91] = {
00136         <font class="stringliteral">""</font>,<font class="stringliteral">"Genesis"</font>,<font class="stringliteral">"Exodus"</font>,<font class="stringliteral">"Lev"</font>,<font class="stringliteral">"Num"</font>,<font class="stringliteral">"Deut"</font>,<font class="stringliteral">"Joshua"</font>,<font class="stringliteral">"Judges"</font>, <font class="comment">// 0 - 7</font>
00137         <font class="stringliteral">"Ruth"</font>,<font class="stringliteral">"1Sam"</font>,<font class="stringliteral">"2Sam"</font>,<font class="stringliteral">"1Kings"</font>,<font class="stringliteral">"2Kings"</font>,<font class="stringliteral">"1Chron"</font>,<font class="stringliteral">"2Chron"</font>,   <font class="comment">// 8 - 14</font>
00138         <font class="stringliteral">"Ezra"</font>,<font class="stringliteral">"Nehemiah"</font>,<font class="stringliteral">"Esther"</font>,<font class="stringliteral">"Job"</font>,<font class="stringliteral">"Psalms"</font>,<font class="stringliteral">"Proverbs"</font>,       <font class="comment">// 15-20</font>
00139         <font class="stringliteral">"Eccl"</font>,<font class="stringliteral">"Song"</font>,<font class="stringliteral">"Isaiah"</font>,<font class="stringliteral">"Jeremiah"</font>,<font class="stringliteral">"Lament"</font>,<font class="stringliteral">"Ezekiel"</font>,       <font class="comment">// 21-26</font>
00140         <font class="stringliteral">"Daniel"</font>,<font class="stringliteral">"Hosea"</font>,<font class="stringliteral">"Joel"</font>,<font class="stringliteral">"Amos"</font>,<font class="stringliteral">"Obadiah"</font>,<font class="stringliteral">"Jonah"</font>,<font class="stringliteral">"Micah"</font>,   <font class="comment">// 27-33</font>
00141         <font class="stringliteral">"Nahum"</font>,<font class="stringliteral">"Habakkuk"</font>,<font class="stringliteral">"Zeph"</font>,<font class="stringliteral">"Haggai"</font>,<font class="stringliteral">"Zech"</font>,<font class="stringliteral">"Malachi"</font>,        <font class="comment">// 34-39</font>
00142         <font class="stringliteral">"Tobit"</font>,<font class="stringliteral">"Judith"</font>,<font class="stringliteral">"Esther"</font>,<font class="stringliteral">"Wisdom"</font>,<font class="stringliteral">"Sirach"</font>,<font class="stringliteral">"Baruch"</font>,       <font class="comment">// 40-45</font>
00143         <font class="stringliteral">"Let"</font>,<font class="stringliteral">"Azar"</font>,<font class="stringliteral">"Susanna"</font>,<font class="stringliteral">"Bel"</font>,<font class="stringliteral">"1Mac"</font>,<font class="stringliteral">"2Mac"</font>,<font class="stringliteral">"1Esdras"</font>,       <font class="comment">// 46-52</font>
00144         <font class="stringliteral">"Man"</font>,<font class="stringliteral">"P1"</font>,<font class="stringliteral">"3Mac"</font>,<font class="stringliteral">"2Esdras"</font>,<font class="stringliteral">"4Mac"</font>,<font class="stringliteral">""</font>,<font class="stringliteral">""</font>,<font class="stringliteral">""</font>,<font class="stringliteral">""</font>,<font class="stringliteral">""</font>,<font class="stringliteral">""</font>,       <font class="comment">// 53-63</font>
00145         <font class="stringliteral">"Matthew"</font>,<font class="stringliteral">"Mark"</font>,<font class="stringliteral">"Luke"</font>,<font class="stringliteral">"John"</font>,<font class="stringliteral">"Acts"</font>,<font class="stringliteral">"Romans"</font>,<font class="stringliteral">"1Cor"</font>,      <font class="comment">// 64-70</font>
00146         <font class="stringliteral">"2Cor"</font>,<font class="stringliteral">"Gal"</font>,<font class="stringliteral">"Eph"</font>,<font class="stringliteral">"Philip"</font>,<font class="stringliteral">"Col"</font>,<font class="stringliteral">"1Thes"</font>,<font class="stringliteral">"2Thes"</font>,<font class="stringliteral">"1Tim"</font>,   <font class="comment">// 71-78</font>
00147         <font class="stringliteral">"2Tim"</font>,<font class="stringliteral">"Titus"</font>,<font class="stringliteral">"Philemon"</font>,<font class="stringliteral">"Hebrews"</font>,<font class="stringliteral">"James"</font>,<font class="stringliteral">"1Peter"</font>,       <font class="comment">// 79-84</font>
00148         <font class="stringliteral">"2Peter"</font>,<font class="stringliteral">"1John"</font>,<font class="stringliteral">"2John"</font>,<font class="stringliteral">"3John"</font>,<font class="stringliteral">"Jude"</font>,<font class="stringliteral">"Rev"</font>};             <font class="comment">// 85-90</font>
00149 
00150 <font class="keyword">class </font>TReadGBF {
00151 <font class="keyword">private</font>:
00152         FILE *fp;
00153         string FName, TokenLine;
00154         <font class="keywordtype">int</font> TokenPos;
00155         <font class="keywordtype">bool</font> fFileIsOpen, fParagraphEnd, fInTitle, fInPsalmBookTitle, fInHebrewTitle, fInSectionTitle;
00156 
00157 <font class="keyword">public</font>:
00158         string sBook, sChapter, sVerse, sMode;
00159         string sContext; <font class="comment">// Last text type (header, body, or tail)</font>
00160         string sTitle;   <font class="comment">// Title of this book of the Bible</font>
00161         string sPsalmBookTitle; <font class="comment">// Title of this Psalm book</font>
00162         string sHebrewTitle;    <font class="comment">// Psalm Hebrew title</font>
00163         string sSectionTitle;   <font class="comment">// Section headings</font>
00164         string sDate;
00165         string sFontName;
00166         <font class="keywordtype">int</font> iTotalWords;
00167         <font class="keywordtype">char</font> chJustification, chDirection;
00168         <font class="keywordtype">bool</font> fIndent, fPoetry;
00169         <font class="keywordtype">int</font> CharAttribs;
00170         <font class="keywordtype">char</font> bBk, bChap, bVs, bWd;
00171 
00172         <font class="keywordtype">bool</font> Init(<font class="keyword">const</font> string sFileName);
00173         <font class="keywordtype">void</font> Done();
00174         string GetToken(TToken &amp;TokenKind);
00175     end;
00176 
00177 <font class="keyword">class </font>TWriteGBF {
00178         <font class="keyword">private</font>:
00179         F: TextFile;
00180         FName, LineOut: string;
00181         fFileIsOpen: <font class="keywordtype">boolean</font>;
00182         bBk, bChap, bVs, bWd: byte;
00183 
00184         <font class="keyword">public</font>
00185 
00186         function Init(<font class="keyword">const</font> sFileName: string): boolean;
00187         function Done: <font class="keywordtype">boolean</font>;
00188         procedure Out(<font class="keyword">const</font> s: string);
00189     end;
00190 
00191 function isletter(<font class="keyword">const</font> ch: <font class="keywordtype">char</font>): boolean;
00192 function isinword(<font class="keyword">const</font> ch: <font class="keywordtype">char</font>): boolean;
00193 function IsDigit(<font class="keyword">const</font> ch: <font class="keywordtype">char</font>): Boolean;
00194 function IsUpper(<font class="keyword">const</font> ch: <font class="keywordtype">char</font>): Boolean;
00195 function ConformCase(<font class="keyword">const</font> sPat, sSrc: string): string;
00196 function BookNameToNumber(<font class="keyword">const</font> sBookName: string): byte;
00197 
00198 implementation
00199 
00200 function isletter(<font class="keyword">const</font> ch: <font class="keywordtype">char</font>): boolean;
00201 begin
00202     <font class="keywordflow">case</font> ch of
00203         <font class="charliteral">'A'</font>..<font class="charliteral">'Z'</font>: isletter := <font class="keyword">true</font>;
00204         <font class="charliteral">'a'</font>..<font class="charliteral">'z'</font>: isletter := <font class="keyword">true</font>;
00205         <font class="keywordflow">else</font>
00206         isletter := <font class="keyword">false</font>;
00207     end;
00208 end;
00209 
00210 function isinword(<font class="keyword">const</font> ch: <font class="keywordtype">char</font>): boolean;
00211 begin
00212     <font class="keywordflow">case</font> ch of
00213         <font class="charliteral">'-'</font>: isinword := <font class="keyword">true</font>;
00214         <font class="charliteral">'A'</font>..<font class="charliteral">'Z'</font>: isinword := <font class="keyword">true</font>;
00215         <font class="charliteral">'a'</font>..<font class="charliteral">'z'</font>: isinword := <font class="keyword">true</font>;
00216         <font class="keywordflow">else</font>
00217         isinword := <font class="keyword">false</font>;
00218     end;
00219 end;
00220 
00221 function IsUpper(<font class="keyword">const</font> ch: <font class="keywordtype">char</font>): Boolean;
00222 begin
00223     <font class="keywordflow">case</font> ch of
00224         <font class="charliteral">'A'</font>..<font class="charliteral">'Z'</font>: IsUpper := <font class="keyword">true</font>;
00225         <font class="keywordflow">else</font>
00226             IsUpper := <font class="keyword">false</font>;
00227     end;
00228 end;
00229 
00230 function IsDigit(<font class="keyword">const</font> ch: <font class="keywordtype">char</font>): Boolean;
00231 begin
00232     <font class="keywordflow">case</font> ch of
00233         <font class="charliteral">'0'</font>..<font class="charliteral">'9'</font>: IsDigit := <font class="keyword">true</font>;
00234         <font class="keywordflow">else</font>
00235             IsDigit := <font class="keyword">false</font>;
00236     end;
00237 end;
00238 
00239 
00240 function MatchAbbrev(<font class="keyword">const</font> sName, sAbbrev: string): boolean;
00241 var i: integer;
00242 begin
00243     <font class="keywordflow">if</font> Length(sName) &lt; Length(sAbbrev) then
00244         Result := <font class="keyword">false</font>
00245     <font class="keywordflow">else</font>
00246         Result := <font class="keyword">true</font>;
00247     i := 1;
00248     <font class="keywordflow">while</font> (i &lt;= Length(sAbbrev)) and Result <font class="keywordflow">do</font>
00249         begin
00250         <font class="keywordflow">if</font> UpCase(sName[i]) &lt;&gt; sAbbrev[i] then
00251             Result := <font class="keyword">false</font>;
00252         inc(i);
00253         end;
00254 end;
00255 
00256 function BookNameToNumber(<font class="keyword">const</font> sBookName: string): byte;
00257 var i: integer;
00258 begin
00259     Result := 0;
00260     <font class="keywordflow">try</font>
00261     <font class="keywordflow">if</font> IsDigit(sBookName[Length(sBookName)]) and IsDigit(sBookName[1]) then
00262         Result := StrToInt(sBookName);
00263     except
00264     Result := 0;
00265     end;
00266     i := 0;
00267     <font class="keywordflow">while</font> (Result = 0) and (i &lt;= 115) <font class="keywordflow">do</font>  <font class="comment">// Yuk! Linear search.</font>
00268         begin
00269         <font class="keywordflow">if</font> MatchAbbrev(sBookName,BookAbbr[i].Abbr) then
00270             begin
00271             Result := BookAbbr[i].Num;
00272             end;
00273         inc(i);
00274         end;
00275 end;
00276 
00277 function BookNumberToName(<font class="keyword">const</font> bBookNum: byte): string;
00278 begin
00279     <font class="keywordflow">if</font> bBookNum &lt;= 115 then
00280         Result := BookAbbr[bBookNum].Name
00281     <font class="keywordflow">else</font>
00282         Result := '';
00283 end;
00284 
00285 function ConformCase(<font class="keyword">const</font> sPat, sSrc: string): string;
00286 var i: integer;
00287 begin
00288     Result := sSrc;
00289     <font class="keywordflow">if</font> (Length(sPat) &gt; 0) and (Length(sSrc) &gt; 0) then
00290         begin
00291         Result := LowerCase(sSrc);
00292         <font class="keywordflow">if</font> IsUpper(sPat[1]) then
00293             Result[1] := UpCase(Result[1]);
00294         <font class="keywordflow">if</font> (Length(sPat) &gt; 1) and (Length(sSrc) &gt; 1) then
00295             begin
00296             <font class="keywordflow">if</font> IsUpper(sPat[2]) then
00297                 begin
00298                 <font class="keywordflow">for</font> i := 2 to Length(Result) <font class="keywordflow">do</font>
00299                     Result[i] := UpCase(Result[i]);
00300                 end;
00301             end;
00302         end;
00303 end;
00304 
00305 function TReadGBF.Init(<font class="keyword">const</font> sFileName: string): boolean;
00306 var s: string;
00307     tok: TToken;
00308 begin
00309     <font class="keywordflow">try</font>
00310     fParagraphEnd := <font class="keyword">false</font>;
00311     bBk := 0;
00312     bChap := 0;
00313     bVs := 0;
00314     bWd := 0;
00315     iTotalWords := 0;
00316     FName := sFileName;
00317     Assign(F, FName);
00318     reset(F);
00319     readln(F, TokenLine);
00320     TokenPos := 1;
00321     fFileIsOpen := <font class="keyword">true</font>;
00322     repeat
00323         s := GetToken(tok)
00324     until (tok = tokEOF) or ((tok = tokHeader) and (s[3] = <font class="charliteral">'0'</font>));
00325     Init := <font class="keyword">true</font>;
00326     except
00327     Init := <font class="keyword">false</font>;
00328     fFileIsOpen := <font class="keyword">false</font>;
00329     end
00330 end;
00331 
00332 procedure TReadGBF.Done;
00333 begin
00334     <font class="keywordflow">if</font> fFileIsOpen then
00335         begin
00336         closefile(F);
00337         fFileIsOpen := <font class="keyword">false</font>;
00338         end;
00339 end;
00340 
00341 function TReadGBF.GetToken(var TokenKind: TToken): string;
00342 var m: integer;
00343 begin
00344     Result := '';
00345     TokenKind := tokNull;
00346     <font class="keywordflow">if</font> TokenPos = 0 then
00347         begin
00348         <font class="keywordflow">if</font> (not fFileIsOpen) or EOF(F) then
00349             TokenKind := tokEOF
00350         <font class="keywordflow">else</font>
00351             begin
00352             ReadLn(F,TokenLine);
00353             TokenPos := 1;
00354             end;
00355         end;
00356     <font class="keywordflow">if</font> TokenKind &lt;&gt; tokEOF then
00357         begin
00358         m := Length(TokenLine);
00359         <font class="keywordflow">if</font> TokenPos &gt; m then
00360             begin
00361             TokenKind := tokSpace;
00362             <font class="keywordflow">if</font> fParagraphEnd then
00363                 fParagraphEnd := <font class="keyword">false</font>
00364             <font class="keywordflow">else</font>
00365                 Result := <font class="charliteral">' '</font>;
00366             TokenPos := 0;
00367             end
00368         <font class="keywordflow">else</font>
00369             begin
00370             <font class="keywordflow">if</font> (TokenLine[TokenPos] = <font class="charliteral">'&lt;'</font>) then
00371                 begin
00372                 fParagraphEnd := <font class="keyword">false</font>;
00373                 repeat
00374                     Result := Result + TokenLine[TokenPos];
00375                     inc(TokenPos);
00376                 until (TokenLine[TokenPos] = <font class="charliteral">'&gt;'</font>) or (TokenPos &gt; m);
00377                 Result := Result + <font class="charliteral">'&gt;'</font>;
00378                 inc(TokenPos);
00379                 <font class="keywordflow">case</font> result[2] of
00380                     <font class="charliteral">'B'</font>: begin <font class="comment">// File body text type</font>
00381                          TokenKind := tokContent;
00382                          sContext := Result;
00383                          end;
00384                     <font class="charliteral">'C'</font>: begin <font class="comment">// Special characters</font>
00385                          TokenKind := tokControl;
00386                          <font class="keywordflow">if</font> (Result[3] = <font class="charliteral">'M'</font>) or (Result[3] = <font class="charliteral">'L'</font>) then
00387                              fParagraphEnd := <font class="keyword">true</font>;
00388                          end;
00389                     <font class="charliteral">'D'</font>: begin <font class="comment">// Direction</font>
00390                          TokenKind := tokControl;
00391                          chDirection := Result[3];
00392                          end;
00393                     <font class="charliteral">'H'</font>: begin
00394                          TokenKind := tokHeader;
00395                          sContext := Result;
00396                          end;
00397                     <font class="charliteral">'F'</font>: begin <font class="comment">// Font attributes</font>
00398                          TokenKind := tokFont;
00399                          <font class="keywordflow">case</font> Result[3] of
00400                              <font class="charliteral">'B'</font>: CharAttribs := CharAttribs + [caBold];
00401                              <font class="charliteral">'C'</font>: CharAttribs := CharAttribs + [caSmallCaps];
00402                              <font class="charliteral">'I'</font>: CharAttribs := CharAttribs + [caItalic];
00403                              <font class="charliteral">'N'</font>: sFontName := copy(Result,4,Length(Result)-4);
00404                              <font class="charliteral">'O'</font>: CharAttribs := CharAttribs + [caOTQuote];
00405                              <font class="charliteral">'R'</font>: CharAttribs := CharAttribs + [caRed];
00406                              <font class="charliteral">'S'</font>: CharAttribs := CharAttribs + [caSuperscript];
00407                              <font class="charliteral">'U'</font>: CharAttribs := CharAttribs + [caUnderline];
00408                              <font class="charliteral">'V'</font>: CharAttribs := CharAttribs + [caSubscript];
00409                              <font class="charliteral">'b'</font>: CharAttribs := CharAttribs - [caBold];
00410                              <font class="charliteral">'c'</font>: CharAttribs := CharAttribs - [caSmallCaps];
00411                              <font class="charliteral">'i'</font>: CharAttribs := CharAttribs - [caItalic];
00412                              <font class="charliteral">'n'</font>: sFontName := '';
00413                              <font class="charliteral">'o'</font>: CharAttribs := CharAttribs - [caOTQuote];
00414                              <font class="charliteral">'r'</font>: CharAttribs := CharAttribs - [caRed];
00415                              <font class="charliteral">'s'</font>: CharAttribs := CharAttribs - [caSuperscript];
00416                              <font class="charliteral">'u'</font>: CharAttribs := CharAttribs - [caUnderline];
00417                              <font class="charliteral">'v'</font>: CharAttribs := CharAttribs - [caSubscript];
00418 
00419                          end;
00420                          end;
00421                     <font class="charliteral">'J'</font>: begin <font class="comment">// Justification</font>
00422                          TokenKind := tokStyle;
00423                          chJustification := Result[3];
00424                          end;
00425                     <font class="charliteral">'P'</font>: begin <font class="comment">// Poetry/prose, indent</font>
00426                          TokenKind := tokControl;
00427                          <font class="keywordflow">case</font> Result[3] of
00428                              <font class="charliteral">'I'</font>: fIndent := <font class="keyword">true</font>;
00429                              <font class="charliteral">'P'</font>: fPoetry := <font class="keyword">true</font>;
00430                              <font class="charliteral">'i'</font>: fIndent := <font class="keyword">false</font>;
00431                              <font class="charliteral">'p'</font>: fPoetry := <font class="keyword">false</font>;
00432                          end;
00433                          end;
00434                     <font class="charliteral">'R'</font>: begin <font class="comment">// References and footnotes</font>
00435                          TokenKind := tokControl;
00436                          end;
00437                     <font class="charliteral">'S'</font>: begin <font class="comment">// sync mark</font>
00438                          TokenKind := TokSync;
00439                          <font class="keywordflow">case</font> Result[3] of
00440                              <font class="charliteral">'B'</font>: begin <font class="comment">// Book</font>
00441                                   sBook := system.copy(Result, 4, length(Result)-4);
00442                                   sPsalmBookTitle := '';
00443                                   <font class="keywordflow">if</font> sBook = '' then
00444                                       begin
00445                                       inc(bBk);
00446                                       sBook := BookNumberToName(bBk);
00447                                       end
00448                                   <font class="keywordflow">else</font>
00449                                       bBk := BookNameToNumber(sBook);
00450                                   sTitle := sBook;
00451                                   end;
00452                              <font class="charliteral">'C'</font>: begin <font class="comment">//chapter</font>
00453                                   sChapter := system.copy(Result, 4, length(Result)-4);
00454                                   <font class="keywordflow">if</font> sChapter = '' then
00455                                       begin
00456                                       inc(bChap);
00457                                       sChapter := IntToStr(bChap);
00458                                       end
00459                                   <font class="keywordflow">else</font>
00460                                       begin
00461                                       <font class="keywordflow">try</font>
00462                                       bChap := StrToInt(sChapter);
00463                                       except
00464                                       showmessage('Non-numeric chapter: '+sBook+<font class="charliteral">' '</font>+sChapter);
00465                                       end;
00466                                       end;
00467                                   sHebrewTitle := '';    
00468                                   end;
00469                              <font class="charliteral">'V'</font>: begin <font class="comment">// Verse</font>
00470                                   bWd := 0;
00471                                   sVerse := system.copy(Result, 4, length(Result)-4);
00472                                   <font class="keywordflow">if</font> sVerse = '' then
00473                                       begin
00474                                       inc(bVs);
00475                                       sVerse := IntToStr(bVs);
00476                                       end
00477                                   <font class="keywordflow">else</font>
00478                                       begin
00479                                       <font class="keywordflow">try</font>
00480                                       bVs := StrToInt(sVerse);
00481                                       except
00482                                       showmessage('Non-numeric verse: '+sBook+<font class="charliteral">' '</font>+sChapter+<font class="charliteral">':'</font>+sVerse);
00483                                       end;
00484                                       end;
00485                                   end;
00486                              <font class="charliteral">'D'</font>: begin <font class="comment">// Date</font>
00487                                   sDate := system.copy(Result, 3, length(Result)-4);
00488                                   end;
00489                          end;
00490                          end;
00491                     <font class="charliteral">'T'</font>: begin <font class="comment">// Titles</font>
00492                          TokenKind := TokContent;
00493                          <font class="keywordflow">case</font> Result[3] of
00494                              <font class="charliteral">'B'</font>:
00495                                  begin
00496                                  sPsalmBookTitle := '';
00497                                  fInPsalmBookTitle := <font class="keyword">true</font>;
00498                                  end;
00499                              <font class="charliteral">'b'</font>: fInPsalmBookTitle := <font class="keyword">true</font>;
00500                              <font class="charliteral">'H'</font>:
00501                                  begin
00502                                  sHebrewTitle := '';
00503                                  fInHebrewTitle := <font class="keyword">true</font>;
00504                                  end;
00505                              <font class="charliteral">'h'</font>: fInHebrewTitle := <font class="keyword">false</font>;
00506                              <font class="charliteral">'S'</font>:
00507                                  begin
00508                                  sSectionTitle := '';
00509                                  fInSectionTitle := <font class="keyword">true</font>;
00510                                  end;
00511                              <font class="charliteral">'s'</font>: fInSectionTitle := <font class="keyword">false</font>;
00512                              <font class="charliteral">'T'</font>:
00513                                  begin
00514                                  sTitle := '';
00515                                  fInTitle := <font class="keyword">true</font>;
00516                                  end;
00517                              <font class="charliteral">'t'</font>: fInTitle := <font class="keyword">false</font>;
00518                          end;
00519                          end;
00520                     <font class="charliteral">'Z'</font>: begin <font class="comment">// File tail</font>
00521                          TokenKind := tokTail;
00522                          sContext := Result;
00523                          <font class="keywordflow">if</font> Result[3] = <font class="charliteral">'Z'</font> then
00524                              done;
00525                          end;
00526                     <font class="keywordflow">else</font>
00527                          TokenKind := TokControl;
00528 
00529                 end;
00530                 end
00531             <font class="keywordflow">else</font> <font class="keywordflow">if</font> isletter(TokenLine[TokenPos]) then
00532                 begin {Word}
00533                 fParagraphEnd := <font class="keyword">false</font>;
00534                 TokenKind := tokWord;
00535                 repeat
00536                     Result := Result + TokenLine[TokenPos];
00537                     inc(TokenPos);
00538                 until (TokenPos &gt; m) or (not isinword(TokenLine[TokenPos]));
00539                 inc(bWd);
00540                 inc(iTotalWords);
00541                 end
00542             <font class="keywordflow">else</font> <font class="keywordflow">if</font> ((TokenLine[TokenPos] = <font class="charliteral">' '</font>) or (TokenLine[TokenPos] = #9)) then
00543                 begin
00544                 fParagraphEnd := <font class="keyword">false</font>;
00545                 TokenKind := tokSpace;
00546                 Result := Result + TokenLine[TokenPos];
00547                 inc(TokenPos);
00548                 end
00549             <font class="keywordflow">else</font>
00550                 begin
00551                 fParagraphEnd := <font class="keyword">false</font>;
00552                 TokenKind := tokChar;
00553                 Result := Result + TokenLine[TokenPos];
00554                 inc(TokenPos);
00555                 end
00556             end;
00557         end;
00558     <font class="keywordflow">if</font> ((TokenKind = tokWord) or (TokenKind = tokSpace) or
00559        (TokenKind = tokChar)) then
00560         begin
00561         <font class="keywordflow">if</font> fInTitle then
00562             sTitle := sTitle + Result
00563         <font class="keywordflow">else</font> <font class="keywordflow">if</font> fInPsalmBookTitle then
00564             sPsalmBookTitle := sPsalmBookTitle + Result
00565         <font class="keywordflow">else</font> <font class="keywordflow">if</font> fInHebrewTitle then
00566             sHebrewTitle := sHebrewTitle + Result
00567         <font class="keywordflow">else</font> <font class="keywordflow">if</font> fInSectionTitle then
00568             sSectionTitle := sSectionTitle + Result;
00569         end;
00570 end;
00571 
00572 function TWriteGBF.Init(<font class="keyword">const</font> sFileName: string): boolean;
00573 begin
00574     <font class="keywordflow">try</font>
00575     bBk := 0;
00576     bChap := 0;
00577     bVs := 0;
00578     bWd := 0;
00579     LineOut := '';
00580     FName := sFileName;
00581     Assign(F, FName);
00582     filemode := 1;
00583     rewrite(F);
00584     fFileIsOpen := <font class="keyword">true</font>;
00585     Init := <font class="keyword">true</font>;
00586     except
00587     Init := <font class="keyword">false</font>;
00588     fFileIsOpen := <font class="keyword">false</font>;
00589     end
00590 end;
00591 
00592 function TWriteGBF.Done: <font class="keywordtype">boolean</font>;
00593 begin
00594     <font class="keywordflow">try</font>
00595     <font class="keywordflow">if</font> fFileIsOpen then
00596         begin
00597         <font class="keywordflow">if</font> LineOut &lt;&gt; '' then
00598             begin
00599             WriteLn(F, LineOut);
00600             LineOut := '';
00601             end;
00602         CloseFile(F);
00603         end;
00604     Done := <font class="keyword">true</font>;
00605     except
00606     Done := <font class="keyword">false</font>;
00607     end;
00608 end;
00609 
00610 procedure TWriteGBF.Out(<font class="keyword">const</font> s: string);
00611 var sPrint, sSave, sBook, sChapter, sVerse: string;
00612     i: integer;
00613     b: byte;
00614 begin
00615     <font class="keywordflow">if</font> (Length(s) &gt; 0) and IsLetter(s[1]) then
00616         begin
00617         inc(bWd);
00618         LineOut := LineOut + s;
00619         end
00620     <font class="keywordflow">else</font> <font class="keywordflow">if</font> Length(s) &gt; 3 then
00621         begin
00622         <font class="keywordflow">if</font> (s[1] = <font class="charliteral">'&lt;'</font>) and (s[2] = <font class="charliteral">'S'</font>) then
00623             begin
00624             <font class="keywordflow">case</font> s[3] of
00625                 <font class="charliteral">'B'</font>: begin <font class="comment">// Book</font>
00626                      sBook := system.copy(s, 4, length(s)-4);
00627                      <font class="keywordflow">if</font> sBook = '' then
00628                          begin
00629                          inc(bBk);
00630                          LineOut := LineOut + s;
00631                          end
00632                      <font class="keywordflow">else</font>
00633                          begin
00634                          b := bBk;
00635                          bBk := BookNameToNumber(sBook);
00636                          <font class="keywordflow">if</font> b &lt;&gt; bBk then
00637                              LineOut := LineOut + s;
00638                          end;
00639                      end;
00640                 <font class="charliteral">'C'</font>: begin <font class="comment">//chapter</font>
00641                      sChapter := system.copy(s, 4, length(s)-4);
00642                      <font class="keywordflow">if</font> sChapter = '' then
00643                          begin
00644                          inc(bChap);
00645                          LineOut := LineOut + s;
00646                          end
00647                      <font class="keywordflow">else</font>
00648                          begin
00649                          <font class="keywordflow">try</font>
00650 <font class="comment">//                       b := bChap;</font>
00651                          bChap := StrToInt(sChapter);
00652 <font class="comment">//                       if b &lt;&gt; bChap then</font>
00653                              LineOut := LineOut + s;
00654                          except
00655                          showmessage('Non-numeric chapter: '+sBook+<font class="charliteral">' '</font>+sChapter);
00656                          end;
00657                          end;
00658                      end;
00659                 <font class="charliteral">'V'</font>: begin <font class="comment">// Verse</font>
00660                      bWd := 0;
00661                      sVerse := system.copy(s, 4, length(s)-4);
00662                      <font class="keywordflow">if</font> sVerse = '' then
00663                          begin
00664                          inc(bVs);
00665                          LineOut := LineOut + s;
00666                          end
00667                      <font class="keywordflow">else</font>
00668                          begin
00669                          <font class="keywordflow">try</font>
00670 <font class="comment">//                       b := bVs;</font>
00671                          bVs := StrToInt(sVerse);
00672 <font class="comment">//                       if b &lt;&gt; bVs then</font>
00673                              LineOut := LineOut + s;
00674                          except
00675                          showmessage('Non-numeric verse: '+sBook+<font class="charliteral">' '</font>+sChapter+<font class="charliteral">':'</font>+sVerse);
00676                          end;
00677                          end;
00678                      end;
00679                 <font class="keywordflow">else</font>
00680                     LineOut := LineOut + s;
00681                 end
00682             end
00683         <font class="keywordflow">else</font>
00684             LineOut := LineOut + s; <font class="comment">// Not a sync mark</font>
00685         end
00686     <font class="keywordflow">else</font> <font class="comment">// other token, space, or punctuation</font>
00687         LineOut := LineOut + s; <font class="comment">// Length &lt;= 3</font>
00688     <font class="keywordflow">if</font> ((s = '&lt;CM&gt;') or (s = '&lt;CL&gt;')) then
00689         begin
00690         <font class="keywordflow">if</font> (Length(LineOut) &gt; 78) then
00691             begin
00692             i := 78;
00693             <font class="keywordflow">while</font> (i &gt; 0) and (LineOut[i] &lt;&gt; <font class="charliteral">' '</font>) <font class="keywordflow">do</font>
00694                 dec(i);
00695             <font class="keywordflow">if</font> i &lt; 1 then
00696                 begin
00697                 WriteLn(F,LineOut);
00698                 LineOut := '';
00699                 end
00700             <font class="keywordflow">else</font>
00701                 begin
00702                 sPrint := system.copy(LineOut,1,i-1);
00703                 sSave := system.copy(LineOut,i+1,Length(LineOut)-i);
00704                 WriteLn(F,sPrint);
00705                 WriteLn(F, sSave);
00706                 LineOut := '';
00707                 end
00708             end
00709         <font class="keywordflow">else</font>
00710             begin
00711             WriteLn(F, LineOut);
00712             LineOut := '';
00713             end
00714         end
00715     <font class="keywordflow">else</font> <font class="keywordflow">if</font> (Length(LineOut) &gt; 78) then
00716         begin
00717         i := 78;
00718         <font class="keywordflow">while</font> (i &gt; 0) and (LineOut[i] &lt;&gt; <font class="charliteral">' '</font>) <font class="keywordflow">do</font>
00719             dec(i);
00720         <font class="keywordflow">if</font> i &lt; 1 then
00721             begin
00722             WriteLn(F,LineOut);
00723             LineOut := '';
00724             end
00725         <font class="keywordflow">else</font>
00726             begin
00727             sPrint := system.copy(LineOut,1,i-1);
00728             sSave := system.copy(LineOut,i+1,Length(LineOut)-i);
00729             WriteLn(F,sPrint);
00730             LineOut := sSave;
00731             end
00732         end
00733 end;
00734 
00735 end.
</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>