}
#endif
-void modcall_debug(modcallable *mc, int depth)
+static void unlang_dump(modcallable *mc, int depth)
{
modcallable *this;
modgroup *g;
g = mod_callabletogroup(this);
DEBUG("%.*s%s {", depth, modcall_spaces,
unlang_keyword[this->type]);
- modcall_debug(g->children, depth + 1);
+ unlang_dump(g->children, depth + 1);
DEBUG("%.*s}", depth, modcall_spaces);
break;
fr_cond_snprint(buffer, sizeof(buffer), g->cond);
DEBUG("%.*s%s (%s) {", depth, modcall_spaces,
unlang_keyword[this->type], buffer);
- modcall_debug(g->children, depth + 1);
+ unlang_dump(g->children, depth + 1);
DEBUG("%.*s}", depth, modcall_spaces);
break;
tmpl_snprint(buffer, sizeof(buffer), g->vpt, NULL);
DEBUG("%.*s%s %s {", depth, modcall_spaces,
unlang_keyword[this->type], buffer);
- modcall_debug(g->children, depth + 1);
+ unlang_dump(g->children, depth + 1);
DEBUG("%.*s}", depth, modcall_spaces);
break;
g = mod_callabletogroup(this);
DEBUG("%.*s%s %s {", depth, modcall_spaces,
unlang_keyword[this->type], this->name);
- modcall_debug(g->children, depth + 1);
+ unlang_dump(g->children, depth + 1);
DEBUG("%.*s}", depth, modcall_spaces);
break;
g = mod_callabletogroup(this);
DEBUG("%.*s%s {", depth, modcall_spaces,
unlang_keyword[this->type]);
- modcall_debug(g->children, depth + 1);
+ unlang_dump(g->children, depth + 1);
DEBUG("%.*s}", depth, modcall_spaces);
break;
g = mod_callabletogroup(this);
DEBUG("%.*s%s {", depth, modcall_spaces,
unlang_keyword[this->type]);
- modcall_debug(g->children, depth + 1);
+ unlang_dump(g->children, depth + 1);
DEBUG("%.*s}", depth, modcall_spaces);
break;
}
return NULL;
}
-modcallable *modcall_compile_section(modcallable *parent,
- rlm_components_t component, CONF_SECTION *cs)
+int unlang_compile(CONF_SECTION *cs, rlm_components_t component)
{
char const *name1, *name2;
modcallable *c;
- c = compile_group(parent, component, cs, GROUPTYPE_SIMPLE, GROUPTYPE_SIMPLE, MOD_GROUP);
- if (!c) return NULL;
+ c = compile_group(NULL, component, cs, GROUPTYPE_SIMPLE, GROUPTYPE_SIMPLE, MOD_GROUP);
+ if (!c) return -1;
/*
* The name / debug name are set to "group". We want
}
if (rad_debug_lvl > 3) {
- modcall_debug(c, 2);
+ unlang_dump(c, 2);
}
/*
cf_data_add(cs, "unlang", c, NULL);
dump_tree(component, c);
- return c;
+ return 0;
}
static bool load_subcomponent_section(CONF_SECTION *cs,
fr_dict_attr_t const *da, rlm_components_t comp)
{
- modcallable *ml;
fr_dict_enum_t *dval;
char const *name2 = cf_section_name2(cs);
/*
* Compile the group.
*/
- ml = modcall_compile_section(NULL, comp, cs);
- if (!ml) return false;
+ if (unlang_compile(cs, comp) < 0) {
+ return false;
+ }
return true;
}
static int load_component_section(CONF_SECTION *cs, rlm_components_t comp)
{
CONF_SECTION *subcs;
- modcallable *ml;
fr_dict_attr_t const *da;
/*
/*
* Compile the section.
*/
- ml = modcall_compile_section(NULL, comp, cs);
- if (!ml) {
+ if (unlang_compile(cs, comp) < 0) {
cf_log_err_cs(cs, "Errors parsing %s section.\n",
cf_section_name1(cs));
return -1;