ZealOS/docs/System/Utils/LineRep.CC.html
2021-08-17 02:47:37 -04:00

149 lines
13 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.00">
<style type="text/css">
body {background-color:#fef1f0;}
.cF0{color:#000000;background-color:#fef1f0;}
.cF1{color:#0148a4;background-color:#fef1f0;}
.cF2{color:#3b7901;background-color:#fef1f0;}
.cF3{color:#057c7e;background-color:#fef1f0;}
.cF4{color:#bb2020;background-color:#fef1f0;}
.cF5{color:#9e42ae;background-color:#fef1f0;}
.cF6{color:#b57901;background-color:#fef1f0;}
.cF7{color:#b2b6af;background-color:#fef1f0;}
.cF8{color:#555753;background-color:#fef1f0;}
.cF9{color:#678fbb;background-color:#fef1f0;}
.cFA{color:#82bc49;background-color:#fef1f0;}
.cFB{color:#0097a2;background-color:#fef1f0;}
.cFC{color:#e26a6a;background-color:#fef1f0;}
.cFD{color:#c671bc;background-color:#fef1f0;}
.cFE{color:#c7ab00;background-color:#fef1f0;}
.cFF{color:#fef1f0;background-color:#fef1f0;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Cmd Line (Typically)&quot;</span><span class=cF0>
<a name="l2"></a>
<a name="l3"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>LineRep1</span><span class=cF0>(</span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde)
<a name="l4"></a>{
<a name="l5"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc;
<a name="l6"></a> </span><span class=cF9>I64</span><span class=cF0> res = </span><span class=cFE>0</span><span class=cF0>, i;
<a name="l7"></a>
<a name="l8"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde)
<a name="l9"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l10"></a> i = </span><span class=cFE>0</span><span class=cF0>;
<a name="l11"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde-&gt;attr &amp; </span><span class=cF3>RS_ATTR_DIR</span><span class=cF0>)
<a name="l12"></a> i = </span><span class=cF5>LineRep1</span><span class=cF0>(tmpde-&gt;sub);
<a name="l13"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l14"></a> {
<a name="l15"></a> doc = </span><span class=cF5>DocRead</span><span class=cF0>(tmpde-&gt;full_name);
<a name="l16"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;head.next != doc)
<a name="l17"></a> i = doc-&gt;head.last-&gt;y + </span><span class=cFE>2</span><span class=cF0>;
<a name="l18"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
<a name="l19"></a> }
<a name="l20"></a> tmpde-&gt;user_data = i;
<a name="l21"></a> res += i;
<a name="l22"></a> tmpde = tmpde-&gt;next;
<a name="l23"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l24"></a>
<a name="l25"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l26"></a>}
<a name="l27"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>LineRep2</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde)
<a name="l28"></a>{
<a name="l29"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde)
<a name="l30"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l31"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde-&gt;attr &amp; </span><span class=cF3>RS_ATTR_DIR</span><span class=cF0>)
<a name="l32"></a> {
<a name="l33"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;%8,d $TR+C,\&quot;%s\&quot;$\n$ID,2$&quot;</span><span class=cF0>, tmpde-&gt;user_data, tmpde-&gt;name);
<a name="l34"></a> </span><span class=cF5>LineRep2</span><span class=cF0>(doc, tmpde-&gt;sub);
<a name="l35"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;$ID,-2$&quot;</span><span class=cF0>);
<a name="l36"></a> }
<a name="l37"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l38"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;%8,d $LK,\&quot;%s\&quot;,A=\&quot;FI:%s\&quot;$\n&quot;</span><span class=cF0>, tmpde-&gt;user_data, tmpde-&gt;name, tmpde-&gt;full_name);
<a name="l39"></a> tmpde = tmpde-&gt;next;
<a name="l40"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l41"></a>}
<a name="l42"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>LineRep</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *files_find_mask=</span><span class=cF6>&quot;/*&quot;</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> *fu_flags=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l43"></a>{</span><span class=cF2>//Source line-of-code count report.</span><span class=cF0>
<a name="l44"></a> </span><span class=cF9>I64</span><span class=cF0> fuf_flags = </span><span class=cFE>0</span><span class=cF0>, res = </span><span class=cFE>0</span><span class=cF0>;
<a name="l45"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc = </span><span class=cF5>DocNew</span><span class=cF0>;
<a name="l46"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde1 = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l47"></a>
<a name="l48"></a> </span><span class=cF5>FlagsScan</span><span class=cF0>(&amp;fuf_flags, </span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF6>&quot;ST_FILE_UTIL_FLAGS&quot;</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF6>&quot;+r+S&quot;</span><span class=cF0>);
<a name="l49"></a> </span><span class=cF5>FlagsScan</span><span class=cF0>(&amp;fuf_flags, </span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF6>&quot;ST_FILE_UTIL_FLAGS&quot;</span><span class=cF7>)</span><span class=cF0>, fu_flags);
<a name="l50"></a>
<a name="l51"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde1 = </span><span class=cF5>FilesFind</span><span class=cF7>(</span><span class=cF0>files_find_mask, fuf_flags</span><span class=cF7>)</span><span class=cF0>)
<a name="l52"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l53"></a> res = </span><span class=cF5>LineRep1</span><span class=cF0>(tmpde1);
<a name="l54"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;%8,d $TR+C,\&quot;%s\&quot;$\n$ID,2$&quot;</span><span class=cF0>, res, files_find_mask);
<a name="l55"></a> </span><span class=cF5>LineRep2</span><span class=cF0>(doc, tmpde1);
<a name="l56"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;$ID,-2$&quot;</span><span class=cF0>);
<a name="l57"></a> </span><span class=cF5>DirTreeDel</span><span class=cF0>(tmpde1);
<a name="l58"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l59"></a> </span><span class=cF5>DocInsDoc</span><span class=cF0>(</span><span class=cF5>DocPut</span><span class=cF0>, doc);
<a name="l60"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
<a name="l61"></a>
<a name="l62"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l63"></a>}
<a name="l64"></a>
<a name="l65"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>SizeRep1</span><span class=cF0>(</span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde)
<a name="l66"></a>{
<a name="l67"></a> </span><span class=cF9>I64</span><span class=cF0> res = </span><span class=cFE>0</span><span class=cF0>, i;
<a name="l68"></a>
<a name="l69"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde)
<a name="l70"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l71"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde-&gt;attr &amp; </span><span class=cF3>RS_ATTR_DIR</span><span class=cF0>)
<a name="l72"></a> i = </span><span class=cF5>SizeRep1</span><span class=cF0>(tmpde-&gt;sub);
<a name="l73"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l74"></a> i = tmpde-&gt;size;
<a name="l75"></a> tmpde-&gt;user_data = i; </span><span class=cF2>//Store size of the entry in user_data</span><span class=cF0>
<a name="l76"></a> res += i;
<a name="l77"></a> tmpde = tmpde-&gt;next;
<a name="l78"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l79"></a>
<a name="l80"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l81"></a>}
<a name="l82"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SizeRep2</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc,</span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde)
<a name="l83"></a>{
<a name="l84"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde)
<a name="l85"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l86"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde-&gt;attr &amp; </span><span class=cF3>RS_ATTR_DIR</span><span class=cF0>)
<a name="l87"></a> {
<a name="l88"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;%10,d $TR+C,\&quot;%s\&quot;$\n$ID,2$&quot;</span><span class=cF0>, tmpde-&gt;user_data, tmpde-&gt;name);
<a name="l89"></a> </span><span class=cF5>SizeRep2</span><span class=cF0>(doc, tmpde-&gt;sub);
<a name="l90"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;$ID,-2$&quot;</span><span class=cF0>);
<a name="l91"></a> }
<a name="l92"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l93"></a> {
<a name="l94"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;%10,d &quot;</span><span class=cF0>, tmpde-&gt;user_data);
<a name="l95"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;$LK,\&quot;%s\&quot;,A=\&quot;FI:%s\&quot;$\n&quot;</span><span class=cF0>, tmpde-&gt;name, tmpde-&gt;full_name);
<a name="l96"></a> }
<a name="l97"></a> tmpde = tmpde-&gt;next;
<a name="l98"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l99"></a>}
<a name="l100"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>SizeRep</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *files_find_mask=</span><span class=cF6>&quot;/*&quot;</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> *fu_flags=</span><span class=cF3>NONE</span><span class=cF0>)
<a name="l101"></a>{</span><span class=cF2>//Report file sizes.</span><span class=cF0>
<a name="l102"></a> </span><span class=cF9>I64</span><span class=cF0> fuf_flags = </span><span class=cFE>0</span><span class=cF0>, res = </span><span class=cFE>0</span><span class=cF0>;
<a name="l103"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc = </span><span class=cF5>DocNew</span><span class=cF0>;
<a name="l104"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde1 = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l105"></a>
<a name="l106"></a> </span><span class=cF5>FlagsScan</span><span class=cF0>(&amp;fuf_flags, </span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF6>&quot;ST_FILE_UTIL_FLAGS&quot;</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF6>&quot;+r&quot;</span><span class=cF0>);
<a name="l107"></a> </span><span class=cF5>FlagsScan</span><span class=cF0>(&amp;fuf_flags, </span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF6>&quot;ST_FILE_UTIL_FLAGS&quot;</span><span class=cF7>)</span><span class=cF0>, fu_flags);
<a name="l108"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde1 = </span><span class=cF5>FilesFind</span><span class=cF7>(</span><span class=cF0>files_find_mask, fuf_flags &amp; </span><span class=cF3>FUG_FILES_FIND</span><span class=cF7>)</span><span class=cF0>)
<a name="l109"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l110"></a> res = </span><span class=cF5>SizeRep1</span><span class=cF0>(tmpde1);
<a name="l111"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;%10,d $TR+C,\&quot;%s\&quot;$\n$ID,2$&quot;</span><span class=cF0>, res, files_find_mask);
<a name="l112"></a> </span><span class=cF5>SizeRep2</span><span class=cF0>(doc, tmpde1);
<a name="l113"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;$ID,-2$&quot;</span><span class=cF0>);
<a name="l114"></a> </span><span class=cF5>DirTreeDel</span><span class=cF0>(tmpde1);
<a name="l115"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l116"></a> </span><span class=cF5>DocInsDoc</span><span class=cF0>(</span><span class=cF5>DocPut</span><span class=cF0>,doc);
<a name="l117"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
<a name="l118"></a>
<a name="l119"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l120"></a>}
</span></pre></body>
</html>