|
Revision 905, 1.2 KB
(checked in by shawnw, 19 months ago)
|
|
Have indent convert tabs to spaces
|
| Line | |
|---|
| 1 | /** |
|---|
| 2 | * \file bufferq.h |
|---|
| 3 | * |
|---|
| 4 | * \brief Headers for managing queues of buffers, a handy data structure. |
|---|
| 5 | * |
|---|
| 6 | * |
|---|
| 7 | */ |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | typedef struct bufferq BUFFERQ; |
|---|
| 12 | |
|---|
| 13 | struct bufferq { |
|---|
| 14 | char *buffer; /**< Pointer to start of buffer */ |
|---|
| 15 | char *buffer_end; /**< Pointer to insertion point in buffer */ |
|---|
| 16 | int buffer_size; /**< Size allocated to buffer, in bytes */ |
|---|
| 17 | int num_buffered; /**< Number of strings in the buffer */ |
|---|
| 18 | char last_string[BUFFER_LEN]; /**< Cache of last string inserted */ |
|---|
| 19 | char last_type; /**< Cache of type of last string inserted */ |
|---|
| 20 | }; |
|---|
| 21 | |
|---|
| 22 | #define BufferQSize(b) ((b)->buffer_size) |
|---|
| 23 | #define BufferQNum(b) ((b)->num_buffered) |
|---|
| 24 | #define BufferQLast(b) ((b)->last_string) |
|---|
| 25 | #define BufferQLastType(b) ((b)->last_type) |
|---|
| 26 | |
|---|
| 27 | extern BUFFERQ *allocate_bufferq(int lines); |
|---|
| 28 | extern BUFFERQ *reallocate_bufferq(BUFFERQ *bq, int lines); |
|---|
| 29 | extern void free_bufferq(BUFFERQ *bq); |
|---|
| 30 | extern void add_to_bufferq(BUFFERQ *bq, int type, dbref player, |
|---|
| 31 | const char *msg); |
|---|
| 32 | extern char *iter_bufferq(BUFFERQ *bq, char **p, dbref *player, int *type, |
|---|
| 33 | time_t * timestamp); |
|---|
| 34 | extern int bufferq_lines(BUFFERQ *bq); |
|---|
| 35 | extern int isempty_bufferq(BUFFERQ *bq); |
|---|