templeos-info/public/Wb/Kernel/EdLite.HC.HTML

387 lines
34 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=cF1>class</span><span class=cF0> CLine
<a name="l2"></a>{
<a name="l3"></a> CLine *next,*last;
<a name="l4"></a> </span><span class=cF1>U8</span><span class=cF0> *line;
<a name="l5"></a>};
<a name="l6"></a>
<a name="l7"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>EdLiteUpdate</span><span class=cF0>(CLine *head,CLine *cur_line,</span><span class=cF9>I64</span><span class=cF0> cur_col,</span><span class=cF9>I64</span><span class=cF0> line_start_col)
<a name="l8"></a>{
<a name="l9"></a> </span><span class=cF9>I64</span><span class=cF0> ch,i,j,k,k2,cursor_col,cursor_row=-1;
<a name="l10"></a> </span><span class=cF1>U8</span><span class=cF0> *st;
<a name="l11"></a> CLine *tmpl=cur_line;
<a name="l12"></a> </span><span class=cF1>Bool</span><span class=cF0> done_eof=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l13"></a> </span><span class=cFB>text</span><span class=cF0>.raw_col=0;
<a name="l14"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;</span><span class=cFB>text</span><span class=cF0>.rows/2;i++)
<a name="l15"></a> </span><span class=cF1>if</span><span class=cF0> (tmpl-&gt;last!=head)
<a name="l16"></a> tmpl=tmpl-&gt;last;
<a name="l17"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;</span><span class=cFB>text</span><span class=cF0>.rows;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l18"></a> </span><span class=cF1>if</span><span class=cF0> (cursor_row&lt;0 &amp;&amp; tmpl==cur_line) {
<a name="l19"></a> k=0;
<a name="l20"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j&lt;cur_col;j++)
<a name="l21"></a> </span><span class=cF1>if</span><span class=cF0> (tmpl-&gt;line[j]==</span><span class=cF6>'\t'</span><span class=cF0>)
<a name="l22"></a> k=(k+8)&amp;~7;
<a name="l23"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l24"></a> k++;
<a name="l25"></a> cursor_col=k;
<a name="l26"></a> cursor_row=i;
<a name="l27"></a> }
<a name="l28"></a> </span><span class=cF1>if</span><span class=cF0> (tmpl!=head) {
<a name="l29"></a> st=tmpl-&gt;line;
<a name="l30"></a> k=0;
<a name="l31"></a> j=0;
<a name="l32"></a> </span><span class=cF1>while</span><span class=cF0> (ch=*st++) </span><span class=cF7>{</span><span class=cF0>
<a name="l33"></a> </span><span class=cF1>if</span><span class=cF0> (ch==</span><span class=cF6>'\t'</span><span class=cF0>)
<a name="l34"></a> k2=(k+8)&amp;~7;
<a name="l35"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l36"></a> k2=k+1;
<a name="l37"></a> </span><span class=cF1>if</span><span class=cF0> (line_start_col&lt;=k&lt;line_start_col+</span><span class=cFB>text</span><span class=cF0>.cols) {
<a name="l38"></a> </span><span class=cF6>''</span><span class=cF0> ch;
<a name="l39"></a> j=k2-line_start_col;
<a name="l40"></a> }
<a name="l41"></a> k=k2;
<a name="l42"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l43"></a> </span><span class=cF1>if</span><span class=cF0> (j&lt;</span><span class=cFB>text</span><span class=cF0>.cols)
<a name="l44"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
<a name="l45"></a> tmpl=tmpl-&gt;next;
<a name="l46"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l47"></a> </span><span class=cF1>if</span><span class=cF0> (!done_eof) </span><span class=cF7>{</span><span class=cF0>
<a name="l48"></a> </span><span class=cF6>'&lt;EOF&gt;'</span><span class=cF0>;
<a name="l49"></a> done_eof=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l50"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l51"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
<a name="l52"></a> }
<a name="l53"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l54"></a> </span><span class=cFB>text</span><span class=cF0>.raw_col=</span><span class=cFB>text</span><span class=cF0>.cols*cursor_row+cursor_col-line_start_col;
<a name="l55"></a> </span><span class=cF5>RawPutChar</span><span class=cF0>(0x7F);
<a name="l56"></a>}
<a name="l57"></a>
<a name="l58"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>EdLite</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *filename,</span><span class=cF9>I64</span><span class=cF0> num=1,</span><span class=cF9>I64</span><span class=cF0> edf_dof_flags=0)
<a name="l59"></a>{</span><span class=cF2>//Light weight text editor for debugging.</span><span class=cF0>
<a name="l60"></a> </span><span class=cF1>U8</span><span class=cF0> *src,*src2,*src3,*dst,*buf,*bin_data=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l61"></a> </span><span class=cF9>I64</span><span class=cF0> i,cnt=0,ch,sc,size,bin_size=0,line_start_col=0,cur_col=0,
<a name="l62"></a> old_raw_flags=</span><span class=cFB>text</span><span class=cF0>.raw_flags;
<a name="l63"></a> CLine head,*tmpl,*tmpl1,*cur_line;
<a name="l64"></a> </span><span class=cF1>Bool</span><span class=cF0> res=</span><span class=cF3>FALSE</span><span class=cF0>,
<a name="l65"></a> old_raw=</span><span class=cF5>Raw</span><span class=cF0>(</span><span class=cF3>ON</span><span class=cF0>),
<a name="l66"></a> old_debug=</span><span class=cF5>DbgMode</span><span class=cF0>(</span><span class=cF3>ON</span><span class=cF0>),
<a name="l67"></a> old_single=</span><span class=cF5>SingleUser</span><span class=cF0>(</span><span class=cF3>ON</span><span class=cF0>);
<a name="l68"></a>
<a name="l69"></a> </span><span class=cF1>if</span><span class=cF0> (!filename) filename=</span><span class=cFB>blkdev</span><span class=cF0>.tmp_filename;
<a name="l70"></a> buf=</span><span class=cF5>FileRead</span><span class=cF0>(filename,&amp;size);
<a name="l71"></a>
<a name="l72"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
<a name="l73"></a> </span><span class=cF1>CLI</span><span class=cF0>
<a name="l74"></a> </span><span class=cFB>text</span><span class=cF0>.raw_flags=</span><span class=cFB>text</span><span class=cF0>.raw_flags&amp;~</span><span class=cF3>RWF_SCROLL</span><span class=cF0>|</span><span class=cF3>RWF_SHOW_DOLLAR</span><span class=cF0>;
<a name="l75"></a> </span><span class=cFB>kbd</span><span class=cF0>.scan_code=0;
<a name="l76"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&amp;head);
<a name="l77"></a> head.line=</span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF6>&quot;&quot;</span><span class=cF0>);
<a name="l78"></a>
<a name="l79"></a> </span><span class=cF1>if</span><span class=cF0> (buf) </span><span class=cF7>{</span><span class=cF0>
<a name="l80"></a> src=buf;
<a name="l81"></a> </span><span class=cF1>while</span><span class=cF0> (*src) {
<a name="l82"></a> src2=src;
<a name="l83"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>ch=*src++</span><span class=cF7>)</span><span class=cF0> &amp;&amp; ch!=</span><span class=cF6>'\r'</span><span class=cF0> &amp;&amp; ch!=</span><span class=cF6>'\n'</span><span class=cF0>);
<a name="l84"></a> src--;
<a name="l85"></a> *src++=0;
<a name="l86"></a> </span><span class=cF1>if</span><span class=cF0> (!ch)
<a name="l87"></a> src--;
<a name="l88"></a> </span><span class=cF1>while</span><span class=cF0> (ch==</span><span class=cF6>'\r'</span><span class=cF0> &amp;&amp; *src==</span><span class=cF6>'\n'</span><span class=cF0> || *src==</span><span class=cF3>CH_CURSOR</span><span class=cF0>)
<a name="l89"></a> src++;
<a name="l90"></a> dst=src3=src2;
<a name="l91"></a> </span><span class=cF1>while</span><span class=cF0> (ch=*src3++)
<a name="l92"></a> </span><span class=cF1>if</span><span class=cF0> (ch!=</span><span class=cF6>'\n'</span><span class=cF0> &amp;&amp; ch!=</span><span class=cF3>CH_CURSOR</span><span class=cF0>)
<a name="l93"></a> *dst++=ch;
<a name="l94"></a> *dst=0;
<a name="l95"></a>
<a name="l96"></a> tmpl=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CLine</span><span class=cF7>)</span><span class=cF0>);
<a name="l97"></a> tmpl-&gt;line=</span><span class=cF5>StrNew</span><span class=cF0>(src2);
<a name="l98"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpl,head.last);
<a name="l99"></a> cnt++;
<a name="l100"></a> }
<a name="l101"></a>
<a name="l102"></a> </span><span class=cF1>if</span><span class=cF0> (src+1-buf&lt;size) {
<a name="l103"></a> bin_data=</span><span class=cF5>MAlloc</span><span class=cF0>(bin_size=size-</span><span class=cF7>(</span><span class=cF0>src-buf</span><span class=cF7>)</span><span class=cF0>);
<a name="l104"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(bin_data,src,bin_size);
<a name="l105"></a> }
<a name="l106"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l107"></a> res=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l108"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l109"></a>
<a name="l110"></a> cur_line=head.next;
<a name="l111"></a> </span><span class=cF1>if</span><span class=cF0> (--num&lt;0)
<a name="l112"></a> res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l113"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l114"></a> </span><span class=cF1>if</span><span class=cF0> (num&lt;=cnt)
<a name="l115"></a> </span><span class=cF1>while</span><span class=cF0> (num--)
<a name="l116"></a> cur_line=cur_line-&gt;next;
<a name="l117"></a> </span><span class=cF1>else</span><span class=cF0> {
<a name="l118"></a> cur_line=&amp;head;
<a name="l119"></a> res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l120"></a> }
<a name="l121"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l122"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l123"></a> </span><span class=cF1>if</span><span class=cF0> (cur_line==&amp;head)
<a name="l124"></a> cur_col=0;
<a name="l125"></a> </span><span class=cF1>while</span><span class=cF0> (cur_col-line_start_col&lt;0)
<a name="l126"></a> line_start_col-=8;
<a name="l127"></a> </span><span class=cF1>while</span><span class=cF0> (cur_col-line_start_col&gt;=</span><span class=cFB>text</span><span class=cF0>.cols)
<a name="l128"></a> line_start_col+=8;
<a name="l129"></a> </span><span class=cFD>EdLiteUpdate</span><span class=cF0>(&amp;head,cur_line,cur_col,line_start_col);
<a name="l130"></a> </span><span class=cF1>switch</span><span class=cF0> (ch=</span><span class=cF5>GetKey</span><span class=cF7>(</span><span class=cF0>&amp;sc,</span><span class=cF3>FALSE</span><span class=cF0>,</span><span class=cF3>TRUE</span><span class=cF7>)</span><span class=cF0>) {
<a name="l131"></a> </span><span class=cF1>case</span><span class=cF0> 0:
<a name="l132"></a> </span><span class=cF1>switch</span><span class=cF0> (sc.u8[0]) </span><span class=cF7>{</span><span class=cF0>
<a name="l133"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_UP</span><span class=cF0>:
<a name="l134"></a> </span><span class=cF1>if</span><span class=cF0> (cur_line-&gt;last!=&amp;head)
<a name="l135"></a> cur_line=cur_line-&gt;last;
<a name="l136"></a> </span><span class=cF1>if</span><span class=cF0> (cur_col&gt;</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>cur_line-&gt;line</span><span class=cF7>)</span><span class=cF0>)
<a name="l137"></a> cur_col=</span><span class=cF5>StrLen</span><span class=cF0>(cur_line-&gt;line);
<a name="l138"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l139"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_DOWN</span><span class=cF0>:
<a name="l140"></a> </span><span class=cF1>if</span><span class=cF0> (cur_line!=&amp;head)
<a name="l141"></a> cur_line=cur_line-&gt;next;
<a name="l142"></a> </span><span class=cF1>if</span><span class=cF0> (cur_col&gt;</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>cur_line-&gt;line</span><span class=cF7>)</span><span class=cF0>)
<a name="l143"></a> cur_col=</span><span class=cF5>StrLen</span><span class=cF0>(cur_line-&gt;line);
<a name="l144"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l145"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>:
<a name="l146"></a> cur_col++;
<a name="l147"></a> </span><span class=cF1>if</span><span class=cF0> (cur_col&gt;</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>cur_line-&gt;line</span><span class=cF7>)</span><span class=cF0>) {
<a name="l148"></a> tmpl=cur_line-&gt;next;
<a name="l149"></a> </span><span class=cF1>if</span><span class=cF0> (tmpl!=&amp;head) </span><span class=cF7>{</span><span class=cF0>
<a name="l150"></a> cur_col=0;
<a name="l151"></a> cur_line=tmpl;
<a name="l152"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l153"></a> cur_col=</span><span class=cF5>StrLen</span><span class=cF0>(cur_line-&gt;line);
<a name="l154"></a> }
<a name="l155"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l156"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>:
<a name="l157"></a> </span><span class=cF1>if</span><span class=cF0> (cur_col)
<a name="l158"></a> cur_col--;
<a name="l159"></a> </span><span class=cF1>else</span><span class=cF0> {
<a name="l160"></a> tmpl=cur_line-&gt;last;
<a name="l161"></a> </span><span class=cF1>if</span><span class=cF0> (tmpl!=&amp;head) </span><span class=cF7>{</span><span class=cF0>
<a name="l162"></a> cur_line=tmpl;
<a name="l163"></a> cur_col=</span><span class=cF5>StrLen</span><span class=cF0>(tmpl-&gt;line);
<a name="l164"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l165"></a> }
<a name="l166"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l167"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_PAGE_UP</span><span class=cF0>:
<a name="l168"></a> </span><span class=cF1>for</span><span class=cF0> (i=1;i&lt;</span><span class=cFB>text</span><span class=cF0>.rows;i++) {
<a name="l169"></a> </span><span class=cF1>if</span><span class=cF0> (cur_line-&gt;last!=&amp;head)
<a name="l170"></a> cur_line=cur_line-&gt;last;
<a name="l171"></a> </span><span class=cF1>if</span><span class=cF0> (cur_col&gt;</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>cur_line-&gt;line</span><span class=cF7>)</span><span class=cF0>)
<a name="l172"></a> cur_col=</span><span class=cF5>StrLen</span><span class=cF0>(cur_line-&gt;line);
<a name="l173"></a> }
<a name="l174"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l175"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_PAGE_DOWN</span><span class=cF0>:
<a name="l176"></a> </span><span class=cF1>for</span><span class=cF0> (i=1;i&lt;</span><span class=cFB>text</span><span class=cF0>.rows;i++) {
<a name="l177"></a> </span><span class=cF1>if</span><span class=cF0> (cur_line!=&amp;head)
<a name="l178"></a> cur_line=cur_line-&gt;next;
<a name="l179"></a> </span><span class=cF1>if</span><span class=cF0> (cur_col&gt;</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>cur_line-&gt;line</span><span class=cF7>)</span><span class=cF0>)
<a name="l180"></a> cur_col=</span><span class=cF5>StrLen</span><span class=cF0>(cur_line-&gt;line);
<a name="l181"></a> }
<a name="l182"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l183"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_DELETE</span><span class=cF0>:
<a name="l184"></a> </span><span class=cF1>if</span><span class=cF0> (cur_col==</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>cur_line-&gt;line</span><span class=cF7>)</span><span class=cF0>) {
<a name="l185"></a> tmpl=cur_line-&gt;next;
<a name="l186"></a> </span><span class=cF1>if</span><span class=cF0> (cur_line!=&amp;head &amp;&amp; tmpl!=&amp;head) </span><span class=cF7>{</span><span class=cF0>
<a name="l187"></a> src=</span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;%s%s&quot;</span><span class=cF0>,cur_line-&gt;line,tmpl-&gt;line);
<a name="l188"></a> </span><span class=cF5>Free</span><span class=cF0>(cur_line-&gt;line);
<a name="l189"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpl-&gt;line);
<a name="l190"></a> cur_line-&gt;line=src;
<a name="l191"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpl);
<a name="l192"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpl);
<a name="l193"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l194"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l195"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(cur_line-&gt;line+cur_col,cur_line-&gt;line+cur_col+1);
<a name="l196"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l197"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l198"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l199"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
<a name="l200"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\r'</span><span class=cF0>:
<a name="l201"></a> tmpl=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CLine</span><span class=cF7>)</span><span class=cF0>);
<a name="l202"></a> tmpl-&gt;line=</span><span class=cF5>StrNew</span><span class=cF0>(cur_line-&gt;line+cur_col);
<a name="l203"></a> cur_line-&gt;line[cur_col]=0;
<a name="l204"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpl,cur_line);
<a name="l205"></a> cur_line=tmpl;
<a name="l206"></a> cur_col=0;
<a name="l207"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l208"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_BACKSPACE</span><span class=cF0>:
<a name="l209"></a> </span><span class=cF1>if</span><span class=cF0> (cur_col) </span><span class=cF7>{</span><span class=cF0>
<a name="l210"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(cur_line-&gt;line+cur_col-1,cur_line-&gt;line+cur_col);
<a name="l211"></a> cur_col--;
<a name="l212"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cur_line!=&amp;head &amp;&amp; cur_line-&gt;last!=&amp;head) </span><span class=cF7>{</span><span class=cF0>
<a name="l213"></a> tmpl=cur_line-&gt;last;
<a name="l214"></a> src=</span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;%s%s&quot;</span><span class=cF0>,tmpl-&gt;line,cur_line-&gt;line);
<a name="l215"></a> cur_col=</span><span class=cF5>StrLen</span><span class=cF0>(tmpl-&gt;line);
<a name="l216"></a> </span><span class=cF5>Free</span><span class=cF0>(cur_line-&gt;line);
<a name="l217"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpl-&gt;line);
<a name="l218"></a> tmpl-&gt;line=src;
<a name="l219"></a> </span><span class=cF5>QueRem</span><span class=cF0>(cur_line);
<a name="l220"></a> </span><span class=cF5>Free</span><span class=cF0>(cur_line);
<a name="l221"></a> cur_line=tmpl;
<a name="l222"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l223"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l224"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLY</span><span class=cF0>:
<a name="l225"></a> </span><span class=cF1>if</span><span class=cF0> (cur_line!=&amp;head) </span><span class=cF7>{</span><span class=cF0>
<a name="l226"></a> tmpl=cur_line;
<a name="l227"></a> cur_line=cur_line-&gt;next;
<a name="l228"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpl);
<a name="l229"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpl-&gt;line);
<a name="l230"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpl);
<a name="l231"></a> cur_col=0;
<a name="l232"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l233"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l234"></a> </span><span class=cF1>default</span><span class=cF0>:
<a name="l235"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>char_bmp_printable</span><span class=cF0>,ch</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l236"></a> </span><span class=cF1>if</span><span class=cF0> (cur_line==&amp;head) {
<a name="l237"></a> cur_line=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CLine</span><span class=cF7>)</span><span class=cF0>);
<a name="l238"></a> cur_line-&gt;line=</span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF6>&quot;&quot;</span><span class=cF0>);
<a name="l239"></a> </span><span class=cF5>QueIns</span><span class=cF0>(cur_line,head.last);
<a name="l240"></a> }
<a name="l241"></a> src=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>cur_line-&gt;line</span><span class=cF7>)</span><span class=cF0>+2);
<a name="l242"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(src,cur_line-&gt;line,cur_col);
<a name="l243"></a> src[cur_col]=ch;
<a name="l244"></a> </span><span class=cF1>if</span><span class=cF0> (cur_col&lt;</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>cur_line-&gt;line</span><span class=cF7>)</span><span class=cF0>)
<a name="l245"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(src+cur_col+1,cur_line-&gt;line+cur_col);
<a name="l246"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l247"></a> src[cur_col+1]=0;
<a name="l248"></a> </span><span class=cF5>Free</span><span class=cF0>(cur_line-&gt;line);
<a name="l249"></a> cur_line-&gt;line=src;
<a name="l250"></a> cur_col++;
<a name="l251"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l252"></a> }
<a name="l253"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (ch!=</span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0> &amp;&amp; ch!=</span><span class=cF3>CH_ESC</span><span class=cF0>);
<a name="l254"></a>
<a name="l255"></a> </span><span class=cF1>if</span><span class=cF0> (ch!=</span><span class=cF3>CH_ESC</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l256"></a> </span><span class=cF1>if</span><span class=cF0> (edf_dof_flags&amp;</span><span class=cF3>EDF_WAS_WRITE</span><span class=cF0>)
<a name="l257"></a> res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l258"></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="l259"></a> size=bin_size;
<a name="l260"></a>
<a name="l261"></a> tmpl=head.next;
<a name="l262"></a> </span><span class=cF1>while</span><span class=cF0> (tmpl!=&amp;head) {
<a name="l263"></a> size+=</span><span class=cF5>StrLen</span><span class=cF0>(tmpl-&gt;line)+1;
<a name="l264"></a> tmpl=tmpl-&gt;next;
<a name="l265"></a> }
<a name="l266"></a>
<a name="l267"></a> buf=dst=</span><span class=cF5>MAlloc</span><span class=cF0>(size);
<a name="l268"></a> tmpl=head.next;
<a name="l269"></a> </span><span class=cF1>while</span><span class=cF0> (tmpl!=&amp;head) {
<a name="l270"></a> i=</span><span class=cF5>StrLen</span><span class=cF0>(tmpl-&gt;line);
<a name="l271"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(dst,tmpl-&gt;line,i);
<a name="l272"></a> dst+=i;
<a name="l273"></a> *dst++=</span><span class=cF6>'\n'</span><span class=cF0>;
<a name="l274"></a> tmpl=tmpl-&gt;next;
<a name="l275"></a> }
<a name="l276"></a> </span><span class=cF1>if</span><span class=cF0> (bin_data)
<a name="l277"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(dst,bin_data,bin_size);
<a name="l278"></a> </span><span class=cF5>FileWrite</span><span class=cF0>(filename,buf,size);
<a name="l279"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l280"></a>
<a name="l281"></a> </span><span class=cF1>if</span><span class=cF0> (edf_dof_flags&amp;</span><span class=cF3>EDF_WAS_WRITE</span><span class=cF0>)
<a name="l282"></a> res=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l283"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l284"></a>
<a name="l285"></a> tmpl=head.next;
<a name="l286"></a> </span><span class=cF1>while</span><span class=cF0> (tmpl!=&amp;head) </span><span class=cF7>{</span><span class=cF0>
<a name="l287"></a> tmpl1=tmpl-&gt;next;
<a name="l288"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpl);
<a name="l289"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpl-&gt;line);
<a name="l290"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpl);
<a name="l291"></a> tmpl=tmpl1;
<a name="l292"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l293"></a> </span><span class=cF5>Free</span><span class=cF0>(head.line);
<a name="l294"></a> </span><span class=cF5>Free</span><span class=cF0>(bin_data);
<a name="l295"></a> </span><span class=cF5>Raw</span><span class=cF0>(old_raw);
<a name="l296"></a> </span><span class=cF5>DbgMode</span><span class=cF0>(old_debug);
<a name="l297"></a> </span><span class=cF5>SingleUser</span><span class=cF0>(old_single);
<a name="l298"></a> </span><span class=cFB>text</span><span class=cF0>.raw_flags=</span><span class=cFB>text</span><span class=cF0>.raw_flags&amp;~</span><span class=cF3>RWF_SHOW_DOLLAR</span><span class=cF0>|old_raw_flags&amp;</span><span class=cF3>RWF_SHOW_DOLLAR</span><span class=cF0>;
<a name="l299"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l300"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l301"></a>}
<a name="l302"></a>
<a name="l303"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>ToFileLine</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *_fl_file_line,</span><span class=cF1>U8</span><span class=cF0> **_filename,</span><span class=cF9>I64</span><span class=cF0> *_linenum)
<a name="l304"></a>{</span><span class=cF2>//&quot;FI:D:/Dir/File.HC,123&quot; to &quot;D:/Dir/File.HC&quot; and 123.</span><span class=cF0>
<a name="l305"></a> </span><span class=cF1>U8</span><span class=cF0> *st,*fl_file_line=</span><span class=cF5>StrNew</span><span class=cF0>(_fl_file_line);
<a name="l306"></a> </span><span class=cF9>I64</span><span class=cF0> linenum;
<a name="l307"></a> </span><span class=cF5>StrFirstRem</span><span class=cF0>(fl_file_line,</span><span class=cF6>&quot;:&quot;</span><span class=cF0>);
<a name="l308"></a> st=</span><span class=cF5>StrNew</span><span class=cF0>(fl_file_line);
<a name="l309"></a> </span><span class=cF5>StrLastRem</span><span class=cF0>(fl_file_line,</span><span class=cF6>&quot;,&quot;</span><span class=cF0>,st);
<a name="l310"></a> linenum=</span><span class=cF5>Str2I64</span><span class=cF0>(st);
<a name="l311"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l312"></a> *_filename=fl_file_line;
<a name="l313"></a> *_linenum=linenum;
<a name="l314"></a>}
<a name="l315"></a>
<a name="l316"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>EdLiteFileLine</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *fl_file_line,</span><span class=cF9>I64</span><span class=cF0> edf_dof_flags=0)
<a name="l317"></a>{
<a name="l318"></a> </span><span class=cF1>Bool</span><span class=cF0> res;
<a name="l319"></a> </span><span class=cF1>U8</span><span class=cF0> *filename;
<a name="l320"></a> </span><span class=cF9>I64</span><span class=cF0> linenum;
<a name="l321"></a> </span><span class=cF5>ToFileLine</span><span class=cF0>(fl_file_line,&amp;filename,&amp;linenum);
<a name="l322"></a> res=</span><span class=cF5>EdLite</span><span class=cF0>(filename,linenum,edf_dof_flags);
<a name="l323"></a> </span><span class=cF5>Free</span><span class=cF0>(filename);
<a name="l324"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l325"></a>}
<a name="l326"></a>
<a name="l327"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>FixSet</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *filename,</span><span class=cF9>I64</span><span class=cF0> line)
<a name="l328"></a>{</span><span class=cF2>//Compiler calls this to set file line for Fix</span><span class=cF0>
<a name="l329"></a> </span><span class=cF1>U8</span><span class=cF0> *st=</span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;FL:%s,%d&quot;</span><span class=cF0>,filename,line);
<a name="l330"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>sys_semas</span><span class=cF0>[</span><span class=cF3>SEMA_FIX</span><span class=cF0>],0</span><span class=cF7>)</span><span class=cF0>)
<a name="l331"></a> </span><span class=cF5>Yield</span><span class=cF0>;
<a name="l332"></a> </span><span class=cF5>Free</span><span class=cF0>(</span><span class=cFB>dbg</span><span class=cF0>.fix_file_line);
<a name="l333"></a> </span><span class=cFB>dbg</span><span class=cF0>.fix_file_line=</span><span class=cF5>AStrNew</span><span class=cF0>(st);
<a name="l334"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&amp;</span><span class=cFB>sys_semas</span><span class=cF0>[</span><span class=cF3>SEMA_FIX</span><span class=cF0>],0);
<a name="l335"></a>}
<a name="l336"></a>
<a name="l337"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>Fix</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> edf_dof_flags=0)
<a name="l338"></a>{</span><span class=cF2>//Jump to last err src code to fix it.</span><span class=cF0>
<a name="l339"></a> </span><span class=cF1>U8</span><span class=cF0> *st;
<a name="l340"></a> </span><span class=cF1>Bool</span><span class=cF0> res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l341"></a>
<a name="l342"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>sys_semas</span><span class=cF0>[</span><span class=cF3>SEMA_FIX</span><span class=cF0>],0</span><span class=cF7>)</span><span class=cF0>)
<a name="l343"></a> </span><span class=cF5>Yield</span><span class=cF0>;
<a name="l344"></a> st=</span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cFB>dbg</span><span class=cF0>.fix_file_line);
<a name="l345"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&amp;</span><span class=cFB>sys_semas</span><span class=cF0>[</span><span class=cF3>SEMA_FIX</span><span class=cF0>],0);
<a name="l346"></a>
<a name="l347"></a> </span><span class=cF1>if</span><span class=cF0> (st) </span><span class=cF7>{</span><span class=cF0>
<a name="l348"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>IsRaw</span><span class=cF0>)
<a name="l349"></a> res=</span><span class=cF5>EdLiteFileLine</span><span class=cF0>(st,edf_dof_flags);
<a name="l350"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l351"></a> res=</span><span class=cF5>Ed</span><span class=cF0>(st,edf_dof_flags);
<a name="l352"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l353"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l354"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l355"></a>}
</span></pre></body>
</html>