mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-29 16:56:30 +00:00
dbf8647d59
Added top & right borders to RawDr. Improved spacing in some debug and compiler reporting. Fixed RawPutChar and EdLite tab width. Fixed Ui missing '0x' prefix syntax highlighter bug. Added 32BitPaint demo.
372 lines
37 KiB
HTML
Executable file
372 lines
37 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V0.08">
|
|
<style type="text/css">
|
|
body {background-color:#000000;}
|
|
.cF0{color:#ffffff;background-color:#000000;}
|
|
.cF1{color:#3465a4;background-color:#000000;}
|
|
.cF2{color:#4e9a06;background-color:#000000;}
|
|
.cF3{color:#06989a;background-color:#000000;}
|
|
.cF4{color:#a24444;background-color:#000000;}
|
|
.cF5{color:#75507b;background-color:#000000;}
|
|
.cF6{color:#ce982f;background-color:#000000;}
|
|
.cF7{color:#bcc0b9;background-color:#000000;}
|
|
.cF8{color:#555753;background-color:#000000;}
|
|
.cF9{color:#729fcf;background-color:#000000;}
|
|
.cFA{color:#82bc49;background-color:#000000;}
|
|
.cFB{color:#34e2e2;background-color:#000000;}
|
|
.cFC{color:#ac3535;background-color:#000000;}
|
|
.cFD{color:#ad7fa8;background-color:#000000;}
|
|
.cFE{color:#fce94f;background-color:#000000;}
|
|
.cFF{color:#000000;background-color:#000000;}
|
|
</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>"Cmd Line (Typically)"</span><span class=cF0>
|
|
<a name="l2"></a>
|
|
<a name="l3"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>DS_USE_FILE1</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>
|
|
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>DS_USE_FILE2</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>
|
|
<a name="l5"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>DS_REMAINDER_1</span><span class=cF0> </span><span class=cFE>2</span><span class=cF0>
|
|
<a name="l6"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>DS_REMAINDER_2</span><span class=cF0> </span><span class=cFE>3</span><span class=cF0>
|
|
<a name="l7"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>DS_ABORT_FILE</span><span class=cF0> </span><span class=cFE>4</span><span class=cF0>
|
|
<a name="l8"></a>
|
|
<a name="l9"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>PopUpDiffMenu</span><span class=cF0>()
|
|
<a name="l10"></a>{
|
|
<a name="l11"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l12"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc = </span><span class=cF5>DocNew</span><span class=cF0>;
|
|
<a name="l13"></a>
|
|
<a name="l14"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>"$CM+LX,2,4$$FG$$BT,\"USE FILE1\",LE=DS_USE_FILE1$"</span><span class=cF0>
|
|
<a name="l15"></a> </span><span class=cF6>"$CM+LX,24,0$$CYAN$$BT,\"USE FILE2\",LE=DS_USE_FILE2$"</span><span class=cF0>
|
|
<a name="l16"></a> </span><span class=cF6>"$CM+LX,2,4$$FG$$BT,\"REMAINDER ALL FILE1\",LE=DS_REMAINDER_1$"</span><span class=cF0>
|
|
<a name="l17"></a> </span><span class=cF6>"$CM+LX,24,0$$CYAN$$BT,\"REMAINDER ALL FILE2\",LE=DS_REMAINDER_2$"</span><span class=cF0>
|
|
<a name="l18"></a> </span><span class=cF6>"$CM+LX,2,4$$FG$$BT,\"ABORT FILE\",LE=DS_ABORT_FILE$"</span><span class=cF0>
|
|
<a name="l19"></a> </span><span class=cF6>"$CM+LX,24,0$$FG$$BT,\"ABORT ALL FILES\",LE=DOCM_CANCEL$\n"</span><span class=cF0>);
|
|
<a name="l20"></a> i = </span><span class=cF5>PopUpMenu</span><span class=cF0>(doc);
|
|
<a name="l21"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
|
|
<a name="l22"></a>
|
|
<a name="l23"></a> </span><span class=cF1>return</span><span class=cF0> i;
|
|
<a name="l24"></a>}
|
|
<a name="l25"></a>
|
|
<a name="l26"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>DiffEntriesCompare</span><span class=cF0>(</span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e1, </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e2)
|
|
<a name="l27"></a>{
|
|
<a name="l28"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>StrCompare</span><span class=cF0>(doc_e1->tag, doc_e2->tag);
|
|
<a name="l29"></a>}
|
|
<a name="l30"></a>
|
|
<a name="l31"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>DF_MODIFIED</span><span class=cF0> </span><span class=cFE>0x01</span><span class=cF0>
|
|
<a name="l32"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>DF_DONT_MODIFIED</span><span class=cF0> </span><span class=cFE>0x02</span><span class=cF0>
|
|
<a name="l33"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>DF_REMAINDER_ALL_FILE1</span><span class=cF0> </span><span class=cFE>0x04</span><span class=cF0>
|
|
<a name="l34"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>DF_REMAINDER_ALL_FILE2</span><span class=cF0> </span><span class=cFE>0x08</span><span class=cF0>
|
|
<a name="l35"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>DF_ABORT_FILE</span><span class=cF0> </span><span class=cFE>0x10</span><span class=cF0>
|
|
<a name="l36"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>DF_ABORT_ALL_FILES</span><span class=cF0> </span><span class=cFE>0x20</span><span class=cF0>
|
|
<a name="l37"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>DF_NO_MORE_PROMPTS_THIS_FILE</span><span class=cF0> </span><span class=cFE>0x40</span><span class=cF0>
|
|
<a name="l38"></a>
|
|
<a name="l39"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DiffSel</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>I64</span><span class=cF0> *_df_flags, </span><span class=cF9>I64</span><span class=cF0> j1_lo, </span><span class=cF9>I64</span><span class=cF0> j1_hi, </span><span class=cF9>I64</span><span class=cF0> j2_lo, </span><span class=cF9>I64</span><span class=cF0> j2_hi, </span><span class=cF9>I64</span><span class=cF0> count1, </span><span class=cF9>I64</span><span class=cF0> count2,
|
|
<a name="l40"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> **doc_unsorted1, </span><span class=cF9>CDocEntry</span><span class=cF0> **doc_unsorted2)
|
|
<a name="l41"></a>{
|
|
<a name="l42"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e, *doc_e1, *doc_e2;
|
|
<a name="l43"></a> </span><span class=cF1>Bool</span><span class=cF0> use_file1;
|
|
<a name="l44"></a> </span><span class=cF9>I64</span><span class=cF0> i, old_flags;
|
|
<a name="l45"></a> </span><span class=cF9>CDoc</span><span class=cF0> *cur_l;
|
|
<a name="l46"></a>
|
|
<a name="l47"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>*_df_flags & (</span><span class=cF3>DF_ABORT_FILE</span><span class=cF0> | </span><span class=cF3>DF_ABORT_ALL_FILES</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l48"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l49"></a> </span><span class=cF6>"$RED$"</span><span class=cF0>;
|
|
<a name="l50"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> <= j1_lo < count1)
|
|
<a name="l51"></a> </span><span class=cF6>"%d,"</span><span class=cF0>, doc_unsorted1[j1_lo]->y + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l52"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> <= j1_hi - </span><span class=cFE>1</span><span class=cF0> < count1)
|
|
<a name="l53"></a> </span><span class=cF6>"%d,"</span><span class=cF0>, doc_unsorted1[j1_hi - </span><span class=cFE>1</span><span class=cF0>]->y + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l54"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l55"></a> </span><span class=cF6>"***,"</span><span class=cF0>;
|
|
<a name="l56"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> <= j2_lo < count2)
|
|
<a name="l57"></a> </span><span class=cF6>"%d"</span><span class=cF0>, doc_unsorted2[j2_lo]->y + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l58"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> <= j2_hi - </span><span class=cFE>1</span><span class=cF0> < count2)
|
|
<a name="l59"></a> </span><span class=cF6>"%d"</span><span class=cF0>, doc_unsorted2[j2_hi - </span><span class=cFE>1</span><span class=cF0>]->y + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l60"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l61"></a> </span><span class=cF6>"***"</span><span class=cF0>;
|
|
<a name="l62"></a> </span><span class=cF6>"---------------------$FG$\n"</span><span class=cF0>;
|
|
<a name="l63"></a> </span><span class=cF1>if</span><span class=cF0> (j1_lo <= </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l64"></a> i = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l65"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l66"></a> i = j1_lo - </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l67"></a> </span><span class=cF1>while</span><span class=cF0> (i < j1_hi)
|
|
<a name="l68"></a> {
|
|
<a name="l69"></a> </span><span class=cF1>if</span><span class=cF0> (cur_l = </span><span class=cF5>DocPut</span><span class=cF0>)
|
|
<a name="l70"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l71"></a> old_flags = cur_l->flags & </span><span class=cF3>DOCF_PLAIN_TEXT</span><span class=cF0>;
|
|
<a name="l72"></a> cur_l->flags |= </span><span class=cF3>DOCF_PLAIN_TEXT</span><span class=cF0>;
|
|
<a name="l73"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l74"></a> </span><span class=cF6>"%s"</span><span class=cF0>, doc_unsorted1[i++]->tag;
|
|
<a name="l75"></a> </span><span class=cF1>if</span><span class=cF0> (cur_l)
|
|
<a name="l76"></a> cur_l->flags = cur_l->flags & ~</span><span class=cF3>DOCF_PLAIN_TEXT</span><span class=cF0> | old_flags;
|
|
<a name="l77"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
|
<a name="l78"></a> }
|
|
<a name="l79"></a> </span><span class=cF6>"$CYAN$"</span><span class=cF0>;
|
|
<a name="l80"></a> </span><span class=cF1>if</span><span class=cF0> (j2_lo <= </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l81"></a> i = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l82"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l83"></a> i = j2_lo - </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l84"></a> </span><span class=cF1>while</span><span class=cF0> (i < j2_hi)
|
|
<a name="l85"></a> {
|
|
<a name="l86"></a> </span><span class=cF1>if</span><span class=cF0> (cur_l = </span><span class=cF5>DocPut</span><span class=cF0>)
|
|
<a name="l87"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l88"></a> old_flags = cur_l->flags & </span><span class=cF3>DOCF_PLAIN_TEXT</span><span class=cF0>;
|
|
<a name="l89"></a> cur_l->flags |= </span><span class=cF3>DOCF_PLAIN_TEXT</span><span class=cF0>;
|
|
<a name="l90"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l91"></a> </span><span class=cF6>"%s"</span><span class=cF0>, doc_unsorted2[i++]->tag;
|
|
<a name="l92"></a> </span><span class=cF1>if</span><span class=cF0> (cur_l)
|
|
<a name="l93"></a> cur_l->flags = cur_l->flags & ~</span><span class=cF3>DOCF_PLAIN_TEXT</span><span class=cF0> | old_flags;
|
|
<a name="l94"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
|
<a name="l95"></a> }
|
|
<a name="l96"></a> </span><span class=cF6>"$FG$"</span><span class=cF0>;
|
|
<a name="l97"></a>
|
|
<a name="l98"></a> use_file1 = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l99"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>*_df_flags & </span><span class=cF3>DF_NO_MORE_PROMPTS_THIS_FILE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l100"></a> {
|
|
<a name="l101"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cF5>PopUpDiffMenu</span><span class=cF0>)
|
|
<a name="l102"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l103"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DS_USE_FILE1</span><span class=cF0>:
|
|
<a name="l104"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l105"></a>
|
|
<a name="l106"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DS_USE_FILE2</span><span class=cF0>:
|
|
<a name="l107"></a> use_file1 = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l108"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l109"></a>
|
|
<a name="l110"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DS_REMAINDER_1</span><span class=cF0>:
|
|
<a name="l111"></a> *_df_flags = *_df_flags & ~</span><span class=cF3>DF_REMAINDER_ALL_FILE2</span><span class=cF0> | </span><span class=cF3>DF_REMAINDER_ALL_FILE1</span><span class=cF0> | </span><span class=cF3>DF_NO_MORE_PROMPTS_THIS_FILE</span><span class=cF0>;
|
|
<a name="l112"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l113"></a>
|
|
<a name="l114"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DS_REMAINDER_2</span><span class=cF0>:
|
|
<a name="l115"></a> *_df_flags = *_df_flags & ~</span><span class=cF3>DF_REMAINDER_ALL_FILE1</span><span class=cF0> | </span><span class=cF3>DF_REMAINDER_ALL_FILE2</span><span class=cF0> | </span><span class=cF3>DF_NO_MORE_PROMPTS_THIS_FILE</span><span class=cF0>;
|
|
<a name="l116"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l117"></a>
|
|
<a name="l118"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DS_ABORT_FILE</span><span class=cF0>:
|
|
<a name="l119"></a> *_df_flags |= </span><span class=cF3>DF_DONT_MODIFIED</span><span class=cF0> | </span><span class=cF3>DF_ABORT_FILE</span><span class=cF0> | </span><span class=cF3>DF_NO_MORE_PROMPTS_THIS_FILE</span><span class=cF0>;
|
|
<a name="l120"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l121"></a>
|
|
<a name="l122"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l123"></a> *_df_flags |= </span><span class=cF3>DF_DONT_MODIFIED</span><span class=cF0> | </span><span class=cF3>DF_ABORT_ALL_FILES</span><span class=cF0> | </span><span class=cF3>DF_NO_MORE_PROMPTS_THIS_FILE</span><span class=cF0>;
|
|
<a name="l124"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l125"></a> }
|
|
<a name="l126"></a> </span><span class=cF1>if</span><span class=cF0> (*_df_flags & </span><span class=cF3>DF_REMAINDER_ALL_FILE2</span><span class=cF0> && !</span><span class=cF7>(</span><span class=cF0>*_df_flags & (</span><span class=cF3>DF_DONT_MODIFIED</span><span class=cF0> | </span><span class=cF3>DF_REMAINDER_ALL_FILE1</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l127"></a> use_file1 = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l128"></a> </span><span class=cF1>if</span><span class=cF0> (!use_file1)
|
|
<a name="l129"></a> {
|
|
<a name="l130"></a> *_df_flags |= </span><span class=cF3>DF_MODIFIED</span><span class=cF0>;
|
|
<a name="l131"></a> doc_e1 = doc_unsorted1[j1_lo]->last;
|
|
<a name="l132"></a> </span><span class=cF1>if</span><span class=cF0> (j1_lo < j1_hi)
|
|
<a name="l133"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l134"></a> doc_e = doc_unsorted1[j1_lo];
|
|
<a name="l135"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != doc_unsorted1[j1_hi])
|
|
<a name="l136"></a> {
|
|
<a name="l137"></a> doc_e2 = doc_e->next;
|
|
<a name="l138"></a> </span><span class=cF5>DocEntryDel</span><span class=cF0>(doc, doc_e);
|
|
<a name="l139"></a> doc_e = doc_e2;
|
|
<a name="l140"></a> }
|
|
<a name="l141"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l142"></a> </span><span class=cF1>if</span><span class=cF0> (j2_lo < j2_hi)
|
|
<a name="l143"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l144"></a> doc_e = doc_unsorted2[j2_lo];
|
|
<a name="l145"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != doc_unsorted2[j2_hi])
|
|
<a name="l146"></a> {
|
|
<a name="l147"></a> doc_e2 = </span><span class=cF5>DocEntryCopy</span><span class=cF0>(doc, doc_e);
|
|
<a name="l148"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_e2, doc_e1);
|
|
<a name="l149"></a> doc_e1 = doc_e2;
|
|
<a name="l150"></a> doc_e = doc_e->next;
|
|
<a name="l151"></a> }
|
|
<a name="l152"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l153"></a> }
|
|
<a name="l154"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l155"></a>}
|
|
<a name="l156"></a>
|
|
<a name="l157"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DiffSub</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>I64</span><span class=cF0> *_df_flags, </span><span class=cF9>I64</span><span class=cF0> j1_lo, </span><span class=cF9>I64</span><span class=cF0> j1_hi, </span><span class=cF9>I64</span><span class=cF0> j2_lo, </span><span class=cF9>I64</span><span class=cF0> j2_hi, </span><span class=cF9>I64</span><span class=cF0> count1, </span><span class=cF9>I64</span><span class=cF0> count2,
|
|
<a name="l158"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> **doc_sorted1, </span><span class=cF9>CDocEntry</span><span class=cF0> **doc_sorted2, </span><span class=cF9>CDocEntry</span><span class=cF0> **doc_unsorted1, </span><span class=cF9>CDocEntry</span><span class=cF0> **doc_unsorted2)
|
|
<a name="l159"></a>{
|
|
<a name="l160"></a> </span><span class=cF9>I64</span><span class=cF0> i, i1 = </span><span class=cFE>0</span><span class=cF0>, i2 = </span><span class=cFE>0</span><span class=cF0>, i2b, j1, j2, n, best_j1, best_j2, best_score = </span><span class=cFE>0</span><span class=cF0>, score;
|
|
<a name="l161"></a> </span><span class=cF1>Bool</span><span class=cF0> res = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l162"></a>
|
|
<a name="l163"></a> </span><span class=cF1>if</span><span class=cF0> (j1_lo >= j1_hi || j2_lo >= j2_hi)
|
|
<a name="l164"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l165"></a> </span><span class=cF1>if</span><span class=cF0> (j1_lo < j1_hi || j2_lo < j2_hi)
|
|
<a name="l166"></a> {
|
|
<a name="l167"></a> </span><span class=cF5>DiffSel</span><span class=cF0>(doc, _df_flags, j1_lo, j1_hi, j2_lo, j2_hi, count1, count2, doc_unsorted1, doc_unsorted2);
|
|
<a name="l168"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l169"></a> }
|
|
<a name="l170"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l171"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l172"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l173"></a>
|
|
<a name="l174"></a> </span><span class=cF2>//Locate longest matching str in intervals</span><span class=cF0>
|
|
<a name="l175"></a> </span><span class=cF1>while</span><span class=cF0> (i1 < count1 && i2 < count2)
|
|
<a name="l176"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l177"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>j1_lo <= doc_sorted1[i1]->user_data < j1_hi</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF2>//user_data is the new y</span><span class=cF0>
|
|
<a name="l178"></a> i1++;
|
|
<a name="l179"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>j2_lo <= doc_sorted2[i2]->user_data < j2_hi</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF2>//user_data is new y</span><span class=cF0>
|
|
<a name="l180"></a> i2++;
|
|
<a name="l181"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l182"></a> {
|
|
<a name="l183"></a> i = </span><span class=cF5>StrCompare</span><span class=cF0>(doc_sorted1[i1]->tag, doc_sorted2[i2]->tag);
|
|
<a name="l184"></a> </span><span class=cF1>if</span><span class=cF0> (i > </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l185"></a> i2++;
|
|
<a name="l186"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (i < </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l187"></a> i1++;
|
|
<a name="l188"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l189"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l190"></a> i2b = i2;
|
|
<a name="l191"></a> </span><span class=cF1>while</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>doc_sorted1[i1]->tag, doc_sorted2[i2]->tag</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l192"></a> {
|
|
<a name="l193"></a> </span><span class=cF1>if</span><span class=cF0> (j2_lo <= doc_sorted2[i2]->user_data < j2_hi)
|
|
<a name="l194"></a> </span><span class=cF7>{</span><span class=cF2>//user_data is the new y</span><span class=cF0>
|
|
<a name="l195"></a> score = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l196"></a> j1 = doc_sorted1[i1]->user_data; </span><span class=cF2>//user_data is the new y</span><span class=cF0>
|
|
<a name="l197"></a> j2 = doc_sorted2[i2]->user_data; </span><span class=cF2>//user_data is the new y</span><span class=cF0>
|
|
<a name="l198"></a> n = j1_hi - j1;
|
|
<a name="l199"></a> </span><span class=cF1>if</span><span class=cF0> (j2_hi - j2 < n)
|
|
<a name="l200"></a> n = j2_hi - j2;
|
|
<a name="l201"></a> </span><span class=cF1>while</span><span class=cF0> (score < n)
|
|
<a name="l202"></a> {
|
|
<a name="l203"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>doc_unsorted1[j1 + score]->tag, doc_unsorted2[j2 + score]->tag</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l204"></a> score++;
|
|
<a name="l205"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l206"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l207"></a> }
|
|
<a name="l208"></a> </span><span class=cF1>if</span><span class=cF0> (score > best_score)
|
|
<a name="l209"></a> {
|
|
<a name="l210"></a> best_score = score;
|
|
<a name="l211"></a> best_j1 = j1;
|
|
<a name="l212"></a> best_j2 = j2;
|
|
<a name="l213"></a> }
|
|
<a name="l214"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l215"></a> i2++;
|
|
<a name="l216"></a> </span><span class=cF1>if</span><span class=cF0> (i2 >= count2)
|
|
<a name="l217"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l218"></a> }
|
|
<a name="l219"></a> i2 = i2b;
|
|
<a name="l220"></a> i1++;
|
|
<a name="l221"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l222"></a> }
|
|
<a name="l223"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l224"></a> </span><span class=cF1>if</span><span class=cF0> (!best_score)
|
|
<a name="l225"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l226"></a> </span><span class=cF5>DiffSel</span><span class=cF0>(doc, _df_flags, j1_lo, j1_hi, j2_lo, j2_hi, count1, count2, doc_unsorted1, doc_unsorted2);
|
|
<a name="l227"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l228"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l229"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l230"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l231"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DiffSub</span><span class=cF7>(</span><span class=cF0>doc, _df_flags, j1_lo, best_j1, j2_lo, best_j2, count1, count2,
|
|
<a name="l232"></a> doc_sorted1, doc_sorted2, doc_unsorted1, doc_unsorted2</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l233"></a> res = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l234"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DiffSub</span><span class=cF7>(</span><span class=cF0>doc, _df_flags, best_j1 + best_score, j1_hi, best_j2 + best_score, j2_hi, count1, count2,
|
|
<a name="l235"></a> doc_sorted1, doc_sorted2, doc_unsorted1, doc_unsorted2</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l236"></a> res = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l237"></a>
|
|
<a name="l238"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l239"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l240"></a>}
|
|
<a name="l241"></a>
|
|
<a name="l242"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DiffBins</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc1, </span><span class=cF9>CDoc</span><span class=cF0> *doc2)
|
|
<a name="l243"></a>{
|
|
<a name="l244"></a> </span><span class=cF9>CDocBin</span><span class=cF0> *tmpb1 = doc1->bin_head.next, *tmpb2 = doc2->bin_head.next;
|
|
<a name="l245"></a>
|
|
<a name="l246"></a> </span><span class=cF1>if</span><span class=cF0> (tmpb1->last->last->num != tmpb2->last->last->num)
|
|
<a name="l247"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l248"></a> </span><span class=cF1>while</span><span class=cF0> (tmpb1 != &doc1->bin_head)
|
|
<a name="l249"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l250"></a> </span><span class=cF1>if</span><span class=cF0> (tmpb1->size != tmpb2->size || </span><span class=cF5>MemCompare</span><span class=cF7>(</span><span class=cF0>tmpb1->data, tmpb2->data, tmpb1->size</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l251"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l252"></a> tmpb1 = tmpb1->next;
|
|
<a name="l253"></a> tmpb2 = tmpb2->next;
|
|
<a name="l254"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l255"></a>
|
|
<a name="l256"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l257"></a>}
|
|
<a name="l258"></a>
|
|
<a name="l259"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>Diff</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *dst_file, </span><span class=cF1>U8</span><span class=cF0> *src_file, </span><span class=cF9>I64</span><span class=cF0> *_df_flags=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
<a name="l260"></a>{</span><span class=cF2>//Report differences between two files and merge differences</span><span class=cF0>
|
|
<a name="l261"></a></span><span class=cF2>//from src_file to dst_file.</span><span class=cF0> </span><span class=cF2>Don't use _df_flags arg. (Used by </span><a href="https://tomawezome.github.io/ZealOS/System/Utils/Merge.CC.html#l44"><span class=cF4>Merge</span></a><span class=cF2>().)</span><span class=cF0>
|
|
<a name="l262"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc1 = </span><span class=cF5>DocRead</span><span class=cF0>(dst_file, </span><span class=cF3>DOCF_PLAIN_TEXT_TABS</span><span class=cF0> | </span><span class=cF3>DOCF_NO_CURSOR</span><span class=cF0>),
|
|
<a name="l263"></a> *doc2 = </span><span class=cF5>DocRead</span><span class=cF0>(src_file, </span><span class=cF3>DOCF_PLAIN_TEXT_TABS</span><span class=cF0> | </span><span class=cF3>DOCF_NO_CURSOR</span><span class=cF0>);
|
|
<a name="l264"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e, **doc_sorted1, **doc_sorted2, **doc_unsorted1, **doc_unsorted2;
|
|
<a name="l265"></a> </span><span class=cF9>I64</span><span class=cF0> i, count1 = </span><span class=cFE>0</span><span class=cF0>, count2 = </span><span class=cFE>0</span><span class=cF0>,df_flags;
|
|
<a name="l266"></a> </span><span class=cF1>Bool</span><span class=cF0> res = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l267"></a>
|
|
<a name="l268"></a> </span><span class=cF1>if</span><span class=cF0> (_df_flags)
|
|
<a name="l269"></a> df_flags = *_df_flags;
|
|
<a name="l270"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l271"></a> df_flags = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l272"></a> df_flags &= </span><span class=cF3>DF_ABORT_ALL_FILES</span><span class=cF0>;
|
|
<a name="l273"></a>
|
|
<a name="l274"></a> doc_e = doc1->head.next;
|
|
<a name="l275"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != doc1)
|
|
<a name="l276"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l277"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->type_u8 == </span><span class=cF3>DOCT_TEXT</span><span class=cF0>)
|
|
<a name="l278"></a> doc_e->user_data = count1++; </span><span class=cF2>//user_data is the new y</span><span class=cF0>
|
|
<a name="l279"></a> doc_e = doc_e->next;
|
|
<a name="l280"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l281"></a>
|
|
<a name="l282"></a> doc_e = doc2->head.next;
|
|
<a name="l283"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != doc2)
|
|
<a name="l284"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l285"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->type_u8 == </span><span class=cF3>DOCT_TEXT</span><span class=cF0>)
|
|
<a name="l286"></a> doc_e->user_data = count2++; </span><span class=cF2>//user_data is the new y</span><span class=cF0>
|
|
<a name="l287"></a> doc_e = doc_e->next;
|
|
<a name="l288"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l289"></a>
|
|
<a name="l290"></a> doc_sorted1 = </span><span class=cF5>MAlloc</span><span class=cF0>(count1 * </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDocEntry</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l291"></a> doc_unsorted1 = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>count1 + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> * </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDocEntry</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l292"></a> i = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l293"></a> doc_e = doc1->head.next;
|
|
<a name="l294"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != doc1)
|
|
<a name="l295"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l296"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->type_u8 == </span><span class=cF3>DOCT_TEXT</span><span class=cF0>)
|
|
<a name="l297"></a> {
|
|
<a name="l298"></a> doc_sorted1[i] = doc_e;
|
|
<a name="l299"></a> doc_unsorted1[i++] = doc_e;
|
|
<a name="l300"></a> }
|
|
<a name="l301"></a> doc_e = doc_e->next;
|
|
<a name="l302"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l303"></a> doc_unsorted1[i] = doc1;
|
|
<a name="l304"></a> </span><span class=cF5>QuickSortI64</span><span class=cF0>(doc_sorted1, count1, &</span><span class=cF5>DiffEntriesCompare</span><span class=cF0>);
|
|
<a name="l305"></a>
|
|
<a name="l306"></a> doc_sorted2 = </span><span class=cF5>MAlloc</span><span class=cF0>(count2 * </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDocEntry</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l307"></a> doc_unsorted2 = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>count2 + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> * </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDocEntry</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l308"></a> i = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l309"></a> doc_e = doc2->head.next;
|
|
<a name="l310"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != doc2)
|
|
<a name="l311"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l312"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->type_u8 == </span><span class=cF3>DOCT_TEXT</span><span class=cF0>)
|
|
<a name="l313"></a> {
|
|
<a name="l314"></a> doc_sorted2[i] = doc_e;
|
|
<a name="l315"></a> doc_unsorted2[i++] = doc_e;
|
|
<a name="l316"></a> }
|
|
<a name="l317"></a> doc_e = doc_e->next;
|
|
<a name="l318"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l319"></a> doc_unsorted2[i] = doc2;
|
|
<a name="l320"></a> </span><span class=cF5>QuickSortI64</span><span class=cF0>(doc_sorted2, count2, &</span><span class=cF5>DiffEntriesCompare</span><span class=cF0>);
|
|
<a name="l321"></a>
|
|
<a name="l322"></a> res = </span><span class=cF5>DiffSub</span><span class=cF0>(doc1, &df_flags, </span><span class=cFE>0</span><span class=cF0>, count1, </span><span class=cFE>0</span><span class=cF0>, count2, count1, count2,
|
|
<a name="l323"></a> doc_sorted1, doc_sorted2, doc_unsorted1, doc_unsorted2);
|
|
<a name="l324"></a> </span><span class=cF1>if</span><span class=cF0> (df_flags & </span><span class=cF3>DF_MODIFIED</span><span class=cF0> && !</span><span class=cF7>(</span><span class=cF0>df_flags & </span><span class=cF3>DF_DONT_MODIFIED</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l325"></a> </span><span class=cF5>DocWrite</span><span class=cF0>(doc1);
|
|
<a name="l326"></a>
|
|
<a name="l327"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DiffBins</span><span class=cF7>(</span><span class=cF0>doc1, doc2</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l328"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l329"></a> </span><span class=cF6>"$RED$Bin Data is Different$FG$\n"</span><span class=cF0>;
|
|
<a name="l330"></a> res = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l331"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l332"></a>
|
|
<a name="l333"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc1);
|
|
<a name="l334"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc2);
|
|
<a name="l335"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_sorted1);
|
|
<a name="l336"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_sorted2);
|
|
<a name="l337"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_unsorted1);
|
|
<a name="l338"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_unsorted2);
|
|
<a name="l339"></a> </span><span class=cF1>if</span><span class=cF0> (_df_flags)
|
|
<a name="l340"></a> *_df_flags = df_flags;
|
|
<a name="l341"></a>
|
|
<a name="l342"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l343"></a>}
|
|
</span></pre></body>
|
|
</html>
|