diff options
author | David Robillard <d@drobilla.net> | 2016-07-30 19:08:26 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2016-07-31 14:24:20 -0400 |
commit | 7a5037a1508e3b84b2f742cda09a044451705d25 (patch) | |
tree | cb23094fde71b7737675280bc870ac109942fa22 /lv2 | |
parent | fdeaa14f4078d9eab71fcf38d69010936afd77f7 (diff) | |
download | lv2-7a5037a1508e3b84b2f742cda09a044451705d25.tar.xz |
Add lv2_log_logger_set_map()
Diffstat (limited to 'lv2')
-rw-r--r-- | lv2/lv2plug.in/ns/ext/log/logger.h | 27 | ||||
-rw-r--r-- | lv2/lv2plug.in/ns/ext/log/lv2-log.doap.ttl | 9 | ||||
-rw-r--r-- | lv2/lv2plug.in/ns/ext/log/manifest.ttl | 2 |
3 files changed, 30 insertions, 8 deletions
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 @@ -50,6 +50,25 @@ typedef struct { } 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`. URIs will be mapped using `map` and stored, a reference to `map` itself is @@ -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 <http://drobilla.net/drobilla#me> ; doap:release [ + doap:revision "2.3" ; + doap:created "2016-07-30" ; + dcs:blame <http://drobilla.net/drobilla#me> ; + 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 <http://lv2plug.in/spec/lv2-1.8.0.tar.bz2> ; 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 @@ <http://lv2plug.in/ns/ext/log> a lv2:Specification ; lv2:minorVersion 2 ; - lv2:microVersion 2 ; + lv2:microVersion 3 ; rdfs:seeAlso <log.ttl> . |