diff options
-rw-r--r-- | src/jack.c | 1 | ||||
-rw-r--r-- | src/jalv.c | 1 | ||||
-rw-r--r-- | src/jalv_console.c | 1 | ||||
-rw-r--r-- | src/jalv_internal.h | 33 | ||||
-rw-r--r-- | src/log.c | 7 | ||||
-rw-r--r-- | src/log.h | 54 | ||||
-rw-r--r-- | src/state.c | 1 |
7 files changed, 65 insertions, 33 deletions
@@ -3,6 +3,7 @@ #include "jalv_config.h" #include "jalv_internal.h" +#include "log.h" #include "lv2_evbuf.h" #include "lilv/lilv.h" @@ -7,6 +7,7 @@ #include "jalv_config.h" #include "jalv_internal.h" +#include "log.h" #include "lv2_evbuf.h" #include "worker.h" diff --git a/src/jalv_console.c b/src/jalv_console.c index 943587a..496a9e5 100644 --- a/src/jalv_console.c +++ b/src/jalv_console.c @@ -8,6 +8,7 @@ #include "jalv_config.h" #include "jalv_internal.h" +#include "log.h" #include "lilv/lilv.h" #include "lv2/ui/ui.h" diff --git a/src/jalv_internal.h b/src/jalv_internal.h index 1cc10f4..ce34de6 100644 --- a/src/jalv_internal.h +++ b/src/jalv_internal.h @@ -30,12 +30,9 @@ #include "lv2/urid/urid.h" #include "lv2/worker/worker.h" -#include <stdarg.h> #include <stdbool.h> #include <stdint.h> #include <stdio.h> -#include <stdlib.h> -#include <string.h> #ifdef __clang__ # define REALTIME __attribute__((annotate("realtime"))) @@ -43,12 +40,6 @@ # define REALTIME #endif -#ifdef __GNUC__ -# define JALV_LOG_FUNC(fmt, arg1) __attribute__((format(printf, fmt, arg1))) -#else -# define JALV_LOG_FUNC(fmt, arg1) -#endif - #ifdef __cplusplus extern "C" { #endif @@ -466,6 +457,7 @@ jalv_save(Jalv* jalv, const char* dir); void jalv_save_port_values(Jalv* jalv, SerdWriter* writer, const SerdNode* subject); + char* jalv_make_path(LV2_State_Make_Path_Handle handle, const char* path); @@ -478,29 +470,6 @@ atom_to_turtle(LV2_URID_Unmap* unmap, const SerdNode* predicate, const LV2_Atom* atom); -void -jalv_print_control(Jalv* jalv, const struct Port* port, float value); - -char* -jalv_strdup(const char* str); - -char* -jalv_strjoin(const char* a, const char* b); - -JALV_LOG_FUNC(3, 4) -int -jalv_printf(LV2_Log_Handle handle, LV2_URID type, const char* fmt, ...); - -JALV_LOG_FUNC(3, 0) -int -jalv_vprintf(LV2_Log_Handle handle, LV2_URID type, const char* fmt, va_list ap); - -bool -jalv_ansi_start(FILE* stream, int color); - -void -jalv_ansi_reset(FILE* stream); - #ifdef __cplusplus } // extern "C" #endif @@ -1,11 +1,14 @@ -// Copyright 2007-2016 David Robillard <d@drobilla.net> +// Copyright 2007-2022 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC #define _POSIX_C_SOURCE 200809L +#include "log.h" + #include "jalv_config.h" #include "jalv_internal.h" +#include "lilv/lilv.h" #include "lv2/log/log.h" #include "lv2/urid/urid.h" @@ -16,6 +19,8 @@ #include <stdarg.h> #include <stdbool.h> #include <stdio.h> +#include <stdlib.h> +#include <string.h> void jalv_print_control(Jalv* const jalv, diff --git a/src/log.h b/src/log.h new file mode 100644 index 0000000..a939d3d --- /dev/null +++ b/src/log.h @@ -0,0 +1,54 @@ +// Copyright 2007-2022 David Robillard <d@drobilla.net> +// SPDX-License-Identifier: ISC + +#ifndef JALV_LOG_H +#define JALV_LOG_H + +#include "jalv_internal.h" + +#include "lv2/log/log.h" +#include "lv2/urid/urid.h" + +#include <stdbool.h> +#include <stdio.h> + +#ifdef __GNUC__ +# define JALV_LOG_FUNC(fmt, arg1) __attribute__((format(printf, fmt, arg1))) +#else +# define JALV_LOG_FUNC(fmt, arg1) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// String and log utilities + +void +jalv_print_control(Jalv* jalv, const struct Port* port, float value); + +char* +jalv_strdup(const char* str); + +char* +jalv_strjoin(const char* a, const char* b); + +JALV_LOG_FUNC(3, 4) +int +jalv_printf(LV2_Log_Handle handle, LV2_URID type, const char* fmt, ...); + +JALV_LOG_FUNC(3, 0) +int +jalv_vprintf(LV2_Log_Handle handle, LV2_URID type, const char* fmt, va_list ap); + +bool +jalv_ansi_start(FILE* stream, int color); + +void +jalv_ansi_reset(FILE* stream); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // JALV_LOG_H diff --git a/src/state.c b/src/state.c index c12ed28..b7d8ea3 100644 --- a/src/state.c +++ b/src/state.c @@ -2,6 +2,7 @@ // SPDX-License-Identifier: ISC #include "jalv_internal.h" +#include "log.h" #include "lilv/lilv.h" #include "lv2/atom/forge.h" |