templeos-info/public/Wb/Adam/DolDoc/DocFind.HC.HTML

616 lines
58 KiB
Plaintext
Raw Normal View History

2024-03-24 21:24:44 +00:00
<!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;DolDoc/Editor&quot;</span><span class=cF0>
<a name="l2"></a>
<a name="l3"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DocGoToLine</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc,</span><span class=cF9>I64</span><span class=cF0> line_num) </span><span class=cF2>//one based</span><span class=cF0>
<a name="l4"></a>{</span><span class=cF2>//Nearest to specified line num. Move cur_entry &amp; center.</span><span class=cF0>
<a name="l5"></a> </span><span class=cF1>Bool</span><span class=cF0> res=</span><span class=cF3>FALSE</span><span class=cF0>,unlock;
<a name="l6"></a> </span><span class=cF1>if</span><span class=cF0> (doc) </span><span class=cF7>{</span><span class=cF0>
<a name="l7"></a> unlock=</span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l8"></a> doc-&gt;x=0;
<a name="l9"></a> doc-&gt;y=line_num-1;
<a name="l10"></a> </span><span class=cF5>DocRecalc</span><span class=cF0>(doc,</span><span class=cF3>RECALCt_FIND_CURSOR</span><span class=cF0>);
<a name="l11"></a> </span><span class=cF5>DocCenter</span><span class=cF0>(doc);
<a name="l12"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_entry-&gt;y==line_num-1)
<a name="l13"></a> res=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l14"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l15"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l16"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l17"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l18"></a>}
<a name="l19"></a>
<a name="l20"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DocFind</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *haystack_doc,</span><span class=cF9>I64</span><span class=cF0> start_line_num=</span><span class=cF3>I64_MIN</span><span class=cF0>,
<a name="l21"></a></span><span class=cF1>U8</span><span class=cF0> *needle,</span><span class=cF9>I64</span><span class=cF0> match=1)
<a name="l22"></a>{</span><span class=cF2>//Find str by searching tags. Move cur_entry &amp; center.</span><span class=cF0>
<a name="l23"></a> </span><span class=cF1>Bool</span><span class=cF0> res=</span><span class=cF3>FALSE</span><span class=cF0>,unlock;
<a name="l24"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e;
<a name="l25"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr;
<a name="l26"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l27"></a> </span><span class=cF1>if</span><span class=cF0> (haystack_doc) </span><span class=cF7>{</span><span class=cF0>
<a name="l28"></a> unlock=</span><span class=cF5>DocLock</span><span class=cF0>(haystack_doc);
<a name="l29"></a> </span><span class=cF1>if</span><span class=cF0> (start_line_num==</span><span class=cF3>I64_MIN</span><span class=cF0>) {
<a name="l30"></a> res=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l31"></a> doc_e=haystack_doc-&gt;head.next;
<a name="l32"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l33"></a> res=</span><span class=cF5>DocGoToLine</span><span class=cF0>(haystack_doc,start_line_num);
<a name="l34"></a> doc_e=haystack_doc-&gt;cur_entry;
<a name="l35"></a> }
<a name="l36"></a> </span><span class=cF1>if</span><span class=cF0> (res) {
<a name="l37"></a> </span><span class=cF1>if</span><span class=cF0> (needle) </span><span class=cF7>{</span><span class=cF0>
<a name="l38"></a> res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l39"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=haystack_doc) {
<a name="l40"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags&amp;</span><span class=cF3>DOCEF_TAG</span><span class=cF0> &amp;&amp; doc_e-&gt;tag &amp;&amp;
<a name="l41"></a></span><span class=cF2>//TODO: handle multi-DocEntry strs</span><span class=cF0>
<a name="l42"></a> </span><span class=cF7>(</span><span class=cF0>ptr=</span><span class=cF5>StrIMatch</span><span class=cF0>(needle,doc_e-&gt;tag)</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l43"></a> i=ptr-doc_e-&gt;tag;
<a name="l44"></a> </span><span class=cF1>if</span><span class=cF0> (!--match) {
<a name="l45"></a> haystack_doc-&gt;cur_entry=doc_e;
<a name="l46"></a> </span><span class=cF1>if</span><span class=cF0> (i&lt;doc_e-&gt;min_col) i=doc_e-&gt;min_col;
<a name="l47"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;doc_e-&gt;max_col) i=doc_e-&gt;max_col;
<a name="l48"></a> haystack_doc-&gt;cur_col=i;
<a name="l49"></a> res=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l50"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l51"></a> }
<a name="l52"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l53"></a> doc_e=doc_e-&gt;next;
<a name="l54"></a> }
<a name="l55"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l56"></a> res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l57"></a> }
<a name="l58"></a> </span><span class=cF1>if</span><span class=cF0> (!res) </span><span class=cF5>DocBottom</span><span class=cF0>(haystack_doc);
<a name="l59"></a> </span><span class=cF5>DocCenter</span><span class=cF0>(haystack_doc);
<a name="l60"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l61"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(haystack_doc);
<a name="l62"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l63"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l64"></a>}
<a name="l65"></a>
<a name="l66"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DocAnchorFind</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *haystack_doc,</span><span class=cF1>U8</span><span class=cF0> *needle_str)
<a name="l67"></a>{</span><span class=cF2>//Find named anchor. Move cur_entry &amp; center.</span><span class=cF0>
<a name="l68"></a> </span><span class=cF1>Bool</span><span class=cF0> res=</span><span class=cF3>FALSE</span><span class=cF0>,unlock;
<a name="l69"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e;
<a name="l70"></a> </span><span class=cF1>if</span><span class=cF0> (haystack_doc) </span><span class=cF7>{</span><span class=cF0>
<a name="l71"></a> unlock=</span><span class=cF5>DocLock</span><span class=cF0>(haystack_doc);
<a name="l72"></a> doc_e=haystack_doc-&gt;head.next;
<a name="l73"></a> </span><span class=cF1>if</span><span class=cF0> (needle_str)
<a name="l74"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=haystack_doc) {
<a name="l75"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;type_u8==</span><span class=cF3>DOCT_ANCHOR</span><span class=cF0> &amp;&amp; doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_AUX_STR</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l76"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCmp</span><span class=cF7>(</span><span class=cF0>needle_str,doc_e-&gt;aux_str</span><span class=cF7>)</span><span class=cF0>) {
<a name="l77"></a> haystack_doc-&gt;cur_entry=doc_e;
<a name="l78"></a> haystack_doc-&gt;cur_col=doc_e-&gt;min_col;
<a name="l79"></a> res=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l80"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l81"></a> }
<a name="l82"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l83"></a> doc_e=doc_e-&gt;next;
<a name="l84"></a> }
<a name="l85"></a> </span><span class=cF1>if</span><span class=cF0> (!res) </span><span class=cF5>DocBottom</span><span class=cF0>(haystack_doc);
<a name="l86"></a> </span><span class=cF5>DocCenter</span><span class=cF0>(haystack_doc);
<a name="l87"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l88"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(haystack_doc);
<a name="l89"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l90"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l91"></a>}
<a name="l92"></a>
<a name="l93"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>EdFindNext</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc)
<a name="l94"></a>{</span><span class=cF2>//Editor F3 find next, possibly doing replaces.</span><span class=cF0>
<a name="l95"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock=</span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l96"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr,*ptr2,*ptr3;
<a name="l97"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ce=doc-&gt;cur_entry,*doc_e=doc_ce;
<a name="l98"></a> </span><span class=cF9>I64</span><span class=cF0> sf_flags;
<a name="l99"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;find_replace-&gt;match_case)
<a name="l100"></a> sf_flags=0;
<a name="l101"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l102"></a> sf_flags=</span><span class=cF3>SFF_IGNORE_CASE</span><span class=cF0>;
<a name="l103"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;find_replace-&gt;whole_labels)
<a name="l104"></a> sf_flags|=</span><span class=cF3>SFG_WHOLE_LABELS</span><span class=cF0>;
<a name="l105"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l106"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e!=doc) {
<a name="l107"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags&amp;</span><span class=cF3>DOCEF_TAG</span><span class=cF0> &amp;&amp; doc_e-&gt;tag &amp;&amp;
<a name="l108"></a> !</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;de_flags&amp;(</span><span class=cF3>DOCEG_DONT_EDIT</span><span class=cF0>|</span><span class=cF3>DOCEF_FILTER_SKIP</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l109"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;type &amp; </span><span class=cF3>DOCET_SEL</span><span class=cF0> ||
<a name="l110"></a> !doc-&gt;find_replace-&gt;scan_sel_text) {
<a name="l111"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;find_replace-&gt;scan_fwd) </span><span class=cF7>{</span><span class=cF0>
<a name="l112"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e==doc_ce) {
<a name="l113"></a> ptr=doc_ce-&gt;tag+doc-&gt;cur_col+1;
<a name="l114"></a> </span><span class=cF1>if</span><span class=cF0> (ptr-doc_ce-&gt;tag&gt;=doc_ce-&gt;max_col)
<a name="l115"></a> </span><span class=cF1>goto</span><span class=cF0> fn_skip;
<a name="l116"></a> </span><span class=cF1>if</span><span class=cF0> (ptr-doc_ce-&gt;tag&lt;doc_ce-&gt;min_col)
<a name="l117"></a> ptr=doc_ce-&gt;tag+doc_ce-&gt;min_col;
<a name="l118"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l119"></a> ptr=doc_e-&gt;tag;
<a name="l120"></a> </span><span class=cF1>if</span><span class=cF0> (ptr=</span><span class=cF5>StrFind</span><span class=cF7>(</span><span class=cF0>doc-&gt;find_replace-&gt;find_text,ptr,sf_flags</span><span class=cF7>)</span><span class=cF0>) {
<a name="l121"></a> doc-&gt;cur_entry=doc_e;
<a name="l122"></a> doc-&gt;cur_col=ptr-doc_e-&gt;tag;
<a name="l123"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col&gt;=doc_e-&gt;max_col)
<a name="l124"></a> doc-&gt;cur_col=doc_e-&gt;max_col-1;
<a name="l125"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col&lt;doc_e-&gt;min_col)
<a name="l126"></a> doc-&gt;cur_col=doc_e-&gt;min_col;
<a name="l127"></a> </span><span class=cF5>DocCenter</span><span class=cF0>(doc);
<a name="l128"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l129"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l130"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l131"></a> }
<a name="l132"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l133"></a> ptr2=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l134"></a> ptr=doc_e-&gt;tag+doc_e-&gt;min_col;
<a name="l135"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e==doc_ce)
<a name="l136"></a> ptr3=doc_ce-&gt;tag+doc-&gt;cur_col;
<a name="l137"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l138"></a> ptr3=doc_e-&gt;tag+doc_e-&gt;max_col;
<a name="l139"></a> </span><span class=cF1>while</span><span class=cF0> (ptr=</span><span class=cF5>StrFind</span><span class=cF7>(</span><span class=cF0>doc-&gt;find_replace-&gt;find_text,ptr,sf_flags</span><span class=cF7>)</span><span class=cF0>) {
<a name="l140"></a> </span><span class=cF1>if</span><span class=cF0> (ptr&gt;=ptr3)
<a name="l141"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l142"></a> ptr2=ptr++;
<a name="l143"></a> }
<a name="l144"></a> </span><span class=cF1>if</span><span class=cF0> (ptr2 &amp;&amp; ptr2&lt;ptr3) {
<a name="l145"></a> doc-&gt;cur_entry=doc_e;
<a name="l146"></a> doc-&gt;cur_col=ptr2-doc_e-&gt;tag;
<a name="l147"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col&gt;=doc_e-&gt;max_col)
<a name="l148"></a> doc-&gt;cur_col=doc_e-&gt;max_col-1;
<a name="l149"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col&lt;doc_e-&gt;min_col)
<a name="l150"></a> doc-&gt;cur_col=doc_e-&gt;min_col;
<a name="l151"></a> </span><span class=cF5>DocCenter</span><span class=cF0>(doc);
<a name="l152"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l153"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l154"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l155"></a> }
<a name="l156"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l157"></a> }
<a name="l158"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l159"></a> }
<a name="l160"></a>fn_skip:
<a name="l161"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;find_replace-&gt;scan_fwd)
<a name="l162"></a> doc_e=doc_e-&gt;next;
<a name="l163"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l164"></a> doc_e=doc_e-&gt;last;
<a name="l165"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc_ce);
<a name="l166"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l167"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l168"></a>}
<a name="l169"></a>
<a name="l170"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>EdSelAll</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc,</span><span class=cF1>Bool</span><span class=cF0> sel)
<a name="l171"></a>{</span><span class=cF2>//Set state of </span><a href="/Wb/Kernel/KernelA.HH.HTML#l953"><span class=cF4>DOCET_SEL</span></a><span class=cF2> on all entries.</span><span class=cF0>
<a name="l172"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock=</span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l173"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e=doc-&gt;head.next;
<a name="l174"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc) </span><span class=cF7>{</span><span class=cF0>
<a name="l175"></a> </span><span class=cF5>BEqu</span><span class=cF0>(&amp;doc_e-&gt;type,</span><span class=cF3>DOCEt_SEL</span><span class=cF0>,sel);
<a name="l176"></a> doc_e=doc_e-&gt;next;
<a name="l177"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l178"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l179"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l180"></a>}
<a name="l181"></a>
<a name="l182"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>EdFindPaired</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc,</span><span class=cF1>U8</span><span class=cF0> plus,</span><span class=cF1>U8</span><span class=cF0> minus,
<a name="l183"></a></span><span class=cF1>Bool</span><span class=cF0> fwd,</span><span class=cF1>Bool</span><span class=cF0> abort_on_dbl_colon=</span><span class=cF3>FALSE</span><span class=cF0>)
<a name="l184"></a>{</span><span class=cF2>//Find { } or ( ) pair. Move cur_entry &amp; center.</span><span class=cF0>
<a name="l185"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock=</span><span class=cF5>DocLock</span><span class=cF0>(doc),res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l186"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr;
<a name="l187"></a> </span><span class=cF9>I64</span><span class=cF0> ch,levels=0,colons=0,original_col=doc-&gt;cur_col;
<a name="l188"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ce=doc-&gt;cur_entry,*doc_e=doc_ce,*original_ce=doc_ce;
<a name="l189"></a> </span><span class=cF1>if</span><span class=cF0> (abort_on_dbl_colon &amp;&amp; </span><span class=cF5>EdCurU8</span><span class=cF7>(</span><span class=cF0>doc</span><span class=cF7>)</span><span class=cF0>==</span><span class=cF6>':'</span><span class=cF0>)
<a name="l190"></a> colons=1;
<a name="l191"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l192"></a> colons=0;
<a name="l193"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l194"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e!=doc) {
<a name="l195"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags&amp;</span><span class=cF3>DOCEF_TAG</span><span class=cF0> &amp;&amp; doc_e-&gt;tag &amp;&amp;
<a name="l196"></a> !</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;de_flags&amp;</span><span class=cF3>DOCEF_FILTER_SKIP</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l197"></a> </span><span class=cF1>if</span><span class=cF0> (fwd) {
<a name="l198"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e==doc_ce)
<a name="l199"></a> ptr=doc_e-&gt;tag+doc-&gt;cur_col+1;
<a name="l200"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l201"></a> ptr=doc_e-&gt;tag;
<a name="l202"></a> </span><span class=cF1>if</span><span class=cF0> (ptr-doc_e-&gt;tag&lt;doc_e-&gt;min_col)
<a name="l203"></a> ptr=doc_e-&gt;tag+doc_e-&gt;min_col;
<a name="l204"></a> </span><span class=cF1>if</span><span class=cF0> (ptr-doc_e-&gt;tag&gt;=doc_e-&gt;max_col)
<a name="l205"></a> </span><span class=cF1>goto</span><span class=cF0> pa_skip;
<a name="l206"></a> </span><span class=cF1>while</span><span class=cF0> (ch=*ptr++)
<a name="l207"></a> </span><span class=cF1>if</span><span class=cF0> (abort_on_dbl_colon &amp;&amp; ch==</span><span class=cF6>':'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l208"></a> </span><span class=cF1>if</span><span class=cF0> (++colons==2) {
<a name="l209"></a> doc-&gt;cur_entry=doc_e;
<a name="l210"></a> doc-&gt;cur_col=ptr-doc_e-&gt;tag-1;
<a name="l211"></a> </span><span class=cF5>EdCursorLeft</span><span class=cF0>(doc);
<a name="l212"></a> res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l213"></a> </span><span class=cF1>goto</span><span class=cF0> pa_done;
<a name="l214"></a> }
<a name="l215"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l216"></a> colons=0;
<a name="l217"></a> </span><span class=cF1>if</span><span class=cF0> (ch==plus)
<a name="l218"></a> levels++;
<a name="l219"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (ch==minus) {
<a name="l220"></a> </span><span class=cF1>if</span><span class=cF0> (!levels--) </span><span class=cF7>{</span><span class=cF0>
<a name="l221"></a> doc-&gt;cur_entry=doc_e;
<a name="l222"></a> doc-&gt;cur_col=ptr-doc_e-&gt;tag-1;
<a name="l223"></a> res=doc-&gt;cur_entry!=original_ce ||
<a name="l224"></a> doc-&gt;cur_col!=original_col;
<a name="l225"></a> </span><span class=cF1>goto</span><span class=cF0> pa_done;
<a name="l226"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l227"></a> }
<a name="l228"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l229"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l230"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e==doc_ce) </span><span class=cF7>{</span><span class=cF0>
<a name="l231"></a> ptr=doc_e-&gt;tag+doc-&gt;cur_col-1;
<a name="l232"></a> </span><span class=cF1>if</span><span class=cF0> (ptr-doc_e-&gt;tag&gt;=doc_e-&gt;max_col)
<a name="l233"></a> ptr=doc_e-&gt;tag+doc_e-&gt;max_col-1;
<a name="l234"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l235"></a> ptr=doc_e-&gt;tag+doc_e-&gt;max_col-1;
<a name="l236"></a> </span><span class=cF1>if</span><span class=cF0> (ptr-doc_e-&gt;tag&lt;doc_e-&gt;min_col)
<a name="l237"></a> </span><span class=cF1>goto</span><span class=cF0> pa_skip;
<a name="l238"></a> </span><span class=cF1>while</span><span class=cF0> (ptr&gt;=doc_e-&gt;tag+doc_e-&gt;min_col) </span><span class=cF7>{</span><span class=cF0>
<a name="l239"></a> ch=*ptr--;
<a name="l240"></a> </span><span class=cF1>if</span><span class=cF0> (abort_on_dbl_colon &amp;&amp; ch==</span><span class=cF6>':'</span><span class=cF0>) {
<a name="l241"></a> </span><span class=cF1>if</span><span class=cF0> (++colons==2) </span><span class=cF7>{</span><span class=cF0>
<a name="l242"></a> doc-&gt;cur_entry=doc_e;
<a name="l243"></a> doc-&gt;cur_col=ptr-doc_e-&gt;tag+1;
<a name="l244"></a> res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l245"></a> </span><span class=cF1>goto</span><span class=cF0> pa_done;
<a name="l246"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l247"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l248"></a> colons=0;
<a name="l249"></a> </span><span class=cF1>if</span><span class=cF0> (ch==plus)
<a name="l250"></a> levels++;
<a name="l251"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (ch==minus) </span><span class=cF7>{</span><span class=cF0>
<a name="l252"></a> </span><span class=cF1>if</span><span class=cF0> (!levels--) {
<a name="l253"></a> doc-&gt;cur_entry=doc_e;
<a name="l254"></a> doc-&gt;cur_col=ptr-doc_e-&gt;tag+1;
<a name="l255"></a> res=doc-&gt;cur_entry!=original_ce ||
<a name="l256"></a> doc-&gt;cur_col!=original_col;
<a name="l257"></a> </span><span class=cF1>goto</span><span class=cF0> pa_done;
<a name="l258"></a> }
<a name="l259"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l260"></a> }
<a name="l261"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l262"></a> }
<a name="l263"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l264"></a> }
<a name="l265"></a>pa_skip:
<a name="l266"></a> </span><span class=cF1>if</span><span class=cF0> (fwd)
<a name="l267"></a> doc_e=doc_e-&gt;next;
<a name="l268"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l269"></a> doc_e=doc_e-&gt;last;
<a name="l270"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc_ce);
<a name="l271"></a>pa_done:
<a name="l272"></a> </span><span class=cF5>DocRecalc</span><span class=cF0>(doc);
<a name="l273"></a> </span><span class=cF5>DocCenter</span><span class=cF0>(doc);
<a name="l274"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l275"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l276"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l277"></a>}
<a name="l278"></a>
<a name="l279"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>EdGoToFun</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc,</span><span class=cF1>Bool</span><span class=cF0> fwd,</span><span class=cF1>Bool</span><span class=cF0> abort_on_dbl_colon)
<a name="l280"></a>{</span><span class=cF2>//Move cur_entry to start of cur fun and center.(Shoddy)</span><span class=cF0>
<a name="l281"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock=</span><span class=cF5>DocLock</span><span class=cF0>(doc),res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l282"></a> </span><span class=cF9>I64</span><span class=cF0> ch,levels,colons;
<a name="l283"></a> </span><span class=cF1>if</span><span class=cF0> (fwd) </span><span class=cF7>{</span><span class=cF0>
<a name="l284"></a> levels=0;
<a name="l285"></a> colons=0;
<a name="l286"></a> </span><span class=cF1>while</span><span class=cF0> (doc-&gt;cur_entry!=doc) {
<a name="l287"></a> ch=</span><span class=cF5>EdCurU8</span><span class=cF0>(doc);
<a name="l288"></a> </span><span class=cF1>if</span><span class=cF0> (abort_on_dbl_colon &amp;&amp; ch==</span><span class=cF6>':'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l289"></a> </span><span class=cF1>if</span><span class=cF0> (++colons==2) {
<a name="l290"></a> </span><span class=cF5>EdCursorLeft</span><span class=cF0>(doc);
<a name="l291"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l292"></a> }
<a name="l293"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l294"></a> colons=0;
<a name="l295"></a> </span><span class=cF1>if</span><span class=cF0> (ch==</span><span class=cF6>'{'</span><span class=cF0>)
<a name="l296"></a> levels++;
<a name="l297"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (ch==</span><span class=cF6>'}'</span><span class=cF0> &amp;&amp; !levels--)
<a name="l298"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l299"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l300"></a> </span><span class=cF5>EdCursorRight</span><span class=cF0>(doc);
<a name="l301"></a> }
<a name="l302"></a> </span><span class=cF5>DocRecalc</span><span class=cF0>(doc);
<a name="l303"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_entry!=doc)
<a name="l304"></a> res=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l305"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l306"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>EdFindPaired</span><span class=cF7>(</span><span class=cF0>doc,</span><span class=cF6>'}'</span><span class=cF0>,</span><span class=cF6>'{'</span><span class=cF0>,</span><span class=cF3>FALSE</span><span class=cF0>,abort_on_dbl_colon</span><span class=cF7>)</span><span class=cF0>);
<a name="l307"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_entry!=doc) {
<a name="l308"></a> ch=</span><span class=cF5>EdCurU8</span><span class=cF0>(doc);
<a name="l309"></a> </span><span class=cF1>if</span><span class=cF0> (abort_on_dbl_colon &amp;&amp; ch==</span><span class=cF6>':'</span><span class=cF0>)
<a name="l310"></a> res=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l311"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l312"></a> </span><span class=cF1>if</span><span class=cF0> (ch==</span><span class=cF6>'{'</span><span class=cF0>)
<a name="l313"></a> res=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l314"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l315"></a> }
<a name="l316"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l317"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l318"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l319"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l320"></a>}
<a name="l321"></a>
<a name="l322"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>EdSelFun</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc,</span><span class=cF1>Bool</span><span class=cF0> abort_on_dbl_colon=</span><span class=cF3>FALSE</span><span class=cF0>)
<a name="l323"></a>{</span><span class=cF2>//Set </span><a href="/Wb/Kernel/KernelA.HH.HTML#l953"><span class=cF4>DOCET_SEL</span></a><span class=cF2> on all entries in cur fun.</span><span class=cF0>
<a name="l324"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock=</span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l325"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr;
<a name="l326"></a> </span><span class=cF9>I64</span><span class=cF0> ch,levels=0,colons=0;
<a name="l327"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e;
<a name="l328"></a> </span><span class=cF5>EdSelAll</span><span class=cF0>(doc,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l329"></a> </span><span class=cF5>EdGoToFun</span><span class=cF0>(doc,</span><span class=cF3>FALSE</span><span class=cF0>,abort_on_dbl_colon);
<a name="l330"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>EdCurU8</span><span class=cF7>(</span><span class=cF0>doc</span><span class=cF7>)</span><span class=cF0>==</span><span class=cF6>'{'</span><span class=cF0>)
<a name="l331"></a> levels--;
<a name="l332"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (abort_on_dbl_colon &amp;&amp; </span><span class=cF5>EdCurU8</span><span class=cF7>(</span><span class=cF0>doc</span><span class=cF7>)</span><span class=cF0>==</span><span class=cF6>':'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l333"></a> </span><span class=cF5>EdCursorRight</span><span class=cF0>(doc);
<a name="l334"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>EdCurU8</span><span class=cF7>(</span><span class=cF0>doc</span><span class=cF7>)</span><span class=cF0>==</span><span class=cF6>':'</span><span class=cF0>)
<a name="l335"></a> </span><span class=cF5>EdCursorRight</span><span class=cF0>(doc);
<a name="l336"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l337"></a> doc_e=doc-&gt;cur_entry;
<a name="l338"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc) </span><span class=cF7>{</span><span class=cF0>
<a name="l339"></a> doc_e-&gt;type|=</span><span class=cF3>DOCET_SEL</span><span class=cF0>;
<a name="l340"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags&amp;</span><span class=cF3>DOCEF_TAG</span><span class=cF0> &amp;&amp; doc_e-&gt;tag) {
<a name="l341"></a> ptr=doc_e-&gt;tag;
<a name="l342"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e==doc-&gt;cur_entry)
<a name="l343"></a> ptr+=doc-&gt;cur_col;
<a name="l344"></a> </span><span class=cF1>while</span><span class=cF0> (ch=*ptr++)
<a name="l345"></a> </span><span class=cF1>if</span><span class=cF0> (abort_on_dbl_colon &amp;&amp; ch==</span><span class=cF6>':'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l346"></a> </span><span class=cF1>if</span><span class=cF0> (++colons==2)
<a name="l347"></a> </span><span class=cF1>goto</span><span class=cF0> sf_done;
<a name="l348"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l349"></a> colons=0;
<a name="l350"></a> </span><span class=cF1>if</span><span class=cF0> (ch==</span><span class=cF6>'{'</span><span class=cF0>)
<a name="l351"></a> levels++;
<a name="l352"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (ch==</span><span class=cF6>'}'</span><span class=cF0> &amp;&amp; !levels--)
<a name="l353"></a> </span><span class=cF1>goto</span><span class=cF0> sf_done;
<a name="l354"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l355"></a> }
<a name="l356"></a> doc_e=doc_e-&gt;next;
<a name="l357"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l358"></a>sf_done:
<a name="l359"></a> </span><span class=cF5>DocRecalc</span><span class=cF0>(doc);
<a name="l360"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l361"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l362"></a>}
<a name="l363"></a>
<a name="l364"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>RSAC_REPLACE</span><span class=cF0> 0
<a name="l365"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>RSAC_SKIP</span><span class=cF0> 1
<a name="l366"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>RSAC_ALL</span><span class=cF0> 2
<a name="l367"></a>
<a name="l368"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>PopUpReplaceSkipAllCancel</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *header=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF1>U8</span><span class=cF0> *footer=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l369"></a>{
<a name="l370"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l371"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc=</span><span class=cF5>DocNew</span><span class=cF0>;
<a name="l372"></a> </span><span class=cF1>if</span><span class=cF0> (header) </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;%s&quot;</span><span class=cF0>,header);
<a name="l373"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;$CM+LX,1,4$$BT,\&quot;REPLACE\&quot;,LE=RSAC_REPLACE$&quot;</span><span class=cF0>
<a name="l374"></a> </span><span class=cF6>&quot;$CM+LX,17,0$$BT,\&quot;SKIP\&quot;,LE=RSAC_SKIP$&quot;</span><span class=cF0>
<a name="l375"></a> </span><span class=cF6>&quot;$CM+LX,1,3$$BT,\&quot;ALL\&quot;,LE=RSAC_ALL$&quot;</span><span class=cF0>
<a name="l376"></a> </span><span class=cF6>&quot;$CM+LX,17,0$$BT,\&quot;CANCEL\&quot;,LE=DOCM_CANCEL$\n&quot;</span><span class=cF0>);
<a name="l377"></a> </span><span class=cF1>if</span><span class=cF0> (footer) </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;%s&quot;</span><span class=cF0>,footer);
<a name="l378"></a> i=</span><span class=cF5>PopUpMenu</span><span class=cF0>(doc);
<a name="l379"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
<a name="l380"></a> </span><span class=cF1>return</span><span class=cF0> i;
<a name="l381"></a>}
<a name="l382"></a>
<a name="l383"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>EdFindReplace</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc)
<a name="l384"></a>{
<a name="l385"></a> </span><span class=cF1>Bool</span><span class=cF0> found,unlock;
<a name="l386"></a> </span><span class=cF9>I64</span><span class=cF0> cmd,i,j,plen,rlen,dlen,res=-1,sf_flags;
<a name="l387"></a> </span><span class=cF1>U8</span><span class=cF0> *src,*dst,*dst2;
<a name="l388"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ce,*doc_e,*doc_marker=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l389"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;find_replace-&gt;pmt)
<a name="l390"></a> cmd=</span><span class=cF3>RSAC_REPLACE</span><span class=cF0>;
<a name="l391"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l392"></a> cmd=</span><span class=cF3>RSAC_ALL</span><span class=cF0>;
<a name="l393"></a> </span><span class=cF1>if</span><span class=cF0> (!doc-&gt;find_replace-&gt;pmt || </span><span class=cF5>DocForm</span><span class=cF7>(</span><span class=cF0>doc-&gt;find_replace</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l394"></a> res=0;
<a name="l395"></a> unlock=</span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l396"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;find_replace-&gt;match_case || doc-&gt;find_replace-&gt;local_var)
<a name="l397"></a> sf_flags=0;
<a name="l398"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l399"></a> sf_flags=</span><span class=cF3>SFF_IGNORE_CASE</span><span class=cF0>;
<a name="l400"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;find_replace-&gt;whole_labels || doc-&gt;find_replace-&gt;local_var)
<a name="l401"></a> sf_flags|=</span><span class=cF3>SFG_WHOLE_LABELS</span><span class=cF0>;
<a name="l402"></a>
<a name="l403"></a> </span><span class=cF1>if</span><span class=cF0> (i=doc-&gt;find_replace-&gt;filter_lines) {
<a name="l404"></a> doc_ce=doc-&gt;head.next;
<a name="l405"></a> </span><span class=cF1>while</span><span class=cF0> (doc_ce!=doc) </span><span class=cF7>{</span><span class=cF0>
<a name="l406"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;de_flags&amp;</span><span class=cF3>DOCEF_TAG</span><span class=cF0> &amp;&amp; doc_ce-&gt;tag &amp;&amp;
<a name="l407"></a> !</span><span class=cF7>(</span><span class=cF0>doc_ce-&gt;de_flags&amp;</span><span class=cF3>DOCEF_FILTER_SKIP</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l408"></a> </span><span class=cF5>StrFind</span><span class=cF7>(</span><span class=cF0>doc-&gt;find_replace-&gt;find_text,doc_ce-&gt;tag,sf_flags</span><span class=cF7>)</span><span class=cF0>) {
<a name="l409"></a> doc_ce-&gt;type|=</span><span class=cF3>DOCET_SEL</span><span class=cF0>;
<a name="l410"></a> res++;
<a name="l411"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l412"></a> doc_ce-&gt;type&amp;=~</span><span class=cF3>DOCET_SEL</span><span class=cF0>;
<a name="l413"></a> doc_ce=doc_ce-&gt;next;
<a name="l414"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l415"></a>
<a name="l416"></a> doc_ce=doc-&gt;head.next;
<a name="l417"></a> </span><span class=cF1>while</span><span class=cF0> (doc_ce!=doc) </span><span class=cF7>{</span><span class=cF0>
<a name="l418"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>doc_ce-&gt;de_flags&amp;</span><span class=cF3>DOCEF_FILTER_SKIP</span><span class=cF7>)</span><span class=cF0>) {
<a name="l419"></a> found=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l420"></a>
<a name="l421"></a> doc_e=doc_ce;
<a name="l422"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc &amp;&amp; doc_e-&gt;y&gt;doc_ce-&gt;y-i) </span><span class=cF7>{</span><span class=cF0>
<a name="l423"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;type&amp;</span><span class=cF3>DOCET_SEL</span><span class=cF0>) {
<a name="l424"></a> found=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l425"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l426"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l427"></a> doc_e=doc_e-&gt;last;
<a name="l428"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l429"></a>
<a name="l430"></a> </span><span class=cF1>if</span><span class=cF0> (!found) </span><span class=cF7>{</span><span class=cF0>
<a name="l431"></a> doc_e=doc_ce;
<a name="l432"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc &amp;&amp; doc_e-&gt;y&lt;doc_ce-&gt;y+i) {
<a name="l433"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;type&amp;</span><span class=cF3>DOCET_SEL</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l434"></a> found=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l435"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l436"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l437"></a> doc_e=doc_e-&gt;next;
<a name="l438"></a> }
<a name="l439"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l440"></a>
<a name="l441"></a> </span><span class=cF1>if</span><span class=cF0> (!found)
<a name="l442"></a> doc_ce-&gt;de_flags|=</span><span class=cF3>DOCEF_FILTER_SKIP</span><span class=cF0>;
<a name="l443"></a> }
<a name="l444"></a>
<a name="l445"></a> doc_ce=doc_ce-&gt;next;
<a name="l446"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l447"></a> </span><span class=cF5>EdSelAll</span><span class=cF0>(doc,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l448"></a> </span><span class=cF1>goto</span><span class=cF0> fr_unlock_done;
<a name="l449"></a> }
<a name="l450"></a>
<a name="l451"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;find_replace-&gt;local_var)
<a name="l452"></a> </span><span class=cF5>EdSelFun</span><span class=cF0>(doc);
<a name="l453"></a>
<a name="l454"></a> </span><span class=cF1>if</span><span class=cF0> (!doc-&gt;find_replace-&gt;replace &amp;&amp; !doc-&gt;find_replace-&gt;local_var) {
<a name="l455"></a> </span><span class=cF5>EdFindNext</span><span class=cF0>(doc);
<a name="l456"></a> </span><span class=cF1>goto</span><span class=cF0> fr_unlock_done;
<a name="l457"></a> }
<a name="l458"></a> plen=</span><span class=cF5>StrLen</span><span class=cF0>(doc-&gt;find_replace-&gt;find_text);
<a name="l459"></a> </span><span class=cF1>if</span><span class=cF0> (!plen)
<a name="l460"></a> </span><span class=cF1>goto</span><span class=cF0> fr_unlock_done;
<a name="l461"></a> rlen=</span><span class=cF5>StrLen</span><span class=cF0>(doc-&gt;find_replace-&gt;replace_text);
<a name="l462"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;head.next!=doc) {
<a name="l463"></a> doc_e=doc_marker=</span><span class=cF5>DocSplitTag</span><span class=cF0>(doc,doc-&gt;cur_entry,doc-&gt;cur_col,
<a name="l464"></a> doc-&gt;cur_entry-&gt;x+doc-&gt;cur_col,doc-&gt;cur_entry-&gt;y,</span><span class=cF3>DOCT_MARKER</span><span class=cF0>);
<a name="l465"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l466"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e==doc) {
<a name="l467"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;find_replace-&gt;scan_fwd)
<a name="l468"></a> doc_e=doc_e-&gt;next;
<a name="l469"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l470"></a> doc_e=doc_e-&gt;last;
<a name="l471"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e==doc_marker)
<a name="l472"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l473"></a> }
<a name="l474"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;type_u8==</span><span class=cF3>DOCT_TEXT</span><span class=cF0> &amp;&amp;
<a name="l475"></a> !</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;de_flags&amp;(</span><span class=cF3>DOCEG_DONT_EDIT</span><span class=cF0>|</span><span class=cF3>DOCEF_FILTER_SKIP</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l476"></a> </span><span class=cF7>(</span><span class=cF0>doc_e-&gt;type &amp; </span><span class=cF3>DOCET_SEL</span><span class=cF0> ||
<a name="l477"></a> !doc-&gt;find_replace-&gt;scan_sel_text&amp;&amp;
<a name="l478"></a> !doc-&gt;find_replace-&gt;local_var</span><span class=cF7>)</span><span class=cF0>) {
<a name="l479"></a> src=doc_e-&gt;tag;
<a name="l480"></a> </span><span class=cF1>while</span><span class=cF0> (src) </span><span class=cF7>{</span><span class=cF0>
<a name="l481"></a> src=</span><span class=cF5>StrFind</span><span class=cF0>(doc-&gt;find_replace-&gt;find_text,src,sf_flags);
<a name="l482"></a> </span><span class=cF1>if</span><span class=cF0> (src) {
<a name="l483"></a> doc-&gt;cur_col=src-doc_e-&gt;tag;
<a name="l484"></a> doc-&gt;cur_entry=doc_e;
<a name="l485"></a> </span><span class=cF1>if</span><span class=cF0> (cmd!=</span><span class=cF3>RSAC_ALL</span><span class=cF0>)
<a name="l486"></a> </span><span class=cF5>DocCenter</span><span class=cF0>(doc);
<a name="l487"></a> </span><span class=cF1>if</span><span class=cF0> (cmd!=</span><span class=cF3>RSAC_ALL</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l488"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l489"></a> cmd=</span><span class=cF5>PopUpReplaceSkipAllCancel</span><span class=cF0>(</span><span class=cF6>&quot;&quot;</span><span class=cF0>);
<a name="l490"></a> </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l491"></a> </span><span class=cF1>if</span><span class=cF0> (cmd&lt;0)
<a name="l492"></a> </span><span class=cF1>goto</span><span class=cF0> fr_unlock_done;
<a name="l493"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l494"></a> doc_e=doc-&gt;cur_entry;
<a name="l495"></a> src=doc-&gt;cur_col+doc_e-&gt;tag;
<a name="l496"></a> </span><span class=cF1>if</span><span class=cF0> (cmd==</span><span class=cF3>RSAC_REPLACE</span><span class=cF0> || cmd==</span><span class=cF3>RSAC_ALL</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l497"></a> dlen=</span><span class=cF5>StrLen</span><span class=cF0>(doc_e-&gt;tag);
<a name="l498"></a> doc_e-&gt;max_col=dlen+rlen-plen;
<a name="l499"></a> dst=</span><span class=cF5>MAlloc</span><span class=cF0>(doc_e-&gt;max_col+1,doc-&gt;mem_task);
<a name="l500"></a> dst2=dst;
<a name="l501"></a> j=src-doc_e-&gt;tag;
<a name="l502"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;j;i++)
<a name="l503"></a> *dst++=doc_e-&gt;tag[i];
<a name="l504"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;rlen;i++)
<a name="l505"></a> *dst++=doc-&gt;find_replace-&gt;replace_text[i];
<a name="l506"></a> src=dst;
<a name="l507"></a> </span><span class=cF1>for</span><span class=cF0> (i=j+plen;i&lt;=dlen;i++)
<a name="l508"></a> *dst++=doc_e-&gt;tag[i];
<a name="l509"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_e-&gt;tag);
<a name="l510"></a> doc_e-&gt;tag=dst2;
<a name="l511"></a> doc-&gt;cur_col=src-doc_e-&gt;tag;
<a name="l512"></a> doc-&gt;cur_entry=doc_e;
<a name="l513"></a> </span><span class=cF1>if</span><span class=cF0> (cmd!=</span><span class=cF3>RSAC_ALL</span><span class=cF0>) {
<a name="l514"></a> </span><span class=cF5>DocRemSoftNewLines</span><span class=cF0>(doc,doc-&gt;cur_entry);
<a name="l515"></a> </span><span class=cF5>DocRecalc</span><span class=cF0>(doc);
<a name="l516"></a> }
<a name="l517"></a> doc_e=doc-&gt;cur_entry;
<a name="l518"></a> src=doc-&gt;cur_col+doc_e-&gt;tag;
<a name="l519"></a> res++;
<a name="l520"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l521"></a> src++;
<a name="l522"></a> }
<a name="l523"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l524"></a> }
<a name="l525"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;find_replace-&gt;scan_fwd)
<a name="l526"></a> doc_e=doc_e-&gt;next;
<a name="l527"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l528"></a> doc_e=doc_e-&gt;last;
<a name="l529"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc_marker);
<a name="l530"></a> }
<a name="l531"></a>fr_unlock_done:
<a name="l532"></a> </span><span class=cF1>if</span><span class=cF0> (doc_marker)
<a name="l533"></a> </span><span class=cF5>DocEntryDel</span><span class=cF0>(doc,doc_marker);
<a name="l534"></a> </span><span class=cF5>DocRemSoftNewLines</span><span class=cF0>(doc,</span><span class=cF3>NULL</span><span class=cF0>);
<a name="l535"></a> </span><span class=cF5>DocRecalc</span><span class=cF0>(doc);
<a name="l536"></a> </span><span class=cF5>DocCenter</span><span class=cF0>(doc);
<a name="l537"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l538"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l539"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l540"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l541"></a>}
<a name="l542"></a>
<a name="l543"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>EdReplace</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc,</span><span class=cF1>U8</span><span class=cF0> *find,</span><span class=cF1>U8</span><span class=cF0> *replace,
<a name="l544"></a></span><span class=cF1>Bool</span><span class=cF0> sel=</span><span class=cF3>TRUE</span><span class=cF0>,</span><span class=cF1>Bool</span><span class=cF0> match_case=</span><span class=cF3>TRUE</span><span class=cF0>,</span><span class=cF1>Bool</span><span class=cF0> whole_labels=</span><span class=cF3>FALSE</span><span class=cF0>)
<a name="l545"></a>{</span><span class=cF2>//Find &amp; replace using editor's cmd.</span><span class=cF0>
<a name="l546"></a> </span><span class=cF9>CEdFindText</span><span class=cF0> old_find_replace;
<a name="l547"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock;
<a name="l548"></a> </span><span class=cF9>I64</span><span class=cF0> i,res=-1;
<a name="l549"></a> </span><span class=cF1>if</span><span class=cF0> (!doc) </span><span class=cF1>return</span><span class=cF0> -1;
<a name="l550"></a> unlock=</span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l551"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&amp;old_find_replace,doc-&gt;find_replace,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CEdFindText</span><span class=cF7>)</span><span class=cF0>);
<a name="l552"></a> </span><span class=cF5>MemSet</span><span class=cF0>(doc-&gt;find_replace,0,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CEdFindText</span><span class=cF7>)</span><span class=cF0>);
<a name="l553"></a> i=</span><span class=cF5>StrLen</span><span class=cF0>(find);
<a name="l554"></a> </span><span class=cF1>if</span><span class=cF0> (i&lt;</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CEdFindText</span><span class=cF0>.find_text</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l555"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(doc-&gt;find_replace-&gt;find_text,find,i+1);
<a name="l556"></a> i=</span><span class=cF5>StrLen</span><span class=cF0>(replace);
<a name="l557"></a> </span><span class=cF1>if</span><span class=cF0> (i&lt;</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CEdFindText</span><span class=cF0>.replace_text</span><span class=cF7>)</span><span class=cF0>) {
<a name="l558"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(doc-&gt;find_replace-&gt;replace_text,replace,i+1);
<a name="l559"></a> doc-&gt;find_replace-&gt;replace=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l560"></a> doc-&gt;find_replace-&gt;scan_sel_text=sel;
<a name="l561"></a> doc-&gt;find_replace-&gt;match_case=match_case;
<a name="l562"></a> doc-&gt;find_replace-&gt;whole_labels=whole_labels;
<a name="l563"></a> doc-&gt;find_replace-&gt;pmt=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l564"></a> res=</span><span class=cF5>EdFindReplace</span><span class=cF0>(doc);
<a name="l565"></a> }
<a name="l566"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l567"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(doc-&gt;find_replace,&amp;old_find_replace,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CEdFindText</span><span class=cF7>)</span><span class=cF0>);
<a name="l568"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l569"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l570"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l571"></a>}
<a name="l572"></a>
<a name="l573"></a></span><span class=cF1>class</span><span class=cF0> </span><span class=cF9>CEdLineGoTo</span><span class=cF0>
<a name="l574"></a>{
<a name="l575"></a> </span><span class=cF9>I64</span><span class=cF0> line format </span><span class=cF6>&quot;$DA,A=\&quot;Go to Line:%d\&quot;$&quot;</span><span class=cF0>;
<a name="l576"></a>};
<a name="l577"></a>
<a name="l578"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>EdGoToLine</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc)
<a name="l579"></a>{</span><span class=cF2>//Prompt with form and go to line num.</span><span class=cF0>
<a name="l580"></a> </span><span class=cF9>CEdLineGoTo</span><span class=cF0> gtl;
<a name="l581"></a> gtl.line=1;
<a name="l582"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DocForm</span><span class=cF7>(</span><span class=cF0>&amp;gtl</span><span class=cF7>)</span><span class=cF0>)
<a name="l583"></a> </span><span class=cF5>DocGoToLine</span><span class=cF0>(doc,gtl.line);
<a name="l584"></a>}
</span></pre></body>
</html>