From 7a5037a1508e3b84b2f742cda09a044451705d25 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 30 Jul 2016 19:08:26 -0400 Subject: Add lv2_log_logger_set_map() --- lv2/lv2plug.in/ns/ext/log/logger.h | 27 ++++++++++++++++++++------- lv2/lv2plug.in/ns/ext/log/lv2-log.doap.ttl | 9 +++++++++ lv2/lv2plug.in/ns/ext/log/manifest.ttl | 2 +- 3 files changed, 30 insertions(+), 8 deletions(-) (limited to 'lv2/lv2plug.in/ns/ext/log') diff --git a/lv2/lv2plug.in/ns/ext/log/logger.h b/lv2/lv2plug.in/ns/ext/log/logger.h index 62de1ce..0ef28b8 100644 --- a/lv2/lv2plug.in/ns/ext/log/logger.h +++ b/lv2/lv2plug.in/ns/ext/log/logger.h @@ -49,6 +49,25 @@ typedef struct { LV2_URID Warning; } LV2_Log_Logger; +/** + Set `map` as the URI map for `logger`. + + This affects the message type URIDs (Error, Warning, etc) which are passed + to the log's print functions. +*/ +static inline void +lv2_log_logger_set_map(LV2_Log_Logger* logger, LV2_URID_Map* map) +{ + if (map) { + logger->Error = map->map(map->handle, LV2_LOG__Error); + logger->Note = map->map(map->handle, LV2_LOG__Note); + logger->Trace = map->map(map->handle, LV2_LOG__Trace); + logger->Warning = map->map(map->handle, LV2_LOG__Warning); + } else { + logger->Error = logger->Note = logger->Trace = logger->Warning = 0; + } +} + /** Initialise `logger`. @@ -61,14 +80,8 @@ lv2_log_logger_init(LV2_Log_Logger* logger, LV2_URID_Map* map, LV2_Log_Log* log) { - memset(logger, 0, sizeof(LV2_Log_Logger)); logger->log = log; - if (map) { - logger->Error = map->map(map->handle, LV2_LOG__Error); - logger->Note = map->map(map->handle, LV2_LOG__Note); - logger->Trace = map->map(map->handle, LV2_LOG__Trace); - logger->Warning = map->map(map->handle, LV2_LOG__Warning); - } + lv2_log_logger_set_map(logger, map); } /** diff --git a/lv2/lv2plug.in/ns/ext/log/lv2-log.doap.ttl b/lv2/lv2plug.in/ns/ext/log/lv2-log.doap.ttl index 6316b4b..48460a5 100644 --- a/lv2/lv2plug.in/ns/ext/log/lv2-log.doap.ttl +++ b/lv2/lv2plug.in/ns/ext/log/lv2-log.doap.ttl @@ -11,6 +11,15 @@ doap:created "2012-01-12" ; doap:developer ; doap:release [ + doap:revision "2.3" ; + doap:created "2016-07-30" ; + dcs:blame ; + dcs:changeset [ + dcs:item [ + rdfs:label "Add lv2_log_logger_set_map() for changing the URI map of an existing logger." + ] + ] + ] , [ doap:revision "2.2" ; doap:created "2014-01-04" ; doap:file-release ; diff --git a/lv2/lv2plug.in/ns/ext/log/manifest.ttl b/lv2/lv2plug.in/ns/ext/log/manifest.ttl index ecace58..1af8084 100644 --- a/lv2/lv2plug.in/ns/ext/log/manifest.ttl +++ b/lv2/lv2plug.in/ns/ext/log/manifest.ttl @@ -4,6 +4,6 @@ a lv2:Specification ; lv2:minorVersion 2 ; - lv2:microVersion 2 ; + lv2:microVersion 3 ; rdfs:seeAlso . -- cgit v1.2.1