ZealOS/docs/System/God/HolySpirit.ZC.html
2021-12-11 06:10:58 -05:00

215 lines
21 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.07">
<style type="text/css">
body {background-color:#1f1f1f;}
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
.cF1{color:#4f84a6;background-color:#1f1f1f;}
.cF2{color:#73a255;background-color:#1f1f1f;}
.cF3{color:#297582;background-color:#1f1f1f;}
.cF4{color:#b34f4b;background-color:#1f1f1f;}
.cF5{color:#8a52c3;background-color:#1f1f1f;}
.cF6{color:#b7822f;background-color:#1f1f1f;}
.cF7{color:#444444;background-color:#1f1f1f;}
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
.cF9{color:#94bfde;background-color:#1f1f1f;}
.cFA{color:#a1ce97;background-color:#1f1f1f;}
.cFB{color:#6db4be;background-color:#1f1f1f;}
.cFC{color:#e88e88;background-color:#1f1f1f;}
.cFD{color:#ca94e8;background-color:#1f1f1f;}
.cFE{color:#d4b475;background-color:#1f1f1f;}
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;God&quot;</span><span class=cF0>
<a name="l2"></a>
<a name="l3"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>TimeStampCB</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *, </span><span class=cF9>CDocEntry</span><span class=cF0> *, </span><span class=cF9>CTask</span><span class=cF0> *mem_task)
<a name="l4"></a>{
<a name="l5"></a> </span><span class=cF1>U8</span><span class=cF0> *st = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cFE>64</span><span class=cF0>, mem_task);
<a name="l6"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(st, </span><span class=cF6>&quot;%X&quot;</span><span class=cF0>, </span><span class=cF5>TSCGet</span><span class=cF0> &gt;&gt; </span><span class=cF3>GOD_BAD_BITS</span><span class=cF0>);
<a name="l7"></a> </span><span class=cF1>return</span><span class=cF0> st;
<a name="l8"></a>}
<a name="l9"></a>
<a name="l10"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>KbdMouseTimeCB</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *, </span><span class=cF9>CDocEntry</span><span class=cF0> *, </span><span class=cF9>CTask</span><span class=cF0> *mem_task)
<a name="l11"></a>{
<a name="l12"></a> </span><span class=cF1>U8</span><span class=cF0> *st = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cFE>64</span><span class=cF0>, mem_task);
<a name="l13"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(st, </span><span class=cF6>&quot;%X&quot;</span><span class=cF0>, </span><span class=cF5>KbdMouseEventTime</span><span class=cF0> &gt;&gt; </span><span class=cF3>GOD_BAD_BITS</span><span class=cF0>);
<a name="l14"></a> </span><span class=cF1>return</span><span class=cF0> st;
<a name="l15"></a>}
<a name="l16"></a>
<a name="l17"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>PopUpTimerOk</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *msg=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l18"></a>{
<a name="l19"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l20"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e;
<a name="l21"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc = </span><span class=cF5>DocNew</span><span class=cF0>;
<a name="l22"></a>
<a name="l23"></a> </span><span class=cF1>if</span><span class=cF0> (msg)
<a name="l24"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, msg);
<a name="l25"></a>
<a name="l26"></a> doc_e = </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;\nTimer: $TX+TC,\&quot; \&quot;$&quot;</span><span class=cF0>);
<a name="l27"></a> doc_e-&gt;tag_cb = &amp;</span><span class=cF5>TimeStampCB</span><span class=cF0>;
<a name="l28"></a>
<a name="l29"></a> doc_e = </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;\nLatch: $TX+TC,\&quot; \&quot;$&quot;</span><span class=cF0>);
<a name="l30"></a> doc_e-&gt;tag_cb = &amp;</span><span class=cF5>KbdMouseTimeCB</span><span class=cF0>;
<a name="l31"></a>
<a name="l32"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;$CM+CX,0,4$$BT,\&quot;OKAY\&quot;,LE=1$\n&quot;</span><span class=cF0>);
<a name="l33"></a> i = </span><span class=cF5>PopUpMenu</span><span class=cF0>(doc);
<a name="l34"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
<a name="l35"></a>
<a name="l36"></a> </span><span class=cF1>return</span><span class=cF0> i;
<a name="l37"></a>}
<a name="l38"></a>
<a name="l39"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>GodPick</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *message=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l40"></a>{
<a name="l41"></a> </span><span class=cF1>U8</span><span class=cF0> *st = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;%s\n\nPress $GREEN$OKAY$FG$ to generate a random number from the timer.\n&quot;</span><span class=cF0>
<a name="l42"></a> </span><span class=cF6>&quot;The latch is the last timestamp from the keyboard.\n&quot;</span><span class=cF0>
<a name="l43"></a> </span><span class=cF6>&quot;When you press $GREEN$OKAY$FG$, a new timestamp will be used.\n&quot;</span><span class=cF0>, message);
<a name="l44"></a> </span><span class=cF5>PopUpTimerOk</span><span class=cF0>(st);
<a name="l45"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l46"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>KbdMouseEventTime</span><span class=cF0> &gt;&gt; </span><span class=cF3>GOD_BAD_BITS</span><span class=cF0>;
<a name="l47"></a>}
<a name="l48"></a>
<a name="l49"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>GodBitsInsert</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> num_bits, </span><span class=cF9>I64</span><span class=cF0> bitfield)
<a name="l50"></a>{</span><span class=cF2>//Insert bits into God bit FIFO.</span><span class=cF0>
<a name="l51"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l52"></a>
<a name="l53"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; num_bits; i++)
<a name="l54"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l55"></a> </span><span class=cF5>FifoU8Insert</span><span class=cF0>(</span><span class=cFB>god</span><span class=cF0>.fifo, bitfield &amp; </span><span class=cFE>1</span><span class=cF0>);
<a name="l56"></a> bitfield &gt;&gt;= </span><span class=cFE>1</span><span class=cF0>;
<a name="l57"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l58"></a>}
<a name="l59"></a>
<a name="l60"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>GodHexInsert</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *st)
<a name="l61"></a>{</span><span class=cF2>//Insert hex record into God bit FIFO.</span><span class=cF0>
<a name="l62"></a> </span><span class=cF1>U8</span><span class=cF0> buf[</span><span class=cFE>2</span><span class=cF0>];
<a name="l63"></a> </span><span class=cF1>if</span><span class=cF0> (st)
<a name="l64"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l65"></a> buf[</span><span class=cFE>1</span><span class=cF0>] = </span><span class=cFE>0</span><span class=cF0>;
<a name="l66"></a> </span><span class=cF1>while</span><span class=cF0> (*buf = *st++)
<a name="l67"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>char_bmp_hex_numeric</span><span class=cF0>, *buf</span><span class=cF7>)</span><span class=cF0>)
<a name="l68"></a> </span><span class=cF5>GodBitsInsert</span><span class=cF0>(</span><span class=cFE>4</span><span class=cF0>, </span><span class=cFB>rev_bits_table</span><span class=cF0>[</span><span class=cF5>Str2I64</span><span class=cF7>(</span><span class=cF0>buf, </span><span class=cFE>16</span><span class=cF7>)</span><span class=cF0>] &gt;&gt; </span><span class=cFE>4</span><span class=cF0>);
<a name="l69"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l70"></a>}
<a name="l71"></a>
<a name="l72"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>GodBitsRemove</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> num_bits, </span><span class=cF1>U8</span><span class=cF0> *message=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l73"></a>{</span><span class=cF2>//Return N bits. If low on entropy pop-up okay.</span><span class=cF0>
<a name="l74"></a> </span><span class=cF1>U8</span><span class=cF0> b;
<a name="l75"></a> </span><span class=cF9>I64</span><span class=cF0> res = </span><span class=cFE>0</span><span class=cF0>;
<a name="l76"></a>
<a name="l77"></a> </span><span class=cF1>while</span><span class=cF0> (num_bits)
<a name="l78"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l79"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>FifoU8Remove</span><span class=cF7>(</span><span class=cFB>god</span><span class=cF0>.fifo, &amp;b</span><span class=cF7>)</span><span class=cF0>)
<a name="l80"></a> {
<a name="l81"></a> res = res &lt;&lt; </span><span class=cFE>1</span><span class=cF0> + b;
<a name="l82"></a> num_bits--;
<a name="l83"></a> }
<a name="l84"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l85"></a> </span><span class=cF5>GodBitsInsert</span><span class=cF0>(</span><span class=cF3>GOD_GOOD_BITS</span><span class=cF0>, </span><span class=cF5>GodPick</span><span class=cF7>(</span><span class=cF0>message</span><span class=cF7>)</span><span class=cF0>);
<a name="l86"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l87"></a>
<a name="l88"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l89"></a>}
<a name="l90"></a>
<a name="l91"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>GodInit</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *files_find_mask=</span><span class=cF6>&quot;/System/God/Vocab.DD&quot;</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> *fu_flags=</span><span class=cF3>NONE</span><span class=cF0>)
<a name="l92"></a>{</span><span class=cF2>//Read God's vocab file for picking words.</span><span class=cF0>
<a name="l93"></a> </span><span class=cF9>I64</span><span class=cF0> i, ch, fuf_flags = </span><span class=cFE>0</span><span class=cF0>;;
<a name="l94"></a> </span><span class=cF1>U8</span><span class=cF0> *buf, *ptr, *ptr2;
<a name="l95"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde, *tmpde1;
<a name="l96"></a>
<a name="l97"></a> </span><span class=cF5>FlagsScan</span><span class=cF0>(&amp;fuf_flags, </span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF6>&quot;ST_FILE_UTIL_FLAGS&quot;</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF6>&quot;+r+f+F+T+O&quot;</span><span class=cF0>);
<a name="l98"></a> </span><span class=cF5>FlagsScan</span><span class=cF0>(&amp;fuf_flags, </span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF6>&quot;ST_FILE_UTIL_FLAGS&quot;</span><span class=cF7>)</span><span class=cF0>, fu_flags);
<a name="l99"></a> </span><span class=cF1>if</span><span class=cF0> (fuf_flags &amp; ~</span><span class=cF3>FUG_FILES_FIND</span><span class=cF0>)
<a name="l100"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'FUF'</span><span class=cF0>);
<a name="l101"></a>
<a name="l102"></a> </span><span class=cF5>Free</span><span class=cF0>(</span><span class=cFB>god</span><span class=cF0>.word_file_mask);
<a name="l103"></a> </span><span class=cFB>god</span><span class=cF0>.word_file_mask = </span><span class=cF5>StrNew</span><span class=cF0>(files_find_mask);
<a name="l104"></a> </span><span class=cFB>god</span><span class=cF0>.word_fuf_flags = fuf_flags;
<a name="l105"></a>
<a name="l106"></a> tmpde = tmpde1 = </span><span class=cF5>FilesFind</span><span class=cF0>(files_find_mask, fuf_flags);
<a name="l107"></a>
<a name="l108"></a> i = </span><span class=cFE>0</span><span class=cF0>;
<a name="l109"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde)
<a name="l110"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l111"></a> </span><span class=cF1>if</span><span class=cF0> (buf = ptr = </span><span class=cF5>FileRead</span><span class=cF7>(</span><span class=cF0>tmpde-&gt;full_name</span><span class=cF7>)</span><span class=cF0>);
<a name="l112"></a> {
<a name="l113"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr)
<a name="l114"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l115"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr &amp;&amp; !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>char_bmp_word</span><span class=cF0>, *ptr</span><span class=cF7>)</span><span class=cF0>)
<a name="l116"></a> ptr++;
<a name="l117"></a> </span><span class=cF1>if</span><span class=cF0> (*ptr)
<a name="l118"></a> {
<a name="l119"></a> ptr2 = ptr;
<a name="l120"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr &amp;&amp; </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>char_bmp_word</span><span class=cF0>, *ptr</span><span class=cF7>)</span><span class=cF0>)
<a name="l121"></a> ptr++;
<a name="l122"></a> i++;
<a name="l123"></a> }
<a name="l124"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l125"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l126"></a> }
<a name="l127"></a> tmpde = tmpde-&gt;next;
<a name="l128"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l129"></a>
<a name="l130"></a> </span><span class=cF5>Free</span><span class=cF0>(</span><span class=cFB>god</span><span class=cF0>.words);
<a name="l131"></a> </span><span class=cFB>god</span><span class=cF0>.word_count = i;
<a name="l132"></a> </span><span class=cFB>god</span><span class=cF0>.words = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0> * i);
<a name="l133"></a>
<a name="l134"></a> tmpde = tmpde1;
<a name="l135"></a> i = </span><span class=cFE>0</span><span class=cF0>;
<a name="l136"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde)
<a name="l137"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l138"></a> </span><span class=cF1>if</span><span class=cF0> (buf = ptr = </span><span class=cF5>FileRead</span><span class=cF7>(</span><span class=cF0>tmpde-&gt;full_name</span><span class=cF7>)</span><span class=cF0>)
<a name="l139"></a> {
<a name="l140"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr)
<a name="l141"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l142"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr &amp;&amp; !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>char_bmp_word</span><span class=cF0>, *ptr</span><span class=cF7>)</span><span class=cF0>)
<a name="l143"></a> ptr++;
<a name="l144"></a> </span><span class=cF1>if</span><span class=cF0> (*ptr)
<a name="l145"></a> {
<a name="l146"></a> ptr2 = ptr;
<a name="l147"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr &amp;&amp; </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>char_bmp_word</span><span class=cF0>, *ptr</span><span class=cF7>)</span><span class=cF0>)
<a name="l148"></a> ptr++;
<a name="l149"></a> ch = *ptr;
<a name="l150"></a> *ptr = </span><span class=cF6>'\0'</span><span class=cF0>;
<a name="l151"></a> </span><span class=cFB>god</span><span class=cF0>.words[i++] = </span><span class=cF5>StrNew</span><span class=cF0>(ptr2);
<a name="l152"></a> *ptr = ch;
<a name="l153"></a> }
<a name="l154"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l155"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l156"></a> }
<a name="l157"></a> tmpde = tmpde-&gt;next;
<a name="l158"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l159"></a> </span><span class=cF5>DirTreeDel</span><span class=cF0>(tmpde1);
<a name="l160"></a>
<a name="l161"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFB>god</span><span class=cF0>.word_count;
<a name="l162"></a>}
<a name="l163"></a></span><span class=cF5>GodInit</span><span class=cF0>;
<a name="l164"></a>
<a name="l165"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>GodWordStr</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> bits=</span><span class=cFE>17</span><span class=cF0>)
<a name="l166"></a>{</span><span class=cF2>//Make God pick a word.</span><span class=cF0>
<a name="l167"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>god</span><span class=cF0>.word_count)
<a name="l168"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFB>god</span><span class=cF0>.words[</span><span class=cF5>GodBitsRemove</span><span class=cF0>(bits) % </span><span class=cFB>god</span><span class=cF0>.word_count];
<a name="l169"></a>
<a name="l170"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l171"></a>}
<a name="l172"></a>
<a name="l173"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>GodWord</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> bits=</span><span class=cFE>17</span><span class=cF0>)
<a name="l174"></a>{</span><span class=cF2>//Make God pick a word.</span><span class=cF0>
<a name="l175"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>god</span><span class=cF0>.word_count)
<a name="l176"></a> </span><span class=cF6>&quot;%s &quot;</span><span class=cF0>, </span><span class=cFB>god</span><span class=cF0>.words[</span><span class=cF5>GodBitsRemove</span><span class=cF0>(bits) % </span><span class=cFB>god</span><span class=cF0>.word_count];
<a name="l177"></a>}
<a name="l178"></a>
<a name="l179"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>GodBiblePassage</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> num_lines=</span><span class=cFE>20</span><span class=cF0>)
<a name="l180"></a>{</span><span class=cF2>//Make God pick a Bible passage.</span><span class=cF0>
<a name="l181"></a> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF1>start</span><span class=cF0> = </span><span class=cF5>GodBitsRemove</span><span class=cF0>(</span><span class=cFE>21</span><span class=cF0>) % (</span><span class=cF3>ST_BIBLE_LINES</span><span class=cF0> - </span><span class=cF7>(</span><span class=cF0>num_lines - </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>) + </span><span class=cFE>1</span><span class=cF0>;
<a name="l182"></a> </span><span class=cF1>U8</span><span class=cF0> *verse = </span><span class=cF5>BibleLine2Verse</span><span class=cF0>(</span><span class=cF1>start</span><span class=cF0>);
<a name="l183"></a> </span><span class=cF6>&quot;%s\n\n&quot;</span><span class=cF0>, verse;
<a name="l184"></a> </span><span class=cF5>Free</span><span class=cF0>(verse);
<a name="l185"></a> </span><span class=cF5>BookLines</span><span class=cF0>(, </span><span class=cF1>start</span><span class=cF0>, num_lines);
<a name="l186"></a>}
</span></pre></body>
</html>