TempleOSCDV4.12.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:47:56 +02:00
1 parent 93ca216483
commit b84bbff6db
381 files changed
+18356 -18798

No files matched your search

+42 -42
View File
@@ -1,18 +1,18 @@
U0 LinkedLstDel(U8 **_lst)
{//Free entire linked-list.
U8 **templ;
U8 **tmpl;
while (_lst) {
templ=*_lst;
tmpl=*_lst;
Free(_lst);
_lst=templ;
_lst=tmpl;
}
}
U8 *LinkedLstCopy(U8 **_lst,CTask *mem_task=NULL)
{//MAlloc ident copy of entire linked-list.
U8 *res=NULL,**templ=&res;
U8 *res=NULL,**tmpl=&res;
while (_lst) {
templ=*templ=MAllocIdent(_lst,mem_task);
tmpl=*tmpl=MAllocIdent(_lst,mem_task);
_lst=*_lst;
}
return res;
@@ -40,46 +40,46 @@ I64 LinkedLstSize(U8 **_lst)
U0 QueDel(CQue *head,Bool querem=FALSE)
{//Free entries in queue, not head.
CQue *tempq=head->next,*tempq1;
while (tempq!=head) {
tempq1=tempq->next;
CQue *tmpq=head->next,*tmpq1;
while (tmpq!=head) {
tmpq1=tmpq->next;
if (querem)
QueRem(tempq);
Free(tempq);
tempq=tempq1;
QueRem(tmpq);
Free(tmpq);
tmpq=tmpq1;
}
}
CQue *QueCopy(CQue *head,CTask *mem_task=NULL)
{//MAlloc ident copy of entire queue and head.
CQue *res=MAllocIdent(head,mem_task),*tempq=head->next,*tempq1;
CQue *res=MAllocIdent(head,mem_task),*tmpq=head->next,*tmpq1;
QueInit(res);
while (tempq!=head) {
tempq1=MAllocIdent(tempq,mem_task);
QueIns(tempq1,res->last);
tempq=tempq->next;
while (tmpq!=head) {
tmpq1=MAllocIdent(tmpq,mem_task);
QueIns(tmpq1,res->last);
tmpq=tmpq->next;
}
return res;
}
I64 QueCnt(CQue *head)
{//Count of nodes in queue, not head.
CQue *tempq=head->next;
CQue *tmpq=head->next;
I64 res=0;
while (tempq!=head) {
while (tmpq!=head) {
res++;
tempq=tempq->next;
tmpq=tmpq->next;
}
return res;
}
I64 QueSize(CQue *head)
{//Mem size of all nodes in queue, not head.
CQue *tempq=head->next;
CQue *tmpq=head->next;
I64 res=0;
while (tempq!=head) {
res+=MSize2(tempq);
tempq=tempq->next;
while (tmpq!=head) {
res+=MSize2(tmpq);
tmpq=tmpq->next;
}
return res;
}
@@ -95,34 +95,34 @@ CQueVectU8 *QueVectU8New(I64 min_idx=0)
U0 QueVectU8Put(CQueVectU8 *v,I64 idx,U8 ch)
{//Put U8 at idx i.
CQueVectU8 *tempv;
CQueVectU8 *tmpv;
idx-=v->min_idx;
if (idx<0) return;
if (idx<v->total_cnt) {
tempv=v;
tmpv=v;
do {
idx-=tempv->node_cnt;
idx-=tmpv->node_cnt;
if (idx<0) {
tempv->body[idx+tempv->node_cnt]=ch;
tmpv->body[idx+tmpv->node_cnt]=ch;
return;
}
tempv=tempv->next;
} while (tempv!=v);
tmpv=tmpv->next;
} while (tmpv!=v);
} else
idx-=v->total_cnt;
while (TRUE) {
tempv=v->last;
if (tempv->node_cnt>=QUE_VECT_U8_CNT) {
tempv=MAlloc(sizeof(CQueVectU8));
tempv->node_cnt=0;
QueIns(tempv,v->last);
tmpv=v->last;
if (tmpv->node_cnt>=QUE_VECT_U8_CNT) {
tmpv=MAlloc(sizeof(CQueVectU8));
tmpv->node_cnt=0;
QueIns(tmpv,v->last);
}
if (idx--) {
tempv->body[tempv->node_cnt++]=0;
tmpv->body[tmpv->node_cnt++]=0;
v->total_cnt++;
} else {
tempv->body[tempv->node_cnt++]=ch;
tmpv->body[tmpv->node_cnt++]=ch;
v->total_cnt++;
break;
}
@@ -139,16 +139,16 @@ U0 QueVectU8Del(CQueVectU8 *v)
I64 QueVectU8Get(CQueVectU8 *v,I64 idx)
{//Get U8 at idx i.
CQueVectU8 *tempv;
CQueVectU8 *tmpv;
idx-=v->min_idx;
if (!(0<=idx<v->total_cnt)) return 0;
tempv=v;
tmpv=v;
do {
idx-=tempv->node_cnt;
idx-=tmpv->node_cnt;
if (idx<0)
return tempv->body[idx+tempv->node_cnt];
tempv=tempv->next;
} while (tempv!=v);
return tmpv->body[idx+tmpv->node_cnt];
tmpv=tmpv->next;
} while (tmpv!=v);
return 0;
}