implemented basic error system; restructured some files; replaced a few asserts

This commit is contained in:
aap
2016-06-17 00:06:37 +02:00
parent 416ee91bb7
commit 6e71e34933
14 changed files with 857 additions and 574 deletions

25
src/rwerror.h Normal file
View File

@@ -0,0 +1,25 @@
namespace rw {
struct Error
{
uint32 plugin;
uint32 code;
};
void setError(Error *e);
Error *getError(Error *e);
#define _ERRORCODE(code, ...) code
char *dbgsprint(int32 code, ...);
/* 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); \
}while(0);
}