aboutsummaryrefslogtreecommitdiffstats
path: root/src/grt/grt-hooks.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2015-09-14 21:25:01 +0200
committerTristan Gingold <tgingold@free.fr>2015-09-14 21:25:01 +0200
commit2851e70ffac0e2074a8fc3111410e42c16999bb2 (patch)
tree537e3195dca56834cdaac820d2dfd2b9c7271193 /src/grt/grt-hooks.adb
parent0af83126cae63e9bd71deb924ca1b81c57e590d3 (diff)
downloadghdl-2851e70ffac0e2074a8fc3111410e42c16999bb2.tar.gz
ghdl-2851e70ffac0e2074a8fc3111410e42c16999bb2.tar.bz2
ghdl-2851e70ffac0e2074a8fc3111410e42c16999bb2.zip
grt: add --list-features, and --has-feature
Diffstat (limited to 'src/grt/grt-hooks.adb')
-rw-r--r--src/grt/grt-hooks.adb38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/grt/grt-hooks.adb b/src/grt/grt-hooks.adb
index 6a77aaf01..44a9b7a41 100644
--- a/src/grt/grt-hooks.adb
+++ b/src/grt/grt-hooks.adb
@@ -22,6 +22,7 @@
-- covered by the GNU General Public License. This exception does not
-- however invalidate any other reasons why the executable file might be
-- covered by the GNU Public License.
+with Grt.Astdio;
package body Grt.Hooks is
type Hooks_Cell;
@@ -156,6 +157,43 @@ package body Grt.Hooks is
begin
null;
end Proc_Hook_Nil;
+
+ procedure Display_Hooks_Desc
+ is
+ Cell : Hooks_Cell_Acc;
+ begin
+ Cell := First_Hooks;
+ while Cell /= null loop
+ if Cell.Hooks.Desc /= null then
+ Grt.Astdio.Put_Line (Cell.Hooks.Desc.all);
+ end if;
+ Cell := Cell.Next;
+ end loop;
+ end Display_Hooks_Desc;
+
+ function Has_Feature (Name : String) return Boolean
+ is
+ Len : constant Natural := Name'Length;
+ Cell : Hooks_Cell_Acc;
+ begin
+ Cell := First_Hooks;
+ while Cell /= null loop
+ if Cell.Hooks.Desc /= null then
+ declare
+ F : String renames Cell.Hooks.Desc.all;
+ begin
+ if F'Length > Len
+ and then F (F'First .. F'First + Len - 1) = Name
+ and then F (F'First + Len) = ':'
+ then
+ return True;
+ end if;
+ end;
+ end if;
+ Cell := Cell.Next;
+ end loop;
+ return False;
+ end Has_Feature;
end Grt.Hooks;