extensions CHANGE CHANGE cleanup API of the schema printer for extension plugins
Be more clear by what API of the compiled schema printer is available for the
extension plugins. While the printer context is needed, we want to keep its
members hidden to be able to make future changes. Therefore, there is only a
(possibly extensible in a future) set of getters to access the context's members
to be read and updated by the plugins' printer callbacks.
The patch also explicitely states the common compatible members of the
different schema printers.
diff --git a/src/printer_yin.c b/src/printer_yin.c
index 5ccea30..93fd271 100644
--- a/src/printer_yin.c
+++ b/src/printer_yin.c
@@ -34,10 +34,17 @@
* @brief YIN printer context.
*/
struct lys_ypr_ctx {
- struct ly_out *out; /**< output specification */
- uint16_t level; /**< current indentation level: 0 - no formatting, >= 1 indentation levels */
- uint32_t options; /**< Schema output options (see @ref schemaprinterflags). */
- const struct lys_module *module; /**< schema to print */
+ union {
+ struct {
+ struct ly_out *out; /**< output specification */
+ uint16_t level; /**< current indentation level: 0 - no formatting, >= 1 indentation levels */
+ uint32_t options; /**< Schema output options (see @ref schemaprinterflags). */
+ const struct lys_module *module; /**< schema to print */
+ };
+ struct lyspr_ctx printer_ctx;
+ };
+
+ /* YIN printer specific members */
};
static void yprp_extension_instances(struct lys_ypr_ctx *ctx, enum ly_stmt substmt, uint8_t substmt_index,