From b9899c6cbe2f694c9db36e9d4e15c532d10b546f Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Thu, 25 Oct 2018 12:08:54 -0400 Subject: Started refactoring code Added a src/ and build/ directory Added a include/ directory Included file is smaller --- src/fbuf.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/fbuf.h (limited to 'src/fbuf.h') 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 +#include +#include + +/*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); -- cgit v1.2.3-70-g09d2