aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-05-15 17:12:23 +0200
committerTristan Gingold <tgingold@free.fr>2022-05-15 17:12:23 +0200
commit2fa4b913aefa9b23f3f7773b62d92858a6e3732b (patch)
tree1e69e0ed9d774091801e24ce3d5138f72388fe61 /src/synth
parent69abb3811741c002c22a4ee59ceb185455fa7a0e (diff)
downloadghdl-2fa4b913aefa9b23f3f7773b62d92858a6e3732b.tar.gz
ghdl-2fa4b913aefa9b23f3f7773b62d92858a6e3732b.tar.bz2
ghdl-2fa4b913aefa9b23f3f7773b62d92858a6e3732b.zip
elab-debugger: add append_info_menu, to_num
Diffstat (limited to 'src/synth')
-rw-r--r--src/synth/elab-debugger.adb39
-rw-r--r--src/synth/elab-debugger.ads16
2 files changed, 50 insertions, 5 deletions
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 <gnu.org/licenses>.
-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
diff --git a/src/synth/elab-debugger.ads b/src/synth/elab-debugger.ads
index 5b1bda533..3376e3ba3 100644
--- a/src/synth/elab-debugger.ads
+++ b/src/synth/elab-debugger.ads
@@ -16,6 +16,8 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <gnu.org/licenses>.
+with Types; use Types;
+
with Vhdl.Nodes; use Vhdl.Nodes;
with Elab.Vhdl_Context; use Elab.Vhdl_Context;
@@ -46,4 +48,18 @@ package Elab.Debugger is
procedure Append_Menu_Command (Name : Cst_String_Acc;
Help : Cst_String_Acc;
Proc : Menu_Procedure);
+
+ -- Append a command to the info menu.
+ procedure Append_Info_Command (Name : Cst_String_Acc;
+ Help : Cst_String_Acc;
+ Proc : Menu_Procedure);
+
+
+ -- Utilities for menu commands.
+
+ -- Return the position of the first non-blank character.
+ function Skip_Blanks (S : String) return Positive;
+
+ -- Convert STR to number RES, set VALID to true iff the conversion is ok.
+ procedure To_Num (Str : String; Res : out Uns32; Valid : out Boolean);
end Elab.Debugger;