From 1c1cdc4f5f7420f88a1ac4bc2df35a31cf45a892 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 2 Oct 2017 20:47:13 +0200 Subject: nodes_meta: Generate Attr_, add subprograms for interfaces. --- src/vhdl/nodes_meta.adb.in | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'src/vhdl/nodes_meta.adb.in') diff --git a/src/vhdl/nodes_meta.adb.in b/src/vhdl/nodes_meta.adb.in index d94c2d626..8f9e96490 100644 --- a/src/vhdl/nodes_meta.adb.in +++ b/src/vhdl/nodes_meta.adb.in @@ -53,22 +53,35 @@ package body Nodes_Meta is -- FIELDS_ARRAY ); - Fields_Of_Iir_Last : constant array (Iir_Kind) of Integer := + Fields_Of_Iir_Last : constant array (Iir_Kind) of Fields_Index_Extended := ( -- FIELDS_ARRAY_POS ); - function Get_Fields (K : Iir_Kind) return Fields_Array - is - First : Natural; - Last : Integer; + function Get_Fields_First (K : Iir_Kind) return Fields_Index is begin if K = Iir_Kind'First then - First := Fields_Of_Iir'First; + return Fields_Of_Iir'First; else - First := Fields_Of_Iir_Last (Iir_Kind'Pred (K)) + 1; + return Fields_Of_Iir_Last (Iir_Kind'Pred (K)) + 1; end if; - Last := Fields_Of_Iir_Last (K); + end Get_Fields_First; + + function Get_Fields_Last (K : Iir_Kind) return Fields_Index is + begin + return Fields_Of_Iir_Last (K); + end Get_Fields_Last; + + function Get_Field_By_Index (Idx : Fields_Index) return Fields_Enum is + begin + return Fields_Of_Iir (Idx); + end Get_Field_By_Index; + + function Get_Fields (K : Iir_Kind) return Fields_Array + is + First : constant Fields_Index := Get_Fields_First (K); + Last : constant Fields_Index := Fields_Of_Iir_Last (K); + begin return Fields_Of_Iir (First .. Last); end Get_Fields; -- cgit v1.2.3