Skip to content

Commit 3cccab9

Browse files
committed
Revert "metacall-plugin-local-test working properly"
This reverts commit 512f0d3.
1 parent b80dfc1 commit 3cccab9

File tree

7 files changed

+6
-131
lines changed

7 files changed

+6
-131
lines changed

source/extensions/plugin_extension/source/plugin_extension.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@ static int plugin_extension_get_path(std::string &ext_path)
6767
return 0;
6868
}
6969

70-
int plugin_extension(void *loader, void *context)
70+
int plugin_extension(void *, void *)
7171
{
72-
(void)loader;
7372
std::string ext_path;
7473

7574
if (plugin_extension_get_path(ext_path) != 0)
@@ -103,7 +102,7 @@ int plugin_extension(void *loader, void *context)
103102
{
104103
log_write("metacall", LOG_LEVEL_DEBUG, "Loading extension: %s", dir.path().filename().c_str());
105104

106-
if (metacall_load_from_configuration_ctx(dir.path().c_str(), context, config_allocator) != 0)
105+
if (metacall_load_from_configuration(dir.path().c_str(), NULL, config_allocator) != 0)
107106
{
108107
log_write("metacall", LOG_LEVEL_ERROR, "Failed to load extension: %s", dir.path().c_str());
109108
return 1;

source/loader/include/loader/loader.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,11 @@ LOADER_API int loader_execution_path(const loader_tag tag, const loader_path pat
6565

6666
LOADER_API int loader_load_from_file(const loader_tag tag, const loader_path paths[], size_t size, void **handle);
6767

68-
LOADER_API int loader_load_from_file_ctx(const loader_tag tag, const loader_path paths[], size_t size, void *ctx);
69-
7068
LOADER_API int loader_load_from_memory(const loader_tag tag, const char *buffer, size_t size, void **handle);
7169

7270
LOADER_API int loader_load_from_package(const loader_tag tag, const loader_path path, void **handle);
7371

74-
LOADER_API int loader_load_from_configuration(const loader_path path, void **handle, void *ctx, void *allocator);
72+
LOADER_API int loader_load_from_configuration(const loader_path path, void **handle, void *allocator);
7573

7674
LOADER_API loader_impl loader_get_impl(const loader_tag tag);
7775

source/loader/include/loader/loader_impl.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ LOADER_API int loader_impl_execution_path(plugin p, loader_impl impl, const load
5959

6060
LOADER_API int loader_impl_load_from_file(plugin_manager manager, plugin p, loader_impl impl, const loader_path paths[], size_t size, void **handle_ptr);
6161

62-
LOADER_API int loader_impl_load_from_file_ctx(plugin_manager manager, plugin p, loader_impl impl, const loader_path paths[], size_t size, void *ctx);
63-
6462
LOADER_API int loader_impl_load_from_memory(plugin_manager manager, plugin p, loader_impl impl, const char *buffer, size_t size, void **handle_ptr);
6563

6664
LOADER_API int loader_impl_load_from_package(plugin_manager manager, plugin p, loader_impl impl, const loader_path path, void **handle_ptr);

source/loader/source/loader.c

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -302,26 +302,6 @@ int loader_load_from_file(const loader_tag tag, const loader_path paths[], size_
302302
return loader_impl_load_from_file(&loader_manager, p, plugin_impl_type(p, loader_impl), paths, size, handle);
303303
}
304304

305-
int loader_load_from_file_ctx(const loader_tag tag, const loader_path paths[], size_t size, void *ctx)
306-
{
307-
if (loader_initialize() == 1)
308-
{
309-
return 1;
310-
}
311-
312-
plugin p = loader_get_impl_plugin(tag);
313-
314-
if (p == NULL)
315-
{
316-
log_write("metacall", LOG_LEVEL_ERROR, "Tried to load %" PRIuS " file(s) from non existent loader (%s): %s", size, tag, paths[0]);
317-
return 1;
318-
}
319-
320-
log_write("metacall", LOG_LEVEL_DEBUG, "Loading %" PRIuS " file(s) (%s) from path(s): %s ...", size, tag, paths[0]);
321-
322-
return loader_impl_load_from_file_ctx(&loader_manager, p, plugin_impl_type(p, loader_impl), paths, size, ctx);
323-
}
324-
325305
int loader_load_from_memory(const loader_tag tag, const char *buffer, size_t size, void **handle)
326306
{
327307
if (loader_initialize() == 1)
@@ -362,7 +342,7 @@ int loader_load_from_package(const loader_tag tag, const loader_path path, void
362342
return loader_impl_load_from_package(&loader_manager, p, plugin_impl_type(p, loader_impl), path, handle);
363343
}
364344

365-
int loader_load_from_configuration(const loader_path path, void **handle, void *ctx, void *allocator)
345+
int loader_load_from_configuration(const loader_path path, void **handle, void *allocator)
366346
{
367347
loader_name config_name;
368348
configuration config;
@@ -487,17 +467,7 @@ int loader_load_from_configuration(const loader_path path, void **handle, void *
487467
}
488468
}
489469

490-
int result = 0;
491-
if (ctx != NULL)
492-
{
493-
result = loader_load_from_file_ctx((const char *)value_to_string(tag), (const loader_path *)paths, size, ctx);
494-
}
495-
else
496-
{
497-
result = loader_load_from_file((const char *)value_to_string(tag), (const loader_path *)paths, size, handle);
498-
}
499-
500-
if (result != 0)
470+
if (loader_load_from_file((const char *)value_to_string(tag), (const loader_path *)paths, size, handle) != 0)
501471
{
502472
log_write("metacall", LOG_LEVEL_ERROR, "Loader load from configuration invalid load from file");
503473

source/loader/source/loader_impl.c

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -796,67 +796,6 @@ int loader_impl_load_from_file(plugin_manager manager, plugin p, loader_impl imp
796796

797797
return 1;
798798
}
799-
int loader_impl_load_from_file_ctx(plugin_manager manager, plugin p, loader_impl impl, const loader_path paths[], size_t size, void *ctx)
800-
{
801-
if (ctx == NULL)
802-
{
803-
log_write("metacall", LOG_LEVEL_ERROR, "Load from file failed, invalid context");
804-
805-
return 1;
806-
}
807-
808-
if (impl != NULL)
809-
{
810-
loader_impl_interface iface = loader_iface(p);
811-
812-
size_t iterator;
813-
814-
for (iterator = 0; iterator < size; ++iterator)
815-
{
816-
log_write("metacall", LOG_LEVEL_DEBUG, "Loading %s", paths[iterator]);
817-
}
818-
819-
if (iface != NULL)
820-
{
821-
loader_handle handle;
822-
loader_path path;
823-
824-
if (loader_impl_initialize(manager, p, impl) != 0)
825-
{
826-
return 1;
827-
}
828-
829-
/* This isn't really necessary*/
830-
if (loader_impl_handle_name(manager, paths[0], path) > 1 && loader_impl_get_handle(impl, path) != NULL)
831-
{
832-
log_write("metacall", LOG_LEVEL_ERROR, "Load from file handle failed, handle with name %s already loaded", path);
833-
834-
return 1;
835-
}
836-
837-
handle = iface->load_from_file(impl, paths, size);
838-
839-
log_write("metacall", LOG_LEVEL_DEBUG, "Loader interface: %p - Loader handle: %p", (void *)iface, (void *)handle);
840-
841-
if (handle != NULL)
842-
{
843-
scope sp = context_scope(ctx);
844-
845-
if (sp != NULL)
846-
{
847-
/* Todo: check for duplicate symbols*/
848-
849-
if (iface->discover(impl, handle, ctx) == 0)
850-
{
851-
return 0;
852-
}
853-
}
854-
}
855-
}
856-
}
857-
858-
return 1;
859-
}
860799

861800
int loader_impl_load_from_memory_name(loader_impl impl, loader_name name, const char *buffer, size_t size)
862801
{

source/metacall/include/metacall/metacall.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -309,30 +309,6 @@ METACALL_API int metacall_load_from_package(const char *tag, const char *path, v
309309
*/
310310
METACALL_API int metacall_load_from_configuration(const char *path, void **handle, void *allocator);
311311

312-
/**
313-
* @brief
314-
* Loads a a list of scrips from configuration specified by @path into loader
315-
* with the following format:
316-
* {
317-
* "language_id": "<tag>",
318-
* "path": "<path>",
319-
* "scripts": [ "<script0>", "<script1>", ..., "<scriptN>" ]
320-
* }
321-
*
322-
* @param[in] path
323-
* Path of the configuration
324-
*
325-
* @param[in] context
326-
* Pointer to context
327-
*
328-
* @param[in] allocator
329-
* Pointer to allocator will allocate the configuration
330-
*
331-
* @return
332-
* Zero if success, different from zero otherwise
333-
*/
334-
METACALL_API int metacall_load_from_configuration_ctx(const char *path, void *ctx, void *allocator);
335-
336312
/**
337313
* @brief
338314
* Call a function anonymously by value array @args

source/metacall/source/metacall.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,7 @@ int metacall_load_from_package(const char *tag, const char *path, void **handle)
321321

322322
int metacall_load_from_configuration(const char *path, void **handle, void *allocator)
323323
{
324-
return loader_load_from_configuration(path, handle, NULL, allocator);
325-
}
326-
327-
int metacall_load_from_configuration_ctx(const char *path, void *ctx, void *allocator)
328-
{
329-
return loader_load_from_configuration(path, NULL, ctx, allocator);
324+
return loader_load_from_configuration(path, handle, allocator);
330325
}
331326

332327
void *metacallv(const char *name, void *args[])

0 commit comments

Comments
 (0)