VCOM Linux Driver
Advantech Inc.
Loading...
Searching...
No Matches
jstree.h
Go to the documentation of this file.
1#include "overload.h"
2
3typedef struct _t_treenode_data{
4 int type;
5 char *data;
7
13
14
15static inline void *realloc_it(void *ptrmem, size_t size) {
16 void *p;
17 if(size == 0 ){
18 free(ptrmem);
19 return 0;
20 }
21 p = realloc(ptrmem, size);
22 if (!p) {
23 free (ptrmem);
24 //fprintf(stderr, "realloc(): errno=%d\n", errno);
25 }
26 return p;
27}
28
29int dump(const char *js, jsmntok_t *t, size_t count, int indent);
30
31typedef struct {
32 int ret;
34} jstreeret;
35
36jstreeret js2tree(const char *js, jsmntok_t *t, size_t count);
37_tree_node * _alloc_tree_node_len(int type, const char * data, int datalen);
38_tree_node * _alloc_tree_node_data(int type, const char * data);
40
41#define alloc_tree_node(args...) ovrld3(args, _alloc_tree_node_len, \
42 _alloc_tree_node_data, \
43 _alloc_tree_node_type)(args)
44
45_tree_node * find_node( _tree_node * tree, char * key);
46_tree_node * next_node( _tree_node *node, int step);
48int get_node_string( _tree_node *node, char *buf, int bufsize);
49int dumptree(_tree_node * tree, int indent);
50int tree2json(_tree_node * tree, char * buf, int bufsize);
51void freejstree(_tree_node * tree);
52
53int jstree_string_decode(char * out, int outlen, char * data);
54int jstree_string_encode(char *out, int outlen, char * data);
55
int get_node_string(_tree_node *node, char *buf, int bufsize)
Definition jstree.c:435
struct _t_treenode _tree_node
_tree_node * _alloc_tree_node_len(int type, const char *data, int datalen)
Definition jstree.c:209
int tree2json(_tree_node *tree, char *buf, int bufsize)
Definition jstree.c:620
_tree_node * _alloc_tree_node_data(int type, const char *data)
Definition jstree.c:190
_tree_node ** end_node(_tree_node **node)
Definition jstree.c:447
int jstree_string_decode(char *out, int outlen, char *data)
Definition jstree.c:64
_tree_node * find_node(_tree_node *tree, char *key)
Definition jstree.c:386
struct _t_treenode_data _treenode_data
int dump(const char *js, jsmntok_t *t, size_t count, int indent)
Definition jstree.c:292
_tree_node * next_node(_tree_node *node, int step)
Definition jstree.c:421
jstreeret js2tree(const char *js, jsmntok_t *t, size_t count)
Definition jstree.c:327
int dumptree(_tree_node *tree, int indent)
Definition jstree.c:227
int jstree_string_encode(char *out, int outlen, char *data)
Definition jstree.c:11
void freejstree(_tree_node *tree)
Definition jstree.c:658
_tree_node * _alloc_tree_node_type(int type)
Definition jstree.c:178
Definition jstree.h:3
char * data
Definition jstree.h:5
int type
Definition jstree.h:4
Definition jstree.h:8
struct _t_treenode * l
Definition jstree.h:10
struct _t_treenode * r
Definition jstree.h:11
_treenode_data data
Definition jstree.h:9
Definition jsmn.h:40
Definition jstree.h:31
_tree_node * node
Definition jstree.h:33
int ret
Definition jstree.h:32
struct vc_attach_data data
Definition vcom_proto.h:3