schema tree FEATURE flag for internal parsed structures
That should not be printed for the standard formats.
diff --git a/src/printer_yang.c b/src/printer_yang.c
index 147f860..81aba85 100644
--- a/src/printer_yang.c
+++ b/src/printer_yang.c
@@ -235,7 +235,7 @@
}
count--;
- if ((ext->insubstmt != substmt) || (ext->insubstmt_index != substmt_index)) {
+ if ((ext->flags & LYS_INTERNAL) || (ext->insubstmt != substmt) || (ext->insubstmt_index != substmt_index)) {
continue;
}
@@ -2016,6 +2016,10 @@
LY_ARRAY_COUNT_TYPE u;
LY_ARRAY_FOR(modp->imports, u) {
+ if (modp->imports[u].flags & LYS_INTERNAL) {
+ continue;
+ }
+
ly_print_(ctx->out, "%s%*simport %s {\n", u ? "" : "\n", INDENT, modp->imports[u].name);
LEVEL++;
yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, modp->imports[u].exts, NULL, 0);
diff --git a/src/printer_yin.c b/src/printer_yin.c
index 1b691d9..f0f2177 100644
--- a/src/printer_yin.c
+++ b/src/printer_yin.c
@@ -1317,7 +1317,7 @@
}
count--;
- if ((ext->insubstmt != substmt) || (ext->insubstmt_index != substmt_index)) {
+ if ((ext->flags & LYS_INTERNAL) || (ext->insubstmt != substmt) || (ext->insubstmt_index != substmt_index)) {
continue;
}
@@ -1370,6 +1370,10 @@
LY_ARRAY_COUNT_TYPE u;
LY_ARRAY_FOR(modp->imports, u) {
+ if (modp->imports[u].flags & LYS_INTERNAL) {
+ continue;
+ }
+
ypr_open(ctx, "import", "module", modp->imports[u].name, 1);
LEVEL++;
yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, modp->imports[u].exts, NULL, 0);
diff --git a/src/tree_schema.h b/src/tree_schema.h
index 35dade9..61cbbda 100644
--- a/src/tree_schema.h
+++ b/src/tree_schema.h
@@ -438,6 +438,7 @@
const char *dsc; /**< description */
const char *ref; /**< reference */
struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
+ uint16_t flags; /**< LYS_INTERNAL value (@ref snodeflags) */
char rev[LY_REV_SIZE]; /**< revision-date of the imported module */
};
@@ -496,7 +497,8 @@
LYEXT_SUBSTMT insubstmt; /**< value identifying placement of the extension instance */
LY_ARRAY_COUNT_TYPE insubstmt_index; /**< in case the instance is in a substatement, this identifies
the index of that substatement */
- uint8_t yin; /** flag for YIN source format, can be set to LYS_YIN */
+ uint16_t flags; /**< LYS_INTERNAL value (@ref snodeflags) */
+ uint8_t yin; /**< flag for YIN source format, can be set to LYS_YIN */
LYEXT_PARENT parent_type; /**< type of the parent structure */
};
@@ -808,6 +810,8 @@
* LYS_YIN_ATTR | | | | | | | | | | | | | | | | | | | | | | |x|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* 12 LYS_YIN_ARGUMENT | | | | | | | | | | | | | | | | | | | | | | |x|
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * 13 LYS_INTERNAL |x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|
* ---------------------+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
*/
@@ -927,6 +931,8 @@
#define LYS_YIN_ATTR 0x400 /**< flag to identify YIN attribute parsed as extension's substatement, only when the source is YIN */
#define LYS_YIN_ARGUMENT 0x800 /**< flag to identify statement representing extension's argument, only when the source is YIN */
+#define LYS_INTERNAL 0x1000 /**< flag to identify internal parsed statements that should not be printed */
+
#define LYS_ISENUM 0x200 /**< flag to simply distinguish type in struct lysc_type_bitenum_item */
#define LYS_FLAGS_COMPILED_MASK 0xff /**< mask for flags that maps to the compiled structures */