diff --git a/src/backends/ocarina-backends-aadl_xml.adb b/src/backends/ocarina-backends-aadl_xml.adb
index c201c48c..1d1cd17a 100644
--- a/src/backends/ocarina-backends-aadl_xml.adb
+++ b/src/backends/ocarina-backends-aadl_xml.adb
@@ -37,9 +37,6 @@ with Ocarina.Backends.Utils;
with Ocarina.Backends.XML_Tree.Nodes;
with Ocarina.Backends.XML_Tree.Nutils;
with Ocarina.Backends.XML_Tree.Generator;
-with GNAT.Command_Line; use GNAT.Command_Line;
-
-with Ocarina.Namet; use Ocarina.Namet;
package body Ocarina.Backends.AADL_XML is
@@ -51,8 +48,6 @@ package body Ocarina.Backends.AADL_XML is
package XTN renames Ocarina.Backends.XML_Tree.Nodes;
package XTU renames Ocarina.Backends.XML_Tree.Nutils;
- Generated_Sources_Directory : Name_Id := No_Name;
-
procedure Visit_Architecture_Instance (E : Node_Id);
-- Most top level visitor routine. E is the root of the AADL
-- instance tree. The procedure does a traversal for each
@@ -99,27 +94,6 @@ package body Ocarina.Backends.AADL_XML is
procedure Init is
begin
- Generated_Sources_Directory := Get_String_Name (".");
- Initialize_Option_Scan;
- loop
- case Getopt ("* o:") is
- when ASCII.NUL =>
- exit;
-
- when 'o' =>
- declare
- D : constant String := Parameter;
- begin
- if D'Length /= 0 then
- Generated_Sources_Directory := Get_String_Name (D);
- end if;
- end;
-
- when others =>
- null;
- end case;
- end loop;
-
Register_Backend ("aadl_xml", Generate'Access, AADLXML);
end Init;
diff --git a/src/backends/ocarina-backends-alloy.adb b/src/backends/ocarina-backends-alloy.adb
index a31daafd..c7f9e40a 100644
--- a/src/backends/ocarina-backends-alloy.adb
+++ b/src/backends/ocarina-backends-alloy.adb
@@ -37,7 +37,6 @@ with Ocarina.Instances; use Ocarina.Instances;
with Ocarina.ME_AADL.AADL_Instances.Entities;
use Ocarina.ME_AADL.AADL_Instances.Entities;
-with GNAT.Command_Line;
with Ocarina.Backends.Utils;
with Ada.Text_IO;
@@ -224,9 +223,8 @@ package body Ocarina.Backends.Alloy is
--------------
procedure Generate (AADL_Root : Node_Id) is
- use GNAT.Command_Line;
-
Instance_Root : Node_Id;
+
begin
-- Instantiate the AADL tree
@@ -235,18 +233,6 @@ package body Ocarina.Backends.Alloy is
raise Program_Error;
end if;
- Initialize_Option_Scan;
- loop
- case Getopt ("* ") is
-
- when ASCII.NUL =>
- exit;
-
- when others =>
- null;
- end case;
- end loop;
-
-- Open a new .als file
Create (File => FD, Name => "con_model.als");
diff --git a/src/backends/ocarina-backends-arinc653_conf.adb b/src/backends/ocarina-backends-arinc653_conf.adb
index 776505c2..ae73d3ad 100644
--- a/src/backends/ocarina-backends-arinc653_conf.adb
+++ b/src/backends/ocarina-backends-arinc653_conf.adb
@@ -44,8 +44,6 @@ with Ocarina.Backends.ARINC653_Conf.System_HM;
with Ocarina.Backends.ARINC653_Conf.Module_HM;
with Ocarina.Backends.Utils;
-with GNAT.Command_Line; use GNAT.Command_Line;
-
with Ocarina.Namet; use Ocarina.Namet;
package body Ocarina.Backends.ARINC653_Conf is
@@ -59,9 +57,6 @@ package body Ocarina.Backends.ARINC653_Conf is
package XTN renames Ocarina.Backends.XML_Tree.Nodes;
package XTU renames Ocarina.Backends.XML_Tree.Nutils;
- Remove_Generated_Sources : Boolean := False;
- Generated_Sources_Directory : Name_Id := No_Name;
-
--------------
-- Generate --
--------------
@@ -107,30 +102,6 @@ package body Ocarina.Backends.ARINC653_Conf is
procedure Init is
begin
- Generated_Sources_Directory := Get_String_Name (".");
- Initialize_Option_Scan;
- loop
- case Getopt ("* b z o:") is
- when ASCII.NUL =>
- exit;
-
- when 'z' =>
- Remove_Generated_Sources := True;
-
- when 'o' =>
- declare
- D : constant String := Parameter;
- begin
- if D'Length /= 0 then
- Generated_Sources_Directory := Get_String_Name (D);
- end if;
- end;
-
- when others =>
- null;
- end case;
- end loop;
-
Register_Backend ("ARINC653_Conf", Generate'Access, Statistics);
end Init;
diff --git a/src/backends/ocarina-backends-asn1.adb b/src/backends/ocarina-backends-asn1.adb
index 967b6318..048542a0 100644
--- a/src/backends/ocarina-backends-asn1.adb
+++ b/src/backends/ocarina-backends-asn1.adb
@@ -36,16 +36,9 @@ with Ocarina.Backends.ASN1_Tree.Generator;
with Ocarina.Backends.ASN1_Tree.Nutils;
with Ocarina.Backends.ASN1.Deployment;
with Ocarina.Backends.Utils;
-with GNAT.Command_Line;
-
-with Ocarina.Namet;
package body Ocarina.Backends.ASN1 is
- use GNAT.Command_Line;
-
- use Ocarina.Namet;
-
use Ocarina.Backends.Messages;
use Ocarina.Backends.ASN1_Tree.Generator;
use Ocarina.Backends.ASN1_Tree.Nutils;
@@ -53,8 +46,6 @@ package body Ocarina.Backends.ASN1 is
use Ocarina.Backends.Expander;
use Ocarina.Instances;
- Generated_Sources_Directory : Name_Id := No_Name;
-
procedure Visit_Architecture_Instance (E : Node_Id);
-- Most top level visitor routine. E is the root of the AADL
-- instance tree. The procedure does a traversal for each
@@ -99,27 +90,6 @@ package body Ocarina.Backends.ASN1 is
procedure Init is
begin
ASN1_Tree.Nutils.Initialize;
- Generated_Sources_Directory := Get_String_Name (".");
- Initialize_Option_Scan;
- loop
- case Getopt ("* b z ec er o: perf") is
- when ASCII.NUL =>
- exit;
-
- when 'o' =>
- declare
- D : constant String := Parameter;
- begin
- if D'Length /= 0 then
- Generated_Sources_Directory := Get_String_Name (D);
- end if;
- end;
-
- when others =>
- null;
- end case;
- end loop;
-
Register_Backend ("asn1_deployment", Generate'Access, ASN1_Deployment);
end Init;
diff --git a/src/backends/ocarina-backends-boundt.adb b/src/backends/ocarina-backends-boundt.adb
index 19e4ca33..896be8c0 100644
--- a/src/backends/ocarina-backends-boundt.adb
+++ b/src/backends/ocarina-backends-boundt.adb
@@ -39,7 +39,7 @@ with Ocarina.Instances; use Ocarina.Instances;
with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.Backends.Properties; use Ocarina.Backends.Properties;
with Ocarina.Options; use Ocarina.Options;
-with GNAT.Command_Line;
+
with Utils; use Utils;
with Ada.Text_IO;
@@ -290,8 +290,6 @@ package body Ocarina.Backends.BoundT is
procedure Init is
begin
- -- Registration of the generator
-
Register_Backend ("boundt", Generate'Access, Bound_T);
end Init;
@@ -300,9 +298,8 @@ package body Ocarina.Backends.BoundT is
--------------
procedure Generate (AADL_Root : Node_Id) is
- use GNAT.Command_Line;
-
Instance_Root : Node_Id;
+
begin
-- Instantiate the AADL tree
@@ -311,23 +308,6 @@ package body Ocarina.Backends.BoundT is
raise Program_Error;
end if;
- Initialize_Option_Scan;
- loop
- case Getopt ("* boundt_process:") is
-
- when ASCII.NUL =>
- exit;
-
- when 'b' =>
- if Full_Switch = "boundt_process" then
- Boundt_Process := To_Lower (Get_String_Name (Parameter));
- end if;
-
- when others =>
- null;
- end case;
- end loop;
-
-- Open a new TPO file
if Boundt_Process = No_Name then
diff --git a/src/backends/ocarina-backends-carts.adb b/src/backends/ocarina-backends-carts.adb
index d92e2bf1..b40a168e 100644
--- a/src/backends/ocarina-backends-carts.adb
+++ b/src/backends/ocarina-backends-carts.adb
@@ -37,7 +37,6 @@ with Ocarina.Backends.Utils;
with Ocarina.Backends.XML_Tree.Nodes;
with Ocarina.Backends.XML_Tree.Nutils;
with Ocarina.Backends.XML_Tree.Generator;
-with GNAT.Command_Line; use GNAT.Command_Line;
with Ocarina.Namet; use Ocarina.Namet;
@@ -51,9 +50,6 @@ package body Ocarina.Backends.Carts is
package XTN renames Ocarina.Backends.XML_Tree.Nodes;
package XTU renames Ocarina.Backends.XML_Tree.Nutils;
- Generated_Sources_Directory : Name_Id := No_Name;
- Remove_Generated_Sources : Boolean := False;
-
procedure Visit_Architecture_Instance (E : Node_Id);
-- Most top level visitor routine. E is the root of the AADL
-- instance tree. The procedure does a traversal for each
@@ -97,30 +93,6 @@ package body Ocarina.Backends.Carts is
procedure Init is
begin
- Generated_Sources_Directory := Get_String_Name (".");
- Initialize_Option_Scan;
- loop
- case Getopt ("* z o:") is
- when ASCII.NUL =>
- exit;
-
- when 'z' =>
- Remove_Generated_Sources := True;
-
- when 'o' =>
- declare
- D : constant String := Parameter;
- begin
- if D'Length /= 0 then
- Generated_Sources_Directory := Get_String_Name (D);
- end if;
- end;
-
- when others =>
- null;
- end case;
- end loop;
-
Register_Backend ("carts", Generate'Access, Carts_XML);
end Init;
diff --git a/src/backends/ocarina-backends-cheddar.adb b/src/backends/ocarina-backends-cheddar.adb
index f83dcd8c..c23f2830 100644
--- a/src/backends/ocarina-backends-cheddar.adb
+++ b/src/backends/ocarina-backends-cheddar.adb
@@ -38,10 +38,6 @@ with Ocarina.Backends.XML_Tree.Nodes;
with Ocarina.Backends.XML_Tree.Nutils;
with Ocarina.Backends.XML_Tree.Generator;
-with GNAT.Command_Line; use GNAT.Command_Line;
-
-with Ocarina.Namet; use Ocarina.Namet;
-
package body Ocarina.Backends.Cheddar is
use Ocarina.Instances;
@@ -52,8 +48,6 @@ package body Ocarina.Backends.Cheddar is
package XTN renames Ocarina.Backends.XML_Tree.Nodes;
package XTU renames Ocarina.Backends.XML_Tree.Nutils;
- Generated_Sources_Directory : Name_Id := No_Name;
-
procedure Visit_Architecture_Instance (E : Node_Id);
-- Most top level visitor routine. E is the root of the AADL
-- instance tree. The procedure does a traversal for each
@@ -102,27 +96,6 @@ package body Ocarina.Backends.Cheddar is
procedure Init is
begin
- Generated_Sources_Directory := Get_String_Name (".");
- Initialize_Option_Scan;
- loop
- case Getopt ("* b o:") is
- when ASCII.NUL =>
- exit;
-
- when 'o' =>
- declare
- D : constant String := Parameter;
- begin
- if D'Length /= 0 then
- Generated_Sources_Directory := Get_String_Name (D);
- end if;
- end;
-
- when others =>
- null;
- end case;
- end loop;
-
Register_Backend ("cheddar", Generate'Access, Cheddar_XML);
end Init;
diff --git a/src/backends/ocarina-backends-connection_matrix.adb b/src/backends/ocarina-backends-connection_matrix.adb
index 7a8e5bf5..c826c882 100644
--- a/src/backends/ocarina-backends-connection_matrix.adb
+++ b/src/backends/ocarina-backends-connection_matrix.adb
@@ -36,10 +36,6 @@ with Ocarina.Backends.XML_Tree.Generator;
with Ocarina.Backends.Utils;
with Ocarina.Backends.Connection_Matrix.Main;
-with GNAT.Command_Line; use GNAT.Command_Line;
-
-with Ocarina.Namet; use Ocarina.Namet;
-
package body Ocarina.Backends.Connection_Matrix is
use Ocarina.Instances;
@@ -48,9 +44,6 @@ package body Ocarina.Backends.Connection_Matrix is
use Ocarina.Backends.XML_Tree.Generator;
use Ocarina.Backends.Utils;
- Remove_Generated_Sources : Boolean := False;
- Generated_Sources_Directory : Name_Id := No_Name;
-
procedure Visit_Architecture_Instance (E : Node_Id);
-- Most top level visitor routine. E is the root of the AADL
-- instance tree. The procedure does a traversal for each
@@ -99,30 +92,6 @@ package body Ocarina.Backends.Connection_Matrix is
procedure Init is
begin
- Generated_Sources_Directory := Get_String_Name (".");
- Initialize_Option_Scan;
- loop
- case Getopt ("* b z o:") is
- when ASCII.NUL =>
- exit;
-
- when 'z' =>
- Remove_Generated_Sources := True;
-
- when 'o' =>
- declare
- D : constant String := Parameter;
- begin
- if D'Length /= 0 then
- Generated_Sources_Directory := Get_String_Name (D);
- end if;
- end;
-
- when others =>
- null;
- end case;
- end loop;
-
Register_Backend
("Connection_Matrix",
Generate'Access,
diff --git a/src/backends/ocarina-backends-deos_conf.adb b/src/backends/ocarina-backends-deos_conf.adb
index 4c28ca83..94d88ed5 100644
--- a/src/backends/ocarina-backends-deos_conf.adb
+++ b/src/backends/ocarina-backends-deos_conf.adb
@@ -41,8 +41,6 @@ with Ocarina.Backends.Deos_Conf.Naming;
with Ocarina.Backends.Deos_Conf.Partitions;
with Ocarina.Backends.Utils;
-with GNAT.Command_Line; use GNAT.Command_Line;
-
with Ocarina.Namet; use Ocarina.Namet;
package body Ocarina.Backends.Deos_Conf is
@@ -58,9 +56,6 @@ package body Ocarina.Backends.Deos_Conf is
package XTN renames Ocarina.Backends.XML_Tree.Nodes;
package XTU renames Ocarina.Backends.XML_Tree.Nutils;
- Remove_Generated_Sources : Boolean := False;
- Generated_Sources_Directory : Name_Id := No_Name;
-
--------------
-- Generate --
--------------
@@ -106,30 +101,6 @@ package body Ocarina.Backends.Deos_Conf is
procedure Init is
begin
- Generated_Sources_Directory := Get_String_Name (".");
- Initialize_Option_Scan;
- loop
- case Getopt ("* b z o:") is
- when ASCII.NUL =>
- exit;
-
- when 'z' =>
- Remove_Generated_Sources := True;
-
- when 'o' =>
- declare
- D : constant String := Parameter;
- begin
- if D'Length /= 0 then
- Generated_Sources_Directory := Get_String_Name (D);
- end if;
- end;
-
- when others =>
- null;
- end case;
- end loop;
-
Register_Backend ("Deos_Conf", Generate'Access, Deos_XML);
end Init;
diff --git a/src/backends/ocarina-backends-functions_matrix.adb b/src/backends/ocarina-backends-functions_matrix.adb
index 5e626a4d..7e7c44fa 100644
--- a/src/backends/ocarina-backends-functions_matrix.adb
+++ b/src/backends/ocarina-backends-functions_matrix.adb
@@ -36,10 +36,6 @@ with Ocarina.Backends.XML_Tree.Generator;
with Ocarina.Backends.Utils;
with Ocarina.Backends.Functions_Matrix.Main;
-with GNAT.Command_Line; use GNAT.Command_Line;
-
-with Ocarina.Namet; use Ocarina.Namet;
-
package body Ocarina.Backends.Functions_Matrix is
use Ocarina.Instances;
@@ -48,9 +44,6 @@ package body Ocarina.Backends.Functions_Matrix is
use Ocarina.Backends.XML_Tree.Generator;
use Ocarina.Backends.Utils;
- Remove_Generated_Sources : Boolean := False;
- Generated_Sources_Directory : Name_Id := No_Name;
-
procedure Visit_Architecture_Instance (E : Node_Id);
-- Most top level visitor routine. E is the root of the AADL
-- instance tree. The procedure does a traversal for each
@@ -101,34 +94,8 @@ package body Ocarina.Backends.Functions_Matrix is
procedure Init is
begin
- Generated_Sources_Directory := Get_String_Name (".");
- Initialize_Option_Scan;
- loop
- case Getopt ("* b z o:") is
- when ASCII.NUL =>
- exit;
-
- when 'z' =>
- Remove_Generated_Sources := True;
-
- when 'o' =>
- declare
- D : constant String := Parameter;
- begin
- if D'Length /= 0 then
- Generated_Sources_Directory := Get_String_Name (D);
- end if;
- end;
-
- when others =>
- null;
- end case;
- end loop;
-
Register_Backend
- ("Function_Matrix",
- Generate'Access,
- Functions_Matrix_Analysis);
+ ("Function_Matrix", Generate'Access, Functions_Matrix_Analysis);
end Init;
-----------
diff --git a/src/backends/ocarina-backends-mast.adb b/src/backends/ocarina-backends-mast.adb
index adaf36d1..e3b300bf 100644
--- a/src/backends/ocarina-backends-mast.adb
+++ b/src/backends/ocarina-backends-mast.adb
@@ -33,11 +33,9 @@ with Ocarina.Instances;
with Ocarina.Backends.Expander;
with Ocarina.Backends.Messages;
with Ocarina.Backends.Utils;
--- with Ocarina.Backends.MAST_Tree.Nodes;
with Ocarina.Backends.MAST_Tree.Nutils;
with Ocarina.Backends.MAST.Main;
with Ocarina.Backends.MAST_Tree.Generator;
-with GNAT.Command_Line; use GNAT.Command_Line;
with Ocarina.Namet; use Ocarina.Namet;
@@ -48,12 +46,8 @@ package body Ocarina.Backends.MAST is
use Ocarina.Backends.Utils;
use Ocarina.Backends.Expander;
--- package MTN renames Ocarina.Backends.MAST_Tree.Nodes;
package MTU renames Ocarina.Backends.MAST_Tree.Nutils;
- Generated_Sources_Directory : Name_Id := No_Name;
- Remove_Generated_Sources : Boolean := False;
-
procedure Visit_Architecture_Instance (E : Node_Id);
-- Most top level visitor routine. E is the root of the AADL
-- instance tree. The procedure does a traversal for each
@@ -85,8 +79,8 @@ package body Ocarina.Backends.MAST is
if not Remove_Generated_Sources then
MAST_Tree.Generator.Generate (MAST_File);
end if;
- Leave_Directory;
+ Leave_Directory;
end Generate;
----------
@@ -95,30 +89,6 @@ package body Ocarina.Backends.MAST is
procedure Init is
begin
- Generated_Sources_Directory := Get_String_Name (".");
- Initialize_Option_Scan;
- loop
- case Getopt ("* z o:") is
- when ASCII.NUL =>
- exit;
-
- when 'z' =>
- Remove_Generated_Sources := True;
-
- when 'o' =>
- declare
- D : constant String := Parameter;
- begin
- if D'Length /= 0 then
- Generated_Sources_Directory := Get_String_Name (D);
- end if;
- end;
-
- when others =>
- null;
- end case;
- end loop;
-
Register_Backend ("mast", Generate'Access, MAST_Scheduling);
end Init;
diff --git a/src/backends/ocarina-backends-po_hi_ada.adb b/src/backends/ocarina-backends-po_hi_ada.adb
index c1a4b7de..44a28a63 100644
--- a/src/backends/ocarina-backends-po_hi_ada.adb
+++ b/src/backends/ocarina-backends-po_hi_ada.adb
@@ -54,8 +54,6 @@ with Ocarina.Backends.Build_Utils;
with Ocarina.Backends.Execution_Utils;
with Ocarina.Backends.Execution_Tests;
-with GNAT.Command_Line; use GNAT.Command_Line;
-
with Ocarina.Namet; use Ocarina.Namet;
package body Ocarina.Backends.PO_HI_Ada is
@@ -73,12 +71,6 @@ package body Ocarina.Backends.PO_HI_Ada is
use Ocarina.Backends.Execution_Utils;
use Ocarina.Backends.Execution_Tests;
- Compile_Generated_Sources : Boolean := False;
- Remove_Generated_Sources : Boolean := False;
- Do_Coverage_Test : Boolean := False;
- Do_Regression_Test : Boolean := False;
- Generated_Sources_Directory : Name_Id := No_Name;
-
procedure Visit_Architecture_Instance (E : Node_Id);
-- Most top level visitor routine. E is the root of the AADL
-- instance tree. The procedure does a traversal for each
@@ -392,7 +384,9 @@ package body Ocarina.Backends.PO_HI_Ada is
end loop;
end if;
- Write_Line (");");
+ Write_Line
+ (") & external_as_list(""" & "ADA_INCLUDE_PATH" & """, """ & ":" &
+ """);");
Decrement_Indentation;
@@ -641,41 +635,6 @@ package body Ocarina.Backends.PO_HI_Ada is
procedure Init is
begin
- Generated_Sources_Directory := Get_String_Name (".");
- Initialize_Option_Scan;
- loop
- case Getopt ("* b z ec er o:") is
- when ASCII.NUL =>
- exit;
-
- when 'b' =>
- Compile_Generated_Sources := True;
-
- when 'z' =>
- Remove_Generated_Sources := True;
-
- when 'e' =>
- Compile_Generated_Sources := True;
- if Full_Switch = "ec" then
- Do_Coverage_Test := True;
- elsif Full_Switch = "er" then
- Do_Regression_Test := True;
- end if;
-
- when 'o' =>
- declare
- D : constant String := Parameter;
- begin
- if D'Length /= 0 then
- Generated_Sources_Directory := Get_String_Name (D);
- end if;
- end;
-
- when others =>
- null;
- end case;
- end loop;
-
-- Registration of the generator
Register_Backend ("polyorb_hi_ada", Generate'Access, PolyORB_HI_Ada);
diff --git a/src/backends/ocarina-backends-po_hi_c.adb b/src/backends/ocarina-backends-po_hi_c.adb
index 5b7ba145..0af0ee9c 100644
--- a/src/backends/ocarina-backends-po_hi_c.adb
+++ b/src/backends/ocarina-backends-po_hi_c.adb
@@ -58,13 +58,11 @@ with Ocarina.Backends.Execution_Utils;
with Ocarina.Backends.Execution_Tests;
with Ocarina.Backends.Properties;
with Ocarina.Backends.ASN1;
-with GNAT.Command_Line;
with Ocarina.Namet;
package body Ocarina.Backends.PO_HI_C is
- use GNAT.Command_Line;
use GNAT.OS_Lib;
use Ocarina.Namet;
@@ -98,15 +96,6 @@ package body Ocarina.Backends.PO_HI_C is
package AAU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
package CTN renames Ocarina.Backends.C_Tree.Nodes;
- Generate_ASN1_Deployment : Boolean := False;
- Compile_Generated_Sources : Boolean := False;
- Remove_Generated_Sources : Boolean := False;
- Add_Performance_Analysis : Boolean := False;
- Do_Regression_Test : Boolean := False;
- Do_Coverage_Test : Boolean := False;
- Generated_Sources_Directory : Name_Id := No_Name;
- Verbose_Mode : Boolean := False;
-
procedure Visit_Architecture_Instance (E : Node_Id);
-- Most top level visitor routine. E is the root of the AADL
-- instance tree. The procedure does a traversal for each
@@ -540,13 +529,6 @@ package body Ocarina.Backends.PO_HI_C is
-- Enter the output directory
Enter_Directory (Generated_Sources_Directory);
- if Verbose_Mode then
- Set_Standard_Error;
- Write_Str ("Generating code in directory: ");
- Write_Name (Generated_Sources_Directory);
- Write_Eol;
- Set_Standard_Output;
- end if;
if Remove_Generated_Sources then
Build_Utils.Makefiles.Clean (Instance_Root);
@@ -640,54 +622,6 @@ package body Ocarina.Backends.PO_HI_C is
procedure Init is
begin
- Generated_Sources_Directory := Get_String_Name (".");
- Initialize_Option_Scan;
- loop
- case Getopt ("* b z ec er o: perf asn1 v") is
- when ASCII.NUL =>
- exit;
-
- when 'a' =>
- if Full_Switch = "asn1" then
- Generate_ASN1_Deployment := True;
- end if;
-
- when 'b' =>
- Compile_Generated_Sources := True;
-
- when 'v' =>
- Verbose_Mode := True;
-
- when 'z' =>
- Remove_Generated_Sources := True;
-
- when 'p' =>
- if Full_Switch = "perf" then
- Add_Performance_Analysis := True;
- end if;
-
- when 'e' =>
- Compile_Generated_Sources := True;
- if Full_Switch = "ec" then
- Do_Coverage_Test := True;
- elsif Full_Switch = "er" then
- Do_Regression_Test := True;
- end if;
-
- when 'o' =>
- declare
- D : constant String := Parameter;
- begin
- if D'Length /= 0 then
- Generated_Sources_Directory := Get_String_Name (D);
- end if;
- end;
-
- when others =>
- null;
- end case;
- end loop;
-
Register_Backend ("polyorb_hi_c", Generate'Access, PolyORB_HI_C);
Ocarina.Backends.PO_HI_C.Runtime.Initialize;
end Init;
diff --git a/src/backends/ocarina-backends-pok_c.adb b/src/backends/ocarina-backends-pok_c.adb
index 79a1223e..94cba981 100644
--- a/src/backends/ocarina-backends-pok_c.adb
+++ b/src/backends/ocarina-backends-pok_c.adb
@@ -50,7 +50,6 @@ with Ocarina.Backends.ARINC653_Conf;
with Ocarina.Backends.POK_Cheddar;
with Ocarina.Backends.XML_Tree.Generator;
-with GNAT.Command_Line; use GNAT.Command_Line;
with GNAT.OS_Lib; use GNAT.OS_Lib;
with Ocarina.Namet; use Ocarina.Namet;
@@ -72,12 +71,6 @@ package body Ocarina.Backends.POK_C is
package CTN renames Ocarina.Backends.C_Tree.Nodes;
package CTU renames Ocarina.Backends.C_Tree.Nutils;
- Generated_Sources_Directory : Name_Id := No_Name;
- Remove_Generated_Sources : Boolean := False;
- Build_Generated_Sources : Boolean := False;
- Do_Regression_Test : Boolean := False;
- Do_Coverage_Test : Boolean := False;
-
procedure Visit_Architecture_Instance (E : Node_Id);
-- Most top level visitor routine. E is the root of the AADL
-- instance tree. The procedure does a traversal for each
@@ -132,7 +125,7 @@ package body Ocarina.Backends.POK_C is
-- If the user requested to build the applications then build it
- if Build_Generated_Sources then
+ if Compile_Generated_Sources then
-- Build the source files
Makefile.Build (Instance_Root);
@@ -196,69 +189,44 @@ package body Ocarina.Backends.POK_C is
Leave_Directory;
end Generate;
+ ----------------------
+ -- Use_ARINC653_API --
+ ----------------------
+
function Use_ARINC653_API return Boolean is
begin
return POK_Flavor = ARINC653 or else POK_Flavor = DEOS
or else POK_Flavor = VXWORKS;
end Use_ARINC653_API;
- ----------
- -- Init --
- ----------
+ --------------------
+ -- Set_POK_Flavor --
+ --------------------
- procedure Init is
+ procedure Set_POK_Flavor (S : String) is
begin
- Generated_Sources_Directory := Get_String_Name (".");
- Initialize_Option_Scan;
- loop
- case Getopt ("* b er ec z o: k:") is
- when ASCII.NUL =>
- exit;
-
- when 'k' =>
- if Parameter = "arinc653" then
- POK_Flavor := ARINC653;
- end if;
+ if S = "arinc653" then
+ POK_Flavor := ARINC653;
- if Parameter = "deos" then
- POK_Flavor := DEOS;
- end if;
+ elsif S = "deos" then
+ POK_Flavor := DEOS;
- if Parameter = "vxworks653" then
- POK_Flavor := VXWORKS;
- end if;
-
- if Parameter = "no-assert" then
- Add_Assertions := False;
- end if;
+ elsif S = "vxworks653" then
+ POK_Flavor := VXWORKS;
- when 'b' =>
- Build_Generated_Sources := True;
-
- when 'e' =>
- if Full_Switch = "er" then
- Do_Regression_Test := True;
- elsif Full_Switch = "ec" then
- Do_Coverage_Test := True;
- end if;
-
- when 'z' =>
- Remove_Generated_Sources := True;
-
- when 'o' =>
- declare
- D : constant String := Parameter;
- begin
- if Full_Switch = "o" and then D'Length /= 0 then
- Generated_Sources_Directory := Get_String_Name (D);
- end if;
- end;
+ elsif S = "no-assert" then
+ Add_Assertions := False;
+ else
+ raise Constraint_Error with S;
+ end if;
+ end Set_POK_Flavor;
- when others =>
- null;
- end case;
- end loop;
+ ----------
+ -- Init --
+ ----------
+ procedure Init is
+ begin
Register_Backend ("POK_C", Generate'Access, PolyORB_Kernel_C);
Ocarina.Backends.POK_C.Runtime.Initialize;
end Init;
diff --git a/src/backends/ocarina-backends-pok_c.ads b/src/backends/ocarina-backends-pok_c.ads
index 866408d9..fca2b7b9 100644
--- a/src/backends/ocarina-backends-pok_c.ads
+++ b/src/backends/ocarina-backends-pok_c.ads
@@ -55,6 +55,9 @@ package Ocarina.Backends.POK_C is
function Use_ARINC653_API return Boolean;
-- Indicate if the Flavor uses the ARINC653 API.
+ procedure Set_POK_Flavor (S : String);
+ -- Set POK_Flavor
+
private
C_Root : Node_Id;
-- The root of the C trees
diff --git a/src/backends/ocarina-backends-pok_cheddar.adb b/src/backends/ocarina-backends-pok_cheddar.adb
index 50eed65f..4b7121fe 100644
--- a/src/backends/ocarina-backends-pok_cheddar.adb
+++ b/src/backends/ocarina-backends-pok_cheddar.adb
@@ -43,8 +43,6 @@ with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.Instances.Queries;
-with GNAT.Command_Line; use GNAT.Command_Line;
-
with Ocarina.Namet; use Ocarina.Namet;
package body Ocarina.Backends.POK_Cheddar is
@@ -76,8 +74,6 @@ package body Ocarina.Backends.POK_Cheddar is
procedure Visit_Process_Instance (E : Node_Id);
procedure Visit_Thread_Instance (E : Node_Id);
- Remove_Generated_Sources : Boolean := False;
- Generated_Sources_Directory : Name_Id := No_Name;
Task_Id : Unsigned_Long_Long := 0;
Current_System : Node_Id;
Current_Virtual_Processor : Node_Id;
@@ -290,30 +286,6 @@ package body Ocarina.Backends.POK_Cheddar is
procedure Init is
begin
- Generated_Sources_Directory := Get_String_Name (".");
- Initialize_Option_Scan;
- loop
- case Getopt ("* b z o:") is
- when ASCII.NUL =>
- exit;
-
- when 'z' =>
- Remove_Generated_Sources := True;
-
- when 'o' =>
- declare
- D : constant String := Parameter;
- begin
- if D'Length /= 0 then
- Generated_Sources_Directory := Get_String_Name (D);
- end if;
- end;
-
- when others =>
- null;
- end case;
- end loop;
-
Register_Backend ("POK_Cheddar", Generate'Access, Statistics);
end Init;
diff --git a/src/backends/ocarina-backends-stats.adb b/src/backends/ocarina-backends-stats.adb
index a75dfec6..509f76aa 100644
--- a/src/backends/ocarina-backends-stats.adb
+++ b/src/backends/ocarina-backends-stats.adb
@@ -36,10 +36,6 @@ with Ocarina.Backends.XML_Tree.Generator;
with Ocarina.Backends.Stats.Main;
with Ocarina.Backends.Utils;
-with GNAT.Command_Line; use GNAT.Command_Line;
-
-with Ocarina.Namet; use Ocarina.Namet;
-
package body Ocarina.Backends.Stats is
use Ocarina.Instances;
@@ -49,9 +45,6 @@ package body Ocarina.Backends.Stats is
use Ocarina.Backends.XML_Tree.Generator;
use Ocarina.Backends.Utils;
- Remove_Generated_Sources : Boolean := False;
- Generated_Sources_Directory : Name_Id := No_Name;
-
procedure Visit_Architecture_Instance (E : Node_Id);
-- Most top level visitor routine. E is the root of the AADL
-- instance tree. The procedure does a traversal for each
@@ -100,30 +93,6 @@ package body Ocarina.Backends.Stats is
procedure Init is
begin
- Generated_Sources_Directory := Get_String_Name (".");
- Initialize_Option_Scan;
- loop
- case Getopt ("* b z o:") is
- when ASCII.NUL =>
- exit;
-
- when 'z' =>
- Remove_Generated_Sources := True;
-
- when 'o' =>
- declare
- D : constant String := Parameter;
- begin
- if D'Length /= 0 then
- Generated_Sources_Directory := Get_String_Name (D);
- end if;
- end;
-
- when others =>
- null;
- end case;
- end loop;
-
Register_Backend ("Stats", Generate'Access, Statistics);
end Init;
diff --git a/src/backends/ocarina-backends-subprograms.adb b/src/backends/ocarina-backends-subprograms.adb
index 8bcbed53..fcc74a73 100644
--- a/src/backends/ocarina-backends-subprograms.adb
+++ b/src/backends/ocarina-backends-subprograms.adb
@@ -47,8 +47,6 @@ with Ocarina.Backends.C_Tree.Generator;
with Ocarina.Backends.Utils;
with Ocarina.Backends.Properties;
-with GNAT.Command_Line; use GNAT.Command_Line;
-
with Ocarina.Namet; use Ocarina.Namet;
package body Ocarina.Backends.Subprograms is
@@ -65,8 +63,6 @@ package body Ocarina.Backends.Subprograms is
package CTN renames Ocarina.Backends.C_Tree.Nodes;
package CTU renames Ocarina.Backends.C_Tree.Nutils;
- Generated_Sources_Directory : Name_Id := No_Name;
- Remove_Generated_Sources : Boolean := False;
Source_File : Node_Id;
Header_File : Node_Id;
@@ -516,30 +512,6 @@ package body Ocarina.Backends.Subprograms is
procedure Init is
begin
- Generated_Sources_Directory := Get_String_Name (".");
- Initialize_Option_Scan;
- loop
- case Getopt ("* b er ec z o: k:") is
- when ASCII.NUL =>
- exit;
-
- when 'z' =>
- Remove_Generated_Sources := True;
-
- when 'o' =>
- declare
- D : constant String := Parameter;
- begin
- if Full_Switch = "o" and then D'Length /= 0 then
- Generated_Sources_Directory := Get_String_Name (D);
- end if;
- end;
-
- when others =>
- null;
- end case;
- end loop;
-
Register_Backend ("Subprograms", Generate'Access, Subprograms_Generator);
end Init;
diff --git a/src/backends/ocarina-backends-vxworks653_conf.adb b/src/backends/ocarina-backends-vxworks653_conf.adb
index 89c56def..0f31c7f6 100644
--- a/src/backends/ocarina-backends-vxworks653_conf.adb
+++ b/src/backends/ocarina-backends-vxworks653_conf.adb
@@ -43,8 +43,6 @@ with Ocarina.Backends.Vxworks653_Conf.Payloads;
with Ocarina.Backends.Vxworks653_Conf.Connections;
with Ocarina.Backends.Utils;
-with GNAT.Command_Line; use GNAT.Command_Line;
-
with Ocarina.Namet; use Ocarina.Namet;
package body Ocarina.Backends.Vxworks653_Conf is
@@ -60,9 +58,6 @@ package body Ocarina.Backends.Vxworks653_Conf is
package XTN renames Ocarina.Backends.XML_Tree.Nodes;
package XTU renames Ocarina.Backends.XML_Tree.Nutils;
- Remove_Generated_Sources : Boolean := False;
- Generated_Sources_Directory : Name_Id := No_Name;
-
--------------
-- Generate --
--------------
@@ -108,30 +103,6 @@ package body Ocarina.Backends.Vxworks653_Conf is
procedure Init is
begin
- Generated_Sources_Directory := Get_String_Name (".");
- Initialize_Option_Scan;
- loop
- case Getopt ("* b z o:") is
- when ASCII.NUL =>
- exit;
-
- when 'z' =>
- Remove_Generated_Sources := True;
-
- when 'o' =>
- declare
- D : constant String := Parameter;
- begin
- if D'Length /= 0 then
- Generated_Sources_Directory := Get_String_Name (D);
- end if;
- end;
-
- when others =>
- null;
- end case;
- end loop;
-
Register_Backend ("Vxworks653_Conf", Generate'Access, Vxworks653_XML);
end Init;
diff --git a/src/backends/ocarina-backends-xtratum_conf.adb b/src/backends/ocarina-backends-xtratum_conf.adb
index b8632667..19aad3bc 100644
--- a/src/backends/ocarina-backends-xtratum_conf.adb
+++ b/src/backends/ocarina-backends-xtratum_conf.adb
@@ -44,8 +44,6 @@ with Ocarina.Backends.Xtratum_Conf.Resident_Sw;
with Ocarina.Backends.Xtratum_Conf.Partition_Table;
with Ocarina.Backends.Xtratum_Conf.Channels;
-with GNAT.Command_Line; use GNAT.Command_Line;
-
with Ocarina.Namet; use Ocarina.Namet;
package body Ocarina.Backends.Xtratum_Conf is
@@ -62,9 +60,6 @@ package body Ocarina.Backends.Xtratum_Conf is
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
- Remove_Generated_Sources : Boolean := False;
- Generated_Sources_Directory : Name_Id := No_Name;
-
--------------
-- Generate --
--------------
@@ -110,34 +105,8 @@ package body Ocarina.Backends.Xtratum_Conf is
procedure Init is
begin
- Generated_Sources_Directory := Get_String_Name (".");
- Initialize_Option_Scan;
- loop
- case Getopt ("* b z o:") is
- when ASCII.NUL =>
- exit;
-
- when 'z' =>
- Remove_Generated_Sources := True;
-
- when 'o' =>
- declare
- D : constant String := Parameter;
- begin
- if D'Length /= 0 then
- Generated_Sources_Directory := Get_String_Name (D);
- end if;
- end;
-
- when others =>
- null;
- end case;
- end loop;
-
Register_Backend
- ("Xtratum_Configuration",
- Generate'Access,
- Xtratum_Configuration);
+ ("Xtratum_Configuration", Generate'Access, Xtratum_Configuration);
end Init;
-----------
diff --git a/src/backends/ocarina-backends.adb b/src/backends/ocarina-backends.adb
index 2430f826..0f314789 100644
--- a/src/backends/ocarina-backends.adb
+++ b/src/backends/ocarina-backends.adb
@@ -102,10 +102,6 @@ package body Ocarina.Backends is
10,
10);
- procedure Write_Backends (Indent : Natural);
- -- Displays the list of registered generators each one on a new
- -- line indented by 'Indent'.
-
-------------------
-- Generate_Code --
-------------------
@@ -182,6 +178,13 @@ package body Ocarina.Backends is
MAST_Tree.Nutils.Initialize;
ASN1_Tree.Nutils.Initialize;
+ if Generated_Sources_Directory = No_Name then
+ Generated_Sources_Directory := Get_String_Name (".");
+ end if;
+
+ Compile_Generated_Sources := Compile_Generated_Sources or else
+ Do_Regression_Test or else Do_Coverage_Test;
+
-- Register the several code generators
Ocarina.Backends.ARINC653_Conf.Init;
@@ -326,23 +329,6 @@ package body Ocarina.Backends is
return Current_Backend_Name;
end Get_Current_Backend_Name;
- -----------
- -- Usage --
- -----------
-
- procedure Usage is
- begin
- Write_Line (" -g Generate code from the AADL instance tree");
- Ocarina.Backends.Write_Backends (7);
- Write_Line (" -perf Enable profiling with gprof (PolyORB-HI-C only)");
- Write_Line
- (" -asn1 Generate ASN1 deployment file (PolyORB-HI-C only)");
- Write_Line
- (" -arinc653 Generate code for ARINC653 API (POK backend only)");
- Write_Line (" -b Generate and build code from the AADL model");
- Write_Line (" -z Clean code generated from the AADL model");
- end Usage;
-
--------------------
-- Write_Backends --
--------------------
diff --git a/src/backends/ocarina-backends.ads b/src/backends/ocarina-backends.ads
index 2af8be15..70ef7bca 100644
--- a/src/backends/ocarina-backends.ads
+++ b/src/backends/ocarina-backends.ads
@@ -98,7 +98,18 @@ package Ocarina.Backends is
-- Resets the Backends module by resetting the node entries of
-- the several trees.
- procedure Usage;
- -- Print usage for all registered backends
+ procedure Write_Backends (Indent : Natural);
+ -- Displays the list of registered generators each one on a new
+ -- line indented by 'Indent'.
+
+ Generated_Sources_Directory : Name_Id := No_Name;
+ -- Generated code will be in this directory
+
+ Compile_Generated_Sources : aliased Boolean := False;
+ Remove_Generated_Sources : aliased Boolean := False;
+ Do_Coverage_Test : aliased Boolean := False;
+ Do_Regression_Test : aliased Boolean := False;
+ Generate_ASN1_Deployment : aliased Boolean := False;
+ Add_Performance_Analysis : aliased Boolean := False;
end Ocarina.Backends;
diff --git a/src/core/mgmt/ocarina-options.ads b/src/core/mgmt/ocarina-options.ads
index 57d3dd46..062eca40 100644
--- a/src/core/mgmt/ocarina-options.ads
+++ b/src/core/mgmt/ocarina-options.ads
@@ -35,6 +35,14 @@ with GNAT.Table;
package Ocarina.Options is
+ Quiet : aliased Boolean;
+ Verbose : aliased Boolean;
+ -- Note: Display_Help is implicitly defined as part of GNAT.Command_Line
+ Display_Version : aliased Boolean;
+ Show_Search_Directory : aliased Boolean;
+ Auto_Load_AADL_Files : aliased Boolean := False;
+ Debug_Mode : aliased Boolean := False;
+
type Action_Kind is
(None,
Analyze_Model,
@@ -48,15 +56,16 @@ package Ocarina.Options is
Shell,
Python_Shell);
+ After_Scenario_Action : Action_Kind := Generate_Code;
+ -- Action to be performed _after_ performing scenario activities
+
Root_System_Name : Name_Id := No_Name;
Installation_Directory : Name_Id := No_Name;
Output_Filename : Name_Id := No_Name;
Boundt_Process : Name_Id := No_Name;
Quiet_Mode : Boolean := False;
Verbose_Mode : Boolean := False;
- Debug_Mode : Boolean := False;
Use_Scenario_File : Boolean := False;
- Auto_Load_AADL_Files : Boolean := False;
procedure Set_Current_Action (Action : Action_Kind);
function Get_Current_Action return Action_Kind;
diff --git a/src/core/model/ocarina-analyzer-real.ads b/src/core/model/ocarina-analyzer-real.ads
index 0173953e..5346e65c 100644
--- a/src/core/model/ocarina-analyzer-real.ads
+++ b/src/core/model/ocarina-analyzer-real.ads
@@ -59,7 +59,7 @@ package Ocarina.Analyzer.REAL is
-- Name of the main theorem to be evaluated, by default evaluate
-- all theorems.
- Continue_Evaluation : Boolean := False;
+ Continue_Evaluation : aliased Boolean := False;
-- In case of a theorem evaluates to false, continue the
-- evaluation.
diff --git a/src/frontends/aadl/ocarina-fe_aadl-parser.adb b/src/frontends/aadl/ocarina-fe_aadl-parser.adb
index 85364714..71216062 100644
--- a/src/frontends/aadl/ocarina-fe_aadl-parser.adb
+++ b/src/frontends/aadl/ocarina-fe_aadl-parser.adb
@@ -44,13 +44,13 @@ with Ocarina.Options; use Ocarina.Options;
with Ocarina.Parser; use Ocarina.Parser;
with Ocarina.Property_Sets; use Ocarina.Property_Sets;
-with GNAT.Command_Line; use GNAT.Command_Line;
with GNAT.OS_Lib; use GNAT.OS_Lib;
package body Ocarina.FE_AADL.Parser is
Language : constant String := "aadl";
Suffix : constant String := ".aadl";
+ First_Parsing : Boolean := True;
procedure Exit_On_Error (Error : Boolean; Reason : String);
@@ -72,34 +72,10 @@ package body Ocarina.FE_AADL.Parser is
----------
procedure Init is
- C : Character;
begin
First_Parsing := True;
- Add_Pre_Prop_Sets := False;
- Initialize_Option_Scan;
- loop
- C := Getopt ("* y s f I:");
- case C is
- when ASCII.NUL =>
- exit;
-
- when 'y' =>
- Auto_Load_AADL_Files := True;
-
- when 'I' =>
- Add_Library_Path (Parameter);
-
- when 'f' | 's' =>
- Add_Pre_Prop_Sets := True;
-
- when others =>
- null;
-
- end case;
- end loop;
Add_Library_Path (Get_Name_String (Default_Library_Path));
-
Ocarina.Parser.Register_Parser (Language, Process'Access);
end Init;
diff --git a/src/frontends/aadl/ocarina-fe_aadl-parser.ads b/src/frontends/aadl/ocarina-fe_aadl-parser.ads
index 3183b7ee..490a59e6 100644
--- a/src/frontends/aadl/ocarina-fe_aadl-parser.ads
+++ b/src/frontends/aadl/ocarina-fe_aadl-parser.ads
@@ -43,8 +43,7 @@ package Ocarina.FE_AADL.Parser is
-- Default configuration parameters for the parser
- First_Parsing : Boolean := True;
- Add_Pre_Prop_Sets : Boolean := False;
+ Add_Pre_Prop_Sets : aliased Boolean := False;
function Process
(AADL_Root : Node_Id;
diff --git a/src/frontends/real/ocarina-fe_real-parser.adb b/src/frontends/real/ocarina-fe_real-parser.adb
index 4ba3f05d..edabcdf9 100644
--- a/src/frontends/real/ocarina-fe_real-parser.adb
+++ b/src/frontends/real/ocarina-fe_real-parser.adb
@@ -29,8 +29,6 @@
-- --
------------------------------------------------------------------------------
-with GNAT.Table;
-with GNAT.Command_Line;
with Ocarina.FE_REAL.Lexer;
with Ocarina.FE_REAL.Parser_Errors;
with Ocarina.ME_REAL.Tokens;
@@ -93,7 +91,6 @@ package body Ocarina.FE_REAL.Parser is
Current_Theorem_Name : Name_Id;
package Expressions is new GNAT.Table (Node_Id, Natural, 1, 100, 10);
- package REAL_Libs is new GNAT.Table (Name_Id, Nat, 1, 10, 10);
Preferences : constant array (OV_Equal .. OV_Power) of Natural :=
(OV_Power => 1,
@@ -1924,39 +1921,12 @@ package body Ocarina.FE_REAL.Parser is
----------
procedure Init is
- use GNAT.Command_Line;
use Ocarina.Parser;
use Ocarina.Namet;
- C : Character;
begin
Current_Theorem_Node := No_Node;
- Initialize_Option_Scan;
- loop
- C := Getopt ("* real_lib: real_theorem: real_continue_eval");
- case C is
- when ASCII.NUL =>
- exit;
-
- when 'r' =>
- if Full_Switch = "real_lib" then
- REAL_Libs.Append (Get_String_Name (Parameter));
- end if;
-
- if Full_Switch = "real_theorem" then
- Main_Theorem := Get_String_Name (Parameter);
- end if;
-
- if Full_Switch = "real_continue_eval" then
- Continue_Evaluation := True;
- end if;
-
- when others =>
- null;
- end case;
- end loop;
-
REAL_Language := Get_String_Name (Language);
Register_Parser (Ocarina.ME_REAL.Tokens.Language, Process'Access);
diff --git a/src/frontends/real/ocarina-fe_real-parser.ads b/src/frontends/real/ocarina-fe_real-parser.ads
index 2c1a9a87..dab9956c 100644
--- a/src/frontends/real/ocarina-fe_real-parser.ads
+++ b/src/frontends/real/ocarina-fe_real-parser.ads
@@ -33,6 +33,7 @@
with Ocarina.Types;
with Locations;
+with GNAT.Table;
package Ocarina.FE_REAL.Parser is
use Ocarina.Types;
@@ -47,4 +48,7 @@ package Ocarina.FE_REAL.Parser is
procedure Init;
-- Initialize the parser
+ package REAL_Libs is new GNAT.Table (Name_Id, Nat, 1, 10, 10);
+ -- Table of REAL libraries to consider
+
end Ocarina.FE_REAL.Parser;
diff --git a/src/main/ocarina-cmd_line.adb b/src/main/ocarina-cmd_line.adb
new file mode 100644
index 00000000..1af23aef
--- /dev/null
+++ b/src/main/ocarina-cmd_line.adb
@@ -0,0 +1,363 @@
+------------------------------------------------------------------------------
+-- --
+-- OCARINA COMPONENTS --
+-- --
+-- O C A R I N A . C M D _ L I N E --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2015 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- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. Ocarina is distributed in the hope that it will be useful, but --
+-- WITHOUT ANY WARRANTY; without even the implied warranty of --
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- . --
+-- --
+-- Ocarina is maintained by the TASTE project --
+-- (taste-users@lists.tuxfamily.org) --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Command_Line; use Ada.Command_Line;
+with Ada.Command_Line.Response_File;
+with Ada.Text_IO; use Ada.Text_IO;
+
+with GNAT.Command_Line; use GNAT.Command_Line;
+with GNAT.Directory_Operations; use GNAT.Directory_Operations;
+with GNAT.OS_Lib; use GNAT.OS_Lib;
+
+with Ocarina.Backends; use Ocarina.Backends;
+with Ocarina.Options; use Ocarina.Options;
+with Ocarina.Files; use Ocarina.Files;
+with Ocarina.Output; use Ocarina.Output;
+with Ocarina.Namet; use Ocarina.Namet;
+with Utils; use Utils;
+with Ocarina.FE_AADL.Parser; use Ocarina.FE_AADL.Parser;
+with Ocarina.FE_REAL.Parser; use Ocarina.FE_REAL.Parser;
+with Ocarina.Scripts; use Ocarina.Scripts;
+with Ocarina.Analyzer.REAL; use Ocarina.Analyzer.REAL;
+with Ocarina.Backends.POK_C;
+
+package body Ocarina.Cmd_Line is
+
+ Ocarina_Options : Command_Line_Configuration;
+ -- Stores all information on command line flags
+
+ procedure Parse_Command_Line
+ (Switch : String; Parameter : String; Section : String);
+ -- Callback for complex command line parameters, required by
+ -- GNAT.Command_Line.Getopt.
+
+ procedure Parse_Source_Filename (S : String);
+ -- Parse source filenames, S denotes one file name
+
+ procedure Register_Command_Line_Parameters;
+ -- Define all supported command line parameters
+
+ ------------------------
+ -- Parse_Command_Line --
+ ------------------------
+
+ procedure Parse_Command_Line
+ (Switch : String; Parameter : String; Section : String)
+ is
+ pragma Unreferenced (Section);
+ begin
+ if Switch = "-aadlv" then
+ if Parameter = "1" then
+ AADL_Version := AADL_V1;
+ elsif Parameter = "2" then
+ AADL_Version := AADL_V2;
+ else
+ raise Invalid_Switch;
+ end if;
+
+ elsif Switch = "-boundt_process" then
+ Boundt_Process := To_Lower (Get_String_Name (Parameter));
+
+ elsif Switch = "-disable-annexes" then
+ Reset_Annex_Action;
+ Process_Annex_Action (Parameter);
+
+ elsif Switch = "-g" then
+ Set_Current_Action (Generate_Code);
+ Set_Current_Backend_Name (Parameter);
+
+ elsif Switch = "-k" then
+ Backends.POK_C.Set_POK_Flavor (Parameter);
+
+ elsif Switch = "-i" then
+ Set_Current_Action (Instantiate_Model);
+
+ elsif Switch = "-I" then
+ if Parameter'Length > 0 then
+ Add_Library_Path (Parameter);
+ end if;
+
+ elsif Switch = "-o" then
+ Output_Filename := Get_String_Name (Parameter);
+ Generated_Sources_Directory := Output_Filename;
+
+ elsif Switch = "-p" then
+ After_Scenario_Action := Instantiate_Model;
+
+ elsif Switch = "-r" then
+ Root_System_Name := To_Lower (Get_String_Name (Parameter));
+
+ elsif Switch = "-real_lib" then
+ REAL_Libs.Append (Get_String_Name (Parameter));
+
+ elsif Switch = "-real_theorem" then
+ Main_Theorem := Get_String_Name (Parameter);
+
+ elsif Switch = "-t" then
+ Set_Current_Action (Shell);
+ declare
+ N : constant String := Get_Argument;
+ File : Ada.Text_IO.File_Type;
+ begin
+ if N'Length > 0 then
+ Ada.Text_IO.Open (File, Ada.Text_IO.In_File, N);
+ Ada.Text_IO.Set_Input (File);
+ Ocarina.Scripts.Standard_Input := False;
+ end if;
+ end;
+
+ elsif Switch = "-x" then
+ Use_Scenario_File := True;
+ Set_Current_Action (Parse_Scenario_Files_First);
+
+ else
+ Parse_Source_Filename (Switch);
+ end if;
+
+ exception
+ when GNAT.Command_Line.Invalid_Parameter =>
+ Write_Line
+ (Base_Name (Command_Name) &
+ ": invalid parameter for switch -" & Switch);
+ Write_Eol;
+ OS_Exit (1);
+
+ end Parse_Command_Line;
+
+ -----------------------------
+ -- Parse_Source_Filename --
+ -----------------------------
+
+ procedure Parse_Source_Filename (S : String) is
+ begin
+ if S (S'First) = '-' then
+ -- If there is a new switch, then the previous
+ -- files are discarded.
+ Sources.Init;
+
+ elsif S (S'First) = '@' then
+ declare
+ Files : constant Ada.Command_Line.Response_File
+ .Argument_List :=
+ Ada.Command_Line.Response_File.Arguments_From
+ (S (S'First + 1 .. S'Last));
+ begin
+ for J in Files'Range loop
+ Set_Str_To_Name_Buffer (Files (J).all);
+ Ocarina.Files.Add_File_To_Parse_List
+ (Name_Find,
+ Add_Suffix => False);
+ end loop;
+ -- Free (Files);
+ end;
+
+ else
+ Set_Str_To_Name_Buffer (S);
+ Ocarina.Files.Add_File_To_Parse_List
+ (Name_Find,
+ Add_Suffix => False);
+ end if;
+ end Parse_Source_Filename;
+
+ --------------------------------------
+ -- Register_Command_Line_Parameters --
+ --------------------------------------
+
+ procedure Register_Command_Line_Parameters is
+ begin
+ Set_Usage (Ocarina_Options, Usage => "[switches] ");
+
+ -- Note: the order of call to Define_Switch dictate the order
+ -- of information when calling GNAT.Command_Line.Display_Help.
+
+ -- --help flag, just so that it appears in the online help
+ Define_Switch (Ocarina_Options,
+ Switch => "-h", Long_Switch => "--help",
+ Help => "Display help and exit");
+
+ -- --version flag
+ Define_Switch (Ocarina_Options, Display_Version'Access,
+ Switch => "", Long_Switch => "--version",
+ Help => "Display version and exit");
+
+ -- --verbose flag
+ Define_Switch (Ocarina_Options, Verbose'Access,
+ "-v", Long_Switch => "--verbose",
+ Help => "Output extra verbose information");
+
+ -- -q flag
+ Define_Switch (Ocarina_Options, Quiet'Access,
+ "-q",
+ Help => "Quiet mode (default)", Value => False);
+
+ -- -d flag
+ Define_Switch (Ocarina_Options, Debug_Mode'Access, "-d",
+ Help => "Debug mode");
+
+ -- -s flag
+ Define_Switch (Ocarina_Options, Show_Search_Directory'Access,
+ "-s",
+ Help => "Output default search directory, then exit");
+
+ -- -aadlv? flag
+ Define_Switch
+ (Ocarina_Options, "-aadlv?",
+ Help => "AADL version, ARG = 1 for AADL 1.0, 2 for AADL 2.x");
+
+ -- -f flag
+ Define_Switch
+ (Ocarina_Options, Add_Pre_Prop_Sets'Access, "-f",
+ Value => True,
+ Help => "Parse predefined non-standard property sets");
+
+ -- -disable-annexes flag
+ Define_Switch (Ocarina_Options, "-disable-annexes=",
+ Help => "Deactivate annex ARG");
+
+ -- -r flag
+ Define_Switch (Ocarina_Options, "-r:", Help => "Use ARG as root system");
+
+ -- -o flag
+ Define_Switch (Ocarina_Options, "-o:",
+ Help => "Specify output file/directory");
+
+ -- -y flag
+ Define_Switch (Ocarina_Options, Auto_Load_AADL_Files'Access, "-y",
+ Help => "Automatically load AADL files");
+
+ -- -I flag
+ Define_Switch (Ocarina_Options, "-I:",
+ Help => "Add ARG to the directory search list");
+
+ -- -p flag
+ Define_Switch (Ocarina_Options, "-p",
+ Help => "Parse and instantiate the model");
+
+ -- -i flag
+ Define_Switch (Ocarina_Options, "-i",
+ Help => "Instantiate the model");
+
+ -- -x flag
+ Define_Switch (Ocarina_Options, "-x",
+ Help => "Parse AADL file as an AADL scenario file");
+
+ -- -g flag
+ Define_Switch (Ocarina_Options, "-g:",
+ Help => "Generate code using Ocarina backend 'ARG'");
+
+ -- -b flag
+ Define_Switch (Ocarina_Options,
+ Backends.Compile_Generated_Sources'Access, "-b",
+ Help => "Compile generated code");
+
+ -- -z flag
+ Define_Switch (Ocarina_Options,
+ Backends.Remove_Generated_Sources'Access, "-z",
+ Help => "Clean code generated");
+
+ -- -k flag
+ Define_Switch (Ocarina_Options, "-k:",
+ Help => "Set POK flavor (arinc653/deos/pok/vxworks)");
+
+ -- -t flag
+ Define_Switch (Ocarina_Options, "-t",
+ Help => "Run Ocarina in terminal interactive mode");
+
+ -- -real_theorem flag
+ Define_Switch (Ocarina_Options, "-real_theorem:",
+ Help => "Name of the main theorem to evaluate");
+
+ -- -real_lib flag
+ Define_Switch (Ocarina_Options, "-real_lib:",
+ Help => "Add external library of REAL theorems");
+
+ -- -real_continue_eval flag
+ Define_Switch
+ (Ocarina_Options, Continue_Evaluation'Access,
+ "-real_continue_eval",
+ Help => "Continue evaluation of REAL theorems after first failure "
+ & "(REAL backend)");
+
+ -- -boundt_process flag
+ Define_Switch
+ (Ocarina_Options, "-boundt_process:",
+ Help => "Generate .tpo file for process ARG (Bound-T backend)");
+
+ -- -ec flag
+ Define_Switch (Ocarina_Options, Backends.Do_Coverage_Test'Access,
+ "-ec", Help => "Compute coverage metrics");
+
+ -- -er flag
+ Define_Switch (Ocarina_Options, Backends.Do_Coverage_Test'Access,
+ "-er", Help => "Execute system");
+
+ -- -asn1 flag
+ Define_Switch
+ (Ocarina_Options, Backends.Generate_ASN1_Deployment'Access,
+ "-asn1",
+ Help => "Generate ASN1 deployment file (PolyORB-HI-C only)");
+
+ -- -perf flag
+ Define_Switch
+ (Ocarina_Options, Backends.Add_Performance_Analysis'Access,
+ "-perf", Help => "Enable profiling with gprof (PolyORB-HI-C only)");
+
+ end Register_Command_Line_Parameters;
+
+ -------------
+ -- Process --
+ -------------
+
+ procedure Process is
+ begin
+ Register_Command_Line_Parameters;
+ Getopt (Ocarina_Options, Parse_Command_Line'Unrestricted_Access);
+
+ -- After this call to Getopt, the command line has elements
+ -- that are not caught as regular switches. We assume these are
+ -- AADL filenames. They are passed to Parse_Source_Filename.
+
+ declare
+ Args : Argument_List_Access :=
+ GNAT.OS_Lib.Argument_String_To_List (Get_Argument);
+ begin
+ for S of Args.all loop
+ Parse_Source_Filename (S.all);
+ end loop;
+ Free (Args);
+ end;
+ exception
+ when GNAT.Command_Line.Invalid_Switch =>
+ OS_Exit (1);
+
+ end Process;
+
+end Ocarina.Cmd_Line;
diff --git a/src/main/ocarina-cmd_line.ads b/src/main/ocarina-cmd_line.ads
new file mode 100644
index 00000000..294b61a7
--- /dev/null
+++ b/src/main/ocarina-cmd_line.ads
@@ -0,0 +1,37 @@
+------------------------------------------------------------------------------
+-- --
+-- OCARINA COMPONENTS --
+-- --
+-- O C A R I N A . C M D _ L I N E --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2015 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- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. Ocarina is distributed in the hope that it will be useful, but --
+-- WITHOUT ANY WARRANTY; without even the implied warranty of --
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- . --
+-- --
+-- Ocarina is maintained by the TASTE project --
+-- (taste-users@lists.tuxfamily.org) --
+-- --
+------------------------------------------------------------------------------
+
+package Ocarina.Cmd_Line is
+
+ procedure Process;
+ -- Process command line parameters
+
+end Ocarina.Cmd_Line;
diff --git a/src/main/ocarina_cmd.adb b/src/main/ocarina_cmd.adb
index 9b484d60..ec0a8616 100644
--- a/src/main/ocarina_cmd.adb
+++ b/src/main/ocarina_cmd.adb
@@ -37,13 +37,7 @@ 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 Ada.Command_Line; use Ada.Command_Line;
-with Ada.Command_Line.Response_File;
-with Ada.Unchecked_Deallocation;
-with Ada.Exceptions; use Ada.Exceptions;
-with Ada.IO_Exceptions;
with Ada.Text_IO;
with GNAT.Command_Line; use GNAT.Command_Line;
@@ -57,6 +51,7 @@ with Ocarina.Backends; use Ocarina.Backends;
with Ocarina.Backends.PO_HI_C;
with Ocarina.Backends.PO_HI_Ada;
with Ocarina.Backends.Execution_Tests; use Ocarina.Backends.Execution_Tests;
+with Ocarina.Cmd_Line;
with Ocarina.Configuration; use Ocarina.Configuration;
with Ocarina.Files; use Ocarina.Files;
with Ocarina.Instances; use Ocarina.Instances;
@@ -67,440 +62,23 @@ with Ocarina.Options; use Ocarina.Options;
with Ocarina.Parser; use Ocarina.Parser;
with Ocarina.Property_Sets; use Ocarina.Property_Sets;
with Ocarina.FE_AADL.Parser; use Ocarina.FE_AADL.Parser;
-with Ocarina.FE_REAL; use Ocarina.FE_REAL;
+-- with Ocarina.FE_REAL; use Ocarina.FE_REAL;
with Ocarina.ME_REAL.Tokens;
-with Ocarina.Transfo.Fusions; use Ocarina.Transfo.Fusions;
-with Ocarina.Transfo.Move; use Ocarina.Transfo.Move;
-with Ocarina.Transfo.Optim; use Ocarina.Transfo.Optim;
with Ocarina.ME_AADL.AADL_Instances.Nodes;
+with Ocarina.Scripts; use Ocarina.Scripts;
procedure Ocarina_Cmd is
- procedure Process_Command_Line
- (Root_System_Name : out Name_Id;
- Success : out Boolean);
- -- Process the command line to extract the options for the
- -- different modules of Ocarina.
-
- procedure Usage;
- -- Display a message describing the usage of Ocarina
-
- procedure Ocarina_Shell;
- -- Launch Ocarina interactive mode
-
procedure Parse_Scenario_Files;
-- Parse a set of scenario file and updates the global variable
-- according to the extracted information.
- After_Scenario_Action : Action_Kind := Generate_Code;
- Standard_Input : Boolean := True;
AADL_Root : Node_Id := No_Node;
Success : Boolean := True;
File_Name : Name_Id;
Buffer : Location;
Language : Name_Id;
- Position : String_String_Maps.Cursor;
-
- -------------------
- -- Ocarina_Shell --
- -------------------
-
- procedure Ocarina_Shell is
-
- use Ada.Text_IO;
-
- function "+" (S : String) return String_Access;
- procedure Show_Help;
- procedure Free is new Ada.Unchecked_Deallocation (String, String_Access);
- function Next return String;
- function Argument (Index : Natural) return String_Access;
- function Count (Prompt : String := "> ") return Natural;
-
- Syntax_Error : exception;
-
- type Command is
- (Help,
- Analyze,
- Instantiate,
- Generate,
- Load,
- Status,
- Fusion,
- Move,
- Optimize,
- Brute_Optimize,
- Version,
- Quit);
-
- Args : array (1 .. 16) of String_Access;
- Argc : Natural;
- Line : String (1 .. 1024);
- Last : Natural;
- Scan : Natural;
- Argv : String_Access;
- Cmmd : Command;
- Success : Boolean;
-
- ---------
- -- "+" --
- ---------
-
- function "+" (S : String) return String_Access is
- begin
- return new String'(S);
- end "+";
-
- ---------------
- -- Show_Help --
- ---------------
-
- Help_Messages : constant array (Command) of String_Access :=
- (Help => +"print this message",
- Analyze => +"analyse model",
- Instantiate => +"instantiate model",
- Generate => +"generate code",
- Load => +"load and parse file given as argument",
- Fusion => +"fusion threads",
- Move => +"move a thread",
- Optimize => +"optimize model, using greedy algorithm",
- Brute_Optimize => +"optimize model, using brute force",
- Status => +"print configuration",
- Version => +"print Ocarina version information",
- Quit => +"quit this shell");
-
- procedure Show_Help is
- begin
- for J in Help_Messages'Range loop
- Write_Line (J'Img & ASCII.HT & Help_Messages (J).all);
- end loop;
- end Show_Help;
-
- ------------------
- -- Print_Status --
- ------------------
-
- procedure Print_Status is
- begin
- Write_Line ("AADL version: " & Ocarina.AADL_Version'Img);
- Write_Line
- ("Library Path: " & Get_Name_String (Default_Library_Path));
- end Print_Status;
-
- --------------
- -- Argument --
- --------------
-
- function Argument (Index : Natural) return String_Access is
- begin
- if Index > Argc then
- raise Constraint_Error;
- end if;
- return Args (Index);
- end Argument;
-
- -----------
- -- Count --
- -----------
-
- function Count (Prompt : String := "> ") return Natural is
- begin
- if Standard_Input then
- Put (Prompt);
- end if;
-
- begin
- Get_Line (Current_Input, Line, Last);
- exception
- when Ada.IO_Exceptions.End_Error =>
- -- This means the user hit CTRL-D or the script does
- -- not end with a QUIT command. Not harmful, we just
- -- simulate a QUIT.
-
- Argc := 1;
- if Args (Argc) /= null then
- Free (Args (Argc));
- end if;
- Args (Argc) := new String'(Command'Image (Quit));
- return Argc;
-
- when E : others =>
- Write_Line ("raised " & Exception_Information (E));
- Write_Line (Exception_Message (E));
- raise;
- end;
-
- Scan := 1;
- Argc := 0;
- loop
- declare
- Arg : constant String := Next;
- begin
- exit when Arg = "";
- Argc := Argc + 1;
- if Args (Argc) /= null then
- Free (Args (Argc));
- end if;
- Args (Argc) := new String'(Arg);
- end;
- end loop;
- return Argc;
- end Count;
-
- ----------
- -- Next --
- ----------
-
- function Next return String is
- use ASCII;
-
- F, L : Natural;
- begin
- while Scan <= Last
- and then (Line (Scan) = ' ' or else Line (Scan) = HT)
- loop
- Scan := Scan + 1;
- end loop;
-
- if Scan > Last then
- return "";
- end if;
-
- if Line (Scan) = '"' then -- "
- Scan := Scan + 1;
- F := Scan;
-
- while Scan <= Last loop
- if Line (Scan) = '"' then -- "
- L := Scan - 1;
- Scan := Scan + 1;
- return Line (F .. L);
-
- elsif Line (Scan) = NUL then
- return "";
-
- end if;
-
- Scan := Scan + 1;
- end loop;
- return "";
-
- else
- F := Scan;
- while Scan <= Last
- and then Line (Scan) /= ' '
- and then Line (Scan) /= HT
- loop
- L := Scan;
- Scan := Scan + 1;
- end loop;
- return Line (F .. L);
- end if;
- end Next;
-
- begin
- if Standard_Input then
- Write_Line ("Ocarina shell, type help for information");
- end if;
-
- -- Console main loop: read inputs and process them
-
- <>
- loop
- Argc := Count;
- if Argc > 0
- and then Argument (1) /= null
- and then Argument (1).all (Argument (1).all'First) /= '#'
- then
- begin
- Argv := Argument (1);
-
- begin
- Cmmd := Command'Value (Argv.all);
- exception
- when Constraint_Error =>
- raise Syntax_Error;
- end;
-
- case Cmmd is
- when Help =>
- Show_Help;
-
- when Analyze =>
- Success := Analyze (Language, AADL_Root);
- if not Success then
- Write_Line ("Cannot analyze AADL specifications");
- else
- Write_Line ("Model analyzed sucessfully");
- end if;
-
- when Instantiate =>
- if Argc = 2 then
- Root_System_Name :=
- To_Lower (Get_String_Name (Argument (2).all));
- end if;
- AADL_Root := Instantiate_Model (AADL_Root);
- if Present (AADL_Root) then
- Write_Line ("Model instantiated sucessfully");
- end if;
-
- when Generate =>
- if Argc /= 2 then
- raise Syntax_Error;
- end if;
- Set_Current_Backend_Name (Argument (2).all);
- Write_Line ("Generating code for " & Argument (2).all);
- Generate_Code (AADL_Root);
-
- when Load =>
- if Argc /= 2 then
- raise Syntax_Error;
- end if;
- Set_Str_To_Name_Buffer (Argument (2).all);
-
- File_Name := Search_File (Name_Find);
- if File_Name = No_Name then
- Write_Line ("cannot find file " & Argument (2).all);
- goto Main;
- end if;
-
- Buffer := Load_File (File_Name);
- if File_Name = No_Name then
- Write_Line ("cannot read file " & Argument (2).all);
- goto Main;
- end if;
- AADL_Root := Parse (Language, AADL_Root, Buffer);
- Exit_On_Error
- (No (AADL_Root),
- "cannot parse AADL specifications");
-
- Write_Line
- ("File " &
- Argument (2).all &
- " loaded and parsed sucessfully");
-
- when Brute_Optimize =>
- declare
- Instance_Root : Node_Id;
- begin
- Instance_Root := Instantiate_Model (AADL_Root);
- Exit_On_Error
- (No (Instance_Root),
- "Cannot instantiate AADL models");
-
- Ocarina.Transfo.Optim.Init (Instance_Root);
-
- Exhaustive_Space_Exploration (Instance_Root, Success);
- Exit_On_Error
- (not Success,
- "cannot perform brute optimization on model");
-
- Set_Current_Backend_Name ("aadl");
- Generate_Code (AADL_Root);
- end;
-
- when Optimize =>
- declare
- Instance_Root : Node_Id;
- begin
- Instance_Root := Instantiate_Model (AADL_Root);
- Exit_On_Error
- (No (Instance_Root),
- "Cannot instantiate AADL models");
-
- Ocarina.Transfo.Optim.Init (Instance_Root);
-
- Greedy_Heuristic (Instance_Root, Success);
- Exit_On_Error
- (not Success,
- "cannot perform optimization on model");
-
- Set_Current_Backend_Name ("aadl");
- Generate_Code (AADL_Root);
- end;
-
- when Fusion =>
- declare
- Thread_To_Fusion_1 : Name_Id := No_Name;
- Thread_To_Fusion_2 : Name_Id := No_Name;
- Owner_Process : Name_Id := No_Name;
- -- Transformation-related variables
-
- AADL_Instance : Node_Id;
- New_Thread : Node_Id;
- Success : Boolean;
- begin
- AADL_Instance := Instantiate_Model (AADL_Root);
- Exit_On_Error
- (No (AADL_Instance),
- "Cannot instantiate AADL models");
-
- Owner_Process := Get_String_Name (Argument (2).all);
- Thread_To_Fusion_1 :=
- Get_String_Name (Argument (3).all);
- Thread_To_Fusion_2 :=
- Get_String_Name (Argument (4).all);
-
- Fusion_Threads
- (AADL_Root,
- Owner_Process,
- Thread_To_Fusion_1,
- Thread_To_Fusion_2,
- New_Thread,
- Success);
-
- Exit_On_Error
- (not Success,
- "Cannot fusion the AADL threads");
-
- Set_Current_Backend_Name ("aadl");
- Generate_Code (AADL_Root);
- end;
-
- when Move =>
- declare
- Thread_To_Move : Name_Id := No_Name;
- Src_Process : Name_Id := No_Name;
- Dst_Process : Name_Id := No_Name;
- -- Transformation-related variables
-
- AADL_Instance : Node_Id;
- begin
- AADL_Instance := Instantiate_Model (AADL_Root);
- Exit_On_Error
- (No (AADL_Instance),
- "Cannot instantiate AADL models");
-
- Thread_To_Move := Get_String_Name (Argument (2).all);
- Src_Process := Get_String_Name (Argument (3).all);
- Dst_Process := Get_String_Name (Argument (4).all);
-
- Move_Thread (Thread_To_Move, Src_Process, Dst_Process);
-
- Set_Current_Backend_Name ("aadl");
- Generate_Code (AADL_Root);
- end;
-
- when Status =>
- Print_Status;
-
- when Version =>
- Version;
-
- when Quit =>
- exit;
- end case;
- exception
- when Syntax_Error =>
- Write_Line ("syntax error");
-
- when E : others =>
- Write_Line ("raised " & Exception_Information (E));
- Write_Line (Exception_Message (E));
- end;
- end if;
- end loop;
- end Ocarina_Shell;
-------------------------
-- Parse_Scenario_File --
@@ -616,6 +194,7 @@ procedure Ocarina_Cmd is
Ref_Map : in out String_String_Maps.Map)
is
N : Node_Id;
+ Position : String_String_Maps.Cursor;
begin
if not Is_Empty (Ref_Files) then
N := First_Node (Ref_Files);
@@ -958,261 +537,6 @@ procedure Ocarina_Cmd is
end;
end Parse_Scenario_Files;
- --------------------------
- -- Process_Command_Line --
- --------------------------
-
- procedure Process_Command_Line
- (Root_System_Name : out Name_Id;
- Success : out Boolean)
- is
- begin
- Root_System_Name := No_Name;
- Success := True;
-
- Initialize_Option_Scan;
- loop
- case Getopt
- ("* aadlv1 aadlv2 help o: c d g: " &
- "r: real_lib: real_theorem: boundt_process: " &
- "disable-annexes=: " &
- "i p q v V s x t?")
- is
-
- when 'a' =>
- if Full_Switch = "aadlv2" then
- AADL_Version := AADL_V2;
- elsif Full_Switch = "aadlv1" then
- AADL_Version := AADL_V1;
- else
- raise Invalid_Switch;
- end if;
-
- when 'o' =>
- declare
- D : constant String := Parameter;
- begin
- if D'Length > 0 then
- Output_Filename := Get_String_Name (D);
- end if;
- end;
-
- when 'g' =>
- Set_Current_Action (Generate_Code);
- declare
- G : constant String := Parameter;
- begin
- if G'Length > 0 then
- Set_Current_Backend_Name (G);
- end if;
- end;
-
- when 'h' =>
- if Full_Switch /= "help" then
- raise Invalid_Switch;
- end if;
- Set_Current_Action (Show_Help);
-
- when 'p' =>
- if Full_Switch = "p" then
- After_Scenario_Action := Instantiate_Model;
- end if;
-
- when 'r' =>
- if Full_Switch = "r" then
- declare
- N : constant String := Parameter;
- begin
- if N'Length > 0 then
- Root_System_Name := To_Lower (Get_String_Name (N));
- end if;
- end;
- end if;
-
- when 'i' =>
- Set_Current_Action (Instantiate_Model);
-
- when 'q' =>
- Quiet_Mode := True;
- Verbose_Mode := False;
-
- when 'v' =>
- Quiet_Mode := False;
- Verbose_Mode := True;
-
- when 'd' =>
- if Full_Switch = "disable-annexes=" then
- Reset_Annex_Action;
- Process_Annex_Action (Parameter);
- else
- Debug_Mode := True;
- end if;
-
- when 'V' =>
- Set_Current_Action (Show_Version);
- exit;
-
- when 's' =>
- Set_Current_Action (Show_Libraries);
-
- -- Note: we continue parsing the command line
- -- parameters to know whether the user specified also
- -- an AADL version flag.
-
- when 'x' =>
- Use_Scenario_File := True;
- Set_Current_Action (Parse_Scenario_Files_First);
-
- when 't' =>
- Set_Current_Action (Shell);
- declare
- N : constant String := Get_Argument;
- File : Ada.Text_IO.File_Type;
- begin
- if N'Length > 0 then
- Ada.Text_IO.Open (File, Ada.Text_IO.In_File, N);
- Ada.Text_IO.Set_Input (File);
- Standard_Input := False;
- end if;
- end;
-
- exit;
-
- when ASCII.NUL =>
- exit;
-
- when others =>
- declare
- S : constant String := Full_Switch;
- begin
- if S (S'First) = '-' then
- -- If there is a new switch, then the previous
- -- files are discarded.
- Sources.Init;
-
- elsif S (S'First) = '@' then
- declare
- Files : constant Ada.Command_Line.Response_File
- .Argument_List :=
- Ada.Command_Line.Response_File.Arguments_From
- (S (S'First + 1 .. S'Last));
- begin
- for J in Files'Range loop
- Set_Str_To_Name_Buffer (Files (J).all);
- Ocarina.Files.Add_File_To_Parse_List
- (Name_Find,
- Add_Suffix => False);
- end loop;
- -- Free (Files);
- end;
-
- else
- Set_Str_To_Name_Buffer (S);
- Ocarina.Files.Add_File_To_Parse_List
- (Name_Find,
- Add_Suffix => False);
- end if;
- end;
- end case;
- end loop;
-
- -- If no file is given, print the usage function and exit
-
- if Sources.Last = 0
- and then Get_Current_Action /= Show_Version
- and then Get_Current_Action /= Show_Libraries
- and then Get_Current_Action /= Show_Help
- and then Get_Current_Action /= Shell
- and then Get_Current_Action /= Parse_Scenario_Files_First
- then
- Set_Current_Action (Show_Usage);
-
- elsif Sources.Last /= 0 and then Get_Current_Action = None then
- Set_Current_Action (Analyze_Model);
- end if;
-
- exception
- when Invalid_Options =>
- Write_Line
- (Base_Name (Command_Name) & ": invalid combination of options");
- Write_Eol;
- OS_Exit (1);
-
- when GNAT.Command_Line.Invalid_Switch =>
- Write_Line
- (Base_Name (Command_Name) &
- ": invalid switch " &
- Full_Switch &
- Parameter);
- Write_Eol;
- OS_Exit (1);
-
- when GNAT.Command_Line.Invalid_Parameter =>
- Write_Line
- (Base_Name (Command_Name) &
- ": invalid parameter for switch -" &
- Full_Switch);
- Write_Eol;
- OS_Exit (1);
- end Process_Command_Line;
-
- -----------
- -- Usage --
- -----------
-
- procedure Usage is
- Exec_Suffix : String_Access := Get_Executable_Suffix;
- begin
- Set_Standard_Error;
- Write_Line ("Usage: ");
- Write_Line
- (" " &
- Base_Name (Command_Name, Exec_Suffix.all) &
- " [options] files");
- Write_Line (" OR");
- Write_Line
- (" " & Base_Name (Command_Name, Exec_Suffix.all) & " -help");
- Write_Line (" files are a non null sequence of AADL files");
-
- Write_Eol;
- Write_Line (" General purpose options:");
- Write_Line (" -V Output Ocarina version, then exit");
- Write_Line (" -s Output Ocarina search directory, then exit");
-
- Write_Eol;
- Write_Line (" Scenario file options:");
- Write_Line (" -b Generate and build code from the AADL model");
- Write_Line (" -z Clean code generated from the AADL model");
- Write_Line (" -ec Execute the generated application code and");
- Write_Line (" retrieve coverage information");
- Write_Line (" -er Execute the generated application code and");
- Write_Line (" verify that there is no regression");
- Write_Line (" -p Only parse and instantiate the application model");
-
- Write_Eol;
- Write_Line (" Advanced user options:");
- Write_Line (" -d Debug mode for developpers");
- Write_Line (" -q Quiet mode (default)");
- Write_Line (" -t [script] Run Ocarina in terminal interactive mode.");
- Write_Line (" If a script is given, interpret it then exit.");
- Write_Line (" -v Verbose mode for users");
- Write_Line (" -x Parse AADL file as an AADL scenario file");
-
- Ocarina.FE_AADL.Usage;
- Ocarina.FE_REAL.Usage;
- Ocarina.Backends.Usage;
-
- Write_Line
- (" -disable-annexes={annexes}" & " Desactive one or all annexes");
- Write_Line (" Annexes :");
- Write_Line (" all");
- Write_Line (" behavior_specification");
- Write_Line (" real");
- Write_Eol;
-
- Free (Exec_Suffix);
- end Usage;
-
package RT renames Ocarina.ME_REAL.Tokens;
begin
@@ -1225,46 +549,48 @@ begin
-- Process the command line
- Process_Command_Line (Root_System_Name, Success);
- Exit_On_Error (not Success, "Cannot process command line");
+ Ocarina.Cmd_Line.Process;
-- Initialization Modules
Ocarina.Configuration.Init_Modules;
- if Verbose_Mode then
+ -- Process command line parameters
+
+ if Verbose then
Set_Standard_Error;
Version;
end if;
- case Get_Current_Action is
- when Show_Version =>
- Version;
- OS_Exit (0);
-
- when Show_Help =>
- Usage;
- OS_Exit (0);
-
- when Show_Libraries =>
- Write_Line (Get_Name_String (Default_Library_Path));
- OS_Exit (0);
-
- when Show_Usage =>
- Usage;
- OS_Exit (1);
-
- when Shell =>
- Ocarina_Shell;
- OS_Exit (0);
-
- when Parse_Scenario_Files_First =>
- Parse_Scenario_Files;
- Reset_Current_Action;
- Set_Current_Action (After_Scenario_Action);
- when others =>
- null;
- end case;
+ if Display_Version then
+ Version;
+ OS_Exit (0);
+
+ elsif Show_Search_Directory then
+ Write_Line (Get_Name_String (Default_Library_Path));
+ OS_Exit (0);
+
+ elsif Get_Current_Action = Shell then
+ Ocarina_Shell;
+ OS_Exit (0);
+
+ elsif Sources.Last = 0 then
+ Ada.Text_IO.Put ("No AADL files given, ");
+ Try_Help;
+ OS_Exit (1);
+ end if;
+
+ -- If not action has been set, set it to analyse the models only
+
+ if Get_Current_Action = None then
+ Set_Current_Action (Analyze_Model);
+ end if;
+
+ if Get_Current_Action = Parse_Scenario_Files_First then
+ Parse_Scenario_Files;
+ Reset_Current_Action;
+ Set_Current_Action (After_Scenario_Action);
+ end if;
-- Parse the AADL files
@@ -1332,4 +658,10 @@ begin
when others =>
null;
end case;
+
+exception
+ when GNAT.Command_Line.Exit_From_Command_Line =>
+ -- Expected when Getopt processes -h or --help
+ null;
+
end Ocarina_Cmd;