-
Notifications
You must be signed in to change notification settings - Fork 0
/
qcr.h
83 lines (72 loc) · 1.76 KB
/
qcr.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# ifndef __mdl__qcr__h
# define __mdl__qcr__h
# include <mdlint.h>
# include <mdlerr.h>
enum {
_qc_vt_str,
_qc_vt_int,
_qc_vt_chr
};
struct qcr_val {
mdl_u8_t kind;
mdl_u8_t *p;
};
struct qcr_var {
struct qcr_val val;
char *name;
};
struct qcr_buff {
mdl_u8_t *p, *itr;
mdl_uint_t blk_size;
mdl_uint_t size;
};
struct qcr_vec {
mdl_u8_t *p;
mdl_uint_t blk_size;
mdl_uint_t elem_c, page_c;
};
struct qcr_map {
struct qcr_vec **table;
};
struct qcr_array {
char *name;
struct qcr_vec data;
};
struct qcr {
struct qcr_vec arrays;
struct qcr_vec vars;
struct qcr_map env;
mdl_uint_t fsize;
mdl_u8_t *fp, *f_itr;
struct qcr_vec toks;
};
// map.c
mdl_err_t map_init(struct qcr_map*);
mdl_err_t map_de_init(struct qcr_map*);
mdl_err_t map_get(struct qcr_map*, mdl_u8_t const*, mdl_uint_t, void**);
mdl_err_t map_put(struct qcr_map*, mdl_u8_t const*, mdl_uint_t, void*);
// buff.c
mdl_err_t buff_init(struct qcr_buff*, mdl_uint_t, mdl_uint_t);
void buff_put(struct qcr_buff*, void*);
void buff_get(struct qcr_buff*, void*);
void buff_itr_incr(struct qcr_buff*);
void buff_itr_decr(struct qcr_buff*);
void buff_itr_reset(struct qcr_buff*);
mdl_uint_t buff_blk_c(struct qcr_buff*);
void buff_de_init(struct qcr_buff*);
// vec.c
mdl_err_t vec_init(struct qcr_vec*, mdl_uint_t);
void vec_push_back(struct qcr_vec*, void**);
void vec_pop_back(struct qcr_vec*, void*);
mdl_err_t vec_de_init(struct qcr_vec*);
void* vec_begin(struct qcr_vec*);
void* vec_end(struct qcr_vec*);
void* vec_get(struct qcr_vec*, mdl_uint_t);
// qcr.c
void* qcr_get_arr_elem(struct qcr*, void*, mdl_uint_t);
void* qcr_get(struct qcr*, char*);
mdl_err_t qcr_init(struct qcr*);
mdl_err_t qcr_de_init(struct qcr*);
mdl_err_t qcr_load(struct qcr*, char*);
mdl_err_t qcr_read(struct qcr*);
# endif /*__mdl__qcr__h*/