ZealOS/docs/Kernel/KDefine.CC.html
2021-10-27 03:28:16 -04:00

413 lines
44 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.04">
<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=cF9>CHashDefineStr</span><span class=cF0> *</span><span class=cF5>DefineLoad</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *dname, </span><span class=cF1>U8</span><span class=cF0> *st, </span><span class=cF9>I64</span><span class=cF0> caller_num=</span><span class=cFE>1</span><span class=cF0>)
<a name="l2"></a>{</span><span class=cF2>//Create DEFINE hash entry with string.</span><span class=cF0>
<a name="l3"></a> </span><span class=cF9>CHashDefineStr</span><span class=cF0> *tmph = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashDefineStr</span><span class=cF7>)</span><span class=cF0>);
<a name="l4"></a>
<a name="l5"></a> tmph-&gt;type = </span><span class=cF3>HTT_DEFINE_STR</span><span class=cF0>;
<a name="l6"></a> tmph-&gt;str = </span><span class=cF5>StrNew</span><span class=cF0>(dname);
<a name="l7"></a> tmph-&gt;data = </span><span class=cF5>StrNew</span><span class=cF0>(st);
<a name="l8"></a> tmph-&gt;count = -</span><span class=cFE>1</span><span class=cF0>;
<a name="l9"></a> tmph-&gt;src_link = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;AD:0x%X&quot;</span><span class=cF0>, </span><span class=cF5>Caller</span><span class=cF7>(</span><span class=cF0>caller_num</span><span class=cF7>)</span><span class=cF0>);
<a name="l10"></a>
<a name="l11"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmph, </span><span class=cF5>Fs</span><span class=cF0>-&gt;hash_table);
<a name="l12"></a>
<a name="l13"></a> </span><span class=cF1>return</span><span class=cF0> tmph;
<a name="l14"></a>}
<a name="l15"></a>
<a name="l16"></a></span><span class=cF9>CHashDefineStr</span><span class=cF0> *</span><span class=cF5>DefineListLoad</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *dname, </span><span class=cF1>U8</span><span class=cF0> *list)
<a name="l17"></a>{</span><span class=cF2>//Create DEFINE list. Not efficient, but handy.</span><span class=cF0>
<a name="l18"></a> </span><span class=cF9>I64</span><span class=cF0> count = </span><span class=cFE>0</span><span class=cF0>;
<a name="l19"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr, **idx;
<a name="l20"></a> </span><span class=cF9>CHashDefineStr</span><span class=cF0> *tmph = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashDefineStr</span><span class=cF7>)</span><span class=cF0>);
<a name="l21"></a>
<a name="l22"></a> tmph-&gt;type = </span><span class=cF3>HTT_DEFINE_STR</span><span class=cF0>;
<a name="l23"></a> tmph-&gt;str = </span><span class=cF5>StrNew</span><span class=cF0>(dname);
<a name="l24"></a> tmph-&gt;src_link = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;AD:0x%X&quot;</span><span class=cF0>, </span><span class=cF5>Caller</span><span class=cF0>);
<a name="l25"></a>
<a name="l26"></a> ptr = list;
<a name="l27"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr)
<a name="l28"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l29"></a> </span><span class=cF1>if</span><span class=cF0> (*ptr != </span><span class=cF6>'@'</span><span class=cF0>)
<a name="l30"></a> count++;
<a name="l31"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr++);
<a name="l32"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l33"></a> tmph-&gt;data = </span><span class=cF5>MAlloc</span><span class=cF0>(ptr + </span><span class=cFE>1</span><span class=cF0> - list);
<a name="l34"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(tmph-&gt;data, list, ptr + </span><span class=cFE>1</span><span class=cF0> - list);
<a name="l35"></a> tmph-&gt;count = count;
<a name="l36"></a>
<a name="l37"></a> idx = tmph-&gt;sub_idx = </span><span class=cF5>MAlloc</span><span class=cF0>(count * </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>);
<a name="l38"></a> ptr = list;
<a name="l39"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr)
<a name="l40"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l41"></a> </span><span class=cF1>if</span><span class=cF0> (*ptr != </span><span class=cF6>'@'</span><span class=cF0>)
<a name="l42"></a> *idx++ = ptr;
<a name="l43"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr++);
<a name="l44"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l45"></a>
<a name="l46"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmph, </span><span class=cF5>Fs</span><span class=cF0>-&gt;hash_table);
<a name="l47"></a>
<a name="l48"></a> </span><span class=cF1>return</span><span class=cF0> tmph;
<a name="l49"></a>}
<a name="l50"></a>
<a name="l51"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>UndefinedDefine</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *dname)
<a name="l52"></a>{
<a name="l53"></a> </span><span class=cF3>ST_ERR_ST</span><span class=cF0> </span><span class=cF6>&quot;Undefined Define: '%s'.\n&quot;</span><span class=cF0>, dname;
<a name="l54"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'UndefDef'</span><span class=cF0>);
<a name="l55"></a>}
<a name="l56"></a>
<a name="l57"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>Define</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *dname)
<a name="l58"></a>{</span><span class=cF2>//Look for DEFINE named in hash table, return pointer string.</span><span class=cF0>
<a name="l59"></a> </span><span class=cF9>CHashDefineStr</span><span class=cF0> *tmph;
<a name="l60"></a>
<a name="l61"></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="l62"></a> </span><span class=cF1>return</span><span class=cF0> tmph-&gt;data;
<a name="l63"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (dname)
<a name="l64"></a> </span><span class=cFD>UndefinedDefine</span><span class=cF0>(dname);
<a name="l65"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l66"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l67"></a>}
<a name="l68"></a>
<a name="l69"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>DefineSub</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> sub, </span><span class=cF1>U8</span><span class=cF0> *dname)
<a name="l70"></a>{</span><span class=cF2>//Return DEFINE list entry indexed by number.</span><span class=cF0>
<a name="l71"></a> </span><span class=cF9>CHashDefineStr</span><span class=cF0> *tmph;
<a name="l72"></a>
<a name="l73"></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="l74"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l75"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> &lt;= sub &lt; tmph-&gt;count)
<a name="l76"></a> </span><span class=cF1>return</span><span class=cF0> tmph-&gt;sub_idx[sub];
<a name="l77"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l78"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l79"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l80"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (dname)
<a name="l81"></a> </span><span class=cFD>UndefinedDefine</span><span class=cF0>(dname);
<a name="l82"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l83"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l84"></a>}
<a name="l85"></a>
<a name="l86"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>DefineCount</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *dname)
<a name="l87"></a>{</span><span class=cF2>//Return count of entries in define list.</span><span class=cF0>
<a name="l88"></a> </span><span class=cF9>CHashDefineStr</span><span class=cF0> *tmph;
<a name="l89"></a>
<a name="l90"></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="l91"></a> </span><span class=cF1>return</span><span class=cF0> tmph-&gt;count;
<a name="l92"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (dname)
<a name="l93"></a> </span><span class=cFD>UndefinedDefine</span><span class=cF0>(dname);
<a name="l94"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l95"></a> </span><span class=cF1>return</span><span class=cF0> -</span><span class=cFE>1</span><span class=cF0>;
<a name="l96"></a>}
<a name="l97"></a>
<a name="l98"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>DefineMatch</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *needle, </span><span class=cF1>U8</span><span class=cF0> *haystack_list_dname, </span><span class=cF9>I64</span><span class=cF0> flags=</span><span class=cFE>0</span><span class=cF0>)
<a name="l99"></a>{</span><span class=cF2>//Find match for string in define list.</span><span class=cF0>
<a name="l100"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>ListMatch</span><span class=cF0>(needle, </span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF0>haystack_list_dname</span><span class=cF7>)</span><span class=cF0>, flags);
<a name="l101"></a>}
<a name="l102"></a>
<a name="l103"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DefinePrint</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *dname, </span><span class=cF1>U8</span><span class=cF0> *src, ...)
<a name="l104"></a>{</span><span class=cF2>//Create DEFINE entry with </span><a href="https://zeal-operating-system.github.io/ZealOS/Doc/Print.DD.html#l1"><span class=cF4>Print</span></a><span class=cF2>()ed string.</span><span class=cF0>
<a name="l105"></a> </span><span class=cF1>U8</span><span class=cF0> *buf = </span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>, src, argc, argv);
<a name="l106"></a>
<a name="l107"></a> </span><span class=cF5>DefineLoad</span><span class=cF0>(dname, buf, </span><span class=cFE>2</span><span class=cF0>);
<a name="l108"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l109"></a>}
<a name="l110"></a>
<a name="l111"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>SysDefinesLoad</span><span class=cF0>()
<a name="l112"></a>{
<a name="l113"></a> </span><span class=cF5>DefineListLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_OFF_ON&quot;</span><span class=cF0>,
<a name="l114"></a> </span><span class=cF6>&quot;Off\0&quot;</span><span class=cF0>
<a name="l115"></a> </span><span class=cF6>&quot;On&quot;</span><span class=cF0>);
<a name="l116"></a>
<a name="l117"></a> </span><span class=cF5>DefineListLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_FALSE_TRUE&quot;</span><span class=cF0>,
<a name="l118"></a> </span><span class=cF6>&quot;False\0&quot;</span><span class=cF0>
<a name="l119"></a> </span><span class=cF6>&quot;True&quot;</span><span class=cF0>);
<a name="l120"></a>
<a name="l121"></a> </span><span class=cF5>DefineListLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_HTT_TYPES&quot;</span><span class=cF0>,
<a name="l122"></a> </span><span class=cF6>&quot;ExportSysSym\0&quot;</span><span class=cF0>
<a name="l123"></a> </span><span class=cF6>&quot;ImportSysSym\0&quot;</span><span class=cF0>
<a name="l124"></a> </span><span class=cF6>&quot;DefineStr\0&quot;</span><span class=cF0>
<a name="l125"></a> </span><span class=cF6>&quot;GlbVar\0&quot;</span><span class=cF0>
<a name="l126"></a> </span><span class=cF6>&quot;Class\0&quot;</span><span class=cF0>
<a name="l127"></a> </span><span class=cF6>&quot;IntType\0&quot;</span><span class=cF0>
<a name="l128"></a> </span><span class=cF6>&quot;Funct\0&quot;</span><span class=cF0>
<a name="l129"></a> </span><span class=cF6>&quot;Word\0&quot;</span><span class=cF0>
<a name="l130"></a> </span><span class=cF6>&quot;DictWord\0&quot;</span><span class=cF0>
<a name="l131"></a> </span><span class=cF6>&quot;KeyWord\0&quot;</span><span class=cF0>
<a name="l132"></a> </span><span class=cF6>&quot;AsmKeyWord\0&quot;</span><span class=cF0>
<a name="l133"></a> </span><span class=cF6>&quot;OpCode\0&quot;</span><span class=cF0>
<a name="l134"></a> </span><span class=cF6>&quot;Reg\0&quot;</span><span class=cF0>
<a name="l135"></a> </span><span class=cF6>&quot;File\0&quot;</span><span class=cF0>
<a name="l136"></a> </span><span class=cF6>&quot;Module\0&quot;</span><span class=cF0>
<a name="l137"></a> </span><span class=cF6>&quot;HelpFile\0&quot;</span><span class=cF0>
<a name="l138"></a> </span><span class=cF6>&quot;Frame Ptr\0&quot;</span><span class=cF0>
<a name="l139"></a> </span><span class=cF6>&quot; \0 \0 \0 \0 \0 \0&quot;</span><span class=cF0>
<a name="l140"></a> </span><span class=cF6>&quot;Private\0&quot;</span><span class=cF0>
<a name="l141"></a> </span><span class=cF6>&quot;Public\0&quot;</span><span class=cF0>
<a name="l142"></a> </span><span class=cF6>&quot;Export\0&quot;</span><span class=cF0>
<a name="l143"></a> </span><span class=cF6>&quot;Import\0&quot;</span><span class=cF0>
<a name="l144"></a> </span><span class=cF6>&quot;Imm\0&quot;</span><span class=cF0>
<a name="l145"></a> </span><span class=cF6>&quot;Goto\0&quot;</span><span class=cF0>
<a name="l146"></a> </span><span class=cF6>&quot;Res\0&quot;</span><span class=cF0>
<a name="l147"></a> </span><span class=cF6>&quot;Unres\0&quot;</span><span class=cF0>
<a name="l148"></a> </span><span class=cF6>&quot;Local\0&quot;</span><span class=cF0>);
<a name="l149"></a>
<a name="l150"></a> </span><span class=cF5>DefineListLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_DAYS_OF_WEEK&quot;</span><span class=cF0>,
<a name="l151"></a> </span><span class=cF6>&quot;Sunday\0&quot;</span><span class=cF0>
<a name="l152"></a> </span><span class=cF6>&quot;Monday\0&quot;</span><span class=cF0>
<a name="l153"></a> </span><span class=cF6>&quot;Tuesday\0&quot;</span><span class=cF0>
<a name="l154"></a> </span><span class=cF6>&quot;Wednesday\0&quot;</span><span class=cF0>
<a name="l155"></a> </span><span class=cF6>&quot;Thursday\0&quot;</span><span class=cF0>
<a name="l156"></a> </span><span class=cF6>&quot;Friday\0&quot;</span><span class=cF0>
<a name="l157"></a> </span><span class=cF6>&quot;Saturday\0&quot;</span><span class=cF0>);
<a name="l158"></a>
<a name="l159"></a> </span><span class=cF5>DefineListLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_MONTHS&quot;</span><span class=cF0>,
<a name="l160"></a> </span><span class=cF6>&quot;January\0&quot;</span><span class=cF0>
<a name="l161"></a> </span><span class=cF6>&quot;February\0&quot;</span><span class=cF0>
<a name="l162"></a> </span><span class=cF6>&quot;March\0&quot;</span><span class=cF0>
<a name="l163"></a> </span><span class=cF6>&quot;April\0&quot;</span><span class=cF0>
<a name="l164"></a> </span><span class=cF6>&quot;May\0&quot;</span><span class=cF0>
<a name="l165"></a> </span><span class=cF6>&quot;June\0&quot;</span><span class=cF0>
<a name="l166"></a> </span><span class=cF6>&quot;July\0&quot;</span><span class=cF0>
<a name="l167"></a> </span><span class=cF6>&quot;August\0&quot;</span><span class=cF0>
<a name="l168"></a> </span><span class=cF6>&quot;September\0&quot;</span><span class=cF0>
<a name="l169"></a> </span><span class=cF6>&quot;October\0&quot;</span><span class=cF0>
<a name="l170"></a> </span><span class=cF6>&quot;November\0&quot;</span><span class=cF0>
<a name="l171"></a> </span><span class=cF6>&quot;December\0&quot;</span><span class=cF0>);
<a name="l172"></a>
<a name="l173"></a> </span><span class=cF5>DefineListLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_FILE_ATTRS&quot;</span><span class=cF0>,
<a name="l174"></a> </span><span class=cF6>&quot;R\0&quot;</span><span class=cF0>
<a name="l175"></a> </span><span class=cF6>&quot;H\0&quot;</span><span class=cF0>
<a name="l176"></a> </span><span class=cF6>&quot;S\0&quot;</span><span class=cF0>
<a name="l177"></a> </span><span class=cF6>&quot;V\0&quot;</span><span class=cF0>
<a name="l178"></a> </span><span class=cF6>&quot;D\0&quot;</span><span class=cF0>
<a name="l179"></a> </span><span class=cF6>&quot;A\0&quot;</span><span class=cF0>
<a name="l180"></a> </span><span class=cF6>&quot; \0&quot;</span><span class=cF0>
<a name="l181"></a> </span><span class=cF6>&quot; \0&quot;</span><span class=cF0>
<a name="l182"></a> </span><span class=cF6>&quot;X\0&quot;</span><span class=cF0>
<a name="l183"></a> </span><span class=cF6>&quot;T\0&quot;</span><span class=cF0>
<a name="l184"></a> </span><span class=cF6>&quot;C\0&quot;</span><span class=cF0>
<a name="l185"></a> </span><span class=cF6>&quot;F\0&quot;</span><span class=cF0>);
<a name="l186"></a>
<a name="l187"></a> </span><span class=cF5>DefineListLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_FILE_UTIL_FLAGS&quot;</span><span class=cF0>,
<a name="l188"></a> </span><span class=cF6>&quot;r\0&quot;</span><span class=cF0>
<a name="l189"></a> </span><span class=cF6>&quot;d\0&quot;</span><span class=cF0>
<a name="l190"></a> </span><span class=cF6>&quot;i\0&quot;</span><span class=cF0>
<a name="l191"></a> </span><span class=cF6>&quot;a\0&quot;</span><span class=cF0>
<a name="l192"></a> </span><span class=cF6>&quot;c\0&quot;</span><span class=cF0>
<a name="l193"></a> </span><span class=cF6>&quot;R\0&quot;</span><span class=cF0>
<a name="l194"></a> </span><span class=cF6>&quot;p\0&quot;</span><span class=cF0>
<a name="l195"></a> </span><span class=cF6>&quot;m\0&quot;</span><span class=cF0>
<a name="l196"></a> </span><span class=cF6>&quot;s\0&quot;</span><span class=cF0>
<a name="l197"></a> </span><span class=cF6>&quot;D\0&quot;</span><span class=cF0>
<a name="l198"></a> </span><span class=cF6>&quot;F\0&quot;</span><span class=cF0>
<a name="l199"></a> </span><span class=cF6>&quot;T\0&quot;</span><span class=cF0>
<a name="l200"></a> </span><span class=cF6>&quot;$\0&quot;</span><span class=cF0>
<a name="l201"></a> </span><span class=cF6>&quot;S\0&quot;</span><span class=cF0>
<a name="l202"></a> </span><span class=cF6>&quot;A\0&quot;</span><span class=cF0>
<a name="l203"></a> </span><span class=cF6>&quot;J\0&quot;</span><span class=cF0>
<a name="l204"></a> </span><span class=cF6>&quot;G\0&quot;</span><span class=cF0>
<a name="l205"></a> </span><span class=cF6>&quot;O\0&quot;</span><span class=cF0>
<a name="l206"></a> </span><span class=cF6>&quot;P\0&quot;</span><span class=cF0>
<a name="l207"></a> </span><span class=cF6>&quot;f\0&quot;</span><span class=cF0>
<a name="l208"></a> </span><span class=cF6>&quot;l\0&quot;</span><span class=cF0>
<a name="l209"></a> </span><span class=cF6>&quot;lb\0&quot;</span><span class=cF0>
<a name="l210"></a> </span><span class=cF6>&quot;la\0&quot;</span><span class=cF0>);
<a name="l211"></a>
<a name="l212"></a> </span><span class=cF5>DefineListLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_BLKDEV_TYPES&quot;</span><span class=cF0>,
<a name="l213"></a> </span><span class=cF6>&quot;NULL\0&quot;</span><span class=cF0>
<a name="l214"></a> </span><span class=cF6>&quot;RAM\0&quot;</span><span class=cF0>
<a name="l215"></a> </span><span class=cF6>&quot;ATA\0&quot;</span><span class=cF0>
<a name="l216"></a> </span><span class=cF6>&quot;FILE_READ\0&quot;</span><span class=cF0>
<a name="l217"></a> </span><span class=cF6>&quot;FILE_WRITE\0&quot;</span><span class=cF0>
<a name="l218"></a> </span><span class=cF6>&quot;ATAPI\0&quot;</span><span class=cF0>);
<a name="l219"></a>
<a name="l220"></a> </span><span class=cF5>DefineListLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_DRIVE_TYPES&quot;</span><span class=cF0>,
<a name="l221"></a> </span><span class=cF6>&quot;NULL\0&quot;</span><span class=cF0>
<a name="l222"></a> </span><span class=cF6>&quot;REDSEA\0&quot;</span><span class=cF0>
<a name="l223"></a> </span><span class=cF6>&quot;FAT32\0&quot;</span><span class=cF0>
<a name="l224"></a> </span><span class=cF6>&quot;ISO9660\0&quot;</span><span class=cF0>
<a name="l225"></a> </span><span class=cF6>&quot;NTFS\0&quot;</span><span class=cF0>
<a name="l226"></a> </span><span class=cF6>&quot;LINUX\0&quot;</span><span class=cF0>
<a name="l227"></a> </span><span class=cF6>&quot;SWAP\0&quot;</span><span class=cF0>
<a name="l228"></a> </span><span class=cF6>&quot;UNKNOWN\0&quot;</span><span class=cF0>);
<a name="l229"></a>
<a name="l230"></a> </span><span class=cF5>DefineListLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_COLORS&quot;</span><span class=cF0>,
<a name="l231"></a> </span><span class=cF6>&quot;BLACK\0&quot;</span><span class=cF0>
<a name="l232"></a> </span><span class=cF6>&quot;BLUE\0&quot;</span><span class=cF0>
<a name="l233"></a> </span><span class=cF6>&quot;GREEN\0&quot;</span><span class=cF0>
<a name="l234"></a> </span><span class=cF6>&quot;CYAN\0&quot;</span><span class=cF0>
<a name="l235"></a> </span><span class=cF6>&quot;RED\0&quot;</span><span class=cF0>
<a name="l236"></a> </span><span class=cF6>&quot;PURPLE\0&quot;</span><span class=cF0>
<a name="l237"></a> </span><span class=cF6>&quot;BROWN\0&quot;</span><span class=cF0>
<a name="l238"></a> </span><span class=cF6>&quot;LTGRAY\0&quot;</span><span class=cF0>
<a name="l239"></a> </span><span class=cF6>&quot;DKGRAY\0&quot;</span><span class=cF0>
<a name="l240"></a> </span><span class=cF6>&quot;LTBLUE\0&quot;</span><span class=cF0>
<a name="l241"></a> </span><span class=cF6>&quot;LTGREEN\0&quot;</span><span class=cF0>
<a name="l242"></a> </span><span class=cF6>&quot;LTCYAN\0&quot;</span><span class=cF0>
<a name="l243"></a> </span><span class=cF6>&quot;LTRED\0&quot;</span><span class=cF0>
<a name="l244"></a> </span><span class=cF6>&quot;LTPURPLE\0&quot;</span><span class=cF0>
<a name="l245"></a> </span><span class=cF6>&quot;YELLOW\0&quot;</span><span class=cF0>
<a name="l246"></a> </span><span class=cF6>&quot;WHITE\0&quot;</span><span class=cF0>);
<a name="l247"></a>
<a name="l248"></a> </span><span class=cF5>DefineListLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_INT_NAMES&quot;</span><span class=cF0>,
<a name="l249"></a> </span><span class=cF6>&quot;Divide Error\0&quot;</span><span class=cF0>
<a name="l250"></a> </span><span class=cF6>&quot;SingleStep\0&quot;</span><span class=cF0>
<a name="l251"></a> </span><span class=cF6>&quot;NMI\0&quot;</span><span class=cF0>
<a name="l252"></a> </span><span class=cF6>&quot;Breakpoint\0&quot;</span><span class=cF0>
<a name="l253"></a> </span><span class=cF6>&quot;Overflow\0&quot;</span><span class=cF0>
<a name="l254"></a> </span><span class=cF6>&quot;BOUND Range Exceeded\0&quot;</span><span class=cF0>
<a name="l255"></a> </span><span class=cF6>&quot;Invalid Opcode\0&quot;</span><span class=cF0>
<a name="l256"></a> </span><span class=cF6>&quot;No Math Coprocessor\0&quot;</span><span class=cF0>
<a name="l257"></a> </span><span class=cF6>&quot;Double Fault\0&quot;</span><span class=cF0>
<a name="l258"></a> </span><span class=cF6>&quot;Coprocessor Segment Fault\0&quot;</span><span class=cF0>
<a name="l259"></a> </span><span class=cF6>&quot;Invalid TASK\0&quot;</span><span class=cF0>
<a name="l260"></a> </span><span class=cF6>&quot;Segment Not Present\0&quot;</span><span class=cF0>
<a name="l261"></a> </span><span class=cF6>&quot;Stack Segment Fault\0&quot;</span><span class=cF0>
<a name="l262"></a> </span><span class=cF6>&quot;General Protection\0&quot;</span><span class=cF0>
<a name="l263"></a> </span><span class=cF6>&quot;Page Fault\0&quot;</span><span class=cF0>
<a name="l264"></a> </span><span class=cF6>&quot; \0&quot;</span><span class=cF0>
<a name="l265"></a> </span><span class=cF6>&quot;Math Fault\0&quot;</span><span class=cF0>
<a name="l266"></a> </span><span class=cF6>&quot;Alignment Check\0&quot;</span><span class=cF0>
<a name="l267"></a> </span><span class=cF6>&quot;Machine Check\0&quot;</span><span class=cF0>
<a name="l268"></a> </span><span class=cF6>&quot;SIMD Exception\0&quot;</span><span class=cF0>
<a name="l269"></a> </span><span class=cF6>&quot; \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0&quot;</span><span class=cF0>
<a name="l270"></a> </span><span class=cF6>&quot; \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0&quot;</span><span class=cF0>
<a name="l271"></a> </span><span class=cF6>&quot;MP Crash\0&quot;</span><span class=cF0>
<a name="l272"></a> </span><span class=cF6>&quot;Wake\0&quot;</span><span class=cF0>
<a name="l273"></a> </span><span class=cF6>&quot;Debug\0&quot;</span><span class=cF0>);
<a name="l274"></a>}
<a name="l275"></a>
<a name="l276"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>Color2Str</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *buf, </span><span class=cF9>CColorROPU32</span><span class=cF0> c)
<a name="l277"></a>{</span><span class=cF2>//</span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l3644"><span class=cF4>CColorROPU32</span></a><span class=cF2> with flags to </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrDC.CC.html#l62"><span class=cF4>DCLighting</span></a><span class=cF2> str.</span><span class=cF0>
<a name="l278"></a> *buf = </span><span class=cFE>0</span><span class=cF0>;
<a name="l279"></a> </span><span class=cF1>if</span><span class=cF0> (c.c0.rop &amp; </span><span class=cF3>ROPBF_TWO_SIDED</span><span class=cF0>)
<a name="l280"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>&quot;TWO|&quot;</span><span class=cF0>);
<a name="l281"></a> </span><span class=cF1>if</span><span class=cF0> (c.c0.rop &amp; </span><span class=cF3>ROPBF_HALF_RANGE_COLOR</span><span class=cF0>)
<a name="l282"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>&quot;HALF|&quot;</span><span class=cF0>);
<a name="l283"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> &lt;= c.c0.color &lt; </span><span class=cFE>16</span><span class=cF0>)
<a name="l284"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF5>DefineSub</span><span class=cF7>(</span><span class=cF0>c.c0.color, </span><span class=cF6>&quot;ST_COLORS&quot;</span><span class=cF7>)</span><span class=cF0>);
<a name="l285"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (c.c0.color == </span><span class=cF3>TRANSPARENT</span><span class=cF0>)
<a name="l286"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>&quot;TRANSPARENT&quot;</span><span class=cF0>);
<a name="l287"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l288"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>&quot;INVALID&quot;</span><span class=cF0>);
<a name="l289"></a> </span><span class=cF1>if</span><span class=cF0> (c &amp; </span><span class=cF3>ROPF_DITHER</span><span class=cF0>)
<a name="l290"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l291"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>&quot;/&quot;</span><span class=cF0>);
<a name="l292"></a> </span><span class=cF1>if</span><span class=cF0> (c.c1.rop &amp; </span><span class=cF3>ROPBF_TWO_SIDED</span><span class=cF0>)
<a name="l293"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>&quot;TWO|&quot;</span><span class=cF0>);
<a name="l294"></a> </span><span class=cF1>if</span><span class=cF0> (c.c1.rop &amp; </span><span class=cF3>ROPBF_HALF_RANGE_COLOR</span><span class=cF0>)
<a name="l295"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>&quot;HALF|&quot;</span><span class=cF0>);
<a name="l296"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> &lt;= c.c1.color &lt; </span><span class=cFE>16</span><span class=cF0>)
<a name="l297"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF5>DefineSub</span><span class=cF7>(</span><span class=cF0>c.c1.color, </span><span class=cF6>&quot;ST_COLORS&quot;</span><span class=cF7>)</span><span class=cF0>);
<a name="l298"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (c.c1.color == </span><span class=cF3>TRANSPARENT</span><span class=cF0>)
<a name="l299"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>&quot;TRANSPARENT&quot;</span><span class=cF0>);
<a name="l300"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l301"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>&quot;INVALID&quot;</span><span class=cF0>);
<a name="l302"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l303"></a>
<a name="l304"></a> </span><span class=cF1>return</span><span class=cF0> buf;
<a name="l305"></a>}
<a name="l306"></a>
<a name="l307"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cFD>str2color_list</span><span class=cF0> = </span><span class=cF6>&quot;/,)}&gt;&quot;</span><span class=cF0>;
<a name="l308"></a>
<a name="l309"></a></span><span class=cF9>CColorROPU16</span><span class=cF0> </span><span class=cF5>Str2ColorU16</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *st)
<a name="l310"></a>{</span><span class=cF2>//</span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrDC.CC.html#l62"><span class=cF4>DCLighting</span></a><span class=cF2> color str with flags to </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l3640"><span class=cF4>CColorROPU16</span></a><span class=cF2>.</span><span class=cF0>
<a name="l311"></a> </span><span class=cF9>CColorROPU16</span><span class=cF0> res = </span><span class=cF3>COLOR_INVALID</span><span class=cF0>;
<a name="l312"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l313"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr, *ptr2, *st2;
<a name="l314"></a>
<a name="l315"></a> </span><span class=cF1>if</span><span class=cF0> (!st)
<a name="l316"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>COLOR_INVALID</span><span class=cF0>;
<a name="l317"></a>
<a name="l318"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l319"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l320"></a> </span><span class=cF1>if</span><span class=cF0> (!*st || </span><span class=cF5>StrOcc</span><span class=cF7>(</span><span class=cFD>str2color_list</span><span class=cF0>, *st</span><span class=cF7>)</span><span class=cF0>)
<a name="l321"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l322"></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</span><span class=cF0>, *st</span><span class=cF7>)</span><span class=cF0>)
<a name="l323"></a> {
<a name="l324"></a> ptr = st;
<a name="l325"></a> </span><span class=cF1>while</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>, *ptr</span><span class=cF7>)</span><span class=cF0>)
<a name="l326"></a> ptr++;
<a name="l327"></a> st2 = ptr2 = </span><span class=cF5>MAlloc</span><span class=cF0>(ptr - st + </span><span class=cFE>1</span><span class=cF0>);
<a name="l328"></a> </span><span class=cF1>while</span><span class=cF0> (st &lt; ptr)
<a name="l329"></a> *ptr2++ = *st++;
<a name="l330"></a> *ptr2++ = </span><span class=cFE>0</span><span class=cF0>;
<a name="l331"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrICompare</span><span class=cF7>(</span><span class=cF0>st2, </span><span class=cF6>&quot;TWO&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l332"></a> res.rop |= </span><span class=cF3>ROPBF_TWO_SIDED</span><span class=cF0>;
<a name="l333"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrICompare</span><span class=cF7>(</span><span class=cF0>st2, </span><span class=cF6>&quot;HALF&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l334"></a> res.rop |= </span><span class=cF3>ROPBF_HALF_RANGE_COLOR</span><span class=cF0>;
<a name="l335"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>i = </span><span class=cF5>DefineMatch</span><span class=cF0>(st2, </span><span class=cF6>&quot;ST_COLORS&quot;</span><span class=cF0>, </span><span class=cF3>LMF_IGNORE_CASE</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l336"></a> res.color = i;
<a name="l337"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrICompare</span><span class=cF7>(</span><span class=cF0>st2, </span><span class=cF6>&quot;TRANSPARENT&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l338"></a> res.color = </span><span class=cF3>TRANSPARENT</span><span class=cF0>;
<a name="l339"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l340"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l341"></a> </span><span class=cF5>Free</span><span class=cF0>(st2);
<a name="l342"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>COLOR_INVALID</span><span class=cF0>;
<a name="l343"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l344"></a> </span><span class=cF5>Free</span><span class=cF0>(st2);
<a name="l345"></a> }
<a name="l346"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (*st == </span><span class=cF6>'+'</span><span class=cF0> || *st == </span><span class=cF6>'|'</span><span class=cF0> || </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>char_bmp_white_space</span><span class=cF0>, *st</span><span class=cF7>)</span><span class=cF0>)
<a name="l347"></a> st++;
<a name="l348"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'0'</span><span class=cF0> &lt;= *st &lt;= </span><span class=cF6>'9'</span><span class=cF0>)
<a name="l349"></a> {
<a name="l350"></a> i = </span><span class=cF5>Str2I64</span><span class=cF0>(st, </span><span class=cFE>10</span><span class=cF0>, &amp;ptr);
<a name="l351"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> &lt;= i &lt;= </span><span class=cFE>0xFF</span><span class=cF0>)
<a name="l352"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l353"></a> res.color = i;
<a name="l354"></a> st = ptr;
<a name="l355"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l356"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l357"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>COLOR_INVALID</span><span class=cF0>;
<a name="l358"></a> }
<a name="l359"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l360"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>COLOR_INVALID</span><span class=cF0>;
<a name="l361"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l362"></a>}
<a name="l363"></a>
<a name="l364"></a></span><span class=cF9>CColorROPU32</span><span class=cF0> </span><span class=cF5>Str2ColorU32</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *st)
<a name="l365"></a>{</span><span class=cF2>//</span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrDC.CC.html#l62"><span class=cF4>DCLighting</span></a><span class=cF2> color str with flags to </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l3644"><span class=cF4>CColorROPU32</span></a><span class=cF2>.</span><span class=cF0>
<a name="l366"></a> </span><span class=cF1>U8</span><span class=cF0> *st2;
<a name="l367"></a> </span><span class=cF9>CColorROPU32</span><span class=cF0> res = </span><span class=cFE>0</span><span class=cF0>;
<a name="l368"></a>
<a name="l369"></a> </span><span class=cF1>if</span><span class=cF0> (!st)
<a name="l370"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>COLOR_INVALID</span><span class=cF0>;
<a name="l371"></a>
<a name="l372"></a> st2 = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>st</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0>);
<a name="l373"></a> </span><span class=cF5>StrFirstRemove</span><span class=cF0>(st, </span><span class=cFD>str2color_list</span><span class=cF0>, st2);
<a name="l374"></a> res.c0 = </span><span class=cF5>Str2ColorU16</span><span class=cF0>(st2);
<a name="l375"></a> </span><span class=cF1>if</span><span class=cF0> (*st)
<a name="l376"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l377"></a> res.c1 = </span><span class=cF5>Str2ColorU16</span><span class=cF0>(st);
<a name="l378"></a> res |= </span><span class=cF3>ROPF_DITHER</span><span class=cF0>;
<a name="l379"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l380"></a> </span><span class=cF1>if</span><span class=cF0> (res.c0.color == </span><span class=cF3>COLOR_INVALID</span><span class=cF0> || res.c1.color == </span><span class=cF3>COLOR_INVALID</span><span class=cF0>)
<a name="l381"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>COLOR_INVALID</span><span class=cF0>;
<a name="l382"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l383"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l384"></a>}
</span></pre></body>
</html>