plugins CHANGE redesign lists of internal extension/type plugins

Prepare the lists of plugins for support of external plugins. Instead of
a statically allocated array, change the API to functions encapsulating
accessing and manipulation with the lists and plugins inside.

So far the lists still contain only the internal plugins, loading
external plugins will be added in a separated commit.
diff --git a/src/context.c b/src/context.c
index 801d636..e8d0eb3 100644
--- a/src/context.c
+++ b/src/context.c
@@ -35,6 +35,7 @@
 #include "hash_table.h"
 #include "in.h"
 #include "parser_data.h"
+#include "plugins_internal.h"
 #include "plugins_types.h"
 #include "schema_compile.h"
 #include "set.h"
@@ -226,10 +227,8 @@
     /* dictionary */
     lydict_init(&ctx->dict);
 
-#if 0 /* TODO when plugins implemented */
     /* plugins */
-    ly_load_plugins();
-#endif
+    LY_CHECK_ERR_RET(lyplg_init(), LOGINT(NULL), LY_EINT);
 
     /* initialize thread-specific keys */
     while ((pthread_key_create(&ctx->errlist_key, ly_err_free)) == EAGAIN) {}
@@ -914,10 +913,8 @@
     /* dictionary */
     lydict_clean(&ctx->dict);
 
-#if 0 /* TODO when plugins implemented */
     /* plugins - will be removed only if this is the last context */
-    ly_clean_plugins();
-#endif
+    lyplg_clean();
 
     free(ctx);
 }