214 lines
16 KiB
HTML
Executable File
214 lines
16 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="generator" content="TempleOS V5.03">
|
|
<meta name="viewport" content="width=device-width">
|
|
<link rel="stylesheet" href="/style/templeos.css">
|
|
<script src="/script/templeos.js"></script>
|
|
<style type="text/css">
|
|
.cF0{color:#000000;background-color:#ffffff;}
|
|
.cF1{color:#0000aa;background-color:#ffffff;}
|
|
.cF2{color:#00aa00;background-color:#ffffff;}
|
|
.cF3{color:#00aaaa;background-color:#ffffff;}
|
|
.cF4{color:#aa0000;background-color:#ffffff;}
|
|
.cF5{color:#aa00aa;background-color:#ffffff;}
|
|
.cF6{color:#aa5500;background-color:#ffffff;}
|
|
.cF7{color:#aaaaaa;background-color:#ffffff;}
|
|
.cF8{color:#555555;background-color:#ffffff;}
|
|
.cF9{color:#5555ff;background-color:#ffffff;}
|
|
.cFA{color:#55ff55;background-color:#ffffff;}
|
|
.cFB{color:#55ffff;background-color:#ffffff;}
|
|
.cFC{color:#ff5555;background-color:#ffffff;}
|
|
.cFD{color:#ff55ff;background-color:#ffffff;}
|
|
.cFE{color:#ffff55;background-color:#ffffff;}
|
|
.cFF{color:#ffffff;background-color:#ffffff;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre id="content">
|
|
<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> tmpb=b_head.next;
|
|
<a name="l5"></a> </span><span class=cF1>while</span><span class=cF0> (tmpb!=&b_head) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l6"></a> tmpb1=tmpb->next;
|
|
<a name="l7"></a> </span><span class=cF1>if</span><span class=cF0> (tmpb->template==tmpt) {
|
|
<a name="l8"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpb);
|
|
<a name="l9"></a> BgtEntryDel2(tmpb);
|
|
<a name="l10"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpb);
|
|
<a name="l11"></a> }
|
|
<a name="l12"></a> tmpb=tmpb1;
|
|
<a name="l13"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l14"></a>}
|
|
<a name="l15"></a>
|
|
<a name="l16"></a></span><span class=cF1>U0</span><span class=cF0> BgtTemplateDel(CBgtTemplate *tmpt)
|
|
<a name="l17"></a>{
|
|
<a name="l18"></a> BgtTemplatePurge(tmpt);
|
|
<a name="l19"></a> BgtEntryDel2(&tmpt->b);
|
|
<a name="l20"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpt);
|
|
<a name="l21"></a>}
|
|
<a name="l22"></a>
|
|
<a name="l23"></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="l24"></a>{
|
|
<a name="l25"></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="l26"></a> </span><span class=cF9>CDateStruct</span><span class=cF0> ds;
|
|
<a name="l27"></a> CBgtEntry *tmpb;
|
|
<a name="l28"></a> </span><span class=cF1>Bool</span><span class=cF0> first=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l29"></a>
|
|
<a name="l30"></a> </span><span class=cF1>start</span><span class=cF0>=MyStr2Date(tmpt->start_date);
|
|
<a name="l31"></a> </span><span class=cF1>end</span><span class=cF0> =MyStr2Date(tmpt->end_date);
|
|
<a name="l32"></a> tmpt->b.template=tmpt;
|
|
<a name="l33"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpt->type) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l34"></a> </span><span class=cF1>case</span><span class=cF0> BT_INTERVAL:
|
|
<a name="l35"></a> d=</span><span class=cF1>start</span><span class=cF0>;
|
|
<a name="l36"></a> </span><span class=cF1>while</span><span class=cF0> (d<=</span><span class=cF1>end</span><span class=cF0>) {
|
|
<a name="l37"></a> </span><span class=cF1>if</span><span class=cF0> (!first || !periodic_copy) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l38"></a> tmpb=BgtEntryCopy(&tmpt->b,periodic_copy);
|
|
<a name="l39"></a> tmpb->date=d;
|
|
<a name="l40"></a> </span><span class=cF1>if</span><span class=cF0> (periodic_copy)
|
|
<a name="l41"></a> tmpb->template=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l42"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l43"></a> tmpb->type=BE_TEMPLATE_COPY;
|
|
<a name="l44"></a> BgtIns(tmpb);
|
|
<a name="l45"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l46"></a> d+=tmpt->period*0x100000000;
|
|
<a name="l47"></a> first=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l48"></a> }
|
|
<a name="l49"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l50"></a> </span><span class=cF1>case</span><span class=cF0> BT_MONTHLY:
|
|
<a name="l51"></a> </span><span class=cF5>Date2Struct</span><span class=cF0>(&ds,</span><span class=cF1>start</span><span class=cF0>);
|
|
<a name="l52"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) {
|
|
<a name="l53"></a> d=</span><span class=cF5>Struct2Date</span><span class=cF0>(&ds);
|
|
<a name="l54"></a> </span><span class=cF1>if</span><span class=cF0> (d<=</span><span class=cF1>end</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l55"></a> </span><span class=cF1>if</span><span class=cF0> (!first || !periodic_copy) {
|
|
<a name="l56"></a> tmpb=BgtEntryCopy(&tmpt->b,periodic_copy);
|
|
<a name="l57"></a> tmpb->date=d;
|
|
<a name="l58"></a> </span><span class=cF1>if</span><span class=cF0> (periodic_copy)
|
|
<a name="l59"></a> tmpb->template=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l60"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l61"></a> tmpb->type=BE_TEMPLATE_COPY;
|
|
<a name="l62"></a> BgtIns(tmpb);
|
|
<a name="l63"></a> }
|
|
<a name="l64"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l65"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l66"></a> </span><span class=cF1>if</span><span class=cF0> (++ds.mon>12) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l67"></a> ds.mon=1;
|
|
<a name="l68"></a> ds.year++;
|
|
<a name="l69"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l70"></a> first=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l71"></a> }
|
|
<a name="l72"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l73"></a> </span><span class=cF1>case</span><span class=cF0> BT_BIMONTHLY:
|
|
<a name="l74"></a> </span><span class=cF5>Date2Struct</span><span class=cF0>(&ds,</span><span class=cF1>start</span><span class=cF0>);
|
|
<a name="l75"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) {
|
|
<a name="l76"></a> d=</span><span class=cF5>Struct2Date</span><span class=cF0>(&ds);
|
|
<a name="l77"></a> </span><span class=cF1>if</span><span class=cF0> (d<=</span><span class=cF1>end</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l78"></a> </span><span class=cF1>if</span><span class=cF0> (!first || !periodic_copy) {
|
|
<a name="l79"></a> tmpb=BgtEntryCopy(&tmpt->b,periodic_copy);
|
|
<a name="l80"></a> tmpb->date=d;
|
|
<a name="l81"></a> </span><span class=cF1>if</span><span class=cF0> (periodic_copy)
|
|
<a name="l82"></a> tmpb->template=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l83"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l84"></a> tmpb->type=BE_TEMPLATE_COPY;
|
|
<a name="l85"></a> BgtIns(tmpb);
|
|
<a name="l86"></a> }
|
|
<a name="l87"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l88"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l89"></a> ds.mon+=2;
|
|
<a name="l90"></a> </span><span class=cF1>if</span><span class=cF0> (ds.mon>12) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l91"></a> ds.mon-=12;
|
|
<a name="l92"></a> ds.year++;
|
|
<a name="l93"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l94"></a> first=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l95"></a> }
|
|
<a name="l96"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l97"></a> </span><span class=cF1>case</span><span class=cF0> BT_SEMIANNUAL:
|
|
<a name="l98"></a> </span><span class=cF5>Date2Struct</span><span class=cF0>(&ds,</span><span class=cF1>start</span><span class=cF0>);
|
|
<a name="l99"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) {
|
|
<a name="l100"></a> d=</span><span class=cF5>Struct2Date</span><span class=cF0>(&ds);
|
|
<a name="l101"></a> </span><span class=cF1>if</span><span class=cF0> (d<=</span><span class=cF1>end</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l102"></a> </span><span class=cF1>if</span><span class=cF0> (!first || !periodic_copy) {
|
|
<a name="l103"></a> tmpb=BgtEntryCopy(&tmpt->b,periodic_copy);
|
|
<a name="l104"></a> tmpb->date=d;
|
|
<a name="l105"></a> </span><span class=cF1>if</span><span class=cF0> (periodic_copy)
|
|
<a name="l106"></a> tmpb->template=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l107"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l108"></a> tmpb->type=BE_TEMPLATE_COPY;
|
|
<a name="l109"></a> BgtIns(tmpb);
|
|
<a name="l110"></a> }
|
|
<a name="l111"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l112"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l113"></a> ds.mon+=6;
|
|
<a name="l114"></a> </span><span class=cF1>if</span><span class=cF0> (ds.mon>12) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l115"></a> ds.mon-=12;
|
|
<a name="l116"></a> ds.year++;
|
|
<a name="l117"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l118"></a> first=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l119"></a> }
|
|
<a name="l120"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l121"></a> </span><span class=cF1>case</span><span class=cF0> BT_ANNUAL:
|
|
<a name="l122"></a> </span><span class=cF5>Date2Struct</span><span class=cF0>(&ds,</span><span class=cF1>start</span><span class=cF0>);
|
|
<a name="l123"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) {
|
|
<a name="l124"></a> d=</span><span class=cF5>Struct2Date</span><span class=cF0>(&ds);
|
|
<a name="l125"></a> </span><span class=cF1>if</span><span class=cF0> (d<=</span><span class=cF1>end</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l126"></a> </span><span class=cF1>if</span><span class=cF0> (!first || !periodic_copy) {
|
|
<a name="l127"></a> tmpb=BgtEntryCopy(&tmpt->b,periodic_copy);
|
|
<a name="l128"></a> tmpb->date=d;
|
|
<a name="l129"></a> </span><span class=cF1>if</span><span class=cF0> (periodic_copy)
|
|
<a name="l130"></a> tmpb->template=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l131"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l132"></a> tmpb->type=BE_TEMPLATE_COPY;
|
|
<a name="l133"></a> BgtIns(tmpb);
|
|
<a name="l134"></a> }
|
|
<a name="l135"></a> </span><span class=cF7>}</span><span class=cF0> </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.year++;
|
|
<a name="l138"></a> first=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l139"></a> }
|
|
<a name="l140"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l141"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l142"></a>}
|
|
<a name="l143"></a>
|
|
<a name="l144"></a></span><span class=cF1>U0</span><span class=cF0> CBgtTemplatesExpand()
|
|
<a name="l145"></a>{
|
|
<a name="l146"></a> CBgtTemplate *tmpt=t_head.next;
|
|
<a name="l147"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt!=&t_head) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l148"></a> BgtTemplateExpand(tmpt);
|
|
<a name="l149"></a> tmpt=tmpt->next;
|
|
<a name="l150"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l151"></a>}
|
|
<a name="l152"></a>
|
|
<a name="l153"></a>CBgtTemplate *BgtTemplatePmt(CBgtTemplate *dft_t=</span><span class=cF3>NULL</span><span class=cF0>,CBgtEntry *dft_b=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
<a name="l154"></a>{
|
|
<a name="l155"></a> CBgtTemplate t,*tmpt;
|
|
<a name="l156"></a> CBgtEntry *tmpb;
|
|
<a name="l157"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&t,0,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CBgtTemplate</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l158"></a> </span><span class=cF1>if</span><span class=cF0> (dft_t) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l159"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&t.</span><span class=cF1>start</span><span class=cF0>,&dft_t-></span><span class=cF1>start</span><span class=cF0>,BT_SIZE);
|
|
<a name="l160"></a> dft_b=&dft_t->b;
|
|
<a name="l161"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l162"></a> t.type=BT_INTERVAL;
|
|
<a name="l163"></a> </span><span class=cF1>if</span><span class=cF0> (dft_b)
|
|
<a name="l164"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(&t.start_date,</span><span class=cF6>"%D"</span><span class=cF0>,dft_b->date);
|
|
<a name="l165"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l166"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(&t.start_date,</span><span class=cF6>"["</span><span class=cF0>);
|
|
<a name="l167"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(&t.end_date,</span><span class=cF6>"]"</span><span class=cF0>);
|
|
<a name="l168"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l169"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l170"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>PopUpForm</span><span class=cF7>(</span><span class=cF0>&t</span><span class=cF7>)</span><span class=cF0> && </span><span class=cF7>(</span><span class=cF0>(t.type==BT_INTERVAL && t.period>0) ||
|
|
<a name="l171"></a> t.type>BT_INTERVAL</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l172"></a> </span><span class=cF1>if</span><span class=cF0> (tmpb=BgtEntryPmt</span><span class=cF7>(</span><span class=cF0>dft_b</span><span class=cF7>)</span><span class=cF0>) {
|
|
<a name="l173"></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="l174"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&tmpt-></span><span class=cF1>start</span><span class=cF0>,&t.</span><span class=cF1>start</span><span class=cF0>,BT_SIZE);
|
|
<a name="l175"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&tmpt->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="l176"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpb);
|
|
<a name="l177"></a> </span><span class=cF1>return</span><span class=cF0> tmpt;
|
|
<a name="l178"></a> }
|
|
<a name="l179"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l180"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l181"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l182"></a>}
|
|
</span></pre></body>
|
|
</html>
|