Commit 8e82cddc authored by yoogx's avatar yoogx

Merge branch 'master' of https://github.com/OpenAADL/ocarina

parents 3bea8918 3636a621
This diff is collapsed.
......@@ -122,6 +122,26 @@ def getPropertyValue (nodeId,propertyId):
################################################################################
def getPropertyValueByName (nodeId,propertyString):
'''Get the value of the property
'''Get the value of the property propertyString applied to model
element nodeId.
'''
return runOcarinaFunction (libocarina_python.getPropertyValueByName, nodeId, propertyString)
################################################################################
def getSourcePorts (feature_nodeId):
'''Get the source port associated to the feature_nodeId passed as
parameter, in the case feature_nodeId participates in a
connection.
'''
return runOcarinaFunction (libocarina_python.getSourcePorts, nodeId)
################################################################################
def getDestinationPorts (nodeId):
'''Get the destination port associated to the feature_nodeId passed as
parameter, in the case feature_nodeId participates in a
connection.
'''
return runOcarinaFunction (libocarina_python.getDestinationPorts, nodeId)
......@@ -31,6 +31,8 @@ args = sys.argv[1:]
import ocarina
import lmp
from ocarina_common_tools import *
import libocarina_python
def visitor (component, level):
"""
......@@ -49,14 +51,15 @@ def visitor (component, level):
if features is not None :
print ' ' * level,' -> features:',features
for feature in features :
print ' ' * level,' -> ',feature,",",lmp.getInstanceName(feature)[0]
print ' ' * level,' -> feature:',feature,', ',lmp.getInstanceName(feature)[0]
print ' ' * level,' source feature: ', lmp.getInstanceName(ocarina.getSourcePorts(feature)[0])[0]
print ' ' * level,' destination feature: ', lmp.getInstanceName(ocarina.getDestinationPorts(feature)[0])[0]
properties = ocarina.AIN.Properties(component)[0];
if properties is not None :
print ' ' * level,' -> properties:'
for property in properties:
print ' ' * level,' ',ocarina.getPropertyValue(component,property)[0]
print '[looking for priority] ' * level,' ',ocarina.getPropertyValueByName(component,u'priority')[0]
subcomponents=ocarina.AIN.Subcomponents(component)[0];
if subcomponents is not None :
......
......@@ -3161,7 +3161,6 @@ package body Ocarina.Backends.Utils is
end if;
N := Next_Node (N);
end loop;
return Return_Value;
......@@ -3648,9 +3647,9 @@ package body Ocarina.Backends.Utils is
return False;
end Is_Pure_Device_Port;
----------------------------
-- Is_Using_Virtual_Bus --
----------------------------
---------------------------
-- Is_Using_Virtual_Bus --
---------------------------
function Is_Using_Virtual_Bus (Port : Node_Id) return Boolean is
......
......@@ -207,6 +207,10 @@ package body Ocarina.Backends.Vxworks653_Conf.Connections is
begin
Corresponding_Process := Find_Associated_Process (E);
if AINU.Is_Empty (Features (Corresponding_Process)) then
return;
end if;
Feature := First_Node (Features (Corresponding_Process));
while Present (Feature) loop
......
......@@ -34,10 +34,9 @@ pragma Warnings (Off);
with GNATCOLL.Scripts; use GNATCOLL.Scripts;
with GNATCOLL.Scripts.Python; use GNATCOLL.Scripts.Python;
with GNATCOLL.VFS; use GNATCOLL.VFS;
with Ocarina.Configuration; use Ocarina.Configuration;
with GNATCOLL.VFS; use GNATCOLL.VFS;
with Ocarina.Output; use Ocarina.Output;
with Errors;
......@@ -50,14 +49,18 @@ with Ocarina.ME_AADL.AADL_Tree.Entities;
with Ocarina.Namet; use Ocarina.Namet;
with Ocarina.Backends.Properties.Utils;
with Ocarina.Backends.Utils; use Ocarina.Backends.Utils;
with GNAT.Os_Lib; use GNAT.Os_Lib;
with Ocarina.ME_AADL.AADL_Instances.Nutils;
with Ocarina.ME_AADL.AADL_Instances.Nodes;
use Ocarina.ME_AADL.AADL_Instances.Nodes;
package body Ocarina.Python_Cmd is
package ATE renames Ocarina.ME_AADL.AADL_Tree.Entities;
package ATNP renames Ocarina.ME_AADL.AADL_Tree.Nodes.Python;
package AINP renames Ocarina.ME_AADL.AADL_Instances.Nodes.Python;
package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
procedure Get_Node_Id (Data : in out Callback_Data'Class; N : String);
procedure Get_Property_Value (Data : in out Callback_Data'Class;
PropId : String; PropName : String);
......@@ -100,6 +103,8 @@ package body Ocarina.Python_Cmd is
for Elt of Result loop
Set_Return_Value (Data, Elt.all);
end loop;
-- XXX shoudl free Result
end Get_Property_Value_By_Name;
-----------------
......@@ -653,6 +658,54 @@ package body Ocarina.Python_Cmd is
Node_Id (Integer'Value (Nth_Arg (Data, 1, ""))));
end On_Get_Instance_Name;
-------------------------
-- On_Get_Source_Ports --
-------------------------
procedure On_Get_Source_Ports
(Data : in out Callback_Data'Class; Command : String);
procedure On_Get_Source_Ports
(Data : in out Callback_Data'Class;
Command : String)
is
pragma Unreferenced (Command);
N : constant Node_Id := Node_Id (Integer'Value (Nth_Arg (Data, 1, "")));
Result : List_Id;
begin
if not AINU.Is_Empty (Sources (N)) then
Result := Ocarina.Backends.Utils.Get_Source_Ports (N);
Set_Return_Value (Data, Item (First_Node (Result))'Img);
else
Set_Return_Value (Data, Integer'Image (0));
end if;
end On_Get_Source_Ports;
------------------------------
-- On_Get_Destination_Ports --
------------------------------
procedure On_Get_Destination_Ports
(Data : in out Callback_Data'Class; Command : String);
procedure On_Get_Destination_Ports
(Data : in out Callback_Data'Class;
Command : String)
is
pragma Unreferenced (Command);
N : constant Node_Id := Node_Id (Integer'Value (Nth_Arg (Data, 1, "")));
Result : List_Id;
begin
if not AINU.Is_Empty (Destinations (N)) then
Result := Ocarina.Backends.Utils.Get_Destination_Ports (N);
Set_Return_Value (Data, Item (First_Node (Result))'Img);
else
Set_Return_Value (Data, Integer'Image (0));
end if;
end On_Get_Destination_Ports;
------------------------------------
-- Register_Scripts_And_Functions --
------------------------------------
......@@ -839,6 +892,16 @@ package body Ocarina.Python_Cmd is
(Repo, "getNodeId", 1, 1,
Handler => On_Get_Node_Id'Unrestricted_Access);
-- getSourcePorts() function
Register_Command
(Repo, "getSourcePorts", 1, 1,
Handler => On_Get_Source_Ports'Unrestricted_Access);
-- getDestinationPorts() function
Register_Command
(Repo, "getDestinationPorts", 1, 1,
Handler => On_Get_Destination_Ports'Unrestricted_Access);
-- Register functions generated from AADL declarative and
-- instance trees
......
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