aboutsummaryrefslogtreecommitdiff
path: root/ui/daemon
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2026-02-24 01:33:45 +0100
committerPaul Oliver <contact@pauloliver.dev>2026-02-24 01:33:45 +0100
commit9f7e70904e6c0fa650323ac5e50ebf6003da333c (patch)
tree3015be498d36e8d5c960cf55667c6c825f7de493 /ui/daemon
parent0fb1497a62332e0db45f94b4f195cb37183678cb (diff)
Removes usage of Jinja templates
Use CPP to pre-process C files instead
Diffstat (limited to 'ui/daemon')
-rw-r--r--ui/daemon/ui.c (renamed from ui/daemon/ui.j2.c)25
-rw-r--r--ui/daemon/ui_vars.py10
2 files changed, 14 insertions, 21 deletions
diff --git a/ui/daemon/ui.j2.c b/ui/daemon/ui.c
index 02df79b..1f6c35c 100644
--- a/ui/daemon/ui.j2.c
+++ b/ui/daemon/ui.c
@@ -1,16 +1,9 @@
-// Author: Paul Oliver <contact@pauloliver.dev>
-// Project: Salis
-
-// Lightweight UI for the Salis simulator with minimal output.
-// Can be interrupted through OS signals.
-// Ideal for running Salis in the background.
-
volatile bool g_running;
-uint64_t g_step_block;
+uint64_t g_step_block;
void info_impl(const char *restrict fmt, ...) {
assert(fmt);
- printf("\033[1;34mINFO:\033[0m ");
+ printf("\033[1;34m[INFO]\033[0m ");
va_list args;
va_start(args, fmt);
@@ -22,7 +15,7 @@ void info_impl(const char *restrict fmt, ...) {
void warn_impl(const char *restrict fmt, ...) {
assert(fmt);
- printf("\033[1;31mWARN:\033[0m ");
+ printf("\033[1;33m[WARN]\033[0m ");
va_list args;
va_start(args, fmt);
@@ -61,16 +54,16 @@ int main() {
g_info = info_impl;
g_warn = warn_impl;
- {% if args.command == "new" %}
+#if defined(COMMAND_NEW)
salis_init();
- {% elif args.command == "load" %}
+#elif defined(COMMAND_LOAD)
salis_load();
- {% endif %}
+#endif
- g_running = true;
+ g_running = true;
g_step_block = 1;
- signal(SIGINT, sig_handler);
+ signal(SIGINT, sig_handler);
signal(SIGTERM, sig_handler);
while (g_running) {
@@ -78,7 +71,7 @@ int main() {
}
g_info("Saving simulation...");
- salis_save("{{ sim_path }}");
+ salis_save(SIM_PATH);
salis_free();
g_info("Exiting salis...");
diff --git a/ui/daemon/ui_vars.py b/ui/daemon/ui_vars.py
index bb6be7c..5b3d372 100644
--- a/ui/daemon/ui_vars.py
+++ b/ui/daemon/ui_vars.py
@@ -1,5 +1,5 @@
-def gen_ui_vars(_):
- return {
- "flags": [],
- "includes": ["signal.h", "stdio.h", "unistd.h"],
- }
+class UIVars:
+ def __init__(self, _):
+ self.includes = {"signal.h", "stdio.h", "unistd.h"}
+ self.defines = set()
+ self.links = set()