tree printer FEATURE basic implementation of YANG tree format printer
Follows RFC 8340.
Fixes #858
diff --git a/src/printer_schema.c b/src/printer_schema.c
index 24f772f..a376c14 100644
--- a/src/printer_schema.c
+++ b/src/printer_schema.c
@@ -24,7 +24,7 @@
#include "tree_schema.h"
API LY_ERR
-lys_print_module(struct ly_out *out, const struct lys_module *module, LYS_OUTFORMAT format, size_t UNUSED(line_length),
+lys_print_module(struct ly_out *out, const struct lys_module *module, LYS_OUTFORMAT format, size_t line_length,
uint32_t options)
{
LY_ERR ret;
@@ -62,10 +62,15 @@
ret = yin_print_parsed_module(out, module, module->parsed, options);
break;
- /* TODO not yet implemented
case LYS_OUT_TREE:
- ret = tree_print_model(out, module, target_node, line_length, options);
+ if (!module->parsed) {
+ LOGERR(module->ctx, LY_EINVAL, "Module \"%s\" parsed module missing.", module->name);
+ ret = LY_EINVAL;
+ break;
+ }
+ ret = tree_print_parsed_module(out, module, options, line_length);
break;
+ /* TODO not yet implemented
case LYS_OUT_INFO:
ret = info_print_model(out, module, target_node);
break;
@@ -99,7 +104,7 @@
break;
/* TODO not yet implemented
case LYS_OUT_TREE:
- ret = tree_print_model(out, module, target_node, line_length, options);
+ ret = tree_print_submodule(out, module, submodule, options, line_length);
break;
case LYS_OUT_INFO:
ret = info_print_model(out, module, target_node);
@@ -204,7 +209,7 @@
ret = yin_print_parsed(out, module);
break;
case LYS_OUT_TREE:
- ret = tree_print_model(out, module, target_node, line_length, options);
+ ret = tree_print_compiled_node(out, node, options, line_length);
break;
*/
default: