mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-29 16: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.
199 lines
15 KiB
HTML
Executable file
199 lines
15 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>define</span><span class=cF0> TIME_FILENAME </span><span class=cF6>"~/TimeClock/TimeFile.DATA"</span><span class=cF0>
|
|
<a name="l2"></a>
|
|
<a name="l3"></a>#</span><span class=cF1>define</span><span class=cF0> TET_EOF </span><span class=cFE>0</span><span class=cF0>
|
|
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> TET_PUNCH_IN </span><span class=cFE>1</span><span class=cF0>
|
|
<a name="l5"></a>#</span><span class=cF1>define</span><span class=cF0> TET_PUNCH_OUT </span><span class=cFE>2</span><span class=cF0>
|
|
<a name="l6"></a>
|
|
<a name="l7"></a></span><span class=cF1>class</span><span class=cF0> TimeEntry
|
|
<a name="l8"></a>{
|
|
<a name="l9"></a> TimeEntry *next, *last;
|
|
<a name="l10"></a> </span><span class=cF1>U8</span><span class=cF0> type;
|
|
<a name="l11"></a> </span><span class=cF9>CDate</span><span class=cF0> datetime;
|
|
<a name="l12"></a> </span><span class=cF1>U8</span><span class=cF0> *desc;
|
|
<a name="l13"></a>};
|
|
<a name="l14"></a>
|
|
<a name="l15"></a></span><span class=cF1>U0</span><span class=cF0> TimeFileRead(TimeEntry *header)
|
|
<a name="l16"></a>{
|
|
<a name="l17"></a> </span><span class=cF1>U8</span><span class=cF0> *buf, *ptr;
|
|
<a name="l18"></a> </span><span class=cF9>I64</span><span class=cF0> type;
|
|
<a name="l19"></a> TimeEntry *tmpt;
|
|
<a name="l20"></a>
|
|
<a name="l21"></a> buf = </span><span class=cF5>FileRead</span><span class=cF0>(TIME_FILENAME);
|
|
<a name="l22"></a> </span><span class=cF1>if</span><span class=cF0> (!buf)
|
|
<a name="l23"></a> buf = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l24"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(header);
|
|
<a name="l25"></a> ptr = buf;
|
|
<a name="l26"></a> </span><span class=cF1>while</span><span class=cF0> (type = *ptr++)
|
|
<a name="l27"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l28"></a> tmpt = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>TimeEntry</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l29"></a> tmpt->type = type;
|
|
<a name="l30"></a> tmpt->datetime = *ptr(</span><span class=cF9>CDate</span><span class=cF0> *)++;
|
|
<a name="l31"></a> tmpt->desc = </span><span class=cF5>StrNew</span><span class=cF0>(ptr);
|
|
<a name="l32"></a> ptr += </span><span class=cF5>StrLen</span><span class=cF0>(ptr) + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l33"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpt, header->last);
|
|
<a name="l34"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l35"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
|
|
<a name="l36"></a>}
|
|
<a name="l37"></a>
|
|
<a name="l38"></a></span><span class=cF1>U0</span><span class=cF0> TimeFileWrite(TimeEntry *header)
|
|
<a name="l39"></a>{
|
|
<a name="l40"></a> </span><span class=cF1>U8</span><span class=cF0> *buf, *ptr;
|
|
<a name="l41"></a> TimeEntry *tmpt;
|
|
<a name="l42"></a> </span><span class=cF9>I64</span><span class=cF0> size = </span><span class=cFE>1</span><span class=cF0>; </span><span class=cF2>//for EOF</span><span class=cF0>
|
|
<a name="l43"></a>
|
|
<a name="l44"></a> tmpt = header->next;
|
|
<a name="l45"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt != header)
|
|
<a name="l46"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l47"></a> size += </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0>) + </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CDate</span><span class=cF0>) + </span><span class=cF5>StrLen</span><span class=cF0>(tmpt->desc) + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l48"></a> tmpt = tmpt->next;
|
|
<a name="l49"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l50"></a> buf = </span><span class=cF5>MAlloc</span><span class=cF0>(size);
|
|
<a name="l51"></a>
|
|
<a name="l52"></a> ptr = buf;
|
|
<a name="l53"></a> tmpt = header->next;
|
|
<a name="l54"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt != header)
|
|
<a name="l55"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l56"></a> *ptr+ += tmpt->type;
|
|
<a name="l57"></a> *ptr(</span><span class=cF9>CDate</span><span class=cF0> *)++ = tmpt->datetime;
|
|
<a name="l58"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(ptr, tmpt->desc);
|
|
<a name="l59"></a> ptr += </span><span class=cF5>StrLen</span><span class=cF0>(tmpt->desc) + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l60"></a> tmpt = tmpt->next;
|
|
<a name="l61"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l62"></a> *ptr = TET_EOF;
|
|
<a name="l63"></a> </span><span class=cF5>FileWrite</span><span class=cF0>(TIME_FILENAME, buf, size);
|
|
<a name="l64"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
|
|
<a name="l65"></a>}
|
|
<a name="l66"></a>
|
|
<a name="l67"></a></span><span class=cF1>U0</span><span class=cF0> TimeEntriesDel(TimeEntry *header)
|
|
<a name="l68"></a>{
|
|
<a name="l69"></a> TimeEntry *tmpt = header->next, *tmpt1;
|
|
<a name="l70"></a>
|
|
<a name="l71"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt != header)
|
|
<a name="l72"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l73"></a> tmpt1 = tmpt->next;
|
|
<a name="l74"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpt->desc);
|
|
<a name="l75"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpt);
|
|
<a name="l76"></a> tmpt = tmpt1;
|
|
<a name="l77"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l78"></a> </span><span class=cF5>Free</span><span class=cF0>(header);
|
|
<a name="l79"></a>}
|
|
<a name="l80"></a>
|
|
<a name="l81"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> TimeRep(TimeEntry **_header=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
<a name="l82"></a>{
|
|
<a name="l83"></a> </span><span class=cF1>Bool</span><span class=cF0> is_in = </span><span class=cF3>FALSE</span><span class=cF0>, first = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l84"></a> </span><span class=cF9>I64</span><span class=cF0> week, cur_week = -</span><span class=cFE>1</span><span class=cF0>, week_total;
|
|
<a name="l85"></a> TimeEntry *tmpt, *header = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>TimeEntry</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l86"></a>
|
|
<a name="l87"></a> </span><span class=cF1>if</span><span class=cF0> (_header)
|
|
<a name="l88"></a> *_header = header;
|
|
<a name="l89"></a> TimeFileRead(header);
|
|
<a name="l90"></a> tmpt = header->next;
|
|
<a name="l91"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt != header)
|
|
<a name="l92"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l93"></a> week = tmpt->datetime.date / </span><span class=cFE>7</span><span class=cF0>; </span><span class=cF2>//TODO</span><span class=cF0>
|
|
<a name="l94"></a> </span><span class=cF1>if</span><span class=cF0> (week != cur_week)
|
|
<a name="l95"></a> {
|
|
<a name="l96"></a> </span><span class=cF1>if</span><span class=cF0> (!first)
|
|
<a name="l97"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l98"></a> </span><span class=cF1>if</span><span class=cF0> (is_in)
|
|
<a name="l99"></a> week_total += </span><span class=cF5>Now</span><span class=cF0>;
|
|
<a name="l100"></a> </span><span class=cF6>"Week Total:%T\n"</span><span class=cF0>, week_total - </span><span class=cFB>local_time_offset</span><span class=cF0>;
|
|
<a name="l101"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l102"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l103"></a> first = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l104"></a> cur_week = week;
|
|
<a name="l105"></a> week_total = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l106"></a> }
|
|
<a name="l107"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt->type == TET_PUNCH_IN)
|
|
<a name="l108"></a> {
|
|
<a name="l109"></a> </span><span class=cF6>"$RED$IN "</span><span class=cF0>;
|
|
<a name="l110"></a> </span><span class=cF1>if</span><span class=cF0> (!is_in)
|
|
<a name="l111"></a> week_total -= tmpt->datetime;
|
|
<a name="l112"></a> is_in = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l113"></a> }
|
|
<a name="l114"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l115"></a> {
|
|
<a name="l116"></a> </span><span class=cF6>"$RED$OUT"</span><span class=cF0>;
|
|
<a name="l117"></a> </span><span class=cF1>if</span><span class=cF0> (is_in)
|
|
<a name="l118"></a> week_total += tmpt->datetime;
|
|
<a name="l119"></a> is_in = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l120"></a> }
|
|
<a name="l121"></a> </span><span class=cF6>" %D %T:$FG$\n%s\n"</span><span class=cF0>, tmpt->datetime, tmpt->datetime, tmpt->desc;
|
|
<a name="l122"></a> tmpt = tmpt->next;
|
|
<a name="l123"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l124"></a> </span><span class=cF1>if</span><span class=cF0> (is_in)
|
|
<a name="l125"></a> week_total += </span><span class=cF5>Now</span><span class=cF0>;
|
|
<a name="l126"></a> </span><span class=cF6>"$RED$Week Total:%T$FG$\n"</span><span class=cF0>, week_total - </span><span class=cFB>local_time_offset</span><span class=cF0>;
|
|
<a name="l127"></a> </span><span class=cF1>if</span><span class=cF0> (!_header)
|
|
<a name="l128"></a> TimeEntriesDel(header);
|
|
<a name="l129"></a> </span><span class=cF1>return</span><span class=cF0> is_in;
|
|
<a name="l130"></a>}
|
|
<a name="l131"></a>
|
|
<a name="l132"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> PunchOut()
|
|
<a name="l133"></a>{
|
|
<a name="l134"></a> TimeEntry *tmpt, *header;
|
|
<a name="l135"></a>
|
|
<a name="l136"></a> </span><span class=cF1>if</span><span class=cF0> (!TimeRep</span><span class=cF7>(</span><span class=cF0>&header</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l137"></a> </span><span class=cF6>"$BK,1$Already Punched-Out$BK,0$\n"</span><span class=cF0>;
|
|
<a name="l138"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l139"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l140"></a> tmpt = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>TimeEntry</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l141"></a> tmpt->type = TET_PUNCH_OUT;
|
|
<a name="l142"></a> tmpt->datetime = </span><span class=cF5>Now</span><span class=cF0>;
|
|
<a name="l143"></a> </span><span class=cF6>"\nEnter Description.\nPress <ESC> when done.\n"</span><span class=cF0>;
|
|
<a name="l144"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpt->desc = </span><span class=cF5>StrGet</span><span class=cF0>(,, </span><span class=cF3>SGF_WITH_NEW_LINE</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l145"></a> tmpt->desc = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l146"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpt, header->last);
|
|
<a name="l147"></a> TimeFileWrite(header);
|
|
<a name="l148"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l149"></a> TimeEntriesDel(header);
|
|
<a name="l150"></a>}
|
|
<a name="l151"></a>
|
|
<a name="l152"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> PunchIn()
|
|
<a name="l153"></a>{
|
|
<a name="l154"></a> TimeEntry *tmpt, *header;
|
|
<a name="l155"></a>
|
|
<a name="l156"></a> </span><span class=cF1>if</span><span class=cF0> (TimeRep</span><span class=cF7>(</span><span class=cF0>&header</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l157"></a> </span><span class=cF6>"$BK,1$Already Punched-In$BK,0$\n"</span><span class=cF0>;
|
|
<a name="l158"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l159"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l160"></a> tmpt=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>TimeEntry</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l161"></a> tmpt->type = TET_PUNCH_IN;
|
|
<a name="l162"></a> tmpt->datetime = </span><span class=cF5>Now</span><span class=cF0>;
|
|
<a name="l163"></a> </span><span class=cF6>"\nEnter Description.\nPress <ESC> when done.\n"</span><span class=cF0>;
|
|
<a name="l164"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpt->desc = </span><span class=cF5>StrGet</span><span class=cF0>(,, </span><span class=cF3>SGF_WITH_NEW_LINE</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l165"></a> tmpt->desc = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l166"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpt, header->last);
|
|
<a name="l167"></a> TimeFileWrite(header);
|
|
<a name="l168"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l169"></a> TimeEntriesDel(header);
|
|
<a name="l170"></a>}
|
|
</span></pre></body>
|
|
</html>
|