ZealOS/docs/Kernel/StrB.CC.html

257 lines
23 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.06">
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>Tabs2Spaces</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *src)
<a name="l2"></a>{</span><span class=cF2>//MAlloc str with tabs to spaces.</span><span class=cF0>
<a name="l3"></a> </span><span class=cF9>I64</span><span class=cF0> ch, i, j, l = </span><span class=cF5>StrLen</span><span class=cF0>(src) &lt;&lt; </span><span class=cFE>1</span><span class=cF0> + </span><span class=cFE>2</span><span class=cF0>, col = </span><span class=cFE>0</span><span class=cF0>;
<a name="l4"></a> </span><span class=cF1>U8</span><span class=cF0> *dst = </span><span class=cF5>MAlloc</span><span class=cF0>(l), *tmp;
2021-07-03 05:07:57 +01:00
<a name="l5"></a>
<a name="l6"></a> </span><span class=cF1>while</span><span class=cF0> (ch = *src++)
<a name="l7"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l8"></a> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF6>'\t'</span><span class=cF0>)
<a name="l9"></a> {
<a name="l10"></a> j = (col + </span><span class=cFE>8</span><span class=cF0>) &amp; ~</span><span class=cFE>7</span><span class=cF0>;
<a name="l11"></a> </span><span class=cF1>for</span><span class=cF0> (i = col; i &lt; j; i++)
<a name="l12"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l13"></a> dst[i] = </span><span class=cF3>CH_SPACE</span><span class=cF0>;
<a name="l14"></a> </span><span class=cF1>if</span><span class=cF0> (i &gt;= l - </span><span class=cFE>2</span><span class=cF0>)
<a name="l15"></a> {
<a name="l16"></a> tmp = </span><span class=cF5>MAlloc</span><span class=cF0>(l &lt;&lt; </span><span class=cFE>1</span><span class=cF0>);
<a name="l17"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(tmp, dst, i + </span><span class=cFE>1</span><span class=cF0>);
<a name="l18"></a> </span><span class=cF5>Free</span><span class=cF0>(dst);
<a name="l19"></a> l &lt;&lt;= </span><span class=cFE>1</span><span class=cF0>;
<a name="l20"></a> dst = tmp;
<a name="l21"></a> }
<a name="l22"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l23"></a> col = j;
<a name="l24"></a> }
<a name="l25"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l26"></a> {
<a name="l27"></a> dst[col] = ch;
<a name="l28"></a> </span><span class=cF1>if</span><span class=cF0> (col &gt;= l - </span><span class=cFE>2</span><span class=cF0>)
<a name="l29"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l30"></a> tmp = </span><span class=cF5>MAlloc</span><span class=cF0>(l &lt;&lt; </span><span class=cFE>1</span><span class=cF0>);
<a name="l31"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(tmp, dst, col + </span><span class=cFE>1</span><span class=cF0>);
<a name="l32"></a> </span><span class=cF5>Free</span><span class=cF0>(dst);
<a name="l33"></a> l &lt;&lt;= </span><span class=cFE>1</span><span class=cF0>;
<a name="l34"></a> dst = tmp;
<a name="l35"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l36"></a> col++;
<a name="l37"></a> }
<a name="l38"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l39"></a> dst[col] = </span><span class=cFE>0</span><span class=cF0>;
2021-07-03 05:07:57 +01:00
<a name="l40"></a>
<a name="l41"></a> </span><span class=cF1>return</span><span class=cF0> dst;
2021-07-03 05:07:57 +01:00
<a name="l42"></a>}
<a name="l43"></a>
<a name="l44"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>ScaleIndent</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *src, </span><span class=cF1>F64</span><span class=cF0> indent_scale_factor)
<a name="l45"></a>{</span><span class=cF2>//MAlloced str.</span><span class=cF0> </span><span class=cF2>8*0.25--&gt;2 or 8*2.0--&gt;16</span><span class=cF0>
<a name="l46"></a> </span><span class=cF9>I64</span><span class=cF0> ch, i, col = </span><span class=cFE>0</span><span class=cF0>;
<a name="l47"></a> </span><span class=cF1>U8</span><span class=cF0> *dst, *dst2;
2021-07-03 05:07:57 +01:00
<a name="l48"></a>
<a name="l49"></a> </span><span class=cF1>while</span><span class=cF0> (ch = *src++)
<a name="l50"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l51"></a> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF6>'\t'</span><span class=cF0>)
<a name="l52"></a> col = (col + </span><span class=cFE>8</span><span class=cF0>) &amp; -</span><span class=cFE>0x8</span><span class=cF0>;
<a name="l53"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF3>CH_SPACE</span><span class=cF0>)
<a name="l54"></a> col++;
<a name="l55"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l56"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l57"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l58"></a> src--;
<a name="l59"></a> col = </span><span class=cF5>Round</span><span class=cF0>(indent_scale_factor * col);
<a name="l60"></a> dst = dst2 = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>src</span><span class=cF7>)</span><span class=cF0> + col / </span><span class=cFE>8</span><span class=cF0> + col &amp; </span><span class=cFE>7</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0>);
<a name="l61"></a> </span><span class=cF1>for</span><span class=cF0> (i = col / </span><span class=cFE>8</span><span class=cF0>; i &gt; </span><span class=cFE>0</span><span class=cF0>; i--)
<a name="l62"></a> *dst2++ = </span><span class=cF6>'\t'</span><span class=cF0>;
<a name="l63"></a> </span><span class=cF1>for</span><span class=cF0> (i = col &amp; </span><span class=cFE>7</span><span class=cF0>; i &gt; </span><span class=cFE>0</span><span class=cF0>; i--)
<a name="l64"></a> *dst2++ = </span><span class=cF3>CH_SPACE</span><span class=cF0>;
<a name="l65"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(dst2, src);
2021-07-03 05:07:57 +01:00
<a name="l66"></a>
<a name="l67"></a> </span><span class=cF1>return</span><span class=cF0> dst;
2021-07-03 05:07:57 +01:00
<a name="l68"></a>}
<a name="l69"></a>
<a name="l70"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>MStrUtil</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *src, </span><span class=cF9>I64</span><span class=cF0> flags, </span><span class=cF1>F64</span><span class=cF0> indent_scale_factor=</span><span class=cFE>0</span><span class=cF0>)
<a name="l71"></a>{</span><span class=cF2>//MAlloc </span><a href="https://tomawezome.github.io/ZealOS/Kernel/StrA.CC.html#l528"><span class=cF4>StrUtil</span></a><span class=cF2>().</span><span class=cF0>
<a name="l72"></a> </span><span class=cF1>U8</span><span class=cF0> *dst = </span><span class=cF5>StrNew</span><span class=cF0>(src), *dst2, *tmp;
2021-07-03 05:07:57 +01:00
<a name="l73"></a>
<a name="l74"></a> </span><span class=cF5>StrUtil</span><span class=cF0>(dst, flags);
<a name="l75"></a> </span><span class=cF1>if</span><span class=cF0> (flags &amp; </span><span class=cF3>SUF_T2S</span><span class=cF0>)
<a name="l76"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l77"></a> tmp = </span><span class=cF5>Tabs2Spaces</span><span class=cF0>(dst);
<a name="l78"></a> </span><span class=cF5>Free</span><span class=cF0>(dst);
<a name="l79"></a> dst = tmp;
<a name="l80"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l81"></a> </span><span class=cF1>if</span><span class=cF0> (flags &amp; </span><span class=cF3>SUF_SCALE_INDENT</span><span class=cF0>)
<a name="l82"></a> dst2 = </span><span class=cF5>ScaleIndent</span><span class=cF0>(dst, indent_scale_factor);
<a name="l83"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l84"></a> dst2 = </span><span class=cF5>StrNew</span><span class=cF0>(dst); </span><span class=cF2>//Shorten to just right size.</span><span class=cF0>
<a name="l85"></a> </span><span class=cF5>Free</span><span class=cF0>(dst);
2021-07-03 05:07:57 +01:00
<a name="l86"></a>
<a name="l87"></a> </span><span class=cF1>return</span><span class=cF0> dst2;
2021-07-03 05:07:57 +01:00
<a name="l88"></a>}
<a name="l89"></a>
<a name="l90"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>GetOutOfDollar</span><span class=cF0>()
<a name="l91"></a>{</span><span class=cF2>//If a $ has been printed, print another $ to exit mode.</span><span class=cF0>
<a name="l92"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc;
2021-07-03 05:07:57 +01:00
<a name="l93"></a>
<a name="l94"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>IsRaw</span><span class=cF0>)
<a name="l95"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l96"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>text</span><span class=cF0>.raw_flags &amp; </span><span class=cF3>RAWF_IN_DOLLAR</span><span class=cF0>)
<a name="l97"></a> </span><span class=cF6>'$'</span><span class=cF0>;
<a name="l98"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l99"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l100"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l101"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>fp_doc_put</span><span class=cF0> &amp;&amp; </span><span class=cF7>(</span><span class=cF0>doc = (*</span><span class=cFB>fp_doc_put</span><span class=cF0>)(</span><span class=cF5>Fs</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> &amp;&amp; doc-&gt;flags &amp; </span><span class=cF3>DOCF_IN_DOLLAR</span><span class=cF0>)
<a name="l102"></a> </span><span class=cF6>'$'</span><span class=cF0>;
<a name="l103"></a> </span><span class=cF7>}</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l104"></a>}
<a name="l105"></a>
<a name="l106"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>YorN</span><span class=cF0>()
<a name="l107"></a>{</span><span class=cF2>//Wait for user to answer Y or N.</span><span class=cF0>
<a name="l108"></a> </span><span class=cF9>I64</span><span class=cF0> ch;
2021-07-03 05:07:57 +01:00
<a name="l109"></a>
<a name="l110"></a> </span><span class=cF6>&quot;(y or n)? &quot;</span><span class=cF0>;
<a name="l111"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l112"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l113"></a> ch = </span><span class=cF5>ToUpper</span><span class=cF0>(</span><span class=cF5>CharGet</span><span class=cF7>(</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF7>)</span><span class=cF0>);
<a name="l114"></a> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF6>'Y'</span><span class=cF0>)
<a name="l115"></a> {
<a name="l116"></a> </span><span class=cF6>&quot;$PT$YES$FG$\n&quot;</span><span class=cF0>;
<a name="l117"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l118"></a> }
<a name="l119"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF6>'N'</span><span class=cF0>)
<a name="l120"></a> {
<a name="l121"></a> </span><span class=cF6>&quot;$PT$NO$FG$\n&quot;</span><span class=cF0>;
<a name="l122"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l123"></a> }
<a name="l124"></a> </span><span class=cF7>}</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l125"></a>}
<a name="l126"></a>
<a name="l127"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>PressAKey</span><span class=cF0>()
<a name="l128"></a>{</span><span class=cF2>//Print &quot;Press a key&quot; and wait for non-zero </span><a href="https://tomawezome.github.io/ZealOS/Kernel/KernelA.HH.html#l4093"><span class=cF4>ASCII</span></a><span class=cF2> key.</span><span class=cF0>
<a name="l129"></a> </span><span class=cF6>&quot;$BK,1$PRESS A KEY$BK,0$\n&quot;</span><span class=cF0>;
<a name="l130"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>CharGet</span><span class=cF0>(, </span><span class=cF3>FALSE</span><span class=cF0>);
2021-07-03 05:07:57 +01:00
<a name="l131"></a>}
<a name="l132"></a>
<a name="l133"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>AreYouSure</span><span class=cF0>()
<a name="l134"></a>{</span><span class=cF2>//Print &quot;Are you sure&quot; and waits for Y or N.</span><span class=cF0>
<a name="l135"></a> </span><span class=cF6>&quot;ARE YOU SURE &quot;</span><span class=cF0>;
<a name="l136"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>YorN</span><span class=cF0>;
2021-07-03 05:07:57 +01:00
<a name="l137"></a>}
<a name="l138"></a>
<a name="l139"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>Help</span><span class=cF0>()
<a name="l140"></a>{</span><span class=cF2>//Debug help or master help index file.</span><span class=cF0>
<a name="l141"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>IsDebugMode</span><span class=cF0>)
<a name="l142"></a> </span><span class=cFD>DebugHelp</span><span class=cF0>;
<a name="l143"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l144"></a> </span><span class=cF5>PopUp</span><span class=cF0>(</span><span class=cF6>&quot;Type(\&quot;::/Doc/HelpIndex.DD\&quot;);DocTop;View;&quot;</span><span class=cF0>);
2021-07-03 05:07:57 +01:00
<a name="l145"></a>}
<a name="l146"></a>
<a name="l147"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>FlagsScan</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *_dst_flags, </span><span class=cF1>U8</span><span class=cF0> *list, </span><span class=cF1>U8</span><span class=cF0> *src)
<a name="l148"></a>{</span><span class=cF2>/*More than 64 flags. Flags passed by ref.</span><span class=cF0>
<a name="l149"></a>
<a name="l150"></a></span><span class=cF2>Examples:</span><span class=cF4>
<a name="l151"></a></span><a href="https://tomawezome.github.io/ZealOS/System/Utils/Find.CC.html#l187"><span class=cF4>FlagsScan</span></a><span class=cF2>(&amp;fuf_flags,Define(&quot;ST_FILE_UTIL_FLAGS&quot;),fu_flags);</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l152"></a>
<a name="l153"></a></span><span class=cF2>I64 flags=0;</span><span class=cF0>
<a name="l154"></a></span><span class=cF2>FlagsScan(&amp;flags,&quot;R\0L\0Dump\0Scan\0&quot;,&quot;+Dump-R&quot;); //Sets Bit#2, Clears Bit#0.</span><span class=cF0>
<a name="l155"></a></span><span class=cF2>*/</span><span class=cF0>
<a name="l156"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l157"></a> </span><span class=cF1>U8</span><span class=cF0> *buf, *ptr;
2021-07-03 05:07:57 +01:00
<a name="l158"></a>
<a name="l159"></a> </span><span class=cF1>if</span><span class=cF0> (src)
<a name="l160"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l161"></a> buf = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>src</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0>);
<a name="l162"></a> </span><span class=cF1>while</span><span class=cF0> (*src)
<a name="l163"></a> {
<a name="l164"></a> </span><span class=cF1>while</span><span class=cF0> (*src &amp;&amp; *src != </span><span class=cF6>'+'</span><span class=cF0> &amp;&amp; *src != </span><span class=cF6>'-'</span><span class=cF0>)
<a name="l165"></a> src++;
<a name="l166"></a> </span><span class=cF1>if</span><span class=cF0> (*src == </span><span class=cF6>'+'</span><span class=cF0>)
<a name="l167"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l168"></a> src++;
<a name="l169"></a> </span><span class=cF1>if</span><span class=cF0> (*src)
<a name="l170"></a> {
<a name="l171"></a> ptr = buf;
<a name="l172"></a> </span><span class=cF1>while</span><span class=cF0> (*src &amp;&amp; *src != </span><span class=cF6>'+'</span><span class=cF0> &amp;&amp; *src != </span><span class=cF6>'-'</span><span class=cF0> &amp;&amp; *src != </span><span class=cF3>CH_SPACE</span><span class=cF0>)
<a name="l173"></a> *ptr++ = *src++;
<a name="l174"></a> *ptr = </span><span class=cFE>0</span><span class=cF0>;
<a name="l175"></a> i = </span><span class=cF5>ListMatch</span><span class=cF0>(buf, list);
<a name="l176"></a> </span><span class=cF1>if</span><span class=cF0> (i &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l177"></a> </span><span class=cF5>LBts</span><span class=cF0>(_dst_flags, i);
<a name="l178"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l179"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l180"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l181"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'ScanFlag'</span><span class=cF0>);
<a name="l182"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l183"></a> }
<a name="l184"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l185"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (*src == </span><span class=cF6>'-'</span><span class=cF0>)
<a name="l186"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l187"></a> src++;
<a name="l188"></a> </span><span class=cF1>if</span><span class=cF0> (*src)
<a name="l189"></a> {
<a name="l190"></a> ptr = buf;
<a name="l191"></a> </span><span class=cF1>while</span><span class=cF0> (*src &amp;&amp; *src != </span><span class=cF6>'+'</span><span class=cF0> &amp;&amp; *src != </span><span class=cF6>'-'</span><span class=cF0> &amp;&amp; *src != </span><span class=cF3>CH_SPACE</span><span class=cF0>)
<a name="l192"></a> *ptr++ = *src++;
<a name="l193"></a> *ptr = </span><span class=cFE>0</span><span class=cF0>;
<a name="l194"></a> i = </span><span class=cF5>ListMatch</span><span class=cF0>(buf, list);
<a name="l195"></a> </span><span class=cF1>if</span><span class=cF0> (i &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l196"></a> </span><span class=cF5>LBtr</span><span class=cF0>(_dst_flags, i);
<a name="l197"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l198"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l199"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l200"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'ScanFlag'</span><span class=cF0>);
<a name="l201"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l202"></a> }
<a name="l203"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l204"></a> }
<a name="l205"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l206"></a> </span><span class=cF7>}</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l207"></a>}
<a name="l208"></a>
<a name="l209"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>FlagsStrPrint</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *dst, </span><span class=cF1>U8</span><span class=cF0> *list, </span><span class=cF9>I64</span><span class=cF0> flags, </span><span class=cF1>Bool</span><span class=cF0> print_all=</span><span class=cF3>FALSE</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> print_all_length=</span><span class=cFE>0</span><span class=cF0>)
<a name="l210"></a>{</span><span class=cF2>//Only 64 flags. Flags passed by value. print_all will print false flags using `-`.</span><span class=cF0>
<a name="l211"></a></span><span class=cF2>//Specify print_all_length (list length) if print_all is true.</span><span class=cF0>
<a name="l212"></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="l213"></a>
<a name="l214"></a> *dst = </span><span class=cFE>0</span><span class=cF0>;
<a name="l215"></a> </span><span class=cF1>if</span><span class=cF0> (!print_all_length)
<a name="l216"></a> print_all_length = </span><span class=cFE>64</span><span class=cF0>;
<a name="l217"></a> </span><span class=cF1>while</span><span class=cF0> (i &lt; print_all_length)
<a name="l218"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l219"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;flags, i</span><span class=cF7>)</span><span class=cF0>)
<a name="l220"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(dst, </span><span class=cF6>&quot;+%z&quot;</span><span class=cF0>, i, list);
<a name="l221"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (print_all)
<a name="l222"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(dst, </span><span class=cF6>&quot;-%z&quot;</span><span class=cF0>, i, list);
<a name="l223"></a> i++;
<a name="l224"></a> </span><span class=cF7>}</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l225"></a>
<a name="l226"></a> </span><span class=cF1>return</span><span class=cF0> dst;
2021-07-03 05:07:57 +01:00
<a name="l227"></a>}
</span></pre></body>
</html>