templeos-info/public/Wb/Adam/Opt/Utils/LineRep.HC.HTML

141 lines
14 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="generator" content="TempleOS V5.03">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/style/templeos.css">
<script src="/script/templeos.js"></script>
<style type="text/css">
.cF0{color:#000000;background-color:#ffffff;}
.cF1{color:#0000aa;background-color:#ffffff;}
.cF2{color:#00aa00;background-color:#ffffff;}
.cF3{color:#00aaaa;background-color:#ffffff;}
.cF4{color:#aa0000;background-color:#ffffff;}
.cF5{color:#aa00aa;background-color:#ffffff;}
.cF6{color:#aa5500;background-color:#ffffff;}
.cF7{color:#aaaaaa;background-color:#ffffff;}
.cF8{color:#555555;background-color:#ffffff;}
.cF9{color:#5555ff;background-color:#ffffff;}
.cFA{color:#55ff55;background-color:#ffffff;}
.cFB{color:#55ffff;background-color:#ffffff;}
.cFC{color:#ff5555;background-color:#ffffff;}
.cFD{color:#ff55ff;background-color:#ffffff;}
.cFE{color:#ffff55;background-color:#ffffff;}
.cFF{color:#ffffff;background-color:#ffffff;}
</style>
</head>
<body>
<pre id="content">
<a name="l1"></a><span class=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=0,i;
<a name="l7"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde) </span><span class=cF7>{</span><span class=cF0>
<a name="l8"></a> i=0;
<a name="l9"></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="l10"></a> i=</span><span class=cF5>LineRep1</span><span class=cF0>(tmpde-&gt;sub);
<a name="l11"></a> </span><span class=cF1>else</span><span class=cF0> {
<a name="l12"></a> doc=</span><span class=cF5>DocRead</span><span class=cF0>(tmpde-&gt;full_name);
<a name="l13"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;head.next!=doc)
<a name="l14"></a> i=doc-&gt;head.last-&gt;y+2;
<a name="l15"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
<a name="l16"></a> }
<a name="l17"></a> tmpde-&gt;user_data=i;
<a name="l18"></a> res+=i;
<a name="l19"></a> tmpde=tmpde-&gt;next;
<a name="l20"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l21"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l22"></a>}
<a name="l23"></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="l24"></a>{
<a name="l25"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde) </span><span class=cF7>{</span><span class=cF0>
<a name="l26"></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="l27"></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="l28"></a> </span><span class=cF5>LineRep2</span><span class=cF0>(doc,tmpde-&gt;sub);
<a name="l29"></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="l30"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l31"></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>,
<a name="l32"></a> tmpde-&gt;user_data,tmpde-&gt;name,tmpde-&gt;full_name);
<a name="l33"></a> tmpde=tmpde-&gt;next;
<a name="l34"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l35"></a>}
<a name="l36"></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="l37"></a>{</span><span class=cF2>//Source line-of-code count report.</span><span class=cF0>
<a name="l38"></a> </span><span class=cF9>I64</span><span class=cF0> fuf_flags=0,res=0;
<a name="l39"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc=</span><span class=cF5>DocNew</span><span class=cF0>;
<a name="l40"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde1=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l41"></a> </span><span class=cF5>ScanFlags</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="l42"></a> </span><span class=cF5>ScanFlags</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="l43"></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>) </span><span class=cF7>{</span><span class=cF0>
<a name="l44"></a> res=</span><span class=cF5>LineRep1</span><span class=cF0>(tmpde1);
<a name="l45"></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="l46"></a> </span><span class=cF5>LineRep2</span><span class=cF0>(doc,tmpde1);
<a name="l47"></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="l48"></a> </span><span class=cF5>DirTreeDel</span><span class=cF0>(tmpde1);
<a name="l49"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l50"></a> </span><span class=cF5>DocInsDoc</span><span class=cF0>(</span><span class=cF5>DocPut</span><span class=cF0>,doc);
<a name="l51"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
<a name="l52"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l53"></a>}
<a name="l54"></a>
<a name="l55"></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,</span><span class=cF9>I64</span><span class=cF0> *_fuf_flags)
<a name="l56"></a>{
<a name="l57"></a> </span><span class=cF9>I64</span><span class=cF0> res=0,i;
<a name="l58"></a> </span><span class=cF1>U8</span><span class=cF0> buf[</span><span class=cF3>BLK_SIZE</span><span class=cF0>];
<a name="l59"></a> </span><span class=cF9>CDrv</span><span class=cF0> *dv;
<a name="l60"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde) </span><span class=cF7>{</span><span class=cF0>
<a name="l61"></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="l62"></a> i=</span><span class=cF5>SizeRep1</span><span class=cF0>(tmpde-&gt;sub,_fuf_flags);
<a name="l63"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>i=tmpde-&gt;size</span><span class=cF7>)</span><span class=cF0> &amp;&amp; </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>_fuf_flags,</span><span class=cF3>FUf_EXPAND</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l64"></a> </span><span class=cF5>FileAttr</span><span class=cF7>(</span><span class=cF0>tmpde-&gt;name</span><span class=cF7>)</span><span class=cF0>&amp;</span><span class=cF3>RS_ATTR_COMPRESSED</span><span class=cF0>) {
<a name="l65"></a> dv=</span><span class=cF5>Let2Drv</span><span class=cF0>(*tmpde-&gt;full_name);
<a name="l66"></a> </span><span class=cF5>BlkRead</span><span class=cF0>(dv,buf,</span><span class=cF5>Clus2Blk</span><span class=cF7>(</span><span class=cF0>dv,tmpde-&gt;clus</span><span class=cF7>)</span><span class=cF0>,1);
<a name="l67"></a> i=(&amp;buf)(</span><span class=cF9>CArcCompress</span><span class=cF0> *)-&gt;expanded_size;
<a name="l68"></a> }
<a name="l69"></a> tmpde-&gt;user_data=i;
<a name="l70"></a> res+=i;
<a name="l71"></a> tmpde=tmpde-&gt;next;
<a name="l72"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l73"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l74"></a>}
<a name="l75"></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="l76"></a>{
<a name="l77"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde) </span><span class=cF7>{</span><span class=cF0>
<a name="l78"></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="l79"></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>,
<a name="l80"></a> tmpde-&gt;user_data,tmpde-&gt;name);
<a name="l81"></a> </span><span class=cF5>SizeRep2</span><span class=cF0>(doc,tmpde-&gt;sub);
<a name="l82"></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="l83"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l84"></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="l85"></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>,
<a name="l86"></a> tmpde-&gt;name,tmpde-&gt;full_name);
<a name="l87"></a> }
<a name="l88"></a> tmpde=tmpde-&gt;next;
<a name="l89"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l90"></a>}
<a name="l91"></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>NULL</span><span class=cF0>)
<a name="l92"></a>{</span><span class=cF2>//Report file sizes. &quot;+x&quot; for expanded size of compressed files.</span><span class=cF0>
<a name="l93"></a> </span><span class=cF9>I64</span><span class=cF0> fuf_flags=0,res=0;
<a name="l94"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc=</span><span class=cF5>DocNew</span><span class=cF0>;
<a name="l95"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde1=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l96"></a> </span><span class=cF5>ScanFlags</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="l97"></a> </span><span class=cF5>ScanFlags</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="l98"></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>) </span><span class=cF7>{</span><span class=cF0>
<a name="l99"></a> fuf_flags&amp;=</span><span class=cF3>FUF_EXPAND</span><span class=cF0>;
<a name="l100"></a> res=</span><span class=cF5>SizeRep1</span><span class=cF0>(tmpde1,&amp;fuf_flags);
<a name="l101"></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="l102"></a> </span><span class=cF5>SizeRep2</span><span class=cF0>(doc,tmpde1);
<a name="l103"></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="l104"></a> </span><span class=cF5>DirTreeDel</span><span class=cF0>(tmpde1);
<a name="l105"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l106"></a> </span><span class=cF5>DocInsDoc</span><span class=cF0>(</span><span class=cF5>DocPut</span><span class=cF0>,doc);
<a name="l107"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
<a name="l108"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l109"></a>}
</span></pre></body>
</html>