]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
rename definitions
authorAlan T. DeKok <aland@freeradius.org>
Wed, 27 Mar 2019 17:09:42 +0000 (13:09 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 27 Mar 2019 17:09:42 +0000 (13:09 -0400)
so that we have UNLANG_ACTION_EXECUTE_NEXT instead of CONTINUE
and other similar changes.

We may want to add a "continue" keyword, so it's best to keep
CONTINUE reserved for that.

src/lib/unlang/base.h
src/lib/unlang/interpret.c
src/lib/unlang/op.c
src/lib/unlang/unlang_priv.h
src/lib/unlang/xlat.c

index 4bbdf6f186dc9336b76ff401b43d84286c2e4d68..31c4c4143a7f5e3a00db9f62c7795ce4c5205128 100644 (file)
@@ -33,7 +33,7 @@
  */
 typedef enum {
        UNLANG_ACTION_CALCULATE_RESULT = 1,     //!< Calculate a new section #rlm_rcode_t value.
-       UNLANG_ACTION_CONTINUE,                 //!< Execute the next #unlang_t.
+       UNLANG_ACTION_EXECUTE_NEXT,             //!< Execute the next #unlang_t.
        UNLANG_ACTION_PUSHED_CHILD,             //!< #unlang_t pushed a new child onto the stack,
                                                //!< execute it instead of continuing.
        UNLANG_ACTION_BREAK,                    //!< Break out of the current group.
index 38e71c00bf9f66330e4de8fbf67a7870cede3931..584a4b9aa44982f7cd023c6c975efafe2a6c798f 100644 (file)
@@ -34,7 +34,7 @@ RCSID("$Id$")
 
 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 },
@@ -170,7 +170,7 @@ void unlang_push(unlang_stack_t *stack, unlang_t *program, rlm_rcode_t result, b
 #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
 
@@ -231,7 +231,7 @@ static inline void unlang_pop(unlang_stack_t *stack)
  * @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,
@@ -250,7 +250,7 @@ static inline unlang_frame_action_t unlang_calculate_result(REQUEST *request, un
        /*
         *      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.
@@ -322,7 +322,7 @@ static inline unlang_frame_action_t unlang_calculate_result(REQUEST *request, un
                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
@@ -332,7 +332,7 @@ static inline unlang_frame_action_t unlang_calculate_result(REQUEST *request, un
  * @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.
@@ -410,7 +410,7 @@ static inline unlang_frame_action_t unlang_frame_eval(REQUEST *request, unlang_s
                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
@@ -493,8 +493,8 @@ static inline unlang_frame_action_t unlang_frame_eval(REQUEST *request, unlang_s
                /*
                 *      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("}");
                        }
@@ -519,7 +519,7 @@ static inline unlang_frame_action_t unlang_frame_eval(REQUEST *request, unlang_s
 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.
@@ -538,7 +538,7 @@ rlm_rcode_t unlang_run(REQUEST *request)
 
        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);
@@ -578,7 +578,7 @@ rlm_rcode_t unlang_run(REQUEST *request)
                         *      back on up the stack.
                         */
                        if (frame->repeat) {
-                               fa = UNLANG_FRAME_ACTION_CONTINUE;
+                               fa = UNLANG_FRAME_ACTION_NEXT;
                                continue;
                        }
 
@@ -612,7 +612,7 @@ rlm_rcode_t unlang_run(REQUEST *request)
                         *      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>"),
@@ -725,7 +725,7 @@ void unlang_push_section(REQUEST *request, CONF_SECTION *cs, rlm_rcode_t action,
         *      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__);
 
index 7f3dd7a760c0ee5c64a2d62e735fdbc8f5e46f68..580e7724ab508a2e42e47c5c659d9a6528f9a90d 100644 (file)
@@ -440,10 +440,10 @@ static unlang_action_t unlang_group(REQUEST *request,
         */
        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;
 }
 
@@ -764,7 +764,7 @@ static unlang_action_t unlang_call(REQUEST *request,
        /*
         *      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;
 }
 
@@ -785,7 +785,7 @@ static unlang_action_t unlang_subrequest(REQUEST *request,
        /*
         *      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];
@@ -1407,7 +1407,7 @@ static unlang_action_t unlang_foreach(REQUEST *request,
        /*
         *      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;
@@ -1550,7 +1550,7 @@ do_null_case:
         *      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;
@@ -1592,7 +1592,7 @@ static unlang_action_t unlang_if(REQUEST *request,
 
                if (*presult != RLM_MODULE_UNKNOWN) *priority = instruction->actions[*presult];
 
-               return UNLANG_ACTION_CONTINUE;
+               return UNLANG_ACTION_EXECUTE_NEXT;
        }
 
        /*
index b58604a8cc5d2c92d9d3f8cae38c19b2cc4effa1..682bd7eecf208c4199175766b5f5e3fab5c92368 100644 (file)
@@ -87,7 +87,7 @@ typedef enum {
 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;
@@ -100,8 +100,8 @@ typedef enum {
        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)
@@ -121,7 +121,7 @@ typedef struct unlang_s unlang_t;
  */
 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.
index f4540c159ad22b9b65a90f095b72a11b4a5d3662..fb61412719d5e0cfe58c2221a4802c7dbba29676 100644 (file)
@@ -383,7 +383,7 @@ static unlang_action_t unlang_xlat_inline(REQUEST *request,
                RDEBUG2("`%s`", mx->xlat_name);
                radius_exec_program(request, NULL, 0, NULL, request, mx->xlat_name, request->packet->vps,
                                    false, true, EXEC_TIMEOUT);
-               return UNLANG_ACTION_CONTINUE;
+               return UNLANG_ACTION_EXECUTE_NEXT;
        }
 }