From 517805980b106b5ae44e74f8a9b58e76c09c3124 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Thu, 21 Aug 2025 21:51:47 +0200 Subject: text-buffer: Move to a separate file. --- src/text-buffer.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/text-buffer.h (limited to 'src/text-buffer.h') 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 + * + * 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 . + */ + +#ifndef TEXT_BUFFER_H +#define TEXT_BUFFER_H + +#include + +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 */ -- cgit v1.2.3