static FR_NAME_NUMBER unlang_action_table[] = {
{ "calculate-result", UNLANG_ACTION_CALCULATE_RESULT },
- { "continue", UNLANG_ACTION_CONTINUE },
+ { "next", UNLANG_ACTION_EXECUTE_NEXT },
{ "pushed-child", UNLANG_ACTION_PUSHED_CHILD },
{ "break", UNLANG_ACTION_BREAK },
{ "yield", UNLANG_ACTION_YIELD },
#ifndef NDEBUG
if (DEBUG_ENABLED5) DEBUG("unlang_push called with instruction %s - args %s %s",
program ? program->debug_name : "<none>",
- do_next_sibling ? "UNLANG_NEXT_CONTINUE" : "UNLANG_NEXT_STOP",
+ do_next_sibling ? "UNLANG_NEXT_SUBLING" : "UNLANG_NEXT_STOP",
top_frame ? "UNLANG_TOP_FRAME" : "UNLANG_SUB_FRAME");
#endif
* @param[in,out] result The current section result.
* @param[in,out] priority The current section priority.
* @return
- * - UNLANG_FRAME_ACTION_CONTINUE evaluate more instructions.
+ * - UNLANG_FRAME_ACTION_NEXT evaluate more instructions.
* - UNLANG_FRAME_ACTION_POP the final result has been calculated for this frame.
*/
static inline unlang_frame_action_t unlang_calculate_result(REQUEST *request, unlang_stack_frame_t *frame,
/*
* Don't set action or priority if we don't have one.
*/
- if (*result == RLM_MODULE_UNKNOWN) return UNLANG_FRAME_ACTION_CONTINUE;
+ if (*result == RLM_MODULE_UNKNOWN) return UNLANG_FRAME_ACTION_NEXT;
/*
* The child's action says return. Do so.
return UNLANG_FRAME_ACTION_POP;
}
- return frame->next ? UNLANG_FRAME_ACTION_CONTINUE : UNLANG_FRAME_ACTION_POP;
+ return frame->next ? UNLANG_FRAME_ACTION_NEXT : UNLANG_FRAME_ACTION_POP;
}
/** Evaluates all the unlang nodes in a section
* @param[in,out] result The current section result.
* @param[in,out] priority The current section priority.
* @return
- * - UNLANG_FRAME_ACTION_CONTINUE evaluate more instructions in the current stack frame
+ * - UNLANG_FRAME_ACTION_NEXT evaluate more instructions in the current stack frame
* which may not be the same frame as when this function
* was called.
* - UNLANG_FRAME_ACTION_POP the final result has been calculated for this frame.
case UNLANG_ACTION_PUSHED_CHILD:
rad_assert(&stack->frame[stack->depth] > frame);
*result = frame->result;
- return UNLANG_FRAME_ACTION_CONTINUE;
+ return UNLANG_FRAME_ACTION_NEXT;
/*
* We're in a looping construct and need to stop
/*
* Execute the next instruction in this frame
*/
- case UNLANG_ACTION_CONTINUE:
- if ((action == UNLANG_ACTION_CONTINUE) && unlang_ops[instruction->type].debug_braces) {
+ case UNLANG_ACTION_EXECUTE_NEXT:
+ if ((action == UNLANG_ACTION_EXECUTE_NEXT) && unlang_ops[instruction->type].debug_braces) {
REXDENT();
RDEBUG2("}");
}
rlm_rcode_t unlang_run(REQUEST *request)
{
int priority;
- unlang_frame_action_t fa = UNLANG_FRAME_ACTION_CONTINUE;
+ unlang_frame_action_t fa = UNLANG_FRAME_ACTION_NEXT;
/*
* We don't have a return code yet.
for (;;) {
switch (fa) {
- case UNLANG_FRAME_ACTION_CONTINUE: /* Evaluate the current frame */
+ case UNLANG_FRAME_ACTION_NEXT: /* Evaluate the current frame */
priority = -1;
rad_assert(stack->depth > 0);
* back on up the stack.
*/
if (frame->repeat) {
- fa = UNLANG_FRAME_ACTION_CONTINUE;
+ fa = UNLANG_FRAME_ACTION_NEXT;
continue;
}
* then we advance the instruction else we
* end up executing the same code over and over...
*/
- if (fa == UNLANG_FRAME_ACTION_CONTINUE) {
+ if (fa == UNLANG_FRAME_ACTION_NEXT) {
RDEBUG4("** [%i] %s - continuing after subsection with (%s %d)",
stack->depth, __FUNCTION__,
fr_int2str(mod_rcode_table, stack->result, "<invalid>"),
* no action.
*/
if (top_frame) unlang_push(stack, NULL, action, UNLANG_NEXT_STOP, UNLANG_TOP_FRAME);
- if (instruction) unlang_push(stack, instruction, RLM_MODULE_UNKNOWN, UNLANG_NEXT_CONTINUE, UNLANG_SUB_FRAME);
+ if (instruction) unlang_push(stack, instruction, RLM_MODULE_UNKNOWN, UNLANG_NEXT_SIBLING, UNLANG_SUB_FRAME);
RDEBUG4("** [%i] %s - substack begins", stack->depth, __FUNCTION__);
*/
if (!g->children) {
RDEBUG2("} # %s ... <ignoring empty subsection>", instruction->debug_name);
- return UNLANG_ACTION_CONTINUE;
+ return UNLANG_ACTION_EXECUTE_NEXT;
}
- unlang_push(stack, g->children, frame->result, UNLANG_NEXT_CONTINUE, UNLANG_SUB_FRAME);
+ unlang_push(stack, g->children, frame->result, UNLANG_NEXT_SIBLING, UNLANG_SUB_FRAME);
return UNLANG_ACTION_PUSHED_CHILD;
}
/*
* And then call the children to process the answer.
*/
- unlang_push(stack, g->children, frame->result, UNLANG_NEXT_CONTINUE, UNLANG_SUB_FRAME);
+ unlang_push(stack, g->children, frame->result, UNLANG_NEXT_SIBLING, UNLANG_SUB_FRAME);
return UNLANG_ACTION_PUSHED_CHILD;
}
/*
* Allocate the child request.
*/
- child = unlang_child_alloc(request, g->children, frame->result, UNLANG_NEXT_CONTINUE, UNLANG_DETACHABLE);
+ child = unlang_child_alloc(request, g->children, frame->result, UNLANG_NEXT_SIBLING, UNLANG_DETACHABLE);
if (!child) {
*presult = RLM_MODULE_FAIL;
*priority = instruction->actions[*presult];
/*
* Push the child, and yield for a later return.
*/
- unlang_push(stack, g->children, frame->result, UNLANG_NEXT_CONTINUE, UNLANG_SUB_FRAME);
+ unlang_push(stack, g->children, frame->result, UNLANG_NEXT_SIBLING, UNLANG_SUB_FRAME);
frame->repeat = true;
return UNLANG_ACTION_PUSHED_CHILD;
* Nothing found. Just continue, and ignore the "switch"
* statement.
*/
- if (!found) return UNLANG_ACTION_CONTINUE;
+ if (!found) return UNLANG_ACTION_EXECUTE_NEXT;
unlang_push(stack, found, frame->result, UNLANG_NEXT_STOP, UNLANG_SUB_FRAME);
return UNLANG_ACTION_PUSHED_CHILD;
if (*presult != RLM_MODULE_UNKNOWN) *priority = instruction->actions[*presult];
- return UNLANG_ACTION_CONTINUE;
+ return UNLANG_ACTION_EXECUTE_NEXT;
}
/*
typedef enum {
UNLANG_FRAME_ACTION_POP = 1, //!< Pop the current frame, and check the next one further
///< up in the stack for what to do next.
- UNLANG_FRAME_ACTION_CONTINUE, //!< Process the next instruction at this level.
+ UNLANG_FRAME_ACTION_NEXT, //!< Process the next instruction at this level.
UNLANG_FRAME_ACTION_YIELD //!< Temporarily return control back to the caller on the C
///< stack.
} unlang_frame_action_t;
UNLANG_GROUP_TYPE_MAX //!< Number of group types.
} unlang_group_type_t;
-#define UNLANG_NEXT_STOP (false)
-#define UNLANG_NEXT_CONTINUE (true)
+#define UNLANG_NEXT_STOP (false)
+#define UNLANG_NEXT_SIBLING (true)
#define UNLANG_DETACHABLE (true)
#define UNLANG_NORMAL_CHILD (false)
*/
struct unlang_s {
unlang_t *parent; //!< Previous node.
- unlang_t *next; //!< Next node (executed on #UNLANG_ACTION_CONTINUE et al).
+ unlang_t *next; //!< Next node (executed on #UNLANG_ACTION_EXECUTE_NEXT et al).
char const *name; //!< Unknown...
char const *debug_name; //!< Printed in log messages when the node is executed.
unlang_type_t type; //!< The specialisation of this node.