summaryrefslogtreecommitdiff
path: root/src/text-buffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/text-buffer.h')
-rw-r--r--src/text-buffer.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/text-buffer.h b/src/text-buffer.h
new file mode 100644
index 0000000..5361534
--- /dev/null
+++ b/src/text-buffer.h
@@ -0,0 +1,39 @@
+/* parc
+ * Copyright (C) 2025 Ekaitz Zarraga <ekaitz@elenq.tech>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TEXT_BUFFER_H
+#define TEXT_BUFFER_H
+
+#include <stddef.h>
+
+typedef struct
+ {
+ size_t used;
+ size_t size;
+ char *contents;
+ }
+text_buffer;
+
+void text_buffer_init (text_buffer *tb);
+void text_buffer_resize (text_buffer *tb, size_t size);
+void text_buffer_append (text_buffer *tb, char c);
+char text_buffer_index (text_buffer *tb, size_t pos);
+void text_buffer_empty (text_buffer *tb);
+void text_buffer_fill (text_buffer *tb, char *fill, size_t size);
+void text_buffer_free (text_buffer *tb);
+
+#endif /* TEXT_BUFFER_H */