root / logic / trunk / src / init / buf.h @ 20
History | View | Annotate | Download (667 Bytes)
1 | 20 | Janez1 | #ifndef BUF_H_INCLUDED
|
---|---|---|---|
2 | #define BUF_H_INCLUDED
|
||
3 | |||
4 | typedef int element_t; |
||
5 | |||
6 | //int *buf;
|
||
7 | |||
8 | typedef struct d_buffer |
||
9 | { |
||
10 | // buffer pointers
|
||
11 | int *start_p;
|
||
12 | int *end_p;
|
||
13 | // TODO (fix and remove this one?) pointer to the first element, had problems with malloc without it!
|
||
14 | int *start_el;
|
||
15 | // actual buffer
|
||
16 | element_t *elements; |
||
17 | // attributes
|
||
18 | int buffer_size;
|
||
19 | int buffer_load;
|
||
20 | }d_bufr; |
||
21 | |||
22 | void buf_put(element_t element, d_bufr *buf);
|
||
23 | int buf_get(element_t *element, d_bufr *buf);
|
||
24 | void increase_start_p(d_bufr *buf);
|
||
25 | int increase_end_p(d_bufr *buf);
|
||
26 | d_bufr *init_buf(int buf_size);
|
||
27 | int get_buffer_load(d_bufr *buf);
|
||
28 | |||
29 | #endif // BUF_H_INCLUDED |