From 0fb1497a62332e0db45f94b4f195cb37183678cb Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Wed, 3 Dec 2025 22:14:38 +0100 Subject: Improve SQL handling & aggregate memory events (WIP) --- salis.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'salis.py') diff --git a/salis.py b/salis.py index 7c07ff0..5f81f2c 100755 --- a/salis.py +++ b/salis.py @@ -202,13 +202,15 @@ if args.command in ["new"]: arch_path = f"arch/{args.arch}" info("Loading architecture specific variables from:", f"{arch_path}/arch_vars.py") sys.path.append(arch_path) -import arch_vars +from arch_vars import gen_arch_vars +arch_vars = gen_arch_vars(args) if args.command in ["load", "new"]: ui_path = f"ui/{args.ui}" info("Loading UI specific variables from:", f"{ui_path}/ui_vars.py") sys.path.append(ui_path) - import ui_vars + from ui_vars import gen_ui_vars + ui_vars = gen_ui_vars(args) # ------------------------------------------------------------------------------ # Fill in template variables @@ -266,7 +268,7 @@ if args.command in ["load", "new"]: else: warn("Save file compression disabled") - includes.extend(ui_vars.includes) + includes.extend(ui_vars["includes"]) # ------------------------------------------------------------------------------ # Assemble ancestor organism into byte array @@ -293,7 +295,7 @@ if args.command in ["bench", "new"] and args.anc is not None: for line in lines: found = False - for byte, tup in enumerate(arch_vars.inst_set): + for byte, tup in enumerate(arch_vars["inst_set"]): if line == tup[0]: anc_bytes.append(byte) found = True @@ -341,14 +343,13 @@ build_cmd = ["gcc", salis_src, "-o", salis_bin, "-Wall", "-Wextra", "-Werror", " build_cmd.extend(["-O3", "-DNDEBUG"] if args.optimized else ["-ggdb"]) if args.command in ["load", "new"]: - build_cmd.extend(ui_vars.flags) + build_cmd.extend(ui_vars["flags"]) - # Enable POSIX extensions (open_memstream) + # Enable POSIX extensions (open_memstream) if compression is enabled + # This makes it easy to generate compressed data arrays for lzip using + # C's native FILE interface. build_cmd.extend(["-lz", "-D_POSIX_C_SOURCE=200809L"] if args.compress else []) - - # Enable GNU extensions (asprintf) - # This allows managing large SQL strings more easily - build_cmd.extend(["-lsqlite3", "-D_GNU_SOURCE"] if args.data_push_pow != 0 else []) + build_cmd.extend(["-lsqlite3"] if args.data_push_pow != 0 else []) info("Using build command:", " ".join(build_cmd)) subprocess.run(build_cmd, check=True) -- cgit v1.2.1