ZealOS/docs/Apps/Budget/BgtFile.CC.html
TomAwezome 768c2003e2 Fix DefineLoad variables AutoComplete src_link.
Fix SATARep missing AHCI controller info.
Add PCIDevFind to System/Externs.CC.
Add screen clearing with DocClear or Cls when in raw text mode.
Optimize RawPutChar.
Fix EdLite RAWF_SCROLL bug.
Update screenshots and README.
2021-08-02 02:26:59 -04:00

183 lines
13 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.12">
<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> BgtDataRead()
<a name="l2"></a>{
<a name="l3"></a> CBgtEntry *tmpb;
<a name="l4"></a> CBgtTemplate *tmpt;
<a name="l5"></a> </span><span class=cF9>I64</span><span class=cF0> i, count, size;
<a name="l6"></a> </span><span class=cF1>U8</span><span class=cF0> *b, *ptr;
<a name="l7"></a> </span><span class=cF9>I64</span><span class=cF0> max_num;
<a name="l8"></a> </span><span class=cF1>U8</span><span class=cF0> **s = StrFileRead(bgt_string_file, &amp;max_num);
<a name="l9"></a>
<a name="l10"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&amp;b_head, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CBgtEntry</span><span class=cF7>)</span><span class=cF0>);
<a name="l11"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&amp;b_head);
<a name="l12"></a> b_head.date = </span><span class=cF5>Now</span><span class=cF0>;
<a name="l13"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&amp;t_head, </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="l14"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&amp;t_head);
<a name="l15"></a> t_head.b.date = </span><span class=cF5>Now</span><span class=cF0>;
<a name="l16"></a>
<a name="l17"></a> </span><span class=cF1>if</span><span class=cF0> (ptr = b = </span><span class=cF5>FileRead</span><span class=cF7>(</span><span class=cF0>bgt_data_file, &amp;size</span><span class=cF7>)</span><span class=cF0>)
<a name="l18"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l19"></a> count = *ptr(</span><span class=cF9>I64</span><span class=cF0> *)++;
<a name="l20"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; count; i++)
<a name="l21"></a> {
<a name="l22"></a> tmpb = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CBgtEntry</span><span class=cF7>)</span><span class=cF0>);
<a name="l23"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;tmpb-&gt;</span><span class=cF1>start</span><span class=cF0>, ptr, BE_SIZE);
<a name="l24"></a> tmpb-&gt;credit = </span><span class=cF5>StrNew</span><span class=cF0>(s[tmpb-&gt;credit_idx]);
<a name="l25"></a> tmpb-&gt;debit = </span><span class=cF5>StrNew</span><span class=cF0>(s[tmpb-&gt;debit_idx]);
<a name="l26"></a> tmpb-&gt;desc = </span><span class=cF5>StrNew</span><span class=cF0>(s[tmpb-&gt;desc_idx]);
<a name="l27"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpb, b_head.last);
<a name="l28"></a> ptr += BE_SIZE;
<a name="l29"></a> }
<a name="l30"></a>
<a name="l31"></a> count = *ptr(</span><span class=cF9>I64</span><span class=cF0> *)++;
<a name="l32"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; count; i++)
<a name="l33"></a> {
<a name="l34"></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="l35"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;tmpt-&gt;</span><span class=cF1>start</span><span class=cF0>, ptr, BT_SIZE);
<a name="l36"></a> ptr += BT_SIZE;
<a name="l37"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;tmpt-&gt;b.</span><span class=cF1>start</span><span class=cF0>, ptr, BE_SIZE);
<a name="l38"></a> ptr += BE_SIZE;
<a name="l39"></a> tmpt-&gt;b.credit = </span><span class=cF5>StrNew</span><span class=cF0>(s[tmpt-&gt;b.credit_idx]);
<a name="l40"></a> tmpt-&gt;b.debit = </span><span class=cF5>StrNew</span><span class=cF0>(s[tmpt-&gt;b.debit_idx]);
<a name="l41"></a> tmpt-&gt;b.desc = </span><span class=cF5>StrNew</span><span class=cF0>(s[tmpt-&gt;b.desc_idx]);
<a name="l42"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpt, t_head.last);
<a name="l43"></a> }
<a name="l44"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l45"></a>
<a name="l46"></a> StrFileArrDel(s, max_num);
<a name="l47"></a> </span><span class=cF5>Free</span><span class=cF0>(b);
<a name="l48"></a>
<a name="l49"></a> BgtAcctsUpdate;
<a name="l50"></a>}
<a name="l51"></a>
<a name="l52"></a></span><span class=cF1>U0</span><span class=cF0> BgtDataWrite()
<a name="l53"></a>{
<a name="l54"></a> </span><span class=cF9>I64</span><span class=cF0> i, num = </span><span class=cFE>0</span><span class=cF0>, size, count1, count2;
<a name="l55"></a> </span><span class=cF9>CHashTable</span><span class=cF0> *table = </span><span class=cF5>HashTableNew</span><span class=cF0>(</span><span class=cFE>1024</span><span class=cF0>);
<a name="l56"></a> CBgtEntry *tmpb;
<a name="l57"></a> CBgtTemplate *tmpt;
<a name="l58"></a> </span><span class=cF9>CHashGeneric</span><span class=cF0> *tmph;
<a name="l59"></a> </span><span class=cF1>U8</span><span class=cF0> *buf, *ptr;
<a name="l60"></a>
<a name="l61"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt;= accts_table-&gt;mask; i++)
<a name="l62"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l63"></a> tmph=accts_table-&gt;body[i];
<a name="l64"></a> </span><span class=cF1>while</span><span class=cF0> (tmph)
<a name="l65"></a> {
<a name="l66"></a> StrFileAdd(tmph-&gt;str, &amp;num, table); </span><span class=cF2>//Cosmetics -- make accts appear first.</span><span class=cF0>
<a name="l67"></a> tmph = tmph-&gt;next;
<a name="l68"></a> }
<a name="l69"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l70"></a>
<a name="l71"></a> tmpb = b_head.next;
<a name="l72"></a> count1 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l73"></a> </span><span class=cF1>while</span><span class=cF0> (tmpb != &amp;b_head)
<a name="l74"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l75"></a> </span><span class=cF1>if</span><span class=cF0> (tmpb-&gt;type != BE_TEMPLATE_COPY)
<a name="l76"></a> {
<a name="l77"></a> tmpb-&gt;credit_idx = StrFileAdd(tmpb-&gt;credit, &amp;num, table);
<a name="l78"></a> tmpb-&gt;debit_idx = StrFileAdd(tmpb-&gt;debit, &amp;num, table);
<a name="l79"></a> tmpb-&gt;desc_idx = StrFileAdd(tmpb-&gt;desc, &amp;num, table);
<a name="l80"></a> count1++;
<a name="l81"></a> }
<a name="l82"></a> tmpb = tmpb-&gt;next;
<a name="l83"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l84"></a>
<a name="l85"></a> tmpt = t_head.next;
<a name="l86"></a> count2 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l87"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt != &amp;t_head)
<a name="l88"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l89"></a> tmpt-&gt;b.credit_idx = StrFileAdd(tmpt-&gt;b.credit, &amp;num, table);
<a name="l90"></a> tmpt-&gt;b.debit_idx = StrFileAdd(tmpt-&gt;b.debit, &amp;num, table);
<a name="l91"></a> tmpt-&gt;b.desc_idx = StrFileAdd(tmpt-&gt;b.desc, &amp;num, table);
<a name="l92"></a> count2++;
<a name="l93"></a> tmpt = tmpt-&gt;next;
<a name="l94"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l95"></a> StrFileWrite(bgt_string_file, table);
<a name="l96"></a> StrFileDel(table);
<a name="l97"></a>
<a name="l98"></a> size = </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0>) * </span><span class=cFE>2</span><span class=cF0> + count1 * BE_SIZE + count2 * (BT_SIZE + BE_SIZE);
<a name="l99"></a> buf = ptr = </span><span class=cF5>MAlloc</span><span class=cF0>(size);
<a name="l100"></a>
<a name="l101"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(ptr, &amp;count1, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>);
<a name="l102"></a> ptr += </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0>);
<a name="l103"></a> tmpb=b_head.next;
<a name="l104"></a> </span><span class=cF1>while</span><span class=cF0> (tmpb != &amp;b_head)
<a name="l105"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l106"></a> </span><span class=cF1>if</span><span class=cF0> (tmpb-&gt;type != BE_TEMPLATE_COPY)
<a name="l107"></a> {
<a name="l108"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(ptr, &amp;tmpb-&gt;</span><span class=cF1>start</span><span class=cF0>, BE_SIZE);
<a name="l109"></a> ptr += BE_SIZE;
<a name="l110"></a> }
<a name="l111"></a> tmpb = tmpb-&gt;next;
<a name="l112"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l113"></a>
<a name="l114"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(ptr, &amp;count2, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>);
<a name="l115"></a> ptr += </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0>);
<a name="l116"></a> tmpt=t_head.next;
<a name="l117"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt != &amp;t_head)
<a name="l118"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l119"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(ptr, &amp;tmpt-&gt;</span><span class=cF1>start</span><span class=cF0>, BT_SIZE);
<a name="l120"></a> ptr += BT_SIZE;
<a name="l121"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(ptr, &amp;tmpt-&gt;b.</span><span class=cF1>start</span><span class=cF0>, BE_SIZE);
<a name="l122"></a> ptr += BE_SIZE;
<a name="l123"></a> tmpt = tmpt-&gt;next;
<a name="l124"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l125"></a>
<a name="l126"></a> </span><span class=cF5>FileWrite</span><span class=cF0>(bgt_data_file, buf, size);
<a name="l127"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l128"></a>}
<a name="l129"></a>
<a name="l130"></a></span><span class=cF1>U0</span><span class=cF0> BgtDel()
<a name="l131"></a>{
<a name="l132"></a> CBgtEntry *tmpb, *tmpb1;
<a name="l133"></a> CBgtTemplate *tmpt, *tmpt1;
<a name="l134"></a>
<a name="l135"></a> tmpb = b_head.next;
<a name="l136"></a> </span><span class=cF1>while</span><span class=cF0> (tmpb != &amp;b_head)
<a name="l137"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l138"></a> tmpb1 = tmpb-&gt;next;
<a name="l139"></a> BgtEntryDel2(tmpb);
<a name="l140"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpb);
<a name="l141"></a> tmpb = tmpb1;
<a name="l142"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l143"></a> tmpt = t_head.next;
<a name="l144"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt != &amp;t_head)
<a name="l145"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l146"></a> tmpt1 = tmpt-&gt;next;
<a name="l147"></a> BgtEntryDel2(&amp;tmpt-&gt;b);
<a name="l148"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpt);
<a name="l149"></a> tmpt = tmpt1;
<a name="l150"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l151"></a> StrFileDel(accts_table);
<a name="l152"></a> accts_table = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l153"></a> accts_table_strs = </span><span class=cFE>0</span><span class=cF0>;
<a name="l154"></a>}
</span></pre></body>
</html>