Commit 943cafb7 authored by yoogx's avatar yoogx

* Core reorganization

parent cec7a931
......@@ -6,7 +6,7 @@
-- --
-- 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 --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -31,7 +31,6 @@
with Charset;
with Ocarina.Namet;
with Ocarina.Output;
with GNAT.Table;
......@@ -41,8 +40,8 @@ with Ocarina.Analyzer.REAL;
package body Ocarina.Analyzer is
use Charset;
use Ocarina.Namet;
use Ocarina.Output;
type Analyzer_Record is record
Language : Name_Id;
......@@ -63,11 +62,8 @@ package body Ocarina.Analyzer is
end if;
end loop;
Set_Standard_Error;
Write_Line
("Analyzers : Cannot find language " & Get_Name_String (Language));
Set_Standard_Output;
return False;
raise Program_Error with
"Analyzers : Cannot find language " & Get_Name_String (Language);
end Analyze;
--------------------
......@@ -99,23 +95,20 @@ package body Ocarina.Analyzer is
(Language : String;
Analyzer : Analyzer_Subprogram)
is
N : Name_Id;
N : constant Name_Id := Get_String_Name (To_Lower (Language));
begin
N := Get_String_Name (To_Lower (Language));
for B in Analyzers.First .. Analyzers.Last loop
if Analyzers.Table (B).Language = N then
Set_Standard_Error;
Write_Line ("Cannot register twice analyzer " & Language);
Set_Standard_Output;
raise Program_Error with
"Cannot register twice analyzer " & Language;
end if;
end loop;
if Language'Length > 0 then
Analyzers.Increment_Last;
Set_Str_To_Name_Buffer (Language);
Analyzers.Table (Analyzers.Last).Language := Name_Find;
Analyzers.Table (Analyzers.Last).Analyzer := Analyzer;
end if;
Analyzers.Increment_Last;
Set_Str_To_Name_Buffer (Language);
Analyzers.Table (Analyzers.Last).Language := Name_Find;
Analyzers.Table (Analyzers.Last).Analyzer := Analyzer;
end Register_Analyzer;
end Ocarina.Analyzer;
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- 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 --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -38,6 +38,8 @@ package Ocarina.Analyzer is
type Analyzer_Subprogram is access function
(AADL_Root : Node_Id) return Boolean;
type Init_Analyzer_Subprogram is access procedure;
function Analyze (Language : Name_Id; Root : Node_Id) return Boolean;
procedure Init_Analyzers;
......
......@@ -6,7 +6,7 @@
-- --
-- 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 --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -34,6 +34,10 @@ with Ocarina.ME_AADL.AADL_Tree.Nodes;
package body Ocarina.Builder.AADL.Components.Connections is
use Ocarina.ME_AADL;
use Ocarina.ME_AADL.AADL_Tree.Nutils;
use Ocarina.ME_AADL.AADL_Tree.Nodes;
------------------------------
-- Add_Property_Association --
------------------------------
......@@ -42,9 +46,6 @@ package body Ocarina.Builder.AADL.Components.Connections is
(Connection : Node_Id;
Property_Association : Node_Id) return Boolean
is
use Ocarina.ME_AADL.AADL_Tree.Nodes;
use Ocarina.ME_AADL.AADL_Tree.Nutils;
pragma Assert
(Connection /= No_Node and then Kind (Connection) = K_Connection);
pragma Assert (Property_Association /= No_Node);
......@@ -78,31 +79,13 @@ package body Ocarina.Builder.AADL.Components.Connections is
Destination : Node_Id := No_Node;
In_Modes : Node_Id := No_Node) return Node_Id
is
use Ocarina.ME_AADL;
use Ocarina.ME_AADL.AADL_Tree.Nutils;
use Ocarina.ME_AADL.AADL_Tree.Nodes;
pragma Assert (Kind (Comp_Impl) = K_Component_Implementation);
Node : constant Node_Id := New_Node (K_Connection, Loc);
Node : constant Node_Id
:= New_Connection (Loc, Name, Category, Is_Refinement, Is_Bidirect,
Source, Destination, In_Modes);
Success : Boolean := True;
begin
Set_Identifier (Node, Name);
if Name /= No_Node then
Set_Corresponding_Entity (Name, Node);
end if;
Set_Is_Refinement (Node, Is_Refinement);
Set_Is_Bidirectional (Node, Is_Bidirect);
Set_Source (Node, Source);
Set_Destination (Node, Destination);
Set_Category (Node, Connection_Type'Pos (Category));
Set_In_Modes (Node, In_Modes);
Set_Properties (Node, No_List);
Set_Property_Scope (Node, New_Node (K_Scope_Definition, Loc));
Set_Corresponding_Entity (Property_Scope (Node), Node);
Success := Add_Connection (Component => Comp_Impl, Connection => Node);
if Success then
......@@ -110,7 +93,6 @@ package body Ocarina.Builder.AADL.Components.Connections is
else
return No_Node;
end if;
end Add_New_Connection;
--------------------
......@@ -127,11 +109,8 @@ package body Ocarina.Builder.AADL.Components.Connections is
Destination : Node_Id := No_Node;
In_Modes : Node_Id := No_Node) return Node_Id
is
use Ocarina.ME_AADL;
use Ocarina.ME_AADL.AADL_Tree.Nutils;
use Ocarina.ME_AADL.AADL_Tree.Nodes;
Node : constant Node_Id := New_Node (K_Connection, Loc);
begin
Set_Identifier (Node, Name);
......@@ -150,7 +129,6 @@ package body Ocarina.Builder.AADL.Components.Connections is
Set_Corresponding_Entity (Property_Scope (Node), Node);
return Node;
end New_Connection;
end Ocarina.Builder.AADL.Components.Connections;
......@@ -6,7 +6,7 @@
-- --
-- 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 --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -36,6 +36,8 @@ with Ocarina.ME_AADL.AADL_Tree.Nutils;
package body Ocarina.Builder.AADL.Components.Prototypes is
use Ocarina.ME_AADL;
use Ocarina.ME_AADL.AADL_Tree.Nodes;
use Ocarina.ME_AADL.AADL_Tree.Nutils;
-----------------------
-- Add_New_Prototype --
......@@ -49,9 +51,6 @@ package body Ocarina.Builder.AADL.Components.Prototypes is
Category : Ocarina.ME_AADL.Component_Category;
Is_Refinement : Boolean := False) return Node_Id
is
use Ocarina.ME_AADL.AADL_Tree.Nodes;
use Ocarina.ME_AADL.AADL_Tree.Nutils;
pragma Assert
(Container /= No_Node
and then
......@@ -79,7 +78,6 @@ package body Ocarina.Builder.AADL.Components.Prototypes is
else
return No_Node;
end if;
end Add_New_Prototype;
-------------------------------
......@@ -93,10 +91,8 @@ package body Ocarina.Builder.AADL.Components.Prototypes is
Classifier_Ref : Node_Id;
Category : Ocarina.ME_AADL.Component_Category) return Node_Id
is
use Ocarina.ME_AADL.AADL_Tree.Nodes;
use Ocarina.ME_AADL.AADL_Tree.Nutils;
Node : constant Node_Id := New_Node (K_Binding_Prototype, Loc);
begin
Set_Identifier (Node, Name);
Set_Corresponding_Entity (Name, Node);
......@@ -105,7 +101,6 @@ package body Ocarina.Builder.AADL.Components.Prototypes is
Set_Category (Node, Component_Category'Pos (Category));
return Node;
end Add_New_Prototype_Binding;
end Ocarina.Builder.AADL.Components.Prototypes;
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