mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-30 17:26:31 +00:00
453 lines
44 KiB
HolyC
Executable file
453 lines
44 KiB
HolyC
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V0.05">
|
|
<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>"DolDoc"</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>DocLock</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc)
|
|
<a name="l4"></a>{</span><span class=cF2>//Make this task have exclusive access to this doc.</span><span class=cF0>
|
|
<a name="l5"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&doc->locked_flags, </span><span class=cF3>DOClf_LOCKED</span><span class=cF7>)</span><span class=cF0> || doc->owning_task != </span><span class=cF5>Fs</span><span class=cF0>)
|
|
<a name="l6"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l7"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&doc->locked_flags, </span><span class=cF3>DOClf_LOCKED</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l8"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
|
<a name="l9"></a> </span><span class=cF1>if</span><span class=cF0> (doc->owning_task != </span><span class=cF5>Fs</span><span class=cF0>)
|
|
<a name="l10"></a> </span><span class=cF5>LBEqual</span><span class=cF0>(&doc->flags, </span><span class=cF3>DOCf_BREAK_UNLOCKED</span><span class=cF0>, </span><span class=cF5>BreakLock</span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l11"></a> doc->owning_task = </span><span class=cF5>Fs</span><span class=cF0>;
|
|
<a name="l12"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l13"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l14"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l15"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l16"></a>}
|
|
<a name="l17"></a>
|
|
<a name="l18"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DocUnlock</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc)
|
|
<a name="l19"></a>{</span><span class=cF2>//Release exclusive lock on access to doc.</span><span class=cF0>
|
|
<a name="l20"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock_break;
|
|
<a name="l21"></a>
|
|
<a name="l22"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&doc->locked_flags, </span><span class=cF3>DOClf_LOCKED</span><span class=cF7>)</span><span class=cF0> && doc->owning_task == </span><span class=cF5>Fs</span><span class=cF0>)
|
|
<a name="l23"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l24"></a> doc->owning_task = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l25"></a> unlock_break = </span><span class=cF5>Bt</span><span class=cF0>(&doc->flags, </span><span class=cF3>DOCf_BREAK_UNLOCKED</span><span class=cF0>);
|
|
<a name="l26"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&doc->locked_flags, </span><span class=cF3>DOClf_LOCKED</span><span class=cF0>);
|
|
<a name="l27"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_break)
|
|
<a name="l28"></a> </span><span class=cF5>BreakUnlock</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>);
|
|
<a name="l29"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l30"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l31"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l32"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l33"></a>}
|
|
<a name="l34"></a>
|
|
<a name="l35"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>IsEditableText</span><span class=cF0>(</span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e)
|
|
<a name="l36"></a>{
|
|
<a name="l37"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->type_u8 == </span><span class=cF3>DOCT_TEXT</span><span class=cF0> && !</span><span class=cF7>(</span><span class=cF0>doc_e->de_flags & </span><span class=cF3>DOCEG_DONT_EDIT</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l38"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l39"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l40"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l41"></a>}
|
|
<a name="l42"></a>
|
|
<a name="l43"></a></span><span class=cF9>CDocEntry</span><span class=cF0> *</span><span class=cF5>DocEntryNewBase</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>I64</span><span class=cF0> type, </span><span class=cF9>I64</span><span class=cF0> de_flags=</span><span class=cFE>0</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> x=</span><span class=cFE>0</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> y=</span><span class=cFE>0</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> page_line_num=</span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l44"></a>{</span><span class=cF2>//See also </span><a href="https://tomawezome.github.io/ZealOS/System/DolDoc/DocRecalc.html#l161"><span class=cF4>MAllocIdent</span></a><span class=cF2> and </span><span class=cF9><u>CDocEntry</u></span><span class=cF2>.</span><span class=cF0>
|
|
<a name="l45"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *res = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDocEntryBase</span><span class=cF7>)</span><span class=cF0>, doc->mem_task);
|
|
<a name="l46"></a>
|
|
<a name="l47"></a> res->type = type;
|
|
<a name="l48"></a> res->de_flags = de_flags | </span><span class=cFB>doldoc</span><span class=cF0>.default_de_flags[type.u8[</span><span class=cFE>0</span><span class=cF0>]];
|
|
<a name="l49"></a> res->x = x;
|
|
<a name="l50"></a> res->y = y;
|
|
<a name="l51"></a> res->page_line_num = page_line_num;
|
|
<a name="l52"></a>
|
|
<a name="l53"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l54"></a>}
|
|
<a name="l55"></a>
|
|
<a name="l56"></a></span><span class=cF9>CDocEntry</span><span class=cF0> *</span><span class=cF5>DocEntryNewTag</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ce, </span><span class=cF1>U8</span><span class=cF0> *tag)
|
|
<a name="l57"></a>{
|
|
<a name="l58"></a> </span><span class=cF9>I64</span><span class=cF0> l = </span><span class=cF5>StrLen</span><span class=cF0>(tag);
|
|
<a name="l59"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *res = </span><span class=cF5>DocEntryNewBase</span><span class=cF0>(doc, doc_ce->type, doc_ce->de_flags, doc_ce->x, doc_ce->y, doc_ce->page_line_num);
|
|
<a name="l60"></a>
|
|
<a name="l61"></a> res->de_flags = doc_ce->de_flags; </span><span class=cF2>//Override</span><span class=cF0>
|
|
<a name="l62"></a> res->max_col = l;
|
|
<a name="l63"></a> res->tag = </span><span class=cF5>MAlloc</span><span class=cF0>(l + </span><span class=cFE>1</span><span class=cF0>, doc->mem_task);
|
|
<a name="l64"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(res->tag, tag, l + </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l65"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&res->settings, &doc_ce->settings, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDocSettings</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l66"></a>
|
|
<a name="l67"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l68"></a>}
|
|
<a name="l69"></a>
|
|
<a name="l70"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DocEntryDel</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e)
|
|
<a name="l71"></a>{</span><span class=cF2>//Free entry and all parts of entry.</span><span class=cF0>
|
|
<a name="l72"></a> </span><span class=cF1>if</span><span class=cF0> (!doc || doc == doc_e)
|
|
<a name="l73"></a> </span><span class=cF5>RawPrint</span><span class=cF0>(</span><span class=cFE>3000</span><span class=cF0>, </span><span class=cF6>"DocEntryDel"</span><span class=cF0>);
|
|
<a name="l74"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l75"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l76"></a> </span><span class=cF1>if</span><span class=cF0> (doc->cur_entry == doc_e)
|
|
<a name="l77"></a> doc->cur_entry = doc_e->next;
|
|
<a name="l78"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(doc_e);
|
|
<a name="l79"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_TAG</span><span class=cF0>)
|
|
<a name="l80"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_e->tag);
|
|
<a name="l81"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_AUX_STR</span><span class=cF0>)
|
|
<a name="l82"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_e->aux_str);
|
|
<a name="l83"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_DEFINE</span><span class=cF0>)
|
|
<a name="l84"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_e->define_str);
|
|
<a name="l85"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_HTML_LINK</span><span class=cF0>)
|
|
<a name="l86"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_e->html_link);
|
|
<a name="l87"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_LEFT_MACRO</span><span class=cF0>)
|
|
<a name="l88"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_e->left_macro);
|
|
<a name="l89"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_RIGHT_MACRO</span><span class=cF0>)
|
|
<a name="l90"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_e->right_macro);
|
|
<a name="l91"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_BIN_PTR_LINK</span><span class=cF0>)
|
|
<a name="l92"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_e->bin_ptr_link);
|
|
<a name="l93"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_HAS_BIN</span><span class=cF0>)
|
|
<a name="l94"></a> </span><span class=cF5>DocBinDel</span><span class=cF0>(doc, doc_e->bin_data);
|
|
<a name="l95"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_REMALLOC_DATA</span><span class=cF0>)
|
|
<a name="l96"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_e->data);
|
|
<a name="l97"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_e);
|
|
<a name="l98"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l99"></a>}
|
|
<a name="l100"></a>
|
|
<a name="l101"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>DocEntrySize</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *, </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e)
|
|
<a name="l102"></a>{</span><span class=cF2>//Mem size of entry and all parts.</span><span class=cF0>
|
|
<a name="l103"></a> </span><span class=cF9>I64</span><span class=cF0> res;
|
|
<a name="l104"></a>
|
|
<a name="l105"></a> </span><span class=cF1>if</span><span class=cF0> (!doc_e)
|
|
<a name="l106"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l107"></a> res = </span><span class=cF5>MSize2</span><span class=cF0>(doc_e);
|
|
<a name="l108"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_TAG</span><span class=cF0>)
|
|
<a name="l109"></a> res += </span><span class=cF5>MSize2</span><span class=cF0>(doc_e->tag);
|
|
<a name="l110"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_AUX_STR</span><span class=cF0>)
|
|
<a name="l111"></a> res += </span><span class=cF5>MSize2</span><span class=cF0>(doc_e->aux_str);
|
|
<a name="l112"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_DEFINE</span><span class=cF0>)
|
|
<a name="l113"></a> res += </span><span class=cF5>MSize2</span><span class=cF0>(doc_e->define_str);
|
|
<a name="l114"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_HTML_LINK</span><span class=cF0>)
|
|
<a name="l115"></a> res += </span><span class=cF5>MSize2</span><span class=cF0>(doc_e->html_link);
|
|
<a name="l116"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_LEFT_MACRO</span><span class=cF0>)
|
|
<a name="l117"></a> res += </span><span class=cF5>MSize2</span><span class=cF0>(doc_e->left_macro);
|
|
<a name="l118"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_RIGHT_MACRO</span><span class=cF0>)
|
|
<a name="l119"></a> res += </span><span class=cF5>MSize2</span><span class=cF0>(doc_e->right_macro);
|
|
<a name="l120"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_BIN_PTR_LINK</span><span class=cF0>)
|
|
<a name="l121"></a> res += </span><span class=cF5>MSize2</span><span class=cF0>(doc_e->bin_ptr_link);
|
|
<a name="l122"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_REMALLOC_DATA</span><span class=cF0>)
|
|
<a name="l123"></a> res += </span><span class=cF5>MSize2</span><span class=cF0>(doc_e->data);
|
|
<a name="l124"></a>
|
|
<a name="l125"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l126"></a>}
|
|
<a name="l127"></a>
|
|
<a name="l128"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DocUndoDel</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *, </span><span class=cF9>CDocUndo</span><span class=cF0> *u)
|
|
<a name="l129"></a>{
|
|
<a name="l130"></a> </span><span class=cF5>Free</span><span class=cF0>(u->body);
|
|
<a name="l131"></a> </span><span class=cF5>Free</span><span class=cF0>(u);
|
|
<a name="l132"></a>}
|
|
<a name="l133"></a>
|
|
<a name="l134"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DocUndoCountSet</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc)
|
|
<a name="l135"></a>{
|
|
<a name="l136"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
|
|
<a name="l137"></a> </span><span class=cF9>CDocUndo</span><span class=cF0> *u = doc->undo_head.next;
|
|
<a name="l138"></a>
|
|
<a name="l139"></a> doc->undo_count = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l140"></a> </span><span class=cF1>while</span><span class=cF0> (u != &doc->undo_head)
|
|
<a name="l141"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l142"></a> doc->undo_count++;
|
|
<a name="l143"></a> u = u->next;
|
|
<a name="l144"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l145"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
|
<a name="l146"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
|
|
<a name="l147"></a>}
|
|
<a name="l148"></a>
|
|
<a name="l149"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CDocEntry</span><span class=cF0> *</span><span class=cF5>DocEntryCopy</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e)
|
|
<a name="l150"></a>{</span><span class=cF2>//Make copy of entry and all parts of entry.</span><span class=cF0>
|
|
<a name="l151"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ne;
|
|
<a name="l152"></a> </span><span class=cF9>CDocBin</span><span class=cF0> *tmpb;
|
|
<a name="l153"></a> </span><span class=cF9>CTask</span><span class=cF0> *task = doc->mem_task;
|
|
<a name="l154"></a>
|
|
<a name="l155"></a> doc_ne = </span><span class=cF5>MAllocIdent</span><span class=cF0>(doc_e, task);
|
|
<a name="l156"></a> doc_ne->next = doc_ne;
|
|
<a name="l157"></a> doc_ne->last = doc_ne;
|
|
<a name="l158"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_TAG</span><span class=cF0>)
|
|
<a name="l159"></a> doc_ne->tag = </span><span class=cF5>MAllocIdent</span><span class=cF0>(doc_e->tag, task);
|
|
<a name="l160"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_AUX_STR</span><span class=cF0>)
|
|
<a name="l161"></a> doc_ne->aux_str = </span><span class=cF5>MAllocIdent</span><span class=cF0>(doc_e->aux_str, task);
|
|
<a name="l162"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_DEFINE</span><span class=cF0>)
|
|
<a name="l163"></a> doc_ne->define_str = </span><span class=cF5>MAllocIdent</span><span class=cF0>(doc_e->define_str, task);
|
|
<a name="l164"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_HTML_LINK</span><span class=cF0>)
|
|
<a name="l165"></a> doc_ne->html_link = </span><span class=cF5>MAllocIdent</span><span class=cF0>(doc_e->html_link, task);
|
|
<a name="l166"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_LEFT_MACRO</span><span class=cF0>)
|
|
<a name="l167"></a> doc_ne->left_macro = </span><span class=cF5>MAllocIdent</span><span class=cF0>(doc_e->left_macro, task);
|
|
<a name="l168"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_RIGHT_MACRO</span><span class=cF0>)
|
|
<a name="l169"></a> doc_ne->right_macro = </span><span class=cF5>MAllocIdent</span><span class=cF0>(doc_e->right_macro, task);
|
|
<a name="l170"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_BIN_PTR_LINK</span><span class=cF0>)
|
|
<a name="l171"></a> doc_ne->bin_ptr_link = </span><span class=cF5>MAllocIdent</span><span class=cF0>(doc_e->bin_ptr_link, task);
|
|
<a name="l172"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_HAS_BIN</span><span class=cF0>)
|
|
<a name="l173"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l174"></a> tmpb = </span><span class=cF5>MAllocIdent</span><span class=cF0>(doc_e->bin_data, task);
|
|
<a name="l175"></a> tmpb->data = </span><span class=cF5>MAllocIdent</span><span class=cF0>(doc_e->bin_data->data, task);
|
|
<a name="l176"></a> doc_ne->bin_num = doc->cur_bin_num;
|
|
<a name="l177"></a> tmpb->num = doc->cur_bin_num++;
|
|
<a name="l178"></a> doc_ne->bin_data = tmpb;
|
|
<a name="l179"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_TAG</span><span class=cF0> && doc_e->tag && *doc_e->tag)
|
|
<a name="l180"></a> tmpb->tag = </span><span class=cF5>StrNew</span><span class=cF0>(doc_e->tag, task);
|
|
<a name="l181"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l182"></a> tmpb->tag = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l183"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpb, doc->bin_head.last);
|
|
<a name="l184"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l185"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->de_flags & </span><span class=cF3>DOCEF_REMALLOC_DATA</span><span class=cF0>)
|
|
<a name="l186"></a> doc_ne->data = </span><span class=cF5>MAllocIdent</span><span class=cF0>(doc_e->data, task);
|
|
<a name="l187"></a>
|
|
<a name="l188"></a> </span><span class=cF1>return</span><span class=cF0> doc_ne;
|
|
<a name="l189"></a>}
|
|
<a name="l190"></a>
|
|
<a name="l191"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DocRemSoftNewLines</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
<a name="l192"></a>{
|
|
<a name="l193"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e2, *saved_ll = doc_e;
|
|
<a name="l194"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock;
|
|
<a name="l195"></a>
|
|
<a name="l196"></a> </span><span class=cF1>if</span><span class=cF0> (!doc && !</span><span class=cF7>(</span><span class=cF0>doc = </span><span class=cF5>DocPut</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l197"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l198"></a> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
|
|
<a name="l199"></a> </span><span class=cF1>if</span><span class=cF0> (!doc_e)
|
|
<a name="l200"></a> doc_e = doc->head.next;
|
|
<a name="l201"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != doc)
|
|
<a name="l202"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l203"></a> doc_e2 = doc_e->next;
|
|
<a name="l204"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->type_u8 == </span><span class=cF3>DOCT_SOFT_NEW_LINE</span><span class=cF0>)
|
|
<a name="l205"></a> {
|
|
<a name="l206"></a> </span><span class=cF1>if</span><span class=cF0> (doc->cur_entry == doc_e)
|
|
<a name="l207"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l208"></a> doc->cur_entry = doc_e2;
|
|
<a name="l209"></a> doc->cur_col = doc->cur_entry->min_col;
|
|
<a name="l210"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l211"></a> </span><span class=cF5>DocEntryDel</span><span class=cF0>(doc, doc_e);
|
|
<a name="l212"></a> }
|
|
<a name="l213"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (saved_ll && doc_e->type_u8 == </span><span class=cF3>DOCT_NEW_LINE</span><span class=cF0>)
|
|
<a name="l214"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l215"></a> doc_e = doc_e2;
|
|
<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>U0</span><span class=cF0> </span><span class=cF5>DocInsEntry</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e)
|
|
<a name="l222"></a>{</span><span class=cF2>//Insert entry into doc, updating its vals.</span><span class=cF0>
|
|
<a name="l223"></a> </span><span class=cF1>U8</span><span class=cF0> *dst;
|
|
<a name="l224"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
|
|
<a name="l225"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ce = doc->cur_entry, *doc_ne;
|
|
<a name="l226"></a>
|
|
<a name="l227"></a> doc_e->x = doc_ce->x;
|
|
<a name="l228"></a> doc_e->y = doc_ce->y;
|
|
<a name="l229"></a> doc_e->page_line_num = doc_ce->page_line_num;
|
|
<a name="l230"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&doc_e->settings, &doc_ce->settings, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDocSettings</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l231"></a> </span><span class=cF1>if</span><span class=cF0> (doc->cur_col > </span><span class=cFE>0</span><span class=cF0> &&
|
|
<a name="l232"></a> doc_ce->type_u8 == </span><span class=cF3>DOCT_TEXT</span><span class=cF0> &&
|
|
<a name="l233"></a> !</span><span class=cF7>(</span><span class=cF0>doc_ce->de_flags & (</span><span class=cF3>DOCEF_TAG_CB</span><span class=cF0> | </span><span class=cF3>DOCEF_DEFINE</span><span class=cF0> | </span><span class=cF3>DOCEF_AUX_STR</span><span class=cF0> | </span><span class=cF3>DOCEF_HTML_LINK</span><span class=cF0> | </span><span class=cF3>DOCEF_BIN_PTR_LINK</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> &&
|
|
<a name="l234"></a> doc->cur_col < doc_ce->max_col)
|
|
<a name="l235"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l236"></a> dst = doc_ce->tag + doc->cur_col;
|
|
<a name="l237"></a> doc_ne = </span><span class=cF5>DocEntryNewTag</span><span class=cF0>(doc, doc_ce, dst);
|
|
<a name="l238"></a> *dst = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l239"></a> doc_ne->type = </span><span class=cF3>DOCT_TEXT</span><span class=cF0> | doc_ce->type & </span><span class=cFE>0xFFFFFF00</span><span class=cF0>;
|
|
<a name="l240"></a> doc_ce->max_col = doc->cur_col;
|
|
<a name="l241"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_ne, doc_ce);
|
|
<a name="l242"></a> doc->cur_col = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l243"></a> doc_ce = doc_ne;
|
|
<a name="l244"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l245"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce->type_u8 == </span><span class=cF3>DOCT_TEXT</span><span class=cF0> && doc->cur_col >= doc_ce->max_col)
|
|
<a name="l246"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l247"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_e, doc_ce);
|
|
<a name="l248"></a> doc->cur_entry = doc_e->next;
|
|
<a name="l249"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l250"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l251"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l252"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_e, doc_ce->last);
|
|
<a name="l253"></a> doc->cur_entry = doc_ce;
|
|
<a name="l254"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l255"></a> doc->cur_col = doc->cur_entry->min_col;
|
|
<a name="l256"></a> </span><span class=cF5>DocRemSoftNewLines</span><span class=cF0>(doc, doc->cur_entry);
|
|
<a name="l257"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
|
<a name="l258"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
|
|
<a name="l259"></a>}
|
|
<a name="l260"></a>
|
|
<a name="l261"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DocReset</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF1>Bool</span><span class=cF0> is_old)
|
|
<a name="l262"></a>{</span><span class=cF2>//Del all entries and set doc to defaults.</span><span class=cF0>
|
|
<a name="l263"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock;
|
|
<a name="l264"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e, *doc_e2;
|
|
<a name="l265"></a> </span><span class=cF9>CDocUndo</span><span class=cF0> *u, *u8;
|
|
<a name="l266"></a> </span><span class=cF9>CDocSettings</span><span class=cF0> *s;
|
|
<a name="l267"></a> </span><span class=cF9>CDocBin</span><span class=cF0> *b, *b1;
|
|
<a name="l268"></a>
|
|
<a name="l269"></a> </span><span class=cF1>if</span><span class=cF0> (!doc && !</span><span class=cF7>(</span><span class=cF0>doc = </span><span class=cF5>DocPut</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l270"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l271"></a> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
|
|
<a name="l272"></a> </span><span class=cF1>if</span><span class=cF0> (is_old)
|
|
<a name="l273"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l274"></a> doc_e = doc->head.next;
|
|
<a name="l275"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != doc)
|
|
<a name="l276"></a> {
|
|
<a name="l277"></a> doc_e2 = doc_e->next;
|
|
<a name="l278"></a> </span><span class=cF5>DocEntryDel</span><span class=cF0>(doc, doc_e);
|
|
<a name="l279"></a> doc_e = doc_e2;
|
|
<a name="l280"></a> }
|
|
<a name="l281"></a> u = doc->undo_head.next;
|
|
<a name="l282"></a> </span><span class=cF1>while</span><span class=cF0> (u != &doc->undo_head)
|
|
<a name="l283"></a> {
|
|
<a name="l284"></a> u8 = u->next;
|
|
<a name="l285"></a> </span><span class=cF5>DocUndoDel</span><span class=cF0>(doc, u);
|
|
<a name="l286"></a> u = u8;
|
|
<a name="l287"></a> }
|
|
<a name="l288"></a> b = doc->bin_head.next;
|
|
<a name="l289"></a> </span><span class=cF1>while</span><span class=cF0> (b != &doc->bin_head)
|
|
<a name="l290"></a> {
|
|
<a name="l291"></a> b1 = b->next;
|
|
<a name="l292"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(b);
|
|
<a name="l293"></a> </span><span class=cF5>Free</span><span class=cF0>(b->data);
|
|
<a name="l294"></a> </span><span class=cF5>Free</span><span class=cF0>(b);
|
|
<a name="l295"></a> b = b1;
|
|
<a name="l296"></a> }
|
|
<a name="l297"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l298"></a></span><span class=cF2>//Check </span><a href="https://tomawezome.github.io/ZealOS/System/DolDoc/DocFile.html#l222"><span class=cF4>DocInsDoc</span></a><span class=cF0>
|
|
<a name="l299"></a> doc->flags &= </span><span class=cF3>DOCF_BREAK_UNLOCKED</span><span class=cF0>;
|
|
<a name="l300"></a> doc->head.next = doc->head.last = doc;
|
|
<a name="l301"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&doc->bin_head);
|
|
<a name="l302"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&doc->undo_head);
|
|
<a name="l303"></a> doc->undo_head.time_stamp = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l304"></a> doc->undo_count = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l305"></a> doc->cur_bin_num = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l306"></a> doc->dollar_buf_ptr = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l307"></a> doc->cmd_U8 = </span><span class=cF3>CH_SPACE</span><span class=cF0>;
|
|
<a name="l308"></a> doc->page_line_num = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l309"></a> doc->best_d = </span><span class=cF3>I64_MAX</span><span class=cF0>;
|
|
<a name="l310"></a>
|
|
<a name="l311"></a> s = &doc->settings_head;
|
|
<a name="l312"></a> s->left_margin = </span><span class=cF3>DOC_DEFAULT</span><span class=cF0>;
|
|
<a name="l313"></a> s->right_margin = </span><span class=cF3>DOC_DEFAULT</span><span class=cF0>;
|
|
<a name="l314"></a> s->indent = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l315"></a> s->page_len = </span><span class=cFE>66</span><span class=cF0>;
|
|
<a name="l316"></a> s->header = </span><span class=cF3>DOC_DEFAULT</span><span class=cF0>;
|
|
<a name="l317"></a> s->footer = </span><span class=cF3>DOC_DEFAULT</span><span class=cF0>;
|
|
<a name="l318"></a> s->state = </span><span class=cF3>DOCSS_NORMAL</span><span class=cF0>;
|
|
<a name="l319"></a> s->comment_depth = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l320"></a> s->paren_depth = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l321"></a> s->brace_depth = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l322"></a> s->shifted_x = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l323"></a> s->shifted_y = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l324"></a> s->cur_text_attr = s->default_text_attr = </span><span class=cF3>DOC_ATTR_DEFAULT_TEXT</span><span class=cF0>;
|
|
<a name="l325"></a>
|
|
<a name="l326"></a> doc_e = &doc->head;
|
|
<a name="l327"></a> doc_e->type = </span><span class=cF3>DOCT_ERROR</span><span class=cF0>;
|
|
<a name="l328"></a> doc_e->de_flags = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l329"></a> doc_e->x = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l330"></a> doc_e->y = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l331"></a> doc_e->min_col = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l332"></a> doc_e->max_col = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l333"></a> doc_e->page_line_num = doc->page_line_num;
|
|
<a name="l334"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&doc_e->settings, s, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDocSettings</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l335"></a>
|
|
<a name="l336"></a> </span><span class=cF5>DocTop</span><span class=cF0>(doc);
|
|
<a name="l337"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
|
<a name="l338"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
|
|
<a name="l339"></a>}
|
|
<a name="l340"></a>
|
|
<a name="l341"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DocDel</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc)
|
|
<a name="l342"></a>{</span><span class=cF2>//Free entire doc and entries.</span><span class=cF0>
|
|
<a name="l343"></a> </span><span class=cF1>if</span><span class=cF0> (!doc || doc->doc_signature != </span><span class=cF3>DOC_SIGNATURE_VAL</span><span class=cF0>)
|
|
<a name="l344"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l345"></a> </span><span class=cF5>DocLock</span><span class=cF0>(doc);
|
|
<a name="l346"></a> doc->doc_signature = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l347"></a> </span><span class=cF5>DocReset</span><span class=cF0>(doc, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l348"></a> </span><span class=cF5>Free</span><span class=cF0>(doc->find_replace);
|
|
<a name="l349"></a> </span><span class=cF5>Free</span><span class=cF0>(doc->dollar_buf);
|
|
<a name="l350"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
|
|
<a name="l351"></a> </span><span class=cF5>Free</span><span class=cF0>(doc);
|
|
<a name="l352"></a>}
|
|
<a name="l353"></a>
|
|
<a name="l354"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>DocSize</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc)
|
|
<a name="l355"></a>{</span><span class=cF2>//Mem size of doc and all its entries.</span><span class=cF0>
|
|
<a name="l356"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock;
|
|
<a name="l357"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e;
|
|
<a name="l358"></a> </span><span class=cF9>CDocUndo</span><span class=cF0> *u;
|
|
<a name="l359"></a> </span><span class=cF9>CDocBin</span><span class=cF0> *b;
|
|
<a name="l360"></a> </span><span class=cF9>I64</span><span class=cF0> res = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l361"></a>
|
|
<a name="l362"></a> </span><span class=cF1>if</span><span class=cF0> (!doc || doc->doc_signature != </span><span class=cF3>DOC_SIGNATURE_VAL</span><span class=cF0>)
|
|
<a name="l363"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l364"></a> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
|
|
<a name="l365"></a>
|
|
<a name="l366"></a> doc_e = doc->head.next;
|
|
<a name="l367"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != doc)
|
|
<a name="l368"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l369"></a> res += </span><span class=cF5>DocEntrySize</span><span class=cF0>(doc, doc_e);
|
|
<a name="l370"></a> doc_e = doc_e->next;
|
|
<a name="l371"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l372"></a>
|
|
<a name="l373"></a> u = doc->undo_head.next;
|
|
<a name="l374"></a> </span><span class=cF1>while</span><span class=cF0> (u != &doc->undo_head)
|
|
<a name="l375"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l376"></a> res += </span><span class=cF5>MSize2</span><span class=cF0>(u->body);
|
|
<a name="l377"></a> res += </span><span class=cF5>MSize2</span><span class=cF0>(u);
|
|
<a name="l378"></a> u = u->next;
|
|
<a name="l379"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l380"></a>
|
|
<a name="l381"></a> b = doc->bin_head.next;
|
|
<a name="l382"></a> </span><span class=cF1>while</span><span class=cF0> (b != &doc->bin_head)
|
|
<a name="l383"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l384"></a> res += </span><span class=cF5>MSize2</span><span class=cF0>(b->data);
|
|
<a name="l385"></a> res += </span><span class=cF5>MSize2</span><span class=cF0>(b);
|
|
<a name="l386"></a> b = b->next;
|
|
<a name="l387"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l388"></a>
|
|
<a name="l389"></a> res += </span><span class=cF5>MSize2</span><span class=cF0>(doc->find_replace);
|
|
<a name="l390"></a> res += </span><span class=cF5>MSize2</span><span class=cF0>(doc->dollar_buf);
|
|
<a name="l391"></a> res += </span><span class=cF5>MSize2</span><span class=cF0>(doc);
|
|
<a name="l392"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
|
<a name="l393"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
|
|
<a name="l394"></a>
|
|
<a name="l395"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l396"></a>}
|
|
<a name="l397"></a>
|
|
<a name="l398"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"DolDoc"</span><span class=cF0>
|
|
<a name="l399"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CDoc</span><span class=cF0> *</span><span class=cF5>DocNew</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *filename=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
<a name="l400"></a>{</span><span class=cF2>//MAlloc new </span><a href="https://tomawezome.github.io/ZealOS/Doc/DolDocOverview.html#l1"><span class=cF4>DolDoc</span></a><span class=cF2>. (Begin a new doc.)</span><span class=cF0>
|
|
<a name="l401"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc;
|
|
<a name="l402"></a>
|
|
<a name="l403"></a> </span><span class=cF1>if</span><span class=cF0> (!task)
|
|
<a name="l404"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
|
|
<a name="l405"></a> doc = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDoc</span><span class=cF7>)</span><span class=cF0>, task);
|
|
<a name="l406"></a> </span><span class=cF1>if</span><span class=cF0> (filename)
|
|
<a name="l407"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(doc->filename.name, filename);
|
|
<a name="l408"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l409"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(doc->filename.name, </span><span class=cFB>blkdev</span><span class=cF0>.tmp_filename);
|
|
<a name="l410"></a> doc->find_replace = </span><span class=cF5>CAlloc</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>, task);
|
|
<a name="l411"></a> doc->find_replace->scan_fwd = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l412"></a> doc->find_replace->match_case = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l413"></a> doc->find_replace->prompt = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l414"></a> doc->left_click_link = &</span><span class=cF5>EdLeftClickLink</span><span class=cF0>;
|
|
<a name="l415"></a> doc->dollar_buf_size = </span><span class=cFE>84</span><span class=cF0>;
|
|
<a name="l416"></a> doc->dollar_buf = </span><span class=cF5>MAlloc</span><span class=cF0>(doc->dollar_buf_size, task);
|
|
<a name="l417"></a> doc->max_entries = </span><span class=cF3>I64_MAX</span><span class=cF0>;
|
|
<a name="l418"></a> doc->win_task = task;
|
|
<a name="l419"></a> doc->mem_task = task;
|
|
<a name="l420"></a> </span><span class=cF5>DocReset</span><span class=cF0>(doc, </span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l421"></a> doc->doc_signature = </span><span class=cF3>DOC_SIGNATURE_VAL</span><span class=cF0>;
|
|
<a name="l422"></a>
|
|
<a name="l423"></a> </span><span class=cF1>return</span><span class=cF0> doc;
|
|
<a name="l424"></a>}
|
|
</span></pre></body>
|
|
</html>
|