2016-06-16 23:06:37 +01:00
|
|
|
namespace rw {
|
|
|
|
|
|
|
|
struct Error
|
|
|
|
{
|
|
|
|
uint32 plugin;
|
|
|
|
uint32 code;
|
|
|
|
};
|
|
|
|
|
|
|
|
void setError(Error *e);
|
|
|
|
Error *getError(Error *e);
|
|
|
|
|
|
|
|
#define _ERRORCODE(code, ...) code
|
2018-07-13 00:50:18 +01:00
|
|
|
char *dbgsprint(uint32 code, ...);
|
2016-06-16 23:06:37 +01:00
|
|
|
|
|
|
|
/* ecode is supposed to be in format "(errorcode, printf-arguments..)" */
|
|
|
|
#define RWERROR(ecode) do{ \
|
|
|
|
rw::Error _e; \
|
|
|
|
_e.plugin = PLUGIN_ID; \
|
|
|
|
_e.code = _ERRORCODE ecode; \
|
|
|
|
fprintf(stderr, "%s:%d: ", __FILE__, __LINE__); \
|
|
|
|
fprintf(stderr, "%s\n", rw::dbgsprint ecode); \
|
|
|
|
rw::setError(&_e); \
|
2017-08-09 09:57:32 +01:00
|
|
|
}while(0)
|
2016-06-16 23:06:37 +01:00
|
|
|
|
|
|
|
}
|