-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuffer.H
38 lines (26 loc) · 1.14 KB
/
Buffer.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* File generated by the BNF Converter (bnfc 2.9.4). */
/* A dynamically allocated character buffer that grows as it is appended. */
#ifndef BUFFER_HEADER
#define BUFFER_HEADER
typedef struct buffer {
char* chars; /* Pointer to start of the buffer. */
unsigned int size; /* Buffer size (>= 1). */
unsigned int current; /* Next free character position (< size). */
} * Buffer;
/* External interface. */
/************************************************************************/
/* Create a new buffer of the given size. */
Buffer newBuffer (const unsigned int size);
/* Deallocate the buffer. */
void freeBuffer (Buffer buffer);
/* Deallocate the buffer, but return its content as string. */
char* releaseBuffer (Buffer buffer);
/* Clear contents of buffer. */
void resetBuffer (Buffer buffer);
/* Append string at the end of the buffer. */
void bufferAppendString (Buffer buffer, const char *s);
/* Append single character at the end of the buffer. */
void bufferAppendChar (Buffer buffer, const char c);
/* Give read-only access to the buffer content. */
const char* bufferContent (Buffer buffer);
#endif