This commit is contained in:
2026-04-29 23:35:40 +02:00
parent 8165ee20cc
commit be980dbffd
9 changed files with 163 additions and 48 deletions
+16 -4
View File
@@ -1,7 +1,10 @@
#ifndef UTILS_H
#define UTILS_H
//#define DEBUG_RKT_WEBVIEW
#include <string>
#include "rktwebview_global.h"
#include "rktwebview_types.h"
inline std::string basedir(const std::string &path)
@@ -26,11 +29,17 @@ inline std::string basedir(const std::string &path)
}
return r;
}
extern "C" {
#ifdef RKTWEBVIEW_PRG_EXE
#undef RKTWEBVIEW_EXPORT
#define RKTWEBVIEW_EXPORT
#endif
int logLevel();
void setLogLevel(int l);
void logElapsed();
const char *logIndicator(int l);
RKTWEBVIEW_EXPORT int logLevel();
RKTWEBVIEW_EXPORT void setLogLevel(int l);
RKTWEBVIEW_EXPORT void logElapsed();
RKTWEBVIEW_EXPORT const char *logIndicator(int l);
}
#define LOG_ERROR 1
#define LOG_WARNING 2
@@ -41,6 +50,7 @@ const char *logIndicator(int l);
#define MKL0(level, msg) MKLOGSTMT(level, fprintf(stderr, msg))
#define MKL1(level, msg, a) MKLOGSTMT(level, fprintf(stderr, msg, a))
#define MKL2(level, msg, a, b) MKLOGSTMT(level, fprintf(stderr, msg, a, b))
#define MKL3(level, msg, a, b, c) MKLOGSTMT(level, fprintf(stderr, msg, a, b, c))
#define ERROR0(msg) MKL0(LOG_ERROR, msg)
#define WARN0(msg) MKL0(LOG_WARNING, msg)
@@ -57,6 +67,8 @@ const char *logIndicator(int l);
#define INFO2(msg, a, b) MKL2(LOG_INFO, msg, a, b)
#define DEBUG2(msg, a, b) MKL2(LOG_DEBUG, msg, a, b)
#define INFO3(msg, a, b, c) MKL3(LOG_INFO, msg, a, b, c)
inline void do_free_data(rkt_data_t *d)
{
if (d == nullptr) { return; }