mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-16 00:52:23 -07:00
eliminate old config code
This commit is contained in:
@@ -51,78 +51,6 @@ rd_handle_list_copy(Arena *arena, RD_HandleList list)
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Config Type Functions
|
||||
|
||||
internal void
|
||||
rd_cfg_table_push_unparsed_string(Arena *arena, RD_CfgTable *table, String8 string, RD_CfgSrc source)
|
||||
{
|
||||
if(table->slot_count == 0)
|
||||
{
|
||||
table->slot_count = 64;
|
||||
table->slots = push_array(arena, RD_CfgSlot, table->slot_count);
|
||||
}
|
||||
MD_TokenizeResult tokenize = md_tokenize_from_text(arena, string);
|
||||
MD_ParseResult parse = md_parse_from_text_tokens(arena, str8_lit(""), string, tokenize.tokens);
|
||||
for MD_EachNode(tln, parse.root->first) if(tln->string.size != 0)
|
||||
{
|
||||
// rjf: map string -> hash*slot
|
||||
String8 string = str8(tln->string.str, tln->string.size);
|
||||
U64 hash = d_hash_from_string__case_insensitive(string);
|
||||
U64 slot_idx = hash % table->slot_count;
|
||||
RD_CfgSlot *slot = &table->slots[slot_idx];
|
||||
|
||||
// rjf: find existing value for this string
|
||||
RD_CfgVal *val = 0;
|
||||
for(RD_CfgVal *v = slot->first; v != 0; v = v->hash_next)
|
||||
{
|
||||
if(str8_match(v->string, string, StringMatchFlag_CaseInsensitive))
|
||||
{
|
||||
val = v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: create new value if needed
|
||||
if(val == 0)
|
||||
{
|
||||
val = push_array(arena, RD_CfgVal, 1);
|
||||
val->string = push_str8_copy(arena, string);
|
||||
val->insertion_stamp = table->insertion_stamp_counter;
|
||||
SLLStackPush_N(slot->first, val, hash_next);
|
||||
SLLQueuePush_N(table->first_val, table->last_val, val, linear_next);
|
||||
table->insertion_stamp_counter += 1;
|
||||
}
|
||||
|
||||
// rjf: create new node within this value
|
||||
RD_CfgTree *tree = push_array(arena, RD_CfgTree, 1);
|
||||
SLLQueuePush_NZ(&d_nil_cfg_tree, val->first, val->last, tree, next);
|
||||
tree->source = source;
|
||||
tree->root = md_tree_copy(arena, tln);
|
||||
}
|
||||
}
|
||||
|
||||
internal RD_CfgVal *
|
||||
rd_cfg_val_from_string(RD_CfgTable *table, String8 string)
|
||||
{
|
||||
RD_CfgVal *result = &d_nil_cfg_val;
|
||||
if(table->slot_count != 0)
|
||||
{
|
||||
U64 hash = d_hash_from_string__case_insensitive(string);
|
||||
U64 slot_idx = hash % table->slot_count;
|
||||
RD_CfgSlot *slot = &table->slots[slot_idx];
|
||||
for(RD_CfgVal *val = slot->first; val != 0; val = val->hash_next)
|
||||
{
|
||||
if(str8_match(val->string, string, StringMatchFlag_CaseInsensitive))
|
||||
{
|
||||
result = val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Registers Type Functions
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ struct RD_HandleList
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Binding Types
|
||||
//~ rjf: Key Binding Types
|
||||
|
||||
typedef struct RD_Binding RD_Binding;
|
||||
struct RD_Binding
|
||||
@@ -287,45 +287,7 @@ enum
|
||||
#include "generated/raddbg.meta.h"
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Config Types
|
||||
|
||||
typedef struct RD_CfgTree RD_CfgTree;
|
||||
struct RD_CfgTree
|
||||
{
|
||||
RD_CfgTree *next;
|
||||
RD_CfgSrc source;
|
||||
MD_Node *root;
|
||||
};
|
||||
|
||||
typedef struct RD_CfgVal RD_CfgVal;
|
||||
struct RD_CfgVal
|
||||
{
|
||||
RD_CfgVal *hash_next;
|
||||
RD_CfgVal *linear_next;
|
||||
RD_CfgTree *first;
|
||||
RD_CfgTree *last;
|
||||
U64 insertion_stamp;
|
||||
String8 string;
|
||||
};
|
||||
|
||||
typedef struct RD_CfgSlot RD_CfgSlot;
|
||||
struct RD_CfgSlot
|
||||
{
|
||||
RD_CfgVal *first;
|
||||
};
|
||||
|
||||
typedef struct RD_CfgTable RD_CfgTable;
|
||||
struct RD_CfgTable
|
||||
{
|
||||
U64 slot_count;
|
||||
RD_CfgSlot *slots;
|
||||
U64 insertion_stamp_counter;
|
||||
RD_CfgVal *first_val;
|
||||
RD_CfgVal *last_val;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: New Config/Entity Data Structure
|
||||
//~ rjf: Config Tree
|
||||
|
||||
typedef struct RD_Cfg RD_Cfg;
|
||||
struct RD_Cfg
|
||||
@@ -981,9 +943,6 @@ struct RD_State
|
||||
|
||||
read_only global RD_VocabularyInfo rd_nil_vocabulary_info = {0};
|
||||
|
||||
read_only global RD_CfgTree d_nil_cfg_tree = {&d_nil_cfg_tree, RD_CfgSrc_User, &md_nil_node};
|
||||
read_only global RD_CfgVal d_nil_cfg_val = {&d_nil_cfg_val, &d_nil_cfg_val, &d_nil_cfg_tree, &d_nil_cfg_tree};
|
||||
|
||||
read_only global RD_Cfg rd_nil_cfg =
|
||||
{
|
||||
&rd_nil_cfg,
|
||||
@@ -1055,12 +1014,6 @@ internal void rd_handle_list_push_node(RD_HandleList *list, RD_HandleNode *node)
|
||||
internal void rd_handle_list_push(Arena *arena, RD_HandleList *list, RD_Handle handle);
|
||||
internal RD_HandleList rd_handle_list_copy(Arena *arena, RD_HandleList list);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Config Type Pure Functions
|
||||
|
||||
internal void rd_cfg_table_push_unparsed_string(Arena *arena, RD_CfgTable *table, String8 string, RD_CfgSrc source);
|
||||
internal RD_CfgVal *rd_cfg_val_from_string(RD_CfgTable *table, String8 string);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Registers Type Functions
|
||||
|
||||
|
||||
@@ -144,18 +144,6 @@ struct RD_WatchPt
|
||||
U64 cell_id;
|
||||
};
|
||||
|
||||
typedef struct RD_WatchViewRowInfo RD_WatchViewRowInfo;
|
||||
struct RD_WatchViewRowInfo
|
||||
{
|
||||
RD_EntityKind collection_entity_kind;
|
||||
RD_Entity *collection_entity;
|
||||
CTRL_EntityKind collection_ctrl_entity_kind;
|
||||
CTRL_Entity *collection_ctrl_entity;
|
||||
CTRL_Entity *callstack_thread;
|
||||
U64 callstack_unwind_index;
|
||||
U64 callstack_inline_depth;
|
||||
};
|
||||
|
||||
typedef struct RD_WatchViewTextEditState RD_WatchViewTextEditState;
|
||||
struct RD_WatchViewTextEditState
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user