libyang REFACTOR use lysp_module instead of lys_module as mod_def

Because imports from a specific parsed module
or submodule must be used, not imports from the
module and all its submodules.

Also, pmod (prefix module) is now the term
used for the module where import prefixes are
searched in and cur_mod (current module) is
the module of unprefixed identifiers.
diff --git a/src/tree_schema.c b/src/tree_schema.c
index ace1ee8..e81e77d 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -245,7 +245,7 @@
     LY_CHECK_GOTO(ret, cleanup);
 
     /* atomize expression */
-    ret = lyxp_atomize(exp, LY_PREF_JSON, ctx_node->module, ctx_node, LYXP_NODE_ELEM, &xp_set, options);
+    ret = lyxp_atomize(exp, NULL, LY_PREF_JSON, NULL, ctx_node, &xp_set, options);
     LY_CHECK_GOTO(ret, cleanup);
 
     /* allocate return set */
@@ -290,7 +290,7 @@
     LY_CHECK_GOTO(ret, cleanup);
 
     /* atomize expression */
-    ret = lyxp_atomize(exp, LY_PREF_JSON, ctx_node->module, ctx_node, LYXP_NODE_ELEM, &xp_set, options);
+    ret = lyxp_atomize(exp, NULL, LY_PREF_JSON, NULL, ctx_node, &xp_set, options);
     LY_CHECK_GOTO(ret, cleanup);
 
     /* allocate return set */
@@ -958,7 +958,7 @@
     return LY_SUCCESS;
 
 error:
-    lysp_submodule_free(ctx, submod);
+    lysp_module_free((struct lysp_module *)submod);
     if (format == LYS_IN_YANG) {
         yang_parser_ctx_free(yangctx);
     } else {
@@ -973,6 +973,7 @@
         void *check_data, struct lys_module **module)
 {
     struct lys_module *mod = NULL, *latest, *mod_dup;
+    struct lysp_submodule *submod;
     LY_ERR ret;
     LY_ARRAY_COUNT_TYPE u;
     struct lys_yang_parser_ctx *yangctx = NULL;
@@ -1113,8 +1114,8 @@
 
     if (!implement) {
         /* pre-compile features and identities of the module */
-        LY_CHECK_GOTO(ret = lys_feature_precompile(NULL, ctx, mod, mod->parsed->features, &mod->features), error);
-        LY_CHECK_GOTO(ret = lys_identity_precompile(NULL, ctx, mod, mod->parsed->identities, &mod->identities), error);
+        LY_CHECK_GOTO(ret = lys_feature_precompile(NULL, ctx, mod->parsed, mod->parsed->features, &mod->features), error);
+        LY_CHECK_GOTO(ret = lys_identity_precompile(NULL, ctx, mod->parsed, mod->parsed->identities, &mod->identities), error);
     }
 
     if (latest) {
@@ -1133,10 +1134,11 @@
     if (!implement) {
         /* pre-compile features and identities of any submodules */
         LY_ARRAY_FOR(mod->parsed->includes, u) {
-            LY_CHECK_GOTO(ret = lys_feature_precompile(NULL, ctx, mod, mod->parsed->includes[u].submodule->features,
-                    &mod->features), error);
-            LY_CHECK_GOTO(ret = lys_identity_precompile(NULL, ctx, mod, mod->parsed->includes[u].submodule->identities,
-                    &mod->identities), error);
+            submod = mod->parsed->includes[u].submodule;
+            ret = lys_feature_precompile(NULL, ctx, (struct lysp_module *)submod, submod->features, &mod->features);
+            LY_CHECK_GOTO(ret, error);
+            ret = lys_identity_precompile(NULL, ctx, (struct lysp_module *)submod, submod->identities, &mod->identities);
+            LY_CHECK_GOTO(ret, error);
         }
     }