368 lines
34 KiB
Plaintext
368 lines
34 KiB
Plaintext
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta name="generator" content="TempleOS V5.03">
|
||
|
<meta name="viewport" content="width=device-width">
|
||
|
<link rel="stylesheet" href="/style/templeos.css">
|
||
|
<script src="/script/templeos.js"></script>
|
||
|
<style type="text/css">
|
||
|
.cF0{color:#000000;background-color:#ffffff;}
|
||
|
.cF1{color:#0000aa;background-color:#ffffff;}
|
||
|
.cF2{color:#00aa00;background-color:#ffffff;}
|
||
|
.cF3{color:#00aaaa;background-color:#ffffff;}
|
||
|
.cF4{color:#aa0000;background-color:#ffffff;}
|
||
|
.cF5{color:#aa00aa;background-color:#ffffff;}
|
||
|
.cF6{color:#aa5500;background-color:#ffffff;}
|
||
|
.cF7{color:#aaaaaa;background-color:#ffffff;}
|
||
|
.cF8{color:#555555;background-color:#ffffff;}
|
||
|
.cF9{color:#5555ff;background-color:#ffffff;}
|
||
|
.cFA{color:#55ff55;background-color:#ffffff;}
|
||
|
.cFB{color:#55ffff;background-color:#ffffff;}
|
||
|
.cFC{color:#ff5555;background-color:#ffffff;}
|
||
|
.cFD{color:#ff55ff;background-color:#ffffff;}
|
||
|
.cFE{color:#ffff55;background-color:#ffffff;}
|
||
|
.cFF{color:#ffffff;background-color:#ffffff;}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<pre id="content">
|
||
|
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"DolDoc/Output;StdOut/DolDoc"</span><span class=cF0>
|
||
|
<a name="l2"></a>
|
||
|
<a name="l3"></a></span><span class=cF9>CDocEntry</span><span class=cF0> *</span><span class=cF5>DocPutS</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc,</span><span class=cF1>U8</span><span class=cF0> *st)
|
||
|
<a name="l4"></a>{</span><span class=cF2>//Don't use this. Use </span><a href="/Wb/Adam/DolDoc/DocPutS.HC.HTML#l148"><span class=cF4>DocPrint</span></a><span class=cF2>().</span><span class=cF0>
|
||
|
<a name="l5"></a></span><span class=cF2>//Does not handle partial Doc entries.</span><span class=cF0>
|
||
|
<a name="l6"></a> </span><span class=cF2>//Returns last newly created dollar-sign CDocEntry or NULL.</span><span class=cF0>
|
||
|
<a name="l7"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr=st,*ptr2,*st2,*ptr3,*ptr4,*src,
|
||
|
<a name="l8"></a> *char_bmp;
|
||
|
<a name="l9"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock;
|
||
|
<a name="l10"></a> </span><span class=cF9>I64</span><span class=cF0> ch,j;
|
||
|
<a name="l11"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e=</span><span class=cF3>NULL</span><span class=cF0>,*res=</span><span class=cF3>NULL</span><span class=cF0>,*doc_ce;
|
||
|
<a name="l12"></a> </span><span class=cF1>if</span><span class=cF0> (!st || !doc && !</span><span class=cF7>(</span><span class=cF0>doc=</span><span class=cF5>DocPut</span><span class=cF7>)</span><span class=cF0> || doc->doc_signature!=</span><span class=cF3>DOC_SIGNATURE_VAL</span><span class=cF0>)
|
||
|
<a name="l13"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l14"></a> unlock=</span><span class=cF5>DocLock</span><span class=cF0>(doc);
|
||
|
<a name="l15"></a> </span><span class=cF1>if</span><span class=cF0> (doc->flags & </span><span class=cF3>DOCF_PLAIN_TEXT_TABS</span><span class=cF0>)
|
||
|
<a name="l16"></a> char_bmp=</span><span class=cFB>char_bmp_zero_cr_nl_cursor</span><span class=cF0>;
|
||
|
<a name="l17"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc->flags & </span><span class=cF3>DOCF_PLAIN_TEXT</span><span class=cF0>)
|
||
|
<a name="l18"></a> char_bmp=</span><span class=cFB>char_bmp_zero_tab_cr_nl_cursor</span><span class=cF0>;
|
||
|
<a name="l19"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l20"></a> char_bmp=</span><span class=cFB>char_bmp_zero_tab_cr_nl_cursor_dollar</span><span class=cF0>;
|
||
|
<a name="l21"></a> doc_ce=doc->cur_entry;
|
||
|
<a name="l22"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l23"></a> ptr2=ptr;
|
||
|
<a name="l24"></a> </span><span class=cF1>do</span><span class=cF0> ch=*ptr++;
|
||
|
<a name="l25"></a> </span><span class=cF1>while</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>char_bmp,ch</span><span class=cF7>)</span><span class=cF0> || ch==</span><span class=cF3>CH_CURSOR</span><span class=cF0> && doc->flags&</span><span class=cF3>DOCF_NO_CURSOR</span><span class=cF0>);
|
||
|
<a name="l26"></a> ptr--;
|
||
|
<a name="l27"></a> </span><span class=cF1>if</span><span class=cF0> (!ch) {
|
||
|
<a name="l28"></a> </span><span class=cF1>if</span><span class=cF0> (j=ptr-ptr2) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l29"></a> doc_e=</span><span class=cF5>DocEntryNewBase</span><span class=cF0>(doc,
|
||
|
<a name="l30"></a> </span><span class=cF3>DOCT_TEXT</span><span class=cF0>|doc->settings_head.dft_text_attr<<8);
|
||
|
<a name="l31"></a> </span><span class=cF1>if</span><span class=cF0> (doc->flags & </span><span class=cF3>DOCF_NO_CURSOR</span><span class=cF0>) {
|
||
|
<a name="l32"></a> src=</span><span class=cF5>MAlloc</span><span class=cF0>(j+1);
|
||
|
<a name="l33"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(src,ptr2,j+1);
|
||
|
<a name="l34"></a> </span><span class=cF5>StrUtil</span><span class=cF0>(src,</span><span class=cF3>SUF_REM_CTRL_CHARS</span><span class=cF0>);
|
||
|
<a name="l35"></a> j=</span><span class=cF5>StrLen</span><span class=cF0>(src);
|
||
|
<a name="l36"></a> } </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l37"></a> src=ptr2;
|
||
|
<a name="l38"></a> doc_e->tag=</span><span class=cF5>MAlloc</span><span class=cF0>(j+1,doc->mem_task);
|
||
|
<a name="l39"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(doc_e->tag,src,j+1);
|
||
|
<a name="l40"></a> doc_e->max_col=j;
|
||
|
<a name="l41"></a> </span><span class=cF5>DocInsEntry</span><span class=cF0>(doc,doc_e);
|
||
|
<a name="l42"></a> </span><span class=cF1>if</span><span class=cF0> (doc->flags & </span><span class=cF3>DOCF_NO_CURSOR</span><span class=cF0>)
|
||
|
<a name="l43"></a> </span><span class=cF5>Free</span><span class=cF0>(src);
|
||
|
<a name="l44"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l45"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
||
|
<a name="l46"></a> </span><span class=cF1>if</span><span class=cF0> (j=ptr-ptr2) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l47"></a> *ptr=0;
|
||
|
<a name="l48"></a> doc_e=</span><span class=cF5>DocEntryNewBase</span><span class=cF0>(doc,
|
||
|
<a name="l49"></a> </span><span class=cF3>DOCT_TEXT</span><span class=cF0>|doc->settings_head.dft_text_attr<<8);
|
||
|
<a name="l50"></a> </span><span class=cF1>if</span><span class=cF0> (doc->flags & </span><span class=cF3>DOCF_NO_CURSOR</span><span class=cF0>) {
|
||
|
<a name="l51"></a> src=</span><span class=cF5>MAlloc</span><span class=cF0>(j+1);
|
||
|
<a name="l52"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(src,ptr2,j+1);
|
||
|
<a name="l53"></a> ptr3=src;
|
||
|
<a name="l54"></a> ptr4=src;
|
||
|
<a name="l55"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr3)
|
||
|
<a name="l56"></a> </span><span class=cF1>if</span><span class=cF0> (*ptr3!=</span><span class=cF3>CH_CURSOR</span><span class=cF0>)
|
||
|
<a name="l57"></a> *ptr4++=*ptr3++;
|
||
|
<a name="l58"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l59"></a> ptr3++;
|
||
|
<a name="l60"></a> *ptr4=0;
|
||
|
<a name="l61"></a> j=ptr4-src;
|
||
|
<a name="l62"></a> } </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l63"></a> src=ptr2;
|
||
|
<a name="l64"></a> doc_e->tag=</span><span class=cF5>MAlloc</span><span class=cF0>(j+1,doc->mem_task);
|
||
|
<a name="l65"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(doc_e->tag,src,j+1);
|
||
|
<a name="l66"></a> doc_e->max_col=j;
|
||
|
<a name="l67"></a> </span><span class=cF5>DocInsEntry</span><span class=cF0>(doc,doc_e);
|
||
|
<a name="l68"></a> </span><span class=cF1>if</span><span class=cF0> (doc->flags & </span><span class=cF3>DOCF_NO_CURSOR</span><span class=cF0>)
|
||
|
<a name="l69"></a> </span><span class=cF5>Free</span><span class=cF0>(src);
|
||
|
<a name="l70"></a> *ptr=ch;
|
||
|
<a name="l71"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l72"></a> </span><span class=cF1>switch</span><span class=cF0> (ch) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l73"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CURSOR</span><span class=cF0>:
|
||
|
<a name="l74"></a> doc_e=</span><span class=cF5>DocEntryNewBase</span><span class=cF0>(doc,
|
||
|
<a name="l75"></a> </span><span class=cF3>DOCT_CURSOR</span><span class=cF0>|doc->settings_head.dft_text_attr<<8);
|
||
|
<a name="l76"></a> </span><span class=cF5>DocInsEntry</span><span class=cF0>(doc,doc_e);
|
||
|
<a name="l77"></a> ptr++;
|
||
|
<a name="l78"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l79"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\t'</span><span class=cF0>:
|
||
|
<a name="l80"></a> doc_e=</span><span class=cF5>DocEntryNewBase</span><span class=cF0>(doc,
|
||
|
<a name="l81"></a> </span><span class=cF3>DOCT_TAB</span><span class=cF0>|doc->settings_head.dft_text_attr<<8);
|
||
|
<a name="l82"></a> </span><span class=cF5>DocInsEntry</span><span class=cF0>(doc,doc_e);
|
||
|
<a name="l83"></a> ptr++;
|
||
|
<a name="l84"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l85"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'$'</span><span class=cF0>:
|
||
|
<a name="l86"></a> ptr++; </span><span class=cF2>//skip first dollar</span><span class=cF0>
|
||
|
<a name="l87"></a> ptr2=ptr;
|
||
|
<a name="l88"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr && *ptr!=</span><span class=cF6>'$'</span><span class=cF0>)
|
||
|
<a name="l89"></a> ptr++;
|
||
|
<a name="l90"></a> </span><span class=cF1>if</span><span class=cF0> (*ptr) {
|
||
|
<a name="l91"></a> *ptr=0; </span><span class=cF2>//zero second dollar</span><span class=cF0>
|
||
|
<a name="l92"></a> </span><span class=cF1>if</span><span class=cF0> (ptr-1==ptr2 && *ptr2==</span><span class=cF3>CH_CURSOR</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l93"></a> doc_e=</span><span class=cF5>DocEntryNewBase</span><span class=cF0>(doc,
|
||
|
<a name="l94"></a> </span><span class=cF3>DOCT_CURSOR</span><span class=cF0>|doc->settings_head.dft_text_attr<<8);
|
||
|
<a name="l95"></a> </span><span class=cF5>DocInsEntry</span><span class=cF0>(doc,doc_e);
|
||
|
<a name="l96"></a> ptr2++;
|
||
|
<a name="l97"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l98"></a> </span><span class=cF1>if</span><span class=cF0> (ptr==ptr2) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l99"></a> doc_e=</span><span class=cF5>DocEntryNewBase</span><span class=cF0>(doc,
|
||
|
<a name="l100"></a> </span><span class=cF3>DOCT_TEXT</span><span class=cF0>|doc->settings_head.dft_text_attr<<8);
|
||
|
<a name="l101"></a> doc_e->max_col=1;
|
||
|
<a name="l102"></a> </span><span class=cF1>if</span><span class=cF0> (doc->flags & </span><span class=cF3>DOCF_DBL_DOLLARS</span><span class=cF0>)
|
||
|
<a name="l103"></a> doc_e->tag=</span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF6>"$$"</span><span class=cF0>,doc->mem_task);
|
||
|
<a name="l104"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l105"></a> doc_e->tag=</span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF6>"$"</span><span class=cF0>,doc->mem_task);
|
||
|
<a name="l106"></a> </span><span class=cF5>DocInsEntry</span><span class=cF0>(doc,doc_e);
|
||
|
<a name="l107"></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="l108"></a> st2=</span><span class=cF5>MAlloc</span><span class=cF0>(ptr-ptr2+1);
|
||
|
<a name="l109"></a> ptr3=ptr2;
|
||
|
<a name="l110"></a> ptr4=st2;
|
||
|
<a name="l111"></a> </span><span class=cF1>while</span><span class=cF0> (ch=*ptr3++) {
|
||
|
<a name="l112"></a> </span><span class=cF1>if</span><span class=cF0> (ch==</span><span class=cF3>CH_CURSOR</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l113"></a> doc_e=</span><span class=cF5>DocEntryNewBase</span><span class=cF0>(doc,
|
||
|
<a name="l114"></a> </span><span class=cF3>DOCT_CURSOR</span><span class=cF0>|doc->settings_head.dft_text_attr<<8);
|
||
|
<a name="l115"></a> </span><span class=cF5>DocInsEntry</span><span class=cF0>(doc,doc_e);
|
||
|
<a name="l116"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l117"></a> *ptr4++=ch;
|
||
|
<a name="l118"></a> }
|
||
|
<a name="l119"></a> *ptr4=0;
|
||
|
<a name="l120"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e=</span><span class=cF5>PrsDollarCmd</span><span class=cF7>(</span><span class=cF0>doc,st2</span><span class=cF7>)</span><span class=cF0>) {
|
||
|
<a name="l121"></a> res=doc_e;
|
||
|
<a name="l122"></a> </span><span class=cF5>DocInsEntry</span><span class=cF0>(doc,doc_e);
|
||
|
<a name="l123"></a> }
|
||
|
<a name="l124"></a> </span><span class=cF5>Free</span><span class=cF0>(st2);
|
||
|
<a name="l125"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l126"></a> *ptr++=</span><span class=cF6>'$'</span><span class=cF0>;
|
||
|
<a name="l127"></a> }
|
||
|
<a name="l128"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l129"></a> </span><span class=cF1>default</span><span class=cF0>:
|
||
|
<a name="l130"></a> doc_e=</span><span class=cF5>DocEntryNewBase</span><span class=cF0>(doc,
|
||
|
<a name="l131"></a> </span><span class=cF3>DOCT_NEW_LINE</span><span class=cF0>|doc->settings_head.dft_text_attr<<8);
|
||
|
<a name="l132"></a> </span><span class=cF5>DocInsEntry</span><span class=cF0>(doc,doc_e);
|
||
|
<a name="l133"></a> </span><span class=cF1>if</span><span class=cF0> (ch==</span><span class=cF6>'\r'</span><span class=cF0>)
|
||
|
<a name="l134"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr==</span><span class=cF6>'\r'</span><span class=cF0>)
|
||
|
<a name="l135"></a> ptr++;
|
||
|
<a name="l136"></a> </span><span class=cF1>if</span><span class=cF0> (*ptr==</span><span class=cF6>'\n'</span><span class=cF0>)
|
||
|
<a name="l137"></a> ptr++;
|
||
|
<a name="l138"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr==</span><span class=cF6>'\r'</span><span class=cF0>)
|
||
|
<a name="l139"></a> ptr++;
|
||
|
<a name="l140"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l141"></a> }
|
||
|
<a name="l142"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l143"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
||
|
<a name="l144"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
|
||
|
<a name="l145"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
||
|
<a name="l146"></a>}
|
||
|
<a name="l147"></a>
|
||
|
<a name="l148"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CDocEntry</span><span class=cF0> *</span><span class=cF5>DocPrint</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=cF1>U8</span><span class=cF0> *fmt,...)
|
||
|
<a name="l149"></a>{</span><span class=cF2>//You must not print partial doc cmds.</span><span class=cF0>
|
||
|
<a name="l150"></a></span><span class=cF2>//Returns last newly created dollar-sign CDocEntry or NULL.</span><span class=cF0>
|
||
|
<a name="l151"></a> </span><span class=cF1>U8</span><span class=cF0> *buf=</span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>,fmt,argc,argv);
|
||
|
<a name="l152"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *res=</span><span class=cF5>DocPutS</span><span class=cF0>(doc,buf);
|
||
|
<a name="l153"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
|
||
|
<a name="l154"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
||
|
<a name="l155"></a>}
|
||
|
<a name="l156"></a>
|
||
|
<a name="l157"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DocPrintPartial</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=cF1>U8</span><span class=cF0> *fmt,...)
|
||
|
<a name="l158"></a>{</span><span class=cF2>//Lets you print half a doc cmd, if you like.</span><span class=cF0>
|
||
|
<a name="l159"></a> </span><span class=cF1>U8</span><span class=cF0> *buf,*st,*src,*dst,*ptr,*ptr2;
|
||
|
<a name="l160"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock;
|
||
|
<a name="l161"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ce,*doc_ne;
|
||
|
<a name="l162"></a> </span><span class=cF9>I64</span><span class=cF0> ch,i,j;
|
||
|
<a name="l163"></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="l164"></a> </span><span class=cF1>return</span><span class=cF0>;
|
||
|
<a name="l165"></a> buf=</span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>,fmt,argc,argv);
|
||
|
<a name="l166"></a> ptr=buf;
|
||
|
<a name="l167"></a> </span><span class=cF1>if</span><span class=cF0> (doc->user_put_s && </span><span class=cF7>(</span><span class=cF0>*doc->user_put_s</span><span class=cF7>)(</span><span class=cF0>doc,doc->user_put_data,buf</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l168"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
|
||
|
<a name="l169"></a> </span><span class=cF1>return</span><span class=cF0>;
|
||
|
<a name="l170"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l171"></a> unlock=</span><span class=cF5>DocLock</span><span class=cF0>(doc);
|
||
|
<a name="l172"></a> </span><span class=cF1>if</span><span class=cF0> (doc->cur_entry->type_u8==</span><span class=cF3>DOCT_DATA</span><span class=cF0>)
|
||
|
<a name="l173"></a> </span><span class=cF1>while</span><span class=cF0> (ch=*ptr++)
|
||
|
<a name="l174"></a> </span><span class=cF5>DocPutKey</span><span class=cF0>(doc,ch,0);
|
||
|
<a name="l175"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l176"></a> </span><span class=cF1>while</span><span class=cF0> (ch=*ptr) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l177"></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_safe_dollar</span><span class=cF0>,ch</span><span class=cF7>)</span><span class=cF0> ||
|
||
|
<a name="l178"></a> doc->flags & </span><span class=cF7>(</span><span class=cF3>DOCF_OVERSTRIKE</span><span class=cF0>|</span><span class=cF3>DOCF_IN_DOLLAR</span><span class=cF7>)</span><span class=cF0>) {
|
||
|
<a name="l179"></a> </span><span class=cF5>DocPutKey</span><span class=cF0>(doc,ch,0);
|
||
|
<a name="l180"></a> ptr++;
|
||
|
<a name="l181"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
||
|
<a name="l182"></a> ptr2=ptr++;
|
||
|
<a name="l183"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l184"></a> ch=*ptr++;
|
||
|
<a name="l185"></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_safe_dollar</span><span class=cF0>,ch</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l186"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l187"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l188"></a> ptr--;
|
||
|
<a name="l189"></a> *ptr=0;
|
||
|
<a name="l190"></a> doc_ce=doc->cur_entry;
|
||
|
<a name="l191"></a> j=ptr-ptr2;
|
||
|
<a name="l192"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>IsEditableText</span><span class=cF7>(</span><span class=cF0>doc_ce</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l193"></a> dst=st=</span><span class=cF5>MAlloc</span><span class=cF0>(doc_ce->max_col+j+1,doc->mem_task);
|
||
|
<a name="l194"></a> src=doc_ce->tag;
|
||
|
<a name="l195"></a> i=doc->cur_col;
|
||
|
<a name="l196"></a> doc->cur_col+=j;
|
||
|
<a name="l197"></a> doc_ce->max_col+=j;
|
||
|
<a name="l198"></a> </span><span class=cF1>while</span><span class=cF0> (i-->0)
|
||
|
<a name="l199"></a> *dst++=*src++;
|
||
|
<a name="l200"></a> </span><span class=cF1>while</span><span class=cF0> (j-->0)
|
||
|
<a name="l201"></a> *dst++=*ptr2++;
|
||
|
<a name="l202"></a> </span><span class=cF1>while</span><span class=cF0> (*dst++=*src++);
|
||
|
<a name="l203"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_ce->tag);
|
||
|
<a name="l204"></a> doc_ce->tag=st;
|
||
|
<a name="l205"></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="l206"></a> doc_ne=</span><span class=cF5>DocEntryNewTag</span><span class=cF0>(doc,doc_ce,ptr2);
|
||
|
<a name="l207"></a> doc_ne->type=</span><span class=cF3>DOCT_TEXT</span><span class=cF0>|doc->settings_head.dft_text_attr<<8;
|
||
|
<a name="l208"></a> doc_ne->de_flags=</span><span class=cFB>doldoc</span><span class=cF0>.dft_de_flags[</span><span class=cF3>DOCT_TEXT</span><span class=cF0>];
|
||
|
<a name="l209"></a> </span><span class=cF5>QueIns</span><span class=cF0>(doc_ne,doc_ce->last);
|
||
|
<a name="l210"></a> doc->cur_entry=doc_ne;
|
||
|
<a name="l211"></a> doc->cur_col=</span><span class=cF5>StrLen</span><span class=cF0>(ptr2);
|
||
|
<a name="l212"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l213"></a> *ptr=ch;
|
||
|
<a name="l214"></a> </span><span class=cF5>DocRemSoftNewLines</span><span class=cF0>(doc,doc->cur_entry);
|
||
|
<a name="l215"></a> }
|
||
|
<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> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>doc->flags&</span><span class=cF3>DOCF_DONT_SWAP_OUT</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l220"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
||
|
<a name="l221"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
|
||
|
<a name="l222"></a>}
|
||
|
<a name="l223"></a>
|
||
|
<a name="l224"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>KDDocPutS</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *st)
|
||
|
<a name="l225"></a>{
|
||
|
<a name="l226"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc;
|
||
|
<a name="l227"></a> </span><span class=cF1>if</span><span class=cF0> (doc=</span><span class=cF5>DocPut</span><span class=cF0>)
|
||
|
<a name="l228"></a> </span><span class=cF5>DocPrintPartial</span><span class=cF0>(doc,</span><span class=cF6>"%s"</span><span class=cF0>,st);
|
||
|
<a name="l229"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
||
|
<a name="l230"></a>}
|
||
|
<a name="l231"></a>
|
||
|
<a name="l232"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DocPrintAtomic</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=cF1>U8</span><span class=cF0> *fmt,...)
|
||
|
<a name="l233"></a>{</span><span class=cF2>//Prints multiple whole cmds all-at-once. Might need this when printing trees.</span><span class=cF0>
|
||
|
<a name="l234"></a> </span><span class=cF1>U8</span><span class=cF0> *buf;
|
||
|
<a name="l235"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock;
|
||
|
<a name="l236"></a> </span><span class=cF9>I64</span><span class=cF0> old_flags;
|
||
|
<a name="l237"></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="l238"></a> </span><span class=cF1>return</span><span class=cF0>;
|
||
|
<a name="l239"></a> buf=</span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>,fmt,argc,argv);
|
||
|
<a name="l240"></a> unlock=</span><span class=cF5>DocLock</span><span class=cF0>(doc);
|
||
|
<a name="l241"></a> old_flags=doc->flags;
|
||
|
<a name="l242"></a> doc->flags|=</span><span class=cF3>DOCF_NO_CURSOR</span><span class=cF0>;
|
||
|
<a name="l243"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>"%s"</span><span class=cF0>,buf);
|
||
|
<a name="l244"></a> </span><span class=cF5>DocRecalc</span><span class=cF0>(doc);
|
||
|
<a name="l245"></a> doc->flags=old_flags;
|
||
|
<a name="l246"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
||
|
<a name="l247"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
|
||
|
<a name="l248"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
|
||
|
<a name="l249"></a>}
|
||
|
<a name="l250"></a>
|
||
|
<a name="l251"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DocDump</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc,</span><span class=cF9>I64</span><span class=cF0> uS_delay=0)
|
||
|
<a name="l252"></a>{
|
||
|
<a name="l253"></a> </span><span class=cF1>U8</span><span class=cF0> *st;
|
||
|
<a name="l254"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e,*doc_e2;
|
||
|
<a name="l255"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock=</span><span class=cF5>DocLock</span><span class=cF0>(doc);
|
||
|
<a name="l256"></a> doc_e=doc->head.next;
|
||
|
<a name="l257"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l258"></a> st=</span><span class=cF5>DocScanLine</span><span class=cF0>(doc,doc_e,</span><span class=cF3>NULL</span><span class=cF0>,&doc_e2);
|
||
|
<a name="l259"></a> </span><span class=cF6>"%s"</span><span class=cF0>,st;
|
||
|
<a name="l260"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
||
|
<a name="l261"></a> doc_e=doc_e2;
|
||
|
<a name="l262"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->type_u8==</span><span class=cF3>DOCT_NEW_LINE</span><span class=cF0>) {
|
||
|
<a name="l263"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
||
|
<a name="l264"></a> </span><span class=cF5>Busy</span><span class=cF0>(uS_delay);
|
||
|
<a name="l265"></a> doc_e=doc_e->next;
|
||
|
<a name="l266"></a> }
|
||
|
<a name="l267"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l268"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
||
|
<a name="l269"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
|
||
|
<a name="l270"></a>}
|
||
|
<a name="l271"></a>
|
||
|
<a name="l272"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CDocEntry</span><span class=cF0> *</span><span class=cF5>DocPutLine</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)
|
||
|
<a name="l273"></a>{</span><span class=cF2>//Send line from other doc to StdOut </span><a href="/Wb/Adam/DolDoc/DocDblBuf.HC.HTML#l2"><span class=cF4>DocPut</span></a><span class=cF2>.</span><span class=cF0>
|
||
|
<a name="l274"></a> </span><span class=cF9>I64</span><span class=cF0> ch;
|
||
|
<a name="l275"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr,*ptr2;
|
||
|
<a name="l276"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock;
|
||
|
<a name="l277"></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> || doc->doc_signature!=</span><span class=cF3>DOC_SIGNATURE_VAL</span><span class=cF0>)
|
||
|
<a name="l278"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l279"></a> unlock=</span><span class=cF5>DocLock</span><span class=cF0>(doc);
|
||
|
<a name="l280"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc && doc_e->type_u8!=</span><span class=cF3>DOCT_NEW_LINE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l281"></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="l282"></a> ptr=doc_e->tag;
|
||
|
<a name="l283"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l284"></a> ptr2=ptr;
|
||
|
<a name="l285"></a> </span><span class=cF1>while</span><span class=cF0> (ch=*ptr)
|
||
|
<a name="l286"></a> </span><span class=cF1>if</span><span class=cF0> (ch==</span><span class=cF6>'$'</span><span class=cF0>)
|
||
|
<a name="l287"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l288"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l289"></a> ptr++;
|
||
|
<a name="l290"></a> *ptr=0;
|
||
|
<a name="l291"></a> </span><span class=cF6>"%s"</span><span class=cF0>,ptr2;
|
||
|
<a name="l292"></a> *ptr=ch;
|
||
|
<a name="l293"></a> </span><span class=cF1>if</span><span class=cF0> (ch==</span><span class=cF6>'$'</span><span class=cF0>) {
|
||
|
<a name="l294"></a> </span><span class=cF6>"$$"</span><span class=cF0>;
|
||
|
<a name="l295"></a> ptr++;
|
||
|
<a name="l296"></a> }
|
||
|
<a name="l297"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (ch);
|
||
|
<a name="l298"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e->type_u8==</span><span class=cF3>DOCT_TAB</span><span class=cF0>)
|
||
|
<a name="l299"></a> </span><span class=cF6>'\t'</span><span class=cF0>;
|
||
|
<a name="l300"></a> doc_e=doc_e->next;
|
||
|
<a name="l301"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l302"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
||
|
<a name="l303"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e!=doc)
|
||
|
<a name="l304"></a> doc_e=doc_e->next;
|
||
|
<a name="l305"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
||
|
<a name="l306"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
|
||
|
<a name="l307"></a> </span><span class=cF1>return</span><span class=cF0> doc_e;
|
||
|
<a name="l308"></a>}
|
||
|
<a name="l309"></a>
|
||
|
<a name="l310"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"Debugging/Dump;DolDoc/Cmd Line (Typically);"</span><span class=cF0>\
|
||
|
<a name="l311"></a> </span><span class=cF6>"Cmd Line (Typically);DolDoc/Output;StdOut/DolDoc"</span><span class=cF0>
|
||
|
<a name="l312"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DocDm</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *buf,</span><span class=cF9>I64</span><span class=cF0> cnt=0x80)
|
||
|
<a name="l313"></a>{</span><span class=cF2>//Dump live chunk of mem showing addresses. Can be edited.</span><span class=cF0>
|
||
|
<a name="l314"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e;
|
||
|
<a name="l315"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc=</span><span class=cF5>DocPut</span><span class=cF0>;
|
||
|
<a name="l316"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock=</span><span class=cF5>DocLock</span><span class=cF0>(doc);
|
||
|
<a name="l317"></a> doc_e=</span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>"$HX-Z,%d,16$"</span><span class=cF0>,cnt);
|
||
|
<a name="l318"></a> doc_e->data=buf;
|
||
|
<a name="l319"></a> doc->cur_entry=doc_e->next;
|
||
|
<a name="l320"></a> </span><span class=cF5>DocRecalc</span><span class=cF0>(doc);
|
||
|
<a name="l321"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
||
|
<a name="l322"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
|
||
|
<a name="l323"></a>}
|
||
|
<a name="l324"></a>
|
||
|
<a name="l325"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DocD</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *buf,</span><span class=cF9>I64</span><span class=cF0> cnt=0x80)
|
||
|
<a name="l326"></a>{</span><span class=cF2>//Dump live chunk of mem showing offsets. Can be edited.</span><span class=cF0>
|
||
|
<a name="l327"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e;
|
||
|
<a name="l328"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc=</span><span class=cF5>DocPut</span><span class=cF0>;
|
||
|
<a name="l329"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock=</span><span class=cF5>DocLock</span><span class=cF0>(doc);
|
||
|
<a name="l330"></a> doc_e=</span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>"$HX,%d,16$"</span><span class=cF0>,cnt);
|
||
|
<a name="l331"></a> doc_e->data=buf;
|
||
|
<a name="l332"></a> doc->cur_entry=doc_e->next;
|
||
|
<a name="l333"></a> </span><span class=cF5>DocRecalc</span><span class=cF0>(doc);
|
||
|
<a name="l334"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
||
|
<a name="l335"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
|
||
|
<a name="l336"></a>}
|
||
|
</span></pre></body>
|
||
|
</html>
|