ref: 1d16496ba7c15cc5dd9c34e8a6f2f94385be0612
parent: 4dc405c85c202744355350de7c5bf7b029fe78c0
author: cancel <cancel@cancel.fm>
date: Tue Nov 27 14:02:41 EST 2018
Add bank.h/.c
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@
debug_flags := $(debug_flags) -Og -feliminate-unused-debug-symbols
tui_library_flags := -lncursesw
endif
-common_source_files := field.c mark.c sim.c
+common_source_files := field.c mark.c bank.c sim.c
tui_source_files := $(common_source_files) tui_main.c
cli_source_files := $(common_source_files) cli_main.c
--- /dev/null
+++ b/bank.c
@@ -1,0 +1,10 @@
+#include "bank.h"
+
+void bank_init(Bank* bank) {
+ bank->data = NULL;
+ bank->capacity = 0;
+}
+
+void bank_deinit(Bank* bank) {
+ free(bank->data);
+}
--- /dev/null
+++ b/bank.h
@@ -1,0 +1,16 @@
+#include "base.h"
+
+typedef struct {
+ U32 grid_index;
+ U8 size;
+} Bank_entry;
+
+typedef struct {
+ char* data;
+ Usz capacity;
+} Bank;
+
+typedef char* Bank_cursor;
+
+void bank_init(Bank* bank);
+void bank_deinit(Bank* bank);