238 lines
23 KiB
Plaintext
238 lines
23 KiB
Plaintext
|
<!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>"Cmd Line (Typically)"</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>DEPtrCompare</span><span class=cF0>(</span><span class=cF9>CDocEntry</span><span class=cF0> **e1,</span><span class=cF9>CDocEntry</span><span class=cF0> **e2)
|
||
|
<a name="l4"></a>{
|
||
|
<a name="l5"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>StrCmp</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>*e1</span><span class=cF7>)</span><span class=cF0>->tag,</span><span class=cF7>(</span><span class=cF0>*e2</span><span class=cF7>)</span><span class=cF0>->tag);
|
||
|
<a name="l6"></a>}
|
||
|
<a name="l7"></a>
|
||
|
<a name="l8"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>Sort</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *_in_name,</span><span class=cF1>U8</span><span class=cF0> *_out_name=</span><span class=cF3>NULL</span><span class=cF0>,
|
||
|
<a name="l9"></a> </span><span class=cF9>I64</span><span class=cF0> entry_lines=1,</span><span class=cF1>Bool</span><span class=cF0> unique=</span><span class=cF3>FALSE</span><span class=cF0>)
|
||
|
<a name="l10"></a>{</span><span class=cF2>//Sort lines of a text file. Removes blank lines.</span><span class=cF0>
|
||
|
<a name="l11"></a> </span><span class=cF1>U8</span><span class=cF0> *in_name,*out_name,*st;
|
||
|
<a name="l12"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc;
|
||
|
<a name="l13"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e,*doc_e1,**a;
|
||
|
<a name="l14"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,cnt=0,res;
|
||
|
<a name="l15"></a>
|
||
|
<a name="l16"></a> </span><span class=cF1>if</span><span class=cF0> (!_in_name) </span><span class=cF1>return</span><span class=cF0> 0;
|
||
|
<a name="l17"></a> in_name=</span><span class=cF5>ExtDft</span><span class=cF0>(_in_name,</span><span class=cF6>"DD.Z"</span><span class=cF0>);
|
||
|
<a name="l18"></a> </span><span class=cF1>if</span><span class=cF0> (_out_name)
|
||
|
<a name="l19"></a> out_name=</span><span class=cF5>ExtDft</span><span class=cF0>(_out_name,</span><span class=cF6>"DD.Z"</span><span class=cF0>);
|
||
|
<a name="l20"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l21"></a> out_name=</span><span class=cF5>StrNew</span><span class=cF0>(in_name);
|
||
|
<a name="l22"></a>
|
||
|
<a name="l23"></a> doc=</span><span class=cF5>DocRead</span><span class=cF0>(in_name,</span><span class=cF3>DOCF_PLAIN_TEXT_TABS</span><span class=cF0>|</span><span class=cF3>DOCF_NO_CURSOR</span><span class=cF0>);
|
||
|
<a name="l24"></a> doc_e=doc->head.next;
|
||
|
<a name="l25"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l26"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->type_u8==</span><span class=cF3>DOCT_TEXT</span><span class=cF0>)
|
||
|
<a name="l27"></a> cnt++;
|
||
|
<a name="l28"></a> doc_e=doc_e->next;
|
||
|
<a name="l29"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l30"></a> a=</span><span class=cF5>MAlloc</span><span class=cF0>(cnt*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDocEntry</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l31"></a> doc_e=doc->head.next;
|
||
|
<a name="l32"></a> i=0;
|
||
|
<a name="l33"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l34"></a> doc_e1=doc_e->next;
|
||
|
<a name="l35"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->type_u8==</span><span class=cF3>DOCT_TEXT</span><span class=cF0>) {
|
||
|
<a name="l36"></a> </span><span class=cF5>QueRem</span><span class=cF0>(doc_e);
|
||
|
<a name="l37"></a> a[i++]=doc_e;
|
||
|
<a name="l38"></a> } </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l39"></a> </span><span class=cF5>DocEntryDel</span><span class=cF0>(doc,doc_e);
|
||
|
<a name="l40"></a> doc_e=doc_e1;
|
||
|
<a name="l41"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l42"></a> </span><span class=cF5>QSort</span><span class=cF0>(a,cnt/entry_lines,entry_lines*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDocEntry</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>,&</span><span class=cF5>DEPtrCompare</span><span class=cF0>);
|
||
|
<a name="l43"></a>
|
||
|
<a name="l44"></a> res=0;
|
||
|
<a name="l45"></a> st=</span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l46"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<cnt;) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l47"></a> </span><span class=cF1>if</span><span class=cF0> (!unique || !st || </span><span class=cF5>StrCmp</span><span class=cF7>(</span><span class=cF0>a[i]->tag,st</span><span class=cF7>)</span><span class=cF0>) {
|
||
|
<a name="l48"></a> st=a[i]->tag;
|
||
|
<a name="l49"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j<entry_lines && i<cnt;j++,i++) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l50"></a> </span><span class=cF5>QueIns</span><span class=cF0>(a[i],doc->head.last);
|
||
|
<a name="l51"></a> doc->cur_entry=&doc->head;
|
||
|
<a name="l52"></a> doc->cur_col=0;
|
||
|
<a name="l53"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>"\n"</span><span class=cF0>);
|
||
|
<a name="l54"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l55"></a> res++;
|
||
|
<a name="l56"></a> } </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l57"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j<entry_lines && i<cnt;j++,i++) {
|
||
|
<a name="l58"></a> </span><span class=cF5>QueIns</span><span class=cF0>(a[i],doc->head.last);
|
||
|
<a name="l59"></a> </span><span class=cF5>DocEntryDel</span><span class=cF0>(doc,a[i]);
|
||
|
<a name="l60"></a> }
|
||
|
<a name="l61"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l62"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(doc->filename.name,out_name);
|
||
|
<a name="l63"></a> </span><span class=cF5>DocWrite</span><span class=cF0>(doc);
|
||
|
<a name="l64"></a>
|
||
|
<a name="l65"></a> </span><span class=cF5>Free</span><span class=cF0>(a);
|
||
|
<a name="l66"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
|
||
|
<a name="l67"></a> </span><span class=cF5>Free</span><span class=cF0>(in_name);
|
||
|
<a name="l68"></a> </span><span class=cF5>Free</span><span class=cF0>(out_name);
|
||
|
<a name="l69"></a> </span><span class=cF1>return</span><span class=cF0> res; </span><span class=cF2>//Num Entries</span><span class=cF0>
|
||
|
<a name="l70"></a>}
|
||
|
<a name="l71"></a>
|
||
|
<a name="l72"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>DocWordsFile</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc_out=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF1>U8</span><span class=cF0> *filename,</span><span class=cF9>U32</span><span class=cF0> *char_bmp)
|
||
|
<a name="l73"></a>{
|
||
|
<a name="l74"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr,*ptr2;
|
||
|
<a name="l75"></a> </span><span class=cF9>I64</span><span class=cF0> res=0,ch;
|
||
|
<a name="l76"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc_in=</span><span class=cF5>DocRead</span><span class=cF0>(filename);
|
||
|
<a name="l77"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e=doc_in->head.next;
|
||
|
<a name="l78"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc_in) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l79"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_TAG</span><span class=cF0>) {
|
||
|
<a name="l80"></a> ptr=doc_e->tag;
|
||
|
<a name="l81"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l82"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr && !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>char_bmp,*ptr</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l83"></a> ptr++;
|
||
|
<a name="l84"></a>
|
||
|
<a name="l85"></a> ptr2=ptr;
|
||
|
<a name="l86"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr && </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>char_bmp,*ptr</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l87"></a> ptr++;
|
||
|
<a name="l88"></a>
|
||
|
<a name="l89"></a> ch=*ptr;
|
||
|
<a name="l90"></a> *ptr=0;
|
||
|
<a name="l91"></a> </span><span class=cF1>if</span><span class=cF0> (*ptr2) {
|
||
|
<a name="l92"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc_out,</span><span class=cF6>"%s\n"</span><span class=cF0>,ptr2);
|
||
|
<a name="l93"></a> res++;
|
||
|
<a name="l94"></a> }
|
||
|
<a name="l95"></a> *ptr=ch;
|
||
|
<a name="l96"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l97"></a> }
|
||
|
<a name="l98"></a> doc_e=doc_e->next;
|
||
|
<a name="l99"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l100"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc_in);
|
||
|
<a name="l101"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
||
|
<a name="l102"></a>}
|
||
|
<a name="l103"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>Words</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *files_find_mask=</span><span class=cF6>"*"</span><span class=cF0>,</span><span class=cF9>U32</span><span class=cF0> *char_bmp=</span><span class=cFB>char_bmp_alpha</span><span class=cF0>,
|
||
|
<a name="l104"></a> </span><span class=cF1>U8</span><span class=cF0> *fu_flags=</span><span class=cF3>NULL</span><span class=cF0>)
|
||
|
<a name="l105"></a>{</span><span class=cF2>//Break file into list of not-unique words.</span><span class=cF0>
|
||
|
<a name="l106"></a> </span><span class=cF9>I64</span><span class=cF0> fuf_flags=0,res=0;
|
||
|
<a name="l107"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc_out=</span><span class=cF5>DocNew</span><span class=cF0>;
|
||
|
<a name="l108"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde,*tmpde1;
|
||
|
<a name="l109"></a> </span><span class=cF5>ScanFlags</span><span class=cF0>(&fuf_flags,</span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF6>"ST_FILE_UTIL_FLAGS"</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF6>"+r+f+F+T"</span><span class=cF0>);
|
||
|
<a name="l110"></a> </span><span class=cF5>ScanFlags</span><span class=cF0>(&fuf_flags,</span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF6>"ST_FILE_UTIL_FLAGS"</span><span class=cF7>)</span><span class=cF0>,fu_flags);
|
||
|
<a name="l111"></a> tmpde=tmpde1=</span><span class=cF5>FilesFind</span><span class=cF0>(files_find_mask,fuf_flags);
|
||
|
<a name="l112"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l113"></a> res+=</span><span class=cF5>DocWordsFile</span><span class=cF0>(doc_out,tmpde->full_name,char_bmp);
|
||
|
<a name="l114"></a> tmpde=tmpde->next;
|
||
|
<a name="l115"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l116"></a> </span><span class=cF5>DirTreeDel</span><span class=cF0>(tmpde1);
|
||
|
<a name="l117"></a> </span><span class=cF5>DocInsDoc</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>,doc_out);
|
||
|
<a name="l118"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc_out);
|
||
|
<a name="l119"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
||
|
<a name="l120"></a>}
|
||
|
<a name="l121"></a>
|
||
|
<a name="l122"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>LongLinesFile</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *filename,</span><span class=cF9>I64</span><span class=cF0> cols)
|
||
|
<a name="l123"></a>{
|
||
|
<a name="l124"></a> </span><span class=cF9>I64</span><span class=cF0> res=0;
|
||
|
<a name="l125"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc=</span><span class=cF5>DocRead</span><span class=cF0>(filename);
|
||
|
<a name="l126"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e=doc->head.next;
|
||
|
<a name="l127"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l128"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->type_u8==</span><span class=cF3>DOCT_NEW_LINE</span><span class=cF0> && doc_e->x>=cols+1)
|
||
|
<a name="l129"></a> res++;
|
||
|
<a name="l130"></a> doc_e=doc_e->next;
|
||
|
<a name="l131"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l132"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
|
||
|
<a name="l133"></a> </span><span class=cF1>if</span><span class=cF0> (res) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l134"></a> </span><span class=cF6>"%04d "</span><span class=cF0>,res;
|
||
|
<a name="l135"></a> </span><span class=cF5>PutFileLink</span><span class=cF0>(filename);
|
||
|
<a name="l136"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
||
|
<a name="l137"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l138"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
||
|
<a name="l139"></a>}
|
||
|
<a name="l140"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>LongLines</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *files_find_mask=</span><span class=cF6>"*"</span><span class=cF0>,</span><span class=cF9>I64</span><span class=cF0> cols=80,</span><span class=cF1>U8</span><span class=cF0> *fu_flags=</span><span class=cF3>NULL</span><span class=cF0>)
|
||
|
<a name="l141"></a>{</span><span class=cF2>//Report files with lines of too many cols.</span><span class=cF0>
|
||
|
<a name="l142"></a> </span><span class=cF9>I64</span><span class=cF0> res=0,fuf_flags=0;
|
||
|
<a name="l143"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde,*tmpde1;
|
||
|
<a name="l144"></a> </span><span class=cF5>ScanFlags</span><span class=cF0>(&fuf_flags,</span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF6>"ST_FILE_UTIL_FLAGS"</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF6>"+r+f+F+S"</span><span class=cF0>);
|
||
|
<a name="l145"></a> </span><span class=cF5>ScanFlags</span><span class=cF0>(&fuf_flags,</span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF6>"ST_FILE_UTIL_FLAGS"</span><span class=cF7>)</span><span class=cF0>,fu_flags);
|
||
|
<a name="l146"></a> tmpde=tmpde1=</span><span class=cF5>FilesFind</span><span class=cF0>(files_find_mask,fuf_flags);
|
||
|
<a name="l147"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l148"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>LongLinesFile</span><span class=cF7>(</span><span class=cF0>tmpde->full_name,cols</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l149"></a> res++;
|
||
|
<a name="l150"></a> tmpde=tmpde->next;
|
||
|
<a name="l151"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l152"></a> </span><span class=cF5>DirTreeDel</span><span class=cF0>(tmpde1);
|
||
|
<a name="l153"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
||
|
<a name="l154"></a>}
|
||
|
<a name="l155"></a>
|
||
|
<a name="l156"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SUFile</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *filename,</span><span class=cF9>I64</span><span class=cF0> suf_flags,</span><span class=cF1>F64</span><span class=cF0> indent_scale_factor)
|
||
|
<a name="l157"></a>{</span><span class=cF2>//String utility on a single file</span><span class=cF0>
|
||
|
<a name="l158"></a></span><span class=cF2>//See </span><a href="/Wb/Kernel/KernelA.HH.HTML#l3734"><span class=cF4>SU Flags</span></a><span class=cF0>
|
||
|
<a name="l159"></a> </span><span class=cF1>U8</span><span class=cF0> *dst;
|
||
|
<a name="l160"></a> </span><span class=cF1>Bool</span><span class=cF0> chged=</span><span class=cF3>FALSE</span><span class=cF0>;
|
||
|
<a name="l161"></a> </span><span class=cF9>I64</span><span class=cF0> reduced=0;
|
||
|
<a name="l162"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc=</span><span class=cF5>DocRead</span><span class=cF0>(filename,</span><span class=cF3>DOCF_PLAIN_TEXT_TABS</span><span class=cF0>|</span><span class=cF3>DOCF_NO_CURSOR</span><span class=cF0>);
|
||
|
<a name="l163"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e=doc->head.next;
|
||
|
<a name="l164"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l165"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->type_u8==</span><span class=cF3>DOCT_TEXT</span><span class=cF0>) {
|
||
|
<a name="l166"></a> dst=</span><span class=cF5>MStrUtil</span><span class=cF0>(doc_e->tag,suf_flags,indent_scale_factor);
|
||
|
<a name="l167"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrCmp</span><span class=cF7>(</span><span class=cF0>dst,doc_e->tag</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l168"></a> reduced+=</span><span class=cF5>StrLen</span><span class=cF0>(doc_e->tag)-</span><span class=cF5>StrLen</span><span class=cF0>(dst);
|
||
|
<a name="l169"></a> chged=</span><span class=cF3>TRUE</span><span class=cF0>;
|
||
|
<a name="l170"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_e->tag);
|
||
|
<a name="l171"></a> doc_e->tag=dst;
|
||
|
<a name="l172"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l173"></a> </span><span class=cF5>Free</span><span class=cF0>(dst);
|
||
|
<a name="l174"></a> }
|
||
|
<a name="l175"></a> doc_e=doc_e->next;
|
||
|
<a name="l176"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l177"></a> </span><span class=cF1>if</span><span class=cF0> (chged) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l178"></a> </span><span class=cF6>"Reduced %s by %d chars\n"</span><span class=cF0>,filename,reduced;
|
||
|
<a name="l179"></a> </span><span class=cF5>DocWrite</span><span class=cF0>(doc);
|
||
|
<a name="l180"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l181"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
|
||
|
<a name="l182"></a>}
|
||
|
<a name="l183"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SU</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *files_find_mask,</span><span class=cF9>I64</span><span class=cF0> suf_flags,</span><span class=cF1>U8</span><span class=cF0> *fu_flags=</span><span class=cF3>NULL</span><span class=cF0>,
|
||
|
<a name="l184"></a> </span><span class=cF1>F64</span><span class=cF0> indent_scale_factor=0)
|
||
|
<a name="l185"></a>{</span><span class=cF2>//Apply </span><a href="/Wb/Kernel/StrA.HC.HTML#l519"><span class=cF4>StrUtil</span></a><span class=cF2>() on files.</span><span class=cF0>
|
||
|
<a name="l186"></a></span><span class=cF2>//You can convert spaces to tabs, for example,</span><span class=cF0>
|
||
|
<a name="l187"></a> </span><span class=cF2>//or removing trailing spaces on lines.</span><span class=cF0>
|
||
|
<a name="l188"></a> </span><span class=cF2>//See </span><a href="/Wb/Kernel/KernelA.HH.HTML#l3734"><span class=cF4>SUF Flags</span></a><span class=cF2>.</span><span class=cF0>
|
||
|
<a name="l189"></a> </span><span class=cF9>I64</span><span class=cF0> fuf_flags=0;
|
||
|
<a name="l190"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde,*tmpde1;
|
||
|
<a name="l191"></a> </span><span class=cF5>ScanFlags</span><span class=cF0>(&fuf_flags,</span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF6>"ST_FILE_UTIL_FLAGS"</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF6>"+f+F+T"</span><span class=cF0>);
|
||
|
<a name="l192"></a> </span><span class=cF5>ScanFlags</span><span class=cF0>(&fuf_flags,</span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF6>"ST_FILE_UTIL_FLAGS"</span><span class=cF7>)</span><span class=cF0>,fu_flags);
|
||
|
<a name="l193"></a> tmpde=tmpde1=</span><span class=cF5>FilesFind</span><span class=cF0>(files_find_mask,fuf_flags);
|
||
|
<a name="l194"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l195"></a> </span><span class=cF5>SUFile</span><span class=cF0>(tmpde->full_name,suf_flags,indent_scale_factor);
|
||
|
<a name="l196"></a> tmpde=tmpde->next;
|
||
|
<a name="l197"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l198"></a> </span><span class=cF5>DirTreeDel</span><span class=cF0>(tmpde1);
|
||
|
<a name="l199"></a>}
|
||
|
<a name="l200"></a>
|
||
|
<a name="l201"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>S2T</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *files_find_mask,</span><span class=cF1>U8</span><span class=cF0> *fu_flags=</span><span class=cF3>NULL</span><span class=cF0>)
|
||
|
<a name="l202"></a>{</span><span class=cF2>//Spaces to tabs.</span><span class=cF0>
|
||
|
<a name="l203"></a></span><span class=cF2>//Use "Hard Space" (SHIFT-SPACE) for spaces</span><span class=cF0>
|
||
|
<a name="l204"></a> </span><span class=cF2>//in string consts in your code.</span><span class=cF0>
|
||
|
<a name="l205"></a> </span><span class=cF5>SU</span><span class=cF0>(files_find_mask,</span><span class=cF3>SUF_S2T</span><span class=cF0>|</span><span class=cF3>SUF_REM_TRAILING</span><span class=cF0>,fu_flags);
|
||
|
<a name="l206"></a>}
|
||
|
</span></pre></body>
|
||
|
</html>
|