2016-03-20 17:00:00 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* REminiscence - Flashback interpreter
|
2019-10-27 17:00:00 +01:00
|
|
|
* Copyright (C) 2005-2019 Gregory Montoir (cyx@users.sourceforge.net)
|
2015-08-02 18:00:00 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#include <windows.h>
|
|
|
|
#endif
|
2017-06-07 18:00:00 +02:00
|
|
|
#ifdef __ANDROID__
|
|
|
|
#define LOG_TAG "FbJni"
|
|
|
|
#include <android/log.h>
|
|
|
|
#endif
|
|
|
|
#include <stdarg.h>
|
2015-08-02 18:00:00 +02:00
|
|
|
#include "util.h"
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t g_debugMask;
|
|
|
|
|
|
|
|
void debug(uint16_t cm, const char *msg, ...) {
|
|
|
|
char buf[1024];
|
|
|
|
if (cm & g_debugMask) {
|
|
|
|
va_list va;
|
|
|
|
va_start(va, msg);
|
|
|
|
vsprintf(buf, msg, va);
|
|
|
|
va_end(va);
|
2017-06-07 18:00:00 +02:00
|
|
|
fprintf(stdout, "%s\n", buf);
|
2015-08-02 18:00:00 +02:00
|
|
|
fflush(stdout);
|
2017-06-07 18:00:00 +02:00
|
|
|
#ifdef __ANDROID__
|
|
|
|
__android_log_print(ANDROID_LOG_INFO, LOG_TAG, "%s", buf);
|
|
|
|
#endif
|
2015-08-02 18:00:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void error(const char *msg, ...) {
|
|
|
|
char buf[1024];
|
|
|
|
va_list va;
|
|
|
|
va_start(va, msg);
|
|
|
|
vsnprintf(buf, sizeof(buf), msg, va);
|
|
|
|
va_end(va);
|
|
|
|
fprintf(stderr, "ERROR: %s!\n", buf);
|
|
|
|
#ifdef _WIN32
|
|
|
|
MessageBox(0, buf, g_caption, MB_ICONERROR);
|
2017-06-07 18:00:00 +02:00
|
|
|
#endif
|
|
|
|
#ifdef __ANDROID__
|
|
|
|
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "%s", buf);
|
2015-08-02 18:00:00 +02:00
|
|
|
#endif
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void warning(const char *msg, ...) {
|
|
|
|
char buf[1024];
|
|
|
|
va_list va;
|
|
|
|
va_start(va, msg);
|
|
|
|
vsnprintf(buf, sizeof(buf), msg, va);
|
|
|
|
va_end(va);
|
|
|
|
fprintf(stderr, "WARNING: %s!\n", buf);
|
2017-06-07 18:00:00 +02:00
|
|
|
#ifdef __ANDROID__
|
|
|
|
__android_log_print(ANDROID_LOG_WARN, LOG_TAG, "%s", buf);
|
|
|
|
#endif
|
2015-08-02 18:00:00 +02:00
|
|
|
}
|
|
|
|
|