ZealOS/docs/System/DolDoc/DocFind.CC.html
2021-10-18 01:49:09 -04:00

728 lines
69 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.03">
<style type="text/css">
body {background-color:#1f1f1f;}
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
.cF1{color:#4f84a6;background-color:#1f1f1f;}
.cF2{color:#73a255;background-color:#1f1f1f;}
.cF3{color:#297582;background-color:#1f1f1f;}
.cF4{color:#b34f4b;background-color:#1f1f1f;}
.cF5{color:#8a52c3;background-color:#1f1f1f;}
.cF6{color:#b7822f;background-color:#1f1f1f;}
.cF7{color:#444444;background-color:#1f1f1f;}
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
.cF9{color:#94bfde;background-color:#1f1f1f;}
.cFA{color:#a1ce97;background-color:#1f1f1f;}
.cFB{color:#6db4be;background-color:#1f1f1f;}
.cFC{color:#e88e88;background-color:#1f1f1f;}
.cFD{color:#ca94e8;background-color:#1f1f1f;}
.cFE{color:#d4b475;background-color:#1f1f1f;}
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;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>
<a name="l7"></a> </span><span class=cF1>if</span><span class=cF0> (doc)
<a name="l8"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l9"></a> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l10"></a> doc-&gt;x = </span><span class=cFE>0</span><span class=cF0>;
<a name="l11"></a> doc-&gt;y = line_num - </span><span class=cFE>1</span><span class=cF0>;
<a name="l12"></a> </span><span class=cF5>DocRecalc</span><span class=cF0>(doc, </span><span class=cF3>RECALCt_FIND_CURSOR</span><span class=cF0>);
<a name="l13"></a> </span><span class=cF5>DocCenter</span><span class=cF0>(doc);
<a name="l14"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_entry-&gt;y == line_num - </span><span class=cFE>1</span><span class=cF0>)
<a name="l15"></a> res = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l16"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l17"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l18"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l19"></a>
<a name="l20"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l21"></a>}
<a name="l22"></a>
<a name="l23"></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>, </span><span class=cF1>U8</span><span class=cF0> *needle, </span><span class=cF9>I64</span><span class=cF0> match=</span><span class=cFE>1</span><span class=cF0>)
<a name="l24"></a>{</span><span class=cF2>//Find str by searching tags. Move cur_entry &amp; center.</span><span class=cF0>
<a name="l25"></a> </span><span class=cF1>Bool</span><span class=cF0> res = </span><span class=cF3>FALSE</span><span class=cF0>, unlock;
<a name="l26"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e;
<a name="l27"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr;
<a name="l28"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l29"></a>
<a name="l30"></a> </span><span class=cF1>if</span><span class=cF0> (haystack_doc)
<a name="l31"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l32"></a> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(haystack_doc);
<a name="l33"></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="l34"></a> {
<a name="l35"></a> res = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l36"></a> doc_e = haystack_doc-&gt;head.next;
<a name="l37"></a> }
<a name="l38"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l39"></a> {
<a name="l40"></a> res = </span><span class=cF5>DocGoToLine</span><span class=cF0>(haystack_doc, start_line_num);
<a name="l41"></a> doc_e = haystack_doc-&gt;cur_entry;
<a name="l42"></a> }
<a name="l43"></a> </span><span class=cF1>if</span><span class=cF0> (res)
<a name="l44"></a> {
<a name="l45"></a> </span><span class=cF1>if</span><span class=cF0> (needle)
<a name="l46"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l47"></a> res = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l48"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != haystack_doc)
<a name="l49"></a> {
<a name="l50"></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; </span><span class=cF2>//TODO: handle multi-DocEntry strs</span><span class=cF0>
<a name="l51"></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>)
<a name="l52"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l53"></a> i = ptr-doc_e-&gt;tag;
<a name="l54"></a> </span><span class=cF1>if</span><span class=cF0> (!--match)
<a name="l55"></a> {
<a name="l56"></a> haystack_doc-&gt;cur_entry = doc_e;
<a name="l57"></a> </span><span class=cF1>if</span><span class=cF0> (i &lt; doc_e-&gt;min_col)
<a name="l58"></a> i = doc_e-&gt;min_col;
<a name="l59"></a> </span><span class=cF1>if</span><span class=cF0> (i &gt; doc_e-&gt;max_col)
<a name="l60"></a> i = doc_e-&gt;max_col;
<a name="l61"></a> haystack_doc-&gt;cur_col = i;
<a name="l62"></a> res = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l63"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l64"></a> }
<a name="l65"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l66"></a> doc_e = doc_e-&gt;next;
<a name="l67"></a> }
<a name="l68"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l69"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l70"></a> res = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l71"></a> }
<a name="l72"></a> </span><span class=cF1>if</span><span class=cF0> (!res)
<a name="l73"></a> </span><span class=cF5>DocBottom</span><span class=cF0>(haystack_doc);
<a name="l74"></a> </span><span class=cF5>DocCenter</span><span class=cF0>(haystack_doc);
<a name="l75"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l76"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(haystack_doc);
<a name="l77"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l78"></a>
<a name="l79"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l80"></a>}
<a name="l81"></a>
<a name="l82"></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="l83"></a>{</span><span class=cF2>//Find named anchor. Move cur_entry &amp; center.</span><span class=cF0>
<a name="l84"></a> </span><span class=cF1>Bool</span><span class=cF0> res = </span><span class=cF3>FALSE</span><span class=cF0>, unlock;
<a name="l85"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e;
<a name="l86"></a>
<a name="l87"></a> </span><span class=cF1>if</span><span class=cF0> (haystack_doc)
<a name="l88"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l89"></a> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(haystack_doc);
<a name="l90"></a> doc_e = haystack_doc-&gt;head.next;
<a name="l91"></a> </span><span class=cF1>if</span><span class=cF0> (needle_str)
<a name="l92"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != haystack_doc)
<a name="l93"></a> {
<a name="l94"></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>)
<a name="l95"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l96"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</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="l97"></a> {
<a name="l98"></a> haystack_doc-&gt;cur_entry = doc_e;
<a name="l99"></a> haystack_doc-&gt;cur_col = doc_e-&gt;min_col;
<a name="l100"></a> res = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l101"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l102"></a> }
<a name="l103"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l104"></a> doc_e = doc_e-&gt;next;
<a name="l105"></a> }
<a name="l106"></a> </span><span class=cF1>if</span><span class=cF0> (!res)
<a name="l107"></a> </span><span class=cF5>DocBottom</span><span class=cF0>(haystack_doc);
<a name="l108"></a> </span><span class=cF5>DocCenter</span><span class=cF0>(haystack_doc);
<a name="l109"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l110"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(haystack_doc);
<a name="l111"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l112"></a>
<a name="l113"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l114"></a>}
<a name="l115"></a>
<a name="l116"></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="l117"></a>{</span><span class=cF2>//Editor F3 find next, possibly doing replaces.</span><span class=cF0>
<a name="l118"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l119"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr, *ptr2, *ptr3;
<a name="l120"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ce = doc-&gt;cur_entry, *doc_e = doc_ce;
<a name="l121"></a> </span><span class=cF9>I64</span><span class=cF0> sf_flags;
<a name="l122"></a>
<a name="l123"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;find_replace-&gt;match_case)
<a name="l124"></a> sf_flags = </span><span class=cFE>0</span><span class=cF0>;
<a name="l125"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l126"></a> sf_flags = </span><span class=cF3>SFF_IGNORE_CASE</span><span class=cF0>;
<a name="l127"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;find_replace-&gt;whole_labels)
<a name="l128"></a> sf_flags |= </span><span class=cF3>SFG_WHOLE_LABELS</span><span class=cF0>;
<a name="l129"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l130"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l131"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e != doc)
<a name="l132"></a> {
<a name="l133"></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; !</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>)
<a name="l134"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l135"></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> || !doc-&gt;find_replace-&gt;scan_sel_text)
<a name="l136"></a> {
<a name="l137"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;find_replace-&gt;scan_fwd)
<a name="l138"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l139"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e == doc_ce)
<a name="l140"></a> {
<a name="l141"></a> ptr = doc_ce-&gt;tag + doc-&gt;cur_col + </span><span class=cFE>1</span><span class=cF0>;
<a name="l142"></a> </span><span class=cF1>if</span><span class=cF0> (ptr - doc_ce-&gt;tag &gt;= doc_ce-&gt;max_col)
<a name="l143"></a> </span><span class=cF1>goto</span><span class=cF0> fn_skip;
<a name="l144"></a> </span><span class=cF1>if</span><span class=cF0> (ptr - doc_ce-&gt;tag &lt; doc_ce-&gt;min_col)
<a name="l145"></a> ptr = doc_ce-&gt;tag + doc_ce-&gt;min_col;
<a name="l146"></a> }
<a name="l147"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l148"></a> ptr = doc_e-&gt;tag;
<a name="l149"></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="l150"></a> {
<a name="l151"></a> doc-&gt;cur_entry = doc_e;
<a name="l152"></a> doc-&gt;cur_col = ptr-doc_e-&gt;tag;
<a name="l153"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col &gt;= doc_e-&gt;max_col)
<a name="l154"></a> doc-&gt;cur_col = doc_e-&gt;max_col - </span><span class=cFE>1</span><span class=cF0>;
<a name="l155"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col &lt; doc_e-&gt;min_col)
<a name="l156"></a> doc-&gt;cur_col = doc_e-&gt;min_col;
<a name="l157"></a> </span><span class=cF5>DocCenter</span><span class=cF0>(doc);
<a name="l158"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l159"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l160"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l161"></a> }
<a name="l162"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l163"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l164"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l165"></a> ptr2 = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l166"></a> ptr = doc_e-&gt;tag + doc_e-&gt;min_col;
<a name="l167"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e == doc_ce)
<a name="l168"></a> ptr3 = doc_ce-&gt;tag + doc-&gt;cur_col;
<a name="l169"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l170"></a> ptr3 = doc_e-&gt;tag + doc_e-&gt;max_col;
<a name="l171"></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="l172"></a> {
<a name="l173"></a> </span><span class=cF1>if</span><span class=cF0> (ptr &gt;= ptr3)
<a name="l174"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l175"></a> ptr2 = ptr++;
<a name="l176"></a> }
<a name="l177"></a> </span><span class=cF1>if</span><span class=cF0> (ptr2 &amp;&amp; ptr2 &lt; ptr3)
<a name="l178"></a> {
<a name="l179"></a> doc-&gt;cur_entry = doc_e;
<a name="l180"></a> doc-&gt;cur_col = ptr2 - doc_e-&gt;tag;
<a name="l181"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col &gt;= doc_e-&gt;max_col)
<a name="l182"></a> doc-&gt;cur_col = doc_e-&gt;max_col - </span><span class=cFE>1</span><span class=cF0>;
<a name="l183"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col &lt; doc_e-&gt;min_col)
<a name="l184"></a> doc-&gt;cur_col = doc_e-&gt;min_col;
<a name="l185"></a> </span><span class=cF5>DocCenter</span><span class=cF0>(doc);
<a name="l186"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l187"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l188"></a>
<a name="l189"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l190"></a> }
<a name="l191"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l192"></a> }
<a name="l193"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l194"></a> }
<a name="l195"></a>fn_skip:
<a name="l196"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;find_replace-&gt;scan_fwd)
<a name="l197"></a> doc_e = doc_e-&gt;next;
<a name="l198"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l199"></a> doc_e = doc_e-&gt;last;
<a name="l200"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l201"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != doc_ce);
<a name="l202"></a>
<a name="l203"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l204"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l205"></a>}
<a name="l206"></a>
<a name="l207"></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="l208"></a>{</span><span class=cF2>//Set state of </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l1090"><span class=cF4>DOCET_SEL</span></a><span class=cF2> on all entries.</span><span class=cF0>
<a name="l209"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l210"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e = doc-&gt;head.next;
<a name="l211"></a>
<a name="l212"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != doc)
<a name="l213"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l214"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&amp;doc_e-&gt;type, </span><span class=cF3>DOCEt_SEL</span><span class=cF0>, sel);
<a name="l215"></a> doc_e = doc_e-&gt;next;
<a name="l216"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l217"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l218"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l219"></a>}
<a name="l220"></a>
<a name="l221"></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="l222"></a></span><span class=cF1>Bool</span><span class=cF0> forward, </span><span class=cF1>Bool</span><span class=cF0> abort_on_dbl_colon=</span><span class=cF3>FALSE</span><span class=cF0>)
<a name="l223"></a>{</span><span class=cF2>//Find { } or ( ) pair. Move cur_entry &amp; center.</span><span class=cF0>
<a name="l224"></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="l225"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr;
<a name="l226"></a> </span><span class=cF9>I64</span><span class=cF0> ch, levels = </span><span class=cFE>0</span><span class=cF0>, colons = </span><span class=cFE>0</span><span class=cF0>, original_col = doc-&gt;cur_col;
<a name="l227"></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="l228"></a>
<a name="l229"></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="l230"></a> colons = </span><span class=cFE>1</span><span class=cF0>;
<a name="l231"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l232"></a> colons = </span><span class=cFE>0</span><span class=cF0>;
<a name="l233"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l234"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l235"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e != doc)
<a name="l236"></a> {
<a name="l237"></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; !</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>)
<a name="l238"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l239"></a> </span><span class=cF1>if</span><span class=cF0> (forward)
<a name="l240"></a> {
<a name="l241"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e == doc_ce)
<a name="l242"></a> ptr = doc_e-&gt;tag + doc-&gt;cur_col + </span><span class=cFE>1</span><span class=cF0>;
<a name="l243"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l244"></a> ptr = doc_e-&gt;tag;
<a name="l245"></a> </span><span class=cF1>if</span><span class=cF0> (ptr - doc_e-&gt;tag &lt; doc_e-&gt;min_col)
<a name="l246"></a> ptr = doc_e-&gt;tag + doc_e-&gt;min_col;
<a name="l247"></a> </span><span class=cF1>if</span><span class=cF0> (ptr - doc_e-&gt;tag &gt;= doc_e-&gt;max_col)
<a name="l248"></a> </span><span class=cF1>goto</span><span class=cF0> pa_skip;
<a name="l249"></a> </span><span class=cF1>while</span><span class=cF0> (ch = *ptr++)
<a name="l250"></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="l251"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l252"></a> </span><span class=cF1>if</span><span class=cF0> (++colons == </span><span class=cFE>2</span><span class=cF0>)
<a name="l253"></a> {
<a name="l254"></a> doc-&gt;cur_entry = doc_e;
<a name="l255"></a> doc-&gt;cur_col = ptr - doc_e-&gt;tag - </span><span class=cFE>1</span><span class=cF0>;
<a name="l256"></a> </span><span class=cF5>EdCursorLeft</span><span class=cF0>(doc);
<a name="l257"></a> res = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l258"></a> </span><span class=cF1>goto</span><span class=cF0> pa_done;
<a name="l259"></a> }
<a name="l260"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l261"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l262"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l263"></a> colons = </span><span class=cFE>0</span><span class=cF0>;
<a name="l264"></a> </span><span class=cF1>if</span><span class=cF0> (ch == plus)
<a name="l265"></a> levels++;
<a name="l266"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (ch == minus)
<a name="l267"></a> {
<a name="l268"></a> </span><span class=cF1>if</span><span class=cF0> (!levels--)
<a name="l269"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l270"></a> doc-&gt;cur_entry = doc_e;
<a name="l271"></a> doc-&gt;cur_col = ptr - doc_e-&gt;tag - </span><span class=cFE>1</span><span class=cF0>;
<a name="l272"></a> res = doc-&gt;cur_entry != original_ce || doc-&gt;cur_col != original_col;
<a name="l273"></a> </span><span class=cF1>goto</span><span class=cF0> pa_done;
<a name="l274"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l275"></a> }
<a name="l276"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l277"></a> }
<a name="l278"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l279"></a> {
<a name="l280"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e == doc_ce)
<a name="l281"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l282"></a> ptr = doc_e-&gt;tag + doc-&gt;cur_col - </span><span class=cFE>1</span><span class=cF0>;
<a name="l283"></a> </span><span class=cF1>if</span><span class=cF0> (ptr - doc_e-&gt;tag &gt;= doc_e-&gt;max_col)
<a name="l284"></a> ptr = doc_e-&gt;tag + doc_e-&gt;max_col - </span><span class=cFE>1</span><span class=cF0>;
<a name="l285"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l286"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l287"></a> ptr = doc_e-&gt;tag + doc_e-&gt;max_col - </span><span class=cFE>1</span><span class=cF0>;
<a name="l288"></a> </span><span class=cF1>if</span><span class=cF0> (ptr - doc_e-&gt;tag &lt; doc_e-&gt;min_col)
<a name="l289"></a> </span><span class=cF1>goto</span><span class=cF0> pa_skip;
<a name="l290"></a> </span><span class=cF1>while</span><span class=cF0> (ptr &gt;= doc_e-&gt;tag + doc_e-&gt;min_col)
<a name="l291"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l292"></a> ch = *ptr--;
<a name="l293"></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="l294"></a> {
<a name="l295"></a> </span><span class=cF1>if</span><span class=cF0> (++colons == </span><span class=cFE>2</span><span class=cF0>)
<a name="l296"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l297"></a> doc-&gt;cur_entry = doc_e;
<a name="l298"></a> doc-&gt;cur_col = ptr - doc_e-&gt;tag + </span><span class=cFE>1</span><span class=cF0>;
<a name="l299"></a> res = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l300"></a> </span><span class=cF1>goto</span><span class=cF0> pa_done;
<a name="l301"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l302"></a> }
<a name="l303"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l304"></a> {
<a name="l305"></a> colons = </span><span class=cFE>0</span><span class=cF0>;
<a name="l306"></a> </span><span class=cF1>if</span><span class=cF0> (ch == plus)
<a name="l307"></a> levels++;
<a name="l308"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (ch == minus)
<a name="l309"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l310"></a> </span><span class=cF1>if</span><span class=cF0> (!levels--)
<a name="l311"></a> {
<a name="l312"></a> doc-&gt;cur_entry = doc_e;
<a name="l313"></a> doc-&gt;cur_col = ptr-doc_e-&gt;tag+</span><span class=cFE>1</span><span class=cF0>;
<a name="l314"></a> res = doc-&gt;cur_entry != original_ce || doc-&gt;cur_col != original_col;
<a name="l315"></a> </span><span class=cF1>goto</span><span class=cF0> pa_done;
<a name="l316"></a> }
<a name="l317"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l318"></a> }
<a name="l319"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l320"></a> }
<a name="l321"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l322"></a> }
<a name="l323"></a>pa_skip:
<a name="l324"></a> </span><span class=cF1>if</span><span class=cF0> (forward)
<a name="l325"></a> doc_e = doc_e-&gt;next;
<a name="l326"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l327"></a> doc_e = doc_e-&gt;last;
<a name="l328"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l329"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != doc_ce);
<a name="l330"></a>
<a name="l331"></a>pa_done:
<a name="l332"></a> </span><span class=cF5>DocRecalc</span><span class=cF0>(doc);
<a name="l333"></a> </span><span class=cF5>DocCenter</span><span class=cF0>(doc);
<a name="l334"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l335"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l336"></a>
<a name="l337"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l338"></a>}
<a name="l339"></a>
<a name="l340"></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> forward, </span><span class=cF1>Bool</span><span class=cF0> abort_on_dbl_colon)
<a name="l341"></a>{</span><span class=cF2>//Move cur_entry to start of cur function and center. (Shoddy)</span><span class=cF0>
<a name="l342"></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="l343"></a> </span><span class=cF9>I64</span><span class=cF0> ch, levels, colons;
<a name="l344"></a>
<a name="l345"></a> </span><span class=cF1>if</span><span class=cF0> (forward)
<a name="l346"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l347"></a> levels = </span><span class=cFE>0</span><span class=cF0>;
<a name="l348"></a> colons = </span><span class=cFE>0</span><span class=cF0>;
<a name="l349"></a> </span><span class=cF1>while</span><span class=cF0> (doc-&gt;cur_entry != doc)
<a name="l350"></a> {
<a name="l351"></a> ch = </span><span class=cF5>EdCurU8</span><span class=cF0>(doc);
<a name="l352"></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="l353"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l354"></a> </span><span class=cF1>if</span><span class=cF0> (++colons == </span><span class=cFE>2</span><span class=cF0>)
<a name="l355"></a> {
<a name="l356"></a> </span><span class=cF5>EdCursorLeft</span><span class=cF0>(doc);
<a name="l357"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l358"></a> }
<a name="l359"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l360"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l361"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l362"></a> colons = </span><span class=cFE>0</span><span class=cF0>;
<a name="l363"></a> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF6>'{'</span><span class=cF0>)
<a name="l364"></a> levels++;
<a name="l365"></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="l366"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l367"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l368"></a> </span><span class=cF5>EdCursorRight</span><span class=cF0>(doc);
<a name="l369"></a> }
<a name="l370"></a> </span><span class=cF5>DocRecalc</span><span class=cF0>(doc);
<a name="l371"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_entry != doc)
<a name="l372"></a> res = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l373"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l374"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l375"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l376"></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="l377"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_entry != doc)
<a name="l378"></a> {
<a name="l379"></a> ch = </span><span class=cF5>EdCurU8</span><span class=cF0>(doc);
<a name="l380"></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="l381"></a> res = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l382"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l383"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l384"></a> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF6>'{'</span><span class=cF0>)
<a name="l385"></a> res = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l386"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l387"></a> }
<a name="l388"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l389"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l390"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l391"></a>
<a name="l392"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l393"></a>}
<a name="l394"></a>
<a name="l395"></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="l396"></a>{</span><span class=cF2>//Set </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l1090"><span class=cF4>DOCET_SEL</span></a><span class=cF2> on all entries in cur function.</span><span class=cF0>
<a name="l397"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l398"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr;
<a name="l399"></a> </span><span class=cF9>I64</span><span class=cF0> ch, levels = </span><span class=cFE>0</span><span class=cF0>, colons = </span><span class=cFE>0</span><span class=cF0>;
<a name="l400"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e;
<a name="l401"></a>
<a name="l402"></a> </span><span class=cF5>EdSelAll</span><span class=cF0>(doc, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l403"></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="l404"></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="l405"></a> levels--;
<a name="l406"></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>)
<a name="l407"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l408"></a> </span><span class=cF5>EdCursorRight</span><span class=cF0>(doc);
<a name="l409"></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="l410"></a> </span><span class=cF5>EdCursorRight</span><span class=cF0>(doc);
<a name="l411"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l412"></a> doc_e = doc-&gt;cur_entry;
<a name="l413"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != doc)
<a name="l414"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l415"></a> doc_e-&gt;type |= </span><span class=cF3>DOCET_SEL</span><span class=cF0>;
<a name="l416"></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="l417"></a> {
<a name="l418"></a> ptr = doc_e-&gt;tag;
<a name="l419"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e == doc-&gt;cur_entry)
<a name="l420"></a> ptr += doc-&gt;cur_col;
<a name="l421"></a> </span><span class=cF1>while</span><span class=cF0> (ch = *ptr++)
<a name="l422"></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="l423"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l424"></a> </span><span class=cF1>if</span><span class=cF0> (++colons == </span><span class=cFE>2</span><span class=cF0>)
<a name="l425"></a> </span><span class=cF1>goto</span><span class=cF0> sf_done;
<a name="l426"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l427"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l428"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l429"></a> colons = </span><span class=cFE>0</span><span class=cF0>;
<a name="l430"></a> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF6>'{'</span><span class=cF0>)
<a name="l431"></a> levels++;
<a name="l432"></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="l433"></a> </span><span class=cF1>goto</span><span class=cF0> sf_done;
<a name="l434"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l435"></a> }
<a name="l436"></a> doc_e = doc_e-&gt;next;
<a name="l437"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l438"></a>sf_done:
<a name="l439"></a> </span><span class=cF5>DocRecalc</span><span class=cF0>(doc);
<a name="l440"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l441"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l442"></a>}
<a name="l443"></a>
<a name="l444"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>RSAC_REPLACE</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>
<a name="l445"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>RSAC_SKIP</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>
<a name="l446"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>RSAC_ALL</span><span class=cF0> </span><span class=cFE>2</span><span class=cF0>
<a name="l447"></a>
<a name="l448"></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="l449"></a>{
<a name="l450"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l451"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc = </span><span class=cF5>DocNew</span><span class=cF0>;
<a name="l452"></a>
<a name="l453"></a> </span><span class=cF1>if</span><span class=cF0> (header)
<a name="l454"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, header);
<a name="l455"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,
<a name="l456"></a> </span><span class=cF6>&quot;$CM+LX,1,4$$BT,\&quot;REPLACE\&quot;,LE=RSAC_REPLACE$&quot;</span><span class=cF0>
<a name="l457"></a> </span><span class=cF6>&quot;$CM+LX,17,0$$BT,\&quot;SKIP\&quot;,LE=RSAC_SKIP$&quot;</span><span class=cF0>
<a name="l458"></a> </span><span class=cF6>&quot;$CM+LX,1,3$$BT,\&quot;ALL\&quot;,LE=RSAC_ALL$&quot;</span><span class=cF0>
<a name="l459"></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="l460"></a> </span><span class=cF1>if</span><span class=cF0> (footer)
<a name="l461"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, footer);
<a name="l462"></a> i = </span><span class=cF5>PopUpMenu</span><span class=cF0>(doc);
<a name="l463"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
<a name="l464"></a>
<a name="l465"></a> </span><span class=cF1>return</span><span class=cF0> i;
<a name="l466"></a>}
<a name="l467"></a>
<a name="l468"></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="l469"></a>{
<a name="l470"></a> </span><span class=cF1>Bool</span><span class=cF0> found, unlock;
<a name="l471"></a> </span><span class=cF9>I64</span><span class=cF0> cmd, i, j, plen, rlen, dlen, res = -</span><span class=cFE>1</span><span class=cF0>, sf_flags;
<a name="l472"></a> </span><span class=cF1>U8</span><span class=cF0> *src, *dst, *dst2;
<a name="l473"></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="l474"></a>
<a name="l475"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;find_replace-&gt;prompt)
<a name="l476"></a> cmd = </span><span class=cF3>RSAC_REPLACE</span><span class=cF0>;
<a name="l477"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l478"></a> cmd = </span><span class=cF3>RSAC_ALL</span><span class=cF0>;
<a name="l479"></a> </span><span class=cF1>if</span><span class=cF0> (!doc-&gt;find_replace-&gt;prompt || </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>)
<a name="l480"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l481"></a> res = </span><span class=cFE>0</span><span class=cF0>;
<a name="l482"></a> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l483"></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="l484"></a> sf_flags = </span><span class=cFE>0</span><span class=cF0>;
<a name="l485"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l486"></a> sf_flags = </span><span class=cF3>SFF_IGNORE_CASE</span><span class=cF0>;
<a name="l487"></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="l488"></a> sf_flags |= </span><span class=cF3>SFG_WHOLE_LABELS</span><span class=cF0>;
<a name="l489"></a>
<a name="l490"></a> </span><span class=cF1>if</span><span class=cF0> (i = doc-&gt;find_replace-&gt;filter_lines)
<a name="l491"></a> {
<a name="l492"></a> doc_ce = doc-&gt;head.next;
<a name="l493"></a> </span><span class=cF1>while</span><span class=cF0> (doc_ce != doc)
<a name="l494"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l495"></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; !</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="l496"></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="l497"></a> {
<a name="l498"></a> doc_ce-&gt;type |= </span><span class=cF3>DOCET_SEL</span><span class=cF0>;
<a name="l499"></a> res++;
<a name="l500"></a> }
<a name="l501"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l502"></a> doc_ce-&gt;type &amp;= ~</span><span class=cF3>DOCET_SEL</span><span class=cF0>;
<a name="l503"></a> doc_ce = doc_ce-&gt;next;
<a name="l504"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l505"></a>
<a name="l506"></a> doc_ce = doc-&gt;head.next;
<a name="l507"></a> </span><span class=cF1>while</span><span class=cF0> (doc_ce != doc)
<a name="l508"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l509"></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="l510"></a> {
<a name="l511"></a> found = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l512"></a>
<a name="l513"></a> doc_e = doc_ce;
<a name="l514"></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)
<a name="l515"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l516"></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="l517"></a> {
<a name="l518"></a> found = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l519"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l520"></a> }
<a name="l521"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l522"></a> doc_e = doc_e-&gt;last;
<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> (!found)
<a name="l526"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l527"></a> doc_e = doc_ce;
<a name="l528"></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="l529"></a> {
<a name="l530"></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="l531"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l532"></a> found = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l533"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l534"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l535"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l536"></a> doc_e = doc_e-&gt;next;
<a name="l537"></a> }
<a name="l538"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l539"></a>
<a name="l540"></a> </span><span class=cF1>if</span><span class=cF0> (!found)
<a name="l541"></a> doc_ce-&gt;de_flags |= </span><span class=cF3>DOCEF_FILTER_SKIP</span><span class=cF0>;
<a name="l542"></a> }
<a name="l543"></a>
<a name="l544"></a> doc_ce = doc_ce-&gt;next;
<a name="l545"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l546"></a> </span><span class=cF5>EdSelAll</span><span class=cF0>(doc, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l547"></a> </span><span class=cF1>goto</span><span class=cF0> fr_unlock_done;
<a name="l548"></a> }
<a name="l549"></a>
<a name="l550"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;find_replace-&gt;local_var)
<a name="l551"></a> </span><span class=cF5>EdSelFun</span><span class=cF0>(doc);
<a name="l552"></a>
<a name="l553"></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="l554"></a> {
<a name="l555"></a> </span><span class=cF5>EdFindNext</span><span class=cF0>(doc);
<a name="l556"></a> </span><span class=cF1>goto</span><span class=cF0> fr_unlock_done;
<a name="l557"></a> }
<a name="l558"></a> plen = </span><span class=cF5>StrLen</span><span class=cF0>(doc-&gt;find_replace-&gt;find_text);
<a name="l559"></a> </span><span class=cF1>if</span><span class=cF0> (!plen)
<a name="l560"></a> </span><span class=cF1>goto</span><span class=cF0> fr_unlock_done;
<a name="l561"></a> rlen = </span><span class=cF5>StrLen</span><span class=cF0>(doc-&gt;find_replace-&gt;replace_text);
<a name="l562"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;head.next != doc)
<a name="l563"></a> {
<a name="l564"></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="l565"></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="l566"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l567"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l568"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e == doc)
<a name="l569"></a> {
<a name="l570"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;find_replace-&gt;scan_fwd)
<a name="l571"></a> doc_e = doc_e-&gt;next;
<a name="l572"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l573"></a> doc_e = doc_e-&gt;last;
<a name="l574"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e == doc_marker)
<a name="l575"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l576"></a> }
<a name="l577"></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="l578"></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="l579"></a> </span><span class=cF7>(</span><span class=cF0>doc_e-&gt;type &amp; </span><span class=cF3>DOCET_SEL</span><span class=cF0> || !doc-&gt;find_replace-&gt;scan_sel_text &amp;&amp; !doc-&gt;find_replace-&gt;local_var</span><span class=cF7>)</span><span class=cF0>)
<a name="l580"></a> {
<a name="l581"></a> src = doc_e-&gt;tag;
<a name="l582"></a> </span><span class=cF1>while</span><span class=cF0> (src)
<a name="l583"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l584"></a> src = </span><span class=cF5>StrFind</span><span class=cF0>(doc-&gt;find_replace-&gt;find_text, src, sf_flags);
<a name="l585"></a> </span><span class=cF1>if</span><span class=cF0> (src)
<a name="l586"></a> {
<a name="l587"></a> doc-&gt;cur_col = src - doc_e-&gt;tag;
<a name="l588"></a> doc-&gt;cur_entry = doc_e;
<a name="l589"></a> </span><span class=cF1>if</span><span class=cF0> (cmd != </span><span class=cF3>RSAC_ALL</span><span class=cF0>)
<a name="l590"></a> </span><span class=cF5>DocCenter</span><span class=cF0>(doc);
<a name="l591"></a> </span><span class=cF1>if</span><span class=cF0> (cmd != </span><span class=cF3>RSAC_ALL</span><span class=cF0>)
<a name="l592"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l593"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l594"></a> cmd = </span><span class=cF5>PopUpReplaceSkipAllCancel</span><span class=cF0>(</span><span class=cF6>&quot;&quot;</span><span class=cF0>);
<a name="l595"></a> </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l596"></a> </span><span class=cF1>if</span><span class=cF0> (cmd &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l597"></a> </span><span class=cF1>goto</span><span class=cF0> fr_unlock_done;
<a name="l598"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l599"></a> doc_e = doc-&gt;cur_entry;
<a name="l600"></a> src = doc-&gt;cur_col + doc_e-&gt;tag;
<a name="l601"></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>)
<a name="l602"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l603"></a> dlen = </span><span class=cF5>StrLen</span><span class=cF0>(doc_e-&gt;tag);
<a name="l604"></a> doc_e-&gt;max_col = dlen + rlen - plen;
<a name="l605"></a> dst = </span><span class=cF5>MAlloc</span><span class=cF0>(doc_e-&gt;max_col + </span><span class=cFE>1</span><span class=cF0>, doc-&gt;mem_task);
<a name="l606"></a> dst2 = dst;
<a name="l607"></a> j = src - doc_e-&gt;tag;
<a name="l608"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; j; i++)
<a name="l609"></a> *dst++ = doc_e-&gt;tag[i];
<a name="l610"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; rlen; i++)
<a name="l611"></a> *dst++ = doc-&gt;find_replace-&gt;replace_text[i];
<a name="l612"></a> src = dst;
<a name="l613"></a> </span><span class=cF1>for</span><span class=cF0> (i = j + plen; i &lt;= dlen; i++)
<a name="l614"></a> *dst++ = doc_e-&gt;tag[i];
<a name="l615"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_e-&gt;tag);
<a name="l616"></a> doc_e-&gt;tag = dst2;
<a name="l617"></a> doc-&gt;cur_col = src - doc_e-&gt;tag;
<a name="l618"></a> doc-&gt;cur_entry = doc_e;
<a name="l619"></a> </span><span class=cF1>if</span><span class=cF0> (cmd != </span><span class=cF3>RSAC_ALL</span><span class=cF0>)
<a name="l620"></a> {
<a name="l621"></a> </span><span class=cF5>DocRemSoftNewLines</span><span class=cF0>(doc, doc-&gt;cur_entry);
<a name="l622"></a> </span><span class=cF5>DocRecalc</span><span class=cF0>(doc);
<a name="l623"></a> }
<a name="l624"></a> doc_e = doc-&gt;cur_entry;
<a name="l625"></a> src = doc-&gt;cur_col + doc_e-&gt;tag;
<a name="l626"></a> res++;
<a name="l627"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l628"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l629"></a> src++;
<a name="l630"></a> }
<a name="l631"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l632"></a> }
<a name="l633"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;find_replace-&gt;scan_fwd)
<a name="l634"></a> doc_e = doc_e-&gt;next;
<a name="l635"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l636"></a> doc_e = doc_e-&gt;last;
<a name="l637"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l638"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != doc_marker);
<a name="l639"></a> }
<a name="l640"></a>fr_unlock_done:
<a name="l641"></a> </span><span class=cF1>if</span><span class=cF0> (doc_marker)
<a name="l642"></a> </span><span class=cF5>DocEntryDel</span><span class=cF0>(doc, doc_marker);
<a name="l643"></a> </span><span class=cF5>DocRemSoftNewLines</span><span class=cF0>(doc, </span><span class=cF3>NULL</span><span class=cF0>);
<a name="l644"></a> </span><span class=cF5>DocRecalc</span><span class=cF0>(doc);
<a name="l645"></a> </span><span class=cF5>DocCenter</span><span class=cF0>(doc);
<a name="l646"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l647"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l648"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l649"></a>
<a name="l650"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l651"></a>}
<a name="l652"></a>
<a name="l653"></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, </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="l654"></a>{</span><span class=cF2>//Find &amp; replace using editor's cmd.</span><span class=cF0>
<a name="l655"></a> </span><span class=cF9>CEdFindText</span><span class=cF0> old_find_replace;
<a name="l656"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock;
<a name="l657"></a> </span><span class=cF9>I64</span><span class=cF0> i, res = -</span><span class=cFE>1</span><span class=cF0>;
<a name="l658"></a>
<a name="l659"></a> </span><span class=cF1>if</span><span class=cF0> (!doc)
<a name="l660"></a> </span><span class=cF1>return</span><span class=cF0> -</span><span class=cFE>1</span><span class=cF0>;
<a name="l661"></a> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l662"></a> </span><span class=cF5>MemCopy</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="l663"></a> </span><span class=cF5>MemSet</span><span class=cF0>(doc-&gt;find_replace, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CEdFindText</span><span class=cF7>)</span><span class=cF0>);
<a name="l664"></a> i = </span><span class=cF5>StrLen</span><span class=cF0>(find);
<a name="l665"></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>)
<a name="l666"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l667"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(doc-&gt;find_replace-&gt;find_text, find, i + </span><span class=cFE>1</span><span class=cF0>);
<a name="l668"></a> i = </span><span class=cF5>StrLen</span><span class=cF0>(replace);
<a name="l669"></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="l670"></a> {
<a name="l671"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(doc-&gt;find_replace-&gt;replace_text, replace, i + </span><span class=cFE>1</span><span class=cF0>);
<a name="l672"></a> doc-&gt;find_replace-&gt;replace = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l673"></a> doc-&gt;find_replace-&gt;scan_sel_text = sel;
<a name="l674"></a> doc-&gt;find_replace-&gt;match_case = match_case;
<a name="l675"></a> doc-&gt;find_replace-&gt;whole_labels = whole_labels;
<a name="l676"></a> doc-&gt;find_replace-&gt;prompt = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l677"></a> res = </span><span class=cF5>EdFindReplace</span><span class=cF0>(doc);
<a name="l678"></a> }
<a name="l679"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l680"></a> </span><span class=cF5>MemCopy</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="l681"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l682"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l683"></a>
<a name="l684"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l685"></a>}
<a name="l686"></a>
<a name="l687"></a></span><span class=cF1>class</span><span class=cF0> </span><span class=cF9>CEdLineGoTo</span><span class=cF0>
<a name="l688"></a>{
<a name="l689"></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="l690"></a>};
<a name="l691"></a>
<a name="l692"></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="l693"></a>{</span><span class=cF2>//Prompt with form and go to line num.</span><span class=cF0>
<a name="l694"></a> </span><span class=cF9>CEdLineGoTo</span><span class=cF0> gtl;
<a name="l695"></a>
<a name="l696"></a> gtl.line = </span><span class=cFE>1</span><span class=cF0>;
<a name="l697"></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="l698"></a> </span><span class=cF5>DocGoToLine</span><span class=cF0>(doc, gtl.line);
<a name="l699"></a>}
</span></pre></body>
</html>