aboutsummaryrefslogtreecommitdiff
path: root/src/fbuf.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/fbuf.h')
-rw-r--r--src/fbuf.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/fbuf.h b/src/fbuf.h
new file mode 100644
index 0000000..212979b
--- /dev/null
+++ b/src/fbuf.h
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+/*Oh boy, CS101 linked lists*/
+struct LLNode{
+ size_t length;
+ char* data;
+ struct LLNode* next;
+};
+
+struct TMPL_buf{
+ size_t total_len;
+ struct LLNode* head;
+ struct LLNode* tail;
+};
+
+void bputs(struct TMPL_buf* b, char* s);
+void bputsn(struct TMPL_buf* b, char* s, size_t size);
+
+void bputc(struct TMPL_buf* b, char s);
+
+struct TMPL_buf* alloc_tmpl_buf(void);
+
+void free_tmpl_buf(struct TMPL_buf* b);
+
+char* bstringify(struct TMPL_buf* b, size_t* size);
+
+void bprint(struct TMPL_buf* b);