From dfad81a3c8aee40a515f0ecefb0180a86368b54a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 23 Feb 2013 20:07:09 +0000 Subject: Remove Raul::fmt wrapper, the last vestige of boost dependency for Raul. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5077 a436a847-0d15-0410-975c-d299462d15a1 --- ingen/Log.hpp | 11 +++++++---- src/AtomReader.cpp | 9 ++++----- src/Configuration.cpp | 20 ++++++++++---------- src/URIMap.cpp | 2 +- src/World.cpp | 14 +++++++------- src/client/ClientStore.cpp | 22 +++++++++++----------- src/client/PluginUI.cpp | 6 +++--- src/gui/App.cpp | 8 ++++---- src/gui/GraphBox.cpp | 7 +++---- src/gui/GraphCanvas.cpp | 6 +++--- src/gui/GraphTreeWindow.cpp | 4 ++-- src/gui/NodeMenu.cpp | 2 +- src/gui/NodeModule.cpp | 4 ++-- src/gui/PropertiesWindow.cpp | 6 +++--- src/gui/Style.cpp | 2 +- src/gui/WidgetFactory.cpp | 4 ++-- src/ingen/main.cpp | 6 +++--- src/serialisation/Parser.cpp | 22 +++++++++++----------- src/serialisation/Serialiser.cpp | 4 ++-- src/server/BlockFactory.cpp | 6 +++--- src/server/ControlBindings.cpp | 2 +- src/server/Engine.cpp | 4 ++-- src/server/GraphImpl.cpp | 4 ++-- src/server/JackDriver.cpp | 8 ++++---- src/server/LV2Block.cpp | 12 ++++++------ src/server/ingen_lv2.cpp | 7 +++---- src/socket/SocketReader.cpp | 4 ++-- src/socket/ingen_socket_client.cpp | 2 +- src/socket/ingen_socket_server.cpp | 6 +++--- tests/ingen_test.cpp | 6 +++--- 30 files changed, 110 insertions(+), 110 deletions(-) diff --git a/ingen/Log.hpp b/ingen/Log.hpp index 750d6ec3..3574ae3e 100644 --- a/ingen/Log.hpp +++ b/ingen/Log.hpp @@ -19,11 +19,14 @@ #include +#include + #include "lv2/lv2plug.in/ns/ext/log/log.h" -#include "raul/fmt.hpp" namespace Ingen { +typedef boost::basic_format fmt; + class URIs; class Log { @@ -34,9 +37,9 @@ public: void info(const std::string& msg); void warn(const std::string& msg); - inline void error(const Raul::fmt& fmt) { error(fmt.str()); } - inline void info(const Raul::fmt& fmt) { info(fmt.str()); } - inline void warn(const Raul::fmt& fmt) { warn(fmt.str()); } + inline void error(const fmt& fmt) { error(fmt.str()); } + inline void info(const fmt& fmt) { info(fmt.str()); } + inline void warn(const fmt& fmt) { warn(fmt.str()); } private: LV2_Log_Log* _log; diff --git a/src/AtomReader.cpp b/src/AtomReader.cpp index ae2f19c1..228f3808 100644 --- a/src/AtomReader.cpp +++ b/src/AtomReader.cpp @@ -48,8 +48,7 @@ AtomReader::get_atom(const LV2_Atom* in, Atom& out) if (uri) { out = _forge.alloc_uri(_map.unmap_uri(urid->body)); } else { - _log.error(Raul::fmt("Unable to unmap URID %1%\n") - % urid->body); + _log.error(fmt("Unable to unmap URID %1%\n") % urid->body); } } else { out = _forge.alloc(in->size, in->type, LV2_ATOM_BODY_CONST(in)); @@ -117,7 +116,7 @@ bool AtomReader::write(const LV2_Atom* msg) { if (msg->type != _uris.atom_Blank && msg->type != _uris.atom_Resource) { - _log.warn(Raul::fmt("Unknown message type <%1%>\n") + _log.warn(fmt("Unknown message type <%1%>\n") % _map.unmap_uri(msg->type)); return false; } @@ -189,7 +188,7 @@ AtomReader::write(const LV2_Atom* msg) if (tail_path && head_path) { _iface.connect(*tail_path, *head_path); } else { - _log.warn(Raul::fmt("Arc %1% => %2% has non-path tail or head\n") + _log.warn(fmt("Arc %1% => %2% has non-path tail or head\n") % atom_to_uri(tail) % atom_to_uri(head)); } } else { @@ -294,7 +293,7 @@ AtomReader::write(const LV2_Atom* msg) (Ingen::Status)((const LV2_Atom_Int*)body)->body, subject_uri ? subject_uri : ""); } else { - _log.warn(Raul::fmt("Unknown object type <%1%>\n") + _log.warn(fmt("Unknown object type <%1%>\n") % _map.unmap_uri(obj->body.otype)); } diff --git a/src/Configuration.cpp b/src/Configuration.cpp index a18e6d2c..ad4ab09a 100644 --- a/src/Configuration.cpp +++ b/src/Configuration.cpp @@ -24,7 +24,7 @@ #include #include "ingen/Configuration.hpp" -#include "raul/fmt.hpp" +#include "ingen/Log.hpp" #include "sord/sordmm.hpp" #include "sratom/sratom.h" @@ -121,7 +121,7 @@ Configuration::set_value_from_string(Configuration::Option& option, option.value = _forge.make(intval); } else { throw OptionError( - (Raul::fmt("option `%1%' has non-integer value `%2%'") + (fmt("option `%1%' has non-integer value `%2%'") % option.name % value).str()); } } else if (option.type == _forge.String) { @@ -132,7 +132,7 @@ Configuration::set_value_from_string(Configuration::Option& option, assert(option.value.type() == _forge.Bool); } else { throw OptionError( - (Raul::fmt("bad option type `%1%'") % option.name).str()); + (fmt("bad option type `%1%'") % option.name).str()); } return EXIT_SUCCESS; } @@ -149,14 +149,14 @@ Configuration::parse(int argc, char** argv) throw (Configuration::OptionError) Options::iterator o = _options.find(name); if (o == _options.end()) { throw OptionError( - (Raul::fmt("unrecognized option `%1%'") % name).str()); + (fmt("unrecognized option `%1%'") % name).str()); } if (o->second.type == _forge.Bool) { o->second.value = _forge.make(true); } else { if (++i >= argc) throw OptionError( - (Raul::fmt("missing value for `%1'") % name).str()); + (fmt("missing value for `%1'") % name).str()); set_value_from_string(o->second, argv[i]); } } else { @@ -166,12 +166,12 @@ Configuration::parse(int argc, char** argv) throw (Configuration::OptionError) ShortNames::iterator n = _short_names.find(letter); if (n == _short_names.end()) throw OptionError( - (Raul::fmt("unrecognized option `%1%'") % letter).str()); + (fmt("unrecognized option `%1%'") % letter).str()); Options::iterator o = _options.find(n->second); if (j < len - 1) { if (o->second.type != _forge.Bool) throw OptionError( - (Raul::fmt("missing value for `%1%'") % letter).str()); + (fmt("missing value for `%1%'") % letter).str()); o->second.value = _forge.make(true); } else { if (o->second.type == _forge.Bool) { @@ -179,7 +179,7 @@ Configuration::parse(int argc, char** argv) throw (Configuration::OptionError) } else { if (++i >= argc) throw OptionError( - (Raul::fmt("missing value for `%1%'") % letter).str()); + (fmt("missing value for `%1%'") % letter).str()); set_value_from_string(o->second, argv[i]); } } @@ -240,14 +240,14 @@ Configuration::save(URIMap& uri_map, // Create parent directories if necessary const std::string dir = Glib::path_get_dirname(path); if (g_mkdir_with_parents(dir.c_str(), 0755) < 0) { - throw FileError((Raul::fmt("Error creating directory %1% (%2%)") + throw FileError((fmt("Error creating directory %1% (%2%)") % dir % strerror(errno)).str()); } // Attempt to open file for writing FILE* file = fopen(path.c_str(), "w"); if (!file) { - throw FileError((Raul::fmt("Failed to open file %1% (%2%)") + throw FileError((fmt("Failed to open file %1% (%2%)") % path % strerror(errno)).str()); } diff --git a/src/URIMap.cpp b/src/URIMap.cpp index 3344b1d0..b5fe8712 100644 --- a/src/URIMap.cpp +++ b/src/URIMap.cpp @@ -55,7 +55,7 @@ LV2_URID URIMap::URIDMapFeature::map(const char* uri) { if (!Raul::URI::is_valid(uri)) { - log.error(Raul::fmt("Attempt to map invalid URI <%1%>\n") % uri); + log.error(fmt("Attempt to map invalid URI <%1%>\n") % uri); return 0; } return urid_map.map(urid_map.handle, uri); diff --git a/src/World.cpp b/src/World.cpp index 27e056b6..e12e9c63 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -83,11 +83,11 @@ ingen_load_module(Log& log, const string& name) if (*module) { return module; } else if (!module_path_found) { - log.error(Raul::fmt("Unable to find %1% (%2%)\n") + log.error(fmt("Unable to find %1% (%2%)\n") % name % Glib::Module::get_last_error()); return NULL; } else { - log.error(Raul::fmt("Unable to load %1% from %2% (%3%)\n") + log.error(fmt("Unable to load %1% from %2% (%3%)\n") % name % module_path % Glib::Module::get_last_error()); return NULL; } @@ -114,7 +114,7 @@ public: // Parse default configuration files std::list files = conf.load_default("ingen", "options.ttl"); for (const auto& f : files) { - log.info(Raul::fmt("Loaded configuration %1%\n") % f); + log.info(fmt("Loaded configuration %1%\n") % f); } // Parse command line options, overriding configuration file values @@ -271,7 +271,7 @@ World::load_module(const char* name) } } - log().error(Raul::fmt("Failed to load module `%1%'\n") % name); + log().error(fmt("Failed to load module `%1%'\n") % name); delete lib; return false; } @@ -281,7 +281,7 @@ World::run_module(const char* name) { Impl::Modules::iterator i = _impl->modules.find(name); if (i == _impl->modules.end()) { - log().error(Raul::fmt("Attempt to run unloaded module `%1%'\n") % name); + log().error(fmt("Attempt to run unloaded module `%1%'\n") % name); return false; } @@ -297,7 +297,7 @@ World::new_interface(const Raul::URI& engine_uri, { const Impl::InterfaceFactories::const_iterator i = _impl->interface_factories.find(engine_uri.scheme()); if (i == _impl->interface_factories.end()) { - log().warn(Raul::fmt("Unknown URI scheme `%1%'\n") % engine_uri.scheme()); + log().warn(fmt("Unknown URI scheme `%1%'\n") % engine_uri.scheme()); return SPtr(); } @@ -310,7 +310,7 @@ World::run(const std::string& mime_type, const std::string& filename) { const Impl::ScriptRunners::const_iterator i = _impl->script_runners.find(mime_type); if (i == _impl->script_runners.end()) { - log().warn(Raul::fmt("Unknown script MIME type `%1%'\n") % mime_type); + log().warn(fmt("Unknown script MIME type `%1%'\n") % mime_type); return false; } diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index b7b38df3..aabe41b0 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -243,7 +243,7 @@ ClientStore::put(const Raul::URI& uri, } if (!Node::uri_is_path(uri)) { - _log.error(Raul::fmt("Put for unknown subject <%1%>\n") + _log.error(fmt("Put for unknown subject <%1%>\n") % uri.c_str()); return; } @@ -281,7 +281,7 @@ ClientStore::put(const Raul::URI& uri, bm->set_properties(properties); add_object(bm); } else { - _log.warn(Raul::fmt("Block %1% has no plugin\n") + _log.warn(fmt("Block %1% has no plugin\n") % path.c_str()); } } else if (is_port) { @@ -296,10 +296,10 @@ ClientStore::put(const Raul::URI& uri, p->set_properties(properties); add_object(p); } else { - _log.error(Raul::fmt("Port %1% has no index\n") % path); + _log.error(fmt("Port %1% has no index\n") % path); } } else { - _log.warn(Raul::fmt("Ignoring object %1% with unknown type\n") + _log.warn(fmt("Ignoring object %1% with unknown type\n") % path.c_str()); } } @@ -329,7 +329,7 @@ ClientStore::delta(const Raul::URI& uri, } if (!Node::uri_is_path(uri)) { - _log.error(Raul::fmt("Delta for unknown subject <%1%>\n") + _log.error(fmt("Delta for unknown subject <%1%>\n") % uri.c_str()); return; } @@ -341,7 +341,7 @@ ClientStore::delta(const Raul::URI& uri, obj->remove_properties(remove); obj->add_properties(add); } else { - _log.warn(Raul::fmt("Failed to find object `%1%'\n") + _log.warn(fmt("Failed to find object `%1%'\n") % path.c_str()); } } @@ -352,7 +352,7 @@ ClientStore::set_property(const Raul::URI& subject_uri, const Atom& value) { if (subject_uri == _uris.ingen_engine) { - _log.info(Raul::fmt("Engine property <%1%> = %2%\n") + _log.info(fmt("Engine property <%1%> = %2%\n") % predicate.c_str() % _uris.forge.str(value)); return; } @@ -370,7 +370,7 @@ ClientStore::set_property(const Raul::URI& subject_uri, if (plugin) { plugin->set_property(predicate, value); } else if (predicate != _uris.ingen_activity) { - _log.warn(Raul::fmt("Property <%1%> for unknown object %2%\n") + _log.warn(fmt("Property <%1%> for unknown object %2%\n") % predicate.c_str() % subject_uri.c_str()); } } @@ -395,7 +395,7 @@ ClientStore::connection_graph(const Raul::Path& tail_path, graph = dynamic_ptr_cast(_object(tail_path.parent().parent())); if (!graph) - _log.error(Raul::fmt("Unable to find graph for arc %1% => %2%\n") + _log.error(fmt("Unable to find graph for arc %1% => %2%\n") % tail_path % head_path); return graph; @@ -418,7 +418,7 @@ ClientStore::attempt_connection(const Raul::Path& tail_path, graph->add_arc(arc); return true; } else { - _log.warn(Raul::fmt("Failed to connect %1% => %2%\n") + _log.warn(fmt("Failed to connect %1% => %2%\n") % tail_path % head_path); return false; } @@ -457,7 +457,7 @@ ClientStore::disconnect_all(const Raul::Path& parent_graph, SPtr object = _object(path); if (!graph || !object) { - _log.error(Raul::fmt("Bad disconnect all notification %1% in %2%\n") + _log.error(fmt("Bad disconnect all notification %1% in %2%\n") % path % parent_graph); return; } diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index 2bee4249..b9212174 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -42,7 +42,7 @@ lv2_ui_write(SuilController controller, const BlockModel::Ports& ports = ui->block()->ports(); if (port_index >= ports.size()) { ui->world()->log().error( - Raul::fmt("%1% UI tried to write to invalid port %2%\n") + fmt("%1% UI tried to write to invalid port %2%\n") % ui->block()->plugin()->uri().c_str() % port_index); return; } @@ -55,7 +55,7 @@ lv2_ui_write(SuilController controller, if (format == 0) { if (buffer_size != 4) { ui->world()->log().error( - Raul::fmt("%1% UI wrote corrupt float with bad size\n") + fmt("%1% UI wrote corrupt float with bad size\n") % ui->block()->plugin()->uri().c_str()); return; } @@ -79,7 +79,7 @@ lv2_ui_write(SuilController controller, } else { ui->world()->log().warn( - Raul::fmt("Unknown value format %1% from LV2 UI\n") + fmt("Unknown value format %1% from LV2 UI\n") % format % ui->block()->plugin()->uri().c_str()); } } diff --git a/src/gui/App.cpp b/src/gui/App.cpp index e64465ea..5a04ebf6 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -241,7 +241,7 @@ App::property_change(const Raul::URI& subject, { if (subject == uris().ingen_engine && key == uris().ingen_sampleRate) { if (value.type() == forge().Int) { - log().info(Raul::fmt("Sample rate: %1%\n") % uris().forge.str(value)); + log().info(fmt("Sample rate: %1%\n") % uris().forge.str(value)); _sample_rate = value.get(); } else { log().error("Engine sample rate property is not an integer\n"); @@ -354,9 +354,9 @@ App::quit(Gtk::Window* dialog_parent) try { const std::string path = _world->conf().save( _world->uri_map(), "ingen", "gui.ttl", Configuration::GUI); - cout << (Raul::fmt("Saved GUI settings to %1%\n") % path); + cout << (fmt("Saved GUI settings to %1%\n") % path); } catch (const std::exception& e) { - cerr << (Raul::fmt("Error saving GUI settings (%1%)\n") + cerr << (fmt("Error saving GUI settings (%1%)\n") % e.what()); } @@ -395,7 +395,7 @@ App::icon_from_path(const string& path, int size) new IconDestroyNotification(*this, make_pair(path, size)), &App::icon_destroyed); } catch (const Glib::Error& e) { - log().warn(Raul::fmt("Error loading icon %1%: %2%\n") + log().warn(fmt("Error loading icon %1%: %2%\n") % path % e.what()); } return buf; diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index d1f76ea4..68756a4b 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -23,10 +23,9 @@ #include #include -#include "raul/fmt.hpp" - -#include "ingen/Interface.hpp" #include "ingen/Configuration.hpp" +#include "ingen/Interface.hpp" +#include "ingen/Log.hpp" #include "ingen/client/ClientStore.hpp" #include "ingen/client/GraphModel.hpp" @@ -183,7 +182,7 @@ GraphBox::init_box(App& app) _status_bar->push("Running internal engine", STATUS_CONTEXT_ENGINE); } else { _status_bar->push( - (Raul::fmt("Connected to %1%") % engine_uri).str(), + (fmt("Connected to %1%") % engine_uri).str(), STATUS_CONTEXT_ENGINE); } diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index 6c391d23..591c6fc9 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -240,7 +240,7 @@ GraphCanvas::build_plugin_class_menu( const char* sub_label_str = lilv_node_as_string(lilv_plugin_class_get_label(c)); const char* sub_uri_str = lilv_node_as_string(lilv_plugin_class_get_uri(c)); if (ancestors.find(sub_uri_str) != ancestors.end()) { - _app.log().warn(Raul::fmt("Infinite LV2 class recursion: %1% <: %2%\n") + _app.log().warn(fmt("Infinite LV2 class recursion: %1% <: %2%\n") % class_uri_str % sub_uri_str); return 0; } @@ -501,7 +501,7 @@ GraphCanvas::connection(SPtr arc) if (tail && head) { new GUI::Arc(*this, arc, tail, head, tail->get_fill_color()); } else { - _app.log().error(Raul::fmt("Unable to find ports to connect %1% => %2%\n") + _app.log().error(fmt("Unable to find ports to connect %1% => %2%\n") % arc->tail_path() % arc->head_path()); } } @@ -515,7 +515,7 @@ GraphCanvas::disconnection(SPtr arc) if (src && dst) { remove_edge(src, dst); } else { - _app.log().error(Raul::fmt("Unable to find ports to disconnect %1% => %2%\n") + _app.log().error(fmt("Unable to find ports to disconnect %1% => %2%\n") % arc->tail_path() % arc->head_path()); } } diff --git a/src/gui/GraphTreeWindow.cpp b/src/gui/GraphTreeWindow.cpp index 249e3e73..7ebb405d 100644 --- a/src/gui/GraphTreeWindow.cpp +++ b/src/gui/GraphTreeWindow.cpp @@ -204,7 +204,7 @@ GraphTreeWindow::graph_property_changed(const Raul::URI& key, Gtk::TreeModel::Row row = *i; row[_graph_tree_columns.enabled_col] = value.get(); } else { - _app->log().error(Raul::fmt("Unable to find graph %1%\n") + _app->log().error(fmt("Unable to find graph %1%\n") % graph->path()); } } @@ -223,7 +223,7 @@ GraphTreeWindow::graph_moved(SPtr graph) Gtk::TreeModel::Row row = *i; row[_graph_tree_columns.name_col] = graph->symbol().c_str(); } else { - _app->log().error(Raul::fmt("Unable to find graph %1%\n") + _app->log().error(fmt("Unable to find graph %1%\n") % graph->path()); } diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp index 43cf266f..cf245edb 100644 --- a/src/gui/NodeMenu.cpp +++ b/src/gui/NodeMenu.cpp @@ -110,7 +110,7 @@ NodeMenu::init(App& app, SPtr block) lilv_nodes_free(labels); } else { app.log().error( - Raul::fmt("Preset <%1> has no rdfs:label\n") + fmt("Preset <%1> has no rdfs:label\n") % lilv_node_as_string(lilv_nodes_get(presets, i))); } } diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 54b30227..9bbd48c2 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -280,7 +280,7 @@ NodeModule::delete_port_view(SPtr model) if (p) { delete p; } else { - app().log().warn(Raul::fmt("Failed to find port %1% on module %2%\n") + app().log().warn(fmt("Failed to find port %1% on module %2%\n") % model->path() % _block->path()); } } @@ -319,7 +319,7 @@ NodeModule::popup_gui() return true; } else { - app().log().warn(Raul::fmt("No LV2 GUI for %1%\n") % _block->path()); + app().log().warn(fmt("No LV2 GUI for %1%\n") % _block->path()); } } diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp index 2e3ef35d..2177de8c 100644 --- a/src/gui/PropertiesWindow.cpp +++ b/src/gui/PropertiesWindow.cpp @@ -268,7 +268,7 @@ PropertiesWindow::create_value_widget(const Raul::URI& uri, const Atom& value) return widget; } - _app->log().error(Raul::fmt("Unable to create widget for value %1% type %2%\n") + _app->log().error(fmt("Unable to create widget for value %1% type %2%\n") % forge.str(value) % value.type()); return NULL; } @@ -327,7 +327,7 @@ PropertiesWindow::value_edited(const Raul::URI& predicate) { Records::iterator r = _records.find(predicate); if (r == _records.end()) { - _app->log().error(Raul::fmt("Unknown property `%1%' edited\n") + _app->log().error(fmt("Unknown property `%1%' edited\n") % predicate); return; } @@ -360,7 +360,7 @@ PropertiesWindow::value_edited(const Raul::URI& predicate) return; bad_type: - _app->log().error(Raul::fmt("Property `%1%' value widget has wrong type\n") + _app->log().error(fmt("Property `%1%' value widget has wrong type\n") % predicate); return; } diff --git a/src/gui/Style.cpp b/src/gui/Style.cpp index 3c004a20..1c61d995 100644 --- a/src/gui/Style.cpp +++ b/src/gui/Style.cpp @@ -98,7 +98,7 @@ Style::get_port_color(const Client::PortModel* p) return _event_port_color; } - _app.log().warn(Raul::fmt("No known port type for %1%\n") % p->path()); + _app.log().warn(fmt("No known port type for %1%\n") % p->path()); return 0x666666FF; } diff --git a/src/gui/WidgetFactory.cpp b/src/gui/WidgetFactory.cpp index 642e3cea..8e7a5ab7 100644 --- a/src/gui/WidgetFactory.cpp +++ b/src/gui/WidgetFactory.cpp @@ -17,7 +17,7 @@ #include #include -#include "raul/fmt.hpp" +#include "ingen/Log.hpp" #include "ingen/runtime_paths.hpp" #include "WidgetFactory.hpp" @@ -58,7 +58,7 @@ WidgetFactory::find_ui_file() if (is_readable(ui_filename)) return; - throw std::runtime_error((Raul::fmt("Unable to find ingen_gui.ui in %1%\n") + throw std::runtime_error((fmt("Unable to find ingen_gui.ui in %1%\n") % INGEN_DATA_DIR).str()); } diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp index fc779488..86f38119 100644 --- a/src/ingen/main.cpp +++ b/src/ingen/main.cpp @@ -24,13 +24,13 @@ #include #include "raul/Path.hpp" -#include "raul/fmt.hpp" #include "ingen_config.h" #include "ingen/Configuration.hpp" #include "ingen/EngineBase.hpp" #include "ingen/Interface.hpp" +#include "ingen/Log.hpp" #include "ingen/World.hpp" #include "ingen/client/ThreadedSigClientInterface.hpp" #include "ingen/runtime_paths.hpp" @@ -122,11 +122,11 @@ main(int argc, char** argv) #endif const char* const uri = conf.option("connect").ptr(); ingen_try(Raul::URI::is_valid(uri), - (Raul::fmt("Invalid URI <%1%>") % uri).str().c_str()); + (fmt("Invalid URI <%1%>") % uri).str().c_str()); SPtr client(new Client::ThreadedSigClientInterface(1024)); engine_interface = world->new_interface(Raul::URI(uri), client); ingen_try(bool(engine_interface), - (Raul::fmt("Unable to create interface to `%1%'") % uri).str().c_str()); + (fmt("Unable to create interface to `%1%'") % uri).str().c_str()); } world->set_interface(engine_interface); diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp index adc3f208..c0f8cf3a 100644 --- a/src/serialisation/Parser.cpp +++ b/src/serialisation/Parser.cpp @@ -152,7 +152,7 @@ get_port(Ingen::World* world, if (i == props.end() || i->second.type() != world->forge().Int || i->second.get() < 0) { - world->log().warn(Raul::fmt("Port %1% has no valid index\n") % subject); + world->log().warn(fmt("Port %1% has no valid index\n") % subject); return boost::optional(); } index = i->second.get(); @@ -160,7 +160,7 @@ get_port(Ingen::World* world, // Get symbol Resource::Properties::const_iterator s = props.find(uris.lv2_symbol); if (s == props.end()) { - world->log().warn(Raul::fmt("Port %1% has no symbol\n") % subject); + world->log().warn(fmt("Port %1% has no symbol\n") % subject); return boost::optional(); } const Raul::Symbol port_sym(s->second.ptr()); @@ -235,7 +235,7 @@ parse_block(Ingen::World* world, std::cerr << "type: " << i.get_object().type() << std::endl; } world->log().error( - Raul::fmt("Block %1% (%2%) missing mandatory ingen:prototype\n") % + fmt("Block %1% (%2%) missing mandatory ingen:prototype\n") % subject.to_string() % path); return boost::optional(); } @@ -316,7 +316,7 @@ parse_graph(Ingen::World* world, graph_path_str = parent->child(*a_symbol); if (!Raul::Path::is_valid(graph_path_str)) { - world->log().error(Raul::fmt("Graph %1% has invalid path\n") + world->log().error(fmt("Graph %1% has invalid path\n") % graph_path_str); return boost::optional(); } @@ -345,7 +345,7 @@ parse_graph(Ingen::World* world, boost::optional port_record = get_port( world, model, port, block_path, index); if (!port_record) { - world->log().error(Raul::fmt("Invalid port %1%\n") % port); + world->log().error(fmt("Invalid port %1%\n") % port); return boost::optional(); } @@ -366,7 +366,7 @@ parse_graph(Ingen::World* world, boost::optional port_record = get_port( world, model, port, graph_path, index); if (!port_record) { - world->log().error(Raul::fmt("Invalid port %1%\n") % port); + world->log().error(fmt("Invalid port %1%\n") % port); return boost::optional(); } @@ -578,7 +578,7 @@ Parser::parse_file(Ingen::World* world, try { uri = Glib::filename_to_uri(path, ""); } catch (const Glib::ConvertError& e) { - world->log().error(Raul::fmt("Path to URI conversion error: %1%\n") + world->log().error(fmt("Path to URI conversion error: %1%\n") % e.what()); return false; } @@ -593,11 +593,11 @@ Parser::parse_file(Ingen::World* world, serd_env_free(env); - world->log().info(Raul::fmt("Parsing %1%\n") % path); + world->log().info(fmt("Parsing %1%\n") % path); if (parent) - world->log().info(Raul::fmt("Parent: %1%\n") % parent->c_str()); + world->log().info(fmt("Parent: %1%\n") % parent->c_str()); if (symbol) - world->log().info(Raul::fmt("Symbol: %1%\n") % symbol->c_str()); + world->log().info(fmt("Symbol: %1%\n") % symbol->c_str()); Sord::Node subject(*world->rdf_world(), Sord::Node::URI, uri); boost::optional parsed_path @@ -631,7 +631,7 @@ Parser::parse_string(Ingen::World* world, model.load_string(env, SERD_TURTLE, str.c_str(), str.length(), base_uri); serd_env_free(env); - world->log().info(Raul::fmt("Parsing string (base %1%)\n") % base_uri); + world->log().info(fmt("Parsing string (base %1%)\n") % base_uri); Sord::Node subject; return parse(world, target, model, base_uri, subject, parent, symbol, data); diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index db4d8430..45d95050 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -157,7 +157,7 @@ Serialiser::Impl::write_manifest(const std::string& bundle_path, std::string lib(Glib::Module::build_path(INGEN_BUNDLE_DIR, "ingen_lv2")); std::string link(Glib::Module::build_path(bundle_path, "ingen_lv2")); if (symlink(lib.c_str(), link.c_str())) { - _world.log().error(Raul::fmt("Error creating link %1% => %2% (%3%\n") + _world.log().error(fmt("Error creating link %1% => %2% (%3%\n") % lib % link % strerror(errno)); } @@ -260,7 +260,7 @@ Serialiser::Impl::finish() if (_mode == Mode::TO_FILE) { SerdStatus st = _model->write_to_file(_base_uri, SERD_TURTLE); if (st) { - _world.log().error(Raul::fmt("Error writing file %1% (%2%)\n") + _world.log().error(fmt("Error writing file %1% (%2%)\n") % _base_uri % serd_strerror(st)); } } else { diff --git a/src/server/BlockFactory.cpp b/src/server/BlockFactory.cpp index a174c270..56fefd3f 100644 --- a/src/server/BlockFactory.cpp +++ b/src/server/BlockFactory.cpp @@ -142,7 +142,7 @@ BlockFactory::load_lv2_plugins() if (!_world->lv2_features().is_supported(feature)) { supported = false; _world->log().warn( - Raul::fmt("Ignoring <%1%>; required feature <%2%>\n") + fmt("Ignoring <%1%>; required feature <%2%>\n") % uri % feature); break; } @@ -154,7 +154,7 @@ BlockFactory::load_lv2_plugins() // Ignore plugins that are missing ports if (!lilv_plugin_get_port_by_index(lv2_plug, 0)) { _world->log().warn( - Raul::fmt("Ignoring <%1%>; missing or corrupt ports\n") % uri); + fmt("Ignoring <%1%>; missing or corrupt ports\n") % uri); continue; } @@ -170,7 +170,7 @@ BlockFactory::load_lv2_plugins() } if (!supported) { _world->log().warn( - Raul::fmt("Ignoring <%1%>; unsupported port <%2%>\n") + fmt("Ignoring <%1%>; unsupported port <%2%>\n") % uri % lilv_node_as_string( lilv_port_get_symbol(lv2_plug, port))); break; diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp index 60e5c4e0..5a633afc 100644 --- a/src/server/ControlBindings.cpp +++ b/src/server/ControlBindings.cpp @@ -97,7 +97,7 @@ ControlBindings::binding_key(const Atom& binding) const } } } else if (binding.type()) { - _engine.log().error(Raul::fmt("Unknown binding type %1%\n") % binding.type()); + _engine.log().error(fmt("Unknown binding type %1%\n") % binding.type()); } return key; } diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index ce253b75..2e7a942a 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -340,14 +340,14 @@ Engine::process_events() void Engine::register_client(const Raul::URI& uri, SPtr client) { - log().info(Raul::fmt("Registering client <%1%>\n") % uri.c_str()); + log().info(fmt("Registering client <%1%>\n") % uri.c_str()); _broadcaster->register_client(uri, client); } bool Engine::unregister_client(const Raul::URI& uri) { - log().info(Raul::fmt("Unregistering client <%1%>\n") % uri.c_str()); + log().info(fmt("Unregistering client <%1%>\n") % uri.c_str()); return _broadcaster->unregister_client(uri); } diff --git a/src/server/GraphImpl.cpp b/src/server/GraphImpl.cpp index 8621106f..f25dcc81 100644 --- a/src/server/GraphImpl.cpp +++ b/src/server/GraphImpl.cpp @@ -240,7 +240,7 @@ GraphImpl::create_port(BufferFactory& bufs, bool polyphonic) { if (type == PortType::UNKNOWN) { - bufs.engine().log().error(Raul::fmt("Unknown port type %1%\n") + bufs.engine().log().error(fmt("Unknown port type %1%\n") % type.uri()); return NULL; } @@ -333,7 +333,7 @@ GraphImpl::compile() } if (compiled_graph->size() != _blocks.size()) { - _engine.log().error(Raul::fmt("Failed to compile graph %1%\n") % _path); + _engine.log().error(fmt("Failed to compile graph %1%\n") % _path); delete compiled_graph; return NULL; } diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index 6a7d7ae9..ad68b64d 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -92,7 +92,7 @@ JackDriver::attach(const std::string& server_name, _client = jack_client_open(client_name.c_str(), JackSessionID, NULL, uuid.c_str()); - _engine.log().info(Raul::fmt("Connected to JACK as `%1%' (UUID `%2%')\n") + _engine.log().info(fmt("Connected to JACK as `%1%' (UUID `%2%')\n") % client_name.c_str() % uuid); } #endif @@ -102,7 +102,7 @@ JackDriver::attach(const std::string& server_name, if ((_client = jack_client_open(client_name.c_str(), JackServerName, NULL, server_name.c_str()))) { - _engine.log().info(Raul::fmt("Connected to JACK server `%1%'\n") + _engine.log().info(fmt("Connected to JACK server `%1%'\n") % server_name); } } @@ -163,7 +163,7 @@ JackDriver::activate() _engine.log().error("Could not activate Jack client, aborting\n"); exit(EXIT_FAILURE); } else { - _engine.log().info(Raul::fmt("Activated Jack client `%1%'\n") % + _engine.log().info(fmt("Activated Jack client `%1%'\n") % world->conf().option("jack-name").ptr()); } } @@ -467,7 +467,7 @@ JackDriver::_block_length_cb(jack_nframes_t nframes) void JackDriver::_session_cb(jack_session_event_t* event) { - _engine.log().info(Raul::fmt("Jack session save to %1%\n") % event->session_dir); + _engine.log().info(fmt("Jack session save to %1%\n") % event->session_dir); const string cmd = (boost::format("ingen -eg -n %1% -u %2% -l ${SESSION_DIR}") % jack_get_client_name(_client) diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp index 66ac0d70..797cc81f 100644 --- a/src/server/LV2Block.cpp +++ b/src/server/LV2Block.cpp @@ -80,7 +80,7 @@ LV2Block::make_instance(URIs& uris, if (!inst) { parent_graph()->engine().log().error( - Raul::fmt("Failed to instantiate <%1%>\n") + fmt("Failed to instantiate <%1%>\n") % _lv2_plugin->uri().c_str()); return SPtr(); } @@ -132,13 +132,13 @@ LV2Block::make_instance(URIs& uris, port->set_type(PortType::CV, 0); } else { parent_graph()->engine().log().error( - Raul::fmt("%1% auto-morphed to unknown type %2%\n") + fmt("%1% auto-morphed to unknown type %2%\n") % port->path().c_str() % type); return SPtr(); } } else { parent_graph()->engine().log().error( - Raul::fmt("Failed to get auto-morphed type of %1%\n") + fmt("Failed to get auto-morphed type of %1%\n") % port->path().c_str()); } } @@ -284,7 +284,7 @@ LV2Block::instantiate(BufferFactory& bufs) uint32_t port_buffer_size = bufs.default_size(buffer_type); if (port_buffer_size == 0) { parent_graph()->engine().log().error( - Raul::fmt("<%1%> port `%2%' has unknown buffer type\n") + fmt("<%1%> port `%2%' has unknown buffer type\n") % _lv2_plugin->uri().c_str() % port_sym.c_str()); ret = false; break; @@ -333,7 +333,7 @@ LV2Block::instantiate(BufferFactory& bufs) if (port_type == PortType::UNKNOWN || direction == UNKNOWN) { parent_graph()->engine().log().error( - Raul::fmt("<%1%> port `%2%' has unknown type or direction\n") + fmt("<%1%> port `%2%' has unknown type or direction\n") % _lv2_plugin->uri().c_str() % port_sym.c_str()); ret = false; break; @@ -455,7 +455,7 @@ LV2Block::work(uint32_t size, const void* data) LV2_Handle inst = lilv_instance_get_handle(instance(0)); if (_worker_iface->work(inst, work_respond, this, size, data)) { parent_graph()->engine().log().error( - Raul::fmt("Error calling %1% work method\n") % _path); + fmt("Error calling %1% work method\n") % _path); } } } diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index 29d6d8c6..0f3c2092 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -505,7 +505,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor, } if (!graph) { - const std::string msg((Raul::fmt("Could not find graph %1%\n") + const std::string msg((fmt("Could not find graph %1%\n") % descriptor->URI).str()); if (log) { log->vprintf(log->handle, @@ -551,7 +551,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor, } plugin->world->log().info( - Raul::fmt("Block: %1% frames, Sequence: %2% bytes\n") + fmt("Block: %1% frames, Sequence: %2% bytes\n") % block_length % seq_size); plugin->world->conf().set( "queue-size", @@ -609,8 +609,7 @@ ingen_connect_port(LV2_Handle instance, uint32_t port, void* data) if (port < driver->ports().size()) { driver->ports().at(port)->set_buffer(data); } else { - engine->log().error(Raul::fmt("Connect to non-existent port %1%\n") - % port); + engine->log().error(fmt("Connect to non-existent port %1%\n") % port); } } diff --git a/src/socket/SocketReader.cpp b/src/socket/SocketReader.cpp index d3e6affc..458032c5 100644 --- a/src/socket/SocketReader.cpp +++ b/src/socket/SocketReader.cpp @@ -94,7 +94,7 @@ SocketReader::run() // Open socket as a FILE for reading directly with serd FILE* f = fdopen(_socket->fd(), "r"); if (!f) { - _world.log().error(Raul::fmt("Failed to open connection (%1%)\n") + _world.log().error(fmt("Failed to open connection (%1%)\n") % strerror(errno)); // Connection gone, exit _socket.reset(); @@ -159,7 +159,7 @@ SocketReader::run() if (st == SERD_FAILURE || !_msg_node) { continue; // Read nothing, e.g. just whitespace } else if (st) { - _world.log().error(Raul::fmt("Read error: %1%\n") + _world.log().error(fmt("Read error: %1%\n") % serd_strerror(st)); continue; } diff --git a/src/socket/ingen_socket_client.cpp b/src/socket/ingen_socket_client.cpp index a6b2f63b..4dd8a491 100644 --- a/src/socket/ingen_socket_client.cpp +++ b/src/socket/ingen_socket_client.cpp @@ -33,7 +33,7 @@ new_socket_interface(Ingen::World* world, { SPtr sock(new Socket(Socket::type_from_uri(uri))); if (!sock->connect(uri)) { - world->log().error(Raul::fmt("Failed to connect <%1%> (%2%)\n") + world->log().error(fmt("Failed to connect <%1%> (%2%)\n") % sock->uri() % strerror(errno)); return SPtr(); } diff --git a/src/socket/ingen_socket_server.cpp b/src/socket/ingen_socket_server.cpp index 0a9d7494..e4f14249 100644 --- a/src/socket/ingen_socket_server.cpp +++ b/src/socket/ingen_socket_server.cpp @@ -49,7 +49,7 @@ ingen_listen(Ingen::World* world, Socket* unix_sock, Socket* net_sock) world->log().error("Failed to create UNIX socket\n"); unix_sock->close(); } - world->log().info(Raul::fmt("Listening on socket %1%\n") % unix_uri); + world->log().info(fmt("Listening on socket %1%\n") % unix_uri); // Bind TCP socket const int port = world->conf().option("engine-port").get(); @@ -60,7 +60,7 @@ ingen_listen(Ingen::World* world, Socket* unix_sock, Socket* net_sock) world->log().error("Failed to create TCP socket\n"); net_sock->close(); } - world->log().info(Raul::fmt("Listening on TCP port %1%\n") % port); + world->log().info(fmt("Listening on TCP port %1%\n") % port); struct pollfd pfds[2]; int nfds = 0; @@ -81,7 +81,7 @@ ingen_listen(Ingen::World* world, Socket* unix_sock, Socket* net_sock) // Wait for input to arrive at a socket const int ret = poll(pfds, nfds, -1); if (ret == -1) { - world->log().error(Raul::fmt("Poll error: %1%\n") % strerror(errno)); + world->log().error(fmt("Poll error: %1%\n") % strerror(errno)); break; } else if ((pfds[0].revents & POLLHUP) || pfds[1].revents & POLLHUP) { break; diff --git a/tests/ingen_test.cpp b/tests/ingen_test.cpp index 27508a7a..6b46b30f 100644 --- a/tests/ingen_test.cpp +++ b/tests/ingen_test.cpp @@ -106,14 +106,14 @@ public: void response(int32_t id, Status status, const std::string& subject) { if (status != Status::SUCCESS) { - _log.error(Raul::fmt("error on message %1%: %2% (%3%)\n") + _log.error(fmt("error on message %1%: %2% (%3%)\n") % id % ingen_status_string(status) % subject); exit(EXIT_FAILURE); } } void error(const std::string& msg) { - _log.error(Raul::fmt("error: %1%\n") % msg); + _log.error(fmt("error: %1%\n") % msg); exit(EXIT_FAILURE); } @@ -215,7 +215,7 @@ main(int argc, char** argv) cmds->load_file(env, SERD_TURTLE, cmds_file_path); Sord::Node nil; for (int i = 0; ; ++i) { - std::string subject_str = (Raul::fmt("msg%1%") % i).str(); + std::string subject_str = (fmt("msg%1%") % i).str(); Sord::URI subject(*world->rdf_world(), subject_str, (const char*)cmds_file_uri.buf); Sord::Iter iter = cmds->find(subject, nil, nil); -- cgit v1.2.1