Commit 0a26a50e authored by yoogx's avatar yoogx

* Resolve duplication of the Version function

parent 2c48bb29
......@@ -45,12 +45,14 @@ with Ocarina.Analyzer;
with Ocarina.Options; use Ocarina.Options;
with Ocarina.Parser; use Ocarina.Parser;
with GNAT.Compiler_Version;
with GNAT.OS_Lib; use GNAT.OS_Lib;
with GNAT.Source_Info;
with Ada.Command_Line; use Ada.Command_Line;
with Charset; use Charset;
with Ocarina.Namet; use Ocarina.Namet;
with Ocarina.Output; use Ocarina.Output;
with Ocarina.Types; use Ocarina.Types;
package body Ocarina.Configuration is
......@@ -58,8 +60,7 @@ package body Ocarina.Configuration is
-- As some of the values of the constants below may make the lines
-- too long for GNAT styles, we put the litterals in a new line.
Version : constant String :=
"@VERSION@";
Ocarina_V : constant String := "@VERSION@";
-- This is the official version of Ocarina Stored in configure.ac
Default_AADL_Version : constant AADL_Version_Type :=
......@@ -75,10 +76,6 @@ package body Ocarina.Configuration is
-- substitution pattern to work. We disable style checks because
-- this line may be too long.
Last_Config_Date : constant String :=
"@LAST_CONFIG_DATE@";
-- The date of the latest execution of the configure script
Last_Config_Year : constant String :=
"@LAST_CONFIG_YEAR@";
-- The year of the latest execution of the configure script
......@@ -239,12 +236,12 @@ package body Ocarina.Configuration is
function Ocarina_Version return String is
begin
return Version;
return Ocarina_V;
end Ocarina_Version;
--------------------------
----------------------
-- Ocarina_Revision --
--------------------------
-----------------------
function Ocarina_Revision return String is
begin
......@@ -257,7 +254,8 @@ package body Ocarina.Configuration is
function Ocarina_Last_Configure_Date return String is
begin
return Last_Config_Date;
return GNAT.Source_Info.Compilation_Date & " "
& GNAT.Source_Info.Compilation_Time;
end Ocarina_Last_Configure_Date;
---------------------------------
......@@ -278,4 +276,22 @@ package body Ocarina.Configuration is
return GNU_Make_Str;
end GNU_Make_Cmd;
-------------
-- Version --
-------------
procedure Version is
package Compiler_Version is new GNAT.Compiler_Version;
begin
Write_Line
("Ocarina " & Ocarina_Version & " (" & Ocarina_Revision & ")");
Write_Line
("Copyright (c) 2003-2009 Telecom ParisTech, 2010-" &
Ocarina_Last_Configure_Year &
" ESA & ISAE");
Write_Line ("Build date: " & Ocarina_Last_Configure_Date);
Write_Line ("Compiled with: " & Compiler_Version.Version);
end Version;
end Ocarina.Configuration;
......@@ -43,6 +43,9 @@ package Ocarina.Configuration is
function Ocarina_Last_Configure_Year return String;
-- Version control routines
procedure Version;
-- Display a text with Ocarina version information
private
function GNU_Make_Cmd return String;
......
......@@ -86,9 +86,6 @@ procedure Ocarina_Cmd is
procedure Usage;
-- Display a message describing the usage of Ocarina
procedure Version;
-- Display version information
procedure Ocarina_Shell;
-- Launch Ocarina interactive mode
......@@ -1216,26 +1213,8 @@ procedure Ocarina_Cmd is
Free (Exec_Suffix);
end Usage;
-------------
-- Version --
-------------
procedure Version is
begin
Write_Line
("Ocarina " & Ocarina_Version & " (" & Ocarina_Revision & ")");
if Ocarina_Last_Configure_Date /= "" then
Write_Line ("Build date: " & Ocarina_Last_Configure_Date);
end if;
Write_Line
("Copyright (c) 2003-2009 Telecom ParisTech, 2010-" &
Ocarina_Last_Configure_Year &
" ESA & ISAE");
end Version;
package RT renames Ocarina.ME_REAL.Tokens;
begin
-- Init
......
......@@ -83,7 +83,7 @@ package body Ocarina.Python_Cmd is
is
pragma Unreferenced (Data, Command);
begin
Ocarina.Utils.Version;
Ocarina.Configuration.Version;
end On_Version;
---------------
......
......@@ -83,25 +83,6 @@ package body Ocarina.Utils is
Language := No_Name;
end Reset;
-------------
-- Version --
-------------
procedure Version is
begin
Write_Line
("Ocarina " & Ocarina_Version
& " (" & Ocarina_Revision & ")");
if Ocarina_Last_Configure_Date /= "" then
Write_Line ("Build date: " & Ocarina_Last_Configure_Date);
end if;
Write_Line
("Copyright (c) 2003-2009 Telecom ParisTech, 2010-"
& Ocarina_Last_Configure_Year & " ESA & ISAE");
end Version;
------------------
-- Print_Status --
------------------
......
......@@ -37,9 +37,6 @@ with Ocarina.ME_AADL.AADL_Tree.Nodes;
package Ocarina.Utils is
procedure Version;
-- Display version information
procedure Usage;
-- Display a message describing the usage of Ocarina
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment