From c16e21db71073ba1cdd3813535b9d05110c2acf8 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Mon, 26 Aug 2024 14:27:51 -0700 Subject: [PATCH] eliminate dead code --- src/df/core/df_core.c | 170 ---------------------------------- src/df/core/df_core.h | 46 --------- src/df/gfx/df_view_rules.h | 18 ---- src/file_stream/file_stream.c | 42 --------- src/ui/ui_core.c | 8 -- 5 files changed, 284 deletions(-) diff --git a/src/df/core/df_core.c b/src/df/core/df_core.c index e483a367..0eae2e46 100644 --- a/src/df/core/df_core.c +++ b/src/df/core/df_core.c @@ -355,66 +355,6 @@ df_expand_set_expansion(Arena *arena, DF_ExpandTreeTable *table, DF_ExpandKey pa //////////////////////////////// //~ rjf: Config Type Functions -#if 0 -internal DF_CfgNode * -df_cfg_tree_copy(Arena *arena, DF_CfgNode *src_root) -{ - DF_CfgNode *dst_root = &df_g_nil_cfg_tree; - DF_CfgNode *dst_parent = dst_root; - { - DF_CfgNodeRec rec = {0}; - for(DF_CfgNode *src = src_root; src != &df_g_nil_cfg_node; src = rec.next) - { - DF_CfgNode *dst = push_array(arena, DF_CfgNode, 1); - dst->first = dst->last = dst->parent = dst->next = &df_g_nil_cfg_node; - dst->flags = src->flags; - dst->string = push_str8_copy(arena, src->string); - dst->source = src->source; - dst->parent = dst_parent; - if(dst_parent != &df_g_nil_cfg_node) - { - SLLQueuePush_NZ(&df_g_nil_cfg_node, dst_parent->first, dst_parent->last, dst, next); - } - else - { - dst_root = dst_parent = dst; - } - rec = df_cfg_node_rec__depth_first_pre(src, src_root); - if(rec.push_count != 0) - { - dst_parent = dst; - } - else for(U64 idx = 0; idx < rec.pop_count; idx += 1) - { - dst_parent = dst_parent->parent; - } - } - } - return dst_root; -} - -internal DF_CfgNodeRec -df_cfg_node_rec__depth_first_pre(DF_CfgNode *node, DF_CfgNode *root) -{ - DF_CfgNodeRec rec = {0}; - rec.next = &df_g_nil_cfg_node; - if(node->first != &df_g_nil_cfg_node) - { - rec.next = node->first; - rec.push_count = 1; - } - else for(DF_CfgNode *p = node; p != &df_g_nil_cfg_node && p != root; p = p->parent, rec.pop_count += 1) - { - if(p->next != &df_g_nil_cfg_node) - { - rec.next = p->next; - break; - } - } - return rec; -} -#endif - internal DF_CfgTree * df_cfg_tree_copy(Arena *arena, DF_CfgTree *src) { @@ -532,116 +472,6 @@ df_cfg_val_from_string(DF_CfgTable *table, String8 string) return result; } -#if 0 -internal DF_CfgNode * -df_cfg_node_child_from_string(DF_CfgNode *node, String8 string, StringMatchFlags flags) -{ - DF_CfgNode *result = &df_g_nil_cfg_node; - for(DF_CfgNode *child = node->first; child != &df_g_nil_cfg_node; child = child->next) - { - if(str8_match(child->string, string, flags)) - { - result = child; - break; - } - } - return result; -} - -internal DF_CfgNode * -df_first_cfg_node_child_from_flags(DF_CfgNode *node, DF_CfgNodeFlags flags) -{ - DF_CfgNode *result = &df_g_nil_cfg_node; - for(DF_CfgNode *child = node->first; child != &df_g_nil_cfg_node; child = child->next) - { - if(child->flags & flags) - { - result = child; - break; - } - } - return result; -} - -internal String8 -df_string_from_cfg_node_children(Arena *arena, DF_CfgNode *node) -{ - Temp scratch = scratch_begin(&arena, 1); - String8List strs = {0}; - for(DF_CfgNode *child = node->first; child != &df_g_nil_cfg_node; child = child->next) - { - str8_list_push(scratch.arena, &strs, child->string); - } - String8 result = str8_list_join(arena, &strs, 0); - scratch_end(scratch); - return result; -} - -internal Vec4F32 -df_hsva_from_cfg_node(DF_CfgNode *node) -{ - Vec4F32 result = {0}; - DF_CfgNode *hsva = df_cfg_node_child_from_string(node, str8_lit("hsva"), StringMatchFlag_CaseInsensitive); - DF_CfgNode *rgba = df_cfg_node_child_from_string(node, str8_lit("rgba"), StringMatchFlag_CaseInsensitive); - DF_CfgNode *hsv = df_cfg_node_child_from_string(node, str8_lit("hsv"), StringMatchFlag_CaseInsensitive); - DF_CfgNode *rgb = df_cfg_node_child_from_string(node, str8_lit("rgb"), StringMatchFlag_CaseInsensitive); - if(hsva != &df_g_nil_cfg_node) - { - DF_CfgNode *hue = hsva->first; - DF_CfgNode *sat = hue->next; - DF_CfgNode *val = sat->next; - DF_CfgNode *alp = val->next; - F32 hue_f32 = (F32)f64_from_str8(hue->string); - F32 sat_f32 = (F32)f64_from_str8(sat->string); - F32 val_f32 = (F32)f64_from_str8(val->string); - F32 alp_f32 = (F32)f64_from_str8(alp->string); - result = v4f32(hue_f32, sat_f32, val_f32, alp_f32); - } - else if(hsv != &df_g_nil_cfg_node) - { - DF_CfgNode *hue = hsva->first; - DF_CfgNode *sat = hue->next; - DF_CfgNode *val = sat->next; - F32 hue_f32 = (F32)f64_from_str8(hue->string); - F32 sat_f32 = (F32)f64_from_str8(sat->string); - F32 val_f32 = (F32)f64_from_str8(val->string); - result = v4f32(hue_f32, sat_f32, val_f32, 1.f); - } - else if(rgba != &df_g_nil_cfg_node) - { - DF_CfgNode *red = rgba->first; - DF_CfgNode *grn = red->next; - DF_CfgNode *blu = grn->next; - DF_CfgNode *alp = blu->next; - F32 red_f32 = (F32)f64_from_str8(red->string); - F32 grn_f32 = (F32)f64_from_str8(grn->string); - F32 blu_f32 = (F32)f64_from_str8(blu->string); - F32 alp_f32 = (F32)f64_from_str8(alp->string); - Vec3F32 hsv = hsv_from_rgb(v3f32(red_f32, grn_f32, blu_f32)); - result = v4f32(hsv.x, hsv.y, hsv.z, alp_f32); - } - else if(rgb != &df_g_nil_cfg_node) - { - DF_CfgNode *red = rgba->first; - DF_CfgNode *grn = red->next; - DF_CfgNode *blu = grn->next; - F32 red_f32 = (F32)f64_from_str8(red->string); - F32 grn_f32 = (F32)f64_from_str8(grn->string); - F32 blu_f32 = (F32)f64_from_str8(blu->string); - Vec3F32 hsv = hsv_from_rgb(v3f32(red_f32, grn_f32, blu_f32)); - result = v4f32(hsv.x, hsv.y, hsv.z, 1.f); - } - return result; -} - -internal String8 -df_string_from_cfg_node_key(DF_CfgNode *node, String8 key, StringMatchFlags flags) -{ - DF_CfgNode *child = df_cfg_node_child_from_string(node, key, flags); - return child->first->string; -} -#endif - //////////////////////////////// //~ rjf: Debug Info Extraction Type Pure Functions diff --git a/src/df/core/df_core.h b/src/df/core/df_core.h index 2e6e4aab..b5803ce0 100644 --- a/src/df/core/df_core.h +++ b/src/df/core/df_core.h @@ -203,28 +203,6 @@ typedef DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_SIG(DF_CoreViewRuleVizBlockPro //////////////////////////////// //~ rjf: Config Types -#if 0 -typedef U32 DF_CfgNodeFlags; -enum -{ - DF_CfgNodeFlag_Identifier = (1<<0), - DF_CfgNodeFlag_Numeric = (1<<1), - DF_CfgNodeFlag_StringLiteral = (1<<2), -}; - -typedef struct DF_CfgNode DF_CfgNode; -struct DF_CfgNode -{ - DF_CfgNode *first; - DF_CfgNode *last; - DF_CfgNode *parent; - DF_CfgNode *next; - DF_CfgNodeFlags flags; - String8 string; - DF_CfgSrc source; -}; -#endif - typedef struct DF_CfgTree DF_CfgTree; struct DF_CfgTree { @@ -233,16 +211,6 @@ struct DF_CfgTree MD_Node *root; }; -#if 0 -typedef struct DF_CfgNodeRec DF_CfgNodeRec; -struct DF_CfgNodeRec -{ - DF_CfgNode *next; - S32 push_count; - S32 pop_count; -}; -#endif - typedef struct DF_CfgVal DF_CfgVal; struct DF_CfgVal { @@ -1240,9 +1208,6 @@ struct DF_State read_only global DF_CmdSpec df_g_nil_cmd_spec = {0}; read_only global DF_CoreViewRuleSpec df_g_nil_core_view_rule_spec = {0}; -#if 0 -read_only global DF_CfgNode df_g_nil_cfg_node = {&df_g_nil_cfg_node, &df_g_nil_cfg_node, &df_g_nil_cfg_node, &df_g_nil_cfg_node}; -#endif read_only global DF_CfgTree df_g_nil_cfg_tree = {&df_g_nil_cfg_tree, DF_CfgSrc_User, &md_nil_node}; read_only global DF_CfgVal df_g_nil_cfg_val = {&df_g_nil_cfg_val, &df_g_nil_cfg_val, &df_g_nil_cfg_tree, &df_g_nil_cfg_tree}; read_only global DF_CfgTable df_g_nil_cfg_table = {0, 0, 0, &df_g_nil_cfg_val, &df_g_nil_cfg_val}; @@ -1340,22 +1305,11 @@ internal void df_expand_set_expansion(Arena *arena, DF_ExpandTreeTable *table, D //////////////////////////////// //~ rjf: Config Type Pure Functions -#if 0 -internal DF_CfgNode *df_cfg_tree_copy(Arena *arena, DF_CfgNode *src_root); -internal DF_CfgNodeRec df_cfg_node_rec__depth_first_pre(DF_CfgNode *node, DF_CfgNode *root); -#endif internal DF_CfgTree *df_cfg_tree_copy(Arena *arena, DF_CfgTree *src); internal void df_cfg_table_push_unparsed_string(Arena *arena, DF_CfgTable *table, String8 string, DF_CfgSrc source); internal DF_CfgTable df_cfg_table_from_inheritance(Arena *arena, DF_CfgTable *src); internal DF_CfgTable df_cfg_table_copy(Arena *arena, DF_CfgTable *src); internal DF_CfgVal *df_cfg_val_from_string(DF_CfgTable *table, String8 string); -#if 0 -internal DF_CfgNode *df_cfg_node_child_from_string(DF_CfgNode *node, String8 string, StringMatchFlags flags); -internal DF_CfgNode *df_first_cfg_node_child_from_flags(DF_CfgNode *node, DF_CfgNodeFlags flags); -internal String8 df_string_from_cfg_node_children(Arena *arena, DF_CfgNode *node); -internal Vec4F32 df_hsva_from_cfg_node(DF_CfgNode *node); -internal String8 df_string_from_cfg_node_key(DF_CfgNode *node, String8 key, StringMatchFlags flags); -#endif //////////////////////////////// //~ rjf: Debug Info Extraction Type Pure Functions diff --git a/src/df/gfx/df_view_rules.h b/src/df/gfx/df_view_rules.h index 97341317..29836675 100644 --- a/src/df/gfx/df_view_rules.h +++ b/src/df/gfx/df_view_rules.h @@ -49,16 +49,6 @@ struct DF_BitmapTopologyInfo R_Tex2DFormat fmt; }; -#if 0 -typedef struct DF_BitmapViewState DF_BitmapViewState; -struct DF_BitmapViewState -{ - Vec2F32 view_center_pos; - F32 zoom; - DF_BitmapTopologyInfo top; -}; -#endif - typedef struct DF_VR_BitmapState DF_VR_BitmapState; struct DF_VR_BitmapState { @@ -77,14 +67,6 @@ struct DF_VR_BitmapBoxDrawData F32 ui_per_bmp_px; }; -#if 0 -internal Vec2F32 df_bitmap_view_state__screen_from_canvas_pos(DF_BitmapViewState *bvs, Rng2F32 rect, Vec2F32 cvs); -internal Rng2F32 df_bitmap_view_state__screen_from_canvas_rect(DF_BitmapViewState *bvs, Rng2F32 rect, Rng2F32 cvs); -internal Vec2F32 df_bitmap_view_state__canvas_from_screen_pos(DF_BitmapViewState *bvs, Rng2F32 rect, Vec2F32 scr); -internal Rng2F32 df_bitmap_view_state__canvas_from_screen_rect(DF_BitmapViewState *bvs, Rng2F32 rect, Rng2F32 scr); -internal DF_BitmapTopologyInfo df_vr_bitmap_topology_info_from_cfg(DF_CfgNode *cfg); -#endif - //////////////////////////////// //~ rjf: "geo" diff --git a/src/file_stream/file_stream.c b/src/file_stream/file_stream.c index 229b7c45..087c05ec 100644 --- a/src/file_stream/file_stream.c +++ b/src/file_stream/file_stream.c @@ -193,48 +193,6 @@ fs_hash_from_path_range(String8 path, Rng1U64 range, U64 endt_us) break; } } - - //- - // TODO(rjf): OLD vvvvvvvvvvvvvvvv - //- -#if 0 - U64 slot_idx = path_key.u64[0]%fs_shared->slots_count; - U64 stripe_idx = slot_idx%fs_shared->stripes_count; - FS_Slot *slot = &fs_shared->slots[slot_idx]; - FS_Stripe *stripe = &fs_shared->stripes[stripe_idx]; - OS_MutexScopeR(stripe->rw_mutex) for(;;) - { - FS_Node *node = 0; - for(FS_Node *n = slot->first; n != 0; n = n->next) - { - if(str8_match(path, n->path, 0)) - { - node = n; - break; - } - } - if(node == 0) OS_MutexScopeRWPromote(stripe->rw_mutex) - { - node = push_array(stripe->arena, FS_Node, 1); - SLLQueuePush(slot->first, slot->last, node); - node->path = push_str8_copy(stripe->arena, path); - } - if(!ins_atomic_u32_eval_cond_assign(&node->is_working, 1, 0) && - !fs_u2s_enqueue_req(range, path, endt_us)) - { - ins_atomic_u32_eval_assign(&node->is_working, 0); - } - result = hs_hash_from_key(path_key, 0); - if(u128_match(result, u128_zero()) && os_now_microseconds() <= endt_us) - { - os_condition_variable_wait_rw_r(stripe->cv, stripe->rw_mutex, endt_us); - } - else - { - break; - } - } -#endif } } diff --git a/src/ui/ui_core.c b/src/ui/ui_core.c index 4e28c938..9d176d1c 100644 --- a/src/ui/ui_core.c +++ b/src/ui/ui_core.c @@ -276,14 +276,6 @@ ui_single_line_txt_op_from_event(Arena *arena, UI_Event *event, String8 string, next_cursor = next_mark = txt_pt(range.min.line, range.min.column + event->string.size); } - //- rjf: replace & commit -> replace entire range -#if 0 - if(event->flags & UI_EventFlag_ReplaceAndCommit) - { - range = txt_rng(txt_pt(cursor.line, 1), txt_pt(cursor.line, line.size+1)); - } -#endif - //- rjf: determine if this event should be taken, based on bounds of cursor { if(next_cursor.column > string.size+1 || 1 > next_cursor.column || event->delta_2s32.y != 0)