Commit 6f2de689 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add placeholder for semantic checks

parent 5dfb5caa
......@@ -16,7 +16,8 @@ with System.Assertions,
Ocarina.Parser,
Ocarina.FE_AADL.Parser,
TASTE.Backend.Build_Script,
TASTE.Backend.Skeletons;
TASTE.Backend.Skeletons,
TASTE.Semantic_Check;
use Ada.Text_IO,
Ada.Exceptions,
......@@ -190,6 +191,8 @@ package body TASTE.AADL_Parser is
raise Quit_Taste;
end if;
Semantic_Check.Check_Model (Result);
return Result;
exception
when Error : AADL_Parser_Error
......@@ -218,6 +221,24 @@ package body TASTE.AADL_Parser is
raise Quit_Taste;
end Parse_Project;
function Find_Binding (Model : TASTE_Model;
F : Unbounded_String)
return Option_Partition.Option is
use Option_Partition;
Function_Name : constant String := To_String (F);
begin
for Node of Model.Deployment_View.Nodes loop
for Each of Node.Partitions loop
for Binding of Each.Bound_Functions loop
if Binding = Function_Name then
return Just (Each);
end if;
end loop;
end loop;
end loop;
return Nothing;
end Find_Binding;
procedure Dump (Model : TASTE_Model) is
Output_Path : constant String := Model.Configuration.Output_Dir.all
& "/Debug";
......
......@@ -3,13 +3,15 @@
-- (c) 2017 European Space Agency - maxime.perrotin@esa.int
-- LGPL license, see LICENSE file
with Ocarina.Types,
with Ada.Strings.Unbounded,
Ocarina.Types,
TASTE.Parser_Utils,
TASTE.Interface_View,
TASTE.Deployment_View,
TASTE.Data_View;
use Ocarina.Types,
use Ada.Strings.Unbounded,
Ocarina.Types,
TASTE.Parser_Utils,
TASTE.Interface_View,
TASTE.Deployment_View,
......@@ -29,6 +31,9 @@ package TASTE.AADL_Parser is
end record;
function Parse_Project return TASTE_Model;
function Find_Binding (Model : TASTE_Model;
F : Unbounded_String)
return Option_Partition.Option;
procedure Dump (Model : TASTE_Model);
procedure Generate_Build_Script (Model : TASTE_Model);
......
......@@ -11,6 +11,7 @@ with Ada.Containers.Indefinite_Ordered_Maps,
Ocarina,
Ocarina.Types,
Ocarina.Backends.Properties,
Option_Type,
TASTE.Parser_Utils;
use Ada.Containers,
......@@ -104,6 +105,8 @@ package TASTE.Deployment_View is
Bound_Functions : String_Vectors.Vector;
end record;
package Option_Partition is new Option_Type (Taste_Partition);
package Taste_Partitions is
new Indefinite_Ordered_Maps (String, Taste_Partition);
......
package TASTE.Parser_Version is
Parser_Release : constant String :=
"56ae695 ; Commit Date: Sun Mar 18 17:09:34 2018 ";
"5dfb5ca ; Commit Date: Fri Mar 23 12:57:52 2018 ";
Ocarina_Version : constant String :=
"Ocarina 2017.x (Working Copy from r2a52334)";
end TASTE.Parser_Version;
\ No newline at end of file
with Ada.Strings.Unbounded,
TASTE.Deployment_View,
TASTE.Parser_Utils;
use Ada.Strings.Unbounded,
TASTE.Deployment_View,
TASTE.Parser_Utils;
package body TASTE.Semantic_Check is
procedure Check_Model (Model : TASTE_Model) is
use Option_Partition;
begin
if Model.Configuration.Glue then
for Each of Model.Interface_View.Flat_Functions loop
-- Check that each function is placed on a partition
if not Each.Is_Type
and then Model.Find_Binding (Each.Name) = Nothing
then
raise Semantic_Error with
"In the deployment view, the function " & To_String (Each.Name)
& " is not bound to any partition!";
end if;
end loop;
end if;
end Check_Model;
end TASTE.Semantic_Check;
with -- TASTE.Interface_View,
TASTE.AADL_Parser;
use -- TASTE.Interface_View,
TASTE.AADL_Parser;
package TASTE.Semantic_Check is
procedure Check_Model (Model : TASTE_Model);
Semantic_Error : exception;
end TASTE.Semantic_Check;
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