summaryrefslogtreecommitdiff
path: root/include/ipc/state.h
diff options
context:
space:
mode:
authorAargh Rai <aargh.rai+git@gmail.com>2026-07-13 21:58:18 +0530
committerAargh Rai <aargh.rai+git@gmail.com>2026-07-13 21:58:18 +0530
commitf8c0dc54e36cc201c657aa12e5a22029b092e1bc (patch)
treea0dd1a42c9681be98a7508c128db0dacacefc2e7 /include/ipc/state.h
parent2e8b78ab0ef01eaacd8094ff839ac93b4451e9c3 (diff)
restructed all the files + uci done now
also broke the symbol analyser in the process, i didn't help much, i had to pull out the pen & paper, but it made a cool graph never the less multithreading was a pain! but it got it in the end fixed the structs naming convention, if it's used outside by other files, it's typedeffed, otherwise it's not fixed the recursive imports issued i had in go_args*, where i was casting it to void* in uci to make it work now response.c doesn't deal with ipc, really happy with that change now every single thing has its own responsibility
Diffstat (limited to 'include/ipc/state.h')
-rw-r--r--include/ipc/state.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/include/ipc/state.h b/include/ipc/state.h
new file mode 100644
index 0000000..6a4455d
--- /dev/null
+++ b/include/ipc/state.h
@@ -0,0 +1,42 @@
+#ifndef IPC_STATE_H
+#define IPC_STATE_H
+
+#include <stdatomic.h>
+
+#include "bitboard.h"
+#include "ipc/moves.h"
+#include "ipc/engine_message.h"
+#include "uci/state.h"
+
+enum {
+ EVENT_INIT,
+ EVENT_STATE_INITIALISED,
+ EVENT_UCI_STATE_INITIALISED,
+ EVENT_UCI_RUNNING,
+ EVENT_UCI_STOP,
+ EVENT_UCI_QUIT,
+ EVENT_ENGINE_GO,
+ EVENT_ENGINE_RUNNING,
+ EVENT_ENGINE_STOP,
+
+ EVENTS_COUNT
+};
+typedef struct {
+ atomic_int event;
+
+ engine_messages_t engine_messages;
+ uci_state_t uci_state;
+
+ // reset on new game
+ position_t from_position;
+ ipc_moves_t moves;
+} ipc_state_t;
+
+void ipc_state_init(ipc_state_t *state);
+void ipc_state_deinit(ipc_state_t *state);
+void ipc_state_game_reset(ipc_state_t *state);
+void ipc_state_wait_for_event(ipc_state_t *state, size_t event);
+bool ipc_state_is_event(ipc_state_t *state, size_t event);
+void ipc_state_set_event(ipc_state_t *state, size_t event);
+
+#endif // IPC_STATE_H