summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ingen/Log.hpp38
-rw-r--r--ingen/client/SocketClient.hpp4
-rw-r--r--ingen/fmt.hpp38
-rw-r--r--src/AtomReader.cpp13
-rw-r--r--src/Configuration.cpp32
-rw-r--r--src/Parser.cpp28
-rw-r--r--src/Serialiser.cpp6
-rw-r--r--src/SocketReader.cpp7
-rw-r--r--src/URIMap.cpp2
-rw-r--r--src/World.cpp21
-rw-r--r--src/client/ClientStore.cpp43
-rw-r--r--src/client/PluginUI.cpp28
-rw-r--r--src/gui/App.cpp22
-rw-r--r--src/gui/ConnectWindow.cpp2
-rw-r--r--src/gui/GraphBox.cpp36
-rw-r--r--src/gui/GraphCanvas.cpp8
-rw-r--r--src/gui/GraphTreeWindow.cpp6
-rw-r--r--src/gui/NodeModule.cpp6
-rw-r--r--src/gui/PluginMenu.cpp4
-rw-r--r--src/gui/PropertiesWindow.cpp6
-rw-r--r--src/gui/RDFS.cpp2
-rw-r--r--src/gui/WidgetFactory.cpp4
-rw-r--r--src/ingen/ingen.cpp6
-rw-r--r--src/server/BlockFactory.cpp19
-rw-r--r--src/server/CompiledGraph.cpp7
-rw-r--r--src/server/Engine.cpp4
-rw-r--r--src/server/JackDriver.cpp20
-rw-r--r--src/server/LV2Block.cpp23
-rw-r--r--src/server/LV2Plugin.cpp4
-rw-r--r--src/server/RunContext.cpp4
-rw-r--r--src/server/SocketListener.cpp21
-rw-r--r--src/server/events/Delta.cpp4
-rw-r--r--src/server/ingen_lv2.cpp4
-rw-r--r--tests/TestClient.hpp10
-rw-r--r--tests/ingen_test.cpp2
-rw-r--r--tests/test_utils.hpp18
36 files changed, 271 insertions, 231 deletions
diff --git a/ingen/Log.hpp b/ingen/Log.hpp
index 4d1bd1ee..000afcbe 100644
--- a/ingen/Log.hpp
+++ b/ingen/Log.hpp
@@ -25,14 +25,18 @@
#include <boost/format.hpp>
#include "ingen/LV2Features.hpp"
+#include "ingen/fmt.hpp"
#include "ingen/ingen.h"
#include "lv2/core/lv2.h"
#include "lv2/log/log.h"
#include "lv2/urid/urid.h"
-namespace ingen {
+#include <cstdarg>
+#include <cstdio>
+#include <functional>
+#include <string>
-typedef boost::basic_format<char> fmt;
+namespace ingen {
class Node;
class URIs;
@@ -63,11 +67,31 @@ public:
void warn(const std::string& msg);
void trace(const std::string& msg);
- 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()); }
-
- int vtprintf(LV2_URID type, const char* fmt, va_list args);
+ template <typename... Args>
+ void error(const char* format, Args&&... args)
+ {
+ error(fmt(format, std::forward<Args>(args)...));
+ }
+
+ template <typename... Args>
+ void info(const char* format, Args&&... args)
+ {
+ info(fmt(format, std::forward<Args>(args)...));
+ }
+
+ template <typename... Args>
+ void warn(const char* format, Args&&... args)
+ {
+ warn(fmt(format, std::forward<Args>(args)...));
+ }
+
+ template <typename... Args>
+ void trace(const char* format, Args&&... args)
+ {
+ trace(fmt(format, std::forward<Args>(args)...));
+ }
+
+ int vtprintf(LV2_URID type, const char* format, va_list args);
void set_flush(bool f) { _flush = f; }
void set_trace(bool f) { _trace = f; }
diff --git a/ingen/client/SocketClient.hpp b/ingen/client/SocketClient.hpp
index bce5ab38..092ef9d2 100644
--- a/ingen/client/SocketClient.hpp
+++ b/ingen/client/SocketClient.hpp
@@ -57,8 +57,8 @@ public:
SPtr<Raul::Socket> sock(new Raul::Socket(type));
if (!sock->connect(uri)) {
- world.log().error(fmt("Failed to connect <%1%> (%2%)\n")
- % sock->uri() % strerror(errno));
+ world.log().error("Failed to connect <%1%> (%2%)\n",
+ sock->uri(), strerror(errno));
return SPtr<Interface>();
}
return SPtr<Interface>(new SocketClient(world, uri, sock, respondee));
diff --git a/ingen/fmt.hpp b/ingen/fmt.hpp
new file mode 100644
index 00000000..3c792d3d
--- /dev/null
+++ b/ingen/fmt.hpp
@@ -0,0 +1,38 @@
+/*
+ This file is part of Ingen.
+ Copyright 2007-2016 David Robillard <http://drobilla.net/>
+
+ Ingen is free software: you can redistribute it and/or modify it under the
+ terms of the GNU Affero General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or any later version.
+
+ Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU Affero General Public License for details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with Ingen. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef INGEN_FMT_HPP
+#define INGEN_FMT_HPP
+
+#include <boost/format.hpp>
+
+#include <initializer_list>
+#include <string>
+
+namespace ingen {
+template <typename... Args>
+std::string
+fmt(const char* fmt, Args&&... args)
+{
+ boost::format f(fmt);
+ std::initializer_list<char> l{(static_cast<void>(f % args), char{})...};
+ (void)l;
+ return boost::str(f);
+}
+
+} // namespace ingen
+
+#endif // INGEN_FMT_HPP
diff --git a/src/AtomReader.cpp b/src/AtomReader.cpp
index cc47498f..71d88a84 100644
--- a/src/AtomReader.cpp
+++ b/src/AtomReader.cpp
@@ -45,7 +45,7 @@ AtomReader::get_atom(const LV2_Atom* in, Atom& out)
if (uri) {
out = Atom(sizeof(int32_t), _uris.atom_URID, &urid->body);
} else {
- _log.error(fmt("Unable to unmap URID %1%\n") % urid->body);
+ _log.error("Unable to unmap URID %1%\n", urid->body);
}
} else {
out = Atom(in->size, in->type, LV2_ATOM_BODY_CONST(in));
@@ -78,7 +78,7 @@ AtomReader::atom_to_uri(const LV2_Atom* atom)
if (URI::is_valid(str)) {
return URI(str);
} else {
- _log.warn(fmt("Invalid URI <%1%>\n") % str);
+ _log.warn("Invalid URI <%1%>\n", str);
}
} else if (atom->type == _uris.atom_Path) {
const char* str = (const char*)LV2_ATOM_BODY_CONST(atom);
@@ -92,7 +92,7 @@ AtomReader::atom_to_uri(const LV2_Atom* atom)
if (str) {
return URI(str);
} else {
- _log.warn(fmt("Unknown URID %1%\n") % str);
+ _log.warn("Unknown URID %1%\n", str);
}
}
return boost::optional<URI>();
@@ -144,8 +144,7 @@ bool
AtomReader::write(const LV2_Atom* msg, int32_t default_id)
{
if (msg->type != _uris.atom_Object) {
- _log.warn(fmt("Unknown message type <%1%>\n")
- % _map.unmap_uri(msg->type));
+ _log.warn("Unknown message type <%1%>\n", _map.unmap_uri(msg->type));
return false;
}
@@ -374,8 +373,8 @@ AtomReader::write(const LV2_Atom* msg, int32_t default_id)
} else if (obj->body.otype == _uris.ingen_BundleEnd) {
_iface(BundleEnd{seq});
} else {
- _log.warn(fmt("Unknown object type <%1%>\n")
- % _map.unmap_uri(obj->body.otype));
+ _log.warn("Unknown object type <%1%>\n",
+ _map.unmap_uri(obj->body.otype));
}
return true;
diff --git a/src/Configuration.cpp b/src/Configuration.cpp
index d0d606e8..003480ea 100644
--- a/src/Configuration.cpp
+++ b/src/Configuration.cpp
@@ -141,9 +141,8 @@ Configuration::set_value_from_string(Configuration::Option& option,
if (endptr && *endptr == '\0') {
option.value = _forge.make(intval);
} else {
- throw OptionError(
- (fmt("Option `%1%' has non-integer value `%2%'")
- % option.name % value).str());
+ throw OptionError(fmt("Option `%1%' has non-integer value `%2%'",
+ option.name, value));
}
} else if (option.type == _forge.String) {
option.value = _forge.alloc(value.c_str());
@@ -152,8 +151,7 @@ Configuration::set_value_from_string(Configuration::Option& option,
option.value = _forge.make(bool(!strcmp(value.c_str(), "true")));
assert(option.value.type() == _forge.Bool);
} else {
- throw OptionError(
- (fmt("Bad option type `%1%'") % option.name).str());
+ throw OptionError(fmt("Bad option type `%1%'", option.name));
}
return EXIT_SUCCESS;
}
@@ -181,17 +179,15 @@ Configuration::parse(int argc, char** argv)
const Options::iterator o = _options.find(name);
if (o == _options.end()) {
- throw OptionError(
- (fmt("Unrecognized option `%1%'") % name).str());
- } else if (o->second.type == _forge.Bool) { // --flag
+ throw OptionError(fmt("Unrecognized option `%1%'", name));
+ } else if (o->second.type == _forge.Bool) { // --flag
o->second.value = _forge.make(true);
} else if (equals) { // --opt=val
set_value_from_string(o->second, equals + 1);
} else if (++i < argc) { // --opt val
set_value_from_string(o->second, argv[i]);
} else {
- throw OptionError(
- (fmt("Missing value for `%1%'") % name).str());
+ throw OptionError(fmt("Missing value for `%1%'", name));
}
} else {
// Short option
@@ -200,15 +196,14 @@ Configuration::parse(int argc, char** argv)
const char letter = argv[i][j];
const ShortNames::iterator n = _short_names.find(letter);
if (n == _short_names.end()) {
- throw OptionError(
- (fmt("Unrecognized option `%1%'") % letter).str());
+ throw OptionError(fmt("Unrecognized option `%1%'", letter));
}
const Options::iterator o = _options.find(n->second);
if (j < len - 1) { // Non-final POSIX style flag
if (o->second.type != _forge.Bool) {
throw OptionError(
- (fmt("Missing value for `%1%'") % letter).str());
+ fmt("Missing value for `%1%'", letter));
}
o->second.value = _forge.make(true);
} else if (o->second.type == _forge.Bool) { // -f
@@ -216,8 +211,7 @@ Configuration::parse(int argc, char** argv)
} else if (++i < argc) { // -v val
set_value_from_string(o->second, argv[i]);
} else {
- throw OptionError(
- (fmt("Missing value for `%1%'") % letter).str());
+ throw OptionError(fmt("Missing value for `%1%'", letter));
}
}
}
@@ -275,16 +269,16 @@ Configuration::save(URIMap& uri_map,
// Create parent directories if necessary
const FilePath dir = path.parent_path();
if (!filesystem::create_directories(dir)) {
- throw FileError((fmt("Error creating directory %1% (%2%)")
- % dir % strerror(errno)).str());
+ throw FileError(fmt("Error creating directory %1% (%2%)",
+ dir, strerror(errno)));
}
// Attempt to open file for writing
std::unique_ptr<FILE, decltype(&fclose)> file{fopen(path.c_str(), "w"),
&fclose};
if (!file) {
- throw FileError((fmt("Failed to open file %1% (%2%)")
- % path % strerror(errno)).str());
+ throw FileError(fmt("Failed to open file %1% (%2%)",
+ path, strerror(errno)));
}
// Use the file's URI as the base URI
diff --git a/src/Parser.cpp b/src/Parser.cpp
index c4439ed3..caebc5f1 100644
--- a/src/Parser.cpp
+++ b/src/Parser.cpp
@@ -165,7 +165,7 @@ get_port(ingen::World& world,
if (i == props.end()
|| i->second.type() != world.forge().Int
|| i->second.get<int32_t>() < 0) {
- world.log().error(fmt("Port %1% has no valid index\n") % subject);
+ world.log().error("Port %1% has no valid index\n", subject);
return boost::optional<PortRecord>();
}
*index = i->second.get<int32_t>();
@@ -186,8 +186,7 @@ get_port(ingen::World& world,
}
if (!Raul::Symbol::is_valid(sym)) {
- world.log().error(fmt("Port %1% has invalid symbol `%2%'\n")
- % subject % sym);
+ world.log().error("Port %1% has invalid symbol `%2%'\n", subject, sym);
return boost::optional<PortRecord>();
}
@@ -267,9 +266,8 @@ parse_block(ingen::World& world,
}
if (!prototype.is_valid()) {
- world.log().error(
- fmt("Block %1% (%2%) missing mandatory lv2:prototype\n") %
- subject % path);
+ world.log().error("Block %1% (%2%) missing mandatory lv2:prototype\n",
+ subject, path);
return boost::optional<Raul::Path>();
}
@@ -363,7 +361,7 @@ parse_graph(ingen::World& world,
boost::optional<PortRecord> port_record = get_port(
world, model, port, ctx, graph_path, &index);
if (!port_record) {
- world.log().error(fmt("Invalid port %1%\n") % port);
+ world.log().error("Invalid port %1%\n", port);
return boost::optional<Raul::Path>();
}
@@ -371,8 +369,8 @@ parse_graph(ingen::World& world,
if (ports.find(index) == ports.end()) {
ports[index] = *port_record;
} else {
- world.log().error(fmt("Ignored port %1% with duplicate index %2%\n")
- % port % index);
+ world.log().error("Ignored port %1% with duplicate index %2%\n",
+ port, index);
}
}
@@ -414,7 +412,7 @@ parse_graph(ingen::World& world,
boost::optional<PortRecord> port_record = get_port(
world, model, port, subctx, block_path, nullptr);
if (!port_record) {
- world.log().error(fmt("Invalid port %1%\n") % port);
+ world.log().error("Invalid port %1%\n", port);
return boost::optional<Raul::Path>();
}
@@ -606,7 +604,7 @@ Parser::parse_file(ingen::World& world,
*world.rdf_world(), manifest_uri, URI(INGEN__Graph));
if (resources.empty()) {
- world.log().error(fmt("No graphs found in %1%\n") % path);
+ world.log().error("No graphs found in %1%\n", path);
return false;
}
@@ -644,12 +642,12 @@ Parser::parse_file(ingen::World& world,
model.load_file(env, SERD_TURTLE, file_uri);
serd_env_free(env);
- world.log().info(fmt("Loading %1% from %2%\n") % uri % file_path);
+ world.log().info("Loading %1% from %2%\n", uri, file_path);
if (parent) {
- world.log().info(fmt("Parent: %1%\n") % parent->c_str());
+ world.log().info("Parent: %1%\n", parent->c_str());
}
if (symbol) {
- world.log().info(fmt("Symbol: %1%\n") % symbol->c_str());
+ world.log().info("Symbol: %1%\n", symbol->c_str());
}
Sord::Node subject(*world.rdf_world(), Sord::Node::URI, uri.string());
@@ -691,7 +689,7 @@ Parser::parse_string(ingen::World& world,
URI actual_base((const char*)serd_env_get_base_uri(env, nullptr)->buf);
serd_env_free(env);
- world.log().info(fmt("Parsing string (base %1%)\n") % base_uri);
+ world.log().info("Parsing string (base %1%)\n", base_uri);
Sord::Node subject;
parse(world, target, model, actual_base, subject, parent, symbol, data);
diff --git a/src/Serialiser.cpp b/src/Serialiser.cpp
index 6a0991be..fb78162f 100644
--- a/src/Serialiser.cpp
+++ b/src/Serialiser.cpp
@@ -184,7 +184,7 @@ Serialiser::Impl::write_bundle(SPtr<const Node> graph, const URI& uri)
path = path.parent_path();
}
- _world.log().info(fmt("Writing bundle %1%\n") % path);
+ _world.log().info("Writing bundle %1%\n", path);
filesystem::create_directories(path);
const FilePath main_file = path / "main.ttl";
@@ -250,8 +250,8 @@ Serialiser::Impl::finish()
if (_mode == Mode::TO_FILE) {
SerdStatus st = _model->write_to_file(_base_uri, SERD_TURTLE);
if (st) {
- _world.log().error(fmt("Error writing file %1% (%2%)\n")
- % _base_uri % serd_strerror(st));
+ _world.log().error("Error writing file %1% (%2%)\n",
+ _base_uri, serd_strerror(st));
}
} else {
ret = _model->write_to_string(_base_uri, SERD_TURTLE);
diff --git a/src/SocketReader.cpp b/src/SocketReader.cpp
index 590b40cd..0cbb63af 100644
--- a/src/SocketReader.cpp
+++ b/src/SocketReader.cpp
@@ -97,8 +97,8 @@ SocketReader::run()
std::unique_ptr<FILE, decltype(&fclose)> f{fdopen(_socket->fd(), "r"),
&fclose};
if (!f) {
- _world.log().error(fmt("Failed to open connection (%1%)\n")
- % strerror(errno));
+ _world.log().error("Failed to open connection (%1%)\n",
+ strerror(errno));
// Connection gone, exit
_socket.reset();
return;
@@ -168,8 +168,7 @@ SocketReader::run()
if (st == SERD_FAILURE || !_msg_node) {
continue; // Read nothing, e.g. just whitespace
} else if (st) {
- _world.log().error(fmt("Read error: %1%\n")
- % serd_strerror(st));
+ _world.log().error("Read error: %1%\n", serd_strerror(st));
continue;
}
diff --git a/src/URIMap.cpp b/src/URIMap.cpp
index 7c5774f8..46ca0108 100644
--- a/src/URIMap.cpp
+++ b/src/URIMap.cpp
@@ -64,7 +64,7 @@ LV2_URID
URIMap::URIDMapFeature::map(const char* uri)
{
if (!URI::is_valid(uri)) {
- log.error(fmt("Attempt to map invalid URI <%1%>\n") % uri);
+ log.error("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 233a7d36..338d6864 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -86,12 +86,12 @@ ingen_load_library(Log& log, const string& name)
if (*library) {
return library;
} else if (!module_path) {
- log.error(fmt("Unable to find %1% (%2%)\n")
- % name % Library::get_last_error());
+ log.error("Unable to find %1% (%2%)\n",
+ name, Library::get_last_error());
return nullptr;
} else {
- log.error(fmt("Unable to load %1% from %2% (%3%)\n")
- % name % module_path % Library::get_last_error());
+ log.error("Unable to load %1% from %2% (%3%)\n",
+ name, module_path, Library::get_last_error());
return nullptr;
}
}
@@ -229,7 +229,7 @@ World::load_configuration(int& argc, char**& argv)
// Parse default configuration files
const auto files = _impl->conf.load_default("ingen", "options.ttl");
for (const auto& f : files) {
- _impl->log.info(fmt("Loaded configuration %1%\n") % f);
+ _impl->log.info("Loaded configuration %1%\n", f);
}
// Parse command line options, overriding configuration file values
@@ -270,7 +270,7 @@ World::load_module(const char* name)
if (i != _impl->modules.end()) {
return true;
}
- log().info(fmt("Loading %1% module\n") % name);
+ log().info("Loading %1% module\n", name);
std::unique_ptr<ingen::Library> lib = ingen_load_library(log(), name);
ingen::Module* (*module_load)() =
lib ? (ingen::Module* (*)())lib->get_function("ingen_module_load")
@@ -285,7 +285,8 @@ World::load_module(const char* name)
}
}
- log().error(fmt("Failed to load module `%1%' (%2%)\n") % name % lib->get_last_error());
+ log().error("Failed to load module `%1%' (%2%)\n",
+ name, lib->get_last_error());
return false;
}
@@ -294,7 +295,7 @@ World::run_module(const char* name)
{
auto i = _impl->modules.find(name);
if (i == _impl->modules.end()) {
- log().error(fmt("Attempt to run unloaded module `%1%'\n") % name);
+ log().error("Attempt to run unloaded module `%1%'\n", name);
return false;
}
@@ -310,7 +311,7 @@ World::new_interface(const URI& engine_uri, SPtr<Interface> respondee)
const Impl::InterfaceFactories::const_iterator i =
_impl->interface_factories.find(std::string(engine_uri.scheme()));
if (i == _impl->interface_factories.end()) {
- log().warn(fmt("Unknown URI scheme `%1%'\n") % engine_uri.scheme());
+ log().warn("Unknown URI scheme `%1%'\n", engine_uri.scheme());
return SPtr<Interface>();
}
@@ -323,7 +324,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(fmt("Unknown script MIME type `%1%'\n") % mime_type);
+ log().warn("Unknown script MIME type `%1%'\n", mime_type);
return false;
}
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index ad3b3c0d..1f71bf61 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -70,7 +70,7 @@ ClientStore::add_object(SPtr<ObjectModel> object)
(*this)[object->path()] = object;
_signal_new_object.emit(object);
} else {
- _log.error(fmt("Object %1% with no parent\n") % object->path());
+ _log.error("Object %1% with no parent\n", object->path());
}
} else {
(*this)[object->path()] = object;
@@ -252,14 +252,14 @@ ClientStore::operator()(const Put& msg)
const Iterator l = properties.find(_uris.rdfs_label);
SPtr<PluginModel> plug;
if (p == properties.end()) {
- _log.error(fmt("Preset <%1%> with no plugin\n") % uri.c_str());
+ _log.error("Preset <%1%> with no plugin\n", uri.c_str());
} else if (l == properties.end()) {
- _log.error(fmt("Preset <%1%> with no label\n") % uri.c_str());
+ _log.error("Preset <%1%> with no label\n", uri.c_str());
} else if (l->second.type() != _uris.forge.String) {
- _log.error(fmt("Preset <%1%> label is not a string\n") % uri.c_str());
+ _log.error("Preset <%1%> label is not a string\n", uri.c_str());
} else if (!(plug = _plugin(p->second))) {
- _log.error(fmt("Preset <%1%> for unknown plugin %2%\n")
- % uri.c_str() % _uris.forge.str(p->second, true));
+ _log.error("Preset <%1%> for unknown plugin %2%\n",
+ uri.c_str(), _uris.forge.str(p->second, true));
} else {
plug->add_preset(uri, l->second.ptr<char>());
}
@@ -274,8 +274,7 @@ ClientStore::operator()(const Put& msg)
}
if (!uri_is_path(uri)) {
- _log.error(fmt("Put for unknown subject <%1%>\n")
- % uri.c_str());
+ _log.error("Put for unknown subject <%1%>\n", uri.c_str());
return;
}
@@ -315,7 +314,7 @@ ClientStore::operator()(const Put& msg)
bm->set_properties(properties);
add_object(bm);
} else {
- _log.warn(fmt("Block %1% has no prototype\n") % path.c_str());
+ _log.warn("Block %1% has no prototype\n", path.c_str());
}
} else if (is_port) {
PortModel::Direction pdir = (is_output)
@@ -331,7 +330,7 @@ ClientStore::operator()(const Put& msg)
p->set_properties(properties);
add_object(p);
} else {
- _log.warn(fmt("Ignoring %1% of unknown type\n") % path.c_str());
+ _log.warn("Ignoring %1% of unknown type\n", path.c_str());
}
}
@@ -345,8 +344,7 @@ ClientStore::operator()(const Delta& msg)
}
if (!uri_is_path(uri)) {
- _log.error(fmt("Delta for unknown subject <%1%>\n")
- % uri.c_str());
+ _log.error("Delta for unknown subject <%1%>\n", uri.c_str());
return;
}
@@ -357,7 +355,7 @@ ClientStore::operator()(const Delta& msg)
obj->remove_properties(msg.remove);
obj->add_properties(msg.add);
} else {
- _log.warn(fmt("Failed to find object `%1%'\n") % path.c_str());
+ _log.warn("Failed to find object `%1%'\n", path.c_str());
}
}
@@ -369,8 +367,8 @@ ClientStore::operator()(const SetProperty& msg)
const auto& value = msg.value;
if (subject_uri == URI("ingen:/engine")) {
- _log.info(fmt("Engine property <%1%> = %2%\n")
- % predicate.c_str() % _uris.forge.str(value, false));
+ _log.info("Engine property <%1%> = %2%\n",
+ predicate.c_str(), _uris.forge.str(value, false));
return;
}
SPtr<Resource> subject = _resource(subject_uri);
@@ -387,8 +385,8 @@ ClientStore::operator()(const SetProperty& msg)
if (plugin) {
plugin->set_property(predicate, value);
} else if (predicate != _uris.ingen_activity) {
- _log.warn(fmt("Property <%1%> for unknown object %2%\n")
- % predicate.c_str() % subject_uri.c_str());
+ _log.warn("Property <%1%> for unknown object %2%\n",
+ predicate.c_str(), subject_uri.c_str());
}
}
}
@@ -416,8 +414,8 @@ ClientStore::connection_graph(const Raul::Path& tail_path,
}
if (!graph) {
- _log.error(fmt("Unable to find graph for arc %1% => %2%\n")
- % tail_path % head_path);
+ _log.error("Unable to find graph for arc %1% => %2%\n",
+ tail_path, head_path);
}
return graph;
@@ -436,8 +434,7 @@ ClientStore::attempt_connection(const Raul::Path& tail_path,
graph->add_arc(arc);
return true;
} else {
- _log.warn(fmt("Failed to connect %1% => %2%\n")
- % tail_path % head_path);
+ _log.warn("Failed to connect %1% => %2%\n", tail_path, head_path);
return false;
}
}
@@ -466,8 +463,8 @@ ClientStore::operator()(const DisconnectAll& msg)
SPtr<ObjectModel> object = _object(msg.path);
if (!graph || !object) {
- _log.error(fmt("Bad disconnect all notification %1% in %2%\n")
- % msg.path % msg.graph);
+ _log.error("Bad disconnect all notification %1% in %2%\n",
+ msg.path, msg.graph);
return;
}
diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp
index 5f954b85..c093ad47 100644
--- a/src/client/PluginUI.cpp
+++ b/src/client/PluginUI.cpp
@@ -32,9 +32,9 @@ static SPtr<const PortModel>
get_port(PluginUI* ui, uint32_t port_index)
{
if (port_index >= ui->block()->ports().size()) {
- ui->world().log().error(
- fmt("%1% UI tried to access invalid port %2%\n")
- % ui->block()->plugin()->uri().c_str() % port_index);
+ ui->world().log().error("%1% UI tried to access invalid port %2%\n",
+ ui->block()->plugin()->uri().c_str(),
+ port_index);
return SPtr<const PortModel>();
}
return ui->block()->ports()[port_index];
@@ -58,8 +58,8 @@ lv2_ui_write(SuilController controller,
if (format == 0) {
if (buffer_size != 4) {
ui->world().log().error(
- fmt("%1% UI wrote corrupt float with bad size\n")
- % ui->block()->plugin()->uri().c_str());
+ "%1% UI wrote corrupt float with bad size\n",
+ ui->block()->plugin()->uri().c_str());
return;
}
const float value = *(const float*)buffer;
@@ -83,9 +83,9 @@ lv2_ui_write(SuilController controller,
val,
Resource::Graph::DEFAULT);
} else {
- ui->world().log().warn(
- fmt("Unknown value format %1% from LV2 UI\n")
- % format % ui->block()->plugin()->uri().c_str());
+ ui->world().log().warn("Unknown value format %1% from LV2 UI\n",
+ format,
+ ui->block()->plugin()->uri().c_str());
}
}
@@ -238,14 +238,14 @@ PluginUI::instantiate()
const LilvNode* sym = lilv_world_get(lworld, note, uris.lv2_symbol, nullptr);
const LilvNode* plug = lilv_world_get(lworld, note, ui_plugin, nullptr);
if (!plug) {
- _world.log().error(fmt("%1% UI %2% notification missing plugin\n")
- % plugin_uri % lilv_node_as_string(_ui_node));
+ _world.log().error("%1% UI %2% notification missing plugin\n",
+ plugin_uri, lilv_node_as_string(_ui_node));
} else if (!sym) {
- _world.log().error(fmt("%1% UI %2% notification missing symbol\n")
- % plugin_uri % lilv_node_as_string(_ui_node));
+ _world.log().error("%1% UI %2% notification missing symbol\n",
+ plugin_uri, lilv_node_as_string(_ui_node));
} else if (!lilv_node_is_uri(plug)) {
- _world.log().error(fmt("%1% UI %2% notification has non-URI plugin\n")
- % plugin_uri % lilv_node_as_string(_ui_node));
+ _world.log().error("%1% UI %2% notification has non-URI plugin\n",
+ plugin_uri, lilv_node_as_string(_ui_node));
} else if (!strcmp(lilv_node_as_uri(plug), plugin_uri.c_str())) {
// Notification is valid and for this plugin
uint32_t index = lv2_ui_port_index(this, lilv_node_as_string(sym));
diff --git a/src/gui/App.cpp b/src/gui/App.cpp
index df4159a1..b9b7f7dc 100644
--- a/src/gui/App.cpp
+++ b/src/gui/App.cpp
@@ -323,7 +323,7 @@ App::property_change(const URI& subject,
} else if (key == uris().ingen_maxRunLoad && value.type() == forge().Float) {
_max_run_load = value.get<float>();
} else {
- _world.log().warn(fmt("Unknown engine property %1%\n") % key);
+ _world.log().warn("Unknown engine property %1%\n", key);
return;
}
@@ -343,19 +343,18 @@ fraction_label(float f)
char col_str[8];
snprintf(col_str, sizeof(col_str), "%02X%02X%02X",
RGBA_R(col), RGBA_G(col), RGBA_B(col));
- return (fmt("<span color='#%s'>%d%%</span>") % col_str % (f * 100)).str();
+ return fmt("<span color='#%s'>%d%%</span>", col_str, (f * 100));
}
std::string
App::status_text() const
{
- return (fmt("%2.1f kHz / %.1f ms, %s, %s DSP")
- % (_sample_rate / 1e3f)
- % (_block_length * 1e3f / (float)_sample_rate)
- % ((_n_threads == 1)
- ? "1 thread"
- : (fmt("%1% threads") % _n_threads).str())
- % fraction_label(_max_run_load)).str();
+ return fmt(
+ "%2.1f kHz / %.1f ms, %s, %s DSP",
+ (_sample_rate / 1e3f),
+ (_block_length * 1e3f / (float)_sample_rate),
+ ((_n_threads == 1) ? "1 thread" : fmt("%1% threads", _n_threads)),
+ fraction_label(_max_run_load));
}
void
@@ -470,10 +469,9 @@ App::quit(Gtk::Window* dialog_parent)
try {
const std::string path = _world.conf().save(
_world.uri_map(), "ingen", "gui.ttl", Configuration::GUI);
- std::cout << (fmt("Saved GUI settings to %1%\n") % path);
+ std::cout << fmt("Saved GUI settings to %1%\n", path);
} catch (const std::exception& e) {
- std::cerr << (fmt("Error saving GUI settings (%1%)\n")
- % e.what());
+ std::cerr << fmt("Error saving GUI settings (%1%)\n", e.what());
}
return true;
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp
index e2968ea2..369331e2 100644
--- a/src/gui/ConnectWindow.cpp
+++ b/src/gui/ConnectWindow.cpp
@@ -244,7 +244,7 @@ ConnectWindow::connect(bool existing)
}
if (!URI::is_valid(uri_str)) {
- error((fmt("Invalid socket URI %1%") % uri_str).str());
+ error(fmt("Invalid socket URI %1%", uri_str));
return;
}
diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp
index cb9edf98..a201eca8 100644
--- a/src/gui/GraphBox.cpp
+++ b/src/gui/GraphBox.cpp
@@ -26,6 +26,7 @@
#include "ingen/Configuration.hpp"
#include "ingen/Interface.hpp"
#include "ingen/Log.hpp"
+#include "ingen/fmt.hpp"
#include "ingen/client/ClientStore.hpp"
#include "ingen/client/GraphModel.hpp"
@@ -220,9 +221,8 @@ GraphBox::init_box(App& app)
if (engine_uri == "ingen:/clients/event_writer") {
_status_bar->push("Running internal engine", STATUS_CONTEXT_ENGINE);
} else {
- _status_bar->push(
- (fmt("Connected to %1%") % engine_uri).str(),
- STATUS_CONTEXT_ENGINE);
+ _status_bar->push(fmt("Connected to %1%", engine_uri),
+ STATUS_CONTEXT_ENGINE);
}
_menu_view_messages_window->signal_activate().connect(
@@ -428,7 +428,7 @@ GraphBox::show_status(const ObjectModel* model)
} else if ((block = dynamic_cast<const BlockModel*>(model))) {
const PluginModel* plugin = dynamic_cast<const PluginModel*>(block->plugin());
if (plugin) {
- msg << ((boost::format(" (%1%)") % plugin->human_name()).str());
+ msg << fmt(" (%1%)", plugin->human_name());
}
_status_bar->push(msg.str(), STATUS_CONTEXT_HOVER);
}
@@ -541,14 +541,12 @@ GraphBox::save_graph(const URI& uri)
{
if (_app->interface()->uri().string().substr(0, 3) == "tcp") {
_status_bar->push(
- (boost::format("Saved %1% to %2% on client")
- % _graph->path() % uri).str(),
+ fmt("Saved %1% to %2% on client", _graph->path(), uri),
STATUS_CONTEXT_GRAPH);
_app->loader()->save_graph(_graph, uri);
} else {
_status_bar->push(
- (boost::format("Saved %1% to %2% on server")
- % _graph->path() % uri).str(),
+ fmt("Saved %1% to %2% on server", _graph->path(), uri),
STATUS_CONTEXT_GRAPH);
_app->interface()->copy(_graph->uri(), uri);
}
@@ -618,23 +616,22 @@ GraphBox::event_save_as()
if (Glib::file_test(filename, Glib::FILE_TEST_IS_DIR)) {
if (Glib::file_test(Glib::build_filename(filename, "manifest.ttl"),
Glib::FILE_TEST_EXISTS)) {
- confirmed = confirm(
- (boost::format("<b>The bundle \"%1%\" already exists."
- " Replace it?</b>") % basename).str());
+ confirmed = confirm(fmt("<b>The bundle \"%1%\" already exists."
+ " Replace it?</b>",
+ basename));
} else {
confirmed = confirm(
- (boost::format("<b>A directory named \"%1%\" already exists,"
- "but is not an Ingen bundle. "
- "Save into it anyway?</b>") % basename).str(),
+ fmt("<b>A directory named \"%1%\" already exists,"
+ "but is not an Ingen bundle. "
+ "Save into it anyway?</b>", basename),
"This will create at least 2 .ttl files in this directory,"
"and possibly several more files and/or directories, recursively. "
"Existing files will be overwritten.");
}
} else if (Glib::file_test(filename, Glib::FILE_TEST_EXISTS)) {
- confirmed = confirm(
- (boost::format("<b>A file named \"%1%\" already exists. "
- "Replace it with an Ingen bundle?</b>")
- % basename).str());
+ confirmed = confirm(fmt("<b>A file named \"%1%\" already exists. "
+ "Replace it with an Ingen bundle?</b>",
+ basename));
if (confirmed) {
::g_remove(filename.c_str());
}
@@ -703,8 +700,7 @@ GraphBox::event_export_image()
}
}
_view->canvas()->export_image(filename.c_str(), bg_but->get_active());
- _status_bar->push((boost::format("Rendered %1% to %2%")
- % _graph->path() % filename).str(),
+ _status_bar->push(fmt("Rendered %1% to %2%", _graph->path(), filename),
STATUS_CONTEXT_GRAPH);
}
}
diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp
index 47a0abcf..986fefdc 100644
--- a/src/gui/GraphCanvas.cpp
+++ b/src/gui/GraphCanvas.cpp
@@ -421,8 +421,8 @@ GraphCanvas::connection(SPtr<const ArcModel> arc)
if (tail && head) {
new gui::Arc(*this, arc, tail, head);
} else {
- _app.log().error(fmt("Unable to find ports to connect %1% => %2%\n")
- % arc->tail_path() % arc->head_path());
+ _app.log().error("Unable to find ports to connect %1% => %2%\n",
+ arc->tail_path(), arc->head_path());
}
}
@@ -442,8 +442,8 @@ GraphCanvas::disconnection(SPtr<const ArcModel> arc)
}
}
} else {
- _app.log().error(fmt("Unable to find ports to disconnect %1% => %2%\n")
- % arc->tail_path() % arc->head_path());
+ _app.log().error("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 2edf8a44..7d00b0f5 100644
--- a/src/gui/GraphTreeWindow.cpp
+++ b/src/gui/GraphTreeWindow.cpp
@@ -205,8 +205,7 @@ GraphTreeWindow::graph_property_changed(const URI& key,
Gtk::TreeModel::Row row = *i;
row[_graph_tree_columns.enabled_col] = value.get<int32_t>();
} else {
- _app->log().error(fmt("Unable to find graph %1%\n")
- % graph->path());
+ _app->log().error("Unable to find graph %1%\n", graph->path());
}
}
_enable_signal = true;
@@ -224,8 +223,7 @@ GraphTreeWindow::graph_moved(SPtr<GraphModel> graph)
Gtk::TreeModel::Row row = *i;
row[_graph_tree_columns.name_col] = graph->symbol().c_str();
} else {
- _app->log().error(fmt("Unable to find graph %1%\n")
- % graph->path());
+ _app->log().error("Unable to find graph %1%\n", graph->path());
}
_enable_signal = true;
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index ae030067..abb9e970 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -334,8 +334,8 @@ NodeModule::delete_port_view(SPtr<const PortModel> model)
if (p) {
delete p;
} else {
- app().log().warn(fmt("Failed to find port %1% on module %2%\n")
- % model->path() % _block->path());
+ app().log().warn("Failed to find port %1% on module %2%\n",
+ model->path(), _block->path());
}
}
@@ -381,7 +381,7 @@ NodeModule::popup_gui()
return true;
} else {
- app().log().warn(fmt("No LV2 GUI for %1%\n") % _block->path());
+ app().log().warn("No LV2 GUI for %1%\n", _block->path());
}
}
diff --git a/src/gui/PluginMenu.cpp b/src/gui/PluginMenu.cpp
index e85d1da7..49ee059d 100644
--- a/src/gui/PluginMenu.cpp
+++ b/src/gui/PluginMenu.cpp
@@ -112,8 +112,8 @@ PluginMenu::build_plugin_class_menu(Gtk::Menu* 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()) {
- _world.log().warn(fmt("Infinite LV2 class recursion: %1% <: %2%\n")
- % class_uri_str % sub_uri_str);
+ _world.log().warn("Infinite LV2 class recursion: %1% <: %2%\n",
+ class_uri_str, sub_uri_str);
return 0;
}
diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp
index 994ed224..ba25d69b 100644
--- a/src/gui/PropertiesWindow.cpp
+++ b/src/gui/PropertiesWindow.cpp
@@ -359,7 +359,7 @@ PropertiesWindow::create_value_widget(const URI& key,
return widget;
}
- _app->log().error(fmt("No widget for value type %1%\n") % type);
+ _app->log().error("No widget for value type %1%\n", type);
return nullptr;
}
@@ -453,7 +453,7 @@ PropertiesWindow::get_value(LV2_URID type, Gtk::Widget* value_widget)
if (uri_entry && URI::is_valid(uri_entry->get_text())) {
return _app->forge().make_urid(URI(uri_entry->get_text()));
} else {
- _app->log().error(fmt("Invalid URI <%1%>\n") % uri_entry->get_text());
+ _app->log().error("Invalid URI <%1%>\n", uri_entry->get_text());
}
} else if (type == forge.String) {
Gtk::Entry* entry = dynamic_cast<Gtk::Entry*>(value_widget);
@@ -480,7 +480,7 @@ PropertiesWindow::on_change(const URI& key)
if (value.is_valid()) {
record.value = value;
} else {
- _app->log().error(fmt("Failed to get `%1%' value from widget\n") % key);
+ _app->log().error("Failed to get `%1%' value from widget\n", key);
}
}
diff --git a/src/gui/RDFS.cpp b/src/gui/RDFS.cpp
index 1ce3618d..80cc24f1 100644
--- a/src/gui/RDFS.cpp
+++ b/src/gui/RDFS.cpp
@@ -132,7 +132,7 @@ types(World& world, SPtr<const client::ObjectModel> model)
types.insert(world.uris().lv2_Plugin);
}
} else {
- world.log().error(fmt("<%1%> has non-URI type\n") % model->uri());
+ world.log().error("<%1%> has non-URI type\n", model->uri());
}
}
diff --git a/src/gui/WidgetFactory.cpp b/src/gui/WidgetFactory.cpp
index 3ca4eec4..a2a83a6f 100644
--- a/src/gui/WidgetFactory.cpp
+++ b/src/gui/WidgetFactory.cpp
@@ -58,8 +58,8 @@ WidgetFactory::find_ui_file()
return;
}
- throw std::runtime_error((fmt("Unable to find ingen_gui.ui in %1%\n")
- % INGEN_DATA_DIR).str());
+ throw std::runtime_error(fmt("Unable to find ingen_gui.ui in %1%\n",
+ INGEN_DATA_DIR));
}
Glib::RefPtr<Gtk::Builder>
diff --git a/src/ingen/ingen.cpp b/src/ingen/ingen.cpp
index bc47d433..e5503715 100644
--- a/src/ingen/ingen.cpp
+++ b/src/ingen/ingen.cpp
@@ -143,11 +143,11 @@ main(int argc, char** argv)
if (!engine_interface) {
const char* const uri = conf.option("connect").ptr<char>();
ingen_try(URI::is_valid(uri),
- (fmt("Invalid URI <%1%>") % uri).str().c_str());
+ fmt("Invalid URI <%1%>", uri).c_str());
engine_interface = world->new_interface(URI(uri), dummy_client);
if (!engine_interface && !conf.option("gui").get<int32_t>()) {
- cerr << (fmt("ingen: error: Failed to connect to `%1%'\n") % uri);
+ cerr << fmt("ingen: error: Failed to connect to `%1%'\n", uri);
return EXIT_FAILURE;
}
@@ -256,7 +256,7 @@ main(int argc, char** argv)
// Save configuration to restore preferences on next run
const std::string path = conf.save(
world->uri_map(), "ingen", "options.ttl", Configuration::GLOBAL);
- std::cout << (fmt("Saved configuration to %1%") % path) << std::endl;
+ std::cout << fmt("Saved configuration to %1%\n", path);
engine_interface.reset();
diff --git a/src/server/BlockFactory.cpp b/src/server/BlockFactory.cpp
index 02be5159..d5a8e2d3 100644
--- a/src/server/BlockFactory.cpp
+++ b/src/server/BlockFactory.cpp
@@ -165,9 +165,8 @@ BlockFactory::load_lv2_plugins()
const char* feature = lilv_node_as_uri(lilv_nodes_get(features, f));
if (!_world.lv2_features().is_supported(feature)) {
supported = false;
- _world.log().warn(
- fmt("Ignoring <%1%>; required feature <%2%>\n")
- % uri % feature);
+ _world.log().warn("Ignoring <%1%>; required feature <%2%>\n",
+ uri, feature);
break;
}
}
@@ -178,8 +177,8 @@ BlockFactory::load_lv2_plugins()
// Ignore plugins that are missing ports
if (!lilv_plugin_get_port_by_index(lv2_plug, 0)) {
- _world.log().warn(
- fmt("Ignoring <%1%>; missing or corrupt ports\n") % uri);
+ _world.log().warn("Ignoring <%1%>; missing or corrupt ports\n",
+ uri);
continue;
}
@@ -197,10 +196,10 @@ BlockFactory::load_lv2_plugins()
!lilv_port_has_property(lv2_plug,
port,
_world.uris().lv2_connectionOptional)) {
- _world.log().warn(
- fmt("Ignoring <%1%>; unsupported port <%2%>\n")
- % uri % lilv_node_as_string(
- lilv_port_get_symbol(lv2_plug, port)));
+ _world.log().warn("Ignoring <%1%>; unsupported port <%2%>\n",
+ uri,
+ lilv_node_as_string(
+ lilv_port_get_symbol(lv2_plug, port)));
break;
}
}
@@ -217,7 +216,7 @@ BlockFactory::load_lv2_plugins()
}
}
- _world.log().info(fmt("Loaded %1% plugins\n") % _plugins.size());
+ _world.log().info("Loaded %1% plugins\n", _plugins.size());
}
} // namespace server
diff --git a/src/server/CompiledGraph.cpp b/src/server/CompiledGraph.cpp
index 073b234e..dec5fdaf 100644
--- a/src/server/CompiledGraph.cpp
+++ b/src/server/CompiledGraph.cpp
@@ -67,11 +67,10 @@ CompiledGraph::compile(Raul::Maid& maid, GraphImpl& graph)
} catch (const FeedbackException& e) {
Log& log = graph.engine().log();
if (e.node && e.root) {
- log.error(fmt("Feedback compiling %1% from %2%\n")
- % e.node->path() % e.root->path());
+ log.error("Feedback compiling %1% from %2%\n",
+ e.node->path(), e.root->path());
} else {
- log.error(fmt("Feedback compiling %1%\n")
- % e.node->path());
+ log.error("Feedback compiling %1%\n", e.node->path());
}
return MPtr<CompiledGraph>();
}
diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp
index c463e7d6..5ab5e490 100644
--- a/src/server/Engine.cpp
+++ b/src/server/Engine.cpp
@@ -509,14 +509,14 @@ Engine::log() const
void
Engine::register_client(SPtr<Interface> client)
{
- log().info(fmt("Registering client <%1%>\n") % client->uri().c_str());
+ log().info("Registering client <%1%>\n", client->uri().c_str());
_broadcaster->register_client(client);
}
bool
Engine::unregister_client(SPtr<Interface> client)
{
- log().info(fmt("Unregistering client <%1%>\n") % client->uri().c_str());
+ log().info("Unregistering client <%1%>\n", client->uri().c_str());
return _broadcaster->unregister_client(client);
}
diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp
index 35406ec4..6e3ca9d6 100644
--- a/src/server/JackDriver.cpp
+++ b/src/server/JackDriver.cpp
@@ -22,7 +22,6 @@
#include <jack/midiport.h>
#ifdef INGEN_JACK_SESSION
#include <jack/session.h>
-#include <boost/format.hpp>
#include "ingen/Serialiser.hpp"
#endif
#ifdef HAVE_JACK_METADATA
@@ -36,6 +35,7 @@
#include "ingen/URI.hpp"
#include "ingen/URIMap.hpp"
#include "ingen/World.hpp"
+#include "ingen/fmt.hpp"
#include "lv2/atom/util.h"
#include "Buffer.hpp"
@@ -89,8 +89,8 @@ JackDriver::attach(const std::string& server_name,
_client = jack_client_open(client_name.c_str(),
JackSessionID, nullptr,
uuid.c_str());
- _engine.log().info(fmt("Connected to Jack as `%1%' (UUID `%2%')\n")
- % client_name.c_str() % uuid);
+ _engine.log().info("Connected to Jack as `%1%' (UUID `%2%')\n",
+ client_name.c_str(), uuid);
}
#endif
@@ -99,8 +99,7 @@ JackDriver::attach(const std::string& server_name,
if ((_client = jack_client_open(client_name.c_str(),
JackServerName, nullptr,
server_name.c_str()))) {
- _engine.log().info(fmt("Connected to Jack server `%1%'\n")
- % server_name);
+ _engine.log().info("Connected to Jack server `%1%'\n", server_name);
}
}
@@ -171,7 +170,7 @@ JackDriver::activate()
_engine.log().error("Could not activate Jack client, aborting\n");
return false;
} else {
- _engine.log().info(fmt("Activated Jack client `%1%'\n") %
+ _engine.log().info("Activated Jack client `%1%'\n",
world.conf().option("jack-name").ptr<char>());
}
return true;
@@ -545,12 +544,11 @@ JackDriver::_block_length_cb(jack_nframes_t nframes)
void
JackDriver::_session_cb(jack_session_event_t* event)
{
- _engine.log().info(fmt("Jack session save to %1%\n") % event->session_dir);
+ _engine.log().info("Jack session save to %1%\n", event->session_dir);
- const std::string cmd = (
- boost::format("ingen -eg -n %1% -u %2% -l ${SESSION_DIR}")
- % jack_get_client_name(_client)
- % event->client_uuid).str();
+ const std::string cmd = fmt("ingen -eg -n %1% -u %2% -l ${SESSION_DIR}",
+ jack_get_client_name(_client),
+ event->client_uuid);
SPtr<Serialiser> serialiser = _engine.world().serialiser();
if (serialiser) {
diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp
index bf6cbd60..54280b5e 100644
--- a/src/server/LV2Block.cpp
+++ b/src/server/LV2Block.cpp
@@ -84,8 +84,8 @@ LV2Block::make_instance(URIs& uris,
lplug, rate, _features->array());
if (!inst) {
- engine.log().error(fmt("Failed to instantiate <%1%>\n")
- % _lv2_plugin->uri().c_str());
+ engine.log().error("Failed to instantiate <%1%>\n",
+ _lv2_plugin->uri().c_str());
return SPtr<Instance>();
}
@@ -141,14 +141,15 @@ LV2Block::make_instance(URIs& uris,
port->set_type(PortType::CV, 0);
} else {
parent_graph()->engine().log().error(
- fmt("%1% auto-morphed to unknown type %2%\n")
- % port->path().c_str() % type);
+ "%1% auto-morphed to unknown type %2%\n",
+ port->path().c_str(),
+ type);
return SPtr<Instance>();
}
} else {
parent_graph()->engine().log().error(
- fmt("Failed to get auto-morphed type of %1%\n")
- % port->path().c_str());
+ "Failed to get auto-morphed type of %1%\n",
+ port->path().c_str());
}
}
}
@@ -304,8 +305,8 @@ LV2Block::instantiate(BufferFactory& bufs, const LilvState* state)
uint32_t port_buffer_size = bufs.default_size(buffer_type);
if (port_buffer_size == 0 && !optional) {
parent_graph()->engine().log().error(
- fmt("<%1%> port `%2%' has unknown buffer type\n")
- % _lv2_plugin->uri().c_str() % port_sym.c_str());
+ "<%1%> port `%2%' has unknown buffer type\n",
+ _lv2_plugin->uri().c_str(), port_sym.c_str());
ret = false;
break;
}
@@ -355,8 +356,8 @@ LV2Block::instantiate(BufferFactory& bufs, const LilvState* state)
if ((port_type == PortType::UNKNOWN && !optional) ||
direction == UNKNOWN) {
parent_graph()->engine().log().error(
- fmt("<%1%> port `%2%' has unknown type or direction\n")
- % _lv2_plugin->uri().c_str() % port_sym.c_str());
+ "<%1%> port `%2%' has unknown type or direction\n",
+ _lv2_plugin->uri().c_str(), port_sym.c_str());
ret = false;
break;
}
@@ -563,7 +564,7 @@ LV2Block::work(uint32_t size, const void* data)
LV2_Worker_Status st = _worker_iface->work(inst, work_respond, this, size, data);
if (st) {
parent_graph()->engine().log().error(
- fmt("Error calling %1% work method\n") % _path);
+ "Error calling %1% work method\n", _path);
}
return st;
}
diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp
index 7012c8fd..9152ab99 100644
--- a/src/server/LV2Plugin.cpp
+++ b/src/server/LV2Plugin.cpp
@@ -128,8 +128,8 @@ LV2Plugin::load_presets()
lilv_nodes_free(labels);
} else {
_world.log().error(
- fmt("Preset <%1%> has no rdfs:label\n")
- % lilv_node_as_string(lilv_nodes_get(presets, i)));
+ "Preset <%1%> has no rdfs:label\n",
+ lilv_node_as_string(lilv_nodes_get(presets, i)));
}
}
diff --git a/src/server/RunContext.cpp b/src/server/RunContext.cpp
index d7b96fba..7087b5ab 100644
--- a/src/server/RunContext.cpp
+++ b/src/server/RunContext.cpp
@@ -164,8 +164,8 @@ RunContext::set_priority(int priority)
sp.sched_priority = (priority > 0) ? priority : 0;
if (pthread_setschedparam(pthread, policy, &sp)) {
_engine.log().error(
- fmt("Failed to set real-time priority of run thread (%s)\n")
- % strerror(errno));
+ "Failed to set real-time priority of run thread (%s)\n",
+ strerror(errno));
}
}
}
diff --git a/src/server/SocketListener.cpp b/src/server/SocketListener.cpp
index bd25d351..849adcad 100644
--- a/src/server/SocketListener.cpp
+++ b/src/server/SocketListener.cpp
@@ -101,25 +101,26 @@ ingen_listen(Engine* engine, Raul::Socket* unix_sock, Raul::Socket* net_sock)
const pid_t pid = std::stoi(suffix);
if (!kill(pid, 0)) {
make_link = false;
- world.log().warn(fmt("Another Ingen instance is running at %1% => %2%\n")
- % link_path % old_path);
+ world.log().warn(
+ "Another Ingen instance is running at %1% => %2%\n",
+ link_path, old_path);
} else {
- world.log().warn(fmt("Replacing old link %1% => %2%\n")
- % link_path % old_path);
+ world.log().warn("Replacing old link %1% => %2%\n",
+ link_path, old_path);
unlink(link_path.c_str());
}
}
if (make_link) {
if (!symlink(unix_path.c_str(), link_path.c_str())) {
- world.log().info(fmt("Listening on %1%\n") %
+ world.log().info("Listening on %1%\n",
(unix_scheme + link_path));
} else {
- world.log().error(fmt("Failed to link %1% => %2% (%3%)\n")
- % link_path % unix_path % strerror(errno));
+ world.log().error("Failed to link %1% => %2% (%3%)\n",
+ link_path, unix_path, strerror(errno));
}
} else {
- world.log().info(fmt("Listening on %1%\n") % unix_uri);
+ world.log().info("Listening on %1%\n", unix_uri);
}
}
@@ -131,7 +132,7 @@ ingen_listen(Engine* engine, Raul::Socket* unix_sock, Raul::Socket* net_sock)
world.log().error("Failed to create TCP socket\n");
net_sock->close();
} else {
- world.log().info(fmt("Listening on TCP port %1%\n") % port);
+ world.log().info("Listening on TCP port %1%\n", port);
}
if (unix_sock->fd() == -1 && net_sock->fd() == -1) {
@@ -157,7 +158,7 @@ ingen_listen(Engine* engine, Raul::Socket* unix_sock, Raul::Socket* net_sock)
// Wait for input to arrive at a socket
const int ret = poll(pfds, nfds, -1);
if (ret == -1) {
- world.log().error(fmt("Poll error: %1%\n") % strerror(errno));
+ world.log().error("Poll error: %1%\n", strerror(errno));
break;
} else if (ret == 0) {
world.log().warn("Poll returned with no data\n");
diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp
index efc50bce..982b1141 100644
--- a/src/server/events/Delta.cpp
+++ b/src/server/events/Delta.cpp
@@ -127,7 +127,7 @@ Delta::add_set_event(const char* port_symbol,
BlockImpl* block = dynamic_cast<BlockImpl*>(_object);
PortImpl* port = block->port_by_symbol(port_symbol);
if (!port) {
- _engine.log().warn(fmt("Unknown port `%1%' in state") % port_symbol);
+ _engine.log().warn("Unknown port `%1%' in state", port_symbol);
return;
}
@@ -373,7 +373,7 @@ Delta::pre_process(PreProcessContext& ctx)
lilv_state_emit_port_values(
_state, s_add_set_event, this);
} else {
- _engine.log().warn(fmt("Failed to load preset <%1%>\n") % uri);
+ _engine.log().warn("Failed to load preset <%1%>\n", uri);
}
} else {
_status = Status::BAD_VALUE;
diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp
index 2d1769a0..25ead48e 100644
--- a/src/server/ingen_lv2.cpp
+++ b/src/server/ingen_lv2.cpp
@@ -538,8 +538,8 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
}
plugin->world->log().info(
- fmt("Block: %1% frames, Sequence: %2% bytes\n")
- % block_length % seq_size);
+ "Block: %1% frames, Sequence: %2% bytes\n",
+ block_length, seq_size);
plugin->world->conf().set(
"queue-size",
plugin->world->forge().make(std::max(block_length, seq_size) * 4));
diff --git a/tests/TestClient.hpp b/tests/TestClient.hpp
index e80557f1..b234d7c2 100644
--- a/tests/TestClient.hpp
+++ b/tests/TestClient.hpp
@@ -35,14 +35,14 @@ public:
void message(const Message& msg) override {
if (const Response* const response = boost::get<Response>(&msg)) {
if (response->status != Status::SUCCESS) {
- _log.error(fmt("error on message %1%: %2% (%3%)\n")
- % response->id
- % ingen_status_string(response->status)
- % response->subject);
+ _log.error("error on message %1%: %2% (%3%)\n",
+ response->id,
+ ingen_status_string(response->status),
+ response->subject);
exit(EXIT_FAILURE);
}
} else if (const Error* const error = boost::get<Error>(&msg)) {
- _log.error(fmt("error: %1%\n") % error->message);
+ _log.error("error: %1%\n", error->message);
exit(EXIT_FAILURE);
}
}
diff --git a/tests/ingen_test.cpp b/tests/ingen_test.cpp
index f40499b4..cd86985f 100644
--- a/tests/ingen_test.cpp
+++ b/tests/ingen_test.cpp
@@ -149,7 +149,7 @@ main(int argc, char** argv)
Sord::Node nil;
int n_events = 0;
for (;; ++n_events) {
- std::string subject_str = (fmt("msg%1%") % n_events).str();
+ std::string subject_str = fmt("msg%1%", n_events);
Sord::URI subject(*world->rdf_world(), subject_str,
(const char*)cmds_file_uri.buf);
Sord::Iter iter = cmds->find(subject, nil, nil);
diff --git a/tests/test_utils.hpp b/tests/test_utils.hpp
index a0cc53ac..c8271325 100644
--- a/tests/test_utils.hpp
+++ b/tests/test_utils.hpp
@@ -14,27 +14,27 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <iostream>
+#include "ingen/fmt.hpp"
-#include <boost/format.hpp>
+#include <iostream>
-typedef boost::basic_format<char> fmt;
+using ingen::fmt;
#define EXPECT_TRUE(value) \
if (!(value)) { \
- std::cerr << (fmt("error: %1%:%2%: !%3%\n") % __FILE__ % \
- __LINE__ % (#value)); \
+ std::cerr << fmt("error: %1%:%2%: !%3%\n", \
+ __FILE__, __LINE__, (#value)); \
}
#define EXPECT_FALSE(value) \
if ((value)) { \
- std::cerr << (fmt("error: %1%:%2%: !%3%\n") % __FILE__ % \
- __LINE__ % (#value)); \
+ std::cerr << (fmt("error: %1%:%2%: !%3%\n", \
+ __FILE__, __LINE__, (#value))); \
}
#define EXPECT_EQ(value, expected) \
if (!((value) == (expected))) { \
- std::cerr << (fmt("error: %1%:%2%: %3% != %4%\n") % __FILE__ % \
- __LINE__ % (#value) % (#expected)); \
+ std::cerr << fmt("error: %1%:%2%: %3% != %4%\n", \
+ __FILE__, __LINE__, (#value), (#expected)); \
std::cerr << "note: actual value: " << value << std::endl; \
}