mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
eliminate dependence on 'command parameter slots'
This commit is contained in:
@@ -123,7 +123,7 @@ D_CoreCmdTable: // | | | |
|
||||
{Exit 1 1 Null Nil 0 0 0 0 0 0 X "exit" "Exit" "Exits the debugger." "quit,close,abort" }
|
||||
|
||||
//- rjf: command runner
|
||||
{RunCommand 1 1 CmdSpec Nil 0 0 0 0 0 0 Null "run_command" "Run Command" "Runs a command from the command palette." "help,cmd" }
|
||||
{RunCommand 1 1 CmdSpec Nil 0 0 0 0 0 1 Null "run_command" "Run Command" "Runs a command from the command palette." "help,cmd" }
|
||||
|
||||
//- rjf: notifications
|
||||
{Error 0 1 Null Nil 0 0 0 0 0 0 Null "error" "Error" "Notifies of an error." "" }
|
||||
|
||||
@@ -6831,12 +6831,10 @@ d_begin_frame(Arena *arena, D_CmdList *cmds, F32 dt)
|
||||
case D_CmdKind_RunCommand:
|
||||
{
|
||||
D_CmdSpec *spec = params.cmd_spec;
|
||||
if(spec != cmd->spec)
|
||||
if(spec != cmd->spec && !d_cmd_spec_is_nil(spec))
|
||||
{
|
||||
d_cmd_spec_counter_inc(spec);
|
||||
if(!(spec->info.query.flags & D_CmdQueryFlag_Required) &&
|
||||
(spec->info.query.slot == D_CmdParamSlot_Null ||
|
||||
d_cmd_params_has_slot(¶ms, spec->info.query.slot)))
|
||||
if(!(spec->info.query.flags & D_CmdQueryFlag_Required))
|
||||
{
|
||||
d_cmd_list_push(arena, cmds, ¶ms, spec);
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ D_CmdSpecInfo d_core_cmd_kind_spec_info_table[221] =
|
||||
{
|
||||
{ str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), (D_CmdSpecFlag_ListInUI*0)|(D_CmdSpecFlag_ListInIPCDocs*0), {D_CmdParamSlot_Null, D_EntityKind_Nil, (D_CmdQueryFlag_AllowFiles*0)|(D_CmdQueryFlag_AllowFolders*0)|(D_CmdQueryFlag_CodeInput*0)|(D_CmdQueryFlag_KeepOldInput*0)|(D_CmdQueryFlag_SelectOldInput*0)|(D_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("exit"), str8_lit_comp("Exits the debugger."), str8_lit_comp("quit,close,abort"), str8_lit_comp("Exit"), (D_CmdSpecFlag_ListInUI*1)|(D_CmdSpecFlag_ListInIPCDocs*1), {D_CmdParamSlot_Null, D_EntityKind_Nil, (D_CmdQueryFlag_AllowFiles*0)|(D_CmdQueryFlag_AllowFolders*0)|(D_CmdQueryFlag_CodeInput*0)|(D_CmdQueryFlag_KeepOldInput*0)|(D_CmdQueryFlag_SelectOldInput*0)|(D_CmdQueryFlag_Required*0)}, DF_IconKind_X},
|
||||
{ str8_lit_comp("run_command"), str8_lit_comp("Runs a command from the command palette."), str8_lit_comp("help,cmd"), str8_lit_comp("Run Command"), (D_CmdSpecFlag_ListInUI*1)|(D_CmdSpecFlag_ListInIPCDocs*1), {D_CmdParamSlot_CmdSpec, D_EntityKind_Nil, (D_CmdQueryFlag_AllowFiles*0)|(D_CmdQueryFlag_AllowFolders*0)|(D_CmdQueryFlag_CodeInput*0)|(D_CmdQueryFlag_KeepOldInput*0)|(D_CmdQueryFlag_SelectOldInput*0)|(D_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("run_command"), str8_lit_comp("Runs a command from the command palette."), str8_lit_comp("help,cmd"), str8_lit_comp("Run Command"), (D_CmdSpecFlag_ListInUI*1)|(D_CmdSpecFlag_ListInIPCDocs*1), {D_CmdParamSlot_CmdSpec, D_EntityKind_Nil, (D_CmdQueryFlag_AllowFiles*0)|(D_CmdQueryFlag_AllowFolders*0)|(D_CmdQueryFlag_CodeInput*0)|(D_CmdQueryFlag_KeepOldInput*0)|(D_CmdQueryFlag_SelectOldInput*0)|(D_CmdQueryFlag_Required*1)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("error"), str8_lit_comp("Notifies of an error."), str8_lit_comp(""), str8_lit_comp("Error"), (D_CmdSpecFlag_ListInUI*0)|(D_CmdSpecFlag_ListInIPCDocs*1), {D_CmdParamSlot_Null, D_EntityKind_Nil, (D_CmdQueryFlag_AllowFiles*0)|(D_CmdQueryFlag_AllowFolders*0)|(D_CmdQueryFlag_CodeInput*0)|(D_CmdQueryFlag_KeepOldInput*0)|(D_CmdQueryFlag_SelectOldInput*0)|(D_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("os_event"), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("OS Event"), (D_CmdSpecFlag_ListInUI*0)|(D_CmdSpecFlag_ListInIPCDocs*0), {D_CmdParamSlot_Null, D_EntityKind_Nil, (D_CmdQueryFlag_AllowFiles*0)|(D_CmdQueryFlag_AllowFolders*0)|(D_CmdQueryFlag_CodeInput*0)|(D_CmdQueryFlag_KeepOldInput*0)|(D_CmdQueryFlag_SelectOldInput*0)|(D_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("launch_and_run"), str8_lit_comp("Starts debugging a new instance of a target, then runs."), str8_lit_comp("launch,start,run,target"), str8_lit_comp("Launch and Run"), (D_CmdSpecFlag_ListInUI*1)|(D_CmdSpecFlag_ListInIPCDocs*1), {D_CmdParamSlot_EntityList, D_EntityKind_Target, (D_CmdQueryFlag_AllowFiles*0)|(D_CmdQueryFlag_AllowFolders*0)|(D_CmdQueryFlag_CodeInput*0)|(D_CmdQueryFlag_KeepOldInput*0)|(D_CmdQueryFlag_SelectOldInput*0)|(D_CmdQueryFlag_Required*1)}, DF_IconKind_Play},
|
||||
|
||||
@@ -1365,18 +1365,17 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds)
|
||||
D_CmdSpec *spec = params.cmd_spec;
|
||||
|
||||
// rjf: command simply executes - just no-op in this layer
|
||||
if(!(spec->info.query.flags & D_CmdQueryFlag_Required) &&
|
||||
!d_cmd_spec_is_nil(spec) &&
|
||||
(spec->info.query.slot == D_CmdParamSlot_Null || d_cmd_params_has_slot(¶ms, spec->info.query.slot)))
|
||||
if(!d_cmd_spec_is_nil(spec) && !(spec->info.query.flags & D_CmdQueryFlag_Required))
|
||||
{
|
||||
}
|
||||
|
||||
// rjf: command is missing arguments -> prep query
|
||||
// rjf: command has required query -> prep query
|
||||
else
|
||||
{
|
||||
arena_clear(ws->query_cmd_arena);
|
||||
ws->query_cmd_spec = d_cmd_spec_is_nil(spec) ? cmd->spec : spec;
|
||||
ws->query_cmd_params = df_cmd_params_copy(ws->query_cmd_arena, ¶ms);
|
||||
MemoryZeroArray(ws->query_cmd_params_mask);
|
||||
ws->query_view_selected = 1;
|
||||
}
|
||||
}break;
|
||||
@@ -3384,22 +3383,22 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds)
|
||||
//- rjf: query completion
|
||||
case D_CmdKind_CompleteQuery:
|
||||
{
|
||||
D_CmdParamSlot slot = ws->query_cmd_spec->info.query.slot;
|
||||
|
||||
// rjf: compound command parameters
|
||||
if(ws->query_cmd_spec->info.query.slot != D_CmdParamSlot_Null &&
|
||||
d_cmd_params_has_slot(¶ms, ws->query_cmd_spec->info.query.slot))
|
||||
if(slot != D_CmdParamSlot_Null && !(ws->query_cmd_params_mask[slot/64] & (1ull<<(slot%64))))
|
||||
{
|
||||
D_CmdParams params_copy = df_cmd_params_copy(ws->query_cmd_arena, ¶ms);
|
||||
Rng1U64 offset_range_in_params = d_cmd_param_slot_range_table[ws->query_cmd_spec->info.query.slot];
|
||||
MemoryCopy((U8 *)(&ws->query_cmd_params) + offset_range_in_params.min,
|
||||
(U8 *)(¶ms_copy) + offset_range_in_params.min,
|
||||
dim_1u64(offset_range_in_params));
|
||||
d_cmd_params_mark_slot(&ws->query_cmd_params, ws->query_cmd_spec->info.query.slot);
|
||||
ws->query_cmd_params_mask[slot/64] |= (1ull<<(slot%64));
|
||||
}
|
||||
|
||||
// rjf: determine if command is ready to run
|
||||
B32 command_ready = 1;
|
||||
if(ws->query_cmd_spec->info.query.slot != D_CmdParamSlot_Null &&
|
||||
!d_cmd_params_has_slot(&ws->query_cmd_params, ws->query_cmd_spec->info.query.slot))
|
||||
if(slot != D_CmdParamSlot_Null && !(ws->query_cmd_params_mask[slot/64] & (1ull<<(slot%64))))
|
||||
{
|
||||
command_ready = 0;
|
||||
}
|
||||
@@ -3422,6 +3421,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds)
|
||||
arena_clear(ws->query_cmd_arena);
|
||||
ws->query_cmd_spec = &d_nil_cmd_spec;
|
||||
MemoryZeroStruct(&ws->query_cmd_params);
|
||||
MemoryZeroArray(ws->query_cmd_params_mask);
|
||||
for(DF_View *v = ws->query_view_stack_top, *next = 0; !df_view_is_nil(v); v = next)
|
||||
{
|
||||
next = v->order_next;
|
||||
|
||||
@@ -632,6 +632,7 @@ struct DF_Window
|
||||
// rjf: query view stack
|
||||
Arena *query_cmd_arena;
|
||||
D_CmdSpec *query_cmd_spec;
|
||||
U64 query_cmd_params_mask[(D_CmdParamSlot_COUNT + 63) / 64];
|
||||
D_CmdParams query_cmd_params;
|
||||
DF_View *query_view_stack_top;
|
||||
B32 query_view_selected;
|
||||
|
||||
Reference in New Issue
Block a user