templeos-info/public/Wb/Home/Src/Kernel/KHashB.HC.HTML

282 lines
31 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=cF9>I64</span><span class=cF0> </span><span class=cF5>HashTypeNum</span><span class=cF0>(</span><span class=cF9>CHash</span><span class=cF0> *tmph)
<a name="l2"></a>{</span><span class=cF2>//Return bit num of hash type, limited to just types.</span><span class=cF0>
<a name="l3"></a> </span><span class=cF1>if</span><span class=cF0> (tmph)
<a name="l4"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>Bsf</span><span class=cF0>(tmph-&gt;type&amp;</span><span class=cF3>HTG_TYPE_MASK</span><span class=cF0>);
<a name="l5"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l6"></a> </span><span class=cF1>return</span><span class=cF0> -1;
<a name="l7"></a>}
<a name="l8"></a>
<a name="l9"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>HashVal</span><span class=cF0>(</span><span class=cF9>CHash</span><span class=cF0> *tmph)
<a name="l10"></a>{</span><span class=cF2>//Returns most likely desired value.</span><span class=cF0>
<a name="l11"></a> </span><span class=cF1>switch</span><span class=cF0> [</span><span class=cF5>HashTypeNum</span><span class=cF0>(tmph)] </span><span class=cF7>{</span><span class=cF0>
<a name="l12"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_EXPORT_SYS_SYM</span><span class=cF0>:
<a name="l13"></a> </span><span class=cF1>return</span><span class=cF0> tmph(</span><span class=cF9>CHashExport</span><span class=cF0> *)-&gt;val;
<a name="l14"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_IMPORT_SYS_SYM</span><span class=cF0>:
<a name="l15"></a> </span><span class=cF1>return</span><span class=cF0> tmph(</span><span class=cF9>CHashImport</span><span class=cF0> *)-&gt;module_base;
<a name="l16"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_DEFINE_STR</span><span class=cF0>:
<a name="l17"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_CLASS</span><span class=cF0>:
<a name="l18"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_INTERNAL_TYPE</span><span class=cF0>:
<a name="l19"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_WORD</span><span class=cF0>:
<a name="l20"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_DICT_WORD</span><span class=cF0>:
<a name="l21"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_OPCODE</span><span class=cF0>:
<a name="l22"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_HELP_FILE</span><span class=cF0>:
<a name="l23"></a> </span><span class=cF1>return</span><span class=cF0> tmph;
<a name="l24"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_GLBL_VAR</span><span class=cF0>:
<a name="l25"></a> </span><span class=cF1>if</span><span class=cF0> (tmph</span><span class=cF7>(</span><span class=cF9>CHashGlblVar</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>-&gt;flags&amp;</span><span class=cF3>GVF_EXTERN</span><span class=cF0>)
<a name="l26"></a> </span><span class=cF1>return</span><span class=cF0> &amp;tmph(</span><span class=cF9>CHashGlblVar</span><span class=cF0> *)-&gt;data_addr;
<a name="l27"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l28"></a> </span><span class=cF1>return</span><span class=cF0> tmph(</span><span class=cF9>CHashGlblVar</span><span class=cF0> *)-&gt;data_addr;
<a name="l29"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_FUN</span><span class=cF0>:
<a name="l30"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;tmph(</span><span class=cF9>CHashFun</span><span class=cF0> *)-&gt;flags,</span><span class=cF3>Cf_EXTERN</span><span class=cF7>)</span><span class=cF0>)
<a name="l31"></a> </span><span class=cF1>return</span><span class=cF0> tmph;
<a name="l32"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l33"></a> </span><span class=cF1>return</span><span class=cF0> tmph(</span><span class=cF9>CHashFun</span><span class=cF0> *)-&gt;exe_addr;
<a name="l34"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_REG</span><span class=cF0>:
<a name="l35"></a> </span><span class=cF1>return</span><span class=cF0> tmph(</span><span class=cF9>CHashReg</span><span class=cF0> *)-&gt;reg_num|tmph(</span><span class=cF9>CHashReg</span><span class=cF0> *)-&gt;reg_type&lt;&lt;8;
<a name="l36"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_KEYWORD</span><span class=cF0>:
<a name="l37"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_ASM_KEYWORD</span><span class=cF0>:
<a name="l38"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_MODULE</span><span class=cF0>:
<a name="l39"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_FILE</span><span class=cF0>:
<a name="l40"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_FRAME_PTR</span><span class=cF0>:
<a name="l41"></a> </span><span class=cF1>return</span><span class=cF0> tmph(</span><span class=cF9>CHashGeneric</span><span class=cF0> *)-&gt;user_data0;
<a name="l42"></a>
<a name="l43"></a> </span><span class=cF1>case</span><span class=cF0> -1: </span><span class=cF2>//nobound switch</span><span class=cF0>
<a name="l44"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_TYPES_NUM</span><span class=cF0>: </span><span class=cF2>//nobound switch</span><span class=cF0>
<a name="l45"></a> </span><span class=cF1>default</span><span class=cF0>:
<a name="l46"></a> </span><span class=cF1>return</span><span class=cF0> 0;
<a name="l47"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l48"></a>}
<a name="l49"></a>
<a name="l50"></a></span><span class=cF9>CHashTable</span><span class=cF0> *</span><span class=cF5>HashTableNew</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> size,</span><span class=cF9>CTask</span><span class=cF0> *mem_task=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l51"></a>{</span><span class=cF2>//New hash table, power-of-two in size.</span><span class=cF0>
<a name="l52"></a> </span><span class=cF9>CHashTable</span><span class=cF0> *table;
<a name="l53"></a> table=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashTable</span><span class=cF7>)</span><span class=cF0>,mem_task);
<a name="l54"></a> table-&gt;body=</span><span class=cF5>CAlloc</span><span class=cF0>(size&lt;&lt;3,mem_task);
<a name="l55"></a> table-&gt;mask=size-1;
<a name="l56"></a> </span><span class=cF1>return</span><span class=cF0> table;
<a name="l57"></a>}
<a name="l58"></a>
<a name="l59"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>HashDel</span><span class=cF0>(</span><span class=cF9>CHashSrcSym</span><span class=cF0> *tmph)
<a name="l60"></a>{</span><span class=cF2>//Free a std TempleOS system hash entry.</span><span class=cF0>
<a name="l61"></a> </span><span class=cF1>if</span><span class=cF0> (!tmph) </span><span class=cF1>return</span><span class=cF0>;
<a name="l62"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmph-&gt;type&amp;</span><span class=cF3>HTT_DICT_WORD</span><span class=cF7>)</span><span class=cF0>)
<a name="l63"></a> </span><span class=cF5>Free</span><span class=cF0>(tmph-&gt;str);
<a name="l64"></a> </span><span class=cF1>if</span><span class=cF0> (tmph-&gt;type &amp; </span><span class=cF3>HTG_SRC_SYM</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l65"></a> </span><span class=cF5>Free</span><span class=cF0>(tmph-&gt;src_link);
<a name="l66"></a> </span><span class=cF5>Free</span><span class=cF0>(tmph-&gt;idx);
<a name="l67"></a> </span><span class=cF5>Free</span><span class=cF0>(tmph-&gt;import_name);
<a name="l68"></a> </span><span class=cF5>LinkedLstDel</span><span class=cF0>(tmph-&gt;ie_lst);
<a name="l69"></a> </span><span class=cF1>if</span><span class=cF0> (tmph-&gt;type &amp; </span><span class=cF7>(</span><span class=cF3>HTT_FUN</span><span class=cF0> | </span><span class=cF3>HTT_EXPORT_SYS_SYM</span><span class=cF7>)</span><span class=cF0>)
<a name="l70"></a> </span><span class=cF5>Free</span><span class=cF0>(tmph-&gt;dbg_info);
<a name="l71"></a> </span><span class=cF1>if</span><span class=cF0> (tmph-&gt;type &amp; </span><span class=cF7>(</span><span class=cF3>HTT_FUN</span><span class=cF0> | </span><span class=cF3>HTT_CLASS</span><span class=cF7>)</span><span class=cF0>)
<a name="l72"></a></span><span class=cF2>//Assumes code not on heap, so doesn't Free.</span><span class=cF0>
<a name="l73"></a> </span><span class=cF2>//</span><a href="/Wb/Compiler/LexLib.HC.HTML#l209"><span class=cF4>ClassMemberLstDel</span></a><span class=cF2>() is an import to the Kernel module</span><span class=cF0>
<a name="l74"></a> </span><span class=cF5>ClassMemberLstDel</span><span class=cF0>(tmph);
<a name="l75"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmph-&gt;type&amp;</span><span class=cF3>HTT_DEFINE_STR</span><span class=cF0>)
<a name="l76"></a> </span><span class=cF5>Free</span><span class=cF0>(tmph</span><span class=cF7>(</span><span class=cF9>CHashDefineStr</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>-&gt;data);
<a name="l77"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmph-&gt;type &amp; </span><span class=cF3>HTT_GLBL_VAR</span><span class=cF0>) {
<a name="l78"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmph(</span><span class=cF9>CHashGlblVar</span><span class=cF0> *)-&gt;flags&amp;</span><span class=cF3>GVF_ALIAS</span><span class=cF7>)</span><span class=cF0>)
<a name="l79"></a> </span><span class=cF5>Free</span><span class=cF0>(tmph</span><span class=cF7>(</span><span class=cF9>CHashGlblVar</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>-&gt;data_addr);
<a name="l80"></a> </span><span class=cF5>LinkedLstDel</span><span class=cF0>(tmph</span><span class=cF7>(</span><span class=cF9>CHashGlblVar</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>-&gt;dim.next);
<a name="l81"></a> </span><span class=cF1>if</span><span class=cF0> (tmph</span><span class=cF7>(</span><span class=cF9>CHashGlblVar</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>-&gt;fun_ptr)
<a name="l82"></a> </span><span class=cF5>HashDel</span><span class=cF0>(tmph</span><span class=cF7>(</span><span class=cF9>CHashGlblVar</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>-&gt;fun_ptr
<a name="l83"></a> -tmph</span><span class=cF7>(</span><span class=cF9>CHashGlblVar</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>-&gt;fun_ptr-&gt;ptr_stars_cnt);
<a name="l84"></a> }
<a name="l85"></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> (tmph-&gt;type &amp; </span><span class=cF3>HTT_FILE</span><span class=cF0>)
<a name="l86"></a> </span><span class=cF5>Free</span><span class=cF0>(tmph</span><span class=cF7>(</span><span class=cF9>CHashGeneric</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>-&gt;user_data0);
<a name="l87"></a> </span><span class=cF5>Free</span><span class=cF0>(tmph);
<a name="l88"></a>}
<a name="l89"></a>
<a name="l90"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>HashTableDel</span><span class=cF0>(</span><span class=cF9>CHashTable</span><span class=cF0> *table)
<a name="l91"></a>{</span><span class=cF2>//Free std system hash table, calling </span><a href="/Wb/Kernel/KHashB.HC.HTML#l59"><span class=cF4>HashDel</span></a><span class=cF2>() on entries.</span><span class=cF0>
<a name="l92"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l93"></a> </span><span class=cF9>CHashSrcSym</span><span class=cF0> *tmph,*tmph1;
<a name="l94"></a> </span><span class=cF1>if</span><span class=cF0> (!table) </span><span class=cF1>return</span><span class=cF0>;
<a name="l95"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;=table-&gt;mask;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l96"></a> tmph=table-&gt;body[i];
<a name="l97"></a> </span><span class=cF1>while</span><span class=cF0> (tmph) {
<a name="l98"></a> tmph1=tmph-&gt;next;
<a name="l99"></a> </span><span class=cF5>HashDel</span><span class=cF0>(tmph);
<a name="l100"></a> tmph=tmph1;
<a name="l101"></a> }
<a name="l102"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l103"></a> </span><span class=cF5>Free</span><span class=cF0>(table-&gt;body);
<a name="l104"></a> </span><span class=cF5>Free</span><span class=cF0>(table);
<a name="l105"></a>}
<a name="l106"></a>
<a name="l107"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>HashTablePurge</span><span class=cF0>(</span><span class=cF9>CHashTable</span><span class=cF0> *table)
<a name="l108"></a>{</span><span class=cF2>//Eliminate ExportSysSyms that have been usurped.</span><span class=cF0>
<a name="l109"></a> </span><span class=cF9>I64</span><span class=cF0> i,res=0;
<a name="l110"></a> </span><span class=cF9>CHashSrcSym</span><span class=cF0> *tmph,*tmph1,*tmph2;
<a name="l111"></a> </span><span class=cF1>if</span><span class=cF0> (!table) </span><span class=cF1>return</span><span class=cF0> 0;
<a name="l112"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
<a name="l113"></a> </span><span class=cF1>CLI</span><span class=cF0> </span><span class=cF2>//Precaution</span><span class=cF0>
<a name="l114"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;=table-&gt;mask;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l115"></a> tmph=table-&gt;body[i];
<a name="l116"></a> </span><span class=cF1>while</span><span class=cF0> (tmph) {
<a name="l117"></a> tmph1=tmph-&gt;next; </span><span class=cF2>//We delete only older ones</span><span class=cF0>
<a name="l118"></a> </span><span class=cF1>if</span><span class=cF0> (tmph-&gt;type&amp;</span><span class=cF7>(</span><span class=cF3>HTT_FUN</span><span class=cF0>|</span><span class=cF3>HTT_GLBL_VAR</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l119"></a> tmph2=tmph-&gt;next; </span><span class=cF2>//Older always later in chain</span><span class=cF0>
<a name="l120"></a> </span><span class=cF1>while</span><span class=cF0> (tmph2) {
<a name="l121"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>tmph2-&gt;type&amp;</span><span class=cF3>HTT_EXPORT_SYS_SYM</span><span class=cF0> ||
<a name="l122"></a> tmph2-&gt;type&amp;</span><span class=cF3>HTG_TYPE_MASK</span><span class=cF0>==</span><span class=cF3>HTT_INVALID</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l123"></a> !</span><span class=cF5>StrCmp</span><span class=cF7>(</span><span class=cF0>tmph2-&gt;str,tmph-&gt;str</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l124"></a> </span><span class=cF1>if</span><span class=cF0> (tmph2-&gt;type&amp;</span><span class=cF3>HTG_TYPE_MASK</span><span class=cF0>==</span><span class=cF3>HTT_INVALID</span><span class=cF0>)
<a name="l125"></a> tmph2-&gt;type=</span><span class=cF3>HTT_KEYWORD</span><span class=cF0>;</span><span class=cF2>//Won't delete HTT_INVALID</span><span class=cF0>
<a name="l126"></a> </span><span class=cF5>HashRemDel</span><span class=cF0>(tmph2,table);
<a name="l127"></a> res++;
<a name="l128"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l129"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l130"></a> tmph2=tmph2-&gt;next;
<a name="l131"></a> }
<a name="l132"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l133"></a> tmph=tmph1;
<a name="l134"></a> }
<a name="l135"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l136"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l137"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l138"></a>}
<a name="l139"></a>
<a name="l140"></a></span><span class=cF9>CHashGeneric</span><span class=cF0> *</span><span class=cF5>HashGenericAdd</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *name,</span><span class=cF9>I64</span><span class=cF0> type,
<a name="l141"></a> </span><span class=cF9>I64</span><span class=cF0> u0=0,</span><span class=cF9>I64</span><span class=cF0> u1=0,</span><span class=cF9>I64</span><span class=cF0> u2=0,</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l142"></a>{</span><span class=cF2>//Add any type to task hash_table, 3 user_data values.</span><span class=cF0>
<a name="l143"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
<a name="l144"></a> </span><span class=cF9>CHashGeneric</span><span class=cF0> *res=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashGeneric</span><span class=cF7>)</span><span class=cF0>,task);
<a name="l145"></a> res-&gt;type=type;
<a name="l146"></a> res-&gt;user_data0=u0;
<a name="l147"></a> res-&gt;user_data1=u1;
<a name="l148"></a> res-&gt;user_data2=u2;
<a name="l149"></a> res-&gt;str=</span><span class=cF5>StrNew</span><span class=cF0>(name,task);
<a name="l150"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(res,task-&gt;hash_table);
<a name="l151"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l152"></a>}
<a name="l153"></a>
<a name="l154"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>HashSrcFileSet</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>CHashSrcSym</span><span class=cF0> *h,</span><span class=cF9>I64</span><span class=cF0> line_num_offset=0)
<a name="l155"></a>{</span><span class=cF2>//Set </span><a href="/Wb/Kernel/KernelA.HH.HTML#l728"><span class=cF4>CHashSrcSym</span></a><span class=cF2> link and help_index by cur cc pos.</span><span class=cF0>
<a name="l156"></a> </span><span class=cF9>CLexFile</span><span class=cF0> *tmpf=cc-&gt;lex_include_stk;
<a name="l157"></a> </span><span class=cF9>I64</span><span class=cF0> line_num=tmpf-&gt;line_num+line_num_offset;
<a name="l158"></a> </span><span class=cF1>if</span><span class=cF0> (line_num&lt;1) line_num=1;
<a name="l159"></a> </span><span class=cF5>Free</span><span class=cF0>(h-&gt;src_link);
<a name="l160"></a> h-&gt;src_link=</span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;FL:%s,%d&quot;</span><span class=cF0>,tmpf-&gt;full_name,line_num);
<a name="l161"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;cc-&gt;opts,</span><span class=cF3>OPTf_KEEP_PRIVATE</span><span class=cF7>)</span><span class=cF0>)
<a name="l162"></a> h-&gt;type|=</span><span class=cF3>HTF_PRIVATE</span><span class=cF0>;
<a name="l163"></a> </span><span class=cF5>Free</span><span class=cF0>(h-&gt;idx);
<a name="l164"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;cur_help_idx &amp;&amp; *cc-&gt;cur_help_idx)
<a name="l165"></a> h-&gt;idx=</span><span class=cF5>StrNew</span><span class=cF0>(cc-&gt;cur_help_idx);
<a name="l166"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l167"></a> h-&gt;idx=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l168"></a>}
<a name="l169"></a>
<a name="l170"></a></span><span class=cF9>CHashGeneric</span><span class=cF0> *</span><span class=cF5>HashPublic</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *st,</span><span class=cF9>I64</span><span class=cF0> mask,</span><span class=cF1>Bool</span><span class=cF0> val=</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l171"></a>{</span><span class=cF2>//Mark a hash entry as public and </span><a href="/Wb/Kernel/KHashB.HC.HTML#l154"><span class=cF4>HashSrcFileSet</span></a><span class=cF2>().</span><span class=cF0>
<a name="l172"></a> </span><span class=cF9>CHashGeneric</span><span class=cF0> *res;
<a name="l173"></a> </span><span class=cF1>if</span><span class=cF0> (res=</span><span class=cF5>HashFind</span><span class=cF7>(</span><span class=cF0>st,</span><span class=cF5>Fs</span><span class=cF0>-&gt;hash_table,mask</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l174"></a> </span><span class=cF1>if</span><span class=cF0> (val)
<a name="l175"></a> res-&gt;type|=</span><span class=cF3>HTF_PUBLIC</span><span class=cF0>;
<a name="l176"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l177"></a> res-&gt;type&amp;=~</span><span class=cF3>HTF_PUBLIC</span><span class=cF0>;
<a name="l178"></a> </span><span class=cF1>if</span><span class=cF0> (res-&gt;type&amp;</span><span class=cF3>HTG_SRC_SYM</span><span class=cF0>)
<a name="l179"></a> </span><span class=cF5>HashSrcFileSet</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;last_cc,res);
<a name="l180"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l181"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l182"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l183"></a>}
<a name="l184"></a>
<a name="l185"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>HashLstAdd</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *lst,</span><span class=cF9>I64</span><span class=cF0> type,</span><span class=cF9>CHashTable</span><span class=cF0> *table)
<a name="l186"></a>{</span><span class=cF2>//Add a list to a hash table.</span><span class=cF0>
<a name="l187"></a> </span><span class=cF9>I64</span><span class=cF0> i=0;
<a name="l188"></a> </span><span class=cF9>CHashGeneric</span><span class=cF0> *tmph;
<a name="l189"></a> </span><span class=cF1>if</span><span class=cF0> (lst) </span><span class=cF7>{</span><span class=cF0>
<a name="l190"></a> </span><span class=cF1>while</span><span class=cF0> (*lst) {
<a name="l191"></a> </span><span class=cF1>if</span><span class=cF0> (*lst==</span><span class=cF6>'@'</span><span class=cF0>)
<a name="l192"></a> lst++;
<a name="l193"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l194"></a> i++;
<a name="l195"></a> tmph=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashGeneric</span><span class=cF7>)</span><span class=cF0>);
<a name="l196"></a> tmph-&gt;user_data0=i-1;
<a name="l197"></a> tmph-&gt;str=</span><span class=cF5>StrNew</span><span class=cF0>(lst);
<a name="l198"></a> tmph-&gt;type=type;
<a name="l199"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmph,table);
<a name="l200"></a> </span><span class=cF1>while</span><span class=cF0> (*lst++);
<a name="l201"></a> }
<a name="l202"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l203"></a> </span><span class=cF1>return</span><span class=cF0> i;
<a name="l204"></a>}
<a name="l205"></a>
<a name="l206"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>HashDefineLstAdd</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *dname,</span><span class=cF9>I64</span><span class=cF0> type,</span><span class=cF9>CHashTable</span><span class=cF0> *table)
<a name="l207"></a>{</span><span class=cF2>//Add define list to a hash table. See </span><a href="/Wb/Adam/DolDoc/DocInit.HC.HTML#l23"><span class=cF4>::/Adam/DolDoc/DocInit.HC</span></a><span class=cF2>.</span><span class=cF0>
<a name="l208"></a> </span><span class=cF9>CHashDefineStr</span><span class=cF0> *tmph;
<a name="l209"></a> </span><span class=cF1>if</span><span class=cF0> (tmph=</span><span class=cF5>HashFind</span><span class=cF7>(</span><span class=cF0>dname,</span><span class=cF5>Fs</span><span class=cF0>-&gt;hash_table,</span><span class=cF3>HTT_DEFINE_STR</span><span class=cF7>)</span><span class=cF0>)
<a name="l210"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>HashLstAdd</span><span class=cF0>(tmph-&gt;data,type,table);
<a name="l211"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l212"></a> </span><span class=cF1>return</span><span class=cF0> 0;
<a name="l213"></a>}
<a name="l214"></a>
<a name="l215"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>FramePtr</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *name,</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l216"></a>{</span><span class=cF2>//Find entry in task-&gt;hash_table, Return user_data.</span><span class=cF0>
<a name="l217"></a> </span><span class=cF9>CHashGeneric</span><span class=cF0> *tmph;
<a name="l218"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
<a name="l219"></a> </span><span class=cF1>if</span><span class=cF0> (tmph=</span><span class=cF5>HashFind</span><span class=cF7>(</span><span class=cF0>name,task-&gt;hash_table,</span><span class=cF3>HTT_FRAME_PTR</span><span class=cF7>)</span><span class=cF0>)
<a name="l220"></a> </span><span class=cF1>return</span><span class=cF0> tmph-&gt;user_data0;
<a name="l221"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l222"></a> </span><span class=cF1>return</span><span class=cF0> 0;
<a name="l223"></a>}
<a name="l224"></a>
<a name="l225"></a></span><span class=cF9>CHashGeneric</span><span class=cF0> *</span><span class=cF5>FramePtrAdd</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *name,</span><span class=cF9>I64</span><span class=cF0> val=0,</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l226"></a>{</span><span class=cF2>//Add named value to task-&gt;hash_table.</span><span class=cF0>
<a name="l227"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>HashGenericAdd</span><span class=cF0>(name,</span><span class=cF3>HTT_FRAME_PTR</span><span class=cF0>,val,0,0,task);
<a name="l228"></a>}
<a name="l229"></a>
<a name="l230"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>FramePtrSet</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *name,</span><span class=cF9>I64</span><span class=cF0> val,</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l231"></a>{</span><span class=cF2>//Find hash entry in task-&gt;hash_table. Change user_data0.</span><span class=cF0>
<a name="l232"></a> </span><span class=cF9>CHashGeneric</span><span class=cF0> *tmph;
<a name="l233"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
<a name="l234"></a> </span><span class=cF1>if</span><span class=cF0> (tmph=</span><span class=cF5>HashFind</span><span class=cF7>(</span><span class=cF0>name,task-&gt;hash_table,</span><span class=cF3>HTT_FRAME_PTR</span><span class=cF7>)</span><span class=cF0>)
<a name="l235"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>LXchgI64</span><span class=cF0>(&amp;tmph-&gt;user_data0,val);
<a name="l236"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l237"></a> </span><span class=cF1>return</span><span class=cF0> 0;
<a name="l238"></a>}
<a name="l239"></a>
<a name="l240"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>FramePtrDel</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *name,</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l241"></a>{</span><span class=cF2>//Remove entry and delete.</span><span class=cF0>
<a name="l242"></a> </span><span class=cF9>CHashGeneric</span><span class=cF0> *tmph;
<a name="l243"></a> </span><span class=cF9>I64</span><span class=cF0> res=0;
<a name="l244"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
<a name="l245"></a> </span><span class=cF1>if</span><span class=cF0> (tmph=</span><span class=cF5>HashFind</span><span class=cF7>(</span><span class=cF0>name,task-&gt;hash_table,</span><span class=cF3>HTT_FRAME_PTR</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l246"></a> res=tmph-&gt;user_data0;
<a name="l247"></a> </span><span class=cF5>HashRemDel</span><span class=cF0>(tmph,task-&gt;hash_table);
<a name="l248"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l249"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l250"></a>}
</span></pre></body>
</html>