TempleOSCDV4.12.ISO
This commit is contained in:
1 parent
93ca216483
commit
b84bbff6db
381 files changed
+18356
-18798
No files matched your search
+48
-48
@@ -1,4 +1,4 @@
|
||||
#define TIME_FILENAME "~/TimeClock/TimeFile.DAT.Z"
|
||||
#define TIME_FILENAME "~/TimeClock/TimeFile.DATA.Z"
|
||||
|
||||
#define TET_EOF 0
|
||||
#define TET_PUNCH_IN 1
|
||||
@@ -16,19 +16,19 @@ U0 TimeFileRead(TimeEntry *header)
|
||||
{
|
||||
U8 *buf,*ptr;
|
||||
I64 type;
|
||||
TimeEntry *tempt;
|
||||
TimeEntry *tmpt;
|
||||
buf=FileRead(TIME_FILENAME);
|
||||
if (!buf)
|
||||
buf=CAlloc(1);
|
||||
QueInit(header);
|
||||
ptr=buf;
|
||||
while (type=*ptr++) {
|
||||
tempt=CAlloc(sizeof(TimeEntry));
|
||||
tempt->type=type;
|
||||
tempt->datetime=*ptr(CDate *)++;
|
||||
tempt->desc=StrNew(ptr);
|
||||
tmpt=CAlloc(sizeof(TimeEntry));
|
||||
tmpt->type=type;
|
||||
tmpt->datetime=*ptr(CDate *)++;
|
||||
tmpt->desc=StrNew(ptr);
|
||||
ptr+=StrLen(ptr)+1;
|
||||
QueIns(tempt,header->last);
|
||||
QueIns(tmpt,header->last);
|
||||
}
|
||||
Free(buf);
|
||||
}
|
||||
@@ -36,24 +36,24 @@ U0 TimeFileRead(TimeEntry *header)
|
||||
U0 TimeFileWrite(TimeEntry *header)
|
||||
{
|
||||
U8 *buf,*ptr;
|
||||
TimeEntry *tempt;
|
||||
TimeEntry *tmpt;
|
||||
I64 size=1; //for EOF
|
||||
|
||||
tempt=header->next;
|
||||
while (tempt!=header) {
|
||||
size+=sizeof(U8)+sizeof(CDate)+StrLen(tempt->desc)+1;
|
||||
tempt=tempt->next;
|
||||
tmpt=header->next;
|
||||
while (tmpt!=header) {
|
||||
size+=sizeof(U8)+sizeof(CDate)+StrLen(tmpt->desc)+1;
|
||||
tmpt=tmpt->next;
|
||||
}
|
||||
buf=MAlloc(size);
|
||||
|
||||
ptr=buf;
|
||||
tempt=header->next;
|
||||
while (tempt!=header) {
|
||||
*ptr++=tempt->type;
|
||||
*ptr(CDate *)++=tempt->datetime;
|
||||
StrCpy(ptr,tempt->desc);
|
||||
ptr+=StrLen(tempt->desc)+1;
|
||||
tempt=tempt->next;
|
||||
tmpt=header->next;
|
||||
while (tmpt!=header) {
|
||||
*ptr++=tmpt->type;
|
||||
*ptr(CDate *)++=tmpt->datetime;
|
||||
StrCpy(ptr,tmpt->desc);
|
||||
ptr+=StrLen(tmpt->desc)+1;
|
||||
tmpt=tmpt->next;
|
||||
}
|
||||
*ptr=TET_EOF;
|
||||
FileWrite(TIME_FILENAME,buf,size);
|
||||
@@ -62,12 +62,12 @@ U0 TimeFileWrite(TimeEntry *header)
|
||||
|
||||
U0 TimeEntriesDel(TimeEntry *header)
|
||||
{
|
||||
TimeEntry *tempt=header->next,*tempt1;
|
||||
while (tempt!=header) {
|
||||
tempt1=tempt->next;
|
||||
Free(tempt->desc);
|
||||
Free(tempt);
|
||||
tempt=tempt1;
|
||||
TimeEntry *tmpt=header->next,*tmpt1;
|
||||
while (tmpt!=header) {
|
||||
tmpt1=tmpt->next;
|
||||
Free(tmpt->desc);
|
||||
Free(tmpt);
|
||||
tmpt=tmpt1;
|
||||
}
|
||||
Free(header);
|
||||
}
|
||||
@@ -76,12 +76,12 @@ public Bool TimeRep(TimeEntry **_header=NULL)
|
||||
{
|
||||
Bool is_in=FALSE,first=TRUE;
|
||||
I64 week,cur_week=-1,week_total;
|
||||
TimeEntry *tempt,*header=MAlloc(sizeof(TimeEntry));
|
||||
TimeEntry *tmpt,*header=MAlloc(sizeof(TimeEntry));
|
||||
if (_header) *_header=header;
|
||||
TimeFileRead(header);
|
||||
tempt=header->next;
|
||||
while (tempt!=header) {
|
||||
week=tempt->datetime.date/7; //TODO
|
||||
tmpt=header->next;
|
||||
while (tmpt!=header) {
|
||||
week=tmpt->datetime.date/7; //TODO
|
||||
if (week!=cur_week) {
|
||||
if (!first) {
|
||||
if (is_in)
|
||||
@@ -92,19 +92,19 @@ public Bool TimeRep(TimeEntry **_header=NULL)
|
||||
cur_week=week;
|
||||
week_total=0;
|
||||
}
|
||||
if (tempt->type==TET_PUNCH_IN) {
|
||||
if (tmpt->type==TET_PUNCH_IN) {
|
||||
"$$RED$$IN ";
|
||||
if (!is_in)
|
||||
week_total-=tempt->datetime;
|
||||
week_total-=tmpt->datetime;
|
||||
is_in=TRUE;
|
||||
} else {
|
||||
"$$RED$$OUT";
|
||||
if (is_in)
|
||||
week_total+=tempt->datetime;
|
||||
week_total+=tmpt->datetime;
|
||||
is_in=FALSE;
|
||||
}
|
||||
" %D %T:$$FG$$\n%s\n",tempt->datetime,tempt->datetime,tempt->desc;
|
||||
tempt=tempt->next;
|
||||
" %D %T:$$FG$$\n%s\n",tmpt->datetime,tmpt->datetime,tmpt->desc;
|
||||
tmpt=tmpt->next;
|
||||
}
|
||||
if (is_in)
|
||||
week_total+=Now;
|
||||
@@ -116,17 +116,17 @@ public Bool TimeRep(TimeEntry **_header=NULL)
|
||||
|
||||
public U0 PunchOut()
|
||||
{
|
||||
TimeEntry *tempt,*header;
|
||||
TimeEntry *tmpt,*header;
|
||||
if (!TimeRep(&header))
|
||||
"$$BK,1$$Already Punched-Out$$BK,0$$\n";
|
||||
else {
|
||||
tempt=MAlloc(sizeof(TimeEntry));
|
||||
tempt->type=TET_PUNCH_OUT;
|
||||
tempt->datetime=Now;
|
||||
tmpt=MAlloc(sizeof(TimeEntry));
|
||||
tmpt->type=TET_PUNCH_OUT;
|
||||
tmpt->datetime=Now;
|
||||
"\nEnter Description.\nPress <ESC> when done.\n";
|
||||
if (!(tempt->desc=GetStr(,,GSF_WITH_NEW_LINE)))
|
||||
tempt->desc=CAlloc(1);
|
||||
QueIns(tempt,header->last);
|
||||
if (!(tmpt->desc=GetStr(,,GSF_WITH_NEW_LINE)))
|
||||
tmpt->desc=CAlloc(1);
|
||||
QueIns(tmpt,header->last);
|
||||
TimeFileWrite(header);
|
||||
}
|
||||
TimeEntriesDel(header);
|
||||
@@ -134,17 +134,17 @@ public U0 PunchOut()
|
||||
|
||||
public U0 PunchIn()
|
||||
{
|
||||
TimeEntry *tempt,*header;
|
||||
TimeEntry *tmpt,*header;
|
||||
if (TimeRep(&header))
|
||||
"$$BK,1$$Already Punched-In$$BK,0$$\n";
|
||||
else {
|
||||
tempt=MAlloc(sizeof(TimeEntry));
|
||||
tempt->type=TET_PUNCH_IN;
|
||||
tempt->datetime=Now;
|
||||
tmpt=MAlloc(sizeof(TimeEntry));
|
||||
tmpt->type=TET_PUNCH_IN;
|
||||
tmpt->datetime=Now;
|
||||
"\nEnter Description.\nPress <ESC> when done.\n";
|
||||
if (!(tempt->desc=GetStr(,,GSF_WITH_NEW_LINE)))
|
||||
tempt->desc=CAlloc(1);
|
||||
QueIns(tempt,header->last);
|
||||
if (!(tmpt->desc=GetStr(,,GSF_WITH_NEW_LINE)))
|
||||
tmpt->desc=CAlloc(1);
|
||||
QueIns(tmpt,header->last);
|
||||
TimeFileWrite(header);
|
||||
}
|
||||
TimeEntriesDel(header);
|
||||
|
||||
Reference in new issue
Block a user