libyang REFACTOR applying deviations, augments, and refines (#1217)
They are no longer applied as part of their
definition module compilation but instead their
target module compilation.
diff --git a/src/printer_yang.c b/src/printer_yang.c
index a173084..4405c2a 100644
--- a/src/printer_yang.c
+++ b/src/printer_yang.c
@@ -439,24 +439,21 @@
}
static void
-yprp_iffeatures(struct ypr_ctx *ctx, const char **iff, struct lysp_ext_instance *exts, ly_bool *flag)
+yprp_iffeatures(struct ypr_ctx *ctx, struct lysp_qname *iffs, struct lysp_ext_instance *exts, ly_bool *flag)
{
- LY_ARRAY_COUNT_TYPE u;
+ LY_ARRAY_COUNT_TYPE u, v;
ly_bool extflag;
- LY_ARRAY_FOR(iff, u) {
+ LY_ARRAY_FOR(iffs, u) {
ypr_open(ctx->out, flag);
extflag = 0;
- ly_print_(ctx->out, "%*sif-feature \"%s\"", INDENT, iff[u]);
+ ly_print_(ctx->out, "%*sif-feature \"%s\"", INDENT, iffs[u].str);
/* extensions */
LEVEL++;
- LY_ARRAY_FOR(exts, u) {
- if (exts[u].insubstmt != LYEXT_SUBSTMT_IFFEATURE || exts[u].insubstmt_index != u) {
- continue;
- }
- yprp_extension_instances(ctx, LYEXT_SUBSTMT_IFFEATURE, u, &exts[u], &extflag, 1);
+ LY_ARRAY_FOR(exts, v) {
+ yprp_extension_instances(ctx, LYEXT_SUBSTMT_IFFEATURE, u, &exts[v], &extflag, 1);
}
LEVEL--;
ypr_close(ctx, extflag);
@@ -672,12 +669,12 @@
ypr_open(ctx->out, flag);
ly_print_(ctx->out, "%*s%s \"", INDENT, name);
- ypr_encode(ctx->out, (restr->arg[0] != 0x15 && restr->arg[0] != 0x06) ? restr->arg : &restr->arg[1], -1);
+ ypr_encode(ctx->out, (restr->arg.str[0] != 0x15 && restr->arg.str[0] != 0x06) ? restr->arg.str : &restr->arg.str[1], -1);
ly_print_(ctx->out, "\"");
LEVEL++;
yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, restr->exts, &inner_flag, 0);
- if (restr->arg[0] == 0x15) {
+ if (restr->arg.str[0] == 0x15) {
/* special byte value in pattern's expression: 0x15 - invert-match, 0x06 - match */
ypr_open(ctx->out, &inner_flag);
ypr_substmt(ctx, LYEXT_SUBSTMT_MODIFIER, 0, "invert-match", restr->exts);
@@ -1066,8 +1063,8 @@
if (tpdf->units) {
ypr_substmt(ctx, LYEXT_SUBSTMT_UNITS, 0, tpdf->units, tpdf->exts);
}
- if (tpdf->dflt) {
- ypr_substmt(ctx, LYEXT_SUBSTMT_DEFAULT, 0, tpdf->dflt, tpdf->exts);
+ if (tpdf->dflt.str) {
+ ypr_substmt(ctx, LYEXT_SUBSTMT_DEFAULT, 0, tpdf->dflt.str, tpdf->exts);
}
ypr_status(ctx, tpdf->flags, tpdf->exts, NULL);
@@ -1126,8 +1123,8 @@
LY_ARRAY_COUNT_TYPE u;
struct lysp_node *data;
- if (!inout->nodetype) {
- /* nodetype not set -> input/output is empty */
+ if (!inout->data) {
+ /* no children */
return;
}
ypr_open(ctx->out, flag);
@@ -1495,9 +1492,9 @@
yprp_node_common1(ctx, node, &flag);
- if (choice->dflt) {
+ if (choice->dflt.str) {
ypr_open(ctx->out, &flag);
- ypr_substmt(ctx, LYEXT_SUBSTMT_DEFAULT, 0, choice->dflt, choice->exts);
+ ypr_substmt(ctx, LYEXT_SUBSTMT_DEFAULT, 0, choice->dflt.str, choice->exts);
}
yprp_node_common2(ctx, node, &flag);
@@ -1549,7 +1546,7 @@
LY_ARRAY_FOR(leaf->musts, u) {
yprp_restr(ctx, &leaf->musts[u], "must", NULL);
}
- ypr_substmt(ctx, LYEXT_SUBSTMT_DEFAULT, 0, leaf->dflt, leaf->exts);
+ ypr_substmt(ctx, LYEXT_SUBSTMT_DEFAULT, 0, leaf->dflt.str, leaf->exts);
yprp_node_common2(ctx, node, NULL);
@@ -1595,7 +1592,7 @@
yprp_restr(ctx, &llist->musts[u], "must", NULL);
}
LY_ARRAY_FOR(llist->dflts, u) {
- ypr_substmt(ctx, LYEXT_SUBSTMT_DEFAULT, u, llist->dflts[u], llist->exts);
+ ypr_substmt(ctx, LYEXT_SUBSTMT_DEFAULT, u, llist->dflts[u].str, llist->exts);
}
ypr_config(ctx, node->flags, node->exts, NULL);
@@ -1678,7 +1675,7 @@
}
LY_ARRAY_FOR(list->uniques, u) {
ypr_open(ctx->out, &flag);
- ypr_substmt(ctx, LYEXT_SUBSTMT_UNIQUE, u, list->uniques[u], list->exts);
+ ypr_substmt(ctx, LYEXT_SUBSTMT_UNIQUE, u, list->uniques[u].str, list->exts);
}
ypr_config(ctx, node->flags, node->exts, NULL);