Commit dd7f358e authored by yoogx's avatar yoogx
Browse files

* Minor reformatting

parent 9dd73496
...@@ -29,7 +29,7 @@ ...@@ -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.Instances.Queries; use Ocarina.Instances.Queries;
with Ocarina.AADL_Values; with Ocarina.AADL_Values;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
with Charset; use Charset; with Charset; use Charset;
with Locations; use Locations; with Locations; use Locations;
with Ocarina.Namet; use Ocarina.Namet; with Ocarina.Namet; use Ocarina.Namet;
with Utils; use Utils; with Utils; use Utils;
with Ocarina.Backends.Ada_Values; use Ocarina.Backends.Ada_Values; with Ocarina.Backends.Ada_Values; use Ocarina.Backends.Ada_Values;
......
...@@ -29,10 +29,10 @@ ...@@ -29,10 +29,10 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Ocarina.Namet; use Ocarina.Namet; with Ocarina.Namet; use Ocarina.Namet;
with Ocarina.Output; use Ocarina.Output; with Ocarina.Output; use Ocarina.Output;
with Utils; use Utils; with Utils; use Utils;
with Outfiles; use Outfiles; with Outfiles; use Outfiles;
with GNAT.OS_Lib; use GNAT.OS_Lib; with GNAT.OS_Lib; use GNAT.OS_Lib;
......
...@@ -32,12 +32,12 @@ ...@@ -32,12 +32,12 @@
with GNAT.Table; with GNAT.Table;
with GNAT.Case_Util; with GNAT.Case_Util;
with Charset; use Charset; with Charset; use Charset;
with Locations; use Locations; with Locations; use Locations;
with Ocarina.Namet; use Ocarina.Namet; with Ocarina.Namet; use Ocarina.Namet;
with Ocarina.Output; use Ocarina.Output; with Ocarina.Output; use Ocarina.Output;
with Ocarina.Types; use Ocarina.Types; with Ocarina.Types; use Ocarina.Types;
with Utils; use Utils; with Utils; use Utils;
with Ocarina.Backends.Ada_Values; use Ocarina.Backends.Ada_Values; with Ocarina.Backends.Ada_Values; use Ocarina.Backends.Ada_Values;
with Ocarina.Backends.Utils; use Ocarina.Backends.Utils; with Ocarina.Backends.Utils; use Ocarina.Backends.Utils;
......
...@@ -42,9 +42,9 @@ package Ocarina.Backends.Ada_Tree.Nutils is ...@@ -42,9 +42,9 @@ package Ocarina.Backends.Ada_Tree.Nutils is
type Token_Type is type Token_Type is
( (
-- Token name Token type -- Token name Token type
-- Keywords -- Keywords
Tok_Mod, -- MOD **** First Keyword Tok_Mod, -- MOD **** First Keyword
Tok_Rem, -- REM Tok_Rem, -- REM
Tok_New, -- NEW Tok_New, -- NEW
Tok_Abs, -- ABS Tok_Abs, -- ABS
...@@ -147,7 +147,7 @@ package Ocarina.Backends.Ada_Tree.Nutils is ...@@ -147,7 +147,7 @@ package Ocarina.Backends.Ada_Tree.Nutils is
Tok_Dot_Dot, -- .. Tok_Dot_Dot, -- ..
Tok_Minus_Minus -- -- Tok_Minus_Minus -- --
); );
Token_Image : array (Token_Type) of Name_Id; Token_Image : array (Token_Type) of Name_Id;
......
...@@ -29,11 +29,11 @@ ...@@ -29,11 +29,11 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Charset; use Charset; with Charset; use Charset;
with Ocarina.Namet; with Ocarina.Namet;
with Ocarina.ME_AADL; with Ocarina.ME_AADL;
with Ocarina.ME_AADL.AADL_Instances.Nodes; 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; with Ocarina.ME_AADL.AADL_Instances.Entities;
use Ocarina.ME_AADL.AADL_Instances.Entities; use Ocarina.ME_AADL.AADL_Instances.Entities;
...@@ -56,7 +56,7 @@ package body Ocarina.Backends.Alloy is ...@@ -56,7 +56,7 @@ package body Ocarina.Backends.Alloy is
procedure Visit_Component_Instance (E : Node_Id); procedure Visit_Component_Instance (E : Node_Id);
FD : File_Type; FD : File_Type;
Root_System_Name : Name_Id; Root_System_Name : Name_Id;
----------- -----------
...@@ -92,7 +92,7 @@ package body Ocarina.Backends.Alloy is ...@@ -92,7 +92,7 @@ package body Ocarina.Backends.Alloy is
procedure Visit_Component_Instance (E : Node_Id) is procedure Visit_Component_Instance (E : Node_Id) is
Category_Name_String : constant array Category_Name_String : constant array
(Component_Category'Range) of Name_Id := (Component_Category'Range) of Name_Id :=
(CC_Abstract => Get_String_Name ("abstract"), (CC_Abstract => Get_String_Name ("abstract"),
CC_Bus => Get_String_Name ("bus"), CC_Bus => Get_String_Name ("bus"),
CC_Data => Get_String_Name ("data"), CC_Data => Get_String_Name ("data"),
...@@ -119,25 +119,30 @@ package body Ocarina.Backends.Alloy is ...@@ -119,25 +119,30 @@ package body Ocarina.Backends.Alloy is
-- of the corresponding instance name -- of the corresponding instance name
if Present (Parent_Subcomponent (E)) then if Present (Parent_Subcomponent (E)) then
Put_Line (FD, "one sig " & Put_Line
To_Lower (FD,
(Get_Name_String "one sig " &
(Normalize_Name To_Lower
(Fully_Qualified_Instance_Name (E)))) (Get_Name_String
& " extends Component{}{"); (Normalize_Name (Fully_Qualified_Instance_Name (E)))) &
" extends Component{}{");
else else
Put_Line (Kind (E)'Img); Put_Line (Kind (E)'Img);
Root_System_Name := Normalize_Name Root_System_Name := Normalize_Name (Display_Name (Identifier (E)));
(Display_Name (Identifier (E)));
Put_Line (FD, "one sig " & Put_Line
To_Lower (Get_Name_String (Root_System_Name)) (FD,
& " extends Component{}{"); "one sig " &
To_Lower (Get_Name_String (Root_System_Name)) &
" extends Component{}{");
end if; end if;
Put_Line (FD, ASCII.HT & "type=" Put_Line
& Get_Name_String (Category_Name_String (Category))); (FD,
ASCII.HT &
"type=" &
Get_Name_String (Category_Name_String (Category)));
-- Rule #2: list subcomponents -- Rule #2: list subcomponents
...@@ -148,10 +153,10 @@ package body Ocarina.Backends.Alloy is ...@@ -148,10 +153,10 @@ package body Ocarina.Backends.Alloy is
declare declare
Subcomponent_Name : constant String := Subcomponent_Name : constant String :=
To_Lower To_Lower
(Get_Name_String (Get_Name_String
(Normalize_Name (Normalize_Name
(Fully_Qualified_Instance_Name (Fully_Qualified_Instance_Name
(Corresponding_Instance (T))))); (Corresponding_Instance (T)))));
begin begin
Put (FD, Subcomponent_Name); Put (FD, Subcomponent_Name);
...@@ -173,18 +178,17 @@ package body Ocarina.Backends.Alloy is ...@@ -173,18 +178,17 @@ package body Ocarina.Backends.Alloy is
if Present (AIN.Properties (E)) then if Present (AIN.Properties (E)) then
T := First_Node (AIN.Properties (E)); T := First_Node (AIN.Properties (E));
while Present (T) loop while Present (T) loop
Put (FD, Put
To_Lower (FD,
(Get_Name_String To_Lower
(Normalize_Name (Get_Name_String
(Display_Name (Normalize_Name (Display_Name (Identifier (T))))));
(Identifier (T))))));
T := Next_Node (T); T := Next_Node (T);
if Present (T) then if Present (T) then
Put (FD, "+"); Put (FD, "+");
end if; end if;
end loop; end loop;
New_Line (Fd); New_Line (FD);
else else
Put_Line (FD, "none"); Put_Line (FD, "none");
...@@ -255,8 +259,9 @@ package body Ocarina.Backends.Alloy is ...@@ -255,8 +259,9 @@ package body Ocarina.Backends.Alloy is
-- Add global contract -- Add global contract
New_Line (FD); New_Line (FD);
Put_Line (FD, "// Declaration of the contract(s) " Put_Line
& "representing the model(s)"); (FD,
"// Declaration of the contract(s) " & "representing the model(s)");
New_Line (FD); New_Line (FD);
Put_Line (FD, "one sig aadl_model extends Contract{}{"); Put_Line (FD, "one sig aadl_model extends Contract{}{");
Put_Line (FD, ASCII.HT & "assumption=none"); Put_Line (FD, ASCII.HT & "assumption=none");
...@@ -266,9 +271,9 @@ package body Ocarina.Backends.Alloy is ...@@ -266,9 +271,9 @@ package body Ocarina.Backends.Alloy is
-- Generate output -- Generate output
declare declare
Print_Subcomponents : Boolean := True; Print_Subcomponents : Boolean := True;
E : constant Node_Id := Root_System (Instance_Root); E : constant Node_Id := Root_System (Instance_Root);
T : Node_Id; T : Node_Id;
begin begin
-- We consider two patterns -- We consider two patterns
-- a) system with subcomponents as system/bus/device only -- a) system with subcomponents as system/bus/device only
...@@ -277,10 +282,12 @@ package body Ocarina.Backends.Alloy is ...@@ -277,10 +282,12 @@ package body Ocarina.Backends.Alloy is
if Present (Subcomponents (E)) then if Present (Subcomponents (E)) then
T := First_Node (Subcomponents (E)); T := First_Node (Subcomponents (E));
while Present (T) loop while Present (T) loop
Print_Subcomponents := Print_Subcomponents Print_Subcomponents :=
and then (Get_Category_Of_Component (T) = CC_System Print_Subcomponents
or else Get_Category_Of_Component (T) = CC_Device and then
or else Get_Category_Of_Component (T) = CC_Bus); (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); T := Next_Node (T);
end loop; end loop;
end if; end if;
...@@ -288,17 +295,17 @@ package body Ocarina.Backends.Alloy is ...@@ -288,17 +295,17 @@ package body Ocarina.Backends.Alloy is
-- We are in case a), generate all subcomponents of root system -- We are in case a), generate all subcomponents of root system
if Print_Subcomponents then if Print_Subcomponents then
Put (Fd, ASCII.HT & "output="); Put (FD, ASCII.HT & "output=");
if Present (Subcomponents (E)) then if Present (Subcomponents (E)) then
T := First_Node (Subcomponents (E)); T := First_Node (Subcomponents (E));
while Present (T) loop while Present (T) loop
declare declare
Subcomponent_Name : constant String := Subcomponent_Name : constant String :=
To_Lower To_Lower
(Get_Name_String (Get_Name_String
(Normalize_Name (Normalize_Name
(Fully_Qualified_Instance_Name (Fully_Qualified_Instance_Name
(Corresponding_Instance (T))))); (Corresponding_Instance (T)))));
begin begin
Put (FD, Subcomponent_Name); Put (FD, Subcomponent_Name);
...@@ -316,8 +323,11 @@ package body Ocarina.Backends.Alloy is ...@@ -316,8 +323,11 @@ package body Ocarina.Backends.Alloy is
else else
-- We are in case b), generate only root system -- We are in case b), generate only root system
Put_Line (FD, ASCII.HT & "output=" Put_Line
& To_Lower (Get_Name_String (Root_System_Name))); (FD,
ASCII.HT &
"output=" &
To_Lower (Get_Name_String (Root_System_Name)));
end if; end if;
end; end;
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Ocarina.Namet; use Ocarina.Namet; with Ocarina.Namet; use Ocarina.Namet;
with Utils; use Utils; with Utils; use Utils;
with Ocarina.ME_AADL; with Ocarina.ME_AADL;
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;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
with Charset; use Charset; with Charset; use Charset;
with Locations; use Locations; with Locations; use Locations;
with Ocarina.Namet; use Ocarina.Namet; with Ocarina.Namet; use Ocarina.Namet;
with Utils; use Utils; with Utils; use Utils;
with Ocarina.Backends.ASN1_Tree.Nutils; use Ocarina.Backends.ASN1_Tree.Nutils; with Ocarina.Backends.ASN1_Tree.Nutils; use Ocarina.Backends.ASN1_Tree.Nutils;
with Ocarina.Backends.ASN1_Values; use Ocarina.Backends.ASN1_Values; with Ocarina.Backends.ASN1_Values; use Ocarina.Backends.ASN1_Values;
......
...@@ -29,10 +29,10 @@ ...@@ -29,10 +29,10 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with GNAT.OS_Lib; use GNAT.OS_Lib; with GNAT.OS_Lib; use GNAT.OS_Lib;
with Outfiles; use Outfiles; with Outfiles; use Outfiles;
with Ocarina.Namet; use Ocarina.Namet; with Ocarina.Namet; use Ocarina.Namet;
with Ocarina.Output; use Ocarina.Output; with Ocarina.Output; use Ocarina.Output;
with Ocarina.Backends.ASN1_Values; with Ocarina.Backends.ASN1_Values;
with Ocarina.Backends.ASN1_Tree.Nodes; with Ocarina.Backends.ASN1_Tree.Nodes;
......
...@@ -31,9 +31,9 @@ ...@@ -31,9 +31,9 @@
with GNAT.Table; with GNAT.Table;
with Ocarina.Namet; use Ocarina.Namet; with Ocarina.Namet; use Ocarina.Namet;
with Charset; use Charset; with Charset; use Charset;
with Locations; use Locations; with Locations; use Locations;
with Ocarina.Backends.ASN1_Tree.Nodes; with Ocarina.Backends.ASN1_Tree.Nodes;
with Ocarina.ME_AADL.AADL_Instances.Nodes; with Ocarina.ME_AADL.AADL_Instances.Nodes;
...@@ -402,7 +402,8 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is ...@@ -402,7 +402,8 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is
Name := Name_Find; Name := Name_Find;
Name := Add_Suffix_To_Name (Keyword_Suffix, Name); Name := Add_Suffix_To_Name (Keyword_Suffix, Name);
Set_Name_Table_Byte 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)); Set_Str_To_Name_Buffer (Image (T));
else else
......
...@@ -40,7 +40,7 @@ with Ocarina.ME_AADL.AADL_Instances.Entities; ...@@ -40,7 +40,7 @@ with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.Backends.Properties; use Ocarina.Backends.Properties; with Ocarina.Backends.Properties; use Ocarina.Backends.Properties;
with Ocarina.Options; use Ocarina.Options; with Ocarina.Options; use Ocarina.Options;
with Utils; use Utils; with Utils; use Utils;
with Ada.Text_IO; with Ada.Text_IO;
with GNAT.IO_Aux; with GNAT.IO_Aux;
......
...@@ -316,7 +316,7 @@ package body Ocarina.Backends.Build_Utils is ...@@ -316,7 +316,7 @@ package body Ocarina.Backends.Build_Utils is
-- The node name (in lower case) -- The node name (in lower case)
Execution_Platform : Supported_Execution_Platform := Platform_None; 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 -- The execution platform of the processor the current node
-- is bound to. -- is bound to.
...@@ -1428,13 +1428,13 @@ package body Ocarina.Backends.Build_Utils is ...@@ -1428,13 +1428,13 @@ package body Ocarina.Backends.Build_Utils is
Write_Line ("all:"); Write_Line ("all:");
Write_Line Write_Line
(ASCII.HT & (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_Eol;
Write_Line ("clean:"); Write_Line ("clean:");
Write_Line Write_Line
(ASCII.HT & (ASCII.HT &
"set -e; for d in $(SUBDIRS); do $(MAKE) " & "set -e; for d in $(SUBDIRS); do $(MAKE) " &
"clean -C $$d ; done"); "clean -C $$d ; done");
-- Close the file -- Close the file
...@@ -1576,8 +1576,8 @@ package body Ocarina.Backends.Build_Utils is ...@@ -1576,8 +1576,8 @@ package body Ocarina.Backends.Build_Utils is
Write_Line ("prove:"); Write_Line ("prove:");
Write_Line Write_Line
(ASCII.HT & (ASCII.HT &
"gnatprove -P$(PROJECT_FILE) -XTARGET=SPARK " "gnatprove -P$(PROJECT_FILE) -XTARGET=SPARK " &
& "--warnings=continue --report=fail"); "--warnings=continue --report=fail");
end if; end if;
-- Close the file -- Close the file
......
...@@ -1373,9 +1373,9 @@ package body Ocarina.Backends.C_Common.Mapping is ...@@ -1373,9 +1373,9 @@ package body Ocarina.Backends.C_Common.Mapping is
if Scade_Name = No_Name then if Scade_Name = No_Name then
Display_Located_Error Display_Located_Error
(AIN.Loc (Parameter), (AIN.Loc (Parameter),
"The Parameter does not specify a SCADE mapping", "The Parameter does not specify a SCADE mapping",
Fatal => True); Fatal => True);
end if; end if;
return CTU.Make_Defining_Identifier (Scade_Name, C_Conversion => False); return CTU.Make_Defining_Identifier (Scade_Name, C_Conversion => False);
...@@ -1996,8 +1996,7 @@ package body Ocarina.Backends.C_Common.Mapping is ...@@ -1996,8 +1996,7 @@ package body Ocarina.Backends.C_Common.Mapping is
CTU.Make_Parameter_Specification CTU.Make_Parameter_Specification
(Defining_Identifier => (Defining_Identifier =>
Map_C_Defining_Identifier (F), Map_C_Defining_Identifier (F),
Parameter_Type => Parameter_Type => Map_C_Data_Type_Designator (D));
Map_C_Data_Type_Designator (D));
else else
Param := Param :=
CTU.Make_Parameter_Specification CTU.Make_Parameter_Specification
...@@ -2019,13 +2018,11 @@ package body Ocarina.Backends.C_Common.Mapping is ...@@ -2019,13 +2018,11 @@ package body Ocarina.Backends.C_Common.Mapping is
Field := AIN.First_Node (Subcomponents (D)); Field := AIN.First_Node (Subcomponents (D));
while Present (Field) loop while Present (Field) loop
if AINU.Is_Data if AINU.Is_Data (Corresponding_Instance (Field)) then
(Corresponding_Instance (Field))
then
if Mode = Mode_In then if Mode = Mode_In then
Param := Param :=
CTU.Make_Parameter_Specification CTU.Make_Parameter_Specification
(Defining_Identifier => (Defining_Identifier =>
Map_C_Defining_Identifier (Field), Map_C_Defining_Identifier (Field),
Parameter_Type => Parameter_Type =>
Map_C_Data_Type_Designator Map_C_Data_Type_Designator
...@@ -2038,8 +2035,7 @@ package body Ocarina.Backends.C_Common.Mapping is ...@@ -2038,8 +2035,7 @@ package body Ocarina.Backends.C_Common.Mapping is
Parameter_Type => Parameter_Type =>
Make_Pointer_Type Make_Pointer_Type
(Map_C_Data_Type_Designator (Map_C_Data_Type_Designator
(Corresponding_Instance (Corresponding_Instance (Field))));
(Field))));
end if; end if;
CTU.Append_Node_To_List (Param, Profile); CTU.Append_Node_To_List (Param, Profile);
end if; end if;
...@@ -3042,8 +3038,8 @@ package body Ocarina.Backends.C_Common.Mapping is ...@@ -3042,8 +3038,8 @@ package body Ocarina.Backends.C_Common.Mapping is
-- Port Name have to be the same. -- Port Name have to be the same.
-- --
if Get_Connection_Pattern (E) = Inter_Process and then if Get_Connection_Pattern (E) = Inter_Process
POK_Flavor = DEOS and then POK_Flavor = DEOS
then then
Get_Name_String (Display_Name (Identifier (E))); Get_Name_String (Display_Name (Identifier (E)));
N := Name_Find; N := Name_Find;
......
...@@ -799,9 +799,7 @@ package body Ocarina.Backends.C_Common.Types is ...@@ -799,9 +799,7 @@ package body Ocarina.Backends.C_Common.Types is
False), False),
True); True);
end if; end if;
elsif Get_Concurrency_Protocol (E) =