64 const char* resolver_name,
65 const char* func_name,
70 amxc_htable_it_t* hit = NULL;
71 amxc_string_t res_name;
72 amxc_string_init(&res_name, 0);
74 if(amxc_string_set_resolved(&res_name, resolver_name, &parser->
config) > 0) {
75 resolver_name = amxc_string_get(&res_name, 0);
78 hit = amxc_htable_get(&
resolvers, resolver_name);
81 parser->
status = amxd_status_ok;
88 if(parser->
status == amxd_status_ok) {
95 amxc_string_clean(&res_name);
104 amxc_htable_it_t* hit_data = NULL;
105 amxc_htable_it_t* hit_resolver = NULL;
109 hit_data = amxc_htable_get_first(parser->
resolvers);
111 const char* key = amxc_htable_it_get_key(hit_data);
113 hit_resolver = amxc_htable_get(&
resolvers, key);
114 resolver = amxc_htable_it_get_data(hit_resolver,
amxo_resolver_t, hit);
115 if(resolver->
clean != NULL) {
118 hit_data = amxc_htable_get_first(parser->
resolvers);
126 amxc_htable_for_each(hit, (&
resolvers)) {
129 if(resolver->
get != NULL) {
130 resolver->
get(parser, resolver->
priv);
140 when_null(resolver, exit);
141 when_true(!amxd_name_is_valid(name), exit);
142 when_not_null(amxc_htable_get(&
resolvers, name), exit);
143 when_null(resolver->
resolve, exit);
155 amxc_htable_it_t* hit = NULL;
156 when_str_empty(name, exit);
159 when_null(hit, exit);
160 amxc_htable_it_clean(hit, NULL);
168 const char* resolver_name) {
169 amxc_htable_t* data_table = NULL;
171 amxc_htable_it_t* it = NULL;
172 when_null(parser, exit);
173 when_str_empty(resolver_name, exit);
174 when_null(amxc_htable_get(&
resolvers, resolver_name), exit);
181 it = amxc_htable_get(parser->
resolvers, resolver_name);
184 when_null(resolver_data, exit);
185 amxc_htable_init(&resolver_data->
data, 10);
186 amxc_htable_insert(parser->
resolvers, resolver_name, &resolver_data->
hit);
191 data_table = &resolver_data->
data;
198 const char* resolver_name) {
199 amxc_htable_t* data_table = NULL;
201 amxc_htable_it_t* it = NULL;
202 when_null(parser, exit);
203 when_str_empty(resolver_name, exit);
205 when_null(amxc_htable_get(&
resolvers, resolver_name), exit);
207 it = amxc_htable_get(parser->
resolvers, resolver_name);
210 data_table = &resolver_data->
data;
217 const char* resolver_name) {
219 amxc_htable_it_t* it = NULL;
220 when_null(parser, exit);
221 when_str_empty(resolver_name, exit);
223 when_null(amxc_htable_get(&
resolvers, resolver_name), exit);
225 it = amxc_htable_get(parser->
resolvers, resolver_name);
228 amxc_htable_it_take(&resolver_data->
hit);
229 amxc_htable_it_clean(&resolver_data->
hit, NULL);
int amxo_parser_resolve(amxo_parser_t *parser, const char *resolver_name, const char *func_name, amxo_fn_type_t type, const char *data)
void amxo_parser_clean_resolvers(amxo_parser_t *parser)
static amxc_htable_t resolvers
void amxo_parser_init_resolvers(amxo_parser_t *parser)
amxc_htable_t * amxo_parser_get_resolvers(void)
enum _amxo_fn_type amxo_fn_type_t
int amxo_unregister_resolver(const char *name)
Unregisters a function resolver.
amxc_htable_t * amxo_parser_get_resolver_data(amxo_parser_t *parser, const char *resolver_name)
Gets the resolver specific parser data.
amxc_htable_t * amxo_parser_claim_resolver_data(amxo_parser_t *parser, const char *resolver_name)
Fetches resolver specific data for a parser instance.
int amxo_register_resolver(const char *name, amxo_resolver_t *resolver)
Registers a function resolver.
void amxo_parser_remove_resolver_data(amxo_parser_t *parser, const char *resolver_name)
Removes the resolver specific parser data.
The ODL parser structure.
amxc_htable_t * resolvers
amxo_fn_ptr_t resolved_fn
amxo_res_get_default_t get
amxo_res_resolve_fn_t resolve
amxo_res_clean_fn_t clean