]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add visual bars for xlat expansion
authorAlan T. DeKok <aland@freeradius.org>
Sat, 17 Sep 2022 13:12:32 +0000 (09:12 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 20 Sep 2022 19:55:33 +0000 (15:55 -0400)
which helps to visually separate them from unlang statements.
And also helps to line up nested xlats

src/lib/unlang/edit.c
src/lib/unlang/xlat_eval.c

index 49fd4e3dc0f06a13f7ca5ad49836d72a8817172f..ea2fcacd5221c4ba2442f359ac8b07c8b12fd775 100644 (file)
@@ -403,6 +403,10 @@ apply_list:
  *
  *             if it needs to be created, then create it and just mash the results in place
  *             otherwise apply the edits (+=, etc.) to an existing attribute.
+ *
+ *     @todo - move to using dcursors for all of the values.  The dcursor should exist in current->rhs.  It
+ *     should be used even for TMPL_DATA and single value-boxes.  Once that's done, it becomes easier to use
+ *     dcursors for xlats, too.
  */
 static int apply_edits_to_leaf(request_t *request, unlang_frame_state_edit_t *state, edit_map_t *current)
 {
index e6a6dec8af9ec751ddc7275cc9494600b50ebe76..fa542c67d55bebd4e1832e1bd09b2845e79bc2a9 100644 (file)
@@ -190,7 +190,7 @@ static inline void xlat_debug_log_expansion(request_t *request, xlat_exp_t const
         *      well as the original fmt string.
         */
        if ((node->type == XLAT_FUNC) && !xlat_is_literal(node->call.args)) {
-               RDEBUG2("(%%%c%s:%pM%c)",
+               RDEBUG2("| %%%c%s:%pM%c",
                        (node->call.func->input_type == XLAT_INPUT_ARGS) ? '(' : '{',
                        node->call.func->name, args,
                        (node->call.func->input_type == XLAT_INPUT_ARGS) ? ')' : '}');
@@ -198,7 +198,7 @@ static inline void xlat_debug_log_expansion(request_t *request, xlat_exp_t const
                char *str;
 
                str = xlat_fmt_aprint(NULL, node);
-               RDEBUG2("%s", str); /* print line number here for debugging */
+               RDEBUG2("%s", str); /* print line number here for debugging */
                talloc_free(str);
        }
 }
@@ -214,7 +214,7 @@ static inline void xlat_debug_log_list_result(request_t *request, xlat_exp_t con
 
        if (!RDEBUG_ENABLED2) return;
 
-       RDEBUG2("--> %pM", result);
+       RDEBUG2("--> %pM", result);
 }
 
 /** Output the result of an expansion
@@ -228,7 +228,7 @@ static inline void xlat_debug_log_result(request_t *request, xlat_exp_t const *n
 
        if (!RDEBUG_ENABLED2) return;
 
-       RDEBUG2("--> %pV", result);
+       RDEBUG2("--> %pV", result);
 }
 
 /** Process an individual xlat argument value box group
@@ -743,7 +743,7 @@ xlat_action_t xlat_frame_eval_resume(TALLOC_CTX *ctx, fr_dcursor_t *out,
        xa = resume(ctx, out, XLAT_CTX(exp->call.inst->data, t->data, t->mctx, rctx), request, result);
        VALUE_BOX_TALLOC_LIST_VERIFY(result);
 
-       RDEBUG2("%%%c%s:...%c",
+       RDEBUG2("%%%c%s:...%c",
                (exp->call.func->input_type == XLAT_INPUT_ARGS) ? '(' : '{',
                exp->call.func->name,
                (exp->call.func->input_type == XLAT_INPUT_ARGS) ? ')' : '}');
@@ -752,12 +752,12 @@ xlat_action_t xlat_frame_eval_resume(TALLOC_CTX *ctx, fr_dcursor_t *out,
                break;
 
        case XLAT_ACTION_YIELD:
-               RDEBUG2("(YIELD)");
+               RDEBUG2("(YIELD)");
                break;
 
        case XLAT_ACTION_DONE:
                fr_dcursor_next(out);           /* Wind to the start of this functions output */
-               RDEBUG2("--> %pV", fr_dcursor_current(out));
+               RDEBUG2("--> %pV", fr_dcursor_current(out));
                break;
 
        case XLAT_ACTION_FAIL:
@@ -843,15 +843,15 @@ xlat_action_t xlat_frame_eval_repeat(TALLOC_CTX *ctx, fr_dcursor_t *out,
                        return xa;
 
                case XLAT_ACTION_PUSH_CHILD:
-                       RDEBUG3("   -- CHILD");
+                       RDEBUG3("|   -- CHILD");
                        return xa;
 
                case XLAT_ACTION_PUSH_UNLANG:
-                       RDEBUG3("   -- UNLANG");
+                       RDEBUG3("|   -- UNLANG");
                        return xa;
 
                case XLAT_ACTION_YIELD:
-                       RDEBUG3("   -- YIELD");
+                       RDEBUG3("|   -- YIELD");
                        return xa;
 
                case XLAT_ACTION_DONE:                          /* Process the result */