Commit a54e50f5 authored by yoogx's avatar yoogx

* analyse() function now returns a boolean

        For issue #30
parent 0679fb81
...@@ -35,8 +35,8 @@ def status (): ...@@ -35,8 +35,8 @@ def status ():
def reset (): def reset ():
'''Reset Ocarina internal state '''Reset Ocarina internal state
**Note:** this function must be called before processing a new set of models. **Note:** this function must be called before processing a new set of
''' models.'''
libocarina_python.reset(); libocarina_python.reset();
...@@ -44,7 +44,7 @@ def reset (): ...@@ -44,7 +44,7 @@ def reset ():
def load (filename): def load (filename):
'''Load a file '''Load a file
:param filename: name of the file to be loaded, following Ocarina search path :param filename: name of the file to be loaded, using Ocarina search path
:type filename: string :type filename: string
E.g. to load "foo.aadl": E.g. to load "foo.aadl":
...@@ -57,7 +57,7 @@ def load (filename): ...@@ -57,7 +57,7 @@ def load (filename):
################################################################################ ################################################################################
def analyze (): def analyze ():
'''Analyze models''' '''Analyze models'''
libocarina_python.analyze (); return libocarina_python.analyze ();
################################################################################ ################################################################################
def instantiate (root_system): def instantiate (root_system):
...@@ -311,5 +311,3 @@ def getNodeId (name): ...@@ -311,5 +311,3 @@ def getNodeId (name):
>>> getNodeId (MyHome); >>> getNodeId (MyHome);
''' '''
return libocarina_python.getNodeId (name); return libocarina_python.getNodeId (name);
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2014 ESA & ISAE. -- -- Copyright (C) 2014-2015 ESA & ISAE. --
-- -- -- --
-- Ocarina is free software; you can redistribute it and/or modify -- -- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the -- -- it under terms of the GNU General Public License as published by the --
...@@ -145,9 +145,10 @@ package body Ocarina.Python_Cmd is ...@@ -145,9 +145,10 @@ package body Ocarina.Python_Cmd is
(Data : in out Callback_Data'Class; (Data : in out Callback_Data'Class;
Command : String) Command : String)
is is
pragma Unreferenced (Command, Data); pragma Unreferenced (Command);
Result : constant Boolean := Ocarina.Utils.Analyze;
begin begin
Ocarina.Utils.Analyze; Set_Return_Value (Data, Result);
end On_Analyze; end On_Analyze;
----------------- -----------------
......
...@@ -208,7 +208,7 @@ package body Ocarina.Utils is ...@@ -208,7 +208,7 @@ package body Ocarina.Utils is
-- Analyze -- -- Analyze --
------------- -------------
procedure Analyze is function Analyze return Boolean is
Success : Boolean; Success : Boolean;
begin begin
Success := Analyze (Language, AADL_Root); Success := Analyze (Language, AADL_Root);
...@@ -217,6 +217,7 @@ package body Ocarina.Utils is ...@@ -217,6 +217,7 @@ package body Ocarina.Utils is
else else
Write_Line ("Model analyzed sucessfully"); Write_Line ("Model analyzed sucessfully");
end if; end if;
return Success;
end Analyze; end Analyze;
----------------- -----------------
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2013 ESA & ISAE. -- -- Copyright (C) 2013-2015 ESA & ISAE. --
-- -- -- --
-- Ocarina is free software; you can redistribute it and/or modify -- -- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the -- -- it under terms of the GNU General Public License as published by the --
...@@ -49,7 +49,7 @@ package Ocarina.Utils is ...@@ -49,7 +49,7 @@ package Ocarina.Utils is
-- Display status information on Ocarina -- Display status information on Ocarina
procedure Load_AADL_File (Filename : String); procedure Load_AADL_File (Filename : String);
procedure Analyze; function Analyze return Boolean;
procedure Instantiate (Root_System : String); procedure Instantiate (Root_System : String);
procedure Generate (Backend_Name : String); procedure Generate (Backend_Name : String);
procedure Reset; procedure Reset;
......
...@@ -10,7 +10,8 @@ def main (): ...@@ -10,7 +10,8 @@ def main ():
load("rma.aadl"); # load a file load("rma.aadl"); # load a file
load("deployment.aadl"); # load a file load("deployment.aadl"); # load a file
analyze(); # analyze models result = analyze(); # analyze models
print "Analysis result %r" % (result);
instantiate("rma.erc32"); # instantiate instantiate("rma.erc32"); # instantiate
generate (Backends.polyorb_hi_ada); generate (Backends.polyorb_hi_ada);
......
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