1 | %{ |
---|
2 | #include <arbdb.h> |
---|
3 | #include <arbdbt.h> |
---|
4 | |
---|
5 | GB_shell thegbshell; |
---|
6 | %} |
---|
7 | |
---|
8 | |
---|
9 | /* map GB_error to char pointer -- errors are message strings */ |
---|
10 | %typemap(out) GB_ERROR = const char*; |
---|
11 | |
---|
12 | %inline %{ |
---|
13 | |
---|
14 | /* ARB:: */ |
---|
15 | |
---|
16 | /* Accessing database */ |
---|
17 | |
---|
18 | GBDATA* |
---|
19 | open(const char *path, const char *opent) { |
---|
20 | return GB_open(path, opent); |
---|
21 | } |
---|
22 | |
---|
23 | GB_ERROR |
---|
24 | save(GBDATA *gb, const char *path, const char *savetype) { |
---|
25 | return GB_save(gb, path, savetype); |
---|
26 | } |
---|
27 | |
---|
28 | GB_ERROR |
---|
29 | save_as(GBDATA *gb, const char *path, const char *savetype) { |
---|
30 | return GB_save_as(gb, path, savetype); |
---|
31 | } |
---|
32 | |
---|
33 | void |
---|
34 | close(GBDATA *gbd) { |
---|
35 | GB_close(gbd); |
---|
36 | } |
---|
37 | |
---|
38 | const char* |
---|
39 | get_db_path(GBDATA *gbd) { |
---|
40 | return GB_get_db_path(gbd); |
---|
41 | } |
---|
42 | |
---|
43 | /* transactions */ |
---|
44 | |
---|
45 | GB_ERROR |
---|
46 | abort_transaction(GBDATA *gbd) { |
---|
47 | return GB_abort_transaction(gbd); |
---|
48 | } |
---|
49 | |
---|
50 | GB_ERROR |
---|
51 | begin_transaction(GBDATA *gbd) { |
---|
52 | return GB_begin_transaction(gbd); |
---|
53 | } |
---|
54 | |
---|
55 | GB_ERROR |
---|
56 | commit_transaction(GBDATA *gbd) { |
---|
57 | return GB_commit_transaction(gbd); |
---|
58 | } |
---|
59 | |
---|
60 | /* read/write operations */ |
---|
61 | |
---|
62 | char* |
---|
63 | read_as_string(GBDATA *gbd) { |
---|
64 | return GB_read_as_string(gbd); |
---|
65 | } |
---|
66 | |
---|
67 | char* |
---|
68 | read_string(GBDATA *gbd) { |
---|
69 | return GB_read_string(gbd); |
---|
70 | } |
---|
71 | |
---|
72 | GB_ERROR |
---|
73 | write_string(GBDATA *gbd, const char *s) { |
---|
74 | return GB_write_string(gbd, s); |
---|
75 | } |
---|
76 | |
---|
77 | void |
---|
78 | write_flag(GBDATA *gbd, long flag) { |
---|
79 | return GB_write_flag(gbd, flag); |
---|
80 | } |
---|
81 | |
---|
82 | int |
---|
83 | read_flag(GBDATA *gbd) { |
---|
84 | return GB_read_flag(gbd); |
---|
85 | } |
---|
86 | |
---|
87 | GB_ERROR |
---|
88 | check_key(const char *key) { |
---|
89 | return GB_check_key(key); |
---|
90 | } |
---|
91 | |
---|
92 | GBDATA* |
---|
93 | search(GBDATA *gbd, const char *fieldpath, GB_TYPES create) { |
---|
94 | return GB_search(gbd, fieldpath, create); |
---|
95 | } |
---|
96 | |
---|
97 | /* others */ |
---|
98 | |
---|
99 | GB_ERROR |
---|
100 | await_error(void) { |
---|
101 | return GB_await_error(); |
---|
102 | } |
---|
103 | |
---|
104 | uint32_t |
---|
105 | checksum(const char *seq, long length, int ignore_case, const char *exclude) { |
---|
106 | return GB_checksum(seq, length, ignore_case, exclude); |
---|
107 | } |
---|
108 | |
---|
109 | |
---|
110 | /* BIO */ |
---|
111 | |
---|
112 | /* read and write database (GBDATA) items */ |
---|
113 | |
---|
114 | char* |
---|
115 | read_string(GBDATA *gb_container, const char *fieldpath) { |
---|
116 | return GBT_read_string(gb_container, fieldpath); |
---|
117 | } |
---|
118 | |
---|
119 | char* |
---|
120 | read_as_string(GBDATA *gb_container, const char *fieldpath) { |
---|
121 | return GBT_read_as_string(gb_container, fieldpath); |
---|
122 | } |
---|
123 | |
---|
124 | GB_CSTR |
---|
125 | read_name(GBDATA *gb_item) { |
---|
126 | return GBT_read_name(gb_item); |
---|
127 | } |
---|
128 | |
---|
129 | GB_ERROR |
---|
130 | write_int(GBDATA *gb_container, const char *fieldpath, long content) { |
---|
131 | return GBT_write_int(gb_container, fieldpath, content); |
---|
132 | } |
---|
133 | |
---|
134 | GB_ERROR |
---|
135 | write_string(GBDATA *gb_container, const char *fieldpath, const char *content) { |
---|
136 | return GBT_write_string(gb_container, fieldpath, content); |
---|
137 | } |
---|
138 | |
---|
139 | /* access AWARS (values from GUI) */ |
---|
140 | |
---|
141 | GB_ERROR |
---|
142 | remote_action(GBDATA *gb_main, const char *application, const char *action_name) { |
---|
143 | return GBT_remote_action(gb_main, application, action_name); |
---|
144 | } |
---|
145 | |
---|
146 | GB_ERROR |
---|
147 | remote_awar(GBDATA *gb_main, const char *application, const char *awar_name, const char *value) { |
---|
148 | return GBT_remote_awar(gb_main, application, awar_name, value); |
---|
149 | } |
---|
150 | |
---|
151 | GB_ERROR |
---|
152 | remote_read_awar(GBDATA *gb_main, const char *application, const char *awar_name) { |
---|
153 | return GBT_remote_read_awar(gb_main, application, awar_name); |
---|
154 | } |
---|
155 | |
---|
156 | /* iterate through species */ |
---|
157 | |
---|
158 | GBDATA* |
---|
159 | first_species(GBDATA *gb_main) { |
---|
160 | return GBT_first_species(gb_main); |
---|
161 | } |
---|
162 | |
---|
163 | GBDATA* |
---|
164 | next_species(GBDATA *gb_species) { |
---|
165 | return GBT_next_species(gb_species); |
---|
166 | } |
---|
167 | |
---|
168 | GBDATA* |
---|
169 | first_marked_species(GBDATA *gb_main) { |
---|
170 | return GBT_first_marked_species(gb_main); |
---|
171 | } |
---|
172 | |
---|
173 | GBDATA* |
---|
174 | next_marked_species(GBDATA *gb_species) { |
---|
175 | return GBT_next_marked_species(gb_species); |
---|
176 | } |
---|
177 | |
---|
178 | /* other */ |
---|
179 | |
---|
180 | /* |
---|
181 | char *get_name_of_next_tree(GBDATA *gb_main, const char *tree_name) { |
---|
182 | return GBT_get_name_of_next_tree(gb_main, tree_name); |
---|
183 | } |
---|
184 | */ |
---|
185 | |
---|
186 | char* |
---|
187 | get_default_alignment(GBDATA *gb_main) { |
---|
188 | GBT_get_default_alignment(gb_main); |
---|
189 | } |
---|
190 | |
---|
191 | void |
---|
192 | message(GBDATA *gb_main, const char *msg) { |
---|
193 | GBT_message(gb_main, msg); |
---|
194 | } |
---|
195 | |
---|
196 | %} |
---|