templeos-info/public/Wb/Home/Src/Adam/Training.HC.HTML

216 lines
23 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="generator" content="TempleOS V5.03">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/style/templeos.css">
<script src="/script/templeos.js"></script>
<style type="text/css">
.cF0{color:#000000;background-color:#ffffff;}
.cF1{color:#0000aa;background-color:#ffffff;}
.cF2{color:#00aa00;background-color:#ffffff;}
.cF3{color:#00aaaa;background-color:#ffffff;}
.cF4{color:#aa0000;background-color:#ffffff;}
.cF5{color:#aa00aa;background-color:#ffffff;}
.cF6{color:#aa5500;background-color:#ffffff;}
.cF7{color:#aaaaaa;background-color:#ffffff;}
.cF8{color:#555555;background-color:#ffffff;}
.cF9{color:#5555ff;background-color:#ffffff;}
.cFA{color:#55ff55;background-color:#ffffff;}
.cFB{color:#55ffff;background-color:#ffffff;}
.cFC{color:#ff5555;background-color:#ffffff;}
.cFD{color:#ff55ff;background-color:#ffffff;}
.cFE{color:#ffff55;background-color:#ffffff;}
.cFF{color:#ffffff;background-color:#ffffff;}
</style>
</head>
<body>
<pre id="content">
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Help System&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>KeyMapKeyMStrPrint</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> sc,</span><span class=cF1>U0</span><span class=cF0> </span><span class=cF7>(</span><span class=cF0>*fp_hndlr</span><span class=cF7>)(</span><span class=cF9>I64</span><span class=cF0> sc</span><span class=cF7>)</span><span class=cF0>,
<a name="l4"></a> </span><span class=cF1>U8</span><span class=cF0> *desc,</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l5"></a>{
<a name="l6"></a> </span><span class=cF9>I64</span><span class=cF0> i=9,k,c;
<a name="l7"></a> </span><span class=cF1>U8</span><span class=cF0> *st,*st2,*res,*ptr;
<a name="l8"></a> </span><span class=cF9>CHashTable</span><span class=cF0> *old_hash=</span><span class=cF5>Fs</span><span class=cF0>-&gt;hash_table;
<a name="l9"></a> st=</span><span class=cF5>ScanCode2KeyName</span><span class=cF0>(sc);
<a name="l10"></a> </span><span class=cF1>if</span><span class=cF0> (sc&amp;</span><span class=cF3>SCF_CTRL</span><span class=cF0>) i+=5;
<a name="l11"></a> </span><span class=cF1>if</span><span class=cF0> (sc&amp;</span><span class=cF3>SCF_ALT</span><span class=cF0>) i+=4;
<a name="l12"></a> </span><span class=cF1>if</span><span class=cF0> (sc&amp;</span><span class=cF7>(</span><span class=cF3>SCF_SHIFT</span><span class=cF0>|</span><span class=cF3>SCF_NO_SHIFT</span><span class=cF7>)</span><span class=cF0>) i+=6;
<a name="l13"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0>)
<a name="l14"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;hash_table=task-&gt;hash_table;
<a name="l15"></a> st2=</span><span class=cF5>SrcEdLink</span><span class=cF0>(fp_hndlr,256);
<a name="l16"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;hash_table=old_hash;
<a name="l17"></a>
<a name="l18"></a> k=*desc(</span><span class=cF9>U32</span><span class=cF0> *);
<a name="l19"></a> </span><span class=cF1>if</span><span class=cF0> (k==</span><span class=cF6>'Edit'</span><span class=cF0>) c=</span><span class=cF3>BLUE</span><span class=cF0>;
<a name="l20"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (k==</span><span class=cF6>'Dol '</span><span class=cF0>) c=</span><span class=cF3>GREEN</span><span class=cF0>;
<a name="l21"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (k==</span><span class=cF6>'Cmd '</span><span class=cF0>) c=</span><span class=cF3>RED</span><span class=cF0>;
<a name="l22"></a> </span><span class=cF1>else</span><span class=cF0> c=</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l23"></a>
<a name="l24"></a> res=</span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;%-*s $FG,%d$$TX+UL+L+PU,\&quot;%$Q\&quot;,A=\&quot;%s\&quot;$$FG$\n&quot;</span><span class=cF0>,
<a name="l25"></a> i,st,c,desc,st2);
<a name="l26"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l27"></a> </span><span class=cF5>Free</span><span class=cF0>(st2);
<a name="l28"></a>
<a name="l29"></a> ptr=res;
<a name="l30"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr) </span><span class=cF7>{</span><span class=cF0>
<a name="l31"></a> </span><span class=cF1>if</span><span class=cF0> (*ptr==</span><span class=cF3>CH_SPACE</span><span class=cF0>)
<a name="l32"></a> *ptr=</span><span class=cF3>CH_SHIFT_SPACE</span><span class=cF0>;
<a name="l33"></a> ptr++;
<a name="l34"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l35"></a>
<a name="l36"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l37"></a>}
<a name="l38"></a>
<a name="l39"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>KeyMapKeyPrint</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> sc,</span><span class=cF1>U0</span><span class=cF0> </span><span class=cF7>(</span><span class=cF0>*fp_hndlr</span><span class=cF7>)(</span><span class=cF9>I64</span><span class=cF0> sc</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF1>U8</span><span class=cF0> *desc,</span><span class=cF9>CTask</span><span class=cF0> *task=</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>KeyMapKeyMStrPrint</span><span class=cF0>(sc,fp_hndlr,desc,task);
<a name="l42"></a> </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>,st;
<a name="l43"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l44"></a>}
<a name="l45"></a>
<a name="l46"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>KeyMapCtrlAltFamily</span><span class=cF0>(</span><span class=cF1>Bool</span><span class=cF0> no_shift,</span><span class=cF1>Bool</span><span class=cF0> shift)
<a name="l47"></a>{
<a name="l48"></a> </span><span class=cF9>I64</span><span class=cF0> i,no_shift_f;
<a name="l49"></a> </span><span class=cF1>if</span><span class=cF0> (no_shift &amp;&amp; shift)
<a name="l50"></a> no_shift_f=</span><span class=cF3>SCF_NO_SHIFT</span><span class=cF0>;
<a name="l51"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l52"></a> no_shift_f=0;
<a name="l53"></a> </span><span class=cF1>if</span><span class=cF0> (no_shift) </span><span class=cF5>KeyMapKeyPrint</span><span class=cF0>(</span><span class=cF3>SC_DELETE</span><span class=cF0>+</span><span class=cF3>SCF_CTRL</span><span class=cF0>+</span><span class=cF3>SCF_ALT</span><span class=cF0>+no_shift_f,
<a name="l54"></a> &amp;</span><span class=cF5>Reboot</span><span class=cF0>,</span><span class=cF6>&quot;Cmd /Reboot&quot;</span><span class=cF0>);
<a name="l55"></a> </span><span class=cF1>if</span><span class=cF0> (no_shift) </span><span class=cF5>KeyMapKeyPrint</span><span class=cF0>(</span><span class=cF3>SC_ESC</span><span class=cF0>+</span><span class=cF3>SCF_CTRL</span><span class=cF0>+</span><span class=cF3>SCF_ALT</span><span class=cF0>+no_shift_f,
<a name="l56"></a> &amp;</span><span class=cF5>User</span><span class=cF0>,</span><span class=cF6>&quot;Cmd /Terminal Window&quot;</span><span class=cF0>);
<a name="l57"></a> </span><span class=cF1>if</span><span class=cF0> (no_shift) </span><span class=cF5>KeyMapKeyPrint</span><span class=cF0>(</span><span class=cF3>SC_TAB</span><span class=cF0>+</span><span class=cF3>SCF_CTRL</span><span class=cF0>+</span><span class=cF3>SCF_ALT</span><span class=cF0>+no_shift_f,
<a name="l58"></a> &amp;</span><span class=cF5>WinToTop</span><span class=cF0>,</span><span class=cF6>&quot;Cmd /Next Focus Task&quot;</span><span class=cF0>);
<a name="l59"></a>
<a name="l60"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;26;i++)
<a name="l61"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>keydev</span><span class=cF0>.fp_ctrl_alt_cbs[i]) </span><span class=cF7>{</span><span class=cF0>
<a name="l62"></a> </span><span class=cF1>if</span><span class=cF0> (no_shift &amp;&amp; </span><span class=cFB>keydev</span><span class=cF0>.ctrl_alt_no_shift_descs[i])
<a name="l63"></a> </span><span class=cF5>KeyMapKeyPrint</span><span class=cF0>(</span><span class=cF5>Char2ScanCode</span><span class=cF7>(</span><span class=cF0>i+</span><span class=cF6>'a'</span><span class=cF7>)</span><span class=cF0>+</span><span class=cF3>SCF_CTRL</span><span class=cF0>+</span><span class=cF3>SCF_ALT</span><span class=cF0>+no_shift_f,
<a name="l64"></a> </span><span class=cFB>keydev</span><span class=cF0>.fp_ctrl_alt_cbs[i],</span><span class=cFB>keydev</span><span class=cF0>.ctrl_alt_no_shift_descs[i]);
<a name="l65"></a> </span><span class=cF1>if</span><span class=cF0> (shift &amp;&amp; </span><span class=cFB>keydev</span><span class=cF0>.ctrl_alt_shift_descs[i])
<a name="l66"></a> </span><span class=cF5>KeyMapKeyPrint</span><span class=cF0>(</span><span class=cF5>Char2ScanCode</span><span class=cF7>(</span><span class=cF0>i+</span><span class=cF6>'a'</span><span class=cF7>)</span><span class=cF0>+</span><span class=cF3>SCF_CTRL</span><span class=cF0>+</span><span class=cF3>SCF_ALT</span><span class=cF0>+</span><span class=cF3>SCF_SHIFT</span><span class=cF0>,
<a name="l67"></a> </span><span class=cFB>keydev</span><span class=cF0>.fp_ctrl_alt_cbs[i],</span><span class=cFB>keydev</span><span class=cF0>.ctrl_alt_shift_descs[i]);
<a name="l68"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l69"></a>}
<a name="l70"></a>
<a name="l71"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>KMComparePrepare</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *buf,</span><span class=cF9>I64</span><span class=cF0> *src)
<a name="l72"></a>{
<a name="l73"></a> </span><span class=cF9>I64</span><span class=cF0> i,*dst=buf;
<a name="l74"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr;
<a name="l75"></a> </span><span class=cF1>if</span><span class=cF0> (src) </span><span class=cF7>{</span><span class=cF0>
<a name="l76"></a> *dst++=*src++;
<a name="l77"></a> *dst++=*src++;
<a name="l78"></a> *dst++=*src++;
<a name="l79"></a> *dst++=*src++;
<a name="l80"></a> *dst(</span><span class=cF1>U8</span><span class=cF0> *)=0;
<a name="l81"></a> </span><span class=cF1>if</span><span class=cF0> (ptr=</span><span class=cF5>StrMatch</span><span class=cF7>(</span><span class=cF6>&quot;SHIFT&quot;</span><span class=cF0>,buf</span><span class=cF7>)</span><span class=cF0>) {
<a name="l82"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;5;i++)
<a name="l83"></a> ptr[i]=</span><span class=cF3>CH_SHIFT_SPACE</span><span class=cF0>;
<a name="l84"></a> </span><span class=cF1>if</span><span class=cF0> (ptr=</span><span class=cF5>StrMatch</span><span class=cF7>(</span><span class=cF6>&quot;$&quot;</span><span class=cF0>,buf</span><span class=cF7>)</span><span class=cF0>)
<a name="l85"></a> *ptr=255;
<a name="l86"></a> }
<a name="l87"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l88"></a> *buf=0;
<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>KMCompare</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *e1,</span><span class=cF1>U8</span><span class=cF0> *e2)
<a name="l92"></a>{
<a name="l93"></a> </span><span class=cF1>U8</span><span class=cF0> buf1[</span><span class=cF3>STR_LEN</span><span class=cF0>],buf2[</span><span class=cF3>STR_LEN</span><span class=cF0>];
<a name="l94"></a> </span><span class=cF5>KMComparePrepare</span><span class=cF0>(buf1,e1);
<a name="l95"></a> </span><span class=cF5>KMComparePrepare</span><span class=cF0>(buf2,e2);
<a name="l96"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>StrCmp</span><span class=cF0>(buf1,buf2);
<a name="l97"></a>}
<a name="l98"></a>
<a name="l99"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>KeyMapFamily2</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> **entries,</span><span class=cF9>CTask</span><span class=cF0> *task,</span><span class=cF9>I64</span><span class=cF0> scf)
<a name="l100"></a>{
<a name="l101"></a> </span><span class=cF9>I64</span><span class=cF0> i,arg1,arg2;
<a name="l102"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;256;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l103"></a> arg2=scf|i|</span><span class=cF3>SCF_KEY_DESC</span><span class=cF0>;
<a name="l104"></a> arg1=</span><span class=cF5>ScanCode2Char</span><span class=cF0>(arg2);
<a name="l105"></a> *</span><span class=cFB>keydev</span><span class=cF0>.desc=0;
<a name="l106"></a> </span><span class=cFB>keydev</span><span class=cF0>.hndlr=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l107"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0> &amp;&amp; !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;task-&gt;win_inhibit,</span><span class=cF3>WIf_SELF_KEY_DESC</span><span class=cF7>)</span><span class=cF0>) {
<a name="l108"></a> </span><span class=cF1>if</span><span class=cF0> (task==</span><span class=cF5>Fs</span><span class=cF0>)
<a name="l109"></a> </span><span class=cF5>PutKey</span><span class=cF0>(arg1,arg2);
<a name="l110"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l111"></a> </span><span class=cF5>PostMsg</span><span class=cF0>(task,</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>,arg1,arg2);
<a name="l112"></a> </span><span class=cF5>Refresh</span><span class=cF0>(0,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l113"></a> </span><span class=cF5>Sleep</span><span class=cF0>(1); </span><span class=cF2>//Open loop because might be no response. TODO: Drops msgs.</span><span class=cF0>
<a name="l114"></a> }
<a name="l115"></a> </span><span class=cF1>if</span><span class=cF0> (*</span><span class=cFB>keydev</span><span class=cF0>.desc &amp;&amp; </span><span class=cF5>StrNCmp</span><span class=cF7>(</span><span class=cFB>keydev</span><span class=cF0>.desc,</span><span class=cF6>&quot;Char /&quot;</span><span class=cF0>,7</span><span class=cF7>)</span><span class=cF0>)
<a name="l116"></a> entries[i]=</span><span class=cF5>KeyMapKeyMStrPrint</span><span class=cF0>(arg2,</span><span class=cFB>keydev</span><span class=cF0>.hndlr,</span><span class=cFB>keydev</span><span class=cF0>.desc,task);
<a name="l117"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l118"></a>}
<a name="l119"></a>
<a name="l120"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>KeyMapFamily</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task,</span><span class=cF9>I64</span><span class=cF0> scf,</span><span class=cF1>Bool</span><span class=cF0> no_shift,</span><span class=cF1>Bool</span><span class=cF0> shift)
<a name="l121"></a>{
<a name="l122"></a> </span><span class=cF9>I64</span><span class=cF0> i,cnt=0;
<a name="l123"></a> </span><span class=cF1>U8</span><span class=cF0> **entries=</span><span class=cF5>CAlloc</span><span class=cF0>(2*256*</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>),**ptr=entries;
<a name="l124"></a> </span><span class=cF1>if</span><span class=cF0> (no_shift) </span><span class=cF7>{</span><span class=cF0>
<a name="l125"></a> </span><span class=cF1>if</span><span class=cF0> (shift)
<a name="l126"></a> </span><span class=cF5>KeyMapFamily2</span><span class=cF0>(ptr,task,scf+</span><span class=cF3>SCF_NO_SHIFT</span><span class=cF0>);
<a name="l127"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l128"></a> </span><span class=cF5>KeyMapFamily2</span><span class=cF0>(ptr,task,scf);
<a name="l129"></a> ptr+=256;
<a name="l130"></a> cnt+=256;
<a name="l131"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l132"></a> </span><span class=cF1>if</span><span class=cF0> (shift) </span><span class=cF7>{</span><span class=cF0>
<a name="l133"></a> </span><span class=cF5>KeyMapFamily2</span><span class=cF0>(ptr,task,scf+</span><span class=cF3>SCF_SHIFT</span><span class=cF0>);
<a name="l134"></a> ptr+=256;
<a name="l135"></a> cnt+=256;
<a name="l136"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l137"></a> </span><span class=cF5>QSortI64</span><span class=cF0>(entries,cnt,&amp;</span><span class=cF5>KMCompare</span><span class=cF0>);
<a name="l138"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;cnt;i++)
<a name="l139"></a> </span><span class=cF1>if</span><span class=cF0> (entries[i]) </span><span class=cF7>{</span><span class=cF0>
<a name="l140"></a> </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>,entries[i];
<a name="l141"></a> </span><span class=cF5>Free</span><span class=cF0>(entries[i]);
<a name="l142"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l143"></a> </span><span class=cF5>Free</span><span class=cF0>(entries);
<a name="l144"></a>}
<a name="l145"></a>
<a name="l146"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>KeyMap</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l147"></a>{</span><span class=cF2>//Report desc of all keys.</span><span class=cF0>
<a name="l148"></a> </span><span class=cF1>Bool</span><span class=cF0> old_key_desc;
<a name="l149"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
<a name="l150"></a> old_key_desc=</span><span class=cF5>LBtr</span><span class=cF0>(&amp;task-&gt;win_inhibit,</span><span class=cF3>WIf_SELF_KEY_DESC</span><span class=cF0>);
<a name="l151"></a> </span><span class=cF5>DocMax</span><span class=cF0>;
<a name="l152"></a> </span><span class=cF5>KeyMapFamily</span><span class=cF0>(task,0,</span><span class=cF3>TRUE</span><span class=cF0>,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l153"></a> </span><span class=cF5>KeyMapFamily</span><span class=cF0>(task,</span><span class=cF3>SCF_CTRL</span><span class=cF0>,</span><span class=cF3>TRUE</span><span class=cF0>,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l154"></a> </span><span class=cF5>KeyMapFamily</span><span class=cF0>(task,</span><span class=cF3>SCF_ALT</span><span class=cF0>,</span><span class=cF3>TRUE</span><span class=cF0>,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l155"></a> </span><span class=cF5>KeyMapCtrlAltFamily</span><span class=cF0>(</span><span class=cF3>TRUE</span><span class=cF0>,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l156"></a> </span><span class=cF5>LBEqu</span><span class=cF0>(&amp;task-&gt;win_inhibit,</span><span class=cF3>WIf_SELF_KEY_DESC</span><span class=cF0>,old_key_desc);
<a name="l157"></a> </span><span class=cF6>&quot;\nKeyMap Completed.\n&quot;</span><span class=cF0>;
<a name="l158"></a>}
<a name="l159"></a>
<a name="l160"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Help System/Training&quot;</span><span class=cF0>
<a name="l161"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>TipOfDay</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *tip_file=</span><span class=cF6>&quot;::/Doc/Tips.DD&quot;</span><span class=cF0>)
<a name="l162"></a>{</span><span class=cF2>//Print random tip-of-day from ::/Doc/Tips.DD.</span><span class=cF0>
<a name="l163"></a> </span><span class=cF9>I64</span><span class=cF0> i=</span><span class=cF5>RandU16</span><span class=cF0>;
<a name="l164"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc=</span><span class=cF5>DocRead</span><span class=cF0>(tip_file),*doc2=</span><span class=cF5>DocNew</span><span class=cF0>;
<a name="l165"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e=doc-&gt;head.next;
<a name="l166"></a> </span><span class=cF6>&quot;$WW,1$\n&quot;</span><span class=cF0>;
<a name="l167"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l168"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;type_u8==</span><span class=cF3>DOCT_TEXT</span><span class=cF0> &amp;&amp; *doc_e-&gt;tag==</span><span class=cF6>'*'</span><span class=cF0>)
<a name="l169"></a> </span><span class=cF1>if</span><span class=cF0> (!i--) </span><span class=cF1>break</span><span class=cF0>;
<a name="l170"></a> doc_e=doc_e-&gt;next;
<a name="l171"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l172"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;type_u8==</span><span class=cF3>DOCT_TEXT</span><span class=cF0> &amp;&amp; *doc_e-&gt;tag==</span><span class=cF6>'*'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l173"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc) {
<a name="l174"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;type_u8!=</span><span class=cF3>DOCT_ERROR</span><span class=cF0>)
<a name="l175"></a> </span><span class=cF5>DocInsEntry</span><span class=cF0>(doc2,</span><span class=cF5>DocEntryCopy</span><span class=cF7>(</span><span class=cF0>doc2,doc_e</span><span class=cF7>)</span><span class=cF0>);
<a name="l176"></a> doc_e=doc_e-&gt;next;
<a name="l177"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;type_u8==</span><span class=cF3>DOCT_TEXT</span><span class=cF0> &amp;&amp; *doc_e-&gt;tag==</span><span class=cF6>'*'</span><span class=cF0>)
<a name="l178"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l179"></a> }
<a name="l180"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l181"></a> </span><span class=cF5>DocInsDoc</span><span class=cF0>(</span><span class=cF5>DocPut</span><span class=cF0>,doc2);
<a name="l182"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc2);
<a name="l183"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
<a name="l184"></a>}
</span></pre></body>
</html>