From 9c5d9caa32c1ad4154a75c094d6917a110b35a59 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Thu, 10 Oct 2024 07:44:26 -0700 Subject: [PATCH] pass over help menu; typeof in eval --- src/ctrl/ctrl_core.h | 4 ++-- src/eval/eval.mdesk | 23 ++++++++++++----------- src/eval/eval_ir.c | 15 +++++++++++++++ src/eval/generated/eval.meta.c | 28 +++++++++++++++------------- src/eval/generated/eval.meta.h | 5 +++-- src/os/gfx/linux/os_gfx_linux.c | 6 ++++++ src/os/gfx/os_gfx.h | 1 + src/os/gfx/stub/os_gfx_stub.c | 5 +++++ src/os/gfx/win32/os_gfx_win32.c | 9 +++++++++ src/raddbg/raddbg_core.c | 22 +++++++++++----------- 10 files changed, 79 insertions(+), 39 deletions(-) diff --git a/src/ctrl/ctrl_core.h b/src/ctrl/ctrl_core.h index 6892744e..49e3f409 100644 --- a/src/ctrl/ctrl_core.h +++ b/src/ctrl/ctrl_core.h @@ -157,8 +157,8 @@ struct_members(CTRL_ModuleMetaEval) { member_lit_comp(CTRL_MetaEval, type(U32), color, .pretty_name = str8_lit_comp("Color")), member_lit_comp(CTRL_MetaEval, type(CTRL_CodeString8), label, .pretty_name = str8_lit_comp("Name")), - member_lit_comp(CTRL_MetaEval, type(CTRL_PlainString8),exe, .pretty_name = str8_lit_comp("Executable Path")), - member_lit_comp(CTRL_MetaEval, type(CTRL_PlainString8),dbg, .pretty_name = str8_lit_comp("Debug Info Path")), + member_lit_comp(CTRL_MetaEval, type(CTRL_PathString8), exe, .pretty_name = str8_lit_comp("Executable Path")), + member_lit_comp(CTRL_MetaEval, type(CTRL_PathString8), dbg, .pretty_name = str8_lit_comp("Debug Info Path")), member_lit_comp(CTRL_MetaEval, type(Rng1U64), vaddr_range, .pretty_name = str8_lit_comp("Address Range")), }; diff --git a/src/eval/eval.mdesk b/src/eval/eval.mdesk index 0a8e3e55..01945b3d 100644 --- a/src/eval/eval.mdesk +++ b/src/eval/eval.mdesk @@ -52,14 +52,14 @@ E_TypeKindTable: {ComplexF64 "ComplexF64" 16 } {ComplexF80 "ComplexF80" 20 } {ComplexF128 "ComplexF128" 32 } - {Modifier "" 0 } - {Ptr "" 0 } - {LRef "" 0 } - {RRef "" 0 } - {Array "" 0 } - {Function "" 0 } - {Method "" 0 } - {MemberPtr "" 0 } + {Modifier "modifier" 0 } + {Ptr "ptr" 0 } + {LRef "lref" 0 } + {RRef "rref" 0 } + {Array "array" 0 } + {Function "function" 0 } + {Method "method" 0 } + {MemberPtr "member_ptr" 0 } {Struct "struct" 0 } {Class "class" 0 } {Union "union" 0 } @@ -69,9 +69,9 @@ E_TypeKindTable: {IncompleteUnion "union" 0 } {IncompleteClass "class" 0 } {IncompleteEnum "enum" 0 } - {Bitfield "" 0 } - {Variadic "" 0 } - {Collection "" 0 } + {Bitfield "bitfield" 0 } + {Variadic "variadic" 0 } + {Collection "collection" 0 } } @table(name op_kind precedence string op_pre op_sep op_pos) @@ -87,6 +87,7 @@ E_ExprKindTable: { Cast Null 1 "cast" "(" ")" "" } { Sizeof UnaryPrefix 1 "sizeof" "sizeof" "" "" } + { Typeof UnaryPrefix 1 "typeof" "typeof" "" "" } { ByteSwap UnaryPrefix 1 "bswap" "bswap" "(" ")"} { Neg UnaryPrefix 2 "-" "-" "" "" } diff --git a/src/eval/eval_ir.c b/src/eval/eval_ir.c index 4fdb399f..01203435 100644 --- a/src/eval/eval_ir.c +++ b/src/eval/eval_ir.c @@ -806,6 +806,21 @@ e_irtree_and_type_from_expr(Arena *arena, E_Expr *expr) } }break; + //- rjf: typeof + case E_ExprKind_Typeof: + { + // rjf: evaluate operand tree + E_Expr *r_expr = expr->first; + E_IRTreeAndType r_tree = e_irtree_and_type_from_expr(arena, r_expr); + e_msg_list_concat_in_place(&result.msgs, &r_tree.msgs); + + // rjf: fill output + result.root = &e_irnode_nil; + result.type_key = r_tree.type_key; + result.mode = E_Mode_Null; + result.space = r_tree.space; + }break; + //- rjf: byteswap case E_ExprKind_ByteSwap: { diff --git a/src/eval/generated/eval.meta.c b/src/eval/generated/eval.meta.c index aa532147..e5e004d7 100644 --- a/src/eval/generated/eval.meta.c +++ b/src/eval/generated/eval.meta.c @@ -14,7 +14,7 @@ str8_lit_comp("CharLiteral"), str8_lit_comp("Symbol"), }; -String8 e_expr_kind_strings[46] = +String8 e_expr_kind_strings[47] = { str8_lit_comp("Nil"), str8_lit_comp("Ref"), @@ -24,6 +24,7 @@ str8_lit_comp("Deref"), str8_lit_comp("Address"), str8_lit_comp("Cast"), str8_lit_comp("Sizeof"), +str8_lit_comp("Typeof"), str8_lit_comp("ByteSwap"), str8_lit_comp("Neg"), str8_lit_comp("LogNot"), @@ -79,7 +80,7 @@ str8_lit_comp("Insufficient evaluation machine stack space."), str8_lit_comp("Malformed bytecode."), }; -E_OpInfo e_expr_kind_op_info_table[46] = +E_OpInfo e_expr_kind_op_info_table[47] = { { E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("") }, { E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("") }, @@ -89,6 +90,7 @@ E_OpInfo e_expr_kind_op_info_table[46] = { E_OpKind_UnaryPrefix, 2, str8_lit_comp("&"), str8_lit_comp(""), str8_lit_comp("") }, { E_OpKind_Null, 1, str8_lit_comp("("), str8_lit_comp(")"), str8_lit_comp("") }, { E_OpKind_UnaryPrefix, 1, str8_lit_comp("sizeof"), str8_lit_comp(""), str8_lit_comp("") }, +{ E_OpKind_UnaryPrefix, 1, str8_lit_comp("typeof"), str8_lit_comp(""), str8_lit_comp("") }, { E_OpKind_UnaryPrefix, 1, str8_lit_comp("bswap"), str8_lit_comp("("), str8_lit_comp(")") }, { E_OpKind_UnaryPrefix, 2, str8_lit_comp("-"), str8_lit_comp(""), str8_lit_comp("") }, { E_OpKind_UnaryPrefix, 2, str8_lit_comp("!"), str8_lit_comp(""), str8_lit_comp("") }, @@ -227,14 +229,14 @@ str8_lit_comp("ComplexF32"), str8_lit_comp("ComplexF64"), str8_lit_comp("ComplexF80"), str8_lit_comp("ComplexF128"), -str8_lit_comp(""), -str8_lit_comp(""), -str8_lit_comp(""), -str8_lit_comp(""), -str8_lit_comp(""), -str8_lit_comp(""), -str8_lit_comp(""), -str8_lit_comp(""), +str8_lit_comp("modifier"), +str8_lit_comp("ptr"), +str8_lit_comp("lref"), +str8_lit_comp("rref"), +str8_lit_comp("array"), +str8_lit_comp("function"), +str8_lit_comp("method"), +str8_lit_comp("member_ptr"), str8_lit_comp("struct"), str8_lit_comp("class"), str8_lit_comp("union"), @@ -244,9 +246,9 @@ str8_lit_comp("struct"), str8_lit_comp("union"), str8_lit_comp("class"), str8_lit_comp("enum"), -str8_lit_comp(""), -str8_lit_comp(""), -str8_lit_comp(""), +str8_lit_comp("bitfield"), +str8_lit_comp("variadic"), +str8_lit_comp("collection"), }; C_LINKAGE_END diff --git a/src/eval/generated/eval.meta.h b/src/eval/generated/eval.meta.h index 30ad06ba..a3a32761 100644 --- a/src/eval/generated/eval.meta.h +++ b/src/eval/generated/eval.meta.h @@ -99,6 +99,7 @@ E_ExprKind_Deref, E_ExprKind_Address, E_ExprKind_Cast, E_ExprKind_Sizeof, +E_ExprKind_Typeof, E_ExprKind_ByteSwap, E_ExprKind_Neg, E_ExprKind_LogNot, @@ -158,9 +159,9 @@ E_InterpretationCode_COUNT, C_LINKAGE_BEGIN extern String8 e_token_kind_strings[6]; -extern String8 e_expr_kind_strings[46]; +extern String8 e_expr_kind_strings[47]; extern String8 e_interpretation_code_display_strings[11]; -extern E_OpInfo e_expr_kind_op_info_table[46]; +extern E_OpInfo e_expr_kind_op_info_table[47]; extern U8 e_kind_basic_byte_size_table[56]; extern String8 e_kind_basic_string_table[56]; diff --git a/src/os/gfx/linux/os_gfx_linux.c b/src/os/gfx/linux/os_gfx_linux.c index a771727c..11da04b8 100644 --- a/src/os/gfx/linux/os_gfx_linux.c +++ b/src/os/gfx/linux/os_gfx_linux.c @@ -492,3 +492,9 @@ os_show_in_filesystem_ui(String8 path) { } + +internal void +os_open_in_browser(String8 url) +{ + +} diff --git a/src/os/gfx/os_gfx.h b/src/os/gfx/os_gfx.h index 2a593336..f2a860d7 100644 --- a/src/os/gfx/os_gfx.h +++ b/src/os/gfx/os_gfx.h @@ -192,5 +192,6 @@ internal void os_graphical_message(B32 error, String8 title, String8 m //~ rjf: @os_hooks Shell Operations internal void os_show_in_filesystem_ui(String8 path); +internal void os_open_in_browser(String8 url); #endif // OS_GFX_H diff --git a/src/os/gfx/stub/os_gfx_stub.c b/src/os/gfx/stub/os_gfx_stub.c index 2be9677d..34fd08c9 100644 --- a/src/os/gfx/stub/os_gfx_stub.c +++ b/src/os/gfx/stub/os_gfx_stub.c @@ -238,3 +238,8 @@ internal void os_show_in_filesystem_ui(String8 path) { } + +internal void +os_open_in_browser(String8 url) +{ +} diff --git a/src/os/gfx/win32/os_gfx_win32.c b/src/os/gfx/win32/os_gfx_win32.c index b863185f..b0d30218 100644 --- a/src/os/gfx/win32/os_gfx_win32.c +++ b/src/os/gfx/win32/os_gfx_win32.c @@ -1542,3 +1542,12 @@ os_show_in_filesystem_ui(String8 path) } scratch_end(scratch); } + +internal void +os_open_in_browser(String8 url) +{ + Temp scratch = scratch_begin(0, 0); + String16 url16 = str16_from_8(scratch.arena, url); + ShellExecuteW(0, L"open", (WCHAR *)url16.str, 0, 0, SW_SHOWNORMAL); + scratch_end(scratch); +} diff --git a/src/raddbg/raddbg_core.c b/src/raddbg/raddbg_core.c index 807c3afb..8efbbfe1 100644 --- a/src/raddbg/raddbg_core.c +++ b/src/raddbg/raddbg_core.c @@ -5293,6 +5293,7 @@ rd_window_frame(RD_Window *ws) { UI_Row UI_TextAlignment(UI_TextAlign_Center) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) ui_label(str8_lit(BUILD_TITLE_STRING_LITERAL)); + ui_spacer(ui_em(1.f, 1.f)); UI_PrefHeight(ui_children_sum(1)) UI_Row UI_Padding(ui_pct(1, 0)) { R_Handle texture = rd_state->icon_texture; @@ -5301,7 +5302,7 @@ rd_window_frame(RD_Window *ws) UI_PrefHeight(ui_px(ui_top_font_size()*10.f, 1.f)) ui_image(texture, R_Tex2DSampleKind_Linear, r2f32p(0, 0, texture_dim.x, texture_dim.y), v4f32(1, 1, 1, 1), 0, str8_lit("")); } - ui_spacer(ui_em(0.25f, 1.f)); + ui_spacer(ui_em(1.f, 1.f)); UI_Row UI_PrefWidth(ui_text_dim(10, 1)) UI_TextAlignment(UI_TextAlign_Center) @@ -5312,20 +5313,19 @@ rd_window_frame(RD_Window *ws) UI_TextAlignment(UI_TextAlign_Center) rd_cmd_binding_buttons(rd_cmd_kind_info_table[RD_CmdKind_RunCommand].string); } - ui_spacer(ui_em(0.25f, 1.f)); - UI_Row UI_TextAlignment(UI_TextAlign_Center) ui_label(str8_lit("Submit issues to the GitHub at:")); - UI_TextAlignment(UI_TextAlign_Center) + ui_spacer(ui_em(1.f, 1.f)); + RD_Palette(RD_PaletteCode_NeutralPopButton) + UI_Row UI_Padding(ui_pct(1, 0)) UI_TextAlignment(UI_TextAlign_Center) UI_PrefWidth(ui_text_dim(10, 1)) + UI_CornerRadius(ui_top_font_size()*0.5f) { - UI_Signal url_sig = ui_buttonf("github.com/EpicGames/raddebugger"); - if(ui_hovering(url_sig)) UI_Tooltip + String8 url = str8_lit("https://github.com/EpicGamesExt/raddebugger/issues"); + UI_Signal sig = ui_button(str8_lit("Submit Request, Issue, or Bug Report")); + if(ui_clicked(sig)) { - ui_labelf("Copy To Clipboard"); - } - if(ui_clicked(url_sig)) - { - os_set_clipboard_text(str8_lit("https://github.com/EpicGames/raddebugger")); + os_open_in_browser(url); } } + ui_spacer(ui_em(0.5f, 1.f)); } // rjf: buttons