Commit ed6fcec6 authored by Jerome Hugues's avatar Jerome Hugues
Browse files

* Move instantiation and analyse part of REAL to its backend,

          for symmetry with other backends
parent ce72615f
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2009 Telecom ParisTech, 2010-2015 ESA & ISAE. -- -- Copyright (C) 2009 Telecom ParisTech, 2010-2016 ESA & ISAE. --
-- -- -- --
-- Ocarina is free software; you can redistribute it and/or modify under -- -- Ocarina is free software; you can redistribute it and/or modify under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -32,9 +32,12 @@ ...@@ -32,9 +32,12 @@
with Ada.Numerics.Generic_Elementary_Functions; with Ada.Numerics.Generic_Elementary_Functions;
with Ocarina.Namet; with Ocarina.Namet;
with Ocarina.Output; with Ocarina.Output;
with Errors; use Errors;
with Locations; use Locations; with Locations; use Locations;
with Ocarina.Analyzer.REAL; with Ocarina.Analyzer.REAL;
with Ocarina.ME_REAL.Tokens; use Ocarina.ME_REAL.Tokens;
with Ocarina.ME_REAL.REAL_Tree.Nodes; with Ocarina.ME_REAL.REAL_Tree.Nodes;
with Ocarina.ME_REAL.REAL_Tree.Nutils; with Ocarina.ME_REAL.REAL_Tree.Nutils;
with Ocarina.ME_REAL.REAL_Tree.Utils; with Ocarina.ME_REAL.REAL_Tree.Utils;
...@@ -44,6 +47,8 @@ with Ocarina.Backends.Messages; ...@@ -44,6 +47,8 @@ with Ocarina.Backends.Messages;
with Ocarina.ME_AADL.AADL_Instances.Nodes; with Ocarina.ME_AADL.AADL_Instances.Nodes;
with Ocarina.ME_AADL.AADL_Instances.Nutils; with Ocarina.ME_AADL.AADL_Instances.Nutils;
with Ocarina.Analyzer;
with Ocarina.Instances;
with Ocarina.Instances.REAL_Finder; with Ocarina.Instances.REAL_Finder;
with Ocarina.Instances.REAL_Checker.Queries.Subcomponent_Predicates; with Ocarina.Instances.REAL_Checker.Queries.Subcomponent_Predicates;
with Ocarina.Instances.REAL_Checker.Queries.Bound_Predicates; with Ocarina.Instances.REAL_Checker.Queries.Bound_Predicates;
...@@ -62,10 +67,12 @@ package body Ocarina.Backends.REAL is ...@@ -62,10 +67,12 @@ package body Ocarina.Backends.REAL is
(Long_Long_Float); (Long_Long_Float);
use Numerics; use Numerics;
use Ocarina.Analyzer;
use Ocarina.ME_REAL.REAL_Tree.Nodes; use Ocarina.ME_REAL.REAL_Tree.Nodes;
use Ocarina.ME_REAL.REAL_Tree.Nutils; use Ocarina.ME_REAL.REAL_Tree.Nutils;
use Ocarina.ME_REAL.REAL_Tree.Utils; use Ocarina.ME_REAL.REAL_Tree.Utils;
use Ocarina.REAL_Values; use Ocarina.REAL_Values;
use Ocarina.Instances;
use Ocarina.Instances.REAL_Finder; use Ocarina.Instances.REAL_Finder;
use Ocarina.Backends.Messages; use Ocarina.Backends.Messages;
use Ocarina.Namet; use Ocarina.Namet;
...@@ -3187,8 +3194,13 @@ package body Ocarina.Backends.REAL is ...@@ -3187,8 +3194,13 @@ package body Ocarina.Backends.REAL is
It : Natural := First; It : Natural := First;
Node : Node_Id; Node : Node_Id;
Success : Boolean;
begin begin
Root_System := AADL_Root; Root_System := Instantiate_Model (AADL_Root);
Exit_On_Error (No (AADL_Root), "Cannot instantiate AADL models");
Success := Analyze (REAL_Language, Root_System);
Exit_On_Error (not Success, "Cannot analyze REAL specifications");
-- Runtime -- Runtime
......
...@@ -62,9 +62,6 @@ with Ocarina.Options; use Ocarina.Options; ...@@ -62,9 +62,6 @@ with Ocarina.Options; use Ocarina.Options;
with Ocarina.Parser; use Ocarina.Parser; with Ocarina.Parser; use Ocarina.Parser;
with Ocarina.Property_Sets; use Ocarina.Property_Sets; with Ocarina.Property_Sets; use Ocarina.Property_Sets;
with Ocarina.FE_AADL.Parser; use Ocarina.FE_AADL.Parser; with Ocarina.FE_AADL.Parser; use Ocarina.FE_AADL.Parser;
-- with Ocarina.FE_REAL; use Ocarina.FE_REAL;
with Ocarina.ME_REAL.Tokens;
with Ocarina.ME_AADL.AADL_Instances.Nodes; with Ocarina.ME_AADL.AADL_Instances.Nodes;
with Ocarina.Scripts; use Ocarina.Scripts; with Ocarina.Scripts; use Ocarina.Scripts;
...@@ -537,8 +534,6 @@ procedure Ocarina_Cmd is ...@@ -537,8 +534,6 @@ procedure Ocarina_Cmd is
end; end;
end Parse_Scenario_Files; end Parse_Scenario_Files;
package RT renames Ocarina.ME_REAL.Tokens;
begin begin
-- Init -- Init
...@@ -651,16 +646,6 @@ begin ...@@ -651,16 +646,6 @@ begin
end if; end if;
when Generate_Code => when Generate_Code =>
if Get_Current_Backend_Name = Get_String_Name ("real_theorem")
or else Get_Current_Backend_Name = Get_String_Name ("real_pp")
then
AADL_Root := Instantiate_Model (AADL_Root);
Exit_On_Error (No (AADL_Root), "Cannot instantiate AADL models");
Success := Analyze (RT.REAL_Language, AADL_Root);
Exit_On_Error (not Success, "Cannot analyze REAL specifications");
end if;
Generate_Code (AADL_Root); Generate_Code (AADL_Root);
if Verbose then if Verbose then
Set_Standard_Error; Set_Standard_Error;
......
Supports Markdown
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