ZealOS/docs/Apps/Budget/BgtTemplate.CC.html
TomAwezome 923b700822 Change DVDImageWrite to use single buffer.
Add CAtapiWriteCmd for AHCIAtapiBlksWrite.
Remove AHCIAtapiSeek and AHCIAtapiFormat.
2021-08-15 02:23:46 -04:00

250 lines
19 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.16">
<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>U0</span><span class=cF0> BgtTemplatePurge(CBgtTemplate *tmpt)
<a name="l2"></a>{
<a name="l3"></a> CBgtEntry *tmpb, *tmpb1;
<a name="l4"></a>
<a name="l5"></a> tmpb=b_head.next;
<a name="l6"></a> </span><span class=cF1>while</span><span class=cF0> (tmpb != &amp;b_head)
<a name="l7"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l8"></a> tmpb1 = tmpb-&gt;next;
<a name="l9"></a> </span><span class=cF1>if</span><span class=cF0> (tmpb-&gt;template == tmpt)
<a name="l10"></a> {
<a name="l11"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpb);
<a name="l12"></a> BgtEntryDel2(tmpb);
<a name="l13"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpb);
<a name="l14"></a> }
<a name="l15"></a> tmpb = tmpb1;
<a name="l16"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l17"></a>}
<a name="l18"></a>
<a name="l19"></a></span><span class=cF1>U0</span><span class=cF0> BgtTemplateDel(CBgtTemplate *tmpt)
<a name="l20"></a>{
<a name="l21"></a> BgtTemplatePurge(tmpt);
<a name="l22"></a> BgtEntryDel2(&amp;tmpt-&gt;b);
<a name="l23"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpt);
<a name="l24"></a>}
<a name="l25"></a>
<a name="l26"></a></span><span class=cF1>U0</span><span class=cF0> BgtTemplateExpand(CBgtTemplate *tmpt, </span><span class=cF1>Bool</span><span class=cF0> periodic_copy=</span><span class=cF3>FALSE</span><span class=cF0>)
<a name="l27"></a>{
<a name="l28"></a> </span><span class=cF9>CDate</span><span class=cF0> d, </span><span class=cF1>start</span><span class=cF0>, </span><span class=cF1>end</span><span class=cF0>;
<a name="l29"></a> </span><span class=cF9>CDateStruct</span><span class=cF0> ds;
<a name="l30"></a> CBgtEntry *tmpb;
<a name="l31"></a> </span><span class=cF1>Bool</span><span class=cF0> first = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l32"></a>
<a name="l33"></a> </span><span class=cF1>start</span><span class=cF0> = MyStr2Date(tmpt-&gt;start_date);
<a name="l34"></a> </span><span class=cF1>end</span><span class=cF0> = MyStr2Date(tmpt-&gt;end_date);
<a name="l35"></a> tmpt-&gt;b.template = tmpt;
<a name="l36"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpt-&gt;type)
<a name="l37"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l38"></a> </span><span class=cF1>case</span><span class=cF0> BT_INTERVAL:
<a name="l39"></a> d = </span><span class=cF1>start</span><span class=cF0>;
<a name="l40"></a> </span><span class=cF1>while</span><span class=cF0> (d &lt;= </span><span class=cF1>end</span><span class=cF0>)
<a name="l41"></a> {
<a name="l42"></a> </span><span class=cF1>if</span><span class=cF0> (!first || !periodic_copy)
<a name="l43"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l44"></a> tmpb = BgtEntryCopy(&amp;tmpt-&gt;b, periodic_copy);
<a name="l45"></a> tmpb-&gt;date = d;
<a name="l46"></a> </span><span class=cF1>if</span><span class=cF0> (periodic_copy)
<a name="l47"></a> tmpb-&gt;template = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l48"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l49"></a> tmpb-&gt;type = BE_TEMPLATE_COPY;
<a name="l50"></a> BgtIns(tmpb);
<a name="l51"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l52"></a> d += tmpt-&gt;period * </span><span class=cFE>0x100000000</span><span class=cF0>;
<a name="l53"></a> first = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l54"></a> }
<a name="l55"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l56"></a>
<a name="l57"></a> </span><span class=cF1>case</span><span class=cF0> BT_MONTHLY:
<a name="l58"></a> </span><span class=cF5>Date2Struct</span><span class=cF0>(&amp;ds, </span><span class=cF1>start</span><span class=cF0>);
<a name="l59"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l60"></a> {
<a name="l61"></a> d = </span><span class=cF5>Struct2Date</span><span class=cF0>(&amp;ds);
<a name="l62"></a> </span><span class=cF1>if</span><span class=cF0> (d &lt;= </span><span class=cF1>end</span><span class=cF0>)
<a name="l63"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l64"></a> </span><span class=cF1>if</span><span class=cF0> (!first || !periodic_copy)
<a name="l65"></a> {
<a name="l66"></a> tmpb = BgtEntryCopy(&amp;tmpt-&gt;b, periodic_copy);
<a name="l67"></a> tmpb-&gt;date = d;
<a name="l68"></a> </span><span class=cF1>if</span><span class=cF0> (periodic_copy)
<a name="l69"></a> tmpb-&gt;template = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l70"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l71"></a> tmpb-&gt;type = BE_TEMPLATE_COPY;
<a name="l72"></a> BgtIns(tmpb);
<a name="l73"></a> }
<a name="l74"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l75"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l76"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l77"></a> </span><span class=cF1>if</span><span class=cF0> (++ds.mon &gt; </span><span class=cFE>12</span><span class=cF0>)
<a name="l78"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l79"></a> ds.mon = </span><span class=cFE>1</span><span class=cF0>;
<a name="l80"></a> ds.year++;
<a name="l81"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l82"></a> first = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l83"></a> }
<a name="l84"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l85"></a>
<a name="l86"></a> </span><span class=cF1>case</span><span class=cF0> BT_BIMONTHLY:
<a name="l87"></a> </span><span class=cF5>Date2Struct</span><span class=cF0>(&amp;ds, </span><span class=cF1>start</span><span class=cF0>);
<a name="l88"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l89"></a> {
<a name="l90"></a> d = </span><span class=cF5>Struct2Date</span><span class=cF0>(&amp;ds);
<a name="l91"></a> </span><span class=cF1>if</span><span class=cF0> (d &lt;= </span><span class=cF1>end</span><span class=cF0>)
<a name="l92"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l93"></a> </span><span class=cF1>if</span><span class=cF0> (!first || !periodic_copy)
<a name="l94"></a> {
<a name="l95"></a> tmpb = BgtEntryCopy(&amp;tmpt-&gt;b, periodic_copy);
<a name="l96"></a> tmpb-&gt;date = d;
<a name="l97"></a> </span><span class=cF1>if</span><span class=cF0> (periodic_copy)
<a name="l98"></a> tmpb-&gt;template = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l99"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l100"></a> tmpb-&gt;type = BE_TEMPLATE_COPY;
<a name="l101"></a> BgtIns(tmpb);
<a name="l102"></a> }
<a name="l103"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l104"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l105"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l106"></a>
<a name="l107"></a> ds.mon += </span><span class=cFE>2</span><span class=cF0>;
<a name="l108"></a> </span><span class=cF1>if</span><span class=cF0> (ds.mon &gt; </span><span class=cFE>12</span><span class=cF0>)
<a name="l109"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l110"></a> ds.mon -= </span><span class=cFE>12</span><span class=cF0>;
<a name="l111"></a> ds.year++;
<a name="l112"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l113"></a> first = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l114"></a> }
<a name="l115"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l116"></a>
<a name="l117"></a> </span><span class=cF1>case</span><span class=cF0> BT_SEMIANNUAL:
<a name="l118"></a> </span><span class=cF5>Date2Struct</span><span class=cF0>(&amp;ds, </span><span class=cF1>start</span><span class=cF0>);
<a name="l119"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l120"></a> {
<a name="l121"></a> d = </span><span class=cF5>Struct2Date</span><span class=cF0>(&amp;ds);
<a name="l122"></a> </span><span class=cF1>if</span><span class=cF0> (d &lt;= </span><span class=cF1>end</span><span class=cF0>)
<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> (!first || !periodic_copy)
<a name="l125"></a> {
<a name="l126"></a> tmpb = BgtEntryCopy(&amp;tmpt-&gt;b, periodic_copy);
<a name="l127"></a> tmpb-&gt;date = d;
<a name="l128"></a> </span><span class=cF1>if</span><span class=cF0> (periodic_copy)
<a name="l129"></a> tmpb-&gt;template = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l130"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l131"></a> tmpb-&gt;type = BE_TEMPLATE_COPY;
<a name="l132"></a> BgtIns(tmpb);
<a name="l133"></a> }
<a name="l134"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l135"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l136"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l137"></a> ds.mon += </span><span class=cFE>6</span><span class=cF0>;
<a name="l138"></a> </span><span class=cF1>if</span><span class=cF0> (ds.mon&gt;</span><span class=cFE>12</span><span class=cF0>)
<a name="l139"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l140"></a> ds.mon -= </span><span class=cFE>12</span><span class=cF0>;
<a name="l141"></a> ds.year++;
<a name="l142"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l143"></a> first = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l144"></a> }
<a name="l145"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l146"></a>
<a name="l147"></a> </span><span class=cF1>case</span><span class=cF0> BT_ANNUAL:
<a name="l148"></a> </span><span class=cF5>Date2Struct</span><span class=cF0>(&amp;ds, </span><span class=cF1>start</span><span class=cF0>);
<a name="l149"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l150"></a> {
<a name="l151"></a> d = </span><span class=cF5>Struct2Date</span><span class=cF0>(&amp;ds);
<a name="l152"></a> </span><span class=cF1>if</span><span class=cF0> (d &lt;= </span><span class=cF1>end</span><span class=cF0>)
<a name="l153"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l154"></a> </span><span class=cF1>if</span><span class=cF0> (!first || !periodic_copy)
<a name="l155"></a> {
<a name="l156"></a> tmpb = BgtEntryCopy(&amp;tmpt-&gt;b, periodic_copy);
<a name="l157"></a> tmpb-&gt;date = d;
<a name="l158"></a> </span><span class=cF1>if</span><span class=cF0> (periodic_copy)
<a name="l159"></a> tmpb-&gt;template = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l160"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l161"></a> tmpb-&gt;type = BE_TEMPLATE_COPY;
<a name="l162"></a> BgtIns(tmpb);
<a name="l163"></a> }
<a name="l164"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l165"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l166"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l167"></a> ds.year++;
<a name="l168"></a> first = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l169"></a> }
<a name="l170"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l171"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l172"></a>}
<a name="l173"></a>
<a name="l174"></a></span><span class=cF1>U0</span><span class=cF0> CBgtTemplatesExpand()
<a name="l175"></a>{
<a name="l176"></a> CBgtTemplate *tmpt = t_head.next;
<a name="l177"></a>
<a name="l178"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt != &amp;t_head)
<a name="l179"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l180"></a> BgtTemplateExpand(tmpt);
<a name="l181"></a> tmpt = tmpt-&gt;next;
<a name="l182"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l183"></a>}
<a name="l184"></a>
<a name="l185"></a>CBgtTemplate *BgtTemplatePrompt(CBgtTemplate *default_t=</span><span class=cF3>NULL</span><span class=cF0>, CBgtEntry *default_b=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l186"></a>{
<a name="l187"></a> CBgtTemplate t, *tmpt;
<a name="l188"></a> CBgtEntry *tmpb;
<a name="l189"></a>
<a name="l190"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&amp;t, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CBgtTemplate</span><span class=cF7>)</span><span class=cF0>);
<a name="l191"></a> </span><span class=cF1>if</span><span class=cF0> (default_t)
<a name="l192"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l193"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;t.</span><span class=cF1>start</span><span class=cF0>, &amp;default_t-&gt;</span><span class=cF1>start</span><span class=cF0>, BT_SIZE);
<a name="l194"></a> default_b = &amp;default_t-&gt;b;
<a name="l195"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l196"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l197"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l198"></a> t.type = BT_INTERVAL;
<a name="l199"></a> </span><span class=cF1>if</span><span class=cF0> (default_b)
<a name="l200"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(&amp;t.start_date, </span><span class=cF6>&quot;%D&quot;</span><span class=cF0>, default_b-&gt;date);
<a name="l201"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l202"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(&amp;t.start_date, </span><span class=cF6>&quot;[&quot;</span><span class=cF0>);
<a name="l203"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(&amp;t.end_date, </span><span class=cF6>&quot;]&quot;</span><span class=cF0>);
<a name="l204"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l205"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l206"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>PopUpForm</span><span class=cF7>(</span><span class=cF0>&amp;t</span><span class=cF7>)</span><span class=cF0> &amp;&amp; </span><span class=cF7>(</span><span class=cF0>(t.type == BT_INTERVAL &amp;&amp; t.period &gt; </span><span class=cFE>0</span><span class=cF0>) || t.type &gt; BT_INTERVAL</span><span class=cF7>)</span><span class=cF0>)
<a name="l207"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l208"></a> </span><span class=cF1>if</span><span class=cF0> (tmpb = BgtEntryPrompt</span><span class=cF7>(</span><span class=cF0>default_b</span><span class=cF7>)</span><span class=cF0>)
<a name="l209"></a> {
<a name="l210"></a> tmpt = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CBgtTemplate</span><span class=cF7>)</span><span class=cF0>);
<a name="l211"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;tmpt-&gt;</span><span class=cF1>start</span><span class=cF0>, &amp;t.</span><span class=cF1>start</span><span class=cF0>, BT_SIZE);
<a name="l212"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;tmpt-&gt;b, tmpb, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CBgtEntry</span><span class=cF7>)</span><span class=cF0>);
<a name="l213"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpb);
<a name="l214"></a> </span><span class=cF1>return</span><span class=cF0> tmpt;
<a name="l215"></a> }
<a name="l216"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l217"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l218"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l219"></a>
<a name="l220"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l221"></a>}
</span></pre></body>
</html>