tree printer CHANGE new tree-rfc format and some other options added

Added option for not printing leafref targets, not resolving uses
groupings and print uses instead, printing only subtree, and
limiting line length. New test of this also added.
diff --git a/src/tree_schema.c b/src/tree_schema.c
index 15c37e7..e1ff147 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -1581,7 +1581,6 @@
 
         memset(&new, 0, sizeof new);
 
-        new.module_name = lydict_insert(mod->ctx, type->module_name, 0);
         new.base = type->base;
         new.parent = (struct lys_tpdf *)parent;
 
@@ -1940,7 +1939,6 @@
 {
     int i;
 
-    new->module_name = lydict_insert(mod->ctx, old->module_name, 0);
     new->base = old->base;
     new->der = old->der;
     new->parent = (struct lys_tpdf *)parent;
@@ -1980,8 +1978,6 @@
         return;
     }
 
-    lydict_remove(ctx, type->module_name);
-
     lys_extension_instances_free(ctx, type->ext, type->ext_size, private_destructor);
 
     switch (type->base) {
@@ -3248,6 +3244,17 @@
     return 0;
 }
 
+int
+lys_type_is_local(const struct lys_type *type)
+{
+    if (!type->der->module) {
+        /* build-in type */
+        return 1;
+    }
+    /* type->parent can be either a typedef or leaf/leaf-list, but module pointers are compatible */
+    return (lys_main_module(type->der->module) == lys_main_module(((struct lys_tpdf *)type->parent)->module));
+}
+
 /*
  * shallow -
  *         - do not inherit status from the parent