summaryrefslogtreecommitdiff
path: root/src/rwerror.h
diff options
context:
space:
mode:
authorclaude-bot <[email protected]>2026-07-13 12:40:03 +0000
committerclaude-bot <[email protected]>2026-07-13 12:40:03 +0000
commit847962910f0bff071f3bf07c9abb87764fb6cac3 (patch)
treeddcd429e134c7fd5f72ddc97ced175de8d66fcd0 /src/rwerror.h
downloadlibrw-847962910f0bff071f3bf07c9abb87764fb6cac3.tar.gz
librw-847962910f0bff071f3bf07c9abb87764fb6cac3.zip
Import aap/librw @ masterHEADmaster
Snapshot for re3/reVC vendoring, per @lzcnt. Source: https://github.com/aap/librw (master).
Diffstat (limited to 'src/rwerror.h')
-rw-r--r--src/rwerror.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/rwerror.h b/src/rwerror.h
new file mode 100644
index 0000000..2575626
--- /dev/null
+++ b/src/rwerror.h
@@ -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(uint32 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)
+
+}