ZealOS/docs/Kernel/StrA.CC.html

791 lines
103 KiB
HTML
Raw Normal View History

2021-07-03 05:07:57 +01:00
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V0.10">
2021-07-03 05:07:57 +01:00
<style type="text/css">
body {background-color:#000000;}
.cF0{color:#ffffff;background-color:#000000;}
.cF1{color:#3465a4;background-color:#000000;}
.cF2{color:#4e9a06;background-color:#000000;}
.cF3{color:#06989a;background-color:#000000;}
.cF4{color:#a24444;background-color:#000000;}
.cF5{color:#75507b;background-color:#000000;}
.cF6{color:#ce982f;background-color:#000000;}
.cF7{color:#bcc0b9;background-color:#000000;}
.cF8{color:#555753;background-color:#000000;}
.cF9{color:#729fcf;background-color:#000000;}
.cFA{color:#82bc49;background-color:#000000;}
.cFB{color:#34e2e2;background-color:#000000;}
.cFC{color:#ac3535;background-color:#000000;}
.cFD{color:#ad7fa8;background-color:#000000;}
.cFE{color:#fce94f;background-color:#000000;}
.cFF{color:#000000;background-color:#000000;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
2021-07-03 05:07:57 +01:00
<a name="l1"></a><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>StrPrintHex</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *dst, </span><span class=cF9>I64</span><span class=cF0> num; </span><span class=cF9>I64</span><span class=cF0> width)
<a name="l2"></a>{
<a name="l3"></a> </span><span class=cF1>U8</span><span class=cF0> *res = dst + width;
2021-07-03 05:07:57 +01:00
<a name="l4"></a>
<a name="l5"></a> dst = res;
<a name="l6"></a> </span><span class=cF1>while</span><span class=cF0> (width--)
<a name="l7"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l8"></a> *--dst = </span><span class=cF6>&quot;0123456789ABCDEF&quot;</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *)[num &amp; </span><span class=cFE>15</span><span class=cF0>];
<a name="l9"></a> num &gt;&gt;= </span><span class=cFE>4</span><span class=cF0>;
<a name="l10"></a> </span><span class=cF7>}</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l11"></a>
<a name="l12"></a> </span><span class=cF1>return</span><span class=cF0> res;
2021-07-03 05:07:57 +01:00
<a name="l13"></a>}
<a name="l14"></a>
<a name="l15"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>PutHex</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> num, </span><span class=cF9>I64</span><span class=cF0> width)
<a name="l16"></a>{
<a name="l17"></a> </span><span class=cF1>U8</span><span class=cF0> buf[</span><span class=cFE>17</span><span class=cF0>];
2021-07-03 05:07:57 +01:00
<a name="l18"></a>
<a name="l19"></a> </span><span class=cF1>if</span><span class=cF0> (width &gt; </span><span class=cFE>16</span><span class=cF0>)
<a name="l20"></a> width = </span><span class=cFE>16</span><span class=cF0>;
2021-07-03 05:07:57 +01:00
<a name="l21"></a>
<a name="l22"></a> *</span><span class=cF5>StrPrintHex</span><span class=cF0>(buf, num, width) = </span><span class=cFE>0</span><span class=cF0>;
<a name="l23"></a> </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, buf;
2021-07-03 05:07:57 +01:00
<a name="l24"></a>}
<a name="l25"></a>
<a name="l26"></a></span><span class=cF1>asm</span><span class=cF0> {
<a name="l27"></a></span><span class=cF2>// IN:</span><span class=cF0> </span><span class=cF2>RAX=NUM TO PRINT</span><span class=cF0>
<a name="l28"></a></span><span class=cFD>PUT_HEX_U64</span><span class=cF0>::
<a name="l29"></a> </span><span class=cF3>PUSH_C_REGS</span><span class=cF0>
<a name="l30"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFE>16</span><span class=cF0>
<a name="l31"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>
<a name="l32"></a> </span><span class=cF1>CALL</span><span class=cF0> &amp;</span><span class=cF5>PutHex</span><span class=cF0>
<a name="l33"></a> </span><span class=cF3>POP_C_REGS</span><span class=cF0>
<a name="l34"></a> </span><span class=cF1>RET</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l35"></a></span><span class=cFD>PUT_HEX_U32</span><span class=cF0>::
<a name="l36"></a> </span><span class=cF3>PUSH_C_REGS</span><span class=cF0>
<a name="l37"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFE>8</span><span class=cF0>
<a name="l38"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>
<a name="l39"></a> </span><span class=cF1>CALL</span><span class=cF0> &amp;</span><span class=cF5>PutHex</span><span class=cF0>
<a name="l40"></a> </span><span class=cF3>POP_C_REGS</span><span class=cF0>
<a name="l41"></a> </span><span class=cF1>RET</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l42"></a></span><span class=cFD>PUT_HEX_U16</span><span class=cF0>::
<a name="l43"></a> </span><span class=cF3>PUSH_C_REGS</span><span class=cF0>
<a name="l44"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFE>4</span><span class=cF0>
<a name="l45"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>
<a name="l46"></a> </span><span class=cF1>CALL</span><span class=cF0> &amp;</span><span class=cF5>PutHex</span><span class=cF0>
<a name="l47"></a> </span><span class=cF3>POP_C_REGS</span><span class=cF0>
<a name="l48"></a> </span><span class=cF1>RET</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l49"></a></span><span class=cFD>PUT_HEX_U8</span><span class=cF0>::
<a name="l50"></a> </span><span class=cF3>PUSH_C_REGS</span><span class=cF0>
<a name="l51"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFE>2</span><span class=cF0>
<a name="l52"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>
<a name="l53"></a> </span><span class=cF1>CALL</span><span class=cF0> &amp;</span><span class=cF5>PutHex</span><span class=cF0>
<a name="l54"></a> </span><span class=cF3>POP_C_REGS</span><span class=cF0>
<a name="l55"></a> </span><span class=cF1>RET</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l56"></a></span><span class=cFD>PUT_CHARS</span><span class=cF0>::
<a name="l57"></a></span><span class=cF2>// IN:</span><span class=cF0> </span><span class=cF2>RAX=Char</span><span class=cF0>
<a name="l58"></a> </span><span class=cF3>PUSH_C_REGS</span><span class=cF0>
<a name="l59"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>
<a name="l60"></a> </span><span class=cF1>CALL</span><span class=cF0> &amp;</span><span class=cF5>PutChars</span><span class=cF0>
<a name="l61"></a> </span><span class=cF3>POP_C_REGS</span><span class=cF0>
<a name="l62"></a> </span><span class=cF1>RET</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l63"></a></span><span class=cFD>PUT_STR</span><span class=cF0>::
<a name="l64"></a></span><span class=cF2>// IN:</span><span class=cF0> </span><span class=cF2>RSI=String</span><span class=cF0>
<a name="l65"></a> </span><span class=cF3>PUSH_C_REGS</span><span class=cF0>
<a name="l66"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l67"></a> </span><span class=cF1>CALL</span><span class=cF0> &amp;</span><span class=cF5>PutS</span><span class=cF0>
<a name="l68"></a> </span><span class=cF3>POP_C_REGS</span><span class=cF0>
<a name="l69"></a> </span><span class=cF1>RET</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l70"></a></span><span class=cFD>_STRCOPY</span><span class=cF0>::
<a name="l71"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l72"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>, </span><span class=cFC>RSP</span><span class=cF0>
<a name="l73"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l74"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>
<a name="l75"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG1</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l76"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>, </span><span class=cFC>RDI</span><span class=cF0>
<a name="l77"></a> </span><span class=cF1>JZ</span><span class=cF0> @@15
<a name="l78"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG2</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l79"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>, </span><span class=cFC>RSI</span><span class=cF0>
<a name="l80"></a> </span><span class=cF1>JNZ</span><span class=cF0> @@05
<a name="l81"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, </span><span class=cFC>RAX</span><span class=cF0>
<a name="l82"></a> </span><span class=cF1>JMP</span><span class=cF0> @@10
<a name="l83"></a>@@05: </span><span class=cF1>LODSB</span><span class=cF0>
<a name="l84"></a>@@10: </span><span class=cF1>STOSB</span><span class=cF0>
<a name="l85"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cFC>AL</span><span class=cF0>
<a name="l86"></a> </span><span class=cF1>JNZ</span><span class=cF0> @@05
<a name="l87"></a>@@15: </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>
<a name="l88"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l89"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l90"></a> </span><span class=cF1>RET1</span><span class=cF0> </span><span class=cFE>16</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l91"></a></span><span class=cFD>_STRCOMPARE</span><span class=cF0>::
<a name="l92"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l93"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>, </span><span class=cFC>RSP</span><span class=cF0>
<a name="l94"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l95"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>
<a name="l96"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG2</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l97"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG1</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l98"></a>@@05: </span><span class=cF1>LODSB</span><span class=cF0>
<a name="l99"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cFC>AL</span><span class=cF0>
<a name="l100"></a> </span><span class=cF1>JZ</span><span class=cF0> @@20
<a name="l101"></a> </span><span class=cF1>SCASB</span><span class=cF0>
<a name="l102"></a> </span><span class=cF1>JE</span><span class=cF0> @@05
<a name="l103"></a> </span><span class=cF1>JA</span><span class=cF0> @@15
<a name="l104"></a>@@10: </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>
<a name="l105"></a> </span><span class=cF1>JMP</span><span class=cF0> @@25
<a name="l106"></a>@@15: </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, -</span><span class=cFE>1</span><span class=cF0>
<a name="l107"></a> </span><span class=cF1>JMP</span><span class=cF0> @@25
<a name="l108"></a>@@20: </span><span class=cF1>SCASB</span><span class=cF0>
<a name="l109"></a> </span><span class=cF1>JNE</span><span class=cF0> @@10
<a name="l110"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, </span><span class=cFC>RAX</span><span class=cF0>
<a name="l111"></a>@@25: </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>
<a name="l112"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l113"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l114"></a> </span><span class=cF1>RET1</span><span class=cF0> </span><span class=cFE>16</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l115"></a></span><span class=cFD>TO_UPPER</span><span class=cF0>::
<a name="l116"></a> </span><span class=cF1>CMP</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cF6>'a'</span><span class=cF0>
<a name="l117"></a> </span><span class=cF1>JB</span><span class=cF0> @@05
<a name="l118"></a> </span><span class=cF1>CMP</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cF6>'z'</span><span class=cF0>
<a name="l119"></a> </span><span class=cF1>JA</span><span class=cF0> @@05
<a name="l120"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cF6>'A'</span><span class=cF0> - </span><span class=cF6>'a'</span><span class=cF0>
<a name="l121"></a>@@05: </span><span class=cF1>RET</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l122"></a></span><span class=cFD>_STRICOMPARE</span><span class=cF0>::
<a name="l123"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l124"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>, </span><span class=cFC>RSP</span><span class=cF0>
<a name="l125"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l126"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>
<a name="l127"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG2</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l128"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG1</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l129"></a>@@05: </span><span class=cF1>LODSB</span><span class=cF0>
<a name="l130"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cFC>AL</span><span class=cF0>
<a name="l131"></a> </span><span class=cF1>JZ</span><span class=cF0> @@30
<a name="l132"></a> </span><span class=cF1>CMP</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cF6>'a'</span><span class=cF0>
<a name="l133"></a> </span><span class=cF1>JB</span><span class=cF0> @@10
<a name="l134"></a> </span><span class=cF1>CMP</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cF6>'z'</span><span class=cF0>
<a name="l135"></a> </span><span class=cF1>JA</span><span class=cF0> @@10
<a name="l136"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cF6>'A'</span><span class=cF0> - </span><span class=cF6>'a'</span><span class=cF0>
<a name="l137"></a>@@10: </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>BL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> [</span><span class=cFC>RDI</span><span class=cF0>]
<a name="l138"></a> </span><span class=cF1>INC</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>
<a name="l139"></a> </span><span class=cF1>CMP</span><span class=cF0> </span><span class=cFC>BL</span><span class=cF0>, </span><span class=cF6>'a'</span><span class=cF0>
<a name="l140"></a> </span><span class=cF1>JB</span><span class=cF0> @@15
<a name="l141"></a> </span><span class=cF1>CMP</span><span class=cF0> </span><span class=cFC>BL</span><span class=cF0>, </span><span class=cF6>'z'</span><span class=cF0>
<a name="l142"></a> </span><span class=cF1>JA</span><span class=cF0> @@15
<a name="l143"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cFC>BL</span><span class=cF0>, </span><span class=cF6>'A'</span><span class=cF0> - </span><span class=cF6>'a'</span><span class=cF0>
<a name="l144"></a>@@15: </span><span class=cF1>CMP</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cFC>BL</span><span class=cF0>
<a name="l145"></a> </span><span class=cF1>JE</span><span class=cF0> @@05
<a name="l146"></a> </span><span class=cF1>JA</span><span class=cF0> @@25
<a name="l147"></a>@@20: </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>
<a name="l148"></a> </span><span class=cF1>JMP</span><span class=cF0> @@35
<a name="l149"></a>@@25: </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, -</span><span class=cFE>1</span><span class=cF0>
<a name="l150"></a> </span><span class=cF1>JMP</span><span class=cF0> @@35
<a name="l151"></a>@@30: </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>BL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> [</span><span class=cFC>RDI</span><span class=cF0>]
<a name="l152"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>BL</span><span class=cF0>, </span><span class=cFC>BL</span><span class=cF0>
<a name="l153"></a> </span><span class=cF1>JNE</span><span class=cF0> @@20
<a name="l154"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, </span><span class=cFC>RAX</span><span class=cF0>
<a name="l155"></a>@@35: </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>
<a name="l156"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l157"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l158"></a> </span><span class=cF1>RET1</span><span class=cF0> </span><span class=cFE>16</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l159"></a></span><span class=cFD>_STRNCOMPARE</span><span class=cF0>::
<a name="l160"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l161"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>, </span><span class=cFC>RSP</span><span class=cF0>
<a name="l162"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l163"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>
<a name="l164"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RCX</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG3</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l165"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG2</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l166"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG1</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l167"></a>@@05: </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>RCX</span><span class=cF0>, </span><span class=cFC>RCX</span><span class=cF0>
<a name="l168"></a> </span><span class=cF1>JZ</span><span class=cF0> @@25
<a name="l169"></a> </span><span class=cF1>DEC</span><span class=cF0> </span><span class=cFC>RCX</span><span class=cF0>
<a name="l170"></a> </span><span class=cF1>LODSB</span><span class=cF0>
<a name="l171"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cFC>AL</span><span class=cF0>
<a name="l172"></a> </span><span class=cF1>JZ</span><span class=cF0> @@20
<a name="l173"></a> </span><span class=cF1>SCASB</span><span class=cF0>
<a name="l174"></a> </span><span class=cF1>JE</span><span class=cF0> @@05
<a name="l175"></a> </span><span class=cF1>JA</span><span class=cF0> @@15
<a name="l176"></a>@@10: </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>
<a name="l177"></a> </span><span class=cF1>JMP</span><span class=cF0> @@30
<a name="l178"></a>@@15: </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, -</span><span class=cFE>1</span><span class=cF0>
<a name="l179"></a> </span><span class=cF1>JMP</span><span class=cF0> @@30
<a name="l180"></a>@@20: </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>BL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> [</span><span class=cFC>RDI</span><span class=cF0>]
<a name="l181"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>BL</span><span class=cF0>, </span><span class=cFC>BL</span><span class=cF0>
<a name="l182"></a> </span><span class=cF1>JNE</span><span class=cF0> @@10
<a name="l183"></a>@@25: </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, </span><span class=cFC>RAX</span><span class=cF0>
<a name="l184"></a>@@30: </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>
<a name="l185"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l186"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l187"></a> </span><span class=cF1>RET1</span><span class=cF0> </span><span class=cFE>24</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l188"></a></span><span class=cFD>_STRNICOMPARE</span><span class=cF0>::
<a name="l189"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l190"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>, </span><span class=cFC>RSP</span><span class=cF0>
<a name="l191"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l192"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>
<a name="l193"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RCX</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG3</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l194"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG2</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l195"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG1</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l196"></a>@@05: </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>RCX</span><span class=cF0>, </span><span class=cFC>RCX</span><span class=cF0>
<a name="l197"></a> </span><span class=cF1>JZ</span><span class=cF0> @@35
<a name="l198"></a> </span><span class=cF1>DEC</span><span class=cF0> </span><span class=cFC>RCX</span><span class=cF0>
<a name="l199"></a> </span><span class=cF1>LODSB</span><span class=cF0>
<a name="l200"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cFC>AL</span><span class=cF0>
<a name="l201"></a> </span><span class=cF1>JZ</span><span class=cF0> @@30
<a name="l202"></a> </span><span class=cF1>CMP</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cF6>'a'</span><span class=cF0>
<a name="l203"></a> </span><span class=cF1>JB</span><span class=cF0> @@10
<a name="l204"></a> </span><span class=cF1>CMP</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cF6>'z'</span><span class=cF0>
<a name="l205"></a> </span><span class=cF1>JA</span><span class=cF0> @@10
<a name="l206"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cF6>'A'</span><span class=cF0> - </span><span class=cF6>'a'</span><span class=cF0>
<a name="l207"></a>@@10: </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>BL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> [</span><span class=cFC>RDI</span><span class=cF0>]
<a name="l208"></a> </span><span class=cF1>INC</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>
<a name="l209"></a> </span><span class=cF1>CMP</span><span class=cF0> </span><span class=cFC>BL</span><span class=cF0>, </span><span class=cF6>'a'</span><span class=cF0>
<a name="l210"></a> </span><span class=cF1>JB</span><span class=cF0> @@15
<a name="l211"></a> </span><span class=cF1>CMP</span><span class=cF0> </span><span class=cFC>BL</span><span class=cF0>, </span><span class=cF6>'z'</span><span class=cF0>
<a name="l212"></a> </span><span class=cF1>JA</span><span class=cF0> @@15
<a name="l213"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cFC>BL</span><span class=cF0>, </span><span class=cF6>'A'</span><span class=cF0> - </span><span class=cF6>'a'</span><span class=cF0>
<a name="l214"></a>@@15: </span><span class=cF1>CMP</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cFC>BL</span><span class=cF0>
<a name="l215"></a> </span><span class=cF1>JE</span><span class=cF0> @@05
<a name="l216"></a> </span><span class=cF1>JA</span><span class=cF0> @@25
<a name="l217"></a>@@20: </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>
<a name="l218"></a> </span><span class=cF1>JMP</span><span class=cF0> @@40
<a name="l219"></a>@@25: </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, -</span><span class=cFE>1</span><span class=cF0>
<a name="l220"></a> </span><span class=cF1>JMP</span><span class=cF0> @@40
<a name="l221"></a>@@30: </span><span class=cF1>SCASB</span><span class=cF0>
<a name="l222"></a> </span><span class=cF1>JNE</span><span class=cF0> @@20
<a name="l223"></a>@@35: </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, </span><span class=cFC>RAX</span><span class=cF0>
<a name="l224"></a>@@40: </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>
<a name="l225"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l226"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l227"></a> </span><span class=cF1>RET1</span><span class=cF0> </span><span class=cFE>24</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l228"></a></span><span class=cFD>_STRMATCH</span><span class=cF0>::
<a name="l229"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l230"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>, </span><span class=cFC>RSP</span><span class=cF0>
<a name="l231"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l232"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>
<a name="l233"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG2</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l234"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>, </span><span class=cFC>RSI</span><span class=cF0>
<a name="l235"></a> </span><span class=cF1>JZ</span><span class=cF0> @@25
<a name="l236"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG1</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l237"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>, </span><span class=cFC>RDI</span><span class=cF0>
<a name="l238"></a> </span><span class=cF1>JZ</span><span class=cF0> @@25
<a name="l239"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>DL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> [</span><span class=cFC>RDI</span><span class=cF0>]
<a name="l240"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>DL</span><span class=cF0>, </span><span class=cFC>DL</span><span class=cF0>
<a name="l241"></a> </span><span class=cF1>JZ</span><span class=cF0> @@20
<a name="l242"></a> </span><span class=cF1>JMP</span><span class=cF0> @@10
<a name="l243"></a>@@05: </span><span class=cF1>INC</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l244"></a>@@10: </span><span class=cF1>LODSB</span><span class=cF0>
<a name="l245"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cFC>AL</span><span class=cF0>
<a name="l246"></a> </span><span class=cF1>JZ</span><span class=cF0> @@25
<a name="l247"></a> </span><span class=cF1>CMP</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cFC>DL</span><span class=cF0>
<a name="l248"></a> </span><span class=cF1>JNE</span><span class=cF0> @@10
<a name="l249"></a> </span><span class=cF1>DEC</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l250"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RCX</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>
<a name="l251"></a>@@15: </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> [</span><span class=cFC>RDI</span><span class=cF0> + </span><span class=cFC>RCX</span><span class=cF0>]
<a name="l252"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cFC>AL</span><span class=cF0>
<a name="l253"></a> </span><span class=cF1>JZ</span><span class=cF0> @@20
<a name="l254"></a> </span><span class=cF1>CMP</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> [</span><span class=cFC>RSI</span><span class=cF0> + </span><span class=cFC>RCX</span><span class=cF0>]
<a name="l255"></a> </span><span class=cF1>JNE</span><span class=cF0> @@05
<a name="l256"></a> </span><span class=cF1>INC</span><span class=cF0> </span><span class=cFC>RCX</span><span class=cF0>
<a name="l257"></a> </span><span class=cF1>JMP</span><span class=cF0> @@15
2021-07-03 05:07:57 +01:00
<a name="l258"></a>
<a name="l259"></a> </span><span class=cF1>DEC</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l260"></a>@@20: </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, </span><span class=cFC>RSI</span><span class=cF0>
<a name="l261"></a> </span><span class=cF1>JMP</span><span class=cF0> @@30
<a name="l262"></a>@@25: </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, </span><span class=cFC>RAX</span><span class=cF0>
<a name="l263"></a>@@30: </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>
<a name="l264"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l265"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l266"></a> </span><span class=cF1>RET1</span><span class=cF0> </span><span class=cFE>16</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l267"></a></span><span class=cFD>_STRIMATCH</span><span class=cF0>::
<a name="l268"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l269"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>, </span><span class=cFC>RSP</span><span class=cF0>
<a name="l270"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l271"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>
<a name="l272"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG2</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l273"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>, </span><span class=cFC>RSI</span><span class=cF0>
<a name="l274"></a> </span><span class=cF1>JZ</span><span class=cF0> @@25
<a name="l275"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG1</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l276"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>, </span><span class=cFC>RDI</span><span class=cF0>
<a name="l277"></a> </span><span class=cF1>JZ</span><span class=cF0> @@25
<a name="l278"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> [</span><span class=cFC>RDI</span><span class=cF0>]
<a name="l279"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFD>TO_UPPER</span><span class=cF0>
<a name="l280"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>DL</span><span class=cF0>, </span><span class=cFC>AL</span><span class=cF0>
<a name="l281"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>DL</span><span class=cF0>, </span><span class=cFC>DL</span><span class=cF0>
<a name="l282"></a> </span><span class=cF1>JZ</span><span class=cF0> @@20
<a name="l283"></a> </span><span class=cF1>JMP</span><span class=cF0> @@10
<a name="l284"></a>@@05: </span><span class=cF1>INC</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l285"></a>@@10: </span><span class=cF1>LODSB</span><span class=cF0>
<a name="l286"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFD>TO_UPPER</span><span class=cF0>
<a name="l287"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cFC>AL</span><span class=cF0>
<a name="l288"></a> </span><span class=cF1>JZ</span><span class=cF0> @@25
<a name="l289"></a> </span><span class=cF1>CMP</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cFC>DL</span><span class=cF0>
<a name="l290"></a> </span><span class=cF1>JNE</span><span class=cF0> @@10
<a name="l291"></a> </span><span class=cF1>DEC</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l292"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RCX</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>
<a name="l293"></a>@@15: </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> [</span><span class=cFC>RDI</span><span class=cF0> + </span><span class=cFC>RCX</span><span class=cF0>]
<a name="l294"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFD>TO_UPPER</span><span class=cF0>
<a name="l295"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cFC>AL</span><span class=cF0>
<a name="l296"></a> </span><span class=cF1>JZ</span><span class=cF0> @@20
<a name="l297"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>BL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> [</span><span class=cFC>RSI</span><span class=cF0> + </span><span class=cFC>RCX</span><span class=cF0>]
<a name="l298"></a> </span><span class=cF1>XCHG</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cFC>BL</span><span class=cF0>
<a name="l299"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFD>TO_UPPER</span><span class=cF0>
<a name="l300"></a> </span><span class=cF1>CMP</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cFC>BL</span><span class=cF0>
<a name="l301"></a> </span><span class=cF1>JNE</span><span class=cF0> @@05
<a name="l302"></a> </span><span class=cF1>INC</span><span class=cF0> </span><span class=cFC>RCX</span><span class=cF0>
<a name="l303"></a> </span><span class=cF1>JMP</span><span class=cF0> @@15
2021-07-03 05:07:57 +01:00
<a name="l304"></a>
<a name="l305"></a> </span><span class=cF1>DEC</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l306"></a>@@20: </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, </span><span class=cFC>RSI</span><span class=cF0>
<a name="l307"></a> </span><span class=cF1>JMP</span><span class=cF0> @@30
<a name="l308"></a>@@25: </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, </span><span class=cFC>RAX</span><span class=cF0>
<a name="l309"></a>@@30: </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>
<a name="l310"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l311"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l312"></a> </span><span class=cF1>RET1</span><span class=cF0> </span><span class=cFE>16</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l313"></a>}
<a name="l314"></a></span><span class=cF1>_extern</span><span class=cF0> </span><span class=cFD>_STRCOMPARE</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>StrCompare</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *st1, </span><span class=cF1>U8</span><span class=cF0> *st2); </span><span class=cF2>//Compare two strings.</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l315"></a></span><span class=cF1>_extern</span><span class=cF0> </span><span class=cFD>_STRICOMPARE</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>StrICompare</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *st1, </span><span class=cF1>U8</span><span class=cF0> *st2); </span><span class=cF2>//Compare two strings, ignoring case.</span><span class=cF0>
<a name="l316"></a></span><span class=cF1>_extern</span><span class=cF0> </span><span class=cFD>_STRNCOMPARE</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>StrNCompare</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *st1, </span><span class=cF1>U8</span><span class=cF0> *st2, </span><span class=cF9>I64</span><span class=cF0> n); </span><span class=cF2>//Compare N bytes in two strings.</span><span class=cF0>
<a name="l317"></a></span><span class=cF1>_extern</span><span class=cF0> </span><span class=cFD>_STRNICOMPARE</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>StrNICompare</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *st1, </span><span class=cF1>U8</span><span class=cF0> *st2, </span><span class=cF9>I64</span><span class=cF0> n); </span><span class=cF2>//Compare N bytes in two strings, ignoring case.</span><span class=cF0>
<a name="l318"></a></span><span class=cF1>_extern</span><span class=cF0> </span><span class=cFD>_STRMATCH</span><span class=cF0> </span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>StrMatch</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *needle, </span><span class=cF1>U8</span><span class=cF0> *haystack_str);</span><span class=cF2>//Scan for string in string.</span><span class=cF0>
<a name="l319"></a></span><span class=cF1>_extern</span><span class=cF0> </span><span class=cFD>_STRIMATCH</span><span class=cF0> </span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>StrIMatch</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *needle, </span><span class=cF1>U8</span><span class=cF0> *haystack_str);</span><span class=cF2>//Scan for string in string, ignoring case.</span><span class=cF0>
<a name="l320"></a></span><span class=cF1>_extern</span><span class=cF0> </span><span class=cFD>_STRCOPY</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>StrCopy</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *dst, </span><span class=cF1>U8</span><span class=cF0> *src); </span><span class=cF2>//Copy string.</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l321"></a>
<a name="l322"></a></span><span class=cF2>//These bitmaps go to 0-511 so that </span><a href="https://zeal-operating-system.github.io/ZealOS/Compiler/Lex.CC.html#l529"><span class=cF4>Lex</span></a><span class=cF2>() can use them with </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l2211"><span class=cF4>Token Codes</span></a><span class=cF2>.</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l323"></a></span><span class=cF9>U32</span><span class=cF0>
<a name="l324"></a> </span><span class=cFB>char_bmp_alpha</span><span class=cF0>[</span><span class=cFE>16</span><span class=cF0>] =
<a name="l325"></a> {</span><span class=cFE>0x0000000</span><span class=cF0>, </span><span class=cFE>0x00000000</span><span class=cF0>, </span><span class=cFE>0x87FFFFFF</span><span class=cF0>, </span><span class=cFE>0x07FFFFFE</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>},
2021-07-03 05:07:57 +01:00
<a name="l326"></a>
<a name="l327"></a> </span><span class=cFB>char_bmp_alpha_numeric</span><span class=cF0>[</span><span class=cFE>16</span><span class=cF0>] =
<a name="l328"></a> {</span><span class=cFE>0x0000000</span><span class=cF0>, </span><span class=cFE>0x03FF0000</span><span class=cF0>, </span><span class=cFE>0x87FFFFFF</span><span class=cF0>, </span><span class=cFE>0x07FFFFFE</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>},
2021-07-03 05:07:57 +01:00
<a name="l329"></a>
<a name="l330"></a> </span><span class=cFB>char_bmp_alpha_numeric_no_at</span><span class=cF0>[</span><span class=cFE>16</span><span class=cF0>] =
<a name="l331"></a> {</span><span class=cFE>0x0000000</span><span class=cF0>, </span><span class=cFE>0x03FF0000</span><span class=cF0>, </span><span class=cFE>0x87FFFFFE</span><span class=cF0>, </span><span class=cFE>0x07FFFFFE</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>},
2021-07-03 05:07:57 +01:00
<a name="l332"></a>
<a name="l333"></a> </span><span class=cFB>char_bmp_word</span><span class=cF0>[</span><span class=cFE>16</span><span class=cF0>] =
<a name="l334"></a> {</span><span class=cFE>0x0000000</span><span class=cF0>, </span><span class=cFE>0x03FF0080</span><span class=cF0>, </span><span class=cFE>0x87FFFFFE</span><span class=cF0>, </span><span class=cFE>0x07FFFFFE</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>},
2021-07-03 05:07:57 +01:00
<a name="l335"></a>
<a name="l336"></a> </span><span class=cFB>char_bmp_filename</span><span class=cF0>[</span><span class=cFE>16</span><span class=cF0>] =
<a name="l337"></a> {</span><span class=cFE>0x0000000</span><span class=cF0>, </span><span class=cFE>0x03FF73FB</span><span class=cF0>, </span><span class=cFE>0xEFFFFFFF</span><span class=cF0>, </span><span class=cFE>0x6FFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>},
2021-07-03 05:07:57 +01:00
<a name="l338"></a>
<a name="l339"></a> </span><span class=cFB>char_bmp_dec_numeric</span><span class=cF0>[</span><span class=cFE>16</span><span class=cF0>] =
<a name="l340"></a> {</span><span class=cFE>0x0000000</span><span class=cF0>, </span><span class=cFE>0x03FF0000</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>},
2021-07-03 05:07:57 +01:00
<a name="l341"></a>
<a name="l342"></a> </span><span class=cFB>char_bmp_hex_numeric</span><span class=cF0>[</span><span class=cFE>16</span><span class=cF0>] =
<a name="l343"></a> {</span><span class=cFE>0x0000000</span><span class=cF0>, </span><span class=cFE>0x03FF0000</span><span class=cF0>, </span><span class=cFE>0x7E</span><span class=cF0>, </span><span class=cFE>0x7E</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>},
2021-07-03 05:07:57 +01:00
<a name="l344"></a>
<a name="l345"></a> </span><span class=cFB>char_bmp_white_space</span><span class=cF0>[</span><span class=cFE>16</span><span class=cF0>] =
<a name="l346"></a> {</span><span class=cFE>0x80002600</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>},
2021-07-03 05:07:57 +01:00
<a name="l347"></a>
<a name="l348"></a> </span><span class=cFB>char_bmp_non_eol_white_space</span><span class=cF0>[</span><span class=cFE>16</span><span class=cF0>] =
<a name="l349"></a> {</span><span class=cFE>0x80000200</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>},
2021-07-03 05:07:57 +01:00
<a name="l350"></a>
<a name="l351"></a> </span><span class=cFB>char_bmp_zero_cr_nl_cursor</span><span class=cF0>[</span><span class=cFE>16</span><span class=cF0>] =
<a name="l352"></a> {</span><span class=cFE>0x00002421</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>},
2021-07-03 05:07:57 +01:00
<a name="l353"></a>
<a name="l354"></a> </span><span class=cFB>char_bmp_zero_tab_cr_nl_cursor</span><span class=cF0>[</span><span class=cFE>16</span><span class=cF0>] =
<a name="l355"></a> {</span><span class=cFE>0x00002621</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>},
2021-07-03 05:07:57 +01:00
<a name="l356"></a>
<a name="l357"></a> </span><span class=cFB>char_bmp_zero_tab_cr_nl_cursor_dollar</span><span class=cF0>[</span><span class=cFE>16</span><span class=cF0>] =
<a name="l358"></a> {</span><span class=cFE>0x00002621</span><span class=cF0>, </span><span class=cFE>0x10</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>},
2021-07-03 05:07:57 +01:00
<a name="l359"></a>
<a name="l360"></a> </span><span class=cFB>char_bmp_macro</span><span class=cF0>[</span><span class=cFE>16</span><span class=cF0>] =
<a name="l361"></a> {</span><span class=cFE>0x80002600</span><span class=cF0>, </span><span class=cFE>0xFFFFFFDF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0x7FFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>},
2021-07-03 05:07:57 +01:00
<a name="l362"></a>
<a name="l363"></a> </span><span class=cFB>char_bmp_printable</span><span class=cF0>[</span><span class=cFE>16</span><span class=cF0>] =
<a name="l364"></a> {</span><span class=cFE>0x80002600</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0x7FFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>},
2021-07-03 05:07:57 +01:00
<a name="l365"></a>
<a name="l366"></a> </span><span class=cFB>char_bmp_displayable</span><span class=cF0>[</span><span class=cFE>16</span><span class=cF0>] =
<a name="l367"></a> {</span><span class=cFE>0x80000000</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0x7FFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>},
2021-07-03 05:07:57 +01:00
<a name="l368"></a>
<a name="l369"></a> </span><span class=cFB>char_bmp_safe_dollar</span><span class=cF0>[</span><span class=cFE>16</span><span class=cF0>] =
<a name="l370"></a> {</span><span class=cFE>0x80000000</span><span class=cF0>, </span><span class=cFE>0xFFFFFFEF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0x7FFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>},
<a name="l371"></a> </span><span class=cF2>//same but no dollar sign</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l372"></a>
<a name="l373"></a> </span><span class=cFB>char_bmp_non_eol</span><span class=cF0>[</span><span class=cFE>16</span><span class=cF0>] =
<a name="l374"></a> {</span><span class=cFE>0xFFFFDBFE</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>,
<a name="l375"></a> </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFFFFFF</span><span class=cF0>};
2021-07-03 05:07:57 +01:00
<a name="l376"></a>
<a name="l377"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>ListSub</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> sub, </span><span class=cF1>U8</span><span class=cF0> *list)
<a name="l378"></a>{</span><span class=cF2>//Point to list entry.</span><span class=cF0>
<a name="l379"></a></span><span class=cF2>//Not efficient. Use an array of U8 ptrs for efficiency.</span><span class=cF0>
<a name="l380"></a> </span><span class=cF1>if</span><span class=cF0> (!list)
<a name="l381"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l382"></a> </span><span class=cF1>while</span><span class=cF0> (*list &amp;&amp; sub &gt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l383"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l384"></a> </span><span class=cF1>while</span><span class=cF0> (*list) </span><span class=cF2>//Advance to end of cur entry.</span><span class=cF0>
<a name="l385"></a> list++;
<a name="l386"></a> list++; </span><span class=cF2>//Skip trailing zero.</span><span class=cF0>
<a name="l387"></a> </span><span class=cF1>if</span><span class=cF0> (*list == </span><span class=cF6>'@'</span><span class=cF0>) </span><span class=cF2>//Check for '@' alias list entry.</span><span class=cF0>
<a name="l388"></a> list++;
<a name="l389"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l390"></a> sub--;
<a name="l391"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l392"></a> </span><span class=cF1>if</span><span class=cF0> (sub || !*list)
<a name="l393"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l394"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l395"></a> </span><span class=cF1>return</span><span class=cF0> list;
2021-07-03 05:07:57 +01:00
<a name="l396"></a>}
<a name="l397"></a>
<a name="l398"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>ListMatch</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, </span><span class=cF9>I64</span><span class=cF0> flags=</span><span class=cFE>0</span><span class=cF0>)
<a name="l399"></a>{</span><span class=cF2>//-2 if Ambiguous</span><span class=cF0>
<a name="l400"></a></span><span class=cF2>// -1 if not found</span><span class=cF0>
<a name="l401"></a> </span><span class=cF2>// Not efficient. Use hash tables for efficiency.</span><span class=cF0>
<a name="l402"></a> </span><span class=cF9>I64</span><span class=cF0> n, sub = </span><span class=cFE>0</span><span class=cF0>, res = -</span><span class=cFE>1</span><span class=cF0>;
<a name="l403"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr;
<a name="l404"></a> </span><span class=cF1>Bool</span><span class=cF0> exact_match = </span><span class=cF3>FALSE</span><span class=cF0>;
2021-07-03 05:07:57 +01:00
<a name="l405"></a>
<a name="l406"></a> </span><span class=cF1>if</span><span class=cF0> (!haystack_list)
<a name="l407"></a> </span><span class=cF1>return</span><span class=cF0> -</span><span class=cFE>1</span><span class=cF0>;
2021-07-03 05:07:57 +01:00
<a name="l408"></a>
<a name="l409"></a> n = </span><span class=cF5>StrLen</span><span class=cF0>(needle);
<a name="l410"></a> </span><span class=cF1>while</span><span class=cF0> (*haystack_list)
<a name="l411"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l412"></a> </span><span class=cF1>if</span><span class=cF0> (*haystack_list == </span><span class=cF6>'@'</span><span class=cF0>)
<a name="l413"></a> { </span><span class=cF2>//Check for '@' alias haystack_list entry</span><span class=cF0>
<a name="l414"></a> sub--;
<a name="l415"></a> haystack_list++;
<a name="l416"></a> }
<a name="l417"></a> ptr = needle;
<a name="l418"></a> </span><span class=cF1>if</span><span class=cF0> (flags &amp; </span><span class=cF3>LMF_IGNORE_CASE</span><span class=cF0>)
<a name="l419"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr &amp;&amp; </span><span class=cF5>ToUpper</span><span class=cF7>(</span><span class=cF0>*ptr</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF5>ToUpper</span><span class=cF7>(</span><span class=cF0>*haystack_list</span><span class=cF7>)</span><span class=cF0>)
<a name="l420"></a> {
<a name="l421"></a> ptr++;
<a name="l422"></a> haystack_list++;
<a name="l423"></a> }
<a name="l424"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l425"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr &amp;&amp; *ptr == *haystack_list)
<a name="l426"></a> {
<a name="l427"></a> ptr++;
<a name="l428"></a> haystack_list++;
<a name="l429"></a> }
<a name="l430"></a> </span><span class=cF1>if</span><span class=cF0> (!*ptr)
<a name="l431"></a> { </span><span class=cF2>//Did we reach end of needle?</span><span class=cF0>
<a name="l432"></a> </span><span class=cF1>if</span><span class=cF0> (!*haystack_list) </span><span class=cF2>//Did we reach end of haystack_list?</span><span class=cF0>
<a name="l433"></a> </span><span class=cF1>return</span><span class=cF0> sub; </span><span class=cF2>//Found Exact match</span><span class=cF0>
<a name="l434"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l435"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l436"></a> </span><span class=cF1>if</span><span class=cF0> (res != -</span><span class=cFE>1</span><span class=cF0>)
<a name="l437"></a> {
<a name="l438"></a> </span><span class=cF1>if</span><span class=cF0> (!exact_match)
<a name="l439"></a> res = -</span><span class=cFE>2</span><span class=cF0>; </span><span class=cF2>//Ambiguous unless later exact match.</span><span class=cF0>
<a name="l440"></a> }
<a name="l441"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l442"></a> {
<a name="l443"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>flags &amp; </span><span class=cF3>LMF_EXACT</span><span class=cF7>)</span><span class=cF0>)
<a name="l444"></a> res = sub;
<a name="l445"></a> }
<a name="l446"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l447"></a> }
<a name="l448"></a> </span><span class=cF1>while</span><span class=cF0> (*haystack_list) </span><span class=cF2>//Advance to end of cur entry.</span><span class=cF0>
<a name="l449"></a> haystack_list++;
<a name="l450"></a> haystack_list++; </span><span class=cF2>//Skip trailing zero</span><span class=cF0>
<a name="l451"></a> sub++;
<a name="l452"></a> </span><span class=cF7>}</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l453"></a>
<a name="l454"></a> </span><span class=cF1>return</span><span class=cF0> res;
2021-07-03 05:07:57 +01:00
<a name="l455"></a>}
<a name="l456"></a>
<a name="l457"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>StrOcc</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *src, </span><span class=cF9>I64</span><span class=cF0> ch)
<a name="l458"></a>{</span><span class=cF2>//Count occurrences of a char.</span><span class=cF0>
<a name="l459"></a> </span><span class=cF9>I64</span><span class=cF0> i = </span><span class=cFE>0</span><span class=cF0>;
2021-07-03 05:07:57 +01:00
<a name="l460"></a>
<a name="l461"></a> </span><span class=cF1>if</span><span class=cF0> (!src)
<a name="l462"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l463"></a> </span><span class=cF1>while</span><span class=cF0> (*src)
<a name="l464"></a> </span><span class=cF1>if</span><span class=cF0> (*src++ == ch)
<a name="l465"></a> i++;
2021-07-03 05:07:57 +01:00
<a name="l466"></a>
<a name="l467"></a> </span><span class=cF1>return</span><span class=cF0> i;
2021-07-03 05:07:57 +01:00
<a name="l468"></a>}
<a name="l469"></a>
<a name="l470"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>Spaces2Tabs</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *dst, </span><span class=cF1>U8</span><span class=cF0> *src)
<a name="l471"></a>{</span><span class=cF2>//Src buf with spaces to dst buf without.</span><span class=cF0>
<a name="l472"></a> </span><span class=cF1>U8</span><span class=cF0> *src2;
<a name="l473"></a> </span><span class=cF9>I64</span><span class=cF0> chged = </span><span class=cFE>0</span><span class=cF0>, space_count, space_count2, col = </span><span class=cFE>0</span><span class=cF0>;
2021-07-03 05:07:57 +01:00
<a name="l474"></a>
<a name="l475"></a> </span><span class=cF1>if</span><span class=cF0> (*src)
<a name="l476"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l477"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l478"></a> src2 = src;
<a name="l479"></a> </span><span class=cF1>while</span><span class=cF0> (*src2 == </span><span class=cF3>CH_SPACE</span><span class=cF0>)
<a name="l480"></a> src2++;
<a name="l481"></a> space_count = src2 - src;
<a name="l482"></a> </span><span class=cF1>while</span><span class=cF0> (col + space_count &gt;= </span><span class=cFE>4</span><span class=cF0>)
<a name="l483"></a> {
<a name="l484"></a> space_count2 = </span><span class=cFE>4</span><span class=cF0> - col;
<a name="l485"></a> </span><span class=cF1>if</span><span class=cF0> (space_count2 == </span><span class=cFE>1</span><span class=cF0>)
<a name="l486"></a> *dst++ = </span><span class=cF3>CH_SPACE</span><span class=cF0>;
<a name="l487"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l488"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l489"></a> *dst++ = </span><span class=cF6>'\t'</span><span class=cF0>;
<a name="l490"></a> chged += space_count2 - </span><span class=cFE>1</span><span class=cF0>;
<a name="l491"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l492"></a> space_count -= space_count2;
<a name="l493"></a> col = </span><span class=cFE>0</span><span class=cF0>;
<a name="l494"></a> }
<a name="l495"></a> </span><span class=cF1>if</span><span class=cF0> (*src2 == </span><span class=cF6>'\t'</span><span class=cF0>)
<a name="l496"></a> {
<a name="l497"></a> </span><span class=cF1>if</span><span class=cF0> (space_count == </span><span class=cFE>1</span><span class=cF0> &amp;&amp; col == </span><span class=cFE>3</span><span class=cF0>)
<a name="l498"></a> *dst++ = </span><span class=cF3>CH_SPACE</span><span class=cF0>;
<a name="l499"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l500"></a> chged += space_count;
<a name="l501"></a> *dst++ = </span><span class=cF6>'\t'</span><span class=cF0>;
<a name="l502"></a> col = </span><span class=cFE>0</span><span class=cF0>;
<a name="l503"></a> }
<a name="l504"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l505"></a> {
<a name="l506"></a> </span><span class=cF1>while</span><span class=cF0> (space_count--)
<a name="l507"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l508"></a> *dst++ = </span><span class=cF3>CH_SPACE</span><span class=cF0>;
<a name="l509"></a> </span><span class=cF1>if</span><span class=cF0> (++col == </span><span class=cFE>4</span><span class=cF0>)
<a name="l510"></a> col = </span><span class=cFE>0</span><span class=cF0>;
<a name="l511"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l512"></a> </span><span class=cF1>if</span><span class=cF0> (*src2)
<a name="l513"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l514"></a> *dst++ = *src2;
<a name="l515"></a> </span><span class=cF1>if</span><span class=cF0> (++col == </span><span class=cFE>4</span><span class=cF0>)
<a name="l516"></a> col = </span><span class=cFE>0</span><span class=cF0>;
<a name="l517"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l518"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l519"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l520"></a> }
<a name="l521"></a> src = ++src2;
<a name="l522"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l523"></a> *dst = </span><span class=cFE>0</span><span class=cF0>;
2021-07-03 05:07:57 +01:00
<a name="l524"></a>
<a name="l525"></a> </span><span class=cF1>return</span><span class=cF0> chged;
2021-07-03 05:07:57 +01:00
<a name="l526"></a>}
<a name="l527"></a>
<a name="l528"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>StrUtil</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *_src, </span><span class=cF9>I64</span><span class=cF0> flags)
<a name="l529"></a>{</span><span class=cF2>//Modifies in place. See </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l4361"><span class=cF4>flags</span></a><span class=cF2> for all the options.</span><span class=cF0>
<a name="l530"></a> </span><span class=cF1>U8</span><span class=cF0> *src = _src, *dst = _src;
<a name="l531"></a> </span><span class=cF9>I64</span><span class=cF0> ch;
2021-07-03 05:07:57 +01:00
<a name="l532"></a>
<a name="l533"></a> </span><span class=cF1>if</span><span class=cF0> (flags &amp; </span><span class=cF3>SUF_REM_LEADING</span><span class=cF0>)
<a name="l534"></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_white_space</span><span class=cF0>, *src</span><span class=cF7>)</span><span class=cF0>)
<a name="l535"></a> src++;
<a name="l536"></a> </span><span class=cF1>while</span><span class=cF0> (ch = *src++)
<a name="l537"></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_white_space</span><span class=cF0>, ch</span><span class=cF7>)</span><span class=cF0>)
<a name="l538"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l539"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>flags &amp; </span><span class=cF3>SUF_REM_SPACES</span><span class=cF7>)</span><span class=cF0>)
<a name="l540"></a> {
<a name="l541"></a> </span><span class=cF1>if</span><span class=cF0> (flags &amp; </span><span class=cF3>SUF_SINGLE_SPACE</span><span class=cF0>)
<a name="l542"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l543"></a> *dst++ = </span><span class=cF3>CH_SPACE</span><span class=cF0>;
<a name="l544"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>ch = *src++</span><span class=cF7>)</span><span class=cF0> &amp;&amp; </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>char_bmp_white_space</span><span class=cF0>, ch</span><span class=cF7>)</span><span class=cF0>);
<a name="l545"></a> src--;
<a name="l546"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l547"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l548"></a> *dst++ = ch;
<a name="l549"></a> }
<a name="l550"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l551"></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>flags &amp; </span><span class=cF3>SUF_REM_CTRL_CHARS</span><span class=cF7>)</span><span class=cF0> || ch &gt;= </span><span class=cF3>CH_SPACE</span><span class=cF0>)
<a name="l552"></a> *dst++ = ch;
<a name="l553"></a> *dst = </span><span class=cFE>0</span><span class=cF0>;
2021-07-03 05:07:57 +01:00
<a name="l554"></a>
<a name="l555"></a> </span><span class=cF1>if</span><span class=cF0> (flags &amp; </span><span class=cF3>SUF_REM_TRAILING</span><span class=cF0>)
<a name="l556"></a> </span><span class=cF1>while</span><span class=cF0> (dst != _src &amp;&amp; </span><span class=cF7>(</span><span class=cF0>!*dst || </span><span class=cF5>Bt</span><span class=cF0>(</span><span class=cFB>char_bmp_white_space</span><span class=cF0>, *dst)</span><span class=cF7>)</span><span class=cF0>)
<a name="l557"></a> *dst-- = </span><span class=cFE>0</span><span class=cF0>;
<a name="l558"></a> </span><span class=cF1>if</span><span class=cF0> (flags &amp; </span><span class=cF3>SUF_TO_UPPER</span><span class=cF0>)
<a name="l559"></a> </span><span class=cF1>for</span><span class=cF0> (dst = _src; *dst; dst++)
<a name="l560"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l561"></a> ch = *dst;
<a name="l562"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'a'</span><span class=cF0> &lt;= ch &lt;= </span><span class=cF6>'z'</span><span class=cF0>)
<a name="l563"></a> *dst = ch - </span><span class=cFE>0x20</span><span class=cF0>;
<a name="l564"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l565"></a> </span><span class=cF1>if</span><span class=cF0> (flags &amp; </span><span class=cF3>SUF_TO_LOWER</span><span class=cF0>)
<a name="l566"></a> </span><span class=cF1>for</span><span class=cF0> (dst = _src; *dst; dst++)
<a name="l567"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l568"></a> ch = *dst;
<a name="l569"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'A'</span><span class=cF0> &lt;= ch &lt;= </span><span class=cF6>'Z'</span><span class=cF0>)
<a name="l570"></a> *dst = ch + </span><span class=cFE>0x20</span><span class=cF0>;
<a name="l571"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l572"></a> </span><span class=cF1>if</span><span class=cF0> (flags &amp; </span><span class=cF3>SUF_SAFE_DOLLAR</span><span class=cF0>)
<a name="l573"></a> </span><span class=cF1>for</span><span class=cF0> (dst = _src; *dst; dst++)
<a name="l574"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l575"></a> ch = *dst;
<a name="l576"></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_safe_dollar</span><span class=cF0>, *dst</span><span class=cF7>)</span><span class=cF0>)
<a name="l577"></a> *dst = </span><span class=cF6>'.'</span><span class=cF0>;
<a name="l578"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l579"></a> </span><span class=cF1>if</span><span class=cF0> (flags &amp; </span><span class=cF3>SUF_S2T</span><span class=cF0>)
<a name="l580"></a> </span><span class=cF5>Spaces2Tabs</span><span class=cF0>(_src, _src);
2021-07-03 05:07:57 +01:00
<a name="l581"></a>
<a name="l582"></a> </span><span class=cF1>return</span><span class=cF0> _src;
2021-07-03 05:07:57 +01:00
<a name="l583"></a>}
<a name="l584"></a>
<a name="l585"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>StrFirstOcc</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *src, </span><span class=cF1>U8</span><span class=cF0> *marker)
<a name="l586"></a>{</span><span class=cF2>//Point to 1st occurrence of marker set in str.</span><span class=cF0>
<a name="l587"></a> </span><span class=cF9>I64</span><span class=cF0> ch;
2021-07-03 05:07:57 +01:00
<a name="l588"></a>
<a name="l589"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>ch = *src++</span><span class=cF7>)</span><span class=cF0> &amp;&amp; !</span><span class=cF5>StrOcc</span><span class=cF7>(</span><span class=cF0>marker, ch</span><span class=cF7>)</span><span class=cF0>);
<a name="l590"></a> </span><span class=cF1>if</span><span class=cF0> (ch)
<a name="l591"></a> </span><span class=cF1>return</span><span class=cF0> src - </span><span class=cFE>1</span><span class=cF0>;
<a name="l592"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l593"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
2021-07-03 05:07:57 +01:00
<a name="l594"></a>}
<a name="l595"></a>
<a name="l596"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>StrFirstRemove</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *src, </span><span class=cF1>U8</span><span class=cF0> *marker, </span><span class=cF1>U8</span><span class=cF0> *dst=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l597"></a>{</span><span class=cF2>//Remove first str segment and place in dst buf or NULL.</span><span class=cF0>
<a name="l598"></a> </span><span class=cF9>I64</span><span class=cF0> ch;
<a name="l599"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr = src, *res = dst;
2021-07-03 05:07:57 +01:00
<a name="l600"></a>
<a name="l601"></a> </span><span class=cF1>if</span><span class=cF0> (dst)
<a name="l602"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l603"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>ch = *ptr++</span><span class=cF7>)</span><span class=cF0> &amp;&amp; !</span><span class=cF5>StrOcc</span><span class=cF7>(</span><span class=cF0>marker, ch</span><span class=cF7>)</span><span class=cF0>)
<a name="l604"></a> *dst++ = ch;
<a name="l605"></a> *dst = </span><span class=cFE>0</span><span class=cF0>;
<a name="l606"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l607"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l608"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>ch = *ptr++</span><span class=cF7>)</span><span class=cF0> &amp;&amp; !</span><span class=cF5>StrOcc</span><span class=cF7>(</span><span class=cF0>marker, ch</span><span class=cF7>)</span><span class=cF0>);
<a name="l609"></a> </span><span class=cF1>if</span><span class=cF0> (ch)
<a name="l610"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(src, ptr);
<a name="l611"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l612"></a> *src = </span><span class=cFE>0</span><span class=cF0>;
2021-07-03 05:07:57 +01:00
<a name="l613"></a>
<a name="l614"></a> </span><span class=cF1>return</span><span class=cF0> res;
2021-07-03 05:07:57 +01:00
<a name="l615"></a>}
<a name="l616"></a>
<a name="l617"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>StrLastOcc</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *src, </span><span class=cF1>U8</span><span class=cF0> *marker)
<a name="l618"></a>{</span><span class=cF2>//Point to last occurrence of market set in str.</span><span class=cF0>
<a name="l619"></a> </span><span class=cF9>I64</span><span class=cF0> ch;
<a name="l620"></a> </span><span class=cF1>U8</span><span class=cF0> *res = </span><span class=cF3>NULL</span><span class=cF0>;
2021-07-03 05:07:57 +01:00
<a name="l621"></a>
<a name="l622"></a> </span><span class=cF1>while</span><span class=cF0> (ch = *src++)
<a name="l623"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrOcc</span><span class=cF7>(</span><span class=cF0>marker, ch</span><span class=cF7>)</span><span class=cF0>)
<a name="l624"></a> res = src - </span><span class=cFE>1</span><span class=cF0>;
2021-07-03 05:07:57 +01:00
<a name="l625"></a>
<a name="l626"></a> </span><span class=cF1>return</span><span class=cF0> res;
2021-07-03 05:07:57 +01:00
<a name="l627"></a>}
<a name="l628"></a>
<a name="l629"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>StrLastRemove</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *src, </span><span class=cF1>U8</span><span class=cF0> *marker, </span><span class=cF1>U8</span><span class=cF0> *dst=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l630"></a>{</span><span class=cF2>//Remove last str segment and place in dst buf or NULL.</span><span class=cF0>
<a name="l631"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr;
2021-07-03 05:07:57 +01:00
<a name="l632"></a>
<a name="l633"></a> </span><span class=cF1>if</span><span class=cF0> (ptr = </span><span class=cF5>StrLastOcc</span><span class=cF7>(</span><span class=cF0>src, marker</span><span class=cF7>)</span><span class=cF0>)
<a name="l634"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l635"></a> </span><span class=cF1>if</span><span class=cF0> (dst)
<a name="l636"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(dst, ptr + </span><span class=cFE>1</span><span class=cF0>);
<a name="l637"></a> *ptr = </span><span class=cFE>0</span><span class=cF0>;
<a name="l638"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l639"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l640"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l641"></a> </span><span class=cF1>if</span><span class=cF0> (dst)
<a name="l642"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(dst, src);
<a name="l643"></a> *src = </span><span class=cFE>0</span><span class=cF0>;
<a name="l644"></a> </span><span class=cF7>}</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l645"></a>
<a name="l646"></a> </span><span class=cF1>return</span><span class=cF0> dst;
2021-07-03 05:07:57 +01:00
<a name="l647"></a>}
<a name="l648"></a>
<a name="l649"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>StrFind</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *needle, </span><span class=cF1>U8</span><span class=cF0> *haystack_str, </span><span class=cF9>I64</span><span class=cF0> flags=</span><span class=cFE>0</span><span class=cF0>)
<a name="l650"></a>{</span><span class=cF2>//Find needle_str in haystack_str with options.</span><span class=cF0>
<a name="l651"></a> </span><span class=cF1>Bool</span><span class=cF0> cont;
<a name="l652"></a> </span><span class=cF1>U8</span><span class=cF0> *saved_haystack_str = haystack_str;
<a name="l653"></a> </span><span class=cF9>I64</span><span class=cF0> plen = </span><span class=cF5>StrLen</span><span class=cF0>(needle);
2021-07-03 05:07:57 +01:00
<a name="l654"></a>
<a name="l655"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l656"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l657"></a> cont = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l658"></a> </span><span class=cF1>if</span><span class=cF0> (flags &amp; </span><span class=cF3>SFF_IGNORE_CASE</span><span class=cF0>)
<a name="l659"></a> haystack_str = </span><span class=cF5>StrIMatch</span><span class=cF0>(needle, haystack_str);
<a name="l660"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l661"></a> haystack_str = </span><span class=cF5>StrMatch</span><span class=cF0>(needle, haystack_str);
<a name="l662"></a> </span><span class=cF1>if</span><span class=cF0> (haystack_str &amp;&amp; flags &amp; </span><span class=cF3>SFF_WHOLE_LABELS_BEFORE</span><span class=cF0> &amp;&amp; haystack_str != saved_haystack_str &amp;&amp;
<a name="l663"></a> </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>char_bmp_alpha_numeric</span><span class=cF0>, *(haystack_str - </span><span class=cFE>1</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
<a name="l664"></a> {
<a name="l665"></a> haystack_str++;
<a name="l666"></a> </span><span class=cF1>if</span><span class=cF0> (*haystack_str)
<a name="l667"></a> cont = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l668"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l669"></a> haystack_str = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l670"></a> }
<a name="l671"></a> </span><span class=cF1>if</span><span class=cF0> (haystack_str &amp;&amp; flags &amp; </span><span class=cF3>SFF_WHOLE_LABELS_AFTER</span><span class=cF0> &amp;&amp; </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>char_bmp_alpha_numeric</span><span class=cF0>, *(haystack_str + plen)</span><span class=cF7>)</span><span class=cF0>)
<a name="l672"></a> {
<a name="l673"></a> haystack_str++;
<a name="l674"></a> </span><span class=cF1>if</span><span class=cF0> (*haystack_str)
<a name="l675"></a> cont = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l676"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l677"></a> haystack_str = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l678"></a> }
<a name="l679"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l680"></a> </span><span class=cF1>while</span><span class=cF0> (cont);
2021-07-03 05:07:57 +01:00
<a name="l681"></a>
<a name="l682"></a> </span><span class=cF1>return</span><span class=cF0> haystack_str;
2021-07-03 05:07:57 +01:00
<a name="l683"></a>}
<a name="l684"></a>
<a name="l685"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>StrReplace</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *str, </span><span class=cF1>U8</span><span class=cF0> *old, </span><span class=cF1>U8</span><span class=cF0> *new, </span><span class=cF9>I64</span><span class=cF0> sff_flags=</span><span class=cF3>NONE</span><span class=cF0>, </span><span class=cF1>Bool</span><span class=cF0> free_str=</span><span class=cF3>FALSE</span><span class=cF0>)
<a name="l686"></a>{</span><span class=cF2>//Replace all instances of old with new in str. New MAlloc()ed string. free_str aids in chain replacement.</span><span class=cF0>
<a name="l687"></a> </span><span class=cF1>U8</span><span class=cF0> *str_start, *str_end = str, *str_loc, *tmpm = </span><span class=cF3>NULL</span><span class=cF0>;
2021-07-03 05:07:57 +01:00
<a name="l688"></a>
<a name="l689"></a> </span><span class=cF1>if</span><span class=cF0> (!*old)
<a name="l690"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l691"></a> str_start = </span><span class=cF5>StrNew</span><span class=cF0>(new);
<a name="l692"></a> </span><span class=cF1>goto</span><span class=cF0> sr_end2;
<a name="l693"></a> </span><span class=cF7>}</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l694"></a>
<a name="l695"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>old, new</span><span class=cF7>)</span><span class=cF0>)
<a name="l696"></a> </span><span class=cF1>goto</span><span class=cF0> sr_end;
2021-07-03 05:07:57 +01:00
<a name="l697"></a>
<a name="l698"></a> </span><span class=cF1>while</span><span class=cF0> (str_loc = str_end = </span><span class=cF5>StrFind</span><span class=cF7>(</span><span class=cF0>old, str_end, sff_flags</span><span class=cF7>)</span><span class=cF0>)
<a name="l699"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l700"></a> str_start = str;
<a name="l701"></a> str_end += </span><span class=cF5>StrLen</span><span class=cF0>(old); </span><span class=cF2>//Move start marker past old str, cutting it out</span><span class=cF0>
<a name="l702"></a> str_start[</span><span class=cF5>StrLen</span><span class=cF0>(str_start) - </span><span class=cF5>StrLen</span><span class=cF0>(str_loc)] = </span><span class=cF6>'\0'</span><span class=cF0>; </span><span class=cF2>//End str_start right before where old was</span><span class=cF0>
<a name="l703"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpm);
<a name="l704"></a> tmpm = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;%s%s%s&quot;</span><span class=cF0>, str_start, new, str_end);
<a name="l705"></a> str = tmpm;
<a name="l706"></a> </span><span class=cF7>}</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l707"></a>sr_end:
<a name="l708"></a> str_start = </span><span class=cF5>StrNew</span><span class=cF0>(str);
2021-07-03 05:07:57 +01:00
<a name="l709"></a>sr_end2:
<a name="l710"></a> </span><span class=cF1>if</span><span class=cF0> (free_str)
<a name="l711"></a> </span><span class=cF5>Free</span><span class=cF0>(str);
<a name="l712"></a> </span><span class=cF1>return</span><span class=cF0> str_start;
2021-07-03 05:07:57 +01:00
<a name="l713"></a>}
<a name="l714"></a>
<a name="l715"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>WildMatch</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *test_str, </span><span class=cF1>U8</span><span class=cF0> *wild_str)
<a name="l716"></a>{</span><span class=cF2>//Wildcard match with '*' and '?'.</span><span class=cF0>
<a name="l717"></a> </span><span class=cF9>I64</span><span class=cF0> ch1, ch2;
<a name="l718"></a> </span><span class=cF1>U8</span><span class=cF0> *fall_back_src = </span><span class=cF3>NULL</span><span class=cF0>, *fall_back_wild = </span><span class=cF3>NULL</span><span class=cF0>;
2021-07-03 05:07:57 +01:00
<a name="l719"></a>
<a name="l720"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l721"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l722"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>ch1 = *test_str++</span><span class=cF7>)</span><span class=cF0>)
<a name="l723"></a> {
<a name="l724"></a> </span><span class=cF1>if</span><span class=cF0> (*wild_str &amp;&amp; *wild_str != </span><span class=cF6>'*'</span><span class=cF0>)
<a name="l725"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l726"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l727"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l728"></a> }
<a name="l729"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l730"></a> {
<a name="l731"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>ch2 = *wild_str++</span><span class=cF7>)</span><span class=cF0>)
<a name="l732"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l733"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l734"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l735"></a> </span><span class=cF1>if</span><span class=cF0> (ch2 == </span><span class=cF6>'*'</span><span class=cF0>)
<a name="l736"></a> {
<a name="l737"></a> fall_back_wild = wild_str - </span><span class=cFE>1</span><span class=cF0>;
<a name="l738"></a> fall_back_src = test_str;
<a name="l739"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>ch2 = *wild_str++</span><span class=cF7>)</span><span class=cF0>)
<a name="l740"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l741"></a> </span><span class=cF1>while</span><span class=cF0> (ch2 != ch1)
<a name="l742"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>ch1 = *test_str++</span><span class=cF7>)</span><span class=cF0>)
<a name="l743"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l744"></a> }
<a name="l745"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l746"></a> </span><span class=cF1>if</span><span class=cF0> (ch2 != </span><span class=cF6>'?'</span><span class=cF0> &amp;&amp; ch1 != ch2)
<a name="l747"></a> {
<a name="l748"></a> </span><span class=cF1>if</span><span class=cF0> (fall_back_wild)
<a name="l749"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l750"></a> wild_str = fall_back_wild;
<a name="l751"></a> test_str = fall_back_src;
<a name="l752"></a> fall_back_wild = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l753"></a> fall_back_src = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l754"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l755"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l756"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l757"></a> }
<a name="l758"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l759"></a> }
<a name="l760"></a> </span><span class=cF7>}</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l761"></a>}
</span></pre></body>
</html>