mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
sort locals by debug info order; still likely not sufficient for all the options, but at least marginally better & introduces the sorting path
This commit is contained in:
@@ -779,4 +779,9 @@ internal U64 ring_read(U8 *ring_base, U64 ring_size, U64 ring_pos, void *dst_dat
|
||||
#define ring_write_struct(ring_base, ring_size, ring_pos, ptr) ring_write((ring_base), (ring_size), (ring_pos), (ptr), sizeof(*(ptr)))
|
||||
#define ring_read_struct(ring_base, ring_size, ring_pos, ptr) ring_read((ring_base), (ring_size), (ring_pos), (ptr), sizeof(*(ptr)))
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Sorts
|
||||
|
||||
#define quick_sort(ptr, count, element_size, cmp_function) qsort((ptr), (count), (element_size), (int (*)(const void *, const void *))(cmp_function))
|
||||
|
||||
#endif // BASE_CORE_H
|
||||
|
||||
@@ -955,7 +955,7 @@ df_qsort_compare_cmd_spec__run_counter(DF_CmdSpec **a, DF_CmdSpec **b)
|
||||
internal void
|
||||
df_cmd_spec_array_sort_by_run_counter__in_place(DF_CmdSpecArray array)
|
||||
{
|
||||
qsort(array.v, array.count, sizeof(DF_CmdSpec *), (int (*)(const void *, const void *))df_qsort_compare_cmd_spec__run_counter);
|
||||
quick_sort(array.v, array.count, sizeof(DF_CmdSpec *), df_qsort_compare_cmd_spec__run_counter);
|
||||
}
|
||||
|
||||
internal DF_Handle
|
||||
|
||||
+2
-2
@@ -8966,7 +8966,7 @@ df_autocomp_lister_item_qsort_compare(DF_AutoCompListerItem *a, DF_AutoCompListe
|
||||
internal void
|
||||
df_autocomp_lister_item_array_sort__in_place(DF_AutoCompListerItemArray *array)
|
||||
{
|
||||
qsort(array->v, array->count, sizeof(array->v[0]), (int (*)(const void*, const void*))df_autocomp_lister_item_qsort_compare);
|
||||
quick_sort(array->v, array->count, sizeof(array->v[0]), df_autocomp_lister_item_qsort_compare);
|
||||
}
|
||||
|
||||
internal String8
|
||||
@@ -9568,7 +9568,7 @@ df_cfg_strings_from_gfx(Arena *arena, String8 root_path, DF_CfgSrc source)
|
||||
string_binding_pair_count += 1;
|
||||
}
|
||||
}
|
||||
qsort(string_binding_pairs, string_binding_pair_count, sizeof(DF_StringBindingPair), (int (*)(const void *, const void *))df_qsort_compare__cfg_string_bindings);
|
||||
quick_sort(string_binding_pairs, string_binding_pair_count, sizeof(DF_StringBindingPair), df_qsort_compare__cfg_string_bindings);
|
||||
if(string_binding_pair_count != 0)
|
||||
{
|
||||
str8_list_push(arena, &strs, str8_lit("/// keybindings ///////////////////////////////////////////////////////////////\n"));
|
||||
|
||||
+13
-11
@@ -211,7 +211,7 @@ df_cmd_lister_item_array_from_list(Arena *arena, DF_CmdListerItemList list)
|
||||
internal void
|
||||
df_cmd_lister_item_array_sort_by_strength__in_place(DF_CmdListerItemArray array)
|
||||
{
|
||||
qsort(array.v, array.count, sizeof(DF_CmdListerItem), (int (*)(const void *, const void *))df_qsort_compare_cmd_lister__strength);
|
||||
quick_sort(array.v, array.count, sizeof(DF_CmdListerItem), df_qsort_compare_cmd_lister__strength);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
@@ -314,7 +314,7 @@ df_process_info_array_from_list(Arena *arena, DF_ProcessInfoList list)
|
||||
internal void
|
||||
df_process_info_array_sort_by_strength__in_place(DF_ProcessInfoArray array)
|
||||
{
|
||||
qsort(array.v, array.count, sizeof(DF_ProcessInfo), (int (*)(const void *, const void *))df_qsort_compare_process_info);
|
||||
quick_sort(array.v, array.count, sizeof(DF_ProcessInfo), df_qsort_compare_process_info);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
@@ -366,7 +366,7 @@ df_entity_lister_item_array_from_list(Arena *arena, DF_EntityListerItemList list
|
||||
internal void
|
||||
df_entity_lister_item_array_sort_by_strength__in_place(DF_EntityListerItemArray array)
|
||||
{
|
||||
qsort(array.v, array.count, sizeof(DF_EntityListerItem), (int (*)(const void *, const void *))df_qsort_compare_entity_lister__strength);
|
||||
quick_sort(array.v, array.count, sizeof(DF_EntityListerItem), df_qsort_compare_entity_lister__strength);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
@@ -617,15 +617,17 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *di_scope, F
|
||||
//
|
||||
case DF_WatchViewFillKind_Locals:
|
||||
{
|
||||
U64 num = 1;
|
||||
for(EVAL_String2NumMapNode *n = parse_ctx->locals_map->first; n != 0; n = n->order_next, num += 1)
|
||||
EVAL_String2NumMapNodeArray nodes = eval_string2num_map_node_array_from_map(scratch.arena, parse_ctx->locals_map);
|
||||
eval_string2num_map_node_array_sort__in_place(&nodes);
|
||||
for(U64 idx = 0; idx < nodes.count; idx += 1)
|
||||
{
|
||||
EVAL_String2NumMapNode *n = nodes.v[idx];
|
||||
String8 root_expr_string = n->string;
|
||||
FuzzyMatchRangeList matches = fuzzy_match_find(arena, filter, root_expr_string);
|
||||
if(matches.count == matches.needle_part_count)
|
||||
{
|
||||
DF_ExpandKey parent_key = df_expand_key_make(5381, 0);
|
||||
DF_ExpandKey key = df_expand_key_make(df_hash_from_expand_key(parent_key), num);
|
||||
DF_ExpandKey key = df_expand_key_make(df_hash_from_expand_key(parent_key), idx+1);
|
||||
DF_EvalVizBlockList root_blocks = df_eval_viz_block_list_from_eval_view_expr_keys(arena, di_scope, ctrl_ctx, parse_ctx, macro_map, eval_view, root_expr_string, parent_key, key);
|
||||
df_eval_viz_block_list_concat__in_place(&blocks, &root_blocks);
|
||||
}
|
||||
@@ -2588,24 +2590,24 @@ DF_VIEW_UI_FUNCTION_DEF(FileSystem)
|
||||
{
|
||||
if(path_query.search.size != 0)
|
||||
{
|
||||
qsort(new_files, new_file_count, sizeof(DF_FileInfo), (int (*)(const void *, const void *))df_qsort_compare_file_info__default_filtered);
|
||||
quick_sort(new_files, new_file_count, sizeof(DF_FileInfo), df_qsort_compare_file_info__default_filtered);
|
||||
}
|
||||
else
|
||||
{
|
||||
qsort(new_files, new_file_count, sizeof(DF_FileInfo), (int (*)(const void *, const void *))df_qsort_compare_file_info__default);
|
||||
quick_sort(new_files, new_file_count, sizeof(DF_FileInfo), df_qsort_compare_file_info__default);
|
||||
}
|
||||
}break;
|
||||
case DF_FileSortKind_Filename:
|
||||
{
|
||||
qsort(new_files, new_file_count, sizeof(DF_FileInfo), (int (*)(const void *, const void *))df_qsort_compare_file_info__filename);
|
||||
quick_sort(new_files, new_file_count, sizeof(DF_FileInfo), df_qsort_compare_file_info__filename);
|
||||
}break;
|
||||
case DF_FileSortKind_LastModified:
|
||||
{
|
||||
qsort(new_files, new_file_count, sizeof(DF_FileInfo), (int (*)(const void *, const void *))df_qsort_compare_file_info__last_modified);
|
||||
quick_sort(new_files, new_file_count, sizeof(DF_FileInfo), df_qsort_compare_file_info__last_modified);
|
||||
}break;
|
||||
case DF_FileSortKind_Size:
|
||||
{
|
||||
qsort(new_files, new_file_count, sizeof(DF_FileInfo), (int (*)(const void *, const void *))df_qsort_compare_file_info__size);
|
||||
quick_sort(new_files, new_file_count, sizeof(DF_FileInfo), df_qsort_compare_file_info__size);
|
||||
}break;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ eval_string2num_map_insert(Arena *arena, EVAL_String2NumMap *map, String8 string
|
||||
SLLQueuePush_N(map->first, map->last, node, order_next);
|
||||
node->string = push_str8_copy(arena, string);
|
||||
node->num = num;
|
||||
map->node_count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,6 +122,41 @@ eval_num_from_string(EVAL_String2NumMap *map, String8 string)
|
||||
return num;
|
||||
}
|
||||
|
||||
internal EVAL_String2NumMapNodeArray
|
||||
eval_string2num_map_node_array_from_map(Arena *arena, EVAL_String2NumMap *map)
|
||||
{
|
||||
EVAL_String2NumMapNodeArray result = {0};
|
||||
result.count = map->node_count;
|
||||
result.v = push_array(arena, EVAL_String2NumMapNode *, result.count);
|
||||
U64 idx = 0;
|
||||
for(EVAL_String2NumMapNode *n = map->first; n != 0; n = n->order_next, idx += 1)
|
||||
{
|
||||
result.v[idx] = n;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal int
|
||||
eval_string2num_map_node_qsort_compare__num_ascending(EVAL_String2NumMapNode **a, EVAL_String2NumMapNode **b)
|
||||
{
|
||||
int result = 0;
|
||||
if(a[0]->num < b[0]->num)
|
||||
{
|
||||
result = -1;
|
||||
}
|
||||
else if(a[0]->num > b[0]->num)
|
||||
{
|
||||
result = +1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal void
|
||||
eval_string2num_map_node_array_sort__in_place(EVAL_String2NumMapNodeArray *array)
|
||||
{
|
||||
quick_sort(array->v, array->count, sizeof(array->v[0]), eval_string2num_map_node_qsort_compare__num_ascending);
|
||||
}
|
||||
|
||||
//- rjf: string -> expr
|
||||
|
||||
internal EVAL_String2ExprMap
|
||||
|
||||
@@ -144,6 +144,13 @@ struct EVAL_String2NumMapNode
|
||||
U64 num;
|
||||
};
|
||||
|
||||
typedef struct EVAL_String2NumMapNodeArray EVAL_String2NumMapNodeArray;
|
||||
struct EVAL_String2NumMapNodeArray
|
||||
{
|
||||
EVAL_String2NumMapNode **v;
|
||||
U64 count;
|
||||
};
|
||||
|
||||
typedef struct EVAL_String2NumMapSlot EVAL_String2NumMapSlot;
|
||||
struct EVAL_String2NumMapSlot
|
||||
{
|
||||
@@ -155,6 +162,7 @@ typedef struct EVAL_String2NumMap EVAL_String2NumMap;
|
||||
struct EVAL_String2NumMap
|
||||
{
|
||||
U64 slots_count;
|
||||
U64 node_count;
|
||||
EVAL_String2NumMapSlot *slots;
|
||||
EVAL_String2NumMapNode *first;
|
||||
EVAL_String2NumMapNode *last;
|
||||
@@ -210,6 +218,9 @@ internal void eval_error_list_concat_in_place(EVAL_ErrorList *dst, EVAL_ErrorLis
|
||||
internal EVAL_String2NumMap eval_string2num_map_make(Arena *arena, U64 slot_count);
|
||||
internal void eval_string2num_map_insert(Arena *arena, EVAL_String2NumMap *map, String8 string, U64 num);
|
||||
internal U64 eval_num_from_string(EVAL_String2NumMap *map, String8 string);
|
||||
internal EVAL_String2NumMapNodeArray eval_string2num_map_node_array_from_map(Arena *arena, EVAL_String2NumMap *map);
|
||||
internal int eval_string2num_map_node_qsort_compare__num_ascending(EVAL_String2NumMapNode **a, EVAL_String2NumMapNode **b);
|
||||
internal void eval_string2num_map_node_array_sort__in_place(EVAL_String2NumMapNodeArray *array);
|
||||
|
||||
//- rjf: string -> expr
|
||||
internal EVAL_String2ExprMap eval_string2expr_map_make(Arena *arena, U64 slot_count);
|
||||
|
||||
@@ -517,7 +517,7 @@ fzy_search_thread__entry_point(void *p)
|
||||
//- rjf: sort item array
|
||||
if(items.count != 0 && query.size != 0)
|
||||
{
|
||||
qsort(items.v, items.count, sizeof(FZY_Item), (int (*)(const void *, const void *))fzy_qsort_compare_items);
|
||||
quick_sort(items.v, items.count, sizeof(FZY_Item), fzy_qsort_compare_items);
|
||||
}
|
||||
|
||||
//- rjf: commit to cache - busyloop on scope touches
|
||||
|
||||
@@ -1056,7 +1056,7 @@ tg_data_members_from_graph_rdi_key(Arena *arena, TG_Graph *graph, RDI_Parsed *rd
|
||||
//- rjf: sort array by offset if needed
|
||||
if(members_need_offset_sort)
|
||||
{
|
||||
qsort(members.v, members.count, sizeof(TG_Member), (int (*)(const void *, const void *))tg_qsort_compare_members_offset);
|
||||
quick_sort(members.v, members.count, sizeof(TG_Member), tg_qsort_compare_members_offset);
|
||||
}
|
||||
|
||||
//- rjf: find all padding instances
|
||||
|
||||
Reference in New Issue
Block a user