Files
tp/libs/SSystem/SComponent/c_list.cpp
T

76 lines
2.2 KiB
C++
Raw Normal View History

/**
* c_list.cpp
*
*/
2020-11-30 14:26:55 -08:00
2021-03-29 00:10:25 +02:00
#include "SSystem/SComponent/c_list.h"
2023-05-12 12:10:14 -07:00
#include "SSystem/SComponent/c_node.h"
2021-03-28 22:49:05 +02:00
#include "dolphin/types.h"
2020-11-30 14:26:55 -08:00
2021-03-29 00:10:25 +02:00
/* 80265E64-80265E78 0014+00 s=1 e=0 z=0 None .text cLs_Init__FP15node_list_class */
void cLs_Init(node_list_class* list) {
list->mpHead = NULL;
list->mpTail = NULL;
list->mSize = 0;
2020-11-30 14:26:55 -08:00
}
2021-03-29 00:10:25 +02:00
/* 80265E78-80265EFC 0084+00 s=1 e=4 z=0 None .text cLs_SingleCut__FP10node_class */
int cLs_SingleCut(node_class* node) {
node_list_class* list = (node_list_class*)node->mpData;
if (node == list->mpHead)
list->mpHead = node->mpNextNode;
if (node == list->mpTail)
list->mpTail = node->mpPrevNode;
cNd_SingleCut(node);
cNd_ClearObject(node);
int newSize = list->mSize - 1;
list->mSize = newSize;
2021-03-30 02:45:32 +02:00
return newSize > 0;
2020-11-30 14:26:55 -08:00
}
2021-03-29 00:10:25 +02:00
/* 80265EFC-80265F70 0074+00 s=1 e=4 z=0 None .text
* cLs_Addition__FP15node_list_classP10node_class */
int cLs_Addition(node_list_class* list, node_class* node) {
if (list->mpTail == NULL) {
list->mpHead = node;
2021-03-30 02:45:32 +02:00
} else {
cNd_Addition(list->mpTail, node);
2021-03-30 02:45:32 +02:00
}
list->mpTail = cNd_Last(node);
cNd_SetObject(node, list);
list->mSize = cNd_LengthOf(list->mpHead);
return list->mSize;
2020-11-30 14:26:55 -08:00
}
2021-03-29 00:10:25 +02:00
/* 80265F70-80265FF8 0088+00 s=0 e=1 z=0 None .text cLs_Insert__FP15node_list_classiP10node_class
*/
int cLs_Insert(node_list_class* list, int idx, node_class* node) {
node_class* pExisting = cNd_Order(list->mpHead, idx);
2021-03-30 02:45:32 +02:00
if (pExisting == NULL) {
return cLs_Addition(list, node);
2021-03-30 02:45:32 +02:00
} else {
cNd_SetObject(node, list);
cNd_Insert(pExisting, node);
list->mpHead = cNd_First(node);
list->mSize = cNd_LengthOf(list->mpHead);
return list->mSize;
2021-03-30 02:45:32 +02:00
}
2020-11-30 14:26:55 -08:00
}
2021-03-29 00:10:25 +02:00
/* 80265FF8-80266040 0048+00 s=0 e=1 z=0 None .text cLs_GetFirst__FP15node_list_class */
node_class* cLs_GetFirst(node_list_class* list) {
if (list->mSize != 0) {
node_class* pHead = list->mpHead;
2021-03-30 02:45:32 +02:00
cLs_SingleCut(pHead);
return pHead;
} else {
return NULL;
}
2020-11-30 14:26:55 -08:00
}
2021-03-28 22:49:05 +02:00
2021-03-29 00:10:25 +02:00
/* 80266040-80266060 0020+00 s=0 e=4 z=0 None .text cLs_Create__FP15node_list_class */
void cLs_Create(node_list_class* list) {
cLs_Init(list);
2021-03-28 22:49:05 +02:00
}