printers CHANGE unify formatting options for data and schema printers
Replaces LYD_PRINT_FORMAT by the LYD_PRINT_SHRINK with the inverse
meaning. This way the default formating (do format output) is unified
between data and schema printers. The commit also introduces
LYS_PRINT_SHRINK with the same value to have the option explicitely also
for the schema printers and to allow to print schemas without
unnecessary indentations and new lines.
diff --git a/src/printer_yang.c b/src/printer_yang.c
index 1c3a196..2ea38f4 100644
--- a/src/printer_yang.c
+++ b/src/printer_yang.c
@@ -1174,7 +1174,7 @@
yprc_must(ctx, &inout->musts[u], NULL);
}
- if (!(ctx->options & LYS_OUTPUT_NO_SUBSTMT)) {
+ if (!(ctx->options & LYS_PRINT_NO_SUBSTMT)) {
LY_LIST_FOR(inout->data, data) {
yprc_node(ctx, data);
}
@@ -1243,7 +1243,7 @@
ypr_description(ctx, notif->dsc, notif->exts, &flag);
ypr_reference(ctx, notif->ref, notif->exts, &flag);
- if (!(ctx->options & LYS_OUTPUT_NO_SUBSTMT)) {
+ if (!(ctx->options & LYS_PRINT_NO_SUBSTMT)) {
LY_LIST_FOR(notif->data, data) {
ypr_open(ctx->out, &flag);
yprc_node(ctx, data);
@@ -1426,7 +1426,7 @@
yprc_node_common2(ctx, node, &flag);
- if (!(ctx->options & LYS_OUTPUT_NO_SUBSTMT)) {
+ if (!(ctx->options & LYS_PRINT_NO_SUBSTMT)) {
LY_LIST_FOR(cont->child, child) {
ypr_open(ctx->out, &flag);
yprc_node(ctx, child);
@@ -1475,7 +1475,7 @@
yprc_node_common1(ctx, (struct lysc_node *)cs, &flag);
yprc_node_common2(ctx, (struct lysc_node *)cs, &flag);
- if (!(ctx->options & LYS_OUTPUT_NO_SUBSTMT)) {
+ if (!(ctx->options & LYS_PRINT_NO_SUBSTMT)) {
for (child = cs->child; child && child->parent == (struct lysc_node *)cs; child = child->next) {
ypr_open(ctx->out, &flag);
yprc_node(ctx, child);
@@ -1776,7 +1776,7 @@
ypr_description(ctx, node->dsc, node->exts, NULL);
ypr_reference(ctx, node->ref, node->exts, NULL);
- if (!(ctx->options & LYS_OUTPUT_NO_SUBSTMT)) {
+ if (!(ctx->options & LYS_PRINT_NO_SUBSTMT)) {
LY_LIST_FOR(list->child, child) {
ypr_open(ctx->out, &flag);
yprc_node(ctx, child);
@@ -2202,7 +2202,7 @@
yang_print_parsed_module(struct ly_out *out, const struct lys_module *module, const struct lysp_module *modp, uint32_t options)
{
LY_ARRAY_COUNT_TYPE u;
- struct ypr_ctx ctx_ = {.out = out, .level = 0, .module = module, .schema = YPR_PARSED, .options = options | LYD_PRINT_FORMAT}, *ctx = &ctx_;
+ struct ypr_ctx ctx_ = {.out = out, .level = 0, .module = module, .schema = YPR_PARSED, .options = options}, *ctx = &ctx_;
ly_print_(ctx->out, "%*smodule %s {\n", INDENT, module->name);
LEVEL++;
@@ -2259,7 +2259,7 @@
yang_print_parsed_submodule(struct ly_out *out, const struct lys_module *module, const struct lysp_submodule *submodp, uint32_t options)
{
LY_ARRAY_COUNT_TYPE u;
- struct ypr_ctx ctx_ = {.out = out, .level = 0, .module = module, .schema = YPR_PARSED, .options = options | LYD_PRINT_FORMAT}, *ctx = &ctx_;
+ struct ypr_ctx ctx_ = {.out = out, .level = 0, .module = module, .schema = YPR_PARSED, .options = options}, *ctx = &ctx_;
ly_print_(ctx->out, "%*ssubmodule %s {\n", INDENT, submodp->name);
LEVEL++;
@@ -2303,7 +2303,7 @@
LY_ERR
yang_print_compiled_node(struct ly_out *out, const struct lysc_node *node, uint32_t options)
{
- struct ypr_ctx ctx_ = {.out = out, .level = 0, .module = node->module, .options = options | LYD_PRINT_FORMAT}, *ctx = &ctx_;
+ struct ypr_ctx ctx_ = {.out = out, .level = 0, .module = node->module, .options = options}, *ctx = &ctx_;
yprc_node(ctx, node);
@@ -2317,7 +2317,7 @@
LY_ARRAY_COUNT_TYPE u;
struct lysc_node *data;
struct lysc_module *modc = module->compiled;
- struct ypr_ctx ctx_ = {.out = out, .level = 0, .module = module, .options = options | LYD_PRINT_FORMAT}, *ctx = &ctx_;
+ struct ypr_ctx ctx_ = {.out = out, .level = 0, .module = module, .options = options}, *ctx = &ctx_;
ly_print_(ctx->out, "%*smodule %s {\n", INDENT, module->name);
LEVEL++;
@@ -2359,7 +2359,7 @@
yprc_identity(ctx, &modc->identities[u]);
}
- if (!(ctx->options & LYS_OUTPUT_NO_SUBSTMT)) {
+ if (!(ctx->options & LYS_PRINT_NO_SUBSTMT)) {
LY_LIST_FOR(modc->data, data) {
yprc_node(ctx, data);
}