aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2016-09-08 03:37:39 +0100
committerTristan Gingold <tgingold@free.fr>2016-09-17 05:55:22 +0200
commit285084bf0f827af98463a07f520d418b6e999c2a (patch)
treeb66df4aefd03dacf8cc231d3d1fce47e68f939f6
parentf9ea178139736775d8be7f8880cb532f56430b49 (diff)
downloadghdl-285084bf0f827af98463a07f520d418b6e999c2a.tar.gz
ghdl-285084bf0f827af98463a07f520d418b6e999c2a.tar.bz2
ghdl-285084bf0f827af98463a07f520d418b6e999c2a.zip
Move Library_To_File_Name from Back_End to Libraries
-rw-r--r--src/ghdldrv/ghdllocal.adb2
-rw-r--r--src/libraries.adb26
-rw-r--r--src/libraries.ads6
-rw-r--r--src/vhdl/back_end.adb38
-rw-r--r--src/vhdl/back_end.ads11
5 files changed, 29 insertions, 54 deletions
diff --git a/src/ghdldrv/ghdllocal.adb b/src/ghdldrv/ghdllocal.adb
index 193910896..3a9ec6a04 100644
--- a/src/ghdldrv/ghdllocal.adb
+++ b/src/ghdldrv/ghdllocal.adb
@@ -1009,7 +1009,7 @@ package body Ghdllocal is
end if;
Perform_Action (Command_Clean (Cmd), Args);
Delete (Image (Libraries.Work_Directory)
- & Back_End.Library_To_File_Name (Libraries.Work_Library)
+ & Libraries.Library_To_File_Name (Libraries.Work_Library)
& Nul);
end Perform_Action;
diff --git a/src/libraries.adb b/src/libraries.adb
index 9e9c5093e..3d864a6aa 100644
--- a/src/libraries.adb
+++ b/src/libraries.adb
@@ -114,11 +114,29 @@ package body Libraries is
return Pathes.Table (N);
end Get_Path;
+ -- Transform a library identifier into a file name.
+ -- Very simple mechanism: just add '-objVV.cf' extension, where VV
+ -- is the version.
+ function Library_To_File_Name (Library: Iir_Library_Declaration)
+ return String
+ is
+ use Flags;
+ begin
+ case Vhdl_Std is
+ when Vhdl_87 =>
+ return Image_Identifier (Library) & "-obj87.cf";
+ when Vhdl_93c | Vhdl_93 | Vhdl_00 | Vhdl_02 =>
+ return Image_Identifier (Library) & "-obj93.cf";
+ when Vhdl_08 =>
+ return Image_Identifier (Library) & "-obj08.cf";
+ end case;
+ end Library_To_File_Name;
+
-- Search LIBRARY in the library path.
procedure Search_Library_In_Path (Library : Iir)
is
use Flags;
- File_Name : constant String := Back_End.Library_To_File_Name (Library);
+ File_Name : constant String := Library_To_File_Name (Library);
Library_Id : constant Name_Id := Get_Identifier (Library);
Id_Len : constant Natural := Get_Name_Length (Library_Id);
L : Natural;
@@ -181,7 +199,7 @@ package body Libraries is
Library: Iir_Library_Declaration)
return Boolean
is
- File_Name : constant String := Back_End.Library_To_File_Name (Library);
+ File_Name : constant String := Library_To_File_Name (Library);
Fe : Source_File_Entry;
begin
Fe := Files_Map.Load_Source_File (Dir, Get_Identifier (File_Name));
@@ -1165,7 +1183,7 @@ package body Libraries is
use Interfaces.C_Streams;
use GNAT.OS_Lib;
Temp_Name: constant String := Image (Work_Directory)
- & '_' & Back_End.Library_To_File_Name (Library) & ASCII.NUL;
+ & '_' & Library_To_File_Name (Library) & ASCII.NUL;
Mode : constant String := 'w' & ASCII.NUL;
Stream : FILEs;
Success : Boolean;
@@ -1338,7 +1356,7 @@ package body Libraries is
declare
use Files_Map;
File_Name: constant String := Image (Work_Directory)
- & Back_End.Library_To_File_Name (Library) & ASCII.NUL;
+ & Library_To_File_Name (Library) & ASCII.NUL;
Delete_Success : Boolean;
begin
-- For windows: renames doesn't overwrite destination; so first
diff --git a/src/libraries.ads b/src/libraries.ads
index a9920d359..448195822 100644
--- a/src/libraries.ads
+++ b/src/libraries.ads
@@ -78,6 +78,12 @@ package Libraries is
-- Set PATH as the path of the work library.
procedure Set_Work_Library_Path (Path : String);
+ -- Transform a library identifier into a file name.
+ -- Very simple mechanism: just add '-objVV.cf' extension, where VV
+ -- is the version.
+ function Library_To_File_Name (Library: Iir_Library_Declaration)
+ return String;
+
-- Set the name of the work library, load the work library.
-- Note: the scanner shouldn't be in use, since this function uses it.
-- If EMPTY is set, the work library is just created and not loaded.
diff --git a/src/vhdl/back_end.adb b/src/vhdl/back_end.adb
deleted file mode 100644
index 81bc20732..000000000
--- a/src/vhdl/back_end.adb
+++ /dev/null
@@ -1,38 +0,0 @@
--- Back-end specialization
--- Copyright (C) 2002, 2003, 2004, 2005 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 Flags; use Flags;
-with Iirs_Utils; use Iirs_Utils;
-
-package body Back_End is
- -- Transform a library identifier into a file name.
- -- Very simple mechanism: just add '-simVV.cf' extension, where VV
- -- is the version.
- function Default_Library_To_File_Name (Library: Iir_Library_Declaration)
- return String
- is
- begin
- case Vhdl_Std is
- when Vhdl_87 =>
- return Image_Identifier (Library) & "-obj87.cf";
- when Vhdl_93c | Vhdl_93 | Vhdl_00 | Vhdl_02 =>
- return Image_Identifier (Library) & "-obj93.cf";
- when Vhdl_08 =>
- return Image_Identifier (Library) & "-obj08.cf";
- end case;
- end Default_Library_To_File_Name;
-end Back_End;
diff --git a/src/vhdl/back_end.ads b/src/vhdl/back_end.ads
index 3ee1e686a..e9db8bd42 100644
--- a/src/vhdl/back_end.ads
+++ b/src/vhdl/back_end.ads
@@ -18,17 +18,6 @@
with Iirs; use Iirs;
package Back_End is
- -- Return the name of the library file for LIBRARY.
- -- The library file describe the contents of LIBRARY.
- function Default_Library_To_File_Name (Library : Iir_Library_Declaration)
- return String;
-
- type Library_To_File_Name_Acc is
- access function (Library : Iir_Library_Declaration) return String;
-
- Library_To_File_Name : Library_To_File_Name_Acc :=
- Default_Library_To_File_Name'Access;
-
-- Back-end options.
type Parse_Option_Acc is access function (Opt : String) return Boolean;
Parse_Option : Parse_Option_Acc := null;