summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/lcq/pit/runtime.h1
-rw-r--r--src/runtime.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/include/lcq/pit/runtime.h b/include/lcq/pit/runtime.h
index 1cf8549..7fada2b 100644
--- a/include/lcq/pit/runtime.h
+++ b/include/lcq/pit/runtime.h
@@ -110,6 +110,7 @@ bool pit_runtime_print_error(pit_runtime *rt); /* return true if an error has oc
i64 pit_dump(pit_runtime *rt, char *buf, i64 len, pit_value v, bool readable); /* if readable is true, try to produce output that can be machine-read (quotes on strings, etc) */
#define pit_trace(rt, v) pit_trace_(rt, "Trace [" __FILE__ ":" PIT_STR(__LINE__) "] %s\n", v)
void pit_trace_(pit_runtime *rt, char *format, pit_value v);
+pit_value pit_get_error(pit_runtime *rt);
void pit_error(pit_runtime *rt, char *format, ...);
/* working with small values */
diff --git a/src/runtime.c b/src/runtime.c
index 7c15a0a..4088c4b 100644
--- a/src/runtime.c
+++ b/src/runtime.c
@@ -155,6 +155,10 @@ i64 pit_dump(pit_runtime *rt, char *buf, i64 len, pit_value v, bool readable) {
return 0;
}
+pit_value pit_get_error(pit_runtime *rt) {
+ return rt->error;
+}
+
void pit_error(pit_runtime *rt, char *format, ...) {
if (rt->error == PIT_NIL) { /* only record the first error encountered */
char buf[1024] = {0};