From 2fa4b913aefa9b23f3f7773b62d92858a6e3732b Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 15 May 2022 17:12:23 +0200 Subject: elab-debugger: add append_info_menu, to_num --- src/synth/elab-debugger.adb | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'src/synth/elab-debugger.adb') diff --git a/src/synth/elab-debugger.adb b/src/synth/elab-debugger.adb index 0ae4ef856..e9f372dc3 100644 --- a/src/synth/elab-debugger.adb +++ b/src/synth/elab-debugger.adb @@ -16,7 +16,6 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -with Types; use Types; with Files_Map; with Tables; with Simple_IO; use Simple_IO; @@ -286,6 +285,20 @@ package body Elab.Debugger is return Get_Word (S (F .. S'Last)); end Get_Word; + procedure To_Num (Str : String; Res : out Uns32; Valid : out Boolean) is + begin + Res := 0; + Valid := True; + for P in Str'Range loop + if Str (P) in '0' .. '9' then + Res := Res * 10 + Character'Pos (Str (P)) - Character'Pos ('0'); + else + Valid := False; + return; + end if; + end loop; + end To_Num; + procedure Info_Params_Proc (Line : String) is pragma Unreferenced (Line); @@ -655,9 +668,11 @@ package body Elab.Debugger is Next => null, First => Menu_Help2'Access); - procedure Append_Menu_Command (Name : Cst_String_Acc; - Help : Cst_String_Acc; - Proc : Menu_Procedure) + -- Append command to MENU. + procedure Append_Menu (Menu : Menu_Entry; + Name : Cst_String_Acc; + Help : Cst_String_Acc; + Proc : Menu_Procedure) is M, L : Menu_Entry_Acc; begin @@ -667,13 +682,27 @@ package body Elab.Debugger is Next => null, Proc => Proc); - L := Menu_Top.First; + L := Menu.First; while L.Next /= null loop L := L.Next; end loop; L.Next := M; + end Append_Menu; + + procedure Append_Menu_Command (Name : Cst_String_Acc; + Help : Cst_String_Acc; + Proc : Menu_Procedure) is + begin + Append_Menu (Menu_Top, Name, Help, Proc); end Append_Menu_Command; + procedure Append_Info_Command (Name : Cst_String_Acc; + Help : Cst_String_Acc; + Proc : Menu_Procedure) is + begin + Append_Menu (Menu_Info, Name, Help, Proc); + end Append_Info_Command; + function Find_Menu (Menu : Menu_Entry_Acc; Cmd : String) return Menu_Entry_Acc is -- cgit v1.2.3