-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathpcu_buffer.h
38 lines (31 loc) · 1.01 KB
/
pcu_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
/******************************************************************************
Copyright 2011 Scientific Computation Research Center,
Rensselaer Polytechnic Institute. All rights reserved.
This work is open source software, licensed under the terms of the
BSD license as described in the LICENSE file in the top-level directory.
*******************************************************************************/
#ifndef PCU_MEMORY_H
#define PCU_MEMORY_H
#include <stddef.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
char* start;
size_t size;
size_t capacity;
} pcu_buffer;
void pcu_make_buffer(pcu_buffer* b);
void pcu_free_buffer(pcu_buffer* b);
void* pcu_push_buffer(pcu_buffer* b, size_t size);
void pcu_begin_buffer(pcu_buffer* b);
void* pcu_walk_buffer(pcu_buffer* b, size_t size);
bool pcu_buffer_walked(pcu_buffer* b);
void pcu_resize_buffer(pcu_buffer* b, size_t size);
void pcu_set_buffer(pcu_buffer* b, void* p, size_t size);
#ifdef __cplusplus
}
#endif
#endif