-
Notifications
You must be signed in to change notification settings - Fork 0
/
gglib.h
63 lines (49 loc) · 1.18 KB
/
gglib.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
/* MIT - Copyright 2017 - mrmacete */
#ifndef R_GGLIB_H
#define R_GGLIB_H
#define GG_TYPE_NULL 1
#define GG_TYPE_HASH 2
#define GG_TYPE_ARRAY 3
#define GG_TYPE_STRING 4
#define GG_TYPE_INT 5
#define GG_TYPE_DOUBLE 6
typedef struct {
int type;
} GGValue;
typedef struct {
const char * key;
GGValue * value;
} GGHashPair;
typedef struct {
int type;
ut32 value;
} GGIntValue;
typedef struct {
int type;
double value;
} GGDoubleValue;
typedef struct {
int type;
const char * value;
} GGStringValue;
typedef struct {
int type;
GGHashPair **pairs;
ut32 n_pairs;
} GGHashValue;
typedef struct {
int type;
GGValue **entries;
ut32 length;
} GGArrayValue;
bool gg_hash_serialize(GGHashValue * hash, ut8 ** out_buf, ut32 * out_buf_size);
GGHashValue *gg_hash_unserialize(const ut8* in_buf, ut32 buf_size);
GGArrayValue *gg_array_new(ut32 length);
void gg_array_free(GGArrayValue * array);
GGHashValue *gg_hash_new(ut32 n_pairs);
void gg_hash_free(GGHashValue * hash);
GGValue *gg_hash_value_for_key(GGHashValue * hash, const char * key);
GGIntValue *gg_int_new(ut32 value);
GGStringValue *gg_string_new(const char * value);
GGHashPair *gg_pair_new(const char * key, GGValue * value);
#endif