templeos-info/public/Wb/Adam/AutoComplete/ACTask.HC.HTML

315 lines
37 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;AutoComplete/Dictionary&quot;</span><span class=cF0>
<a name="l2"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>ACDDictWordsAdd</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *st)
<a name="l3"></a>{
<a name="l4"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l5"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr;
<a name="l6"></a> </span><span class=cF1>if</span><span class=cF0> (st &amp;&amp; *st &amp;&amp; </span><span class=cF7>(</span><span class=cF0>ptr=</span><span class=cF5>ACDWordPtAt</span><span class=cF0>(st)</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l7"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;</span><span class=cF3>ACD_FILLINS_NUM</span><span class=cF0>;i++) {
<a name="l8"></a> </span><span class=cF1>if</span><span class=cF0> (*ptr++!=</span><span class=cF3>ACD_WORD_CHAR</span><span class=cF0>)
<a name="l9"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l10"></a> </span><span class=cF1>if</span><span class=cF0> (i) </span><span class=cF6>'\n'</span><span class=cF0>;
<a name="l11"></a> </span><span class=cFB>acd</span><span class=cF0>.fillins[i]=ptr-1;
<a name="l12"></a> </span><span class=cF6>&quot;$GREEN$'%d'$FG$ %-23ts&quot;</span><span class=cF0>,i,ptr;
<a name="l13"></a> ptr+=</span><span class=cF5>StrLen</span><span class=cF0>(ptr)+3;
<a name="l14"></a> }
<a name="l15"></a> </span><span class=cFB>acd</span><span class=cF0>.num_fillins=i;
<a name="l16"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l17"></a>}
<a name="l18"></a>
<a name="l19"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;AutoComplete&quot;</span><span class=cF0>
<a name="l20"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>ACDocRst</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> left,</span><span class=cF9>I64</span><span class=cF0> top)
<a name="l21"></a>{
<a name="l22"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc=</span><span class=cF5>DocPut</span><span class=cF0>;
<a name="l23"></a> </span><span class=cF5>DocRst</span><span class=cF0>(doc,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l24"></a> doc-&gt;flags|=</span><span class=cF3>DOCF_SIZE_MIN</span><span class=cF0>;
<a name="l25"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;border_src=</span><span class=cF3>BDS_CONST</span><span class=cF0>;
<a name="l26"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;border_attr=</span><span class=cF3>LTGRAY</span><span class=cF0>&lt;&lt;4+</span><span class=cF5>DrvTextAttrGet</span><span class=cF0>(</span><span class=cF6>':'</span><span class=cF0>)&amp;15;
<a name="l27"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;text_attr =</span><span class=cF3>LTGRAY</span><span class=cF0>&lt;&lt;4+</span><span class=cF3>BLUE</span><span class=cF0>;
<a name="l28"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&amp;</span><span class=cF5>Fs</span><span class=cF0>-&gt;display_flags,</span><span class=cF3>DISPLAYf_SHOW</span><span class=cF0>);
<a name="l29"></a> </span><span class=cF5>WinHorz</span><span class=cF0>(left,</span><span class=cF5>Fs</span><span class=cF0>-&gt;win_right);
<a name="l30"></a> </span><span class=cF5>WinVert</span><span class=cF0>(top,</span><span class=cF5>Fs</span><span class=cF0>-&gt;win_bottom);
<a name="l31"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
<a name="l32"></a>}
<a name="l33"></a>
<a name="l34"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>ACSkipCrap</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *src,</span><span class=cF9>I64</span><span class=cF0> len)
<a name="l35"></a>{
<a name="l36"></a> </span><span class=cF9>I64</span><span class=cF0> j;
<a name="l37"></a> j=len-1;
<a name="l38"></a> </span><span class=cF1>while</span><span class=cF0> (j&gt;=0) </span><span class=cF7>{</span><span class=cF0>
<a name="l39"></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_alpha_numeric</span><span class=cF0>,src[j]</span><span class=cF7>)</span><span class=cF0>)
<a name="l40"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l41"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l42"></a> j--;
<a name="l43"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l44"></a> </span><span class=cF1>return</span><span class=cF0> j+1;
<a name="l45"></a>}
<a name="l46"></a>
<a name="l47"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>ACPriorWordInStr</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *src,</span><span class=cF1>U8</span><span class=cF0> *dst,</span><span class=cF9>I64</span><span class=cF0> len,</span><span class=cF9>I64</span><span class=cF0> buf_size)
<a name="l48"></a>{
<a name="l49"></a> </span><span class=cF9>I64</span><span class=cF0> i,j=0,k;
<a name="l50"></a> i=len-1;
<a name="l51"></a> </span><span class=cF1>while</span><span class=cF0> (i&gt;=0)
<a name="l52"></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_alpha_numeric</span><span class=cF0>,src[i]</span><span class=cF7>)</span><span class=cF0>)
<a name="l53"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l54"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l55"></a> i--;
<a name="l56"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;=-1 &amp;&amp; len&gt;0)
<a name="l57"></a> </span><span class=cF1>for</span><span class=cF0> (k=i+1;k&lt;len &amp;&amp; j&lt;buf_size-1;k++)
<a name="l58"></a> dst[j++]=src[k];
<a name="l59"></a> dst[j]=0;
<a name="l60"></a> </span><span class=cF1>return</span><span class=cF0> i+1;
<a name="l61"></a>}
<a name="l62"></a>
<a name="l63"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>ACFillInAdd</span><span class=cF0>(</span><span class=cF9>CHashAC</span><span class=cF0> *tmpw)
<a name="l64"></a>{
<a name="l65"></a> </span><span class=cF9>I64</span><span class=cF0> k;
<a name="l66"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>ac</span><span class=cF0>.num_fillins&lt;</span><span class=cF3>AC_FILLINS_NUM</span><span class=cF0> ||
<a name="l67"></a> tmpw-&gt;hits&gt;</span><span class=cFB>ac</span><span class=cF0>.fillin_hits[</span><span class=cFB>ac</span><span class=cF0>.num_fillins-1]) </span><span class=cF7>{</span><span class=cF0>
<a name="l68"></a> </span><span class=cF1>for</span><span class=cF0> (k=</span><span class=cFB>ac</span><span class=cF0>.num_fillins-1;k&gt;=0;k--) {
<a name="l69"></a> </span><span class=cF1>if</span><span class=cF0> (tmpw-&gt;hits&lt;=</span><span class=cFB>ac</span><span class=cF0>.fillin_hits[k])
<a name="l70"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l71"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l72"></a> </span><span class=cFB>ac</span><span class=cF0>.fillin_matches[k+1]=</span><span class=cFB>ac</span><span class=cF0>.fillin_matches[k];
<a name="l73"></a> </span><span class=cFB>ac</span><span class=cF0>.fillin_hits[k+1] =</span><span class=cFB>ac</span><span class=cF0>.fillin_hits[k];
<a name="l74"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l75"></a> }
<a name="l76"></a> </span><span class=cFB>ac</span><span class=cF0>.fillin_matches[k+1]=tmpw;
<a name="l77"></a> </span><span class=cFB>ac</span><span class=cF0>.fillin_hits[k+1] =tmpw-&gt;hits;
<a name="l78"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>ac</span><span class=cF0>.num_fillins&lt;</span><span class=cF3>AC_FILLINS_NUM</span><span class=cF0>)
<a name="l79"></a> </span><span class=cFB>ac</span><span class=cF0>.num_fillins++;
<a name="l80"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l81"></a>}
<a name="l82"></a>
<a name="l83"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>ACPutChoices</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *focus_l,</span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e,</span><span class=cF9>CTask</span><span class=cF0> *focus_task,
<a name="l84"></a> </span><span class=cF1>Bool</span><span class=cF0> force_refresh)
<a name="l85"></a>{
<a name="l86"></a> </span><span class=cF9>I64</span><span class=cF0> i,data_col;
<a name="l87"></a> </span><span class=cF1>U8</span><span class=cF0> *buf,*buf1,*src=</span><span class=cF3>NULL</span><span class=cF0>,*st;
<a name="l88"></a> </span><span class=cF9>CHashAC</span><span class=cF0> *tmpw;
<a name="l89"></a> </span><span class=cF1>F64</span><span class=cF0> timeout_time=</span><span class=cF5>tS</span><span class=cF0>+0.5;
<a name="l90"></a> </span><span class=cF9>CHashSrcSym</span><span class=cF0> *tmph;
<a name="l91"></a>
<a name="l92"></a> src=</span><span class=cF5>DocScanLine</span><span class=cF0>(focus_l,doc_e,&amp;data_col);
<a name="l93"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(focus_l);
<a name="l94"></a> i=</span><span class=cF5>StrLen</span><span class=cF0>(src);
<a name="l95"></a> buf =</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF5>MaxI64</span><span class=cF7>(</span><span class=cF0>i+1,256</span><span class=cF7>)</span><span class=cF0>);
<a name="l96"></a> buf1=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF5>MaxI64</span><span class=cF7>(</span><span class=cF0>i+1,256</span><span class=cF7>)</span><span class=cF0>);
<a name="l97"></a> </span><span class=cF1>if</span><span class=cF0> (data_col==-1)
<a name="l98"></a> data_col=0;
<a name="l99"></a> data_col=</span><span class=cF5>ACPriorWordInStr</span><span class=cF0>(src,buf,data_col,256);
<a name="l100"></a> </span><span class=cFB>ac</span><span class=cF0>.partial_len=</span><span class=cF5>StrLen</span><span class=cF0>(buf);
<a name="l101"></a> data_col=</span><span class=cF5>ACSkipCrap</span><span class=cF0>(src,data_col);
<a name="l102"></a> data_col=</span><span class=cF5>ACPriorWordInStr</span><span class=cF0>(src,buf1,data_col,256);
<a name="l103"></a>
<a name="l104"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFB>ac</span><span class=cF0>.cur_word || </span><span class=cF5>StrCmp</span><span class=cF7>(</span><span class=cFB>ac</span><span class=cF0>.cur_word,buf</span><span class=cF7>)</span><span class=cF0> || force_refresh) </span><span class=cF7>{</span><span class=cF0>
<a name="l105"></a> st=</span><span class=cFB>ac</span><span class=cF0>.cur_word;
<a name="l106"></a> </span><span class=cFB>ac</span><span class=cF0>.cur_word=</span><span class=cF5>AStrNew</span><span class=cF0>(buf);
<a name="l107"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l108"></a> </span><span class=cFB>ac</span><span class=cF0>.num_fillins=0;
<a name="l109"></a> </span><span class=cF1>if</span><span class=cF0> (*</span><span class=cFB>ac</span><span class=cF0>.cur_word)
<a name="l110"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;=</span><span class=cFB>ac</span><span class=cF0>.hash_table-&gt;mask &amp;&amp; </span><span class=cF5>tS</span><span class=cF0>&lt;timeout_time;i++) {
<a name="l111"></a> tmpw=</span><span class=cFB>ac</span><span class=cF0>.hash_table-&gt;body[i];
<a name="l112"></a> </span><span class=cF1>while</span><span class=cF0> (tmpw) </span><span class=cF7>{</span><span class=cF0>
<a name="l113"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>MemCmp</span><span class=cF7>(</span><span class=cFB>ac</span><span class=cF0>.cur_word,tmpw-&gt;str,</span><span class=cF5>StrLen</span><span class=cF0>(</span><span class=cFB>ac</span><span class=cF0>.cur_word)</span><span class=cF7>)</span><span class=cF0>)
<a name="l114"></a> </span><span class=cF5>ACFillInAdd</span><span class=cF0>(tmpw);
<a name="l115"></a> tmpw=tmpw-&gt;next;
<a name="l116"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l117"></a> }
<a name="l118"></a> </span><span class=cF5>ACDocRst</span><span class=cF0>(51,13);
<a name="l119"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>ac</span><span class=cF0>.cur_word &amp;&amp; *</span><span class=cFB>ac</span><span class=cF0>.cur_word) {
<a name="l120"></a> </span><span class=cF6>&quot;$PURPLE$Word:%s$FG$\n&quot;</span><span class=cF0>,</span><span class=cFB>ac</span><span class=cF0>.cur_word;
<a name="l121"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;</span><span class=cFB>ac</span><span class=cF0>.num_fillins;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l122"></a> st=</span><span class=cFB>ac</span><span class=cF0>.fillin_matches[i]-&gt;str;
<a name="l123"></a> </span><span class=cF6>&quot;$GREEN$F%02d$FG$ &quot;</span><span class=cF0>,i+1;
<a name="l124"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>focus_task</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l125"></a> </span><span class=cF7>(</span><span class=cF0>tmph=</span><span class=cF5>HashFind</span><span class=cF0>(st,focus_task-&gt;hash_table,</span><span class=cF3>HTG_SRC_SYM</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l126"></a> tmph-&gt;src_link) {
<a name="l127"></a> </span><span class=cF1>if</span><span class=cF0> (tmph-&gt;type&amp;</span><span class=cF3>HTF_PUBLIC</span><span class=cF0>)
<a name="l128"></a> </span><span class=cF6>&quot;$RED$&quot;</span><span class=cF0>;
<a name="l129"></a> </span><span class=cF6>&quot;$TX+UL+L+PU,\&quot;%$Q\&quot;,A=\&quot;%s\&quot;$$FG$\n&quot;</span><span class=cF0>,st,tmph-&gt;src_link;
<a name="l130"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l131"></a> </span><span class=cF6>&quot;%s\n&quot;</span><span class=cF0>,st;
<a name="l132"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l133"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>acd</span><span class=cF0>.has_words)
<a name="l134"></a> </span><span class=cF5>ACDDictWordsAdd</span><span class=cF0>(</span><span class=cFB>ac</span><span class=cF0>.cur_word);
<a name="l135"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>FileFind</span><span class=cF7>(</span><span class=cF6>&quot;::/Doc/StandBy.DD.Z&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l136"></a> </span><span class=cF5>Type</span><span class=cF0>(</span><span class=cF6>&quot;::/Doc/StandBy.DD.Z&quot;</span><span class=cF0>,0);
<a name="l137"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l138"></a> </span><span class=cF5>Free</span><span class=cF0>(src);
<a name="l139"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l140"></a> </span><span class=cF5>Free</span><span class=cF0>(buf1);
<a name="l141"></a>}
<a name="l142"></a>
<a name="l143"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>ACTaskNormal</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> sc,</span><span class=cF9>I64</span><span class=cF0> last_sc,
<a name="l144"></a> </span><span class=cF9>CTask</span><span class=cF0> *focus_task,</span><span class=cF9>CTask</span><span class=cF0> *original_focus_task)
<a name="l145"></a>{
<a name="l146"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc;
<a name="l147"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e;
<a name="l148"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>doc=</span><span class=cF5>DocPut</span><span class=cF0>(focus_task)</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l149"></a> focus_task!=</span><span class=cF5>Fs</span><span class=cF0> &amp;&amp; </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;focus_task-&gt;display_flags,</span><span class=cF3>DISPLAYf_SHOW</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l150"></a> </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l151"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>focus_task</span><span class=cF7>)</span><span class=cF0> &amp;&amp; original_focus_task==</span><span class=cFB>sys_focus_task</span><span class=cF0> &amp;&amp;
<a name="l152"></a> doc &amp;&amp; doc==</span><span class=cF5>DocPut</span><span class=cF7>(</span><span class=cF0>focus_task</span><span class=cF7>)</span><span class=cF0> &amp;&amp; </span><span class=cF7>(</span><span class=cF0>doc_e=doc-&gt;cur_entry</span><span class=cF7>)</span><span class=cF0>) {
<a name="l153"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e==doc) doc_e=doc_e-&gt;last;
<a name="l154"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e-&gt;last!=doc &amp;&amp; </span><span class=cF7>(</span><span class=cF0>doc_e-&gt;type_u8==</span><span class=cF3>DOCT_NEW_LINE</span><span class=cF0> ||
<a name="l155"></a> doc_e-&gt;type_u8==</span><span class=cF3>DOCT_SOFT_NEW_LINE</span><span class=cF7>)</span><span class=cF0>)
<a name="l156"></a> doc_e=doc_e-&gt;last;
<a name="l157"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e-&gt;last-&gt;type_u8!=</span><span class=cF3>DOCT_NEW_LINE</span><span class=cF0> &amp;&amp; doc_e-&gt;last!=doc)
<a name="l158"></a> doc_e=doc_e-&gt;last;
<a name="l159"></a> </span><span class=cF5>ACPutChoices</span><span class=cF0>(doc,doc_e,focus_task,</span><span class=cF5>ToBool</span><span class=cF7>(</span><span class=cF0>sc!=last_sc</span><span class=cF7>)</span><span class=cF0>);
<a name="l160"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l161"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l162"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l163"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cF5>Fs</span><span class=cF0>-&gt;display_flags,</span><span class=cF3>DISPLAYf_SHOW</span><span class=cF7>)</span><span class=cF0>)
<a name="l164"></a> </span><span class=cF5>WinZBufUpdate</span><span class=cF0>;
<a name="l165"></a>}
<a name="l166"></a>
<a name="l167"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>ACTaskCtrl</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> sc,</span><span class=cF9>I64</span><span class=cF0> last_sc,
<a name="l168"></a> </span><span class=cF9>CTask</span><span class=cF0> *focus_task,</span><span class=cF9>CTask</span><span class=cF0> *original_focus_task)
<a name="l169"></a>{
<a name="l170"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>focus_task</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l171"></a> </span><span class=cF7>(</span><span class=cF0>focus_task-&gt;scroll_x || focus_task-&gt;scroll_y</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l172"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>LBtr</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cF5>Fs</span><span class=cF0>-&gt;display_flags,</span><span class=cF3>DISPLAYf_SHOW</span><span class=cF7>)</span><span class=cF0>)
<a name="l173"></a> </span><span class=cF5>WinZBufUpdate</span><span class=cF0>;
<a name="l174"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l175"></a> </span><span class=cF1>if</span><span class=cF0> (sc!=last_sc) {
<a name="l176"></a> </span><span class=cF1>if</span><span class=cF0> (sc&amp;</span><span class=cF3>SCF_ALT</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l177"></a> </span><span class=cF5>ACDocRst</span><span class=cF0>(27,3);
<a name="l178"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>original_focus_task</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l179"></a> !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;original_focus_task-&gt;win_inhibit,</span><span class=cF3>WIf_SELF_KEY_DESC</span><span class=cF7>)</span><span class=cF0>)
<a name="l180"></a> </span><span class=cF5>KeyMapFamily</span><span class=cF0>(original_focus_task,0,
<a name="l181"></a> </span><span class=cF5>ToBool</span><span class=cF7>(</span><span class=cF0>!(sc&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF5>ToBool</span><span class=cF7>(</span><span class=cF0>sc&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF7>)</span><span class=cF0>);
<a name="l182"></a> </span><span class=cF5>KeyMapCtrlAltFamily</span><span class=cF0>(
<a name="l183"></a> </span><span class=cF5>ToBool</span><span class=cF7>(</span><span class=cF0>!(sc&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF5>ToBool</span><span class=cF7>(</span><span class=cF0>sc&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF7>)</span><span class=cF0>);
<a name="l184"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>original_focus_task</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l185"></a> !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;original_focus_task-&gt;win_inhibit,</span><span class=cF3>WIf_SELF_KEY_DESC</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l186"></a> </span><span class=cF5>ACDocRst</span><span class=cF0>(27,3);
<a name="l187"></a> </span><span class=cF5>KeyMapFamily</span><span class=cF0>(original_focus_task,</span><span class=cF3>SCF_CTRL</span><span class=cF0>,
<a name="l188"></a> </span><span class=cF5>ToBool</span><span class=cF7>(</span><span class=cF0>!(sc&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF5>ToBool</span><span class=cF7>(</span><span class=cF0>sc&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF7>)</span><span class=cF0>);
<a name="l189"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l190"></a> }
<a name="l191"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cF5>Fs</span><span class=cF0>-&gt;display_flags,</span><span class=cF3>DISPLAYf_SHOW</span><span class=cF7>)</span><span class=cF0>)
<a name="l192"></a> </span><span class=cF5>WinZBufUpdate</span><span class=cF0>;
<a name="l193"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l194"></a>}
<a name="l195"></a>
<a name="l196"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>ACTaskAlt</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> sc,</span><span class=cF9>I64</span><span class=cF0> last_sc,
<a name="l197"></a> </span><span class=cF9>CTask</span><span class=cF0> *,</span><span class=cF9>CTask</span><span class=cF0> *original_focus_task)
<a name="l198"></a>{
<a name="l199"></a> </span><span class=cF1>if</span><span class=cF0> (sc!=last_sc &amp;&amp; </span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>original_focus_task</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l200"></a> !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;original_focus_task-&gt;win_inhibit,</span><span class=cF3>WIf_SELF_KEY_DESC</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l201"></a> </span><span class=cF5>ACDocRst</span><span class=cF0>(27,3);
<a name="l202"></a> </span><span class=cF5>KeyMapFamily</span><span class=cF0>(original_focus_task,</span><span class=cF3>SCF_ALT</span><span class=cF0>,
<a name="l203"></a> </span><span class=cF5>ToBool</span><span class=cF7>(</span><span class=cF0>!(sc&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF5>ToBool</span><span class=cF7>(</span><span class=cF0>sc&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF7>)</span><span class=cF0>);
<a name="l204"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l205"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cF5>Fs</span><span class=cF0>-&gt;display_flags,</span><span class=cF3>DISPLAYf_SHOW</span><span class=cF7>)</span><span class=cF0>)
<a name="l206"></a> </span><span class=cF5>WinZBufUpdate</span><span class=cF0>;
<a name="l207"></a>}
<a name="l208"></a>
<a name="l209"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>ACTaskEndCB</span><span class=cF0>()
<a name="l210"></a>{
<a name="l211"></a> </span><span class=cFB>ac</span><span class=cF0>.task=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l212"></a> </span><span class=cF5>Exit</span><span class=cF0>;
<a name="l213"></a>}
<a name="l214"></a>
<a name="l215"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>ACTask</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0>)
<a name="l216"></a>{
<a name="l217"></a> </span><span class=cF9>CTask</span><span class=cF0> *focus_task,*original_focus_task;
<a name="l218"></a> </span><span class=cF9>I64</span><span class=cF0> ch,scan_code=0,last_scan_code=0;
<a name="l219"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc;
<a name="l220"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;task_end_cb=&amp;</span><span class=cF5>ACTaskEndCB</span><span class=cF0>;
<a name="l221"></a> </span><span class=cF5>DocTermNew</span><span class=cF0>;
<a name="l222"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;</span><span class=cF5>Fs</span><span class=cF0>-&gt;display_flags,</span><span class=cF3>DISPLAYf_SHOW</span><span class=cF0>);
<a name="l223"></a> </span><span class=cF5>WinHorz</span><span class=cF0>(51,</span><span class=cF5>Fs</span><span class=cF0>-&gt;win_right);
<a name="l224"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;</span><span class=cF5>Fs</span><span class=cF0>-&gt;display_flags,</span><span class=cF3>DISPLAYf_WIN_ON_TOP</span><span class=cF0>);
<a name="l225"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;win_inhibit=</span><span class=cF3>WIG_NO_FOCUS_TASK_DFT</span><span class=cF0>;
<a name="l226"></a> </span><span class=cF5>Free</span><span class=cF0>(</span><span class=cFB>ac</span><span class=cF0>.cur_word);
<a name="l227"></a> </span><span class=cFB>ac</span><span class=cF0>.cur_word=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l228"></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="l229"></a> </span><span class=cF1>if</span><span class=cF0> (scan_code&amp;</span><span class=cF7>(</span><span class=cF3>SCF_CTRL</span><span class=cF0>|</span><span class=cF3>SCF_ALT</span><span class=cF7>)</span><span class=cF0> ||
<a name="l230"></a> </span><span class=cF5>GetTSC</span><span class=cF0>&gt;</span><span class=cF5>KbdMsEvtTime</span><span class=cF0>+</span><span class=cFB>cnts</span><span class=cF0>.time_stamp_freq&gt;&gt;1) {
<a name="l231"></a> last_scan_code=scan_code;
<a name="l232"></a> scan_code=</span><span class=cFB>kbd</span><span class=cF0>.scan_code;
<a name="l233"></a> }
<a name="l234"></a> original_focus_task=focus_task=</span><span class=cFB>sys_focus_task</span><span class=cF0>;
<a name="l235"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>focus_task</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l236"></a> </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;focus_task-&gt;task_flags,</span><span class=cF3>TASKf_INPUT_FILTER_TASK</span><span class=cF7>)</span><span class=cF0>)
<a name="l237"></a> focus_task=focus_task-&gt;parent_task;
<a name="l238"></a> </span><span class=cF1>if</span><span class=cF0> (scan_code&amp;</span><span class=cF3>SCF_CTRL</span><span class=cF0>)
<a name="l239"></a> </span><span class=cF5>ACTaskCtrl</span><span class=cF0>(scan_code,last_scan_code,focus_task,original_focus_task);
<a name="l240"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>focus_task</span><span class=cF7>)</span><span class=cF0>) {
<a name="l241"></a> </span><span class=cF1>if</span><span class=cF0> (scan_code&amp;</span><span class=cF3>SCF_ALT</span><span class=cF0>)
<a name="l242"></a> </span><span class=cF5>ACTaskAlt</span><span class=cF0>(scan_code,last_scan_code,focus_task,original_focus_task);
<a name="l243"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l244"></a> </span><span class=cF5>ACTaskNormal</span><span class=cF0>(scan_code,last_scan_code,focus_task,original_focus_task);
<a name="l245"></a> }
<a name="l246"></a> </span><span class=cF5>Sleep</span><span class=cF0>(333);
<a name="l247"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>ScanMsg</span><span class=cF7>(</span><span class=cF0>&amp;ch,,1&lt;&lt;</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF7>)</span><span class=cF0> &amp;&amp; </span><span class=cF7>(</span><span class=cF0>ch==</span><span class=cF3>CH_ESC</span><span class=cF0>||ch==</span><span class=cF3>CH_SHIFT_ESC</span><span class=cF7>)</span><span class=cF0>)
<a name="l248"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l249"></a> doc=</span><span class=cF5>DocPut</span><span class=cF0>;
<a name="l250"></a> </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l251"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_entry-&gt;de_flags &amp; </span><span class=cF3>DOCEF_LINK</span><span class=cF0>) {
<a name="l252"></a> </span><span class=cF6>''</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>;
<a name="l253"></a> doc-&gt;cur_entry=doc;
<a name="l254"></a> }
<a name="l255"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l256"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l257"></a>}
<a name="l258"></a>
<a name="l259"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>AutoComplete</span><span class=cF0>(</span><span class=cF1>Bool</span><span class=cF0> val=</span><span class=cF3>OFF</span><span class=cF0>)
<a name="l260"></a>{</span><span class=cF2>//Turn AutoComplete OFF or ON.</span><span class=cF0>
<a name="l261"></a> </span><span class=cF1>Bool</span><span class=cF0> old_val=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l262"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>ac</span><span class=cF0>.flags,</span><span class=cF3>ACf_INIT_IN_PROGRESS</span><span class=cF7>)</span><span class=cF0>)
<a name="l263"></a> </span><span class=cF5>Sleep</span><span class=cF0>(10);
<a name="l264"></a> </span><span class=cF1>if</span><span class=cF0> (val) </span><span class=cF7>{</span><span class=cF0>
<a name="l265"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>sys_run_level</span><span class=cF0>,</span><span class=cF3>RLf_AUTO_COMPLETE</span><span class=cF7>)</span><span class=cF0>) {
<a name="l266"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cFB>ac</span><span class=cF0>.task</span><span class=cF7>)</span><span class=cF0>)
<a name="l267"></a> old_val=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l268"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l269"></a> </span><span class=cFB>ac</span><span class=cF0>.task=</span><span class=cF5>Spawn</span><span class=cF0>(&amp;</span><span class=cF5>ACTask</span><span class=cF0>,</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF6>&quot;AutoComplete&quot;</span><span class=cF0>);
<a name="l270"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(</span><span class=cFB>ac</span><span class=cF0>.task);
<a name="l271"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l272"></a> </span><span class=cF5>WinToTop</span><span class=cF0>(</span><span class=cFB>ac</span><span class=cF0>.task);
<a name="l273"></a> }
<a name="l274"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l275"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cFB>ac</span><span class=cF0>.task</span><span class=cF7>)</span><span class=cF0>) {
<a name="l276"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>sys_run_level</span><span class=cF0>,</span><span class=cF3>RLf_AUTO_COMPLETE</span><span class=cF7>)</span><span class=cF0>)
<a name="l277"></a> old_val=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l278"></a> </span><span class=cF5>Kill</span><span class=cF0>(</span><span class=cFB>ac</span><span class=cF0>.task);
<a name="l279"></a> </span><span class=cF5>DeathWait</span><span class=cF0>(&amp;</span><span class=cFB>ac</span><span class=cF0>.task);
<a name="l280"></a> }
<a name="l281"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l282"></a> </span><span class=cF1>return</span><span class=cF0> old_val;
<a name="l283"></a>}
</span></pre></body>
</html>