summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-04-18 03:30:02 +0000
committerDavid Robillard <d@drobilla.net>2011-04-18 03:30:02 +0000
commit1776fe75458a11eeaa5ed0c26c6c9aa0e93f6f2c (patch)
tree16f09c2b731d2968a9b2390cf938d164d2920541
parentad02810bb505e823ed7222c785649f668baaa404 (diff)
downloadingen-1776fe75458a11eeaa5ed0c26c6c9aa0e93f6f2c.tar.gz
ingen-1776fe75458a11eeaa5ed0c26c6c9aa0e93f6f2c.tar.bz2
ingen-1776fe75458a11eeaa5ed0c26c6c9aa0e93f6f2c.zip
Saner module loading API.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3157 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/engine/ingen_lv2.cpp4
-rw-r--r--src/gui/App.cpp2
-rw-r--r--src/gui/ConnectWindow.cpp4
-rw-r--r--src/gui/ThreadedLoader.cpp2
-rw-r--r--src/ingen/main.cpp20
-rw-r--r--src/shared/Configuration.cpp1
-rw-r--r--src/shared/World.cpp22
-rw-r--r--src/shared/World.hpp16
-rw-r--r--src/shared/runtime_paths.cpp2
9 files changed, 38 insertions, 35 deletions
diff --git a/src/engine/ingen_lv2.cpp b/src/engine/ingen_lv2.cpp
index 69daa7ae..c48e65fa 100644
--- a/src/engine/ingen_lv2.cpp
+++ b/src/engine/ingen_lv2.cpp
@@ -258,7 +258,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
IngenPlugin* plugin = (IngenPlugin*)malloc(sizeof(IngenPlugin));
plugin->world = new World(&lib.conf, lib.argc, lib.argv);
- if (!plugin->world->load("ingen_serialisation")) {
+ if (!plugin->world->load_module("serialisation")) {
delete plugin->world;
return NULL;
}
@@ -389,7 +389,7 @@ Lib::Lib()
Ingen::Shared::set_bundle_path_from_code((void*)&lv2_descriptor);
Ingen::Shared::World* world = new Ingen::Shared::World(&conf, argc, argv);
- if (!world->load("ingen_serialisation")) {
+ if (!world->load_module("serialisation")) {
delete world;
return;
}
diff --git a/src/gui/App.cpp b/src/gui/App.cpp
index a70014fa..5462116a 100644
--- a/src/gui/App.cpp
+++ b/src/gui/App.cpp
@@ -196,7 +196,7 @@ SharedPtr<Serialiser>
App::serialiser()
{
if (!_world->serialiser())
- _world->load("ingen_serialisation");
+ _world->load_module("serialisation");
return _world->serialiser();
}
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp
index 8c5a654a..19e5594b 100644
--- a/src/gui/ConnectWindow.cpp
+++ b/src/gui/ConnectWindow.cpp
@@ -242,12 +242,12 @@ ConnectWindow::connect(bool existing)
#endif // defined(HAVE_LIBLO) || defined(HAVE_SOUP)
if (_mode == INTERNAL) {
if (!world->local_engine())
- world->load("ingen_engine");
+ world->load_module("engine");
SharedPtr<SigClientInterface> client(new SigClientInterface());
if (!((Engine*)world->local_engine().get())->driver())
- world->load("ingen_jack");
+ world->load_module("jack");
world->local_engine()->activate();
diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp
index 86d249a6..5338b7ee 100644
--- a/src/gui/ThreadedLoader.cpp
+++ b/src/gui/ThreadedLoader.cpp
@@ -47,7 +47,7 @@ ThreadedLoader::parser()
Ingen::Shared::World* world = App::instance().world();
if (!world->parser())
- world->load("ingen_serialisation");
+ world->load_module("serialisation");
return world->parser();
}
diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp
index 747f2498..dd2e5057 100644
--- a/src/ingen/main.cpp
+++ b/src/ingen/main.cpp
@@ -39,11 +39,11 @@
#include "ingen-config.h"
-#include "engine/Engine.hpp"
+#include "ingen/EngineBase.hpp"
#include "ingen/EngineInterface.hpp"
-#include "shared/World.hpp"
#include "serialisation/Parser.hpp"
#include "shared/Configuration.hpp"
+#include "shared/World.hpp"
#include "shared/runtime_paths.hpp"
#ifdef WITH_BINDINGS
#include "bindings/ingen_bindings.hpp"
@@ -119,7 +119,7 @@ main(int argc, char** argv)
// Run engine
if (conf.option("engine").get_bool()) {
- ingen_try(world->load("ingen_engine"),
+ ingen_try(world->load_module("engine"),
"Unable to load engine module");
ingen_try(world->local_engine(),
@@ -130,11 +130,11 @@ main(int argc, char** argv)
// Not loading a GUI, load network engine interfaces
if (!conf.option("gui").get_bool()) {
#ifdef HAVE_LIBLO
- ingen_try(world->load("ingen_osc"),
+ ingen_try(world->load_module("osc"),
"Unable to load OSC module");
#endif
#ifdef HAVE_SOUP
- ingen_try(world->load("ingen_http"),
+ ingen_try(world->load_module("http"),
"Unable to load HTTP module");
#endif
}
@@ -142,7 +142,7 @@ main(int argc, char** argv)
// Load client library (required for patch loading and/or GUI)
if (conf.option("load").is_valid() || conf.option("gui").get_bool())
- ingen_try(world->load("ingen_client"),
+ ingen_try(world->load_module("client"),
"Unable to load client module");
// If we don't have a local engine interface (for GUI), use network
@@ -154,7 +154,7 @@ main(int argc, char** argv)
// Activate the engine, if we have one
if (world->local_engine()) {
- ingen_try(world->load("ingen_jack"),
+ ingen_try(world->load_module("jack"),
"Unable to load jack module");
}
@@ -178,7 +178,7 @@ main(int argc, char** argv)
}
}
- ingen_try(world->load("ingen_serialisation"),
+ ingen_try(world->load_module("serialisation"),
"Unable to load serialisation module");
ingen_try(world->parser(),
@@ -202,13 +202,13 @@ main(int argc, char** argv)
// Load GUI
if (conf.option("gui").get_bool())
- ingen_try(world->load("ingen_gui"),
+ ingen_try(world->load_module("gui"),
"Unable to load GUI module");
// Run a script
if (conf.option("run").is_valid()) {
#ifdef WITH_BINDINGS
- ingen_try(world->load("ingen_bindings"),
+ ingen_try(world->load_module("bindings"),
"Unable to load bindings module");
world->run("application/x-python", conf.option("run").get_string());
diff --git a/src/shared/Configuration.cpp b/src/shared/Configuration.cpp
index e5def43b..3cf07a14 100644
--- a/src/shared/Configuration.cpp
+++ b/src/shared/Configuration.cpp
@@ -17,6 +17,7 @@
#include "raul/Atom.hpp"
+#include "ingen-config.h"
#include "Configuration.hpp"
using namespace Raul;
diff --git a/src/shared/World.cpp b/src/shared/World.cpp
index 38c08340..e53bcf4f 100644
--- a/src/shared/World.cpp
+++ b/src/shared/World.cpp
@@ -49,7 +49,7 @@ namespace Shared {
* \param name The base name of the module, e.g. "ingen_serialisation"
*/
static SharedPtr<Glib::Module>
-load_module(const string& name)
+ingen_load_module(const string& name)
{
Glib::Module* module = NULL;
@@ -95,9 +95,9 @@ load_module(const string& name)
}
}
-class WorldImpl : public boost::noncopyable {
+class World::Pimpl {
public:
- WorldImpl(Raul::Configuration* conf, int& a_argc, char**& a_argv)
+ Pimpl(Raul::Configuration* conf, int& a_argc, char**& a_argv)
: argc(a_argc)
, argv(a_argv)
, conf(conf)
@@ -134,7 +134,7 @@ public:
rdf_world->add_prefix("xsd", "http://www.w3.org/2001/XMLSchema#");
}
- virtual ~WorldImpl()
+ virtual ~Pimpl()
{
local_engine.reset();
@@ -182,13 +182,13 @@ public:
};
World::World(Raul::Configuration* conf, int& argc, char**& argv)
- : _impl(new WorldImpl(conf, argc, argv))
+ : _impl(new Pimpl(conf, argc, argv))
{
}
World::~World()
{
- unload_all();
+ unload_modules();
delete _impl;
}
@@ -219,9 +219,9 @@ SharedPtr<LV2URIMap> World::uris() { return _impl->uris; }
* @return true on success, false on failure
*/
bool
-World::load(const char* name)
+World::load_module(const char* name)
{
- SharedPtr<Glib::Module> lib = load_module(name);
+ SharedPtr<Glib::Module> lib = ingen_load_module(name);
Ingen::Shared::Module* (*module_load)() = NULL;
if (lib && lib->get_symbol("ingen_module_load", (void*&)module_load)) {
Module* module = module_load();
@@ -238,7 +238,7 @@ World::load(const char* name)
/** Unload all loaded Ingen modules.
*/
void
-World::unload_all()
+World::unload_modules()
{
_impl->modules.clear();
}
@@ -249,7 +249,7 @@ SharedPtr<Ingen::Shared::EngineInterface>
World::interface(const std::string& url)
{
const string scheme = url.substr(0, url.find(":"));
- const WorldImpl::InterfaceFactories::const_iterator i = _impl->interface_factories.find(scheme);
+ const Pimpl::InterfaceFactories::const_iterator i = _impl->interface_factories.find(scheme);
if (i == _impl->interface_factories.end()) {
warn << "Unknown URI scheme `" << scheme << "'" << endl;
return SharedPtr<Ingen::Shared::EngineInterface>();
@@ -262,7 +262,7 @@ World::interface(const std::string& url)
bool
World::run(const std::string& mime_type, const std::string& filename)
{
- const WorldImpl::ScriptRunners::const_iterator i = _impl->script_runners.find(mime_type);
+ const Pimpl::ScriptRunners::const_iterator i = _impl->script_runners.find(mime_type);
if (i == _impl->script_runners.end()) {
warn << "Unknown script MIME type `" << mime_type << "'" << endl;
return false;
diff --git a/src/shared/World.hpp b/src/shared/World.hpp
index 4a07d4f6..189e2bbe 100644
--- a/src/shared/World.hpp
+++ b/src/shared/World.hpp
@@ -45,7 +45,6 @@ class EngineInterface;
class LV2Features;
class LV2URIMap;
class Store;
-class WorldImpl;
/** The "world" all Ingen modules may share.
*
@@ -61,16 +60,17 @@ public:
World(Raul::Configuration* conf, int& argc, char**& argv);
virtual ~World();
- virtual bool load(const char* name);
- virtual void unload_all();
+ virtual bool load_module(const char* name);
+ virtual void unload_modules();
- typedef SharedPtr<Ingen::Shared::EngineInterface> (*InterfaceFactory)(
- World* world, const std::string& engine_url);
+ typedef SharedPtr<Shared::EngineInterface> (*InterfaceFactory)(
+ World* world,
+ const std::string& engine_url);
virtual void add_interface_factory(const std::string& scheme,
InterfaceFactory factory);
- virtual SharedPtr<Ingen::Shared::EngineInterface> interface(
+ virtual SharedPtr<Shared::EngineInterface> interface(
const std::string& engine_url);
virtual bool run(const std::string& mime_type,
@@ -105,7 +105,9 @@ public:
virtual std::string jack_uuid();
private:
- WorldImpl* _impl;
+ class Pimpl;
+
+ Pimpl* _impl;
};
} // namespace Shared
diff --git a/src/shared/runtime_paths.cpp b/src/shared/runtime_paths.cpp
index e177bc65..d533c883 100644
--- a/src/shared/runtime_paths.cpp
+++ b/src/shared/runtime_paths.cpp
@@ -99,7 +99,7 @@ module_path(const std::string& name, std::string dir)
#endif
}
- ret = Glib::Module::build_path(dir, name);
+ ret = Glib::Module::build_path(dir, string("ingen_") + name);
#ifdef __APPLE__
// MacPorts glib doesnt seem to do portable path building correctly...