forked from jarjin/tolua_runtime_V2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproto.h
65 lines (56 loc) · 1.46 KB
/
proto.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
#ifndef PROTOBUFC_PROTO_H
#define PROTOBUFC_PROTO_H
#include "pbc.h"
#include "map.h"
#include "array.h"
#ifndef _MSC_VER
#include <stdbool.h>
#endif
#include <stddef.h>
struct map_ip;
struct map_si;
struct map_sp;
struct _message;
struct _enum;
#define LABEL_OPTIONAL 0
#define LABEL_REQUIRED 1
#define LABEL_REPEATED 2
#define LABEL_PACKED 3
struct _field {
int id;
const char *name;
int type;
int label;
pbc_var default_v;
union {
const char * n;
struct _message * m;
struct _enum * e;
} type_name;
};
struct _message {
const char * key;
struct map_ip * id; // id -> _field
struct map_sp * name; // string -> _field
struct pbc_rmessage * def; // default message
struct pbc_env * env;
};
struct _enum {
const char * key;
struct map_ip * id;
struct map_si * name;
pbc_var default_v;
};
struct pbc_env {
struct map_sp * files; // string -> void *
struct map_sp * enums; // string -> _enum
struct map_sp * msgs; // string -> _message
const char * lasterror;
};
struct _message * _pbcP_init_message(struct pbc_env * p, const char *name);
void _pbcP_push_message(struct pbc_env * p, const char *name, struct _field *f , pbc_array queue);
struct _enum * _pbcP_push_enum(struct pbc_env * p, const char *name, struct map_kv *table, int sz );
int _pbcP_message_default(struct _message * m, const char * name, pbc_var defv);
struct _message * _pbcP_get_message(struct pbc_env * p, const char *name);
int _pbcP_type(struct _field * field, const char **type);
#endif