2021-07-03 05:07:57 +01:00
<!DOCTYPE HTML>
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html;charset=US-ASCII" >
2021-08-15 07:23:46 +01:00
< meta name = "generator" content = "ZealOS V0.16" >
2021-07-03 05:07:57 +01:00
< style type = "text/css" >
2021-07-29 03:20:15 +01:00
body {background-color:#fef1f0;}
.cF0{color:#000000;background-color:#fef1f0;}
.cF1{color:#0148a4;background-color:#fef1f0;}
.cF2{color:#3b7901;background-color:#fef1f0;}
.cF3{color:#057c7e;background-color:#fef1f0;}
.cF4{color:#bb2020;background-color:#fef1f0;}
.cF5{color:#9e42ae;background-color:#fef1f0;}
.cF6{color:#b57901;background-color:#fef1f0;}
.cF7{color:#b2b6af;background-color:#fef1f0;}
.cF8{color:#555753;background-color:#fef1f0;}
.cF9{color:#678fbb;background-color:#fef1f0;}
.cFA{color:#82bc49;background-color:#fef1f0;}
.cFB{color:#0097a2;background-color:#fef1f0;}
.cFC{color:#e26a6a;background-color:#fef1f0;}
.cFD{color:#c671bc;background-color:#fef1f0;}
.cFE{color:#c7ab00;background-color:#fef1f0;}
.cFF{color:#fef1f0;background-color:#fef1f0;}
2021-07-03 05:07:57 +01:00
< / style >
< / head >
< body >
2021-07-05 01:12:38 +01:00
< pre style = "font-family:monospace;font-size:12pt" >
2021-07-03 05:07:57 +01:00
< a name = "l1" > < / a > < span class = cF0 > #< / span > < span class = cF1 > help_index< / span > < span class = cF0 > < / span > < span class = cF6 > " DolDoc/File" < / 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 > U0< / span > < span class = cF0 > < / span > < span class = cF5 > DocLoad< / span > < span class = cF0 > (< / span > < span class = cF9 > CDoc< / span > < span class = cF0 > *doc, < / span > < span class = cF1 > U8< / span > < span class = cF0 > *src2, < / span > < span class = cF9 > I64< / span > < span class = cF0 > size)
< a name = "l4" > < / a > {< / span > < span class = cF2 > //Fetch doc from raw mem buf.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l5" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > i;
< a name = "l6" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > *src;
< a name = "l7" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > unlock = < / span > < span class = cF5 > DocLock< / span > < span class = cF0 > (doc);
< a name = "l8" > < / a > < / span > < span class = cF9 > CDocBin< / span > < span class = cF0 > *tmpb;
2021-07-03 05:07:57 +01:00
< a name = "l9" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l10" > < / a > doc-> find_replace-> filter_lines = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l11" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (src2)
< a name = "l12" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
2021-07-26 20:29:49 +01:00
< a name = "l13" > < / a > < / span > < span class = cF5 > DocPutS< / span > < span class = cF0 > (doc, src2); < / span > < span class = cF2 > //Too big < / span > < a href = "https://zeal-operating-system.github.io/ZealOS/System/DolDoc/DocPutS.CC.html#l164" > < span class = cF4 > DocPrint< / span > < / a > < span class = cF2 > () is wasteful.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l14" > < / a > src = src2 + < / span > < span class = cF5 > StrLen< / span > < span class = cF0 > (src2) + < / span > < span class = cFE > 1< / span > < span class = cF0 > ;
< a name = "l15" > < / a > i = size - (< / span > < span class = cF1 > offset< / span > < span class = cF7 > (< / span > < span class = cF9 > CDocBin< / span > < span class = cF0 > .< / span > < span class = cF1 > end< / span > < span class = cF7 > )< / span > < span class = cF0 > - < / span > < span class = cF1 > offset< / span > < span class = cF7 > (< / span > < span class = cF9 > CDocBin< / span > < span class = cF0 > .< / span > < span class = cF1 > start< / span > < span class = cF7 > )< / span > < span class = cF0 > );
< a name = "l16" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (src < = src2 + i)
< a name = "l17" > < / a > {
< a name = "l18" > < / a > tmpb = < / span > < span class = cF5 > CAlloc< / span > < span class = cF0 > (< / span > < span class = cF1 > sizeof< / span > < span class = cF7 > (< / span > < span class = cF9 > CDocBin< / span > < span class = cF7 > )< / span > < span class = cF0 > , doc-> mem_task);
< a name = "l19" > < / a > < / span > < span class = cF5 > MemCopy< / span > < span class = cF0 > (& tmpb-> < / span > < span class = cF1 > start< / span > < span class = cF0 > , src, < / span > < span class = cF1 > offset< / span > < span class = cF7 > (< / span > < span class = cF9 > CDocBin< / span > < span class = cF0 > .< / span > < span class = cF1 > end< / span > < span class = cF7 > )< / span > < span class = cF0 > - < / span > < span class = cF1 > offset< / span > < span class = cF7 > (< / span > < span class = cF9 > CDocBin< / span > < span class = cF0 > .< / span > < span class = cF1 > start< / span > < span class = cF7 > )< / span > < span class = cF0 > );
< a name = "l20" > < / a > src+=< / span > < span class = cF1 > offset< / span > < span class = cF0 > (< / span > < span class = cF9 > CDocBin< / span > < span class = cF0 > .< / span > < span class = cF1 > end< / span > < span class = cF0 > )-< / span > < span class = cF1 > offset< / span > < span class = cF0 > (< / span > < span class = cF9 > CDocBin< / span > < span class = cF0 > .< / span > < span class = cF1 > start< / span > < span class = cF0 > );
< a name = "l21" > < / a > tmpb-> data = < / span > < span class = cF5 > MAlloc< / span > < span class = cF0 > (tmpb-> size, doc-> mem_task);
< a name = "l22" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (tmpb-> size)
< a name = "l23" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l24" > < / a > < / span > < span class = cF5 > MemCopy< / span > < span class = cF0 > (tmpb-> data, src, tmpb-> size);
< a name = "l25" > < / a > src += tmpb-> size;
< a name = "l26" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l27" > < / a > < / span > < span class = cF5 > QueueInsert< / span > < span class = cF0 > (tmpb, doc-> bin_head.last);
< a name = "l28" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (tmpb-> num > = doc-> cur_bin_num)
< a name = "l29" > < / a > doc-> cur_bin_num = tmpb-> num + < / span > < span class = cFE > 1< / span > < span class = cF0 > ;
< a name = "l30" > < / a > }
< a name = "l31" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l32" > < / 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_PLAIN_TEXT< / span > < span class = cF0 > | < / span > < span class = cF3 > DOCF_PLAIN_TEXT_TABS< / span > < span class = cF0 > )< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l33" > < / a > < / span > < span class = cF5 > DocBinsValidate< / span > < span class = cF0 > (doc);
2021-07-26 20:29:49 +01:00
< a name = "l34" > < / a > < / span > < span class = cF5 > DocTop< / span > < span class = cF0 > (doc); < / span > < span class = cF2 > //Calls < / span > < a href = "https://zeal-operating-system.github.io/ZealOS/System/DolDoc/DocRecalc.CC.html#l305" > < span class = cF4 > DocRecalc< / span > < / a > < span class = cF2 > (). DOCT_CURSOR will be set.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l35" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (unlock)
< a name = "l36" > < / a > < / span > < span class = cF5 > DocUnlock< / span > < span class = cF0 > (doc);
2021-07-03 05:07:57 +01:00
< a name = "l37" > < / a > }
< a name = "l38" > < / a >
< a name = "l39" > < / a > < / span > < span class = cF1 > public< / span > < span class = cF0 > < / span > < span class = cF9 > CDoc< / span > < span class = cF0 > *< / span > < span class = cF5 > DocRead< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > *name=< / span > < span class = cF3 > NULL< / span > < span class = cF0 > , < / span > < span class = cF9 > I64< / span > < span class = cF0 > flags=< / span > < span class = cFE > 0< / span > < span class = cF0 > )
2021-07-26 20:29:49 +01:00
< a name = "l40" > < / a > {< / span > < span class = cF2 > //Fetch doc from disk. See < / span > < a href = "https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l1404" > < span class = cF4 > flags< / span > < / a > < span class = cF2 > .< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l41" > < / a > < / span > < span class = cF9 > CDoc< / span > < span class = cF0 > *doc = < / span > < span class = cF5 > DocNew< / span > < span class = cF0 > ;
< a name = "l42" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > *src, *name2;
< a name = "l43" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > size = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l44" > < / a > < / span > < span class = cF9 > CDirContext< / span > < span class = cF0 > *dirc;
2021-07-03 05:07:57 +01:00
< a name = "l45" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l46" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!name)
< a name = "l47" > < / a > name = < / span > < span class = cFB > blkdev< / span > < span class = cF0 > .tmp_filename;
< a name = "l48" > < / a > doc-> flags |= flags;
< a name = "l49" > < / a > name2 = < / span > < span class = cF5 > FileNameAbs< / span > < span class = cF0 > (name);
< a name = "l50" > < / a > < / span > < span class = cF5 > StrCopy< / span > < span class = cF0 > (doc-> filename.name, name2);
< a name = "l51" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (src = < / span > < span class = cF5 > FileRead< / span > < span class = cF7 > (< / span > < span class = cF0 > name2, & size, & doc-> file_attr< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l52" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l53" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (dirc = < / span > < span class = cF5 > DirContextNew< / span > < span class = cF7 > (< / span > < span class = cF0 > name2< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l54" > < / a > {
< a name = "l55" > < / a > < / span > < span class = cF5 > DocLoad< / span > < span class = cF0 > (doc, src, size);
< a name = "l56" > < / a > < / span > < span class = cF5 > DirContextDel< / span > < span class = cF0 > (dirc);
< a name = "l57" > < / a > }
< a name = "l58" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (src);
< a name = "l59" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l60" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (name2);
2021-07-03 05:07:57 +01:00
< a name = "l61" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l62" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > doc;
2021-07-03 05:07:57 +01:00
< a name = "l63" > < / a > }
< a name = "l64" > < / a >
< a name = "l65" > < / a > < / span > < span class = cF1 > public< / span > < span class = cF0 > < / span > < span class = cF1 > U8< / span > < span class = cF0 > *< / span > < span class = cF5 > DocSave< / span > < span class = cF0 > (< / span > < span class = cF9 > CDoc< / span > < span class = cF0 > *doc, < / span > < span class = cF9 > I64< / span > < span class = cF0 > *_size=< / span > < span class = cF3 > NULL< / span > < span class = cF0 > )
< a name = "l66" > < / a > {< / span > < span class = cF2 > //Store doc to raw mem buf.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l67" > < / a > < / span > < span class = cF9 > CDocEntry< / span > < span class = cF0 > *doc_e, *doc_e1;
< a name = "l68" > < / a > < / span > < span class = cF9 > CDocBin< / span > < span class = cF0 > *b;
< a name = "l69" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > unlock = < / span > < span class = cF5 > DocLock< / span > < span class = cF0 > (doc);
< a name = "l70" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > ch, count = < / span > < span class = cFE > 1< / span > < span class = cF0 > ;< / span > < span class = cF2 > //terminator< / span > < span class = cF0 >
< a name = "l71" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > *st, *res, *dst, *src;
2021-07-03 05:07:57 +01:00
< a name = "l72" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l73" > < / 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_PLAIN_TEXT< / span > < span class = cF0 > | < / span > < span class = cF3 > DOCF_PLAIN_TEXT_TABS< / span > < span class = cF0 > )< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l74" > < / a > < / span > < span class = cF5 > DocBinsValidate< / span > < span class = cF0 > (doc);
< a name = "l75" > < / 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 = "l76" > < / a > < / span > < span class = cF5 > DocRecalc< / span > < span class = cF0 > (doc);
< a name = "l77" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l78" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l79" > < / a > < / span > < span class = cF5 > DocRecalc< / span > < span class = cF0 > (doc, < / span > < span class = cF3 > RECALCF_ADD_CURSOR< / span > < span class = cF0 > );
< a name = "l80" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (doc-> head.next-> type_u8 == < / span > < span class = cF3 > DOCT_CURSOR< / span > < span class = cF0 > )
2021-07-26 20:29:49 +01:00
< a name = "l81" > < / a > < / span > < span class = cF5 > DocEntryDel< / span > < span class = cF0 > (doc, doc-> head.next); < / span > < span class = cF2 > //If no cursor, < / span > < a href = "https://zeal-operating-system.github.io/ZealOS/System/DolDoc/DocFile.CC.html#l3" > < span class = cF4 > DocLoad< / span > < / a > < span class = cF2 > () puts at top.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l82" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l83" > < / a > < / span > < span class = cF1 > for< / span > < span class = cF0 > (doc_e = doc-> head.next; doc_e != doc; doc_e = doc_e-> next)
< a name = "l84" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l85" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!< / span > < span class = cF5 > Bt< / span > < span class = cF7 > (< / span > < span class = cFB > doldoc< / span > < span class = cF0 > .type_flags_data, doc_e-> type_u8< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l86" > < / a > {
< a name = "l87" > < / a > < / span > < span class = cF1 > switch< / span > < span class = cF0 > (doc_e-> type_u8)
< a name = "l88" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l89" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > DOCT_TAB< / span > < span class = cF0 > :
< a name = "l90" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > DOCT_PAGE_BREAK< / span > < span class = cF0 > :
< a name = "l91" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > DOCT_CURSOR< / span > < span class = cF0 > :
< a name = "l92" > < / a > count++;
< a name = "l93" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l94" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l95" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > DOCT_NEW_LINE< / span > < span class = cF0 > :
< a name = "l96" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (doc-> flags & < / span > < span class = cF3 > DOCF_CARRIAGE_RETURN< / span > < span class = cF0 > )
< a name = "l97" > < / a > count += < / span > < span class = cFE > 2< / span > < span class = cF0 > ;
< a name = "l98" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l99" > < / a > count++;
< a name = "l100" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l101" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l102" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > DOCT_SOFT_NEW_LINE< / span > < span class = cF0 > :
< a name = "l103" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l104" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l105" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > DOCT_TEXT< / span > < span class = cF0 > :
< a name = "l106" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!< / span > < span class = cF7 > (< / span > < span class = cF0 > doc_e-> de_flags &
< a name = "l107" > < / a > ~(< / span > < span class = cF3 > DOCEF_TAG< / span > < span class = cF0 > | < / span > < span class = cF3 > DOCG_BL_IV_UL< / span > < span class = cF0 > | < / span > < span class = cF3 > DOCEF_WORD_WRAP< / span > < span class = cF0 > | < / span > < span class = cF3 > DOCEF_HIGHLIGHT< / span > < span class = cF0 > |< / span > < span class = cF3 > DOCEF_SKIP< / span > < span class = cF0 > | < / span > < span class = cF3 > DOCEF_FILTER_SKIP< / span > < span class = cF0 > )< / span > < span class = cF7 > )< / span > < span class = cF0 > & &
< a name = "l108" > < / a > !< / span > < span class = cF7 > (< / span > < span class = cF0 > doc_e-> type & < / span > < span class = cF3 > DOCG_BL_IV_UL< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l109" > < / a > {
< a name = "l110" > < / a > count += < / span > < span class = cF5 > StrLen< / span > < span class = cF0 > (doc_e-> tag);
< a name = "l111" > < / 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_PLAIN_TEXT< / span > < span class = cF0 > | < / span > < span class = cF3 > DOCF_PLAIN_TEXT_TABS< / span > < span class = cF0 > )< / span > < span class = cF7 > )< / span > < span class = cF0 > || doc-> flags & < / span > < span class = cF3 > DOCF_DBL_DOLLARS< / span > < span class = cF0 > )
< a name = "l112" > < / a > count += < / span > < span class = cF5 > StrOcc< / span > < span class = cF0 > (doc_e-> tag, < / span > < span class = cF6 > '$'< / span > < span class = cF0 > );
< a name = "l113" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
< a name = "l114" > < / a > }
2021-07-03 05:07:57 +01:00
< a name = "l115" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l116" > < / a > < / span > < span class = cF1 > default< / span > < span class = cF0 > :
< a name = "l117" > < / a > st = < / span > < span class = cF5 > Doc2PlainText< / span > < span class = cF0 > (doc, doc_e);
< a name = "l118" > < / a > count += < / span > < span class = cF5 > StrLen< / span > < span class = cF0 > (st) + < / span > < span class = cFE > 2< / span > < span class = cF0 > ;
< a name = "l119" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (st);
< a name = "l120" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l121" > < / a > }
< a name = "l122" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l123" > < / a > < / span > < span class = cF1 > for< / span > < span class = cF0 > (b = doc-> bin_head.next; b != & doc-> bin_head; b = b-> next)
< a name = "l124" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (b-> use_count > b-> tmp_use_count)
< a name = "l125" > < / a > count += < / span > < span class = cF1 > offset< / span > < span class = cF0 > (< / span > < span class = cF9 > CDocBin< / span > < span class = cF0 > .< / span > < span class = cF1 > end< / span > < span class = cF0 > ) - < / span > < span class = cF1 > offset< / span > < span class = cF0 > (< / span > < span class = cF9 > CDocBin< / span > < span class = cF0 > .< / span > < span class = cF1 > start< / span > < span class = cF0 > ) + b-> size;
< a name = "l126" > < / a > res = < / span > < span class = cF5 > MAlloc< / span > < span class = cF0 > (count);
< a name = "l127" > < / a > dst = res;
< a name = "l128" > < / a > doc_e = doc-> head.next;
< a name = "l129" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (doc_e != doc)
< a name = "l130" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l131" > < / a > doc_e1 = doc_e-> next;
< a name = "l132" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!< / span > < span class = cF5 > Bt< / span > < span class = cF7 > (< / span > < span class = cFB > doldoc< / span > < span class = cF0 > .type_flags_data, doc_e-> type_u8< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l133" > < / a > < / span > < span class = cF1 > switch< / span > < span class = cF0 > (doc_e-> type_u8)
< a name = "l134" > < / a > {
< a name = "l135" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > DOCT_CURSOR< / span > < span class = cF0 > :
< a name = "l136" > < / a > < / span > < span class = cF5 > DocEntryDel< / span > < span class = cF0 > (doc, doc_e);
< a name = "l137" > < / a > *dst++ = < / span > < span class = cF3 > CH_CURSOR< / span > < span class = cF0 > ;
< a name = "l138" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l139" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l140" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > DOCT_TAB< / span > < span class = cF0 > :
< a name = "l141" > < / a > *dst++ = < / span > < span class = cF6 > '\t'< / span > < span class = cF0 > ;
< a name = "l142" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l143" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l144" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > DOCT_NEW_LINE< / span > < span class = cF0 > :
< a name = "l145" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (doc-> flags & < / span > < span class = cF3 > DOCF_CARRIAGE_RETURN< / span > < span class = cF0 > )
< a name = "l146" > < / a > *dst++ = < / span > < span class = cF6 > '\r'< / span > < span class = cF0 > ;
< a name = "l147" > < / a > *dst++ = < / span > < span class = cF6 > '\n'< / span > < span class = cF0 > ;
< a name = "l148" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l149" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l150" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > DOCT_SOFT_NEW_LINE< / span > < span class = cF0 > :
< a name = "l151" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l152" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l153" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > DOCT_TEXT< / span > < span class = cF0 > :
< a name = "l154" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!< / span > < span class = cF7 > (< / span > < span class = cF0 > doc_e-> de_flags &
< a name = "l155" > < / a > ~(< / span > < span class = cF3 > DOCEF_TAG< / span > < span class = cF0 > | < / span > < span class = cF3 > DOCG_BL_IV_UL< / span > < span class = cF0 > | < / span > < span class = cF3 > DOCEF_WORD_WRAP< / span > < span class = cF0 > | < / span > < span class = cF3 > DOCEF_HIGHLIGHT< / span > < span class = cF0 > | < / span > < span class = cF3 > DOCEF_SKIP< / span > < span class = cF0 > | < / span > < span class = cF3 > DOCEF_FILTER_SKIP< / span > < span class = cF0 > )< / span > < span class = cF7 > )< / span > < span class = cF0 > & &
< a name = "l156" > < / a > !< / span > < span class = cF7 > (< / span > < span class = cF0 > doc_e-> type & < / span > < span class = cF3 > DOCG_BL_IV_UL< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l157" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l158" > < / a > src = doc_e-> tag;
< a name = "l159" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (ch = *src++)
< a name = "l160" > < / a > {
< a name = "l161" > < / a > *dst++ = ch;
< a name = "l162" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (ch == < / span > < span class = cF6 > '$'< / span > < span class = cF0 > & & < / span > < span class = cF7 > (< / span > < span class = cF0 > !(doc-> flags & < / span > < span class = cF7 > (< / span > < span class = cF3 > DOCF_PLAIN_TEXT< / span > < span class = cF0 > | < / span > < span class = cF3 > DOCF_PLAIN_TEXT_TABS< / span > < span class = cF7 > )< / span > < span class = cF0 > ) ||
< a name = "l163" > < / a > doc-> flags & < / span > < span class = cF3 > DOCF_DBL_DOLLARS< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l164" > < / a > *dst++ = ch;
< a name = "l165" > < / a > }
< a name = "l166" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
< a name = "l167" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l168" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l169" > < / a > < / span > < span class = cF1 > default< / span > < span class = cF0 > :
< a name = "l170" > < / a > *dst++ = < / span > < span class = cF6 > '$'< / span > < span class = cF0 > ;
< a name = "l171" > < / a > st = < / span > < span class = cF5 > Doc2PlainText< / span > < span class = cF0 > (doc, doc_e);
< a name = "l172" > < / a > < / span > < span class = cF5 > StrCopy< / span > < span class = cF0 > (dst, st);
< a name = "l173" > < / a > dst += < / span > < span class = cF5 > StrLen< / span > < span class = cF0 > (st);
< a name = "l174" > < / a > *dst++ = < / span > < span class = cF6 > '$'< / span > < span class = cF0 > ;
< a name = "l175" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (st);
< a name = "l176" > < / a > }
< a name = "l177" > < / a > doc_e = doc_e1;
< a name = "l178" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l179" > < / a > *dst++ = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l180" > < / a > b = doc-> bin_head.next;
< a name = "l181" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (b != & doc-> bin_head)
< a name = "l182" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l183" > < / a > < / span > < span class = cF1 > do< / span > < span class = cF0 >
< a name = "l184" > < / a > {
< a name = "l185" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (b-> use_count > b-> tmp_use_count)
< a name = "l186" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l187" > < / a > < / span > < span class = cF5 > MemCopy< / span > < span class = cF0 > (dst, & b-> < / span > < span class = cF1 > start< / span > < span class = cF0 > , < / span > < span class = cF1 > offset< / span > < span class = cF7 > (< / span > < span class = cF9 > CDocBin< / span > < span class = cF0 > .< / span > < span class = cF1 > end< / span > < span class = cF7 > )< / span > < span class = cF0 > - < / span > < span class = cF1 > offset< / span > < span class = cF7 > (< / span > < span class = cF9 > CDocBin< / span > < span class = cF0 > .< / span > < span class = cF1 > start< / span > < span class = cF7 > )< / span > < span class = cF0 > );
< a name = "l188" > < / a > dst += < / span > < span class = cF1 > offset< / span > < span class = cF0 > (< / span > < span class = cF9 > CDocBin< / span > < span class = cF0 > .< / span > < span class = cF1 > end< / span > < span class = cF0 > ) - < / span > < span class = cF1 > offset< / span > < span class = cF0 > (< / span > < span class = cF9 > CDocBin< / span > < span class = cF0 > .< / span > < span class = cF1 > start< / span > < span class = cF0 > );
< a name = "l189" > < / a > < / span > < span class = cF5 > MemCopy< / span > < span class = cF0 > (dst, b-> data, b-> size);
< a name = "l190" > < / a > dst += b-> size;
< a name = "l191" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l192" > < / a > b = b-> next;
< a name = "l193" > < / a > }
< a name = "l194" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (b != & doc-> bin_head);
2021-07-03 05:07:57 +01:00
< a name = "l195" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l196" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l197" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l198" > < / a > count--; < / span > < span class = cF2 > //No terminator< / span > < span class = cF0 >
< a name = "l199" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (_size)
< a name = "l200" > < / a > *_size = count;
< a name = "l201" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (unlock)
< a name = "l202" > < / a > < / span > < span class = cF5 > DocUnlock< / span > < span class = cF0 > (doc);
2021-07-03 05:07:57 +01:00
< a name = "l203" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l204" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > res;
2021-07-03 05:07:57 +01:00
< a name = "l205" > < / a > }
< a name = "l206" > < / a >
< a name = "l207" > < / a > < / span > < span class = cF1 > public< / span > < span class = cF0 > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > < / span > < span class = cF5 > DocWrite< / span > < span class = cF0 > (< / span > < span class = cF9 > CDoc< / span > < span class = cF0 > *doc, < / span > < span class = cF1 > Bool< / span > < span class = cF0 > prompt=< / span > < span class = cF3 > FALSE< / span > < span class = cF0 > )
< a name = "l208" > < / a > {< / span > < span class = cF2 > //Store doc to disk.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l209" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > size;
< a name = "l210" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > *buf;
2021-07-03 05:07:57 +01:00
< a name = "l211" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l212" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (prompt & & !< / span > < span class = cF5 > DocForm< / span > < span class = cF7 > (< / span > < span class = cF0 > & doc-> filename< / span > < span class = cF7 > )< / span > < span class = cF0 > || doc-> filename.name[< / span > < span class = cFE > 0< / span > < span class = cF0 > ] == < / span > < span class = cF6 > 'A'< / span > < span class = cF0 > & & doc-> filename.name[< / span > < span class = cFE > 2< / span > < span class = cF0 > ] == < / span > < span class = cF6 > ':'< / span > < span class = cF0 > )
< a name = "l213" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > ; < / span > < span class = cF2 > //CANCEL || LK_DOC,LK_DOC_ANCHOR,LK_DOC_FIND,LK_DOC_LINE?< / span > < span class = cF0 >
< a name = "l214" > < / a > buf = < / span > < span class = cF5 > DocSave< / span > < span class = cF0 > (doc, & size);
< a name = "l215" > < / a > < / span > < span class = cF5 > FileWrite< / span > < span class = cF0 > (doc-> filename.name, buf, size, < / span > < span class = cFE > 0< / span > < span class = cF0 > , doc-> file_attr);
< a name = "l216" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (buf);
2021-07-03 05:07:57 +01:00
< a name = "l217" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l218" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l219" > < / a > }
< a name = "l220" > < / a >
< a name = "l221" > < / a > #< / span > < span class = cF1 > help_index< / span > < span class = cF0 > < / span > < span class = cF6 > " DolDoc" < / span > < span class = cF0 >
< a name = "l222" > < / a > < / span > < span class = cF1 > public< / span > < span class = cF0 > < / span > < span class = cF1 > U0< / span > < span class = cF0 > < / span > < span class = cF5 > DocInsDoc< / 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 > CDoc< / span > < span class = cF0 > *doc2)
< a name = "l223" > < / a > {< / span > < span class = cF2 > //Insert copy of doc2 into doc at insert pt, cur_entry.< / span > < span class = cF0 >
2021-07-26 20:29:49 +01:00
< a name = "l224" > < / a > < / span > < span class = cF2 > //TODO: < / span > < a href = "https://zeal-operating-system.github.io/ZealOS/System/DolDoc/DocNew.CC.html#l261" > < span class = cF4 > DocReset< / span > < / a > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l225" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > *dst;
< a name = "l226" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > unlock_doc, unlock_doc2 = < / span > < span class = cF5 > DocLock< / span > < span class = cF0 > (doc2);
< a name = "l227" > < / a > < / span > < span class = cF9 > CDocEntry< / span > < span class = cF0 > *doc_ne, *doc_e = doc2-> head.next, *doc_ce;
2021-07-03 05:07:57 +01:00
< a name = "l228" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l229" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!doc)
< a name = "l230" > < / a > doc = < / span > < span class = cF5 > DocPut< / span > < span class = cF0 > ;
< a name = "l231" > < / a > unlock_doc = < / span > < span class = cF5 > DocLock< / span > < span class = cF0 > (doc), < / span > < span class = cF5 > DocRemSoftNewLines< / span > < span class = cF0 > (doc, < / span > < span class = cF3 > NULL< / span > < span class = cF0 > );
< a name = "l232" > < / a > doc_ce = doc-> cur_entry;
< a name = "l233" > < / 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-> min_col)
< a name = "l234" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l235" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (doc-> cur_col < doc_ce-> max_col)
< a name = "l236" > < / a > {
< a name = "l237" > < / a > dst = doc_ce-> tag + doc-> cur_col;
< a name = "l238" > < / a > doc_ne = < / span > < span class = cF5 > DocEntryNewTag< / span > < span class = cF0 > (doc, doc_ce, dst);
< a name = "l239" > < / a > *dst = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l240" > < / 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 = "l241" > < / a > doc_ce-> max_col = doc-> cur_col;
< a name = "l242" > < / a > < / span > < span class = cF5 > QueueInsert< / span > < span class = cF0 > (doc_ne, doc_ce);
< a name = "l243" > < / a > doc-> cur_entry = doc_ne;
< a name = "l244" > < / a > doc-> cur_col = doc_ne-> min_col;
< a name = "l245" > < / a > }
< a name = "l246" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l247" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (doc_ce != doc)
< a name = "l248" > < / a > doc-> cur_entry = doc_ce-> next;
< a name = "l249" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l250" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (doc_e != doc2)
< a name = "l251" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l252" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (doc_e-> type_u8 != < / span > < span class = cF3 > DOCT_SOFT_NEW_LINE< / span > < span class = cF0 > )
< a name = "l253" > < / a > {
< a name = "l254" > < / a > doc_ne = < / span > < span class = cF5 > DocEntryCopy< / span > < span class = cF0 > (doc, doc_e);
< a name = "l255" > < / a > < / span > < span class = cF5 > QueueInsert< / span > < span class = cF0 > (doc_ne, doc-> cur_entry-> last);
< a name = "l256" > < / a > }
< a name = "l257" > < / a > doc_e = doc_e-> next;
< a name = "l258" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l259" > < / a > < / span > < span class = cF5 > DocRecalc< / span > < span class = cF0 > (doc);
< a name = "l260" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (unlock_doc2)
< a name = "l261" > < / a > < / span > < span class = cF5 > DocUnlock< / span > < span class = cF0 > (doc2);
< a name = "l262" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (unlock_doc)
< a name = "l263" > < / a > < / span > < span class = cF5 > DocUnlock< / span > < span class = cF0 > (doc);
2021-07-03 05:07:57 +01:00
< a name = "l264" > < / a > }
< a name = "l265" > < / a >
< a name = "l266" > < / a > #< / span > < span class = cF1 > help_index< / span > < span class = cF0 > < / span > < span class = cF6 > " DolDoc/Compiler;Compiler/Directive" < / span > < span class = cF0 >
< a name = "l267" > < / a > < / span > < span class = cF1 > public< / span > < span class = cF0 > < / span > < span class = cF1 > U0< / span > < span class = cF0 > < / span > < span class = cF5 > StreamDoc< / span > < span class = cF0 > (< / span > < span class = cF9 > CDoc< / span > < span class = cF0 > *doc)
< a name = "l268" > < / a > {< / span > < span class = cF2 > //Inject doc into compile stream. Use inside #exe{}.< / span > < span class = cF0 >
2021-07-26 20:29:49 +01:00
< a name = "l269" > < / a > < / span > < span class = cF2 > //TODO: < / span > < a href = "https://zeal-operating-system.github.io/ZealOS/System/DolDoc/DocNew.CC.html#l261" > < span class = cF4 > DocReset< / span > < / a > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l270" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > unlock_doc = < / span > < span class = cF5 > DocLock< / span > < span class = cF0 > (doc);
< a name = "l271" > < / a > < / span > < span class = cF9 > CDocEntry< / span > < span class = cF0 > *doc_e = doc-> head.next;
2021-07-03 05:07:57 +01:00
< a name = "l272" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l273" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (doc_e != doc)
< a name = "l274" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l275" > < / 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 = "l276" > < / a > < / span > < span class = cF5 > StreamPrint< / span > < span class = cF0 > (< / span > < span class = cF6 > " %s" < / span > < span class = cF0 > , doc_e-> tag);
< a name = "l277" > < / 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_NEW_LINE< / span > < span class = cF0 > )
< a name = "l278" > < / a > < / span > < span class = cF5 > StreamPrint< / span > < span class = cF0 > (< / span > < span class = cF6 > " \n" < / span > < span class = cF0 > );
< a name = "l279" > < / 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 = "l280" > < / a > < / span > < span class = cF5 > StreamPrint< / span > < span class = cF0 > (< / span > < span class = cF6 > " \t" < / span > < span class = cF0 > );
< a name = "l281" > < / a > doc_e = doc_e-> next;
< a name = "l282" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l283" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (unlock_doc)
< a name = "l284" > < / a > < / span > < span class = cF5 > DocUnlock< / span > < span class = cF0 > (doc);
2021-07-03 05:07:57 +01:00
< a name = "l285" > < / a > }
< a name = "l286" > < / a >
< a name = "l287" > < / a > #< / span > < span class = cF1 > help_index< / span > < span class = cF0 > < / span > < span class = cF6 > " DolDoc" < / span > < span class = cF0 >
< a name = "l288" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > < / span > < span class = cF5 > DocCaptureUndo< / span > < span class = cF0 > (< / span > < span class = cF9 > CDoc< / span > < span class = cF0 > *doc, < / span > < span class = cF1 > Bool< / span > < span class = cF0 > force=< / span > < span class = cF3 > FALSE< / span > < span class = cF0 > )
< a name = "l289" > < / a > {
2021-07-04 23:11:34 +01:00
< a name = "l290" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > res = < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > , unlock;
< a name = "l291" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > time_stamp, flags;
< a name = "l292" > < / a > < / span > < span class = cF9 > CDocUndo< / span > < span class = cF0 > *u;
2021-07-03 05:07:57 +01:00
< a name = "l293" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l294" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (doc-> flags & < / span > < span class = cF3 > DOCF_ALLOW_UNDO< / span > < span class = cF0 > )
< a name = "l295" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l296" > < / a > unlock = < / span > < span class = cF5 > DocLock< / span > < span class = cF0 > (doc);
< a name = "l297" > < / a > time_stamp = < / span > < span class = cF5 > TSCGet< / span > < span class = cF0 > ;
< a name = "l298" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (doc-> flags & < / span > < span class = cF3 > DOCF_UNDO_DIRTY< / span > < span class = cF0 > & &
< a name = "l299" > < / a > time_stamp > doc-> undo_head.last-> time_stamp + < / span > < span class = cFB > counts< / span > < span class = cF0 > .time_stamp_freq < < < / span > < span class = cFE > 4< / span > < span class = cF0 > ||
< a name = "l300" > < / a > force)
< a name = "l301" > < / a > {
< a name = "l302" > < / a > u = < / span > < span class = cF5 > CAlloc< / span > < span class = cF0 > (< / span > < span class = cF1 > sizeof< / span > < span class = cF7 > (< / span > < span class = cF9 > CDocUndo< / span > < span class = cF7 > )< / span > < span class = cF0 > , doc-> mem_task);
< a name = "l303" > < / a > u-> time_stamp = time_stamp;
< a name = "l304" > < / a > flags = doc-> flags;
< a name = "l305" > < / a > doc-> flags & = ~< / span > < span class = cF3 > DOCF_NO_CURSOR< / span > < span class = cF0 > ;
< a name = "l306" > < / a > u-> body = < / span > < span class = cF5 > DocSave< / span > < span class = cF0 > (doc, & u-> size);
< a name = "l307" > < / a > doc-> flags = flags;
< a name = "l308" > < / a > < / span > < span class = cF5 > QueueInsert< / span > < span class = cF0 > (u, doc-> undo_head.last);
< a name = "l309" > < / a > doc-> flags & = ~< / span > < span class = cF3 > DOCF_UNDO_DIRTY< / span > < span class = cF0 > ;
< a name = "l310" > < / a > doc-> undo_count++;
< a name = "l311" > < / a > u-> doc_flags = doc-> flags;
< a name = "l312" > < / a > res = < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > ;
< a name = "l313" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (doc-> flags & < / span > < span class = cF3 > DOCF_AUTO_SAVE< / span > < span class = cF0 > )
< a name = "l314" > < / a > < / span > < span class = cF5 > DocWrite< / span > < span class = cF0 > (doc);
< a name = "l315" > < / a > }
< a name = "l316" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (unlock)
< a name = "l317" > < / a > < / span > < span class = cF5 > DocUnlock< / span > < span class = cF0 > (doc);
< a name = "l318" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l319" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > res;
2021-07-03 05:07:57 +01:00
< a name = "l320" > < / a > }
< a name = "l321" > < / a >
< a name = "l322" > < / a > < / span > < span class = cF1 > U0< / span > < span class = cF0 > < / span > < span class = cF5 > DocUndoRestore< / span > < span class = cF0 > (< / span > < span class = cF9 > CDoc< / span > < span class = cF0 > *doc)
< a name = "l323" > < / a > {
2021-07-04 23:11:34 +01:00
< a name = "l324" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > unlock = < / span > < span class = cF5 > DocLock< / span > < span class = cF0 > (doc);
< a name = "l325" > < / a > < / span > < span class = cF9 > CDocUndo< / span > < span class = cF0 > *u = doc-> undo_head.last, *u_next, *u_last;
2021-07-03 05:07:57 +01:00
< a name = "l326" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l327" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (u != & doc-> undo_head)
< a name = "l328" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l329" > < / a > < / span > < span class = cF5 > QueueRemove< / span > < span class = cF0 > (u);
< a name = "l330" > < / a > u_next = doc-> undo_head.next;
< a name = "l331" > < / a > u_last = doc-> undo_head.last;
< a name = "l332" > < / a > < / span > < span class = cF5 > QueueInit< / span > < span class = cF0 > (& doc-> undo_head);
< a name = "l333" > < / a > < / span > < span class = cF5 > DocReset< / span > < span class = cF0 > (doc, < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > );
< a name = "l334" > < / a > doc-> flags = u-> doc_flags & ~< / span > < span class = cF3 > DOCF_NO_CURSOR< / span > < span class = cF0 > ;
< a name = "l335" > < / a > < / span > < span class = cF5 > DocLoad< / span > < span class = cF0 > (doc, u-> body, u-> size);
< a name = "l336" > < / a > doc-> flags = u-> doc_flags;
< a name = "l337" > < / a > < / span > < span class = cF5 > DocUndoDel< / span > < span class = cF0 > (doc, u);
< a name = "l338" > < / a > doc-> undo_head.next = u_next;
< a name = "l339" > < / a > doc-> undo_head.last = u_last;
< a name = "l340" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l341" > < / a > < / span > < span class = cF5 > DocUndoCountSet< / span > < span class = cF0 > (doc);
< a name = "l342" > < / a > doc-> flags & = ~< / span > < span class = cF3 > DOCF_UNDO_DIRTY< / span > < span class = cF0 > ;
< a name = "l343" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (unlock)
< a name = "l344" > < / a > < / span > < span class = cF5 > DocUnlock< / span > < span class = cF0 > (doc);
2021-07-03 05:07:57 +01:00
< a name = "l345" > < / a > }
< a name = "l346" > < / a >
< a name = "l347" > < / a > #< / span > < span class = cF1 > help_index< / span > < span class = cF0 > < / span > < span class = cF6 > " Graphics/GR Files;DolDoc/Output;StdOut/DolDoc" < / span > < span class = cF0 >
< a name = "l348" > < / a > < / span > < span class = cF1 > public< / span > < span class = cF0 > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > < / span > < span class = cF5 > DocType< / 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 > *filename, < / span > < span class = cF9 > I64< / span > < span class = cF0 > trailing_new_lines=< / span > < span class = cFE > 1< / span > < span class = cF0 > )
< a name = "l349" > < / a > {< / span > < span class = cF2 > //Output txt or graphic file to document.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l350" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > res = < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > ;
< a name = "l351" > < / a > < / span > < span class = cF9 > CDoc< / span > < span class = cF0 > *doc2;
2021-07-03 05:07:57 +01:00
< a name = "l352" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l353" > < / 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 = "l354" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > ;
< a name = "l355" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > FilesFindMatch< / span > < span class = cF7 > (< / span > < span class = cF0 > filename, < / span > < span class = cF3 > FILEMASK_TXT< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l356" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l357" > < / a > doc2 = < / span > < span class = cF5 > DocRead< / span > < span class = cF0 > (filename);
< a name = "l358" > < / a > < / span > < span class = cF5 > DocInsDoc< / span > < span class = cF0 > (doc, doc2);
< a name = "l359" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > IsRaw< / span > < span class = cF0 > )
< a name = "l360" > < / a > < / span > < span class = cF5 > DocDump< / span > < span class = cF0 > (doc2, < / span > < span class = cFE > 100000< / span > < span class = cF0 > );
< a name = "l361" > < / a > < / span > < span class = cF5 > DocDel< / span > < span class = cF0 > (doc2);
< a name = "l362" > < / a > res = < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > ;
< a name = "l363" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l364" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > FilesFindMatch< / span > < span class = cF7 > (< / span > < span class = cF0 > filename, < / span > < span class = cF6 > " *.GR*" < / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l365" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l366" > < / a > < / span > < span class = cF5 > DocGR< / span > < span class = cF0 > (doc, filename);
< a name = "l367" > < / a > res = < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > ;
< a name = "l368" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l369" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (res)
< a name = "l370" > < / a > < / span > < span class = cF5 > DocPrint< / span > < span class = cF0 > (doc, < / span > < span class = cF6 > " %h*c" < / span > < span class = cF0 > , trailing_new_lines, < / span > < span class = cF6 > '\n'< / span > < span class = cF0 > );
2021-07-03 05:07:57 +01:00
< a name = "l371" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l372" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > res;
2021-07-03 05:07:57 +01:00
< a name = "l373" > < / a > }
< a name = "l374" > < / a >
< a name = "l375" > < / a > #< / span > < span class = cF1 > help_index< / span > < span class = cF0 > < / span > < span class = cF6 > " Graphics/GR Files;" < / span > < span class = cF0 > \
2021-07-04 23:11:34 +01:00
< a name = "l376" > < / a > < / span > < span class = cF6 > " File/Cmd Line (Typically);DolDoc/Cmd Line (Typically);" < / span > < span class = cF0 > \
< a name = "l377" > < / a > < / span > < span class = cF6 > " StdOut;Cmd Line (Typically)" < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l378" > < / a > < / span > < span class = cF1 > public< / span > < span class = cF0 > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > < / span > < span class = cF5 > Type< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > *filename, < / span > < span class = cF9 > I64< / span > < span class = cF0 > trailing_new_lines=< / span > < span class = cFE > 1< / span > < span class = cF0 > )
< a name = "l379" > < / a > {< / span > < span class = cF2 > //Output txt or graphic file to command line.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l380" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF5 > DocType< / span > < span class = cF0 > (, filename, trailing_new_lines);
2021-07-03 05:07:57 +01:00
< a name = "l381" > < / a > }
< a name = "l382" > < / a >
< a name = "l383" > < / a > #< / span > < span class = cF1 > help_index< / span > < span class = cF0 > < / span > < span class = cF6 > " DolDoc/File" < / span > < span class = cF0 >
< a name = "l384" > < / a >
< a name = "l385" > < / a > < / span > < span class = cF1 > public< / span > < span class = cF0 > < / span > < span class = cF1 > U8< / span > < span class = cF0 > *< / span > < span class = cF5 > DocLineRead< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > *filename, < / span > < span class = cF9 > I64< / span > < span class = cF0 > line, < / span > < span class = cF9 > CTask< / span > < span class = cF0 > *mem_task=< / span > < span class = cF3 > NULL< / span > < span class = cF0 > )
< a name = "l386" > < / a > {< / span > < span class = cF2 > //Extract line from stored doc file. (Slow.)< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l387" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > *res = < / span > < span class = cF3 > NULL< / span > < span class = cF0 > ;
< a name = "l388" > < / a > < / span > < span class = cF9 > CDoc< / span > < span class = cF0 > *doc = < / span > < span class = cF5 > DocRead< / span > < span class = cF0 > (filename, < / span > < span class = cF3 > DOCF_PLAIN_TEXT_TABS< / span > < span class = cF0 > | < / span > < span class = cF3 > DOCF_NO_CURSOR< / span > < span class = cF0 > );
2021-07-03 05:07:57 +01:00
< a name = "l389" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l390" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > DocGoToLine< / span > < span class = cF7 > (< / span > < span class = cF0 > doc, line< / span > < span class = cF7 > )< / span > < span class = cF0 > & & doc-> cur_entry-> type_u8 == < / span > < span class = cF3 > DOCT_TEXT< / span > < span class = cF0 > )
< a name = "l391" > < / a > res = < / span > < span class = cF5 > StrNew< / span > < span class = cF0 > (doc-> cur_entry-> tag, mem_task);
< a name = "l392" > < / a > < / span > < span class = cF5 > DocDel< / span > < span class = cF0 > (doc);
2021-07-03 05:07:57 +01:00
< a name = "l393" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l394" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > res;
2021-07-03 05:07:57 +01:00
< a name = "l395" > < / a > }
< a name = "l396" > < / a >
< a name = "l397" > < / a > < / span > < span class = cF1 > public< / span > < span class = cF0 > < / span > < span class = cF1 > U8< / span > < span class = cF0 > *< / span > < span class = cF5 > DocLineWrite< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > *filename, < / span > < span class = cF9 > I64< / span > < span class = cF0 > line, < / span > < span class = cF1 > U8< / span > < span class = cF0 > *st)
< a name = "l398" > < / a > {< / span > < span class = cF2 > //Write line to stored doc file. (Slow.)< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l399" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > *res = < / span > < span class = cF3 > NULL< / span > < span class = cF0 > ;
< a name = "l400" > < / a > < / span > < span class = cF9 > CDoc< / span > < span class = cF0 > *doc = < / span > < span class = cF5 > DocRead< / span > < span class = cF0 > (filename, < / span > < span class = cF3 > DOCF_PLAIN_TEXT_TABS< / span > < span class = cF0 > | < / span > < span class = cF3 > DOCF_NO_CURSOR< / span > < span class = cF0 > );
2021-07-03 05:07:57 +01:00
< a name = "l401" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l402" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > DocGoToLine< / span > < span class = cF7 > (< / span > < span class = cF0 > doc, line< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l403" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l404" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (doc-> cur_entry-> type_u8 == < / span > < span class = cF3 > DOCT_TEXT< / span > < span class = cF0 > )
< a name = "l405" > < / a > {
< a name = "l406" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (doc-> cur_entry-> tag);
< a name = "l407" > < / a > doc-> cur_entry-> tag = < / span > < span class = cF5 > StrNew< / span > < span class = cF0 > (st);
< a name = "l408" > < / a > }
< a name = "l409" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l410" > < / a > < / span > < span class = cF5 > DocPrint< / span > < span class = cF0 > (doc, < / span > < span class = cF6 > " %s" < / span > < span class = cF0 > , st);
< a name = "l411" > < / a > < / span > < span class = cF5 > DocTop< / span > < span class = cF0 > (doc);
< a name = "l412" > < / a > < / span > < span class = cF5 > DocWrite< / span > < span class = cF0 > (doc);
< a name = "l413" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l414" > < / a > < / span > < span class = cF5 > DocDel< / span > < span class = cF0 > (doc);
2021-07-03 05:07:57 +01:00
< a name = "l415" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l416" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > res;
2021-07-03 05:07:57 +01:00
< a name = "l417" > < / a > }
< / span > < / pre > < / body >
< / html >