2020-04-30 16:54:38 +01:00
|
|
|
#include <stdio.h>
|
2016-06-16 23:06:37 +01:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "rwbase.h"
|
|
|
|
#include "rwerror.h"
|
|
|
|
|
|
|
|
namespace rw {
|
|
|
|
|
|
|
|
static Error error;
|
|
|
|
|
|
|
|
void
|
|
|
|
setError(Error *e)
|
|
|
|
{
|
|
|
|
error = *e;
|
|
|
|
}
|
|
|
|
|
|
|
|
Error*
|
|
|
|
getError(Error *e)
|
|
|
|
{
|
|
|
|
*e = error;
|
|
|
|
error.plugin = 0;
|
|
|
|
error.code = 0;
|
|
|
|
return e;
|
|
|
|
}
|
|
|
|
|
2018-07-13 00:09:45 +01:00
|
|
|
#define ECODE(c, s) s
|
2016-06-16 23:06:37 +01:00
|
|
|
|
|
|
|
const char *errstrs[] = {
|
|
|
|
"No error",
|
|
|
|
#include "base.err"
|
|
|
|
};
|
|
|
|
|
|
|
|
#undef ECODE
|
|
|
|
|
|
|
|
char*
|
2018-07-13 00:50:18 +01:00
|
|
|
dbgsprint(uint32 code, ...)
|
2016-06-16 23:06:37 +01:00
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
static char strbuf[512];
|
|
|
|
|
|
|
|
if(code & 0x80000000)
|
|
|
|
code &= ~0x80000000;
|
|
|
|
va_start(ap, code);
|
|
|
|
vsprintf(strbuf, errstrs[code], ap);
|
|
|
|
va_end(ap);
|
|
|
|
return strbuf;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|