Commit dd7f358e authored by yoogx's avatar yoogx

* Minor reformatting

parent 9dd73496
......@@ -29,7 +29,7 @@
-- --
------------------------------------------------------------------------------
with Ocarina.Namet; use Ocarina.Namet;
with Ocarina.Namet; use Ocarina.Namet;
with Ocarina.Instances.Queries; use Ocarina.Instances.Queries;
with Ocarina.AADL_Values;
......
......@@ -31,7 +31,7 @@
with Charset; use Charset;
with Locations; use Locations;
with Ocarina.Namet; use Ocarina.Namet;
with Ocarina.Namet; use Ocarina.Namet;
with Utils; use Utils;
with Ocarina.Backends.Ada_Values; use Ocarina.Backends.Ada_Values;
......
......@@ -29,10 +29,10 @@
-- --
------------------------------------------------------------------------------
with Ocarina.Namet; use Ocarina.Namet;
with Ocarina.Output; use Ocarina.Output;
with Utils; use Utils;
with Outfiles; use Outfiles;
with Ocarina.Namet; use Ocarina.Namet;
with Ocarina.Output; use Ocarina.Output;
with Utils; use Utils;
with Outfiles; use Outfiles;
with GNAT.OS_Lib; use GNAT.OS_Lib;
......
......@@ -32,12 +32,12 @@
with GNAT.Table;
with GNAT.Case_Util;
with Charset; use Charset;
with Locations; use Locations;
with Ocarina.Namet; use Ocarina.Namet;
with Ocarina.Output; use Ocarina.Output;
with Ocarina.Types; use Ocarina.Types;
with Utils; use Utils;
with Charset; use Charset;
with Locations; use Locations;
with Ocarina.Namet; use Ocarina.Namet;
with Ocarina.Output; use Ocarina.Output;
with Ocarina.Types; use Ocarina.Types;
with Utils; use Utils;
with Ocarina.Backends.Ada_Values; use Ocarina.Backends.Ada_Values;
with Ocarina.Backends.Utils; use Ocarina.Backends.Utils;
......
......@@ -42,9 +42,9 @@ package Ocarina.Backends.Ada_Tree.Nutils is
type Token_Type is
(
-- Token name Token type
-- Keywords
Tok_Mod, -- MOD **** First Keyword
-- Token name Token type
-- Keywords
Tok_Mod, -- MOD **** First Keyword
Tok_Rem, -- REM
Tok_New, -- NEW
Tok_Abs, -- ABS
......@@ -147,7 +147,7 @@ package Ocarina.Backends.Ada_Tree.Nutils is
Tok_Dot_Dot, -- ..
Tok_Minus_Minus -- --
);
);
Token_Image : array (Token_Type) of Name_Id;
......
......@@ -29,11 +29,11 @@
-- --
------------------------------------------------------------------------------
with Charset; use Charset;
with Charset; use Charset;
with Ocarina.Namet;
with Ocarina.ME_AADL;
with Ocarina.ME_AADL.AADL_Instances.Nodes;
with Ocarina.Instances; use Ocarina.Instances;
with Ocarina.Instances; use Ocarina.Instances;
with Ocarina.ME_AADL.AADL_Instances.Entities;
use Ocarina.ME_AADL.AADL_Instances.Entities;
......@@ -56,7 +56,7 @@ package body Ocarina.Backends.Alloy is
procedure Visit_Component_Instance (E : Node_Id);
FD : File_Type;
FD : File_Type;
Root_System_Name : Name_Id;
-----------
......@@ -92,7 +92,7 @@ package body Ocarina.Backends.Alloy is
procedure Visit_Component_Instance (E : Node_Id) is
Category_Name_String : constant array
(Component_Category'Range) of Name_Id :=
(Component_Category'Range) of Name_Id :=
(CC_Abstract => Get_String_Name ("abstract"),
CC_Bus => Get_String_Name ("bus"),
CC_Data => Get_String_Name ("data"),
......@@ -119,25 +119,30 @@ package body Ocarina.Backends.Alloy is
-- of the corresponding instance name
if Present (Parent_Subcomponent (E)) then
Put_Line (FD, "one sig " &
To_Lower
(Get_Name_String
(Normalize_Name
(Fully_Qualified_Instance_Name (E))))
& " extends Component{}{");
Put_Line
(FD,
"one sig " &
To_Lower
(Get_Name_String
(Normalize_Name (Fully_Qualified_Instance_Name (E)))) &
" extends Component{}{");
else
Put_Line (Kind (E)'Img);
Root_System_Name := Normalize_Name
(Display_Name (Identifier (E)));
Root_System_Name := Normalize_Name (Display_Name (Identifier (E)));
Put_Line (FD, "one sig " &
To_Lower (Get_Name_String (Root_System_Name))
& " extends Component{}{");
Put_Line
(FD,
"one sig " &
To_Lower (Get_Name_String (Root_System_Name)) &
" extends Component{}{");
end if;
Put_Line (FD, ASCII.HT & "type="
& Get_Name_String (Category_Name_String (Category)));
Put_Line
(FD,
ASCII.HT &
"type=" &
Get_Name_String (Category_Name_String (Category)));
-- Rule #2: list subcomponents
......@@ -148,10 +153,10 @@ package body Ocarina.Backends.Alloy is
declare
Subcomponent_Name : constant String :=
To_Lower
(Get_Name_String
(Normalize_Name
(Fully_Qualified_Instance_Name
(Corresponding_Instance (T)))));
(Get_Name_String
(Normalize_Name
(Fully_Qualified_Instance_Name
(Corresponding_Instance (T)))));
begin
Put (FD, Subcomponent_Name);
......@@ -173,18 +178,17 @@ package body Ocarina.Backends.Alloy is
if Present (AIN.Properties (E)) then
T := First_Node (AIN.Properties (E));
while Present (T) loop
Put (FD,
To_Lower
(Get_Name_String
(Normalize_Name
(Display_Name
(Identifier (T))))));
Put
(FD,
To_Lower
(Get_Name_String
(Normalize_Name (Display_Name (Identifier (T))))));
T := Next_Node (T);
if Present (T) then
Put (FD, "+");
end if;
end loop;
New_Line (Fd);
New_Line (FD);
else
Put_Line (FD, "none");
......@@ -255,8 +259,9 @@ package body Ocarina.Backends.Alloy is
-- Add global contract
New_Line (FD);
Put_Line (FD, "// Declaration of the contract(s) "
& "representing the model(s)");
Put_Line
(FD,
"// Declaration of the contract(s) " & "representing the model(s)");
New_Line (FD);
Put_Line (FD, "one sig aadl_model extends Contract{}{");
Put_Line (FD, ASCII.HT & "assumption=none");
......@@ -266,9 +271,9 @@ package body Ocarina.Backends.Alloy is
-- Generate output
declare
Print_Subcomponents : Boolean := True;
E : constant Node_Id := Root_System (Instance_Root);
T : Node_Id;
Print_Subcomponents : Boolean := True;
E : constant Node_Id := Root_System (Instance_Root);
T : Node_Id;
begin
-- We consider two patterns
-- a) system with subcomponents as system/bus/device only
......@@ -277,10 +282,12 @@ package body Ocarina.Backends.Alloy is
if Present (Subcomponents (E)) then
T := First_Node (Subcomponents (E));
while Present (T) loop
Print_Subcomponents := Print_Subcomponents
and then (Get_Category_Of_Component (T) = CC_System
or else Get_Category_Of_Component (T) = CC_Device
or else Get_Category_Of_Component (T) = CC_Bus);
Print_Subcomponents :=
Print_Subcomponents
and then
(Get_Category_Of_Component (T) = CC_System
or else Get_Category_Of_Component (T) = CC_Device
or else Get_Category_Of_Component (T) = CC_Bus);
T := Next_Node (T);
end loop;
end if;
......@@ -288,17 +295,17 @@ package body Ocarina.Backends.Alloy is
-- We are in case a), generate all subcomponents of root system
if Print_Subcomponents then
Put (Fd, ASCII.HT & "output=");
Put (FD, ASCII.HT & "output=");
if Present (Subcomponents (E)) then
T := First_Node (Subcomponents (E));
while Present (T) loop
declare
Subcomponent_Name : constant String :=
To_Lower
(Get_Name_String
(Normalize_Name
(Fully_Qualified_Instance_Name
(Corresponding_Instance (T)))));
(Get_Name_String
(Normalize_Name
(Fully_Qualified_Instance_Name
(Corresponding_Instance (T)))));
begin
Put (FD, Subcomponent_Name);
......@@ -316,8 +323,11 @@ package body Ocarina.Backends.Alloy is
else
-- We are in case b), generate only root system
Put_Line (FD, ASCII.HT & "output="
& To_Lower (Get_Name_String (Root_System_Name)));
Put_Line
(FD,
ASCII.HT &
"output=" &
To_Lower (Get_Name_String (Root_System_Name)));
end if;
end;
......
......@@ -30,7 +30,7 @@
------------------------------------------------------------------------------
with Ocarina.Namet; use Ocarina.Namet;
with Utils; use Utils;
with Utils; use Utils;
with Ocarina.ME_AADL;
with Ocarina.ME_AADL.AADL_Instances.Nodes;
with Ocarina.ME_AADL.AADL_Instances.Nutils;
......
......@@ -31,7 +31,7 @@
with Charset; use Charset;
with Locations; use Locations;
with Ocarina.Namet; use Ocarina.Namet;
with Ocarina.Namet; use Ocarina.Namet;
with Utils; use Utils;
with Ocarina.Backends.ASN1_Tree.Nutils; use Ocarina.Backends.ASN1_Tree.Nutils;
with Ocarina.Backends.ASN1_Values; use Ocarina.Backends.ASN1_Values;
......
......@@ -29,10 +29,10 @@
-- --
------------------------------------------------------------------------------
with GNAT.OS_Lib; use GNAT.OS_Lib;
with Outfiles; use Outfiles;
with Ocarina.Namet; use Ocarina.Namet;
with Ocarina.Output; use Ocarina.Output;
with GNAT.OS_Lib; use GNAT.OS_Lib;
with Outfiles; use Outfiles;
with Ocarina.Namet; use Ocarina.Namet;
with Ocarina.Output; use Ocarina.Output;
with Ocarina.Backends.ASN1_Values;
with Ocarina.Backends.ASN1_Tree.Nodes;
......
......@@ -31,9 +31,9 @@
with GNAT.Table;
with Ocarina.Namet; use Ocarina.Namet;
with Charset; use Charset;
with Locations; use Locations;
with Ocarina.Namet; use Ocarina.Namet;
with Charset; use Charset;
with Locations; use Locations;
with Ocarina.Backends.ASN1_Tree.Nodes;
with Ocarina.ME_AADL.AADL_Instances.Nodes;
......@@ -402,7 +402,8 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is
Name := Name_Find;
Name := Add_Suffix_To_Name (Keyword_Suffix, Name);
Set_Name_Table_Byte
(Name, Ocarina.Types.Byte (Token_Type'Pos (T) + 1));
(Name,
Ocarina.Types.Byte (Token_Type'Pos (T) + 1));
Set_Str_To_Name_Buffer (Image (T));
else
......
......@@ -40,7 +40,7 @@ with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.Backends.Properties; use Ocarina.Backends.Properties;
with Ocarina.Options; use Ocarina.Options;
with Utils; use Utils;
with Utils; use Utils;
with Ada.Text_IO;
with GNAT.IO_Aux;
......
......@@ -316,7 +316,7 @@ package body Ocarina.Backends.Build_Utils is
-- The node name (in lower case)
Execution_Platform : Supported_Execution_Platform := Platform_None;
Execution_Platform_Name : Name_Id := No_Name;
Execution_Platform_Name : Name_Id := No_Name;
-- The execution platform of the processor the current node
-- is bound to.
......@@ -1428,13 +1428,13 @@ package body Ocarina.Backends.Build_Utils is
Write_Line ("all:");
Write_Line
(ASCII.HT &
"set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d ; done");
"set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d ; done");
Write_Eol;
Write_Line ("clean:");
Write_Line
(ASCII.HT &
"set -e; for d in $(SUBDIRS); do $(MAKE) " &
"clean -C $$d ; done");
"set -e; for d in $(SUBDIRS); do $(MAKE) " &
"clean -C $$d ; done");
-- Close the file
......@@ -1576,8 +1576,8 @@ package body Ocarina.Backends.Build_Utils is
Write_Line ("prove:");
Write_Line
(ASCII.HT &
"gnatprove -P$(PROJECT_FILE) -XTARGET=SPARK "
& "--warnings=continue --report=fail");
"gnatprove -P$(PROJECT_FILE) -XTARGET=SPARK " &
"--warnings=continue --report=fail");
end if;
-- Close the file
......
......@@ -1373,9 +1373,9 @@ package body Ocarina.Backends.C_Common.Mapping is
if Scade_Name = No_Name then
Display_Located_Error
(AIN.Loc (Parameter),
"The Parameter does not specify a SCADE mapping",
Fatal => True);
(AIN.Loc (Parameter),
"The Parameter does not specify a SCADE mapping",
Fatal => True);
end if;
return CTU.Make_Defining_Identifier (Scade_Name, C_Conversion => False);
......@@ -1996,8 +1996,7 @@ package body Ocarina.Backends.C_Common.Mapping is
CTU.Make_Parameter_Specification
(Defining_Identifier =>
Map_C_Defining_Identifier (F),
Parameter_Type =>
Map_C_Data_Type_Designator (D));
Parameter_Type => Map_C_Data_Type_Designator (D));
else
Param :=
CTU.Make_Parameter_Specification
......@@ -2019,13 +2018,11 @@ package body Ocarina.Backends.C_Common.Mapping is
Field := AIN.First_Node (Subcomponents (D));
while Present (Field) loop
if AINU.Is_Data
(Corresponding_Instance (Field))
then
if AINU.Is_Data (Corresponding_Instance (Field)) then
if Mode = Mode_In then
Param :=
CTU.Make_Parameter_Specification
(Defining_Identifier =>
CTU.Make_Parameter_Specification
(Defining_Identifier =>
Map_C_Defining_Identifier (Field),
Parameter_Type =>
Map_C_Data_Type_Designator
......@@ -2038,8 +2035,7 @@ package body Ocarina.Backends.C_Common.Mapping is
Parameter_Type =>
Make_Pointer_Type
(Map_C_Data_Type_Designator
(Corresponding_Instance
(Field))));
(Corresponding_Instance (Field))));
end if;
CTU.Append_Node_To_List (Param, Profile);
end if;
......@@ -3042,8 +3038,8 @@ package body Ocarina.Backends.C_Common.Mapping is
-- Port Name have to be the same.
--
if Get_Connection_Pattern (E) = Inter_Process and then
POK_Flavor = DEOS
if Get_Connection_Pattern (E) = Inter_Process
and then POK_Flavor = DEOS
then
Get_Name_String (Display_Name (Identifier (E)));
N := Name_Find;
......
......@@ -799,9 +799,7 @@ package body Ocarina.Backends.C_Common.Types is
False),
True);
end if;
elsif Get_Concurrency_Protocol (E) =
Priority_Ceiling
then
elsif Get_Concurrency_Protocol (E) = Priority_Ceiling then
-- Protected type that does not have struct members.
-- This piece of code is made to handle declaration
......@@ -1000,8 +998,8 @@ package body Ocarina.Backends.C_Common.Types is
elsif AINU.Is_Process (Corresponding_Instance (C)) then
if Present (Subcomponents (Corresponding_Instance (C))) then
S := First_Node
(Subcomponents (Corresponding_Instance (C)));
S :=
First_Node (Subcomponents (Corresponding_Instance (C)));
while Present (S) loop
Visit_Component_Instance (Corresponding_Instance (S));
S := Next_Node (S);
......@@ -1120,8 +1118,8 @@ package body Ocarina.Backends.C_Common.Types is
if AINU.Is_Process (Parent) and then Parent /= E then
if Present (Extra_Item (Src))
and then Present (Get_Provided_Virtual_Bus_Class
(Extra_Item (Src)))
and then Present
(Get_Provided_Virtual_Bus_Class (Extra_Item (Src)))
then
Visit
(Get_Provided_Virtual_Bus_Class
......
......@@ -31,7 +31,7 @@
with Charset; use Charset;
with Locations; use Locations;
with Ocarina.Namet; use Ocarina.Namet;
with Ocarina.Namet; use Ocarina.Namet;
with Utils; use Utils;
with Ocarina.Backends.C_Values; use Ocarina.Backends.C_Values;
with Ocarina.Backends.C_Tree.Nutils; use Ocarina.Backends.C_Tree.Nutils;
......
......@@ -29,10 +29,10 @@
-- --
------------------------------------------------------------------------------
with Ocarina.Namet; use Ocarina.Namet;
with Ocarina.Output; use Ocarina.Output;
with Utils; use Utils;
with Outfiles; use Outfiles;
with Ocarina.Namet; use Ocarina.Namet;
with Ocarina.Output; use Ocarina.Output;
with Utils; use Utils;
with Outfiles; use Outfiles;
with GNAT.OS_Lib; use GNAT.OS_Lib;
......
......@@ -32,10 +32,10 @@
with GNAT.Table;
with GNAT.Case_Util;
with Charset; use Charset;
with Locations; use Locations;
with Ocarina.Namet; use Ocarina.Namet;
with Utils; use Utils;
with Charset; use Charset;
with Locations; use Locations;
with Ocarina.Namet; use Ocarina.Namet;
with Utils; use Utils;
with Ocarina.Backends;
with Ocarina.Backends.C_Common.Mapping;
......@@ -736,7 +736,7 @@ package body Ocarina.Backends.C_Tree.Nutils is
function Make_Variable_Declaration
(Defining_Identifier : Node_Id;
Used_Type : Node_Id;
Is_Static : Boolean := False) return Node_Id
Is_Static : Boolean := False) return Node_Id
is
P : Node_Id;
begin
......@@ -1007,7 +1007,8 @@ package body Ocarina.Backends.C_Tree.Nutils is
Name := Name_Find;
Name := Add_Suffix_To_Name (Keyword_Suffix, Name);
Set_Name_Table_Byte
(Name, Ocarina.Types.Byte (Token_Type'Pos (T) + 1));
(Name,
Ocarina.Types.Byte (Token_Type'Pos (T) + 1));
Set_Str_To_Name_Buffer (Image (T));
else
......@@ -1665,8 +1666,7 @@ package body Ocarina.Backends.C_Tree.Nutils is
if not AINU.Is_Empty (AIN.Features (Spg)) then
F := AIN.First_Node (AIN.Features (Spg));
while Present (F) loop
if Kind (F) = K_Subcomponent_Access_Instance
then
if Kind (F) = K_Subcomponent_Access_Instance then
-- This case is specific to POK since we don't
-- handle the shared data with the same patterns as
-- in PolyORB-HI-C. This could be updated later.
......@@ -1675,8 +1675,7 @@ package body Ocarina.Backends.C_Tree.Nutils is
if Data_Accessed = No_Node then
Display_Located_Error
(AIN.Loc (F),
"is not properly conected to" &
" any source",
"is not properly conected to" & " any source",
Fatal => True);
end if;
......
......@@ -46,9 +46,9 @@ package Ocarina.Backends.C_Tree.Nutils is
type Token_Type is
(
-- Token name Token type
-- Keywords
Tok_Null, -- NULL **** First Keyword
-- Token name Token type
-- Keywords
Tok_Null, -- NULL **** First Keyword
Tok_Break, -- BREAK
Tok_Case, -- CASE
Tok_Const, -- CONST
......
......@@ -29,9 +29,9 @@
-- --
------------------------------------------------------------------------------
with GNAT.OS_Lib; use GNAT.OS_Lib;
with Ocarina.Namet; use Ocarina.Namet;
with Utils; use Utils;
with GNAT.OS_Lib; use GNAT.OS_Lib;
with Ocarina.Namet; use Ocarina.Namet;
with Utils; use Utils;
with Ocarina.ME_AADL.AADL_Instances.Nodes;
with Ocarina.ME_AADL.AADL_Instances.Nutils;
......@@ -234,10 +234,9 @@ package body Ocarina.Backends.Cheddar.Mapping is
Concurrency_Protocols : constant array
(Supported_Concurrency_Control_Protocol'Range) of Name_Id :=
(None_Specified => Get_String_Name ("NO_PROTOCOL"),
Priority_Ceiling =>
Get_String_Name ("PRIORITY_CEILING_PROTOCOL"),
others => No_Name);
(None_Specified => Get_String_Name ("NO_PROTOCOL"),
Priority_Ceiling => Get_String_Name ("PRIORITY_CEILING_PROTOCOL"),
others => No_Name);
begin
-- The structure of a XML node for a data is
......
......@@ -361,8 +361,8 @@ package body Ocarina.Backends.Connection_Matrix.Main is
Bandwidth :=
Get_Integer_Property
(Conn,
"bus_properties:"
& ":required_bandwidth");
"bus_properties:" &
":required_bandwidth");
Bandwidth_Unit :=
ATN.Name
......@@ -370,9 +370,8 @@ package body Ocarina.Backends.Connection_Matrix.Main is
(Get_Value_Of_Property_Association
(Conn,
Get_String_Name
("bus_properties:"
& ":required_bandwidth"
))));
("bus_properties:" &
":required_bandwidth"))));
Connected := True;
end if;
end if;
......
......@@ -29,7 +29,7 @@
-- --
------------------------------------------------------------------------------
with Ada.Strings; use Ada.Strings;
with Ada.Strings; use Ada.Strings;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
-- with Locations;
......@@ -59,7 +59,7 @@ package body Ocarina.Backends.Deos_Conf.Hm is
package XTU renames Ocarina.Backends.XML_Tree.Nutils;
Root_Node : Node_Id := No_Node;
HM_Node : Node_Id := No_Node;
HM_Node : Node_Id := No_Node;
procedure Visit_Architecture_Instance (E : Node_Id);
procedure Visit_Component_Instance (E : Node_Id);
......@@ -69,14 +69,16 @@ package body Ocarina.Backends.Deos_Conf.Hm is
procedure Visit_Bus_Instance (E : Node_Id);
procedure Visit_Virtual_Processor_Instance (E : Node_Id);
procedure Add_System_Error (XML_Node : Node_Id;
Identifier : String;
Description : String);
procedure Add_System_Error
(XML_Node : Node_Id;
Identifier : String;
Description : String);
procedure Add_Error_Action (XML_Node : Node_Id;
Identifier : String;
Level : String;
Action : String);
procedure Add_Error_Action
(XML_Node : Node_Id;
Identifier : String;
Level : String;
Action : String);
-----------
-- Visit --
-----------
......@@ -186,34 +188,36 @@ package body Ocarina.Backends.Deos_Conf.Hm is
-- Add_System_Error --
------------------------
procedure Add_System_Error (XML_Node : Node_Id;
Identifier : String;
Description : String) is
procedure Add_System_Error
(XML_Node : Node_Id;
Identifier : String;
Description : String)
is
Intermediate : Node_Id;
begin
Intermediate := Make_XML_Node ("SystemError");
XTU.Add_Attribute ("ErrorIdentifier", Identifier, Intermediate);
XTU.Add_Attribute ("Description", Description, Intermediate);
Append_Node_To_List
(Intermediate, XTN.Subitems (XML_Node));
Append_Node_To_List (Intermediate, XTN.Subitems (XML_Node));
end Add_System_Error;
------------------------
-- Add_Error_Action --
------------------------
procedure Add_Error_Action (XML_Node : Node_Id;
Identifier : String;