Commit aa036ede authored by yoogx's avatar yoogx

* Complete reorganization of Ocarina shell

parent 07467d45
...@@ -40,6 +40,7 @@ with Ada.IO_Exceptions; ...@@ -40,6 +40,7 @@ with Ada.IO_Exceptions;
with Ada.Text_IO; with Ada.Text_IO;
with GNAT.OS_Lib; use GNAT.OS_Lib; with GNAT.OS_Lib; use GNAT.OS_Lib;
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with Ocarina.Backends; use Ocarina.Backends; with Ocarina.Backends; use Ocarina.Backends;
with Ocarina.Instances; use Ocarina.Instances; with Ocarina.Instances; use Ocarina.Instances;
...@@ -47,6 +48,8 @@ with Ocarina.Transfo.Fusions; use Ocarina.Transfo.Fusions; ...@@ -47,6 +48,8 @@ with Ocarina.Transfo.Fusions; use Ocarina.Transfo.Fusions;
with Ocarina.Transfo.Move; use Ocarina.Transfo.Move; with Ocarina.Transfo.Move; use Ocarina.Transfo.Move;
with Ocarina.Transfo.Optim; use Ocarina.Transfo.Optim; with Ocarina.Transfo.Optim; use Ocarina.Transfo.Optim;
with Ocarina.Utils; use Ocarina.Utils; with Ocarina.Utils; use Ocarina.Utils;
with Ocarina.Configuration; use Ocarina.Configuration;
with Ocarina.Options; use Ocarina.Options;
package body Ocarina.Scripts is package body Ocarina.Scripts is
...@@ -164,7 +167,7 @@ package body Ocarina.Scripts is ...@@ -164,7 +167,7 @@ package body Ocarina.Scripts is
return Argc; return Argc;
when E : others => when E : others =>
Write_Line ("raised "& Exception_Information (E)); Write_Line ("raised " & Exception_Information (E));
Write_Line (Exception_Message (E)); Write_Line (Exception_Message (E));
raise; raise;
end; end;
...@@ -264,14 +267,27 @@ package body Ocarina.Scripts is ...@@ -264,14 +267,27 @@ package body Ocarina.Scripts is
Show_Help; Show_Help;
when Analyze => when Analyze =>
Ocarina.Utils.Analyze; declare
Result : constant Boolean
:= Ocarina.Utils.Analyze;
begin
Exit_On_Error (not Result,
"Cannot analyze AADL models");
end;
when Instantiate => when Instantiate =>
declare
Result : Boolean;
begin
if Argc = 2 then if Argc = 2 then
Result :=
Ocarina.Utils.Instantiate (Argument (2).all); Ocarina.Utils.Instantiate (Argument (2).all);
else else
Ocarina.Utils.Instantiate (""); Result := Ocarina.Utils.Instantiate ("");
end if; end if;
Exit_On_Error (not Result,
"Cannot instantiatee AADL models");
end;
when Generate => when Generate =>
if Argc /= 2 then if Argc /= 2 then
...@@ -387,7 +403,7 @@ package body Ocarina.Scripts is ...@@ -387,7 +403,7 @@ package body Ocarina.Scripts is
Print_Status; Print_Status;
when Version => when Version =>
Version; Ocarina.Configuration.Version;
when Quit => when Quit =>
exit; exit;
...@@ -397,7 +413,7 @@ package body Ocarina.Scripts is ...@@ -397,7 +413,7 @@ package body Ocarina.Scripts is
Write_Line ("syntax error"); Write_Line ("syntax error");
when E : others => when E : others =>
Write_Line ("raised "& Exception_Information (E)); Write_Line ("raised " & Exception_Information (E));
Write_Line (Exception_Message (E)); Write_Line (Exception_Message (E));
end; end;
end if; end if;
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with GNAT.OS_Lib;
package Ocarina.Scripts is package Ocarina.Scripts is
procedure Ocarina_Shell; procedure Ocarina_Shell;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment