summaryrefslogtreecommitdiff
path: root/src/SSystem/SComponent/c_list.cpp
diff options
context:
space:
mode:
authorLuke Street <luke.street@encounterpc.com>2023-09-10 00:42:26 -0400
committerLuke Street <luke.street@encounterpc.com>2023-09-10 00:48:55 -0400
commitadb95b135c3d7498eba29bbd9728d345eed5a407 (patch)
tree655575b939c12067569263171b68c079b1a232c8 /src/SSystem/SComponent/c_list.cpp
parent81ac53f1317dafb3506ae3ed8b2820d40645c3c8 (diff)
Import project
Original repository: https://github.com/encounter/ww
Diffstat (limited to 'src/SSystem/SComponent/c_list.cpp')
-rw-r--r--src/SSystem/SComponent/c_list.cpp73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/SSystem/SComponent/c_list.cpp b/src/SSystem/SComponent/c_list.cpp
new file mode 100644
index 00000000..bb80882c
--- /dev/null
+++ b/src/SSystem/SComponent/c_list.cpp
@@ -0,0 +1,73 @@
+//
+// Generated by dtk
+// Translation Unit: c_list.cpp
+//
+
+#include "SSystem/SComponent/c_list.h"
+#include "SSystem/SComponent/c_node.h"
+#include "dolphin/types.h"
+
+/* 802449F4-80244A08 .text cLs_Init__FP15node_list_class */
+void cLs_Init(node_list_class* pList) {
+ pList->mpHead = NULL;
+ pList->mpTail = NULL;
+ pList->mSize = 0;
+}
+
+/* 80244A08-80244A8C .text cLs_SingleCut__FP10node_class */
+int cLs_SingleCut(node_class* pNode) {
+ node_list_class* pList = (node_list_class*)pNode->mpData;
+ if (pNode == pList->mpHead)
+ pList->mpHead = pNode->mpNextNode;
+ if (pNode == pList->mpTail)
+ pList->mpTail = pNode->mpPrevNode;
+ cNd_SingleCut(pNode);
+ cNd_ClearObject(pNode);
+ int newSize = pList->mSize - 1;
+ pList->mSize = newSize;
+ return newSize > 0;
+}
+
+/* 80244A8C-80244B00 .text cLs_Addition__FP15node_list_classP10node_class */
+int cLs_Addition(node_list_class* pList, node_class* pNode) {
+ if (pList->mpTail == NULL) {
+ pList->mpHead = pNode;
+ } else {
+ cNd_Addition(pList->mpTail, pNode);
+ }
+
+ pList->mpTail = cNd_Last(pNode);
+ cNd_SetObject(pNode, pList);
+ pList->mSize = cNd_LengthOf(pList->mpHead);
+ return pList->mSize;
+}
+
+/* 80244B00-80244B88 .text cLs_Insert__FP15node_list_classiP10node_class */
+int cLs_Insert(node_list_class* pList, int idx, node_class* pNode) {
+ node_class* pExisting = cNd_Order(pList->mpHead, idx);
+ if (pExisting == NULL) {
+ return cLs_Addition(pList, pNode);
+ } else {
+ cNd_SetObject(pNode, pList);
+ cNd_Insert(pExisting, pNode);
+ pList->mpHead = cNd_First(pNode);
+ pList->mSize = cNd_LengthOf(pList->mpHead);
+ return pList->mSize;
+ }
+}
+
+/* 80244B88-80244BD0 .text cLs_GetFirst__FP15node_list_class */
+node_class* cLs_GetFirst(node_list_class* pList) {
+ if (pList->mSize != 0) {
+ node_class* pHead = pList->mpHead;
+ cLs_SingleCut(pHead);
+ return pHead;
+ } else {
+ return NULL;
+ }
+}
+
+/* 80244BD0-80244BF0 .text cLs_Create__FP15node_list_class */
+void cLs_Create(node_list_class* pList) {
+ cLs_Init(pList);
+}