diff options
Diffstat (limited to 'doc/api-documentation/html/vntidx_8cpp-source.html')
-rw-r--r-- | doc/api-documentation/html/vntidx_8cpp-source.html | 199 |
1 files changed, 199 insertions, 0 deletions
diff --git a/doc/api-documentation/html/vntidx_8cpp-source.html b/doc/api-documentation/html/vntidx_8cpp-source.html new file mode 100644 index 0000000..8813465 --- /dev/null +++ b/doc/api-documentation/html/vntidx_8cpp-source.html @@ -0,0 +1,199 @@ +<!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>vntidx.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>vntidx.cpp</h1><div class="fragment"><pre>00001 <font class="preprocessor">#include <stdio.h></font> +00002 <font class="preprocessor">#include <fcntl.h></font> +00003 <font class="preprocessor">#include <versekey.h></font> +00004 +00005 +00006 <font class="keywordtype">char</font> findbreak(<font class="keywordtype">int</font> fp, <font class="keywordtype">int</font> *offset, <font class="keywordtype">int</font> *num1, <font class="keywordtype">int</font> *num2, <font class="keywordtype">short</font> *size); +00007 +00008 +00009 main(<font class="keywordtype">int</font> argc, <font class="keywordtype">char</font> **argv) +00010 { +00011 <font class="keywordtype">int</font> fp, vfp, cfp, bfp; +00012 <font class="keywordtype">long</font> pos; +00013 <font class="keywordtype">short</font> size, tmp; +00014 <font class="keywordtype">int</font> num1, num2, offset, curbook = 0, curchap = 0, curverse = 0; +00015 <font class="keywordtype">char</font> buf[127]; +00016 <a class="code" href="class_verse_key.html">VerseKey</a> mykey; +00017 +00018 <font class="keywordflow">if</font> ((argc < 2) || (argc > 3)) { +00019 fprintf(stderr, <font class="stringliteral">"usage: %s <file to process> [nt]\n"</font>, argv[0]); +00020 exit(1); +00021 } +00022 +00023 <font class="keywordflow">if</font> ((fp = open(argv[1], O_RDONLY)) == -1) { +00024 fprintf(stderr, <font class="stringliteral">"Couldn't open file: %s\n"</font>, argv[1]); +00025 exit(1); +00026 } +00027 +00028 sprintf(buf, <font class="stringliteral">"%s.vss"</font>, argv[1]); +00029 <font class="keywordflow">if</font> ((vfp = open(buf, O_CREAT|O_WRONLY)) == -1) { +00030 fprintf(stderr, <font class="stringliteral">"Couldn't open file: %s\n"</font>, buf); +00031 exit(1); +00032 } +00033 +00034 sprintf(buf, <font class="stringliteral">"%s.cps"</font>, argv[1]); +00035 <font class="keywordflow">if</font> ((cfp = open(buf, O_CREAT|O_WRONLY)) == -1) { +00036 fprintf(stderr, <font class="stringliteral">"Couldn't open file: %s\n"</font>, buf); +00037 exit(1); +00038 } +00039 +00040 sprintf(buf, <font class="stringliteral">"%s.bks"</font>, argv[1]); +00041 <font class="keywordflow">if</font> ((bfp = open(buf, O_CREAT|O_WRONLY)) == -1) { +00042 fprintf(stderr, <font class="stringliteral">"Couldn't open file: %s\n"</font>, buf); +00043 exit(1); +00044 } +00045 +00046 pos = 0; +00047 write(bfp, &pos, 4); <font class="comment">/* Book offset for testament intros */</font> +00048 pos = 4; +00049 write(cfp, &pos, 4); <font class="comment">/* Chapter offset for testament intro */</font> +00050 +00051 +00052 <font class="comment">/* Right now just zero out intros until parsing correctly */</font> +00053 pos = 0; +00054 size = 0; +00055 write(vfp, &pos, 4); <font class="comment">/* Module intro */</font> +00056 write(vfp, &size, 2); +00057 write(vfp, &pos, 4); <font class="comment">/* Testament intro */</font> +00058 write(vfp, &size, 2); +00059 +00060 mykey = (argc == 3) ? <font class="stringliteral">"Matthew 1:1"</font> : <font class="stringliteral">"Genesis 1:1"</font>; +00061 +00062 <font class="keywordflow">while</font> (!findbreak(fp, &offset, &num1, &num2, &size)) { +00063 num1 = mykey.<a class="code" href="class_verse_key.html#a24">Chapter</a>(); +00064 num2 = mykey.<a class="code" href="class_verse_key.html#a25">Verse</a>(); +00065 <font class="keywordflow">if</font> (num2 == 1) { <font class="comment">/* if we're at a new chapter */</font> +00066 <font class="keywordflow">if</font> (num1 == 1) { <font class="comment">/* if we're at a new book */</font> +00067 pos = lseek(cfp, 0, SEEK_CUR); +00068 write(bfp, &pos, 4); +00069 pos = lseek(vfp, 0, SEEK_CUR); <font class="comment">/* Book intro (cps) */</font> +00070 write(cfp, &pos, 4); +00071 pos = 0; +00072 tmp = 0; +00073 write(vfp, &pos, 4); <font class="comment">/* Book intro (vss) */</font> +00074 write(vfp, &tmp, 2); +00075 curbook++; +00076 curchap = 0; +00077 } +00078 pos = lseek(vfp, 0, SEEK_CUR); +00079 write(cfp, &pos, 4); +00080 curverse = 1; +00081 pos = 0; +00082 tmp = 0; +00083 write(vfp, &pos, 4); <font class="comment">/* Chapter intro */</font> +00084 write(vfp, &tmp, 2); +00085 curchap++; +00086 } +00087 <font class="keywordflow">else</font> curverse++; +00088 +00089 printf(<font class="stringliteral">"%2d:%3d:%3d found at offset: %7d\n"</font>, curbook, num1, num2, offset); +00090 +00091 <font class="keywordflow">if</font> (num1 != curchap) { +00092 fprintf(stderr, <font class="stringliteral">"Error: Found chaptures out of sequence\n"</font>); +00093 <font class="keywordflow">break</font>; +00094 } +00095 <font class="keywordflow">if</font> (num2 != curverse) { +00096 fprintf(stderr, <font class="stringliteral">"Error: Found verses out of sequence\n"</font>); +00097 <font class="keywordflow">break</font>; +00098 } +00099 write(vfp, &offset, 4); +00100 write(vfp, &size, 2); +00101 mykey++; +00102 } +00103 +00104 close(vfp); +00105 close(cfp); +00106 close(bfp); +00107 close(fp); +00108 } +00109 +00110 +00111 <font class="keywordtype">char</font> findbreak(<font class="keywordtype">int</font> fp, <font class="keywordtype">int</font> *offset, <font class="keywordtype">int</font> *num1, <font class="keywordtype">int</font> *num2, <font class="keywordtype">short</font> *size) +00112 { +00113 <font class="keywordtype">char</font> buf[17]; +00114 <font class="keywordtype">char</font> buf2[7]; +00115 <font class="keywordtype">char</font> buf3[7]; +00116 <font class="keywordtype">char</font> loop; +00117 <font class="keywordtype">char</font> offadj, inquotes, sizeadj; +00118 <font class="keywordtype">int</font> offset2, ch2, vs2; +00119 +00120 strcpy (buf3, <font class="stringliteral">"\\par "</font>); +00121 buf3[5] = 10; +00122 memset(buf, <font class="charliteral">' '</font>, 17); +00123 +00124 <font class="keywordflow">while</font> (1) { +00125 offadj = -100; +00126 inquotes = 0; +00127 sizeadj = 0; +00128 <font class="keywordflow">if</font> (!memcmp(buf, <font class="stringliteral">"\\par FIN DEL NUEVO TESTAMENTO"</font>, 16)) { +00129 offadj = -11; +00130 <font class="comment">// inquotes = 1;</font> +00131 sizeadj = -7; +00132 } +00133 +00134 <font class="keywordflow">if</font> ((!memcmp(buf, buf3, 6)) && (!size)) { +00135 offadj = -11; +00136 <font class="comment">// inquotes = 1;</font> +00137 sizeadj = -7; +00138 } +00139 <font class="keywordflow">if</font> (!memcmp(buf, <font class="stringliteral">"\\par "</font>, 6)) { +00140 <font class="keywordflow">if</font> (isdigit(buf[6])) { +00141 <font class="keywordflow">for</font> (loop = 7; loop < 10; loop++) { +00142 <font class="keywordflow">if</font> (!isdigit(buf[loop])) +00143 <font class="keywordflow">break</font>; +00144 } +00145 offadj = -(11 - (loop - 6)); +00146 <font class="comment">// inquotes = 1;</font> +00147 sizeadj = -7; +00148 } +00149 } +00150 <font class="comment">/*</font> +00151 <font class="comment"> if (!memcmp(buf, "\\fi200\\widctlpar", 16)) {</font> +00152 <font class="comment"> offadj = -1;</font> +00153 <font class="comment">// inquotes = 1;</font> +00154 <font class="comment"> sizeadj = -18;</font> +00155 <font class="comment"> }</font> +00156 <font class="comment">*/</font> +00157 <font class="keywordflow">if</font> (offadj > -100) { +00158 *offset = lseek(fp, 0, SEEK_CUR) + offadj; +00159 <font class="keywordflow">if</font> (size) { +00160 (*offset)++; +00161 <font class="keywordflow">while</font> (inquotes) { +00162 <font class="keywordflow">while</font> (read(fp, buf2, 1) == 1) { +00163 <font class="keywordflow">if</font> (*buf2 == <font class="charliteral">'}'</font>) +00164 <font class="keywordflow">break</font>; +00165 (*offset)++; +00166 } +00167 inquotes--; +00168 } +00169 <font class="keywordflow">if</font> (findbreak(fp, &offset2, &ch2, &vs2, 0)) { +00170 *size = (short) (lseek(fp, 0, SEEK_END) - (*offset)); +00171 } +00172 <font class="keywordflow">else</font> { +00173 *size = (offset2 - (*offset)); +00174 } +00175 lseek(fp, *offset-sizeadj, SEEK_SET); +00176 } +00177 <font class="keywordflow">else</font> (*offset) += sizeadj; +00178 <font class="keywordflow">return</font> 0; +00179 } +00180 memmove(buf, &buf[1], 16); +00181 <font class="keywordflow">if</font> (read(fp, &buf[16], 1) != 1) +00182 <font class="keywordflow">return</font> 1; +00183 } +00184 } +00185 +</pre></div><hr><address align="right"><small>Generated on Thu Jun 20 22:13:01 2002 for The Sword Project by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 +width=110 height=53></a>1.2.15 </small></address> +</body> +</html> |