diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-05-15 11:53:17 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-05-15 13:35:35 +0200 |
commit | 1d4483054c8f0906110e3619053de6bad0263561 (patch) | |
tree | 9713c9b6aa027994839f32d92d9f326a2009d0e6 /src | |
parent | 0d28d6eece31215686f390b6cdfaa62394616172 (diff) | |
download | ghdl-1d4483054c8f0906110e3619053de6bad0263561.tar.gz ghdl-1d4483054c8f0906110e3619053de6bad0263561.tar.bz2 ghdl-1d4483054c8f0906110e3619053de6bad0263561.zip |
elab-debugger: add append_menu_command
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/elab-debugger.adb | 28 | ||||
-rw-r--r-- | src/synth/elab-debugger.ads | 8 |
2 files changed, 29 insertions, 7 deletions
diff --git a/src/synth/elab-debugger.adb b/src/synth/elab-debugger.adb index 2b4831215..0ae4ef856 100644 --- a/src/synth/elab-debugger.adb +++ b/src/synth/elab-debugger.adb @@ -228,8 +228,6 @@ package body Elab.Debugger is -- to the prompt. Command_Error : exception; - type Menu_Procedure is access procedure (Line : String); - -- If set (by commands), call this procedure on empty line to repeat -- last command. Cmd_Repeat : Menu_Procedure; @@ -238,8 +236,6 @@ package body Elab.Debugger is type Menu_Entry (Kind : Menu_Kind); type Menu_Entry_Acc is access all Menu_Entry; - type Cst_String_Acc is access constant String; - type Menu_Entry (Kind : Menu_Kind) is record Name : Cst_String_Acc; Help : Cst_String_Acc; @@ -249,7 +245,7 @@ package body Elab.Debugger is when Menu_Command => Proc : Menu_Procedure; when Menu_Submenu => - First, Last : Menu_Entry_Acc := null; + First : Menu_Entry_Acc := null; end case; end record; @@ -573,7 +569,7 @@ package body Elab.Debugger is Name => new String'("i*nfo"), Help => null, Next => null, -- Menu_Ps'Access, - First | Last => Menu_Info_Params'Access); -- Menu_Info_Proc'Access); + First => Menu_Info_Params'Access); -- Menu_Info_Proc'Access); Menu_Pwh : aliased Menu_Entry := (Kind => Menu_Command, @@ -657,8 +653,26 @@ package body Elab.Debugger is Help => null, Name => null, Next => null, - First | Last => Menu_Help2'Access); + First => Menu_Help2'Access); + + procedure Append_Menu_Command (Name : Cst_String_Acc; + Help : Cst_String_Acc; + Proc : Menu_Procedure) + is + M, L : Menu_Entry_Acc; + begin + M := new Menu_Entry'(Kind => Menu_Command, + Name => Name, + Help => Help, + Next => null, + Proc => Proc); + L := Menu_Top.First; + while L.Next /= null loop + L := L.Next; + end loop; + L.Next := M; + end Append_Menu_Command; function Find_Menu (Menu : Menu_Entry_Acc; Cmd : String) return Menu_Entry_Acc diff --git a/src/synth/elab-debugger.ads b/src/synth/elab-debugger.ads index e37ce017f..5b1bda533 100644 --- a/src/synth/elab-debugger.ads +++ b/src/synth/elab-debugger.ads @@ -38,4 +38,12 @@ package Elab.Debugger is -- To be called in case of execution error, like: -- * index out of bounds. procedure Debug_Error (Inst : Synth_Instance_Acc; Expr : Node); + + type Menu_Procedure is access procedure (Line : String); + type Cst_String_Acc is access constant String; + + -- Append a command to the main menu. + procedure Append_Menu_Command (Name : Cst_String_Acc; + Help : Cst_String_Acc; + Proc : Menu_Procedure); end Elab.Debugger; |