1 /* 2 * Copyright (C) 1984-2026 Mark Nudelman 3 * 4 * You may distribute under the terms of either the GNU General Public 5 * License or the Less License, as specified in the README file. 6 * 7 * For more information, see the README file. 8 */ 9 10 #ifndef XBUF_H_ 11 #define XBUF_H_ 12 13 #include "lang.h" 14 15 struct xbuffer 16 { 17 unsigned char *data; 18 size_t end; 19 size_t size; 20 size_t init_size; 21 }; 22 23 void xbuf_init(struct xbuffer *xbuf); 24 void xbuf_init_size(struct xbuffer *xbuf, size_t init_size); 25 void xbuf_deinit(struct xbuffer *xbuf); 26 void xbuf_reset(struct xbuffer *xbuf); 27 void xbuf_add_byte(struct xbuffer *xbuf, unsigned char b); 28 void xbuf_add_char(struct xbuffer *xbuf, char c); 29 void xbuf_add_data(struct xbuffer *xbuf, constant void *data, size_t len); 30 int xbuf_pop(struct xbuffer *xbuf); 31 constant char *xbuf_char_data(constant struct xbuffer *xbuf); 32 33 #endif 34