mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-28 08:16:31 +00:00
112 lines
11 KiB
HTML
Executable file
112 lines
11 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.14">
|
|
<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=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> DocProfile(</span><span class=cF1>U8</span><span class=cF0> *filename,</span><span class=cF9>I64</span><span class=cF0> flags)
|
|
<a name="l2"></a>{
|
|
<a name="l3"></a> </span><span class=cF9>I64</span><span class=cF0> i,
|
|
<a name="l4"></a> *cmd_stats = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0> * </span><span class=cF3>DOCT_TYPES_NUM</span><span class=cF0>),
|
|
<a name="l5"></a> *flags_stats = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0> * </span><span class=cFE>64</span><span class=cF0>),
|
|
<a name="l6"></a> *type_flags_stats = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0> * </span><span class=cFE>64</span><span class=cF0>);
|
|
<a name="l7"></a> </span><span class=cF2>//Note: word wrap is determined by</span><span class=cF0>
|
|
<a name="l8"></a> </span><span class=cF2>//doc->win_task when a </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l1502"><span class=cF4>CDoc</span></a><span class=cF2> is recalculated</span><span class=cF0>
|
|
<a name="l9"></a> </span><span class=cF2>//use </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>().</span><span class=cF0>
|
|
<a name="l10"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc = </span><span class=cF5>DocRead</span><span class=cF0>(filename, flags);
|
|
<a name="l11"></a>
|
|
<a name="l12"></a> </span><span class=cF2>//doc->head which is equ to doc is the</span><span class=cF0>
|
|
<a name="l13"></a> </span><span class=cF2>//header of the CQueue and represents the end-of-file marker.</span><span class=cF0>
|
|
<a name="l14"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e = doc->head.next;
|
|
<a name="l15"></a>
|
|
<a name="l16"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != doc)
|
|
<a name="l17"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l18"></a> cmd_stats[doc_e->type_u8]++;
|
|
<a name="l19"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFE>64</span><span class=cF0>; i++)
|
|
<a name="l20"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&doc_e->de_flags, i</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l21"></a> flags_stats[i]++;
|
|
<a name="l22"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>16</span><span class=cF0>; i < </span><span class=cFE>32</span><span class=cF0>; i++)
|
|
<a name="l23"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&doc_e->type, i</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l24"></a> type_flags_stats[i]++;
|
|
<a name="l25"></a> doc_e = doc_e->next;
|
|
<a name="l26"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l27"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
|
|
<a name="l28"></a>
|
|
<a name="l29"></a> </span><span class=cF6>"$PURPLE$-------%s-------\n"</span><span class=cF0>, filename;
|
|
<a name="l30"></a> </span><span class=cF6>"$GREEN$The lowest byte of the 32-bit 'doc_e->type', "</span><span class=cF0>
|
|
<a name="l31"></a> </span><span class=cF6>"'$PURPLE$doc_e->type.u8[0]$GREEN$', "</span><span class=cF0>
|
|
<a name="l32"></a> </span><span class=cF6>"is cmd and accessed with the union "</span><span class=cF0>
|
|
<a name="l33"></a> </span><span class=cF6>"'$PURPLE$doc_e->type_u8$GREEN$'. "</span><span class=cF0>
|
|
<a name="l34"></a> </span><span class=cF6>"See $LK,\"CDocEntry\",A=\"MN:CDocEntry\"$, "</span><span class=cF0>
|
|
<a name="l35"></a> </span><span class=cF6>"$LK,\"Doc Type Defines\",A=\"MN:DOCT_TEXT\"$ and "</span><span class=cF0>
|
|
<a name="l36"></a> </span><span class=cF6>"$LK,\"Doc Type Codes\","</span><span class=cF0>
|
|
<a name="l37"></a> </span><span class=cF6>"A=\"FF:::/System/DolDoc/DocInit.CC,ST_DOC_CMDS\"$.\n"</span><span class=cF0>
|
|
<a name="l38"></a> </span><span class=cF6>"$FG$"</span><span class=cF0>;
|
|
<a name="l39"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cF3>DOCT_TYPES_NUM</span><span class=cF0>; i++)
|
|
<a name="l40"></a> </span><span class=cF1>if</span><span class=cF0> (cmd_stats[i])
|
|
<a name="l41"></a> </span><span class=cF6>"%4Z:%d\n"</span><span class=cF0>, i, </span><span class=cF6>"ST_DOC_CMDS"</span><span class=cF0>, cmd_stats[i];
|
|
<a name="l42"></a>
|
|
<a name="l43"></a> </span><span class=cF6>"\n$GREEN$'$PURPLE$doc_e->type.u8[1]$GREEN$' is "</span><span class=cF0>
|
|
<a name="l44"></a> </span><span class=cF6>"the screen color attr of the "</span><span class=cF0>
|
|
<a name="l45"></a> </span><span class=cF6>"entry. '$PURPLE$doc_e->type.u16[1]"</span><span class=cF0>
|
|
<a name="l46"></a> </span><span class=cF6>"$GREEN$' is some flags for blinking and "</span><span class=cF0>
|
|
<a name="l47"></a> </span><span class=cF6>"stuff. See $LK,\"Doc Type Flag "</span><span class=cF0>
|
|
<a name="l48"></a> </span><span class=cF6>"Defines\",A=\"MN:DOCET_BLINK\"$.\n$FG$"</span><span class=cF0>;
|
|
<a name="l49"></a>
|
|
<a name="l50"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>16</span><span class=cF0>; i < </span><span class=cFE>32</span><span class=cF0>; i++)
|
|
<a name="l51"></a> </span><span class=cF1>if</span><span class=cF0> (type_flags_stats[i])
|
|
<a name="l52"></a> </span><span class=cF6>"%4d:%d\n"</span><span class=cF0>, i, type_flags_stats[i];
|
|
<a name="l53"></a>
|
|
<a name="l54"></a> </span><span class=cF6>"$GREEN$\n'$PURPLE$doc_e->de_flags$GREEN$' is 64-bit. "</span><span class=cF0>
|
|
<a name="l55"></a> </span><span class=cF6>"See $LK,\"Doc Flag Defines\",A=\"MN:DOCEf_TAG\"$ and "</span><span class=cF0>
|
|
<a name="l56"></a> </span><span class=cF6>"$LK,\"Doc Flag Codes\","</span><span class=cF0>
|
|
<a name="l57"></a> </span><span class=cF6>"A=\"FF:::/System/DolDoc/DocInit.CC,ST_DOC_FLAGS\"$.\n"</span><span class=cF0>
|
|
<a name="l58"></a> </span><span class=cF6>"$FG$"</span><span class=cF0>;
|
|
<a name="l59"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFE>64</span><span class=cF0>; i++)
|
|
<a name="l60"></a> </span><span class=cF1>if</span><span class=cF0> (flags_stats[i])
|
|
<a name="l61"></a> </span><span class=cF6>"%4Z:%d\n"</span><span class=cF0>, i, </span><span class=cF6>"ST_DOC_FLAGS"</span><span class=cF0>, flags_stats[i];
|
|
<a name="l62"></a>
|
|
<a name="l63"></a> </span><span class=cF5>Free</span><span class=cF0>(cmd_stats);
|
|
<a name="l64"></a> </span><span class=cF5>Free</span><span class=cF0>(flags_stats);
|
|
<a name="l65"></a> </span><span class=cF5>PressAKey</span><span class=cF0>;
|
|
<a name="l66"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
|
<a name="l67"></a>}
|
|
<a name="l68"></a>
|
|
<a name="l69"></a></span><span class=cF2>/*See </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Training.CC.html#l174"><span class=cF4>TipOfDay</span></a><span class=cF2>.</span><span class=cF0>
|
|
<a name="l70"></a>
|
|
<a name="l71"></a></span><span class=cF2>Note: Not all </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l1326"><span class=cF4>CDocEntry</span></a><span class=cF2>'s are full-sized nodes.</span><span class=cF0>
|
|
<a name="l72"></a></span><span class=cF2>Some are </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/Memory/MAllocFree.CC.html#l391"><span class=cF4>MAlloc</span></a><span class=cF2>ed with a smaller size to save</span><span class=cF0>
|
|
<a name="l73"></a></span><span class=cF2>mem.</span><span class=cF0> </span><span class=cF2>They all have at least the size </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l1303"><span class=cF4>CDocEntryBase</span></a><span class=cF2>.</span><span class=cF0>
|
|
<a name="l74"></a>
|
|
<a name="l75"></a></span><span class=cF2>Note: </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l1326"><span class=cF4>CDocEntry</span></a><span class=cF2>'s should be alloced from the</span><span class=cF0>
|
|
<a name="l76"></a></span><span class=cF2>heap of the owning task, doc->mem_task.</span><span class=cF0>
|
|
<a name="l77"></a>
|
|
<a name="l78"></a></span><span class=cF2>The flag arrays </span><a href="https://zeal-operating-system.github.io/ZealOS/System/DolDoc/MakeDoc.CC.html#l21"><span class=cF4>doldoc.type_flags_form</span></a><span class=cF2>, etc</span><span class=cF0>
|
|
<a name="l79"></a></span><span class=cF2>are useful.</span><span class=cF0>
|
|
<a name="l80"></a></span><span class=cF2>*/</span><span class=cF0>
|
|
<a name="l81"></a>
|
|
<a name="l82"></a>DocProfile(</span><span class=cF6>"::/Doc/Welcome.DD"</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l83"></a>DocProfile(</span><span class=cF6>"::/Doc/Welcome.DD"</span><span class=cF0>, </span><span class=cF3>DOCF_PLAIN_TEXT</span><span class=cF0>);
|
|
</span></pre></body>
|
|
</html>
|