TempleOSCD_150216.ISO
This commit is contained in:
1 parent
64f679eeb9
commit
401601816c
531 files changed
+23341
-22071
No files matched your search
+17
-13
@@ -5,15 +5,15 @@ U0 BgtAcctsUpdate()
|
||||
tempb=b_root.next;
|
||||
while (tempb!=&b_root) {
|
||||
if (tempb->type!=BE_TEMPLATE_COPY) {
|
||||
tempb->credit_index =StrFileAdd(tempb->credit,accts_table);
|
||||
tempb->debit_index =StrFileAdd(tempb->debit,accts_table);
|
||||
tempb->credit_index =StrFileAdd(tempb->credit,&accts_table_strs,accts_table);
|
||||
tempb->debit_index =StrFileAdd(tempb->debit,&accts_table_strs,accts_table);
|
||||
}
|
||||
tempb=tempb->next;
|
||||
}
|
||||
tempt=t_root.next;
|
||||
while (tempt!=&t_root) {
|
||||
tempt->b.credit_index =StrFileAdd(tempt->b.credit,accts_table);
|
||||
tempt->b.debit_index =StrFileAdd(tempt->b.debit,accts_table);
|
||||
tempt->b.credit_index =StrFileAdd(tempt->b.credit,&accts_table_strs,accts_table);
|
||||
tempt->b.debit_index =StrFileAdd(tempt->b.debit,&accts_table_strs,accts_table);
|
||||
tempt=tempt->next;
|
||||
}
|
||||
}
|
||||
@@ -29,10 +29,11 @@ U0 BgtAcctsRead()
|
||||
I64 i,max_num;
|
||||
U8 *colors,**s=StrFileRead(BGT_ACCTS_FILE,&max_num,&colors,TRUE);
|
||||
StrFileDel(accts_table);
|
||||
accts_table=HashTableNew(0x200);
|
||||
accts_table=HashTableNew(512);
|
||||
accts_table_strs=0;
|
||||
for (i=0;i<=max_num;i++)
|
||||
if (s[i])
|
||||
StrFileAdd(s[i],accts_table,colors[i]);
|
||||
StrFileAdd(s[i],&accts_table_strs,accts_table,colors[i]);
|
||||
StrFileArrDel(s,max_num);
|
||||
Free(colors);
|
||||
}
|
||||
@@ -48,6 +49,7 @@ I64 BgtAcctColor(U8 *st)
|
||||
|
||||
U8 *BgtPopUpAcct(U8 *header=NULL,U8 *dft=NULL)
|
||||
{
|
||||
I64 i;
|
||||
U8 *result;
|
||||
CDoc *doc=DocNew;
|
||||
CDocEntry *doc_e,*doc_dft=NULL;
|
||||
@@ -56,13 +58,15 @@ U8 *BgtPopUpAcct(U8 *header=NULL,U8 *dft=NULL)
|
||||
if (header)
|
||||
DocPrint(doc,"%s",header);
|
||||
|
||||
temph=accts_table->next_added;
|
||||
while (temph!=accts_table) {
|
||||
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))
|
||||
doc_dft=doc_e;
|
||||
temph=temph->next_added;
|
||||
for (i=0;i<=accts_table->mask;i++) {
|
||||
temph=accts_table->body[i];
|
||||
while (temph) {
|
||||
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))
|
||||
doc_dft=doc_e;
|
||||
temph=temph->next;
|
||||
}
|
||||
}
|
||||
|
||||
if (doc_dft) {
|
||||
|
||||
@@ -62,8 +62,8 @@ CBgtEntry *BgtEntryPmt(CBgtEntry *dft=NULL)
|
||||
tempb->debit =StrNew(b.debit);
|
||||
tempb->desc =StrNew(b.desc);
|
||||
tempb->type =BE_NORMAL;
|
||||
StrFileAdd(tempb->credit,accts_table);
|
||||
StrFileAdd(tempb->debit,accts_table);
|
||||
StrFileAdd(tempb->credit,&accts_table_strs,accts_table);
|
||||
StrFileAdd(tempb->debit,&accts_table_strs,accts_table);
|
||||
return tempb;
|
||||
}
|
||||
} else
|
||||
|
||||
+15
-12
@@ -48,26 +48,28 @@ U0 BgtDataRead()
|
||||
|
||||
U0 BgtDataWrite()
|
||||
{
|
||||
I64 size,cnt1,cnt2;
|
||||
CHashTable *table=HashTableNew(0x1000);
|
||||
I64 i,num=0,size,cnt1,cnt2;
|
||||
CHashTable *table=HashTableNew(1024);
|
||||
CBgtEntry *tempb;
|
||||
CBgtTemplate *tempt;
|
||||
CHashGeneric *temph;
|
||||
U8 *buf,*ptr;
|
||||
|
||||
temph=accts_table->next_added;
|
||||
while (temph!=accts_table) {
|
||||
StrFileAdd(temph->str,table); //Make so accts come first. (Cosmetic)
|
||||
temph=temph->next_added;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
tempb=b_root.next;
|
||||
cnt1=0;
|
||||
while (tempb!=&b_root) {
|
||||
if (tempb->type!=BE_TEMPLATE_COPY) {
|
||||
tempb->credit_index =StrFileAdd(tempb->credit,table);
|
||||
tempb->debit_index =StrFileAdd(tempb->debit,table);
|
||||
tempb->desc_index =StrFileAdd(tempb->desc,table);
|
||||
tempb->credit_index =StrFileAdd(tempb->credit,&num,table);
|
||||
tempb->debit_index =StrFileAdd(tempb->debit,&num,table);
|
||||
tempb->desc_index =StrFileAdd(tempb->desc,&num,table);
|
||||
cnt1++;
|
||||
}
|
||||
tempb=tempb->next;
|
||||
@@ -76,9 +78,9 @@ U0 BgtDataWrite()
|
||||
tempt=t_root.next;
|
||||
cnt2=0;
|
||||
while (tempt!=&t_root) {
|
||||
tempt->b.credit_index =StrFileAdd(tempt->b.credit,table);
|
||||
tempt->b.debit_index =StrFileAdd(tempt->b.debit,table);
|
||||
tempt->b.desc_index =StrFileAdd(tempt->b.desc,table);
|
||||
tempt->b.credit_index =StrFileAdd(tempt->b.credit,&num,table);
|
||||
tempt->b.debit_index =StrFileAdd(tempt->b.debit,&num,table);
|
||||
tempt->b.desc_index =StrFileAdd(tempt->b.desc,&num,table);
|
||||
cnt2++;
|
||||
tempt=tempt->next;
|
||||
}
|
||||
@@ -134,4 +136,5 @@ U0 BgtDel()
|
||||
}
|
||||
StrFileDel(accts_table);
|
||||
accts_table=NULL;
|
||||
accts_table_strs=0;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ Bool BgtPutKey(CDoc *doc,U8 *,I64 ch,I64 sc)
|
||||
case 'a':
|
||||
PopUpOk( "Set the name and color of your accounts.\n"
|
||||
"To delete accounts, manually edit\n"
|
||||
"$$GREEN$$HOME/Budget/Accts.TXT.Z$$FG$$.");
|
||||
"$$GREEN$$/Home/Budget/Accts.TXT.Z$$FG$$.");
|
||||
if (PopUpEd(BGT_ACCTS_FILE,Fs)) {
|
||||
BgtAcctsRead;
|
||||
BgtRegen;
|
||||
@@ -163,7 +163,7 @@ U0 Budget()
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
WinMax;
|
||||
WinBorder;
|
||||
WordStat;
|
||||
AutoComplete;
|
||||
MenuPush(
|
||||
"File {"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
|
||||
+34
-16
@@ -53,7 +53,7 @@ public U0 StrFileArrDel(U8 **a,I64 max_num)
|
||||
Free(a);
|
||||
}
|
||||
|
||||
public I64 StrFileAdd(U8 *st,CHashTable *table,I64 color=COLOR_INVALID)
|
||||
public I64 StrFileAdd(U8 *st,I64 *_num,CHashTable *table,I64 color=COLOR_INVALID)
|
||||
{
|
||||
CHashGeneric *temph;
|
||||
if (!st) return 0;
|
||||
@@ -61,10 +61,7 @@ public I64 StrFileAdd(U8 *st,CHashTable *table,I64 color=COLOR_INVALID)
|
||||
temph=CAlloc(sizeof(CHashGeneric));
|
||||
temph->type=SFT_GENERIC;
|
||||
temph->str=StrNew(st);
|
||||
if (table->last_added==table)
|
||||
temph->user_data0=1;
|
||||
else
|
||||
temph->user_data0=table->last_added(CHashGeneric *)->user_data0+1;
|
||||
temph->user_data0=(*_num)++;
|
||||
HashAdd(temph,table);
|
||||
}
|
||||
if (color!=COLOR_INVALID)
|
||||
@@ -72,14 +69,32 @@ public I64 StrFileAdd(U8 *st,CHashTable *table,I64 color=COLOR_INVALID)
|
||||
return temph->user_data0;
|
||||
}
|
||||
|
||||
I64 StrEntriesCompare(CHashGeneric *h1,CHashGeneric *h2)
|
||||
{
|
||||
return h1->user_data0-h2->user_data0;
|
||||
}
|
||||
|
||||
public U0 StrFileWrite(U8 *name,CHashTable *table,Bool no_nums=FALSE)
|
||||
{
|
||||
I64 color=BLACK;
|
||||
I64 i,j,cnt,color=BLACK;
|
||||
CDoc *doc=DocNew(name);
|
||||
CHashGeneric *temph;
|
||||
CHashGeneric *temph,**a;
|
||||
if (table) {
|
||||
temph=table->next_added;
|
||||
while (temph!=table) {
|
||||
cnt=0; //Count Strings
|
||||
for (i=0;i<=table->mask;i++)
|
||||
cnt+=LinkedLstCnt(table->body[i]);
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
@@ -88,8 +103,8 @@ public U0 StrFileWrite(U8 *name,CHashTable *table,Bool no_nums=FALSE)
|
||||
DocPrint(doc,"%s\n",temph->str);
|
||||
else
|
||||
DocPrint(doc,"%d,%s\n",temph->user_data0,temph->str);
|
||||
temph=temph->next_added;
|
||||
}
|
||||
Free(a);
|
||||
}
|
||||
doc->flags|=DOCF_NO_CURSOR;
|
||||
DocWrite(doc);
|
||||
@@ -98,14 +113,17 @@ public U0 StrFileWrite(U8 *name,CHashTable *table,Bool no_nums=FALSE)
|
||||
|
||||
public U0 StrFileDel(CHashTable *table)
|
||||
{
|
||||
I64 i;
|
||||
CHashGeneric *temph,*temph1;
|
||||
if (!table) return;
|
||||
temph=table->next_added;
|
||||
while (temph!=table) {
|
||||
temph1=temph->next_added;
|
||||
Free(temph->str);
|
||||
Free(temph);
|
||||
temph=temph1;
|
||||
for (i=0;i<=table->mask;i++) {
|
||||
temph=table->body[i];
|
||||
while (temph) {
|
||||
temph1=temph->next;
|
||||
Free(temph->str);
|
||||
Free(temph);
|
||||
temph=temph1;
|
||||
}
|
||||
}
|
||||
Free(table->body);
|
||||
Free(table);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#define BGT_STRINGS_FILE "HOME/Budget/Strs.TXT.Z"
|
||||
#define BGT_ACCTS_FILE "HOME/Budget/Accts.TXT.Z"
|
||||
#define BGT_DATA_FILE "HOME/Budget/Bgt.DAT.Z"
|
||||
#define BGT_STRINGS_FILE "::/Home/Budget/Strs.TXT.Z"
|
||||
#define BGT_ACCTS_FILE "::/Home/Budget/Accts.TXT.Z"
|
||||
#define BGT_DATA_FILE "::/Home/Budget/Bgt.DAT.Z"
|
||||
|
||||
#define BE_NORMAL 0
|
||||
#define BE_GAS 1
|
||||
@@ -55,6 +55,7 @@ class CBgtTemplate
|
||||
|
||||
U8 view_acct[512];
|
||||
CHashTable *accts_table=NULL;
|
||||
I64 accts_table_strs=0;
|
||||
|
||||
CDate MyStr2Date(U8 *st)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
if (!FileFind("HOME/Budget",,FUF_JUST_DIRS)) {
|
||||
MkDir("HOME/Budget");
|
||||
Copy("/Apps/Budget/Accts.TXT.Z","HOME/Budget");
|
||||
Cd(__DIR__);;
|
||||
if (!FileFind("::/Home/Budget",,FUF_JUST_DIRS)) {
|
||||
MkDir("::/Home/Budget");
|
||||
Copy("Accts.TXT.Z","::/Home/Budget");
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
#help_index "Finance"
|
||||
|
||||
#include "/Apps/Budget/BgtStrs"
|
||||
#include "/Apps/Budget/Budget"
|
||||
#include "/Apps/Budget/BgtAccts"
|
||||
#include "/Apps/Budget/BgtEntry"
|
||||
#include "/Apps/Budget/BgtTemplate"
|
||||
#include "/Apps/Budget/BgtFile"
|
||||
#include "/Apps/Budget/BgtMain"
|
||||
Cd(__DIR__);;
|
||||
#include "BgtStrs"
|
||||
#include "Budget"
|
||||
#include "BgtAccts"
|
||||
#include "BgtEntry"
|
||||
#include "BgtTemplate"
|
||||
#include "BgtFile"
|
||||
#include "BgtMain"
|
||||
|
||||
#help_index ""
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
Cd("/Apps/Budget");;
|
||||
Cd(__DIR__);;
|
||||
#include "Load"
|
||||
#include "Install" //Might as well always install
|
||||
Budget;
|
||||
Reference in new issue
Block a user