diff options
author | David Robillard <d@drobilla.net> | 2011-02-18 15:37:36 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-02-18 15:37:36 +0000 |
commit | 05c2dfb6d677e5dc49c4de1ec568da4f69e3c877 (patch) | |
tree | 8d2ff26fa8eeec66777ae84c41a51c238137e402 /src | |
parent | d3264c5685c90856379df368f131188c2af6ab09 (diff) | |
download | ingen-05c2dfb6d677e5dc49c4de1ec568da4f69e3c877.tar.gz ingen-05c2dfb6d677e5dc49c4de1ec568da4f69e3c877.tar.bz2 ingen-05c2dfb6d677e5dc49c4de1ec568da4f69e3c877.zip |
Trim more cruft.
Correctly receive data about plugins with hashes in their URIs.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2988 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/client/ClientStore.cpp | 21 | ||||
-rw-r--r-- | src/client/HTTPClientReceiver.cpp | 2 | ||||
-rw-r--r-- | src/client/NodeModel.cpp | 2 | ||||
-rw-r--r-- | src/client/wscript | 5 | ||||
-rw-r--r-- | src/common/interface/Plugin.hpp | 5 | ||||
-rw-r--r-- | src/gui/LoadPluginWindow.cpp | 5 | ||||
-rw-r--r-- | src/gui/PatchCanvas.cpp | 3 | ||||
-rw-r--r-- | src/serialisation/Parser.cpp | 162 | ||||
-rw-r--r-- | src/serialisation/Parser.hpp | 16 | ||||
-rw-r--r-- | src/shared/LV2URIMap.cpp | 1 | ||||
-rw-r--r-- | src/shared/LV2URIMap.hpp | 1 |
11 files changed, 48 insertions, 175 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 4ae2ff2d..010acb10 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -254,22 +254,19 @@ ClientStore::put(const URI& uri, const Resource::Properties& properties) /*LOG(info) << "PUT " << uri << " {" << endl; for (iterator i = properties.begin(); i != properties.end(); ++i) LOG(info) << " " << i->first << " = " << i->second << " :: " << i->second.type() << endl; - LOG(info) << "}" << endl;*/ + LOG(info) << "}" << endl;*/ - bool is_path = Path::is_valid(uri.str()); bool is_meta = ResourceImpl::is_meta_uri(uri); - if (!(is_path || is_meta)) { - const Atom& type = properties.find(_uris->rdf_type)->second; - if (type.type() == Atom::URI) { - const URI& type_uri = type.get_uri(); - if (Plugin::type_from_uri(type_uri) != Plugin::NIL) { - SharedPtr<PluginModel> p(new PluginModel(uris(), uri, type_uri, properties)); - add_plugin(p); - return; - } + // Check if uri is a plugin + const Atom& type = properties.find(_uris->rdf_type)->second; + if (type.type() == Atom::URI) { + const URI& type_uri = type.get_uri(); + if (Plugin::type_from_uri(type_uri) != Plugin::NIL) { + SharedPtr<PluginModel> p(new PluginModel(uris(), uri, type_uri, properties)); + add_plugin(p); + return; } else { - LOG(error) << "Non-URI type " << type << endl; } } diff --git a/src/client/HTTPClientReceiver.cpp b/src/client/HTTPClientReceiver.cpp index bd16fe73..b6f1e856 100644 --- a/src/client/HTTPClientReceiver.cpp +++ b/src/client/HTTPClientReceiver.cpp @@ -138,7 +138,7 @@ HTTPClientReceiver::close_session() void HTTPClientReceiver::update(const std::string& str) { - LOG(info) << _world->parser()->parse_update(_world, _target.get(), str, _url); + //LOG(info) << _world->parser()->parse_update(_world, _target.get(), str, _url); } void diff --git a/src/client/NodeModel.cpp b/src/client/NodeModel.cpp index 8d8a5ece..2ffd751d 100644 --- a/src/client/NodeModel.cpp +++ b/src/client/NodeModel.cpp @@ -198,8 +198,6 @@ NodeModel::default_port_value_range(SharedPtr<PortModel> port, float& min, float max = _max_values[port->index()]; } #endif - - // TODO: LADSPA support } diff --git a/src/client/wscript b/src/client/wscript index 0cba8a8e..8a4540d0 100644 --- a/src/client/wscript +++ b/src/client/wscript @@ -25,7 +25,10 @@ def build(bld): ''' if bld.env['HAVE_LIBLO'] == 1: - obj.source += ' OSCClientReceiver.cpp OSCEngineSender.cpp ' + obj.source += ''' + OSCClientReceiver.cpp + OSCEngineSender.cpp + ''' obj.includes = ['.', '..', '../..', '../common'] obj.export_includes = ['.'] diff --git a/src/common/interface/Plugin.hpp b/src/common/interface/Plugin.hpp index 5acaa8e6..0dfd85d3 100644 --- a/src/common/interface/Plugin.hpp +++ b/src/common/interface/Plugin.hpp @@ -29,7 +29,7 @@ namespace Shared { class Plugin : virtual public Resource { public: - enum Type { NIL, LV2, LADSPA, Internal, Patch }; + enum Type { NIL, LV2, Internal, Patch }; virtual Type type() const = 0; @@ -37,7 +37,6 @@ public: static const Raul::URI uris[] = { "http://drobilla.net/ns/ingen#nil", "http://lv2plug.in/ns/lv2core#Plugin", - "http://drobilla.net/ns/ingen#LADSPAPlugin", "http://drobilla.net/ns/ingen#Internal", "http://drobilla.net/ns/ingen#Patch" }; @@ -50,8 +49,6 @@ public: static inline Type type_from_uri(const Raul::URI& uri) { if (uri == type_uri(LV2)) return LV2; - else if (uri == type_uri(LADSPA)) - return LADSPA; else if (uri == type_uri(Internal)) return Internal; else if (uri == type_uri(Patch)) diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index 41281140..2c1d9ae7 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -228,16 +228,11 @@ LoadPluginWindow::set_row(Gtk::TreeModel::Row& row, SharedPtr<PluginModel> plugi const Atom& name = plugin->get_property(uris.doap_name); if (name.is_valid() && name.type() == Atom::STRING) row[_plugins_columns._col_name] = name.get_string(); - else if (plugin->type() == Plugin::LADSPA) - App::instance().engine()->request_property(plugin->uri(), uris.doap_name); switch (plugin->type()) { case Plugin::LV2: row[_plugins_columns._col_type] = "LV2"; break; - case Plugin::LADSPA: - row[_plugins_columns._col_type] = "LADSPA"; - break; case Plugin::Internal: row[_plugins_columns._col_type] = "Internal"; break; diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp index 0e1c6fbc..3ee6e3cb 100644 --- a/src/gui/PatchCanvas.cpp +++ b/src/gui/PatchCanvas.cpp @@ -696,7 +696,6 @@ PatchCanvas::paste() if (!_patch->path().is_root()) clipboard.put(_patch->path(), props); - boost::optional<Raul::Path> data_path; boost::optional<Raul::Path> parent; boost::optional<Raul::Symbol> symbol; @@ -705,7 +704,7 @@ PatchCanvas::paste() } ClashAvoider avoider(*App::instance().store().get(), clipboard, &clipboard); - parser->parse_string(App::instance().world(), &avoider, str, Path().str(), data_path, + parser->parse_string(App::instance().world(), &avoider, str, Path().str(), parent, symbol); for (Store::iterator i = clipboard.begin(); i != clipboard.end(); ++i) { diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp index b69900b5..57f54bc9 100644 --- a/src/serialisation/Parser.cpp +++ b/src/serialisation/Parser.cpp @@ -1,5 +1,5 @@ /* This file is part of Ingen. - * Copyright (C) 2007-2009 David Robillard <http://drobilla.net> + * Copyright (C) 2007-2011 David Robillard <http://drobilla.net> * * Ingen is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software @@ -86,14 +86,6 @@ relative_uri(Glib::ustring base, const Glib::ustring uri, bool leading_slash) return ret; } -static void -normalise_uri(Glib::ustring& uri) -{ - size_t dotslash = string::npos; - while ((dotslash = uri.find("./")) != string::npos) - uri = uri.substr(0, dotslash) + uri.substr(dotslash + 2); -} - Parser::PatchRecords Parser::find_patches(Ingen::Shared::World* world, const Glib::ustring& manifest_uri) @@ -105,22 +97,17 @@ Parser::find_patches(Ingen::Shared::World* world, Sord::URI rdfs_seeAlso(*world->rdf_world(), NS_RDFS "seeAlso"); Sord::URI ingen_Patch(*world->rdf_world(), NS_INGEN "Patch"); - RDFNodes patches; - for (Sord::Iter i = model.find(nil, rdf_type, ingen_Patch); !i.end(); ++i) { - patches.insert(i.get_subject()); - } - std::list<PatchRecord> records; - for (RDFNodes::const_iterator i = patches.begin(); i != patches.end(); ++i) { - Sord::Iter f = model.find(*i, rdfs_seeAlso, nil); - if (f.end()) { + for (Sord::Iter i = model.find(nil, rdf_type, ingen_Patch); !i.end(); ++i) { + const Sord::Node patch = i.get_subject(); + Sord::Iter f = model.find(patch, rdfs_seeAlso, nil); + if (!f.end()) { + records.push_back(PatchRecord(patch.to_c_string(), + f.get_object().to_c_string())); + } else { LOG(error) << "Patch has no rdfs:seeAlso" << endl; - continue; } - records.push_back(PatchRecord(i->to_c_string(), - f.get_object().to_c_string())); } - return records; } @@ -135,38 +122,32 @@ Parser::parse_file(Ingen::Shared::World* world, boost::optional<Raul::Symbol> symbol, boost::optional<GraphObject::Properties> data) { - normalise_uri(file_uri); - - const size_t colon = file_uri.find(":"); - Glib::ustring file_path = file_uri; + const size_t colon = file_uri.find(":"); if (colon != Glib::ustring::npos) { const Glib::ustring scheme = file_uri.substr(0, colon); if (scheme != "file") { - LOG(error) << (boost::format("Unsupported URI scheme `%1%'") % scheme) << endl; + LOG(error) << (boost::format("Unsupported URI scheme `%1%'") + % scheme) << endl; return false; } - if (file_uri.substr(0, 7) == "file://") { - file_path = file_uri.substr(7); - } else { - file_path = file_uri.substr(5); - } + } else { + file_uri = Glib::ustring("file://") + file_uri; } - std::string filename = Glib::filename_from_uri(file_uri); - if (file_uri.substr(file_uri.length() - 4) != ".ttl") { - // Not a Turtle file, maybe a bundle, check for manifest + // Not a Turtle file, try to open it as a bundle if (file_uri[file_uri.length() - 1] != '/') { file_uri.append("/"); } Parser::PatchRecords records = find_patches(world, file_uri + "manifest.ttl"); if (!records.empty()) { - filename = Glib::filename_from_uri(records.front().file_uri); + file_uri = records.front().file_uri; } } - Sord::Model model(*world->rdf_world(), filename); - model.load_file(filename); + // Load patch file into model + Sord::Model model(*world->rdf_world(), file_uri); + model.load_file(file_uri); LOG(info) << "Parsing " << file_uri << endl; if (parent) @@ -175,7 +156,7 @@ Parser::parse_file(Ingen::Shared::World* world, LOG(info) << "Symbol: " << *symbol << endl; boost::optional<Path> parsed_path - = parse(world, target, model, filename, Path("/"), parent, symbol, data); + = parse(world, target, model, file_uri, Path("/"), parent, symbol, data); if (parsed_path) { target->set_property(*parsed_path, "http://drobilla.net/ns/ingen#document", @@ -192,19 +173,20 @@ Parser::parse_string(Ingen::Shared::World* world, Ingen::Shared::CommonInterface* target, const Glib::ustring& str, const Glib::ustring& base_uri, - boost::optional<Raul::Path> data_path, boost::optional<Raul::Path> parent, boost::optional<Raul::Symbol> symbol, boost::optional<GraphObject::Properties> data) { + // Load string into model Sord::Model model(*world->rdf_world(), base_uri); model.load_string(str.c_str(), str.length(), base_uri); - LOG(info) << "Parsing " << (data_path ? data_path->str() : "*") << " from string"; + LOG(info) << "Parsing string"; if (!base_uri.empty()) info << " (base " << base_uri << ")"; info << endl; + boost::optional<Raul::Path> data_path; bool ret = parse(world, target, model, base_uri, data_path, parent, symbol, data); Sord::URI subject(*world->rdf_world(), base_uri); parse_connections(world, target, model, subject, parent ? *parent : "/"); @@ -212,73 +194,6 @@ Parser::parse_string(Ingen::Shared::World* world, return ret; } -bool -Parser::parse_update(Ingen::Shared::World* world, - Shared::CommonInterface* target, - const Glib::ustring& str, - const Glib::ustring& base_uri, - boost::optional<Raul::Path> data_path, - boost::optional<Raul::Path> parent, - boost::optional<Raul::Symbol> symbol, - boost::optional<GraphObject::Properties> data) -{ -#if 0 - Sord::Model model(*world->rdf_world(), str.c_str(), str.length(), base_uri); - - // Delete anything explicitly declared to not exist - Glib::ustring query_str = Glib::ustring("SELECT DISTINCT ?o WHERE { ?o a owl:Nothing }"); - Sord::Query query(*world->rdf_world(), query_str); - SharedPtr<Sord::QueryResults> results(query.run(*world->rdf_world(), model, base_uri)); - - for (; !results->finished(); results->next()) { - const Sord::Node& object = results->get("o"); - target->del(object.to_string()); - } - - // Properties - query = Sord::Query(*world->rdf_world(), - "SELECT DISTINCT ?s ?p ?o WHERE {\n" - "?s ?p ?o .\n" - "}"); - - results = query.run(*world->rdf_world(), model, base_uri); - for (; !results->finished(); results->next()) { - Glib::Mutex::Lock lock(world->rdf_world()->mutex()); - string obj_uri(results->get("s").to_string()); - const string key(results->get("p").to_string()); - const Sord::Node& val_node(results->get("o")); - const Atom a(AtomRDF::node_to_atom(model, val_node)); - if (obj_uri.find(":") == string::npos) - obj_uri = Path(obj_uri).str(); - obj_uri = relative_uri(base_uri, obj_uri, true); - if (!key.empty()) - target->set_property(string("path:") + obj_uri, key, a); - } - - // Connections - Sord::URI subject(*world->rdf_world(), base_uri); - parse_connections(world, target, model, subject, "/"); - - // Port values - query = Sord::Query(*world->rdf_world(), - "SELECT DISTINCT ?path ?value WHERE {\n" - "?path ingen:value ?value .\n" - "}"); - - results = query.run(*world->rdf_world(), model, base_uri); - for (; !results->finished(); results->next()) { - Glib::Mutex::Lock lock(world->rdf_world()->mutex()); - const string obj_path = results->get("path").to_string(); - const Sord::Node& val_node = results->get("value"); - const Atom a(AtomRDF::node_to_atom(model, val_node)); - target->set_property(obj_path, world->uris()->ingen_value, a); - } - - return parse(world, target, model, base_uri, data_path, parent, symbol, data); -#endif - return false; -} - boost::optional<Path> Parser::parse(Ingen::Shared::World* world, Ingen::Shared::CommonInterface* target, @@ -289,23 +204,19 @@ Parser::parse(Ingen::Shared::World* world, boost::optional<Raul::Symbol> symbol, boost::optional<GraphObject::Properties> data) { - const Sord::Node::Type res = Sord::Node::URI; - - const Sord::URI rdf_type(*world->rdf_world(), NS_RDF "type"); - - const Sord::Node patch_class (*world->rdf_world(), res, NS_INGEN "Patch"); - const Sord::Node node_class (*world->rdf_world(), res, NS_INGEN "Node"); - const Sord::Node internal_class (*world->rdf_world(), res, NS_INGEN "Internal"); - const Sord::Node ladspa_class (*world->rdf_world(), res, NS_INGEN "LADSPAPlugin"); - const Sord::Node in_port_class (*world->rdf_world(), res, NS_LV2 "InputPort"); - const Sord::Node out_port_class (*world->rdf_world(), res, NS_LV2 "OutputPort"); - const Sord::Node lv2_class (*world->rdf_world(), res, NS_LV2 "Plugin"); + const Sord::URI rdf_type (*world->rdf_world(), NS_RDF "type"); + const Sord::URI patch_class (*world->rdf_world(), NS_INGEN "Patch"); + const Sord::URI node_class (*world->rdf_world(), NS_INGEN "URI"); + const Sord::URI internal_class (*world->rdf_world(), NS_INGEN "Internal"); + const Sord::URI in_port_class (*world->rdf_world(), NS_LV2 "InputPort"); + const Sord::URI out_port_class (*world->rdf_world(), NS_LV2 "OutputPort"); + const Sord::URI lv2_class (*world->rdf_world(), NS_LV2 "Plugin"); Sord::Node subject = nil; if (data_path && data_path->is_root()) { subject = model.base_uri(); } else if (data_path) { - subject = Sord::Node(*world->rdf_world(), res, data_path->chop_start("/")); + subject = Sord::URI(*world->rdf_world(), data_path->chop_start("/")); } else { subject = nil; } @@ -321,10 +232,6 @@ Parser::parse(Ingen::Shared::World* world, if (!data_path) path_str = relative_uri(document_uri, subject.to_c_string(), true); - const bool is_plugin = (rdf_class == ladspa_class) - || (rdf_class == lv2_class) - || (rdf_class == internal_class); - const bool is_object = (rdf_class == patch_class) || (rdf_class == node_class) || (rdf_class == in_port_class) @@ -364,16 +271,7 @@ Parser::parse(Ingen::Shared::World* world, if (data_path && subject.to_string() == data_path->str()) root_path = ret; - - } else if (is_plugin) { - string subject_str = subject.to_string(); - if (URI::is_valid(subject_str)) { - if (subject_str == document_uri) - subject_str = Path::root().str(); - parse_properties(world, target, model, subject, subject_str); - } } - } return boost::optional<Path>(Path(path_str)); diff --git a/src/serialisation/Parser.hpp b/src/serialisation/Parser.hpp index 6d1661dd..5d4fc3fc 100644 --- a/src/serialisation/Parser.hpp +++ b/src/serialisation/Parser.hpp @@ -56,17 +56,6 @@ public: Shared::CommonInterface* target, const Glib::ustring& str, const Glib::ustring& base_uri, - boost::optional<Raul::Path> data_path=boost::optional<Raul::Path>(), - boost::optional<Raul::Path> parent=boost::optional<Raul::Path>(), - boost::optional<Raul::Symbol> symbol=boost::optional<Raul::Symbol>(), - boost::optional<Properties> data=boost::optional<Properties>()); - - virtual bool parse_update( - Ingen::Shared::World* world, - Shared::CommonInterface* target, - const Glib::ustring& str, - const Glib::ustring& base_uri, - boost::optional<Raul::Path> data_path=boost::optional<Raul::Path>(), boost::optional<Raul::Path> parent=boost::optional<Raul::Path>(), boost::optional<Raul::Symbol> symbol=boost::optional<Raul::Symbol>(), boost::optional<Properties> data=boost::optional<Properties>()); @@ -81,9 +70,8 @@ public: typedef std::list<PatchRecord> PatchRecords; - virtual PatchRecords find_patches( - Ingen::Shared::World* world, - const Glib::ustring& manifest_uri); + virtual PatchRecords find_patches(Ingen::Shared::World* world, + const Glib::ustring& manifest_uri); private: boost::optional<Raul::Path> parse( diff --git a/src/shared/LV2URIMap.cpp b/src/shared/LV2URIMap.cpp index 90582102..768982d0 100644 --- a/src/shared/LV2URIMap.cpp +++ b/src/shared/LV2URIMap.cpp @@ -68,7 +68,6 @@ LV2URIMap::LV2URIMap() , doap_name ("http://usefulinc.com/ns/doap#name") , ev_EventPort ("http://lv2plug.in/ns/ext/event#EventPort") , ingen_Internal (NS_INGEN "Internal") - , ingen_LADSPAPlugin (NS_INGEN "LADSPAPlugin") , ingen_Node (NS_INGEN "Node") , ingen_Patch (NS_INGEN "Patch") , ingen_Port (NS_INGEN "Port") diff --git a/src/shared/LV2URIMap.hpp b/src/shared/LV2URIMap.hpp index c8607426..fe98bbc3 100644 --- a/src/shared/LV2URIMap.hpp +++ b/src/shared/LV2URIMap.hpp @@ -104,7 +104,6 @@ public: const Quark doap_name; const Quark ev_EventPort; const Quark ingen_Internal; - const Quark ingen_LADSPAPlugin; const Quark ingen_Node; const Quark ingen_Patch; const Quark ingen_Port; |