1 #ifndef XBUF_H_ 2 #define XBUF_H_ 3 4 #include "lang.h" 5 6 struct xbuffer 7 { 8 unsigned char *data; 9 size_t end; 10 size_t size; 11 size_t init_size; 12 }; 13 14 void xbuf_init(struct xbuffer *xbuf); 15 void xbuf_init_size(struct xbuffer *xbuf, size_t init_size); 16 void xbuf_deinit(struct xbuffer *xbuf); 17 void xbuf_reset(struct xbuffer *xbuf); 18 void xbuf_add_byte(struct xbuffer *xbuf, unsigned char b); 19 void xbuf_add_char(struct xbuffer *xbuf, char c); 20 void xbuf_add_data(struct xbuffer *xbuf, constant unsigned char *data, size_t len); 21 int xbuf_pop(struct xbuffer *xbuf); 22 constant char *xbuf_char_data(constant struct xbuffer *xbuf); 23 24 #endif 25