aboutsummaryrefslogtreecommitdiff
path: root/core.j2.c
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2025-11-22 03:03:11 +0100
committerPaul Oliver <contact@pauloliver.dev>2025-11-24 16:49:04 +0100
commitc8fc429d9e5ed8ab0566729003d60ef41f578807 (patch)
treeda0c41a8e2b72ba2f32ee495440793bd73039ccb /core.j2.c
parent0bc672fe6c263b9894af0cd211d006054215c7a9 (diff)
Improves logging system
Diffstat (limited to 'core.j2.c')
-rw-r--r--core.j2.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/core.j2.c b/core.j2.c
index 8aeff5d..64873d8 100644
--- a/core.j2.c
+++ b/core.j2.c
@@ -62,6 +62,11 @@ char g_asav_pbuf[{{ auto_save_name_len }}];
sqlite3 *g_sim_data;
{% endif %}
+// Before invoking salis_init(),
+// each UI must install its own logger functions
+void (*g_info)(const char *fmt, ...);
+void (*g_warn)(const char *fmt, ...);
+
// Forward declarations
// Each architecture must define these
{% if args.command in ["bench", "new"] and anc_bytes is defined %}
@@ -582,12 +587,16 @@ void salis_auto_save() {
assert(rem >= 0);
assert(rem < {{ auto_save_name_len }});
+ g_info("Saving simulation state on step '%#lx'", g_steps);
salis_save(g_asav_pbuf);
}
{% endif %}
{% if args.command in ["bench", "new"] %}
void salis_init() {
+ assert(g_info);
+ assert(g_warn);
+
uint64_t seed = {{ args.seed }};
for (int i = 0; i < {{ args.cores }}; ++i) {