From 0075d1b10c475d303a314a3425ee472252855f32 Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Wed, 19 Nov 2025 04:42:58 +0100 Subject: Python/SQLite refactor - Uses Python/Jinja2 to preprocess C files - Uses SQLite3 for data compression --- src/ui/daemon.c | 63 --------------------------------------------------------- 1 file changed, 63 deletions(-) delete mode 100644 src/ui/daemon.c (limited to 'src/ui/daemon.c') diff --git a/src/ui/daemon.c b/src/ui/daemon.c deleted file mode 100644 index f74713d..0000000 --- a/src/ui/daemon.c +++ /dev/null @@ -1,63 +0,0 @@ -// Project: Salis -// Author: Paul Oliver -// Email: contact@pauloliver.dev - -/* - * Implements a minimal UI for the Salis simulator with minimal output and - * interruptible via OS signals. Ideal for running Salis in the background. - */ - -#include -#include - -volatile bool g_running; -u64 g_step_block; - -void sig_handler(int signo) { - switch (signo) { - case SIGINT: - case SIGTERM: - printf("signal received, stopping simulator...\n"); - g_running = false; - break; - } -} - -void step_block() { - clock_t beg = clock(); - salis_step(g_step_block - (g_steps % g_step_block)); - clock_t end = clock(); - - if ((end - beg) < (CLOCKS_PER_SEC * 4)) { - g_step_block <<= 1; - } - - if ((end - beg) >= (CLOCKS_PER_SEC * 2) && g_step_block != 1) { - g_step_block >>= 1; - } - - printf("simulator running on step '%#lx'\n", g_steps); -} - -int main() { -#if ACTION == ACT_NEW - salis_init(); -#elif ACTION == ACT_LOAD - salis_load(); -#endif - - g_running = true; - g_step_block = 1; - - signal(SIGINT, sig_handler); - signal(SIGTERM, sig_handler); - - while (g_running) { - step_block(); - } - - salis_save(SIM_PATH); - salis_free(); - - return 0; -} -- cgit v1.2.1