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/uci/state.h | 77 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 33 deletions(-) (limited to 'include/uci/state.h') diff --git a/include/uci/state.h b/include/uci/state.h index a1df891..51207f3 100644 --- a/include/uci/state.h +++ b/include/uci/state.h @@ -1,11 +1,12 @@ #ifndef UCI_STATE_H #define UCI_STATE_H -#include -#include "../fen.h" +#include "ipc/go_args.h" +#include "ipc/moves.h" +#include "bitboard.h" typedef struct { - char* data; + char *data; int length; } str_t; @@ -19,7 +20,7 @@ typedef int combo_t; typedef bool button_t; typedef struct { - char** combination; + char **combination; int count; int default_index; } option_combo_setting_t; @@ -36,7 +37,7 @@ typedef struct { option_combo_setting_t combo; option_spin_setting_t spin; bool check_default; - const char* string_default; + const char *string_default; } data; union { combo_t *combo; @@ -47,52 +48,63 @@ typedef struct { } value; } option_setting_t; -option_setting_t option_setting_combo( - char* option_name, - char** combinations, +void option_setting_combo( + option_setting_t *target, + char *option_name, + char **combinations, int combinations_count, int default_index, combo_t *combo ); -option_setting_t option_setting_spin( - const char* option_name, +void option_setting_spin( + option_setting_t *target, + const char *option_name, int min, int max, int default_value, spin_t *spin ); -option_setting_t option_setting_check( - const char* option_name, +void option_setting_check( + option_setting_t *target, + const char *option_name, bool default_value, check_t *check ); -option_setting_t option_setting_string( - const char* option_name, - const char* default_value, +void option_setting_string( + option_setting_t *target, + const char *option_name, + const char *default_value, str_t *string ); -option_setting_t option_setting_button( - const char* option_name, +void option_setting_button( + option_setting_t *target, + const char *option_name, button_t *button ); +void print_setting(option_setting_t setting); + +enum { + UCI_SIGNAL_NONE, + UCI_SIGNAL_QUIT, + UCI_SIGNAL_GO, + UCI_SIGNAL_GO_LOOP, + UCI_SIGNAL_STOP, // game stop, don't stop the program + + UCI_SIGNAL_COUNT +}; typedef struct { + size_t signal; + size_t current_state; + char name[32]; char author[32]; bool debug; - atomic_int go; - atomic_int go_ready_receive; - atomic_int quit; - atomic_int stop; - atomic_int cleanup; - - void* go_args; // TODO: fix the information flow so i don't need to do this trick + go_args_t go_args; position_t position; - struct uci_move *moves; - int moves_count; - - option_setting_t option_settings[11]; + ipc_moves_t *moves; +option_setting_t option_settings[11]; // options spin_t threads; @@ -112,11 +124,10 @@ typedef struct { str_t uci_engineabout; // str_t uci_shredderbasespath; str_t uci_setpositionvalue; -} uci_state; +} uci_state_t; -struct uci_move { - int from; - int to; -}; +void uci_state_init(uci_state_t *state); +void uci_state_deinit(uci_state_t *state); +void apply_option(uci_state_t *state, char *name, char *buffer); #endif // UCI_STATE_H -- cgit v1.2.3