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

250 lines
28 KiB
Plaintext
Raw Normal View History

2024-03-24 21:24:44 +00:00
<!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>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)
<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> tmph-&gt;type=</span><span class=cF3>HTT_DEFINE_STR</span><span class=cF0>;
<a name="l5"></a> tmph-&gt;str=</span><span class=cF5>StrNew</span><span class=cF0>(dname);
<a name="l6"></a> tmph-&gt;data=</span><span class=cF5>StrNew</span><span class=cF0>(st);
<a name="l7"></a> tmph-&gt;cnt=-1;
<a name="l8"></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="l9"></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="l10"></a> </span><span class=cF1>return</span><span class=cF0> tmph;
<a name="l11"></a>}
<a name="l12"></a>
<a name="l13"></a></span><span class=cF9>CHashDefineStr</span><span class=cF0> *</span><span class=cF5>DefineLstLoad</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *dname,</span><span class=cF1>U8</span><span class=cF0> *lst)
<a name="l14"></a>{</span><span class=cF2>//Create DEFINE list. Not efficient, but handy.</span><span class=cF0>
<a name="l15"></a> </span><span class=cF9>I64</span><span class=cF0> cnt=0;
<a name="l16"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr,**idx;
<a name="l17"></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="l18"></a> tmph-&gt;type=</span><span class=cF3>HTT_DEFINE_STR</span><span class=cF0>;
<a name="l19"></a> tmph-&gt;str=</span><span class=cF5>StrNew</span><span class=cF0>(dname);
<a name="l20"></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="l21"></a> ptr=lst;
<a name="l22"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr) </span><span class=cF7>{</span><span class=cF0>
<a name="l23"></a> </span><span class=cF1>if</span><span class=cF0> (*ptr!=</span><span class=cF6>'@'</span><span class=cF0>)
<a name="l24"></a> cnt++;
<a name="l25"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr++);
<a name="l26"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l27"></a> tmph-&gt;data=</span><span class=cF5>MAlloc</span><span class=cF0>(ptr+1-lst);
<a name="l28"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(tmph-&gt;data,lst,ptr+1-lst);
<a name="l29"></a> tmph-&gt;cnt=cnt;
<a name="l30"></a>
<a name="l31"></a> idx=tmph-&gt;sub_idx=</span><span class=cF5>MAlloc</span><span class=cF0>(cnt*</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="l32"></a> ptr=lst;
<a name="l33"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr) </span><span class=cF7>{</span><span class=cF0>
<a name="l34"></a> </span><span class=cF1>if</span><span class=cF0> (*ptr!=</span><span class=cF6>'@'</span><span class=cF0>)
<a name="l35"></a> *idx++=ptr;
<a name="l36"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr++);
<a name="l37"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l38"></a>
<a name="l39"></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="l40"></a> </span><span class=cF1>return</span><span class=cF0> tmph;
<a name="l41"></a>}
<a name="l42"></a>
<a name="l43"></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="l44"></a>{
<a name="l45"></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="l46"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'UndefDef'</span><span class=cF0>);
<a name="l47"></a>}
<a name="l48"></a>
<a name="l49"></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="l50"></a>{</span><span class=cF2>//Look for DEFINE named in hash table, return ptr string.</span><span class=cF0>
<a name="l51"></a> </span><span class=cF9>CHashDefineStr</span><span class=cF0> *tmph;
<a name="l52"></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="l53"></a> </span><span class=cF1>return</span><span class=cF0> tmph-&gt;data;
<a name="l54"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (dname)
<a name="l55"></a> </span><span class=cFD>UndefinedDefine</span><span class=cF0>(dname);
<a name="l56"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l57"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l58"></a>}
<a name="l59"></a>
<a name="l60"></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="l61"></a>{</span><span class=cF2>//Return DEFINE list entry indexed by number.</span><span class=cF0>
<a name="l62"></a> </span><span class=cF9>CHashDefineStr</span><span class=cF0> *tmph;
<a name="l63"></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>) </span><span class=cF7>{</span><span class=cF0>
<a name="l64"></a> </span><span class=cF1>if</span><span class=cF0> (0&lt;=sub&lt;tmph-&gt;cnt)
<a name="l65"></a> </span><span class=cF1>return</span><span class=cF0> tmph-&gt;sub_idx[sub];
<a name="l66"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l67"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l68"></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> (dname)
<a name="l69"></a> </span><span class=cFD>UndefinedDefine</span><span class=cF0>(dname);
<a name="l70"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l71"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l72"></a>}
<a name="l73"></a>
<a name="l74"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>DefineCnt</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *dname)
<a name="l75"></a>{</span><span class=cF2>//Return cnt of entries in define list.</span><span class=cF0>
<a name="l76"></a> </span><span class=cF9>CHashDefineStr</span><span class=cF0> *tmph;
<a name="l77"></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="l78"></a> </span><span class=cF1>return</span><span class=cF0> tmph-&gt;cnt;
<a name="l79"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (dname)
<a name="l80"></a> </span><span class=cFD>UndefinedDefine</span><span class=cF0>(dname);
<a name="l81"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l82"></a> </span><span class=cF1>return</span><span class=cF0> -1;
<a name="l83"></a>}
<a name="l84"></a>
<a name="l85"></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_lst_dname,</span><span class=cF9>I64</span><span class=cF0> flags=0)
<a name="l86"></a>{</span><span class=cF2>//Find match for string in define list.</span><span class=cF0>
<a name="l87"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>LstMatch</span><span class=cF0>(needle,</span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF0>haystack_lst_dname</span><span class=cF7>)</span><span class=cF0>,flags);
<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>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="l91"></a>{</span><span class=cF2>//Create DEFINE entry with </span><a href="/Wb/Doc/Print.DD.HTML#l1"><span class=cF4>Print</span></a><span class=cF2>()ed string.</span><span class=cF0>
<a name="l92"></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="l93"></a> </span><span class=cF5>DefineLoad</span><span class=cF0>(dname,buf);
<a name="l94"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l95"></a>}
<a name="l96"></a>
<a name="l97"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>SysDefinesLoad</span><span class=cF0>()
<a name="l98"></a>{
<a name="l99"></a> </span><span class=cF5>DefineLstLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_OFF_ON&quot;</span><span class=cF0>,</span><span class=cF6>&quot;Off\0On\0&quot;</span><span class=cF0>);
<a name="l100"></a> </span><span class=cF5>DefineLstLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_HTT_TYPES&quot;</span><span class=cF0>,</span><span class=cF6>&quot;ExportSysSym\0ImportSysSym\0DefineStr\0GlbVar\0&quot;</span><span class=cF0>
<a name="l101"></a> </span><span class=cF6>&quot;Class\0IntType\0Funct\0Word\0DictWord\0KeyWord\0AsmKeyWord\0OpCode\0&quot;</span><span class=cF0>
<a name="l102"></a> </span><span class=cF6>&quot;Reg\0File\0Module\0HelpFile\0Frame Ptr\0 \0 \0 \0 \0 \0 \0Private\0&quot;</span><span class=cF0>
<a name="l103"></a> </span><span class=cF6>&quot;Public\0Export\0Import\0Imm\0Goto\0Res\0Unres\0Local\0&quot;</span><span class=cF0>);
<a name="l104"></a> </span><span class=cF5>DefineLstLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_DAYS_OF_WEEK&quot;</span><span class=cF0>,</span><span class=cF6>&quot;Sunday\0Monday\0Tuesday\0Wednesday\0&quot;</span><span class=cF0>
<a name="l105"></a> </span><span class=cF6>&quot;Thursday\0Friday\0Saturday\0&quot;</span><span class=cF0>);
<a name="l106"></a> </span><span class=cF5>DefineLstLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_MONTHS&quot;</span><span class=cF0>,</span><span class=cF6>&quot;January\0February\0March\0April\0May\0&quot;</span><span class=cF0>
<a name="l107"></a> </span><span class=cF6>&quot;June\0July\0August\0September\0October\0November\0December\0&quot;</span><span class=cF0>);
<a name="l108"></a> </span><span class=cF5>DefineLstLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_FILE_ATTRS&quot;</span><span class=cF0>,</span><span class=cF6>&quot;R\0H\0S\0V\0D\0A\0 \0 \0X\0T\0Z\0C\0F\0&quot;</span><span class=cF0>);
<a name="l109"></a> </span><span class=cF5>DefineLstLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_FILE_UTIL_FLAGS&quot;</span><span class=cF0>,</span><span class=cF6>&quot;r\0d\0i\0a\0c\0R\0p\0m\0x\0s\0&quot;</span><span class=cF0>
<a name="l110"></a> </span><span class=cF6>&quot;D\0F\0T\0$\0S\0A\0J\0G\0Z\0O\0P\0f\0l\0lb\0la\0&quot;</span><span class=cF0>);
<a name="l111"></a> </span><span class=cF5>DefineLstLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_BLKDEV_TYPES&quot;</span><span class=cF0>,
<a name="l112"></a> </span><span class=cF6>&quot;NULL\0RAM\0ATA\0FILE_READ\0FILE_WRITE\0ATAPI\0&quot;</span><span class=cF0>);
<a name="l113"></a> </span><span class=cF5>DefineLstLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_DRV_TYPES&quot;</span><span class=cF0>,
<a name="l114"></a> </span><span class=cF6>&quot;NULL\0REDSEA\0FAT32\0ISO9660\0NTFS\0UNKNOWN\0&quot;</span><span class=cF0>);
<a name="l115"></a> </span><span class=cF5>DefineLstLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_COLORS&quot;</span><span class=cF0>,</span><span class=cF6>&quot;BLACK\0BLUE\0GREEN\0CYAN\0&quot;</span><span class=cF0>
<a name="l116"></a> </span><span class=cF6>&quot;RED\0PURPLE\0BROWN\0LTGRAY\0DKGRAY\0LTBLUE\0LTGREEN\0&quot;</span><span class=cF0>
<a name="l117"></a> </span><span class=cF6>&quot;LTCYAN\0LTRED\0LTPURPLE\0YELLOW\0WHITE\0&quot;</span><span class=cF0>);
<a name="l118"></a> </span><span class=cF5>DefineLstLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_INT_NAMES&quot;</span><span class=cF0>,</span><span class=cF6>&quot;Divide Error\0SingleStep\0NMI\0Breakpoint\0&quot;</span><span class=cF0>
<a name="l119"></a> </span><span class=cF6>&quot;Overflow\0BOUND Range Exceeded\0Invalid Opcode\0No Math Coprocessor\0&quot;</span><span class=cF0>
<a name="l120"></a> </span><span class=cF6>&quot;Double Fault\0Coprocessor Segment Fault\0Invalid TASK\0&quot;</span><span class=cF0>
<a name="l121"></a> </span><span class=cF6>&quot;Segment Not Present\0Stk Segment Fault\0General Protection\0&quot;</span><span class=cF0>
<a name="l122"></a> </span><span class=cF6>&quot;Page Fault\0 \0Math Fault\0Alignment Check\0Machine Check\0&quot;</span><span class=cF0>
<a name="l123"></a> </span><span class=cF6>&quot;SIMD Exception\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0&quot;</span><span class=cF0>
<a name="l124"></a> </span><span class=cF6>&quot; \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0MP Crash\0Wake\0Dbg\0&quot;</span><span class=cF0>);
<a name="l125"></a>}
<a name="l126"></a>
<a name="l127"></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="l128"></a>{</span><span class=cF2>//</span><a href="/Wb/Kernel/KernelA.HH.HTML#l2939"><span class=cF4>CColorROPU32</span></a><span class=cF2> with flags to </span><a href="/Wb/Adam/Gr/GrDC.HC.HTML#l57"><span class=cF4>DCLighting</span></a><span class=cF2> str.</span><span class=cF0>
<a name="l129"></a> *buf=0;
<a name="l130"></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="l131"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf,</span><span class=cF6>&quot;TWO|&quot;</span><span class=cF0>);
<a name="l132"></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="l133"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf,</span><span class=cF6>&quot;HALF|&quot;</span><span class=cF0>);
<a name="l134"></a> </span><span class=cF1>if</span><span class=cF0> (0&lt;=c.c0.color&lt;16)
<a name="l135"></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="l136"></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="l137"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf,</span><span class=cF6>&quot;TRANSPARENT&quot;</span><span class=cF0>);
<a name="l138"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l139"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf,</span><span class=cF6>&quot;INVALID&quot;</span><span class=cF0>);
<a name="l140"></a> </span><span class=cF1>if</span><span class=cF0> (c&amp;</span><span class=cF3>ROPF_DITHER</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l141"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf,</span><span class=cF6>&quot;/&quot;</span><span class=cF0>);
<a name="l142"></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="l143"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf,</span><span class=cF6>&quot;TWO|&quot;</span><span class=cF0>);
<a name="l144"></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="l145"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf,</span><span class=cF6>&quot;HALF|&quot;</span><span class=cF0>);
<a name="l146"></a> </span><span class=cF1>if</span><span class=cF0> (0&lt;=c.c1.color&lt;16)
<a name="l147"></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="l148"></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="l149"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf,</span><span class=cF6>&quot;TRANSPARENT&quot;</span><span class=cF0>);
<a name="l150"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l151"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf,</span><span class=cF6>&quot;INVALID&quot;</span><span class=cF0>);
<a name="l152"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l153"></a> </span><span class=cF1>return</span><span class=cF0> buf;
<a name="l154"></a>}
<a name="l155"></a>
<a name="l156"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cFD>str2color_lst</span><span class=cF0>=</span><span class=cF6>&quot;/,)}&gt;&quot;</span><span class=cF0>;
<a name="l157"></a>
<a name="l158"></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="l159"></a>{</span><span class=cF2>//</span><a href="/Wb/Adam/Gr/GrDC.HC.HTML#l57"><span class=cF4>DCLighting</span></a><span class=cF2> color str with flags to </span><a href="/Wb/Kernel/KernelA.HH.HTML#l2935"><span class=cF4>CColorROPU16</span></a><span class=cF2>.</span><span class=cF0>
<a name="l160"></a> </span><span class=cF9>CColorROPU16</span><span class=cF0> res=</span><span class=cF3>COLOR_INVALID</span><span class=cF0>;
<a name="l161"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l162"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr,*ptr2,*st2;
<a name="l163"></a> </span><span class=cF1>if</span><span class=cF0> (!st) </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>COLOR_INVALID</span><span class=cF0>;
<a name="l164"></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="l165"></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_lst</span><span class=cF0>,*st</span><span class=cF7>)</span><span class=cF0>)
<a name="l166"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l167"></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="l168"></a> ptr=st;
<a name="l169"></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="l170"></a> ptr++;
<a name="l171"></a> st2=ptr2=</span><span class=cF5>MAlloc</span><span class=cF0>(ptr-st+1);
<a name="l172"></a> </span><span class=cF1>while</span><span class=cF0> (st&lt;ptr)
<a name="l173"></a> *ptr2++=*st++;
<a name="l174"></a> *ptr2++=0;
<a name="l175"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrICmp</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="l176"></a> res.rop|=</span><span class=cF3>ROPBF_TWO_SIDED</span><span class=cF0>;
<a name="l177"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrICmp</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="l178"></a> res.rop|=</span><span class=cF3>ROPBF_HALF_RANGE_COLOR</span><span class=cF0>;
<a name="l179"></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;=0)
<a name="l180"></a> res.color=i;
<a name="l181"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrICmp</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="l182"></a> res.color=</span><span class=cF3>TRANSPARENT</span><span class=cF0>;
<a name="l183"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l184"></a> </span><span class=cF5>Free</span><span class=cF0>(st2);
<a name="l185"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>COLOR_INVALID</span><span class=cF0>;
<a name="l186"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l187"></a> </span><span class=cF5>Free</span><span class=cF0>(st2);
<a name="l188"></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="l189"></a> st++;
<a name="l190"></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="l191"></a> i=</span><span class=cF5>Str2I64</span><span class=cF0>(st,10,&amp;ptr);
<a name="l192"></a> </span><span class=cF1>if</span><span class=cF0> (0&lt;=i&lt;=0xFF) </span><span class=cF7>{</span><span class=cF0>
<a name="l193"></a> res.color=i;
<a name="l194"></a> st=ptr;
<a name="l195"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l196"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>COLOR_INVALID</span><span class=cF0>;
<a name="l197"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l198"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>COLOR_INVALID</span><span class=cF0>;
<a name="l199"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l200"></a>}
<a name="l201"></a>
<a name="l202"></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="l203"></a>{</span><span class=cF2>//</span><a href="/Wb/Adam/Gr/GrDC.HC.HTML#l57"><span class=cF4>DCLighting</span></a><span class=cF2> color str with flags to </span><a href="/Wb/Kernel/KernelA.HH.HTML#l2939"><span class=cF4>CColorROPU32</span></a><span class=cF2>.</span><span class=cF0>
<a name="l204"></a> </span><span class=cF1>U8</span><span class=cF0> *st2;
<a name="l205"></a> </span><span class=cF9>CColorROPU32</span><span class=cF0> res=0;
<a name="l206"></a> </span><span class=cF1>if</span><span class=cF0> (!st) </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>COLOR_INVALID</span><span class=cF0>;
<a name="l207"></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>+1);
<a name="l208"></a> </span><span class=cF5>StrFirstRem</span><span class=cF0>(st,</span><span class=cFD>str2color_lst</span><span class=cF0>,st2);
<a name="l209"></a> res.c0=</span><span class=cF5>Str2ColorU16</span><span class=cF0>(st2);
<a name="l210"></a> </span><span class=cF1>if</span><span class=cF0> (*st) </span><span class=cF7>{</span><span class=cF0>
<a name="l211"></a> res.c1=</span><span class=cF5>Str2ColorU16</span><span class=cF0>(st);
<a name="l212"></a> res|=</span><span class=cF3>ROPF_DITHER</span><span class=cF0>;
<a name="l213"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l214"></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="l215"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>COLOR_INVALID</span><span class=cF0>;
<a name="l216"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l217"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l218"></a>}
</span></pre></body>
</html>