From f8c0dc54e36cc201c657aa12e5a22029b092e1bc Mon Sep 17 00:00:00 2001 From: Aargh Rai Date: Mon, 13 Jul 2026 21:58:18 +0530 Subject: 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 --- include/ipc/engine_message.h | 67 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 include/ipc/engine_message.h (limited to 'include/ipc/engine_message.h') diff --git a/include/ipc/engine_message.h b/include/ipc/engine_message.h new file mode 100644 index 0000000..a651bc2 --- /dev/null +++ b/include/ipc/engine_message.h @@ -0,0 +1,67 @@ +#ifndef ENGINE_MESSAGE_H +#define ENGINE_MESSAGE_H + +#include "ipc/moves.h" +#include + +typedef struct engine_message { + atomic_int ready; + + int depth; + int seldepth; + int multipv; + int score_cp; + int nodes; + int nps; + int hashfull; + int tbhits; + int time; + + int mate; + bool node_limit; + ipc_moves_t pv; + + ipc_move_t best_move; + ipc_move_t ponder; + + struct engine_message *next; +} engine_message_t; + +typedef struct { + engine_message_t *oldest_valid; + engine_message_t *newest_valid; + int count; + + // mainly for debugging purposes + int popped_count; + int pushed_count; + +} engine_message_handler_t; + +typedef struct { + engine_message_handler_t **data; + int count; + int capacity; +} engine_messages_t; + +void engine_message_handler_init(engine_message_handler_t *handle); +void engine_message_handler_acquire(engine_message_handler_t *handle); +void engine_message_handler_release(engine_message_handler_t *handle); +bool engine_message_handler_can_pop(engine_message_handler_t *handle); +engine_message_t *engine_message_handler_pop( + engine_message_handler_t *handle +); +engine_message_t *engine_message_handler_push( + engine_message_handler_t *handle +); + +void engine_messages_init(engine_messages_t *messages); +void engine_messages_deinit(engine_messages_t *messages); + +void engine_message_init(engine_message_t *message); +void engine_messages_refresh(engine_messages_t *messages); +void engine_message_mark_ready(engine_message_t *message); +bool engine_message_is_ready(engine_message_t *message); +void engine_message_deinit(engine_message_t *message); + +#endif // ENGINE_MESSAGE_H -- cgit v1.2.3