printers CHANGE rewrite printers mechanism

Instead of specifying output type (memory, stream, file descriptor, ...)
with each printer function call, use printer handler mechanism. The
handler is first created with specifying the output type with necessary
parameters. Then, the handler can be used in the single print function
without the need to specify the specific output type parameters. There
are also a helper functions to update/change the output type parameter
without a need to recreate the printer handler.

This change is necessary due to the increasing complexity of the
printer functions. We want to add another parameters/specific functions,
for example to print a separate node, but together with the specific
output type parameters, the function parameters list would be quite
complex.
diff --git a/src/printer_data.h b/src/printer_data.h
index 38c757b..921793f 100644
--- a/src/printer_data.h
+++ b/src/printer_data.h
@@ -19,6 +19,7 @@
 #include <unistd.h>
 
 #include "tree_data.h"
+#include "printer.h"
 
 /**
  * @defgroup dataprinterflags Data printer flags
@@ -50,71 +51,15 @@
  */
 
 /**
- * @brief Print data tree in the specified format into a memory block.
- * It is up to caller to free the returned string by free().
+ * @brief Common YANG data printer.
  *
- * @param[out] strp Pointer to store the resulting dump.
- * @param[in] root Root node of the data tree to print. It can be actually any (not only real root)
- * node of the data tree to print the specific subtree.
- * @param[in] format Data output format.
+ * @param[in] out Printer handler for a specific output. Use lyp_*() functions to create the handler and lyp_free() to remove the handler.
+ * @param[in] root The root element of the (sub)tree to print.
+ * @param[in] format Output format.
  * @param[in] options [Data printer flags](@ref dataprinterflags). With \p format LYD_LYB, only #LYP_WITHSIBLINGS option is accepted.
  * @return Number of printed characters (excluding the null byte used to end the string) in case of success.
  * @return Negative value failure (absolute value corresponds to LY_ERR values).
  */
-ssize_t lyd_print_mem(char **strp, const struct lyd_node *root, LYD_FORMAT format, int options);
-
-/**
- * @brief Print data tree in the specified format into a file descriptor.
- *
- * @param[in] fd File descriptor where to print the data.
- * @param[in] root Root node of the data tree to print. It can be actually any (not only real root)
- * node of the data tree to print the specific subtree.
- * @param[in] format Data output format.
- * @param[in] options [Data printer flags](@ref dataprinterflags). With \p format LYD_LYB, only #LYP_WITHSIBLINGS option is accepted.
- * @return Number of printed characters (excluding the null byte used to end the string) in case of success.
- * @return Negative value failure (absolute value corresponds to LY_ERR values).
- */
-ssize_t lyd_print_fd(int fd, const struct lyd_node *root, LYD_FORMAT format, int options);
-
-/**
- * @brief Print data tree in the specified format into a file stream.
- *
- * @param[in] f File stream where to print the schema.
- * @param[in] root Root node of the data tree to print. It can be actually any (not only real root)
- * node of the data tree to print the specific subtree.
- * @param[in] format Data output format.
- * @param[in] options [Data printer flags](@ref dataprinterflags). With \p format LYD_LYB, only #LYP_WITHSIBLINGS option is accepted.
- * @return Number of printed characters (excluding the null byte used to end the string) in case of success.
- * @return Negative value failure (absolute value corresponds to LY_ERR values).
- */
-ssize_t lyd_print_file(FILE *f, const struct lyd_node *root, LYD_FORMAT format, int options);
-
-/**
- * @brief Print data tree in the specified format into a file.
- *
- * @param[in] path File where to print the schema.
- * @param[in] root Root node of the data tree to print. It can be actually any (not only real root)
- * node of the data tree to print the specific subtree.
- * @param[in] format Data output format.
- * @param[in] options [Data printer flags](@ref dataprinterflags). With \p format LYD_LYB, only #LYP_WITHSIBLINGS option is accepted.
- * @return Number of printed characters (excluding the null byte used to end the string) in case of success.
- * @return Negative value failure (absolute value corresponds to LY_ERR values).
- */
-ssize_t lyd_print_path(const char *path, const struct lyd_node *root, LYD_FORMAT format, int options);
-
-/**
- * @brief Print data tree in the specified format using the provided callback.
- *
- * @param[in] writeclb Callback function to write the data (see write(2)).
- * @param[in] arg Optional caller-specific argument to be passed to the \p writeclb callback.
- * @param[in] root Root node of the data tree to print. It can be actually any (not only real root)
- * node of the data tree to print the specific subtree.
- * @param[in] format Data output format.
- * @param[in] options [Data printer flags](@ref dataprinterflags). With \p format LYD_LYB, only #LYP_WITHSIBLINGS option is accepted.
- * @return Number of printed characters (excluding the null byte used to end the string) in case of success.
- * @return Negative value failure (absolute value corresponds to LY_ERR values).
- */
-ssize_t lyd_print_clb(ssize_t (*writeclb)(void *arg, const void *buf, size_t count), void *arg, const struct lyd_node *root,
-                      LYD_FORMAT format, int options);
+ssize_t lyd_print(struct lyp_out *out, const struct lyd_node *root, LYD_FORMAT format, int options);
 
 #endif /* LY_PRINTER_DATA_H_ */