aboutsummaryrefslogtreecommitdiff
path: root/core/salis.c
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2026-06-16 23:00:21 +0200
committerPaul Oliver <contact@pauloliver.dev>2026-06-16 23:05:04 +0200
commit00a0cb3821ce2bd0fc589ae64ed9cbb791ce44bb (patch)
tree62eef257fb06ea36ea92e719dff750bede0bd281 /core/salis.c
parentbb52acc8b7ad073068c9a2dc656d4fecf935d710 (diff)
Adds index to all large filesHEADmaster
Diffstat (limited to 'core/salis.c')
-rw-r--r--core/salis.c45
1 files changed, 34 insertions, 11 deletions
diff --git a/core/salis.c b/core/salis.c
index 3740f3c..9f9a3d0 100644
--- a/core/salis.c
+++ b/core/salis.c
@@ -1,3 +1,19 @@
+// index
+// [section] includes
+// [section] macros & enums
+// [section] structs
+// [section] globals
+// [section] architecture forward declarations
+// [section] memory vector functions
+// [section] mutator functions
+// [section] process functions
+// [section] core functions
+// [section] salis functions
+// [section] architecture & ui includes
+
+// ----------------------------------------------------------------------------
+// [section] includes
+// ----------------------------------------------------------------------------
#include <assert.h>
#include <sqlite3.h>
#include <stdbool.h>
@@ -12,6 +28,9 @@
#include "compress.c"
#include "sql.c"
+// ----------------------------------------------------------------------------
+// [section] macros & enums
+// ----------------------------------------------------------------------------
#define INST_CAP 0x80
#define INST_MASK 0x7f
#define IPC_FLAG 0x80
@@ -24,6 +43,9 @@
EVENT_ARRAY(core, 2, bev) /* birth events array */
#define EVENT_ARRAYS_COUNT 3
+// ----------------------------------------------------------------------------
+// [section] structs
+// ----------------------------------------------------------------------------
struct Proc {
#define PROC_FIELD(type, name) type name;
PROC_FIELDS
@@ -71,7 +93,9 @@ struct Core {
uint8_t tgap[THREAD_GAP];
};
-// Globals
+// ----------------------------------------------------------------------------
+// [section] globals
+// ----------------------------------------------------------------------------
struct Core g_cores[CORES];
uint64_t g_steps;
uint64_t g_syncs;
@@ -84,7 +108,9 @@ char g_asav_pbuf[AUTOSAVE_NAME_LEN];
thrd_t g_eva_thrds[CORES][EVENT_ARRAYS_COUNT];
struct DeflateParams g_eva_deflate_params[CORES][EVENT_ARRAYS_COUNT];
-// Each architecture must define these functions
+// ----------------------------------------------------------------------------
+// [section] architecture forward declarations
+// ----------------------------------------------------------------------------
#if defined(COMMAND_NEW)
void arch_core_init(struct Core *core);
#endif
@@ -122,7 +148,7 @@ void arch_push_data_header(void);
void arch_push_data_line(void);
// ----------------------------------------------------------------------------
-// Memory vector functions
+// [section] memory vector functions
// ----------------------------------------------------------------------------
#if defined(MVEC_LOOP)
uint64_t mvec_loop(uint64_t addr) {
@@ -282,7 +308,7 @@ uint64_t mvec_get_owner(const struct Core *core, uint64_t addr) {
}
// ----------------------------------------------------------------------------
-// Mutator functions
+// [section] mutator functions
// ----------------------------------------------------------------------------
#if defined(COMMAND_NEW)
uint64_t muta_smix(uint64_t *seed) {
@@ -333,7 +359,7 @@ void muta_cosmic_ray(struct Core *core) {
}
// ----------------------------------------------------------------------------
-// Process functions
+// [section] process functions
// ----------------------------------------------------------------------------
void proc_new(struct Core *core, const struct Proc *proc) {
assert(core);
@@ -402,7 +428,7 @@ struct Proc *proc_fetch(struct Core *core, uint64_t pix) {
}
// ----------------------------------------------------------------------------
-// Core functions
+// [section] core functions
// ----------------------------------------------------------------------------
#if defined(COMMAND_NEW) || defined(COMMAND_LOAD)
void core_save(FILE *f, const struct Core *core) {
@@ -621,7 +647,7 @@ void core_step(struct Core *core) {
}
// ----------------------------------------------------------------------------
-// Main salis functions
+// [section] salis functions
// ----------------------------------------------------------------------------
#if defined(COMMAND_NEW) || defined(COMMAND_LOAD)
void salis_save(const char *path) {
@@ -1071,13 +1097,10 @@ void salis_free(void) {
}
// ----------------------------------------------------------------------------
-// Architecture
+// [section] architecture & ui includes
// ----------------------------------------------------------------------------
#include "arch.c"
-// ----------------------------------------------------------------------------
-// UI
-// ----------------------------------------------------------------------------
#if defined(COMMAND_NEW) || defined(COMMAND_LOAD)
#include "ui.c"
#endif