mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-31 17:56:30 +00:00
1b75d91002
Add arg to SATARep to specify drive types to show. Add checks in AHCIPortInit to verify port signatures, add helper method to get signatures from port.
320 lines
31 KiB
HTML
Executable file
320 lines
31 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V0.13">
|
|
<style type="text/css">
|
|
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;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"DolDoc/Tree"</span><span class=cF0>
|
|
<a name="l2"></a>
|
|
<a name="l3"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DocTreeFind</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *haystack_doc, </span><span class=cF1>U8</span><span class=cF0> *needle_path, </span><span class=cF9>CDocEntry</span><span class=cF0> **_tree_entry=</span><span class=cF3>NULL</span><span class=cF0>,
|
|
<a name="l4"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> **_start_indent=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF9>CDocEntry</span><span class=cF0> **_end_indent=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
<a name="l5"></a>{</span><span class=cF2>//Find tree widget start and end.</span><span class=cF0>
|
|
<a name="l6"></a> </span><span class=cF9>I64</span><span class=cF0> i = </span><span class=cFE>0</span><span class=cF0>, k = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l7"></a> </span><span class=cF1>U8</span><span class=cF0> *st1 = </span><span class=cF5>StrNew</span><span class=cF0>(needle_path), *st2 = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>needle_path</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l8"></a> </span><span class=cF1>Bool</span><span class=cF0> res = </span><span class=cF3>FALSE</span><span class=cF0>, unlock_doc = </span><span class=cF5>DocLock</span><span class=cF0>(haystack_doc);
|
|
<a name="l9"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e = haystack_doc->head.next;
|
|
<a name="l10"></a>
|
|
<a name="l11"></a> </span><span class=cF1>if</span><span class=cF0> (_tree_entry)
|
|
<a name="l12"></a> *_tree_entry = haystack_doc;
|
|
<a name="l13"></a> </span><span class=cF1>if</span><span class=cF0> (_start_indent)
|
|
<a name="l14"></a> *_start_indent = haystack_doc;
|
|
<a name="l15"></a> </span><span class=cF1>if</span><span class=cF0> (_end_indent)
|
|
<a name="l16"></a> *_end_indent = haystack_doc;
|
|
<a name="l17"></a>
|
|
<a name="l18"></a> </span><span class=cF1>while</span><span class=cF0> (*st1 && doc_e != haystack_doc)
|
|
<a name="l19"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l20"></a> </span><span class=cF5>StrFirstRemove</span><span class=cF0>(st1, </span><span class=cF6>"/"</span><span class=cF0>, st2);
|
|
<a name="l21"></a> </span><span class=cF1>if</span><span class=cF0> (*st2)
|
|
<a name="l22"></a> {
|
|
<a name="l23"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != haystack_doc)
|
|
<a name="l24"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l25"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->type_u8 == </span><span class=cF3>DOCT_INDENT</span><span class=cF0>)
|
|
<a name="l26"></a> i += doc_e->attr;
|
|
<a name="l27"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (i == k && doc_e->de_flags & </span><span class=cF3>DOCEF_TREE</span><span class=cF0> && !</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>doc_e->tag + </span><span class=cFE>3</span><span class=cF0>, st2</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l28"></a> {
|
|
<a name="l29"></a> </span><span class=cF1>if</span><span class=cF0> (*st1)
|
|
<a name="l30"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l31"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l32"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l33"></a> </span><span class=cF1>if</span><span class=cF0> (_tree_entry)
|
|
<a name="l34"></a> *_tree_entry = doc_e;
|
|
<a name="l35"></a> i = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l36"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != haystack_doc && doc_e->type_u8 != </span><span class=cF3>DOCT_INDENT</span><span class=cF0>)
|
|
<a name="l37"></a> doc_e = doc_e->next;
|
|
<a name="l38"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e != haystack_doc)
|
|
<a name="l39"></a> {
|
|
<a name="l40"></a> i = doc_e->attr;
|
|
<a name="l41"></a> </span><span class=cF1>if</span><span class=cF0> (_start_indent)
|
|
<a name="l42"></a> *_start_indent = doc_e;
|
|
<a name="l43"></a> doc_e = doc_e->next;
|
|
<a name="l44"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != haystack_doc && i > </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l45"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l46"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->type_u8 == </span><span class=cF3>DOCT_INDENT</span><span class=cF0>)
|
|
<a name="l47"></a> {
|
|
<a name="l48"></a> i += doc_e->attr;
|
|
<a name="l49"></a> </span><span class=cF1>if</span><span class=cF0> (i <= </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l50"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l51"></a> </span><span class=cF1>if</span><span class=cF0> (_end_indent)
|
|
<a name="l52"></a> *_end_indent = doc_e;
|
|
<a name="l53"></a> res = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l54"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l55"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l56"></a> }
|
|
<a name="l57"></a> doc_e = doc_e->next;
|
|
<a name="l58"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l59"></a> }
|
|
<a name="l60"></a> </span><span class=cF1>goto</span><span class=cF0> ft_done;
|
|
<a name="l61"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l62"></a> }
|
|
<a name="l63"></a> doc_e = doc_e->next;
|
|
<a name="l64"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l65"></a> k += </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l66"></a> }
|
|
<a name="l67"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l68"></a>ft_done:
|
|
<a name="l69"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc)
|
|
<a name="l70"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(haystack_doc);
|
|
<a name="l71"></a> </span><span class=cF5>Free</span><span class=cF0>(st1);
|
|
<a name="l72"></a> </span><span class=cF5>Free</span><span class=cF0>(st2);
|
|
<a name="l73"></a>
|
|
<a name="l74"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l75"></a>}
|
|
<a name="l76"></a>
|
|
<a name="l77"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DocTreeFFind</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *name, </span><span class=cF1>U8</span><span class=cF0> *path)
|
|
<a name="l78"></a>{</span><span class=cF2>//Find tree widget in file.</span><span class=cF0>
|
|
<a name="l79"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc = </span><span class=cF5>DocRead</span><span class=cF0>(name);
|
|
<a name="l80"></a> </span><span class=cF1>Bool</span><span class=cF0> res = </span><span class=cF5>DocTreeFind</span><span class=cF0>(doc, path);
|
|
<a name="l81"></a>
|
|
<a name="l82"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
|
|
<a name="l83"></a>
|
|
<a name="l84"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l85"></a>}
|
|
<a name="l86"></a>
|
|
<a name="l87"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DocTreeMake</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF1>U8</span><span class=cF0> *path)
|
|
<a name="l88"></a>{</span><span class=cF2>//Make tree widget.</span><span class=cF0>
|
|
<a name="l89"></a> </span><span class=cF9>I64</span><span class=cF0> i = </span><span class=cFE>0</span><span class=cF0>, j = </span><span class=cF3>I64_MIN</span><span class=cF0>, k = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l90"></a> </span><span class=cF1>U8</span><span class=cF0> *st1 = </span><span class=cF5>StrNew</span><span class=cF0>(path), *st2 = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>path</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0>), *st3 = </span><span class=cF5>StrNew</span><span class=cF0>(path);
|
|
<a name="l91"></a> </span><span class=cF1>Bool</span><span class=cF0> res = </span><span class=cF3>TRUE</span><span class=cF0>, unlock_doc = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
|
|
<a name="l92"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e = doc->head.next;
|
|
<a name="l93"></a>
|
|
<a name="l94"></a> doc->cur_entry = doc;
|
|
<a name="l95"></a> doc->cur_col = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l96"></a> </span><span class=cF1>while</span><span class=cF0> (*st1 && doc_e != doc)
|
|
<a name="l97"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l98"></a> </span><span class=cF5>StrFirstRemove</span><span class=cF0>(st1, </span><span class=cF6>"/"</span><span class=cF0>, st2);
|
|
<a name="l99"></a> </span><span class=cF1>if</span><span class=cF0> (*st2)
|
|
<a name="l100"></a> {
|
|
<a name="l101"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != doc)
|
|
<a name="l102"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l103"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->type_u8 == </span><span class=cF3>DOCT_INDENT</span><span class=cF0>)
|
|
<a name="l104"></a> {
|
|
<a name="l105"></a> i += doc_e->attr;
|
|
<a name="l106"></a> </span><span class=cF1>if</span><span class=cF0> (i == j)
|
|
<a name="l107"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l108"></a> doc->cur_entry = doc_e;
|
|
<a name="l109"></a> doc->cur_col = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l110"></a> </span><span class=cF1>goto</span><span class=cF0> mt_done;
|
|
<a name="l111"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l112"></a> }
|
|
<a name="l113"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (i == k && doc_e->de_flags & </span><span class=cF3>DOCEF_TREE</span><span class=cF0> && !</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>doc_e->tag + </span><span class=cFE>3</span><span class=cF0>, st2</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l114"></a> {
|
|
<a name="l115"></a> </span><span class=cF5>Free</span><span class=cF0>(st3);
|
|
<a name="l116"></a> st3 = </span><span class=cF5>StrNew</span><span class=cF0>(st1);
|
|
<a name="l117"></a> j = i;
|
|
<a name="l118"></a> </span><span class=cF1>if</span><span class=cF0> (!*st1)
|
|
<a name="l119"></a> res = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l120"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l121"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l122"></a> }
|
|
<a name="l123"></a> doc_e = doc_e->next;
|
|
<a name="l124"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l125"></a> k += </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l126"></a> }
|
|
<a name="l127"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l128"></a>mt_done:
|
|
<a name="l129"></a> </span><span class=cF1>if</span><span class=cF0> (res)
|
|
<a name="l130"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l131"></a> </span><span class=cF1>while</span><span class=cF0> (*st3)
|
|
<a name="l132"></a> {
|
|
<a name="l133"></a> </span><span class=cF5>StrFirstRemove</span><span class=cF0>(st3, </span><span class=cF6>"/"</span><span class=cF0>, st2);
|
|
<a name="l134"></a> </span><span class=cF1>if</span><span class=cF0> (*st2)
|
|
<a name="l135"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l136"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>"$TR+C,\"%s\"$\n$ID,2$"</span><span class=cF0>, st2);
|
|
<a name="l137"></a> doc->cur_entry = </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>"$ID,-2$"</span><span class=cF0>);
|
|
<a name="l138"></a> doc->cur_col = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l139"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l140"></a> }
|
|
<a name="l141"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l142"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc)
|
|
<a name="l143"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
|
|
<a name="l144"></a> </span><span class=cF5>Free</span><span class=cF0>(st1);
|
|
<a name="l145"></a> </span><span class=cF5>Free</span><span class=cF0>(st2);
|
|
<a name="l146"></a> </span><span class=cF5>Free</span><span class=cF0>(st3);
|
|
<a name="l147"></a>
|
|
<a name="l148"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l149"></a>}
|
|
<a name="l150"></a>
|
|
<a name="l151"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DocTreeWriteJoin</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF1>U8</span><span class=cF0> *path, </span><span class=cF1>Bool</span><span class=cF0> write, </span><span class=cF1>U8</span><span class=cF0> *format, </span><span class=cF9>I64</span><span class=cF0> argc, </span><span class=cF9>I64</span><span class=cF0> *argv)
|
|
<a name="l152"></a>{</span><span class=cF2>//Rewrite doc tree branch.</span><span class=cF0>
|
|
<a name="l153"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *tree_branch, *start_indent, *end_indent;
|
|
<a name="l154"></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>, format, argc, argv);
|
|
<a name="l155"></a> </span><span class=cF1>Bool</span><span class=cF0> res, unlock_doc = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
|
|
<a name="l156"></a>
|
|
<a name="l157"></a> </span><span class=cF1>if</span><span class=cF0> (res = </span><span class=cF5>DocTreeFind</span><span class=cF7>(</span><span class=cF0>doc, path, &tree_branch, &start_indent, &end_indent</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l158"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l159"></a> </span><span class=cF5>DocCut</span><span class=cF0>(doc, start_indent->next, end_indent->last);
|
|
<a name="l160"></a> doc->cur_entry = start_indent->next;
|
|
<a name="l161"></a> doc->cur_col = doc->cur_entry->min_col;
|
|
<a name="l162"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l163"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l164"></a> </span><span class=cF5>DocTreeMake</span><span class=cF0>(doc, path);
|
|
<a name="l165"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>"%s"</span><span class=cF0>, buf);
|
|
<a name="l166"></a> </span><span class=cF1>if</span><span class=cF0> (write && </span><span class=cF5>DriveIsWritable</span><span class=cF7>(</span><span class=cF0>*doc->filename.name</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l167"></a> </span><span class=cF5>DocWrite</span><span class=cF0>(doc);
|
|
<a name="l168"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc)
|
|
<a name="l169"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
|
|
<a name="l170"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
|
|
<a name="l171"></a>
|
|
<a name="l172"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l173"></a>}
|
|
<a name="l174"></a>
|
|
<a name="l175"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DocTreeAppendJoin</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF1>U8</span><span class=cF0> *path, </span><span class=cF1>Bool</span><span class=cF0> write, </span><span class=cF1>U8</span><span class=cF0> *format, </span><span class=cF9>I64</span><span class=cF0> argc, </span><span class=cF9>I64</span><span class=cF0> *argv)
|
|
<a name="l176"></a>{</span><span class=cF2>//Append to doc tree branch.</span><span class=cF0>
|
|
<a name="l177"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *tree_branch, *start_indent, *end_indent;
|
|
<a name="l178"></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>, format, argc, argv);
|
|
<a name="l179"></a> </span><span class=cF1>Bool</span><span class=cF0> res, unlock_doc = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
|
|
<a name="l180"></a>
|
|
<a name="l181"></a> </span><span class=cF1>if</span><span class=cF0> (res = </span><span class=cF5>DocTreeFind</span><span class=cF7>(</span><span class=cF0>doc, path, &tree_branch, &start_indent, &end_indent</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l182"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l183"></a> doc->cur_entry = end_indent;
|
|
<a name="l184"></a> doc->cur_col = doc->cur_entry->min_col;
|
|
<a name="l185"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l186"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l187"></a> </span><span class=cF5>DocTreeMake</span><span class=cF0>(doc, path);
|
|
<a name="l188"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>"%s"</span><span class=cF0>, buf);
|
|
<a name="l189"></a> </span><span class=cF1>if</span><span class=cF0> (write && </span><span class=cF5>DriveIsWritable</span><span class=cF7>(</span><span class=cF0>*doc->filename.name</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l190"></a> </span><span class=cF5>DocWrite</span><span class=cF0>(doc);
|
|
<a name="l191"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc)
|
|
<a name="l192"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
|
|
<a name="l193"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
|
|
<a name="l194"></a>
|
|
<a name="l195"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l196"></a>}
|
|
<a name="l197"></a>
|
|
<a name="l198"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DocTreeWrite</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF1>U8</span><span class=cF0> *path, </span><span class=cF1>Bool</span><span class=cF0> write=</span><span class=cF3>TRUE</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> *format, ...)
|
|
<a name="l199"></a>{</span><span class=cF2>//Rewrite doc tree branch.</span><span class=cF0>
|
|
<a name="l200"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>DocTreeWriteJoin</span><span class=cF0>(doc, path, write, format, argc, argv);
|
|
<a name="l201"></a>}
|
|
<a name="l202"></a>
|
|
<a name="l203"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DocTreeAppend</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF1>U8</span><span class=cF0> *path, </span><span class=cF1>Bool</span><span class=cF0> write=</span><span class=cF3>TRUE</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> *format, ...)
|
|
<a name="l204"></a>{</span><span class=cF2>//Append to doc tree branch.</span><span class=cF0>
|
|
<a name="l205"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>DocTreeAppendJoin</span><span class=cF0>(doc, path, write, format, argc, argv);
|
|
<a name="l206"></a>}
|
|
<a name="l207"></a>
|
|
<a name="l208"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DocTreeFWrite</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *name, </span><span class=cF1>U8</span><span class=cF0> *path, </span><span class=cF1>U8</span><span class=cF0> *format, ...)
|
|
<a name="l209"></a>{</span><span class=cF2>//Rewrite doc tree branch in file.</span><span class=cF0>
|
|
<a name="l210"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc = </span><span class=cF5>DocRead</span><span class=cF0>(name);
|
|
<a name="l211"></a> </span><span class=cF1>Bool</span><span class=cF0> res = </span><span class=cF5>DocTreeWriteJoin</span><span class=cF0>(doc, path, </span><span class=cF3>TRUE</span><span class=cF0>, format, argc, argv);
|
|
<a name="l212"></a>
|
|
<a name="l213"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
|
|
<a name="l214"></a>
|
|
<a name="l215"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l216"></a>}
|
|
<a name="l217"></a>
|
|
<a name="l218"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DocTreeFAppend</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *name, </span><span class=cF1>U8</span><span class=cF0> *path, </span><span class=cF1>U8</span><span class=cF0> *format, ...)
|
|
<a name="l219"></a>{</span><span class=cF2>//Append to doc tree branch in file.</span><span class=cF0>
|
|
<a name="l220"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc = </span><span class=cF5>DocRead</span><span class=cF0>(name);
|
|
<a name="l221"></a> </span><span class=cF1>Bool</span><span class=cF0> res = </span><span class=cF5>DocTreeAppendJoin</span><span class=cF0>(doc, path, </span><span class=cF3>TRUE</span><span class=cF0>, format, argc, argv);
|
|
<a name="l222"></a>
|
|
<a name="l223"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
|
|
<a name="l224"></a>
|
|
<a name="l225"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l226"></a>}
|
|
<a name="l227"></a>
|
|
<a name="l228"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"DolDoc/Compiler;Compiler"</span><span class=cF0>
|
|
<a name="l229"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>ExeDoc</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>I64</span><span class=cF0> ccf_flags=</span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l230"></a>{</span><span class=cF2>//JIT Compile and execute a document.</span><span class=cF0>
|
|
<a name="l231"></a> </span><span class=cF9>I64</span><span class=cF0> res;
|
|
<a name="l232"></a> </span><span class=cF1>Bool</span><span class=cF0> okay = </span><span class=cF3>TRUE</span><span class=cF0>, unlock_doc=</span><span class=cF5>DocLock</span><span class=cF0>(doc);
|
|
<a name="l233"></a> </span><span class=cF9>CCompCtrl</span><span class=cF0> *cc = </span><span class=cF5>CompCtrlNew</span><span class=cF0>(, ccf_flags | </span><span class=cF3>CCF_DONT_FREE_BUF</span><span class=cF0>);
|
|
<a name="l234"></a>
|
|
<a name="l235"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0>->last_cc != &</span><span class=cF5>Fs</span><span class=cF0>->next_cc)
|
|
<a name="l236"></a> cc->opts = </span><span class=cF5>Fs</span><span class=cF0>->last_cc->opts;
|
|
<a name="l237"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(cc, </span><span class=cF5>Fs</span><span class=cF0>->last_cc);
|
|
<a name="l238"></a> </span><span class=cF5>LexAttachDoc</span><span class=cF0>(cc,, doc);
|
|
<a name="l239"></a> </span><span class=cF1>try</span><span class=cF0>
|
|
<a name="l240"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l241"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l242"></a> res = </span><span class=cF5>ExeCmdLine</span><span class=cF0>(cc);
|
|
<a name="l243"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l244"></a> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l245"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l246"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0>->except_ch == </span><span class=cF6>'Compiler'</span><span class=cF0> || </span><span class=cF5>Fs</span><span class=cF0>->except_ch == </span><span class=cF6>'Break'</span><span class=cF0>)
|
|
<a name="l247"></a> {
|
|
<a name="l248"></a> </span><span class=cF5>Fs</span><span class=cF0>->catch_except = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l249"></a> okay = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l250"></a> res = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l251"></a> }
|
|
<a name="l252"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l253"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(cc);
|
|
<a name="l254"></a> </span><span class=cF1>if</span><span class=cF0> (okay)
|
|
<a name="l255"></a> </span><span class=cF5>CompCtrlDel</span><span class=cF0>(cc); </span><span class=cF2>//TODO: can crash</span><span class=cF0>
|
|
<a name="l256"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc)
|
|
<a name="l257"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
|
|
<a name="l258"></a>
|
|
<a name="l259"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l260"></a>}
|
|
<a name="l261"></a>
|
|
<a name="l262"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"DolDoc/Tree;DolDoc/Compiler;Compiler"</span><span class=cF0>
|
|
<a name="l263"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>DocTreeExe</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF1>U8</span><span class=cF0> *path)
|
|
<a name="l264"></a>{</span><span class=cF2>//Execute doc tree branch.</span><span class=cF0>
|
|
<a name="l265"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc2;
|
|
<a name="l266"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock_doc = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
|
|
<a name="l267"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *tree_branch, *start_indent, *end_indent;
|
|
<a name="l268"></a> </span><span class=cF9>I64</span><span class=cF0> res = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l269"></a>
|
|
<a name="l270"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DocTreeFind</span><span class=cF7>(</span><span class=cF0>doc, path, &tree_branch, &start_indent, &end_indent</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l271"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l272"></a> doc2=</span><span class=cF5>DocCopy</span><span class=cF0>(doc, tree_branch, end_indent);
|
|
<a name="l273"></a> res=</span><span class=cF5>ExeDoc</span><span class=cF0>(doc2);
|
|
<a name="l274"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc2);
|
|
<a name="l275"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l276"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc)
|
|
<a name="l277"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
|
|
<a name="l278"></a>
|
|
<a name="l279"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l280"></a>}
|
|
<a name="l281"></a>
|
|
<a name="l282"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>DocTreeFExe</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *name, </span><span class=cF1>U8</span><span class=cF0> *path)
|
|
<a name="l283"></a>{</span><span class=cF2>//Execute doc tree branch in file.</span><span class=cF0>
|
|
<a name="l284"></a> </span><span class=cF9>I64</span><span class=cF0> res;
|
|
<a name="l285"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc = </span><span class=cF5>DocRead</span><span class=cF0>(name);
|
|
<a name="l286"></a>
|
|
<a name="l287"></a> res = </span><span class=cF5>DocTreeExe</span><span class=cF0>(doc, path);
|
|
<a name="l288"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
|
|
<a name="l289"></a>
|
|
<a name="l290"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l291"></a>}
|
|
</span></pre></body>
|
|
</html>
|