/* // ColdMUD was created and is copyright 1993, 1994 by Greg Hudson // // ColdX is a derivitive work, and is copyright 1995 by the ColdX Project. // Full copyright information can be found in the file doc/CREDITS // // File: buffer.h // Version: 0.1-5 // Last Edited: 5 Aug 1995 // // --- // // Declarations for ColdC buffers. */ #ifndef BUFFER_H #define BUFFER_H typedef struct buffer Buffer; #include "list.h" struct buffer { int len; int refs; unsigned char s[1]; }; Buffer *buffer_new(int len); Buffer *buffer_dup(Buffer *buf); void buffer_discard(Buffer *buf); Buffer *buffer_append(Buffer *buf1, Buffer *buf2); int buffer_retrieve(Buffer *buf, int pos); Buffer *buffer_replace(Buffer *buf, int pos, unsigned int c); Buffer *buffer_add(Buffer *buf, unsigned int c); int buffer_len(Buffer *buf); Buffer *buffer_truncate(Buffer *buf, int len); Buffer *buffer_tail(Buffer *buf, int pos); List *buffer_to_strings(Buffer *buf, Buffer *sep); Buffer *buffer_from_strings(List *string_list, Buffer *sep); #endif