aboutsummaryrefslogtreecommitdiffstats
path: root/doc/api-documentation/html/rawfilesgen_8cpp-source.html
diff options
context:
space:
mode:
authordanglassey <danglassey>2002-08-14 09:57:17 +0000
committerdanglassey <danglassey>2002-08-14 09:57:17 +0000
commitc9458897ebbb739d8db83c80e06512d8a612f743 (patch)
treef8c5381045887e34388cc6b26cfccc254bf766dc /doc/api-documentation/html/rawfilesgen_8cpp-source.html
downloadsword-sf-cvs-c9458897ebbb739d8db83c80e06512d8a612f743.tar.gz
*** empty log message ***
Diffstat (limited to 'doc/api-documentation/html/rawfilesgen_8cpp-source.html')
-rw-r--r--doc/api-documentation/html/rawfilesgen_8cpp-source.html250
1 files changed, 250 insertions, 0 deletions
diff --git a/doc/api-documentation/html/rawfilesgen_8cpp-source.html b/doc/api-documentation/html/rawfilesgen_8cpp-source.html
new file mode 100644
index 0000000..85badac
--- /dev/null
+++ b/doc/api-documentation/html/rawfilesgen_8cpp-source.html
@@ -0,0 +1,250 @@
+<!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>rawfilesgen.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>rawfilesgen.cpp</h1><div class="fragment"><pre>00001 <font class="comment">/*****************************************************************************</font>
+00002 <font class="comment"> *</font>
+00003 <font class="comment"> */</font>
+00004
+00005 <font class="preprocessor">#include &lt;stdio.h&gt;</font>
+00006 <font class="preprocessor">#include &lt;stdlib.h&gt;</font>
+00007 <font class="preprocessor">#include &lt;string.h&gt;</font>
+00008 <font class="preprocessor">#include &lt;ctype.h&gt;</font>
+00009
+00010 <font class="preprocessor">#ifndef __GNUC__</font>
+00011 <font class="preprocessor"></font><font class="preprocessor">#include &lt;io.h&gt;</font>
+00012 <font class="preprocessor">#else</font>
+00013 <font class="preprocessor"></font><font class="preprocessor">#include &lt;unistd.h&gt;</font>
+00014 <font class="preprocessor">#endif</font>
+00015 <font class="preprocessor"></font>
+00016 <font class="preprocessor">#include &lt;fcntl.h&gt;</font>
+00017 <font class="preprocessor">#include &lt;versekey.h&gt;</font>
+00018
+00019 <font class="preprocessor">#ifndef O_BINARY</font>
+00020 <font class="preprocessor"></font><font class="preprocessor"> #define O_BINARY 0</font>
+00021 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
+00022 <font class="preprocessor"></font>
+00023 <font class="keywordtype">void</font> writeidx(<a class="code" href="class_verse_key.html">VerseKey</a> &amp;key1, <a class="code" href="class_verse_key.html">VerseKey</a> &amp;key2, <a class="code" href="class_verse_key.html">VerseKey</a> &amp;key3, <font class="keywordtype">long</font> offset, <font class="keywordtype">short</font> size);
+00024 <font class="keywordtype">char</font> findbreak(<font class="keywordtype">int</font> fp, <font class="keywordtype">long</font> *offset, <font class="keywordtype">int</font> *num1, <font class="keywordtype">int</font> *num2, <font class="keywordtype">int</font> *rangemax, <font class="keywordtype">short</font> *size);
+00025 <font class="keywordtype">void</font> openfiles();
+00026 <font class="keywordtype">void</font> checkparams(<font class="keywordtype">int</font> argc, <font class="keywordtype">char</font> **argv);
+00027 <font class="keywordtype">void</font> charsetconvert(<font class="keywordtype">char</font> *data);
+00028
+00029
+00030 <a class="code" href="class_verse_key.html">VerseKey</a> key1, key2, key3;
+00031 <font class="keywordtype">int</font> fp, vfp, cfp, bfp;
+00032 <font class="keywordtype">long</font> chapoffset;
+00033 <font class="keywordtype">short</font> chapsize;
+00034 <font class="keywordtype">char</font> testmnt;
+00035 <font class="keywordtype">char</font> startflag = 0;
+00036
+00037
+00038 main(<font class="keywordtype">int</font> argc, <font class="keywordtype">char</font> **argv)
+00039 {
+00040 <font class="keywordtype">long</font> pos, offset;
+00041 <font class="keywordtype">int</font> num1, num2, rangemax, curbook = 0, curchap = 0, curverse = 0;
+00042 <font class="keywordtype">char</font> buf[127];
+00043 <font class="keywordtype">short</font> size, tmp;
+00044 <font class="keyword">extern</font> <font class="keyword">struct </font>zonline online;
+00045
+00046 checkparams(argc, argv);
+00047
+00048 key1 = key2 = key3 = <font class="stringliteral">"Genesis 1:1"</font>;
+00049
+00050 openfiles();
+00051
+00052 num1 = key1.<a class="code" href="class_verse_key.html#a24">Chapter</a>();
+00053 num2 = key1.<a class="code" href="class_verse_key.html#a25">Verse</a>();
+00054
+00055 <font class="keywordflow">while</font>(!findbreak(fp, &amp;offset, &amp;num1, &amp;num2, &amp;rangemax, &amp;size)) {
+00056 <font class="keywordflow">if</font> (!startflag) {
+00057 startflag = 1;
+00058 }
+00059 <font class="keywordflow">else</font> {
+00060 <font class="keywordflow">if</font> (num2 &lt; key2.<a class="code" href="class_verse_key.html#a25">Verse</a>()) { <font class="comment">// new chapter</font>
+00061 <font class="keywordflow">if</font> (num1 &lt;= key2.<a class="code" href="class_verse_key.html#a24">Chapter</a>()) { <font class="comment">// new book</font>
+00062 key2.<a class="code" href="class_verse_key.html#a25">Verse</a>(1);
+00063 key2.<a class="code" href="class_verse_key.html#a24">Chapter</a>(1);
+00064 key2.<a class="code" href="class_verse_key.html#a23">Book</a>(key2.<a class="code" href="class_verse_key.html#a23">Book</a>()+1);
+00065 }
+00066 printf(<font class="stringliteral">"Created Empty Entry: %d ('%s')\n"</font>, num1, (<font class="keyword">const</font> <font class="keywordtype">char</font> *)key2);
+00067 chapoffset = offset;
+00068 chapsize = size;
+00069 <font class="comment">// continue;</font>
+00070 }
+00071 }
+00072 key2.<a class="code" href="class_verse_key.html#a25">Verse</a>(1);
+00073 key2.<a class="code" href="class_verse_key.html#a24">Chapter</a>(num1);
+00074 key2.<a class="code" href="class_verse_key.html#a25">Verse</a>(num2);
+00075
+00076 key3 = key2;
+00077 <font class="comment">// key3 += (rangemax - key3.Verse());</font>
+00078
+00079 writeidx(key1, key2, key3, offset, size);
+00080 }
+00081 close(vfp);
+00082 close(cfp);
+00083 close(bfp);
+00084 close(fp);
+00085 }
+00086
+00087
+00088 <font class="comment">/**************************************************************************</font>
+00089 <font class="comment"> * ENT: key1 - current location of index</font>
+00090 <font class="comment"> * key2 - minimum keyval for which this offset is valid</font>
+00091 <font class="comment"> * key3 - maximum keyval for which this offset is valid</font>
+00092 <font class="comment"> */</font>
+00093
+00094 <font class="keywordtype">void</font> writeidx(<a class="code" href="class_verse_key.html">VerseKey</a> &amp;key1, <a class="code" href="class_verse_key.html">VerseKey</a> &amp;key2, <a class="code" href="class_verse_key.html">VerseKey</a> &amp;key3, <font class="keywordtype">long</font> offset, <font class="keywordtype">short</font> size)
+00095 {
+00096 <font class="keywordtype">long</font> pos;
+00097 <font class="keywordtype">short</font> tmp;
+00098
+00099 <font class="keywordflow">if</font> (key1.<a class="code" href="class_verse_key.html#a25">Verse</a>() == 1) { <font class="comment">// new chapter</font>
+00100 <font class="keywordflow">if</font> (key1.<a class="code" href="class_verse_key.html#a24">Chapter</a>() == 1) { <font class="comment">// new book</font>
+00101 pos = lseek(cfp, 0, SEEK_CUR);
+00102 write(bfp, &amp;pos, 4);
+00103 pos = lseek(vfp, 0, SEEK_CUR); <font class="comment">/* Book intro (cps) */</font>
+00104 write(cfp, &amp;pos, 4);
+00105 write(vfp, &amp;chapoffset, 4); <font class="comment">/* Book intro (vss) set to same as chap for now(it should be chap 1 which usually contains the book into anyway)*/</font>
+00106 write(vfp, &amp;chapsize, 2);
+00107 }
+00108 pos = lseek(vfp, 0, SEEK_CUR);
+00109 write(cfp, &amp;pos, 4);
+00110 write(vfp, &amp;chapoffset, 4); <font class="comment">/* Chapter intro */</font>
+00111 write(vfp, &amp;chapsize, 2);
+00112 }
+00113 <font class="keywordflow">if</font> (key1 &gt;= key2) {
+00114 write(vfp, &amp;offset, 4);
+00115 size = 0;
+00116 write(vfp, &amp;size, 2);
+00117 }
+00118 <font class="keywordflow">else</font> {
+00119 pos = 0;
+00120 tmp = 0;
+00121 write(vfp, &amp;pos, 4);
+00122 write(vfp, &amp;tmp, 2);
+00123 }
+00124 key1++;
+00125 }
+00126
+00127
+00128 <font class="keyword">static</font> <a class="code" href="class_verse_key.html">VerseKey</a> inckey = <font class="stringliteral">"Genesis 1:1"</font>;
+00129
+00130 <font class="keywordtype">char</font> findbreak(<font class="keywordtype">int</font> fp, <font class="keywordtype">long</font> *offset, <font class="keywordtype">int</font> *num1, <font class="keywordtype">int</font> *num2, <font class="keywordtype">int</font> *rangemax, <font class="keywordtype">short</font> *size)
+00131 {
+00132 <font class="keywordtype">char</font> buf[7];
+00133 <font class="keywordtype">char</font> buf2[20];
+00134 <font class="keywordtype">char</font> ch;
+00135 <font class="keywordtype">char</font> loop;
+00136 <font class="keywordtype">long</font> offset2;
+00137 <font class="keywordtype">int</font> ch2, vs2, rm2;
+00138 <font class="keywordtype">bool</font> flag;
+00139 <font class="keywordtype">long</font> chapstart = 0;
+00140 <font class="keyword">static</font> <font class="keywordtype">int</font> olbvnum = 0;
+00141 <font class="keywordtype">char</font> data[16];
+00142
+00143 memset (data,0,16);
+00144
+00145 <font class="keywordflow">if</font> (++olbvnum &lt;= 31102) {
+00146
+00147 <font class="keywordflow">if</font> (olbvnum == 23146) { <font class="comment">// "Matthew 1:1" </font>
+00148 close(vfp);
+00149 close(cfp);
+00150 close(bfp);
+00151 close(fp);
+00152 key1 = key2 = key3 = inckey = <font class="stringliteral">"Matthew 1:1"</font>;
+00153 openfiles();
+00154 startflag = 0;
+00155 }
+00156
+00157
+00158 *offset = lseek(fp, 0, SEEK_CUR);
+00159
+00160 <font class="keywordflow">if</font> ((olbvnum!=1) &amp;&amp; (olbvnum != 23146))
+00161 inckey++;
+00162
+00163 *num1 = inckey.<a class="code" href="class_verse_key.html#a24">Chapter</a>();
+00164 *num2 = inckey.<a class="code" href="class_verse_key.html#a25">Verse</a>();
+00165
+00166
+00167 write(fp, data, 16);
+00168
+00169 *size = lseek(fp, 0, SEEK_CUR) - *offset;
+00170 <font class="keywordflow">return</font> 0;
+00171 }
+00172 <font class="keywordflow">return</font> 1;
+00173 }
+00174
+00175
+00176 <font class="keywordtype">void</font> openfiles()
+00177 {
+00178 <font class="keywordtype">char</font> buf[255];
+00179 <font class="keywordtype">char</font> fname[5];
+00180 <font class="keywordtype">long</font> pos;
+00181 <font class="keywordtype">short</font> size;
+00182
+00183 testmnt = key1.<a class="code" href="class_verse_key.html#a22">Testament</a>();
+00184
+00185 strcpy(fname, (testmnt==2) ? <font class="stringliteral">"nt"</font> : <font class="stringliteral">"ot"</font>);
+00186 unlink(fname);
+00187 <font class="keywordflow">if</font> ((fp = open(fname, O_CREAT|O_RDWR|O_BINARY)) == -1) {
+00188 fprintf(stderr, <font class="stringliteral">"Couldn't open file: %s\n"</font>, fname);
+00189 exit(1);
+00190 }
+00191
+00192 sprintf(buf, <font class="stringliteral">"%s.vss"</font>, fname);
+00193 unlink(buf);
+00194 <font class="keywordflow">if</font> ((vfp = open(buf, O_CREAT|O_WRONLY|O_BINARY)) == -1) {
+00195 fprintf(stderr, <font class="stringliteral">"Couldn't open file: %s\n"</font>, buf);
+00196 exit(1);
+00197 }
+00198
+00199 sprintf(buf, <font class="stringliteral">"%s.cps"</font>, fname);
+00200 unlink(buf);
+00201 <font class="keywordflow">if</font> ((cfp = open(buf, O_CREAT|O_WRONLY|O_BINARY)) == -1) {
+00202 fprintf(stderr, <font class="stringliteral">"Couldn't open file: %s\n"</font>, buf);
+00203 exit(1);
+00204 }
+00205
+00206 sprintf(buf, <font class="stringliteral">"%s.bks"</font>, fname);
+00207 unlink(buf);
+00208 <font class="keywordflow">if</font> ((bfp = open(buf, O_CREAT|O_WRONLY|O_BINARY)) == -1) {
+00209 fprintf(stderr, <font class="stringliteral">"Couldn't open file: %s\n"</font>, buf);
+00210 exit(1);
+00211 }
+00212
+00213 pos = 0;
+00214 write(bfp, &amp;pos, 4); <font class="comment">/* Book offset for testament intros */</font>
+00215 pos = 4;
+00216 write(cfp, &amp;pos, 4); <font class="comment">/* Chapter offset for testament intro */</font>
+00217
+00218
+00219 <font class="comment">/* Right now just zero out intros until parsing correctly */</font>
+00220 pos = 0;
+00221 size = 0;
+00222 write(vfp, &amp;pos, 4); <font class="comment">/* Module intro */</font>
+00223 write(vfp, &amp;size, 2);
+00224 write(vfp, &amp;pos, 4); <font class="comment">/* Testament intro */</font>
+00225 write(vfp, &amp;size, 2);
+00226
+00227 }
+00228
+00229
+00230 <font class="keywordtype">void</font> checkparams(<font class="keywordtype">int</font> argc, <font class="keywordtype">char</font> **argv)
+00231 {
+00232 <font class="keywordflow">if</font> (argc !=1) {
+00233 fprintf(stderr, <font class="stringliteral">"usage: %s\n"</font>, argv[0]);
+00234 exit(1);
+00235 }
+00236 }
+</pre></div><hr><address align="right"><small>Generated on Thu Jun 20 22:13:00 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>