+static inline constant *locate_num_exp_constant(num_exp *exp, constants *consts) {
+ size_t i;
+
+ for (i = 0; i < consts->count; ++i) {
+ constant *cnst = consts->list[i];
+
+ if (!strcmp(cnst->name, exp->u.numb)) {
+ free(exp->u.numb);
+ return exp->u.cnst = cnst;
+ }
+ }
+
+ return NULL;
+}
+static inline int validate_num_exp(PSI_Data *data, impl *impl, num_exp *exp) {
+ switch (exp->t) {
+ case PSI_T_NAME:
+ if (!locate_decl_var_arg(exp->u.dvar, impl->decl->args)) {
+ data->error(PSI_WARNING, "Unknown variable '%s' in numeric expression"
+ " of implementation '%s'", exp->u.dvar->name, impl->func->name);
+ return 0;
+ }
+ return 1;
+ case PSI_T_NSNAME:
+ if (!locate_num_exp_constant(exp, data->consts)) {
+ data->error(PSI_WARNING, "Unknown constant '%s' in numeric expression"
+ " of implementation '%s'", exp->u.numb, impl->func->name);
+ return 0;
+ }
+ return 1;
+ case PSI_T_NUMBER:
+ return 1;
+ default:
+ return 0;
+ }
+}