aboutsummaryrefslogtreecommitdiff
path: root/include/std_gc
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-01-25 09:48:56 +0100
committerdec05eba <dec05eba@protonmail.com>2020-01-25 09:48:56 +0100
commit4b2b8d3176e84f76510cc69a627dbfa089c1dd35 (patch)
tree67e3324b3452cf2b09e51a91acd1e5dec9d89040 /include/std_gc
parent1dd53ce54c2008e3a11a636a496853cf6f9a5d65 (diff)
Implement almost all instructions
Diffstat (limited to 'include/std_gc')
-rw-r--r--include/std_gc/hash_map.h3
-rw-r--r--include/std_gc/list.h21
2 files changed, 23 insertions, 1 deletions
diff --git a/include/std_gc/hash_map.h b/include/std_gc/hash_map.h
index e67dd75..e1a016d 100644
--- a/include/std_gc/hash_map.h
+++ b/include/std_gc/hash_map.h
@@ -1,8 +1,9 @@
#ifndef TSL_HASH_MAP_H
#define TSL_HASH_MAP_H
-#include "../value.h"
+#include "../forward_decl.h"
#include <stdint.h>
+#include <stddef.h>
/* TODO: Optimize small hash map by using the members of the struct instead of allocating on heap */
typedef struct {
diff --git a/include/std_gc/list.h b/include/std_gc/list.h
new file mode 100644
index 0000000..469f585
--- /dev/null
+++ b/include/std_gc/list.h
@@ -0,0 +1,21 @@
+#ifndef TSL_LIST_H
+#define TSL_LIST_H
+
+#include "../forward_decl.h"
+#include <stddef.h>
+
+typedef struct {
+ void *data;
+ size_t size;
+ size_t capacity;
+} TslList;
+
+void tsl_list_init(TslList *self);
+int tsl_list_append(TslList *self, const TslValue *data);
+int tsl_list_set_capacity_hint(TslList *self, size_t capacity);
+TslValue* tsl_list_begin(TslList *self);
+TslValue* tsl_list_end(TslList *self);
+/* Returns NULL if index is out of bounds of the list */
+TslValue* tsl_list_get(TslList *self, double index);
+
+#endif /* TSL_LIST_H */