-
Notifications
You must be signed in to change notification settings - Fork 3
/
db.h
75 lines (42 loc) · 1.02 KB
/
db.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
#ifndef _db_h_
#define _db_h_
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* flags used while traversing the tree */
#define done_left (1<<0)
#define done_this (1<<1)
#define done_right (1<<2)
typedef struct country_s {
char code[4];
char name[60];
} country_t;
/* this struct is only used to build the list */
typedef struct country_list_s {
country_t data;
struct country_list_s* next;
unsigned int id;
} country_list_t;
typedef struct range_s {
/* numbers of the childs in the tree */
unsigned int left;
unsigned int right;
unsigned int start;
unsigned int end;
unsigned short country;
} range_t;
/* this version is only used to build the tree */
typedef struct range_tree_s {
struct range_tree_s* left;
struct range_tree_s* right;
unsigned int start;
unsigned int end;
country_list_t* country;
int depth;
struct range_tree_s* parent;
unsigned int id;
} range_tree_t;
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _db_h_ */