TempleOSCDV4.12.ISO
This commit is contained in:
1 parent
93ca216483
commit
b84bbff6db
381 files changed
+18356
-18798
No files matched your search
+22
-22
@@ -1,24 +1,24 @@
|
||||
U0 BgtAcctsUpdate()
|
||||
{
|
||||
CBgtEntry *tempb;
|
||||
CBgtTemplate *tempt;
|
||||
tempb=b_head.next;
|
||||
while (tempb!=&b_head) {
|
||||
if (tempb->type!=BE_TEMPLATE_COPY) {
|
||||
tempb->credit_idx=StrFileAdd(tempb->credit,
|
||||
CBgtEntry *tmpb;
|
||||
CBgtTemplate *tmpt;
|
||||
tmpb=b_head.next;
|
||||
while (tmpb!=&b_head) {
|
||||
if (tmpb->type!=BE_TEMPLATE_COPY) {
|
||||
tmpb->credit_idx=StrFileAdd(tmpb->credit,
|
||||
&accts_table_strs,accts_table);
|
||||
tempb->debit_idx =StrFileAdd(tempb->debit,
|
||||
tmpb->debit_idx =StrFileAdd(tmpb->debit,
|
||||
&accts_table_strs,accts_table);
|
||||
}
|
||||
tempb=tempb->next;
|
||||
tmpb=tmpb->next;
|
||||
}
|
||||
tempt=t_head.next;
|
||||
while (tempt!=&t_head) {
|
||||
tempt->b.credit_idx=StrFileAdd(tempt->b.credit,
|
||||
tmpt=t_head.next;
|
||||
while (tmpt!=&t_head) {
|
||||
tmpt->b.credit_idx=StrFileAdd(tmpt->b.credit,
|
||||
&accts_table_strs,accts_table);
|
||||
tempt->b.debit_idx =StrFileAdd(tempt->b.debit,
|
||||
tmpt->b.debit_idx =StrFileAdd(tmpt->b.debit,
|
||||
&accts_table_strs,accts_table);
|
||||
tempt=tempt->next;
|
||||
tmpt=tmpt->next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@ U0 BgtAcctsRead()
|
||||
|
||||
I64 BgtAcctColor(U8 *st)
|
||||
{
|
||||
CHashGeneric *temph;
|
||||
if (temph=HashFind(st,accts_table,SFT_GENERIC))
|
||||
return temph->user_data1;
|
||||
CHashGeneric *tmph;
|
||||
if (tmph=HashFind(st,accts_table,SFT_GENERIC))
|
||||
return tmph->user_data1;
|
||||
else
|
||||
return BLACK;
|
||||
}
|
||||
@@ -57,19 +57,19 @@ U8 *BgtPopUpAcct(U8 *header=NULL,U8 *dft=NULL)
|
||||
U8 *res;
|
||||
CDoc *doc=DocNew;
|
||||
CDocEntry *doc_e,*doc_dft=NULL;
|
||||
CHashGeneric *temph;
|
||||
CHashGeneric *tmph;
|
||||
|
||||
if (header)
|
||||
DocPrint(doc,"%s",header);
|
||||
|
||||
for (i=0;i<=accts_table->mask;i++) {
|
||||
temph=accts_table->body[i];
|
||||
while (temph) {
|
||||
tmph=accts_table->body[i];
|
||||
while (tmph) {
|
||||
doc_e=DocPrint(doc,"$$FG,%d$$$$MU-UL,\"%s\",LE=0x%X$$\n",
|
||||
temph->user_data1,temph->str,temph->str);
|
||||
if (dft && !StrCmp(dft,temph->str))
|
||||
tmph->user_data1,tmph->str,tmph->str);
|
||||
if (dft && !StrCmp(dft,tmph->str))
|
||||
doc_dft=doc_e;
|
||||
temph=temph->next;
|
||||
tmph=tmph->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+24
-24
@@ -1,24 +1,24 @@
|
||||
U0 BgtEntryDel2(CBgtEntry *tempb)
|
||||
U0 BgtEntryDel2(CBgtEntry *tmpb)
|
||||
{
|
||||
if (tempb->type!=BE_TEMPLATE_COPY) {
|
||||
Free(tempb->credit);
|
||||
Free(tempb->debit);
|
||||
Free(tempb->desc);
|
||||
if (tmpb->type!=BE_TEMPLATE_COPY) {
|
||||
Free(tmpb->credit);
|
||||
Free(tmpb->debit);
|
||||
Free(tmpb->desc);
|
||||
}
|
||||
}
|
||||
|
||||
U0 BgtEntryDel(CBgtEntry *tempb)
|
||||
U0 BgtEntryDel(CBgtEntry *tmpb)
|
||||
{
|
||||
BgtEntryDel2(tempb);
|
||||
Free(tempb);
|
||||
BgtEntryDel2(tmpb);
|
||||
Free(tmpb);
|
||||
}
|
||||
|
||||
U0 BgtIns(CBgtEntry *tempb)
|
||||
U0 BgtIns(CBgtEntry *tmpb)
|
||||
{
|
||||
CBgtEntry *tempb1=b_head.next;
|
||||
while (tempb1!=&b_head && tempb1->date<tempb->date)
|
||||
tempb1=tempb1->next;
|
||||
QueIns(tempb,tempb1->last);
|
||||
CBgtEntry *tmpb1=b_head.next;
|
||||
while (tmpb1!=&b_head && tmpb1->date<tmpb->date)
|
||||
tmpb1=tmpb1->next;
|
||||
QueIns(tmpb,tmpb1->last);
|
||||
}
|
||||
|
||||
class CBgtEntryForm
|
||||
@@ -33,7 +33,7 @@ class CBgtEntryForm
|
||||
CBgtEntry *BgtEntryPmt(CBgtEntry *dft=NULL)
|
||||
{
|
||||
CBgtEntryForm b;
|
||||
CBgtEntry *tempb;
|
||||
CBgtEntry *tmpb;
|
||||
U8 *st;
|
||||
MemSet(&b,0,sizeof(CBgtEntryForm));
|
||||
StrCpy(&b.date,"*");
|
||||
@@ -55,16 +55,16 @@ CBgtEntry *BgtEntryPmt(CBgtEntry *dft=NULL)
|
||||
if (st!=DOCM_CANCEL)
|
||||
StrCpy(b.debit,st);
|
||||
} else {
|
||||
tempb=CAlloc(sizeof(CBgtEntry));
|
||||
tempb->date =Str2Date(b.date);
|
||||
tempb->amount=b.amount;
|
||||
tempb->credit=StrNew(b.credit);
|
||||
tempb->debit =StrNew(b.debit);
|
||||
tempb->desc =StrNew(b.desc);
|
||||
tempb->type =BE_NORMAL;
|
||||
StrFileAdd(tempb->credit,&accts_table_strs,accts_table);
|
||||
StrFileAdd(tempb->debit,&accts_table_strs,accts_table);
|
||||
return tempb;
|
||||
tmpb=CAlloc(sizeof(CBgtEntry));
|
||||
tmpb->date =Str2Date(b.date);
|
||||
tmpb->amount=b.amount;
|
||||
tmpb->credit=StrNew(b.credit);
|
||||
tmpb->debit =StrNew(b.debit);
|
||||
tmpb->desc =StrNew(b.desc);
|
||||
tmpb->type =BE_NORMAL;
|
||||
StrFileAdd(tmpb->credit,&accts_table_strs,accts_table);
|
||||
StrFileAdd(tmpb->debit,&accts_table_strs,accts_table);
|
||||
return tmpb;
|
||||
}
|
||||
} else
|
||||
return NULL;
|
||||
|
||||
+59
-59
@@ -1,7 +1,7 @@
|
||||
U0 BgtDataRead()
|
||||
{
|
||||
CBgtEntry *tempb;
|
||||
CBgtTemplate *tempt;
|
||||
CBgtEntry *tmpb;
|
||||
CBgtTemplate *tmpt;
|
||||
I64 i,cnt,size;
|
||||
U8 *b,*ptr;
|
||||
I64 max_num;
|
||||
@@ -17,26 +17,26 @@ U0 BgtDataRead()
|
||||
if (ptr=b=FileRead(BGT_DATA_FILE,&size)) {
|
||||
cnt=*ptr(I64 *)++;
|
||||
for (i=0;i<cnt;i++) {
|
||||
tempb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(&tempb->start,ptr,BE_SIZE);
|
||||
tempb->credit=StrNew(s[tempb->credit_idx]);
|
||||
tempb->debit =StrNew(s[tempb->debit_idx]);
|
||||
tempb->desc =StrNew(s[tempb->desc_idx]);
|
||||
QueIns(tempb,b_head.last);
|
||||
tmpb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(&tmpb->start,ptr,BE_SIZE);
|
||||
tmpb->credit=StrNew(s[tmpb->credit_idx]);
|
||||
tmpb->debit =StrNew(s[tmpb->debit_idx]);
|
||||
tmpb->desc =StrNew(s[tmpb->desc_idx]);
|
||||
QueIns(tmpb,b_head.last);
|
||||
ptr+=BE_SIZE;
|
||||
}
|
||||
|
||||
cnt=*ptr(I64 *)++;
|
||||
for (i=0;i<cnt;i++) {
|
||||
tempt=CAlloc(sizeof(CBgtTemplate));
|
||||
MemCpy(&tempt->start,ptr,BT_SIZE);
|
||||
tmpt=CAlloc(sizeof(CBgtTemplate));
|
||||
MemCpy(&tmpt->start,ptr,BT_SIZE);
|
||||
ptr+=BT_SIZE;
|
||||
MemCpy(&tempt->b.start,ptr,BE_SIZE);
|
||||
MemCpy(&tmpt->b.start,ptr,BE_SIZE);
|
||||
ptr+=BE_SIZE;
|
||||
tempt->b.credit=StrNew(s[tempt->b.credit_idx]);
|
||||
tempt->b.debit =StrNew(s[tempt->b.debit_idx]);
|
||||
tempt->b.desc =StrNew(s[tempt->b.desc_idx]);
|
||||
QueIns(tempt,t_head.last);
|
||||
tmpt->b.credit=StrNew(s[tmpt->b.credit_idx]);
|
||||
tmpt->b.debit =StrNew(s[tmpt->b.debit_idx]);
|
||||
tmpt->b.desc =StrNew(s[tmpt->b.desc_idx]);
|
||||
QueIns(tmpt,t_head.last);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,39 +50,39 @@ U0 BgtDataWrite()
|
||||
{
|
||||
I64 i,num=0,size,cnt1,cnt2;
|
||||
CHashTable *table=HashTableNew(1024);
|
||||
CBgtEntry *tempb;
|
||||
CBgtTemplate *tempt;
|
||||
CHashGeneric *temph;
|
||||
CBgtEntry *tmpb;
|
||||
CBgtTemplate *tmpt;
|
||||
CHashGeneric *tmph;
|
||||
U8 *buf,*ptr;
|
||||
|
||||
for (i=0;i<=accts_table->mask;i++) {
|
||||
temph=accts_table->body[i];
|
||||
while (temph) {
|
||||
StrFileAdd(temph->str,&num,table); //Cosmetics -- make accts appear first.
|
||||
temph=temph->next;
|
||||
tmph=accts_table->body[i];
|
||||
while (tmph) {
|
||||
StrFileAdd(tmph->str,&num,table); //Cosmetics -- make accts appear first.
|
||||
tmph=tmph->next;
|
||||
}
|
||||
}
|
||||
|
||||
tempb=b_head.next;
|
||||
tmpb=b_head.next;
|
||||
cnt1=0;
|
||||
while (tempb!=&b_head) {
|
||||
if (tempb->type!=BE_TEMPLATE_COPY) {
|
||||
tempb->credit_idx =StrFileAdd(tempb->credit,&num,table);
|
||||
tempb->debit_idx =StrFileAdd(tempb->debit,&num,table);
|
||||
tempb->desc_idx =StrFileAdd(tempb->desc,&num,table);
|
||||
while (tmpb!=&b_head) {
|
||||
if (tmpb->type!=BE_TEMPLATE_COPY) {
|
||||
tmpb->credit_idx =StrFileAdd(tmpb->credit,&num,table);
|
||||
tmpb->debit_idx =StrFileAdd(tmpb->debit,&num,table);
|
||||
tmpb->desc_idx =StrFileAdd(tmpb->desc,&num,table);
|
||||
cnt1++;
|
||||
}
|
||||
tempb=tempb->next;
|
||||
tmpb=tmpb->next;
|
||||
}
|
||||
|
||||
tempt=t_head.next;
|
||||
tmpt=t_head.next;
|
||||
cnt2=0;
|
||||
while (tempt!=&t_head) {
|
||||
tempt->b.credit_idx =StrFileAdd(tempt->b.credit,&num,table);
|
||||
tempt->b.debit_idx =StrFileAdd(tempt->b.debit,&num,table);
|
||||
tempt->b.desc_idx =StrFileAdd(tempt->b.desc,&num,table);
|
||||
while (tmpt!=&t_head) {
|
||||
tmpt->b.credit_idx =StrFileAdd(tmpt->b.credit,&num,table);
|
||||
tmpt->b.debit_idx =StrFileAdd(tmpt->b.debit,&num,table);
|
||||
tmpt->b.desc_idx =StrFileAdd(tmpt->b.desc,&num,table);
|
||||
cnt2++;
|
||||
tempt=tempt->next;
|
||||
tmpt=tmpt->next;
|
||||
}
|
||||
StrFileWrite(BGT_STRINGS_FILE,table);
|
||||
StrFileDel(table);
|
||||
@@ -92,24 +92,24 @@ U0 BgtDataWrite()
|
||||
|
||||
MemCpy(ptr,&cnt1,sizeof(I64));
|
||||
ptr+=sizeof(I64);
|
||||
tempb=b_head.next;
|
||||
while (tempb!=&b_head) {
|
||||
if (tempb->type!=BE_TEMPLATE_COPY) {
|
||||
MemCpy(ptr,&tempb->start,BE_SIZE);
|
||||
tmpb=b_head.next;
|
||||
while (tmpb!=&b_head) {
|
||||
if (tmpb->type!=BE_TEMPLATE_COPY) {
|
||||
MemCpy(ptr,&tmpb->start,BE_SIZE);
|
||||
ptr+=BE_SIZE;
|
||||
}
|
||||
tempb=tempb->next;
|
||||
tmpb=tmpb->next;
|
||||
}
|
||||
|
||||
MemCpy(ptr,&cnt2,sizeof(I64));
|
||||
ptr+=sizeof(I64);
|
||||
tempt=t_head.next;
|
||||
while (tempt!=&t_head) {
|
||||
MemCpy(ptr,&tempt->start,BT_SIZE);
|
||||
tmpt=t_head.next;
|
||||
while (tmpt!=&t_head) {
|
||||
MemCpy(ptr,&tmpt->start,BT_SIZE);
|
||||
ptr+=BT_SIZE;
|
||||
MemCpy(ptr,&tempt->b.start,BE_SIZE);
|
||||
MemCpy(ptr,&tmpt->b.start,BE_SIZE);
|
||||
ptr+=BE_SIZE;
|
||||
tempt=tempt->next;
|
||||
tmpt=tmpt->next;
|
||||
}
|
||||
|
||||
FileWrite(BGT_DATA_FILE,buf,size);
|
||||
@@ -118,21 +118,21 @@ U0 BgtDataWrite()
|
||||
|
||||
U0 BgtDel()
|
||||
{
|
||||
CBgtEntry *tempb,*tempb1;
|
||||
CBgtTemplate *tempt,*tempt1;
|
||||
tempb=b_head.next;
|
||||
while (tempb!=&b_head) {
|
||||
tempb1=tempb->next;
|
||||
BgtEntryDel2(tempb);
|
||||
Free(tempb);
|
||||
tempb=tempb1;
|
||||
CBgtEntry *tmpb,*tmpb1;
|
||||
CBgtTemplate *tmpt,*tmpt1;
|
||||
tmpb=b_head.next;
|
||||
while (tmpb!=&b_head) {
|
||||
tmpb1=tmpb->next;
|
||||
BgtEntryDel2(tmpb);
|
||||
Free(tmpb);
|
||||
tmpb=tmpb1;
|
||||
}
|
||||
tempt=t_head.next;
|
||||
while (tempt!=&t_head) {
|
||||
tempt1=tempt->next;
|
||||
BgtEntryDel2(&tempt->b);
|
||||
Free(tempt);
|
||||
tempt=tempt1;
|
||||
tmpt=t_head.next;
|
||||
while (tmpt!=&t_head) {
|
||||
tmpt1=tmpt->next;
|
||||
BgtEntryDel2(&tmpt->b);
|
||||
Free(tmpt);
|
||||
tmpt=tmpt1;
|
||||
}
|
||||
StrFileDel(accts_table);
|
||||
accts_table=NULL;
|
||||
|
||||
+49
-49
@@ -3,30 +3,30 @@ extern U0 BgtRegen();
|
||||
Bool BgtPutKey(CDoc *doc,U8 *,I64 ch,I64 sc)
|
||||
{//ch=ASCII; sc=scan_code
|
||||
no_warn sc;
|
||||
CBgtEntry *tempb,*tempb1;
|
||||
CBgtTemplate *tempt,*tempt1;
|
||||
CBgtEntry *tmpb,*tmpb1;
|
||||
CBgtTemplate *tmpt,*tmpt1;
|
||||
CDocEntry *doc_ce;
|
||||
U8 *st;
|
||||
switch (ch) {
|
||||
case '\n':
|
||||
if ((doc_ce=doc->cur_entry) && doc_ce!=doc &&
|
||||
doc_ce->type_u8==DOCT_MENU_VAL) {
|
||||
tempb=doc_ce->user_data;
|
||||
if (tempt=tempb->template) {
|
||||
if (tempt1=BgtTemplatePmt(tempt)) {
|
||||
QueRem(tempt);
|
||||
BgtTemplatePurge(tempt);
|
||||
BgtEntryDel2(&tempt->b);
|
||||
Free(tempt);
|
||||
QueIns(tempt1,t_head.last);
|
||||
BgtTemplateExpand(tempt1);
|
||||
tmpb=doc_ce->user_data;
|
||||
if (tmpt=tmpb->template) {
|
||||
if (tmpt1=BgtTemplatePmt(tmpt)) {
|
||||
QueRem(tmpt);
|
||||
BgtTemplatePurge(tmpt);
|
||||
BgtEntryDel2(&tmpt->b);
|
||||
Free(tmpt);
|
||||
QueIns(tmpt1,t_head.last);
|
||||
BgtTemplateExpand(tmpt1);
|
||||
BgtRegen;
|
||||
}
|
||||
} else {
|
||||
if (tempb1=BgtEntryPmt(tempb)) {
|
||||
QueRem(tempb);
|
||||
BgtEntryDel(tempb);
|
||||
BgtIns(tempb1);
|
||||
if (tmpb1=BgtEntryPmt(tmpb)) {
|
||||
QueRem(tmpb);
|
||||
BgtEntryDel(tmpb);
|
||||
BgtIns(tmpb1);
|
||||
BgtRegen;
|
||||
}
|
||||
}
|
||||
@@ -35,15 +35,15 @@ Bool BgtPutKey(CDoc *doc,U8 *,I64 ch,I64 sc)
|
||||
case CH_CTRLY:
|
||||
if ((doc_ce=doc->cur_entry) && doc_ce!=doc &&
|
||||
doc_ce->type_u8==DOCT_MENU_VAL) {
|
||||
tempb=doc_ce->user_data;
|
||||
if (tempt=tempb->template) {
|
||||
QueRem(tempt);
|
||||
BgtTemplatePurge(tempt);
|
||||
BgtEntryDel2(&tempt->b);
|
||||
Free(tempt);
|
||||
tmpb=doc_ce->user_data;
|
||||
if (tmpt=tmpb->template) {
|
||||
QueRem(tmpt);
|
||||
BgtTemplatePurge(tmpt);
|
||||
BgtEntryDel2(&tmpt->b);
|
||||
Free(tmpt);
|
||||
} else {
|
||||
QueRem(tempb);
|
||||
BgtEntryDel(tempb);
|
||||
QueRem(tmpb);
|
||||
BgtEntryDel(tmpb);
|
||||
}
|
||||
BgtRegen;
|
||||
}
|
||||
@@ -64,26 +64,26 @@ Bool BgtPutKey(CDoc *doc,U8 *,I64 ch,I64 sc)
|
||||
}
|
||||
return TRUE;
|
||||
case 'n':
|
||||
if (tempb1=BgtEntryPmt) {
|
||||
BgtIns(tempb1);
|
||||
if (tmpb1=BgtEntryPmt) {
|
||||
BgtIns(tmpb1);
|
||||
BgtRegen;
|
||||
}
|
||||
return TRUE;
|
||||
case 't':
|
||||
if (tempt1=BgtTemplatePmt) {
|
||||
QueIns(tempt1,t_head.last);
|
||||
BgtTemplateExpand(tempt1);
|
||||
if (tmpt1=BgtTemplatePmt) {
|
||||
QueIns(tmpt1,t_head.last);
|
||||
BgtTemplateExpand(tmpt1);
|
||||
BgtRegen;
|
||||
}
|
||||
return TRUE;
|
||||
case 'c':
|
||||
if ((doc_ce=doc->cur_entry) && doc_ce!=doc &&
|
||||
doc_ce->type_u8==DOCT_MENU_VAL)
|
||||
tempb=doc_ce->user_data;
|
||||
tmpb=doc_ce->user_data;
|
||||
else
|
||||
tempb=NULL;
|
||||
if (tempb1=BgtEntryPmt(tempb)) {
|
||||
BgtIns(tempb1);
|
||||
tmpb=NULL;
|
||||
if (tmpb1=BgtEntryPmt(tmpb)) {
|
||||
BgtIns(tmpb1);
|
||||
BgtRegen;
|
||||
}
|
||||
return TRUE;
|
||||
@@ -97,24 +97,24 @@ U0 BgtRegen()
|
||||
F64 balance=0;
|
||||
CDoc *doc,*pdoc,*ddoc;
|
||||
CDocEntry *doc_ce;
|
||||
CBgtEntry *tempb=b_head.next,*tempb_ce;
|
||||
CBgtEntry *tmpb=b_head.next,*tmpb_ce;
|
||||
doc=DocNew;
|
||||
doc->flags|=DOCF_FORM;
|
||||
while (tempb!=&b_head) {
|
||||
if (!StrCmp(view_acct,tempb->credit))
|
||||
balance-=tempb->amount;
|
||||
if (!StrCmp(view_acct,tempb->debit))
|
||||
balance+=tempb->amount;
|
||||
c=BgtAcctColor(tempb->credit);
|
||||
while (tmpb!=&b_head) {
|
||||
if (!StrCmp(view_acct,tmpb->credit))
|
||||
balance-=tmpb->amount;
|
||||
if (!StrCmp(view_acct,tmpb->debit))
|
||||
balance+=tmpb->amount;
|
||||
c=BgtAcctColor(tmpb->credit);
|
||||
if (c!=color) {
|
||||
color=c;
|
||||
DocPrint(doc,"$$FG,%d$$",color);
|
||||
}
|
||||
tempb->doc_e=DocPrint(doc,
|
||||
tmpb->doc_e=DocPrint(doc,
|
||||
"$$MU-UL,\"%D %8ts %8ts:%8.2f %8.2f:%$$Q\",U=0x%X$$\n",
|
||||
tempb->date,tempb->credit,tempb->debit,balance,
|
||||
tempb->amount,tempb->desc,tempb);
|
||||
tempb=tempb->next;
|
||||
tmpb->date,tmpb->credit,tmpb->debit,balance,
|
||||
tmpb->amount,tmpb->desc,tmpb);
|
||||
tmpb=tmpb->next;
|
||||
}
|
||||
DocRecalc(doc);
|
||||
|
||||
@@ -130,19 +130,19 @@ U0 BgtRegen()
|
||||
doc_ce=pdoc->cur_entry;
|
||||
timeout_jiffy=cnts.jiffies+JIFFY_FREQ; //Max one second.
|
||||
while (doc_ce!=pdoc && cnts.jiffies<timeout_jiffy) {
|
||||
while (doc_ce->type_u8!=DOCT_MENU_VAL || !(tempb_ce=doc_ce->user_data)) {
|
||||
while (doc_ce->type_u8!=DOCT_MENU_VAL || !(tmpb_ce=doc_ce->user_data)) {
|
||||
doc_ce=doc_ce->next;
|
||||
if (doc_ce==pdoc) goto br_cont;
|
||||
}
|
||||
tempb=b_head.next;
|
||||
while (tempb!=&b_head) {
|
||||
if (tempb==tempb_ce) {
|
||||
doc->cur_entry=tempb->doc_e;
|
||||
tmpb=b_head.next;
|
||||
while (tmpb!=&b_head) {
|
||||
if (tmpb==tmpb_ce) {
|
||||
doc->cur_entry=tmpb->doc_e;
|
||||
doc->cur_col=0;
|
||||
DocCenter(doc);
|
||||
goto br_cont;
|
||||
}
|
||||
tempb=tempb->next;
|
||||
tmpb=tmpb->next;
|
||||
}
|
||||
doc_ce=doc_ce->next;
|
||||
}
|
||||
|
||||
+27
-27
@@ -57,18 +57,18 @@ public U0 StrFileArrDel(U8 **a,I64 max_num)
|
||||
public I64 StrFileAdd(U8 *st,I64 *_num,
|
||||
CHashTable *table,I64 color=COLOR_INVALID)
|
||||
{
|
||||
CHashGeneric *temph;
|
||||
CHashGeneric *tmph;
|
||||
if (!st) return 0;
|
||||
if (!(temph=HashFind(st,table,SFT_GENERIC))) {
|
||||
temph=CAlloc(sizeof(CHashGeneric));
|
||||
temph->type=SFT_GENERIC;
|
||||
temph->str=StrNew(st);
|
||||
temph->user_data0=(*_num)++;
|
||||
HashAdd(temph,table);
|
||||
if (!(tmph=HashFind(st,table,SFT_GENERIC))) {
|
||||
tmph=CAlloc(sizeof(CHashGeneric));
|
||||
tmph->type=SFT_GENERIC;
|
||||
tmph->str=StrNew(st);
|
||||
tmph->user_data0=(*_num)++;
|
||||
HashAdd(tmph,table);
|
||||
}
|
||||
if (color!=COLOR_INVALID)
|
||||
temph->user_data1=color;
|
||||
return temph->user_data0;
|
||||
tmph->user_data1=color;
|
||||
return tmph->user_data0;
|
||||
}
|
||||
|
||||
I64 StrEntriesCompare(CHashGeneric *h1,CHashGeneric *h2)
|
||||
@@ -80,7 +80,7 @@ public U0 StrFileWrite(U8 *name,CHashTable *table,Bool no_nums=FALSE)
|
||||
{
|
||||
I64 i,j,cnt,color=BLACK;
|
||||
CDoc *doc=DocNew(name);
|
||||
CHashGeneric *temph,**a;
|
||||
CHashGeneric *tmph,**a;
|
||||
if (table) {
|
||||
cnt=0; //Count Strings
|
||||
for (i=0;i<=table->mask;i++)
|
||||
@@ -88,23 +88,23 @@ public U0 StrFileWrite(U8 *name,CHashTable *table,Bool no_nums=FALSE)
|
||||
a=MAlloc(cnt*sizeof(CHashGeneric *));
|
||||
j=0; //Load Strings
|
||||
for (i=0;i<=table->mask;i++) {
|
||||
temph=table->body[i];
|
||||
while (temph) {
|
||||
a[j++]=temph;
|
||||
temph=temph->next;
|
||||
tmph=table->body[i];
|
||||
while (tmph) {
|
||||
a[j++]=tmph;
|
||||
tmph=tmph->next;
|
||||
}
|
||||
}
|
||||
QSortI64(a,cnt,&StrEntriesCompare);
|
||||
for (i=0;i<cnt;i++) {
|
||||
temph=a[i];
|
||||
if (temph->user_data1&15!=color) {
|
||||
DocPrint(doc,"$$FG,%d$$",temph->user_data1&15);
|
||||
color=temph->user_data1&15;
|
||||
tmph=a[i];
|
||||
if (tmph->user_data1&15!=color) {
|
||||
DocPrint(doc,"$$FG,%d$$",tmph->user_data1&15);
|
||||
color=tmph->user_data1&15;
|
||||
}
|
||||
if (no_nums)
|
||||
DocPrint(doc,"%s\n",temph->str);
|
||||
DocPrint(doc,"%s\n",tmph->str);
|
||||
else
|
||||
DocPrint(doc,"%d,%s\n",temph->user_data0,temph->str);
|
||||
DocPrint(doc,"%d,%s\n",tmph->user_data0,tmph->str);
|
||||
}
|
||||
Free(a);
|
||||
}
|
||||
@@ -116,15 +116,15 @@ public U0 StrFileWrite(U8 *name,CHashTable *table,Bool no_nums=FALSE)
|
||||
public U0 StrFileDel(CHashTable *table)
|
||||
{
|
||||
I64 i;
|
||||
CHashGeneric *temph,*temph1;
|
||||
CHashGeneric *tmph,*tmph1;
|
||||
if (!table) return;
|
||||
for (i=0;i<=table->mask;i++) {
|
||||
temph=table->body[i];
|
||||
while (temph) {
|
||||
temph1=temph->next;
|
||||
Free(temph->str);
|
||||
Free(temph);
|
||||
temph=temph1;
|
||||
tmph=table->body[i];
|
||||
while (tmph) {
|
||||
tmph1=tmph->next;
|
||||
Free(tmph->str);
|
||||
Free(tmph);
|
||||
tmph=tmph1;
|
||||
}
|
||||
}
|
||||
Free(table->body);
|
||||
|
||||
+54
-54
@@ -1,37 +1,37 @@
|
||||
U0 BgtTemplatePurge(CBgtTemplate *tempt)
|
||||
U0 BgtTemplatePurge(CBgtTemplate *tmpt)
|
||||
{
|
||||
CBgtEntry *tempb,*tempb1;
|
||||
tempb=b_head.next;
|
||||
while (tempb!=&b_head) {
|
||||
tempb1=tempb->next;
|
||||
if (tempb->template==tempt) {
|
||||
QueRem(tempb);
|
||||
BgtEntryDel2(tempb);
|
||||
Free(tempb);
|
||||
CBgtEntry *tmpb,*tmpb1;
|
||||
tmpb=b_head.next;
|
||||
while (tmpb!=&b_head) {
|
||||
tmpb1=tmpb->next;
|
||||
if (tmpb->template==tmpt) {
|
||||
QueRem(tmpb);
|
||||
BgtEntryDel2(tmpb);
|
||||
Free(tmpb);
|
||||
}
|
||||
tempb=tempb1;
|
||||
tmpb=tmpb1;
|
||||
}
|
||||
}
|
||||
|
||||
U0 BgtTemplateExpand(CBgtTemplate *tempt)
|
||||
U0 BgtTemplateExpand(CBgtTemplate *tmpt)
|
||||
{
|
||||
CDate d,start,end;
|
||||
CDateStruct ds;
|
||||
CBgtEntry *tempb;
|
||||
CBgtEntry *tmpb;
|
||||
|
||||
start=MyStr2Date(tempt->start_date);
|
||||
end =MyStr2Date(tempt->end_date);
|
||||
tempt->b.template=tempt;
|
||||
switch (tempt->type) {
|
||||
start=MyStr2Date(tmpt->start_date);
|
||||
end =MyStr2Date(tmpt->end_date);
|
||||
tmpt->b.template=tmpt;
|
||||
switch (tmpt->type) {
|
||||
case BT_INTERVAL:
|
||||
d=start;
|
||||
while (d<=end) {
|
||||
tempb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(tempb,&tempt->b,sizeof(CBgtEntry));
|
||||
tempb->date=d;
|
||||
tempb->type=BE_TEMPLATE_COPY;
|
||||
BgtIns(tempb);
|
||||
d+=tempt->period*0x100000000;
|
||||
tmpb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(tmpb,&tmpt->b,sizeof(CBgtEntry));
|
||||
tmpb->date=d;
|
||||
tmpb->type=BE_TEMPLATE_COPY;
|
||||
BgtIns(tmpb);
|
||||
d+=tmpt->period*0x100000000;
|
||||
}
|
||||
break;
|
||||
case BT_MONTHLY:
|
||||
@@ -39,11 +39,11 @@ U0 BgtTemplateExpand(CBgtTemplate *tempt)
|
||||
while (TRUE) {
|
||||
d=Struct2Date(&ds);
|
||||
if (d<=end) {
|
||||
tempb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(tempb,&tempt->b,sizeof(CBgtEntry));
|
||||
tempb->date=d;
|
||||
tempb->type=BE_TEMPLATE_COPY;
|
||||
BgtIns(tempb);
|
||||
tmpb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(tmpb,&tmpt->b,sizeof(CBgtEntry));
|
||||
tmpb->date=d;
|
||||
tmpb->type=BE_TEMPLATE_COPY;
|
||||
BgtIns(tmpb);
|
||||
} else
|
||||
break;
|
||||
if (++ds.mon>11) {
|
||||
@@ -57,11 +57,11 @@ U0 BgtTemplateExpand(CBgtTemplate *tempt)
|
||||
while (TRUE) {
|
||||
d=Struct2Date(&ds);
|
||||
if (d<=end) {
|
||||
tempb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(tempb,&tempt->b,sizeof(CBgtEntry));
|
||||
tempb->date=d;
|
||||
tempb->type=BE_TEMPLATE_COPY;
|
||||
BgtIns(tempb);
|
||||
tmpb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(tmpb,&tmpt->b,sizeof(CBgtEntry));
|
||||
tmpb->date=d;
|
||||
tmpb->type=BE_TEMPLATE_COPY;
|
||||
BgtIns(tmpb);
|
||||
} else
|
||||
break;
|
||||
ds.mon+=2;
|
||||
@@ -76,11 +76,11 @@ U0 BgtTemplateExpand(CBgtTemplate *tempt)
|
||||
while (TRUE) {
|
||||
d=Struct2Date(&ds);
|
||||
if (d<=end) {
|
||||
tempb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(tempb,&tempt->b,sizeof(CBgtEntry));
|
||||
tempb->date=d;
|
||||
tempb->type=BE_TEMPLATE_COPY;
|
||||
BgtIns(tempb);
|
||||
tmpb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(tmpb,&tmpt->b,sizeof(CBgtEntry));
|
||||
tmpb->date=d;
|
||||
tmpb->type=BE_TEMPLATE_COPY;
|
||||
BgtIns(tmpb);
|
||||
} else
|
||||
break;
|
||||
ds.mon+=6;
|
||||
@@ -95,11 +95,11 @@ U0 BgtTemplateExpand(CBgtTemplate *tempt)
|
||||
while (TRUE) {
|
||||
d=Struct2Date(&ds);
|
||||
if (d<=end) {
|
||||
tempb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(tempb,&tempt->b,sizeof(CBgtEntry));
|
||||
tempb->date=d;
|
||||
tempb->type=BE_TEMPLATE_COPY;
|
||||
BgtIns(tempb);
|
||||
tmpb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(tmpb,&tmpt->b,sizeof(CBgtEntry));
|
||||
tmpb->date=d;
|
||||
tmpb->type=BE_TEMPLATE_COPY;
|
||||
BgtIns(tmpb);
|
||||
} else
|
||||
break;
|
||||
ds.year++;
|
||||
@@ -110,17 +110,17 @@ U0 BgtTemplateExpand(CBgtTemplate *tempt)
|
||||
|
||||
U0 CBgtTemplatesExpand()
|
||||
{
|
||||
CBgtTemplate *tempt=t_head.next;
|
||||
while (tempt!=&t_head) {
|
||||
BgtTemplateExpand(tempt);
|
||||
tempt=tempt->next;
|
||||
CBgtTemplate *tmpt=t_head.next;
|
||||
while (tmpt!=&t_head) {
|
||||
BgtTemplateExpand(tmpt);
|
||||
tmpt=tmpt->next;
|
||||
}
|
||||
}
|
||||
|
||||
CBgtTemplate *BgtTemplatePmt(CBgtTemplate *dft_t=NULL)
|
||||
{
|
||||
CBgtTemplate t,*tempt;
|
||||
CBgtEntry *tempb,*dft_b;
|
||||
CBgtTemplate t,*tmpt;
|
||||
CBgtEntry *tmpb,*dft_b;
|
||||
MemSet(&t,0,sizeof(CBgtTemplate));
|
||||
if (dft_t) {
|
||||
MemCpy(&t.start,&dft_t->start,BT_SIZE);
|
||||
@@ -134,12 +134,12 @@ CBgtTemplate *BgtTemplatePmt(CBgtTemplate *dft_t=NULL)
|
||||
while (TRUE)
|
||||
if (PopUpForm(&t) && ((t.type==BT_INTERVAL && t.period>0) ||
|
||||
t.type>BT_INTERVAL)) {
|
||||
if (tempb=BgtEntryPmt(dft_b)) {
|
||||
tempt=CAlloc(sizeof(CBgtTemplate));
|
||||
MemCpy(&tempt->start,&t.start,BT_SIZE);
|
||||
MemCpy(&tempt->b,tempb,sizeof(CBgtEntry));
|
||||
Free(tempb);
|
||||
return tempt;
|
||||
if (tmpb=BgtEntryPmt(dft_b)) {
|
||||
tmpt=CAlloc(sizeof(CBgtTemplate));
|
||||
MemCpy(&tmpt->start,&t.start,BT_SIZE);
|
||||
MemCpy(&tmpt->b,tmpb,sizeof(CBgtEntry));
|
||||
Free(tmpb);
|
||||
return tmpt;
|
||||
}
|
||||
} else
|
||||
break;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#define BGT_STRINGS_FILE "~/Budget/Strs.DD.Z"
|
||||
#define BGT_ACCTS_FILE "~/Budget/Accts.DD.Z"
|
||||
#define BGT_DATA_FILE "~/Budget/Bgt.DAT.Z"
|
||||
#define BGT_DATA_FILE "~/Budget/Bgt.DATA.Z"
|
||||
|
||||
#define BE_NORMAL 0
|
||||
#define BE_GAS 1
|
||||
|
||||
Reference in new issue
Block a user