diff options
-rw-r--r-- | src/flists.adb (renamed from src/vhdl/flists.adb) | 13 | ||||
-rw-r--r-- | src/flists.ads (renamed from src/vhdl/flists.ads) | 7 | ||||
-rw-r--r-- | src/vhdl/vhdl-flists.ads | 21 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes.ads | 2 |
4 files changed, 32 insertions, 11 deletions
diff --git a/src/vhdl/flists.adb b/src/flists.adb index 4c8067542..9759163bb 100644 --- a/src/vhdl/flists.adb +++ b/src/flists.adb @@ -40,7 +40,7 @@ package body Flists is -- Table of all elements. package Els is new Tables - (Table_Component_Type => Node_Type, + (Table_Component_Type => El_Type, Table_Index_Type => El_Index_Type, Table_Low_Bound => 0, Table_Initial => 128); @@ -78,7 +78,7 @@ package body Flists is if Prev = Null_Flist then Free_Flists (Free_Flists'Last) := Next; else - Els.Table (Flistt.Table (Prev).Els) := Node_Type (Next); + Els.Table (Flistt.Table (Prev).Els) := El_Type (Next); end if; end if; else @@ -105,8 +105,7 @@ package body Flists is declare Idx : constant El_Index_Type := Flistt.Table (Res).Els; begin - Els.Table (Idx .. Idx + El_Index_Type (Len) - 1) := - (others => Null_Node); + Els.Table (Idx .. Idx + El_Index_Type (Len) - 1) := (others => 0); end; return Res; @@ -122,7 +121,7 @@ package body Flists is Prev := Free_Flists (Free_Flists'Last); Free_Flists (Free_Flists'Last) := Flist; - Els.Table (Flistt.Table (Flist).Els) := Node_Type (Prev); + Els.Table (Flistt.Table (Flist).Els) := El_Type (Prev); else Prev := Free_Flists (Len); Free_Flists (Len) := Flist; @@ -143,7 +142,7 @@ package body Flists is return Natural (Flistt.Table (Flist).Len); end Length; - function Get_Nth_Element (Flist : Flist_Type; N : Natural) return Node_Type + function Get_Nth_Element (Flist : Flist_Type; N : Natural) return El_Type is E : Entry_Type renames Flistt.Table (Flist); begin @@ -151,7 +150,7 @@ package body Flists is return Els.Table (E.Els + El_Index_Type (N)); end Get_Nth_Element; - procedure Set_Nth_Element (Flist : Flist_Type; N : Natural; V : Node_Type) + procedure Set_Nth_Element (Flist : Flist_Type; N : Natural; V : El_Type) is E : Entry_Type renames Flistt.Table (Flist); begin diff --git a/src/vhdl/flists.ads b/src/flists.ads index 3d43c0f74..a2b28e3c5 100644 --- a/src/vhdl/flists.ads +++ b/src/flists.ads @@ -16,8 +16,9 @@ -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. with Types; use Types; -with Vhdl.Nodes_Priv; use Vhdl.Nodes_Priv; +generic + type El_Type is range <>; package Flists is type Flist_Type is new Int32; for Flist_Type'Size use 32; @@ -44,8 +45,8 @@ package Flists is function Length (Flist : Flist_Type) return Natural; -- Get the N-th element of FLIST. First element has index 0. - function Get_Nth_Element (Flist : Flist_Type; N : Natural) return Node_Type; + function Get_Nth_Element (Flist : Flist_Type; N : Natural) return El_Type; -- Set the N-th element of FLIST to V. - procedure Set_Nth_Element (Flist : Flist_Type; N : Natural; V : Node_Type); + procedure Set_Nth_Element (Flist : Flist_Type; N : Natural; V : El_Type); end Flists; diff --git a/src/vhdl/vhdl-flists.ads b/src/vhdl/vhdl-flists.ads new file mode 100644 index 000000000..ae92345ad --- /dev/null +++ b/src/vhdl/vhdl-flists.ads @@ -0,0 +1,21 @@ +-- Fixed-length lists. +-- Copyright (C) 2019 Tristan Gingold +-- +-- GHDL is free software; you can redistribute it and/or modify it under +-- the terms of the GNU General Public License as published by the Free +-- Software Foundation; either version 2, or (at your option) any later +-- version. +-- +-- GHDL is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or +-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +-- for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with GHDL; see the file COPYING. If not, write to the Free +-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA +-- 02111-1307, USA. +with Vhdl.Types; +with Flists; + +package Vhdl.Flists is new Standard.Flists (El_Type => Vhdl.Types.Node); diff --git a/src/vhdl/vhdl-nodes.ads b/src/vhdl/vhdl-nodes.ads index 7ffa117d6..80c0c80e3 100644 --- a/src/vhdl/vhdl-nodes.ads +++ b/src/vhdl/vhdl-nodes.ads @@ -20,7 +20,7 @@ with Types; use Types; with Vhdl.Tokens; use Vhdl.Tokens; with Vhdl.Nodes_Priv; with Lists; -with Flists; +with Vhdl.Flists; package Vhdl.Nodes is -- This package defines the semantic tree and functions to handle it. |