blob: 52ecd2ea81ab511fffaf9344d8c0c28dce5e994c (
plain) (
blame)
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
|
#ifndef APLWC_INTERNAL_H
#define APLWC_INTERNAL_H
#include <aplwc.h>
#include <aplwc_macros.h>
#define RETURN_ERROR(aplwcp, rc, msg) do{ \
return ((aplwc)->last_error = (rc)); \
}while(0)
#include <assert.h>
#include <stdalign.h>
#include <stdbool.h>
#include <string.h>
struct memory {
uint8_t *data;
size_t size;
size_t offset;
};
struct aplwc {
enum aplwc_rc last_error;
char last_error_msg[64];
struct memory memory;
};
/* errors.c */
const char *rc_to_string(enum aplwc_rc);
/* memory.c */
struct memory memory_init(uint8_t *, size_t);
struct aplwc *memory_alloc_aplwc(struct memory *);
void memory_free_aplwc(struct memory *, struct aplwc *);
#endif /* APLWC_INTERNAL_H */
|