------------------------------------------------------------ -------------------- -- -- -- OCARINA COMPONENTS -- -- -- -- G A I A . P N . N U T I L S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2005-2007, GET-Telecom Paris. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. 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. See the GNU General -- -- Public License for more details. You should have received a copy of the -- -- GNU General Public License distributed with Ocarina; see file COPYING. -- -- If not, write to the Free Software Foundation, 51 Franklin Street, Fifth -- -- Floor, Boston, MA 02111-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- Ocarina is maintained by the Ocarina team -- -- (ocarina-users@listes.enst.fr) -- -- -- ------------------------------------------------------------------------------ with Types; use Types; with Ocarina.AADL_Values; with Gaia.Pn.Nodes; use Gaia.Pn.Nodes; package Gaia.Pn.Nutils is -- Control Color Node Control_Color : Types.Node_Id; -- Color objects Valid_Color_Obj : Value_Id; Invalid_Color_Obj : Value_Id; function New_Node (Kind : Node_Kind) return Node_Id; -- Create a new node function New_List (Kind : Node_Kind) return List_Id; -- Create a new list function Is_Empty (L : List_Id) return Boolean; -- Return true if the list is empty, else return false procedure Append_Node_To_List (E : Node_Id; L : List_Id); -- Append the node to the list function Make_Root_Node (Dir_Name, File_Name : Name_Id) return Node_Id; -- Create the root node function Make_Container return Node_Id; -- Create a new container function Make_Fonctionnal_Entity return Node_Id; -- Create a new fonctionnal entity function Make_Thread_Box return Node_Id; -- Create a new thread function Make_Identifier (Pn_Entity : Node_Id; Ident_Name : Name_Id) return Node_Id; -- Create a new identifier function Map_Scoped_Name (Gaia_Scoped, Corresponding : Node_Id) return Node_Id; -- Copy the Gaia Tree Scoped Name into the PN Tree function Make_Scoped_Name (Reference : Node_Id; Entity_Name : Name_Id) return Node_Id; -- Create a new Scoped Name function Make_Scoped_Name (Reference : Node_Id; Parent : Node_Id; Entity_Name : Name_Id) return Node_Id; -- Create a new Scoped Name whose father will be parent's scoped name -- only use Node_Id number as a name (no parent name) if -- Full_Naming_Policy is set to false function Make_Always_Scoped_Name (Reference : Node_Id; Parent : Node_Id; Entity_Name : Name_Id) return Node_Id; -- as Make_Scoped_Name, but don't care about Full_Naming_Policy value function Make_Colored_Token (Color : Node_Id; Number : Value_Id := Ocarina.AADL_Values.V_One) return Node_Id; -- Create a colored token value for Arcs. Parameters are the color -- and the number of tookens needed. procedure Add_Domain_To_List (D : Node_Id; L : List_Id); -- Add a domain in a List procedure Add_Domain_To_Node (D, N : Node_Id; Number : Value_Id := Ocarina.AADL_Values.V_One); -- Add a domain in Node's domain list if it's not already present. -- Can be used with either Connection_Statement and others petriscript -- objects. procedure Add_Token_Value_To_Arc (A : Node_Id; V : Value_Id; C : Node_Id); -- Set a Token value in Node's domain list. procedure Make_Control_Color; -- Initialize the control color and variable, and initialize -- colors objects values. function Make_Color_Declaration (T, Parent : Node_Id) return Node_Id; -- Create a color declaration node for type T, which is a -- gaia type definition node. function Make_Transition_Declaration (Suffix : Name_Id; Parent : Node_Id) return Node_Id; -- Create a transition -- Useful when building transitions that are not bijective -- with a Gaia node function Make_Fifo_Extremities (Thread : Node_Id) return Node_Id; -- Build a fifo_extremities node function Translate_Position (P : Node_Id) return Node_Location; -- Translate a transtion into a Node_Location. procedure Make_Position (N : Node_Id; P : Node_Location); -- Associate a PN Node with a position function Make_Embedded_Node (N : Node_Id) return Node_Id; -- Return a node which contains the N node procedure Append_Node_To_Fifo (N, F : Node_Id); -- Add the N node to Fifo node list, using an embedded node. procedure Make_Port_Location (P : Node_Id; L : Node_Location); -- Set L location for the port in the fifo procedure Make_Fifos_Location (F : Node_Id; L : Node_Location); -- Set L location for all nodes of F Fifo procedure Add_Token_To_Place (P : Node_Id; V : Value_Id; C : Node_Id); -- Create a token with Value V of color C and append it -- to P's Tokens list procedure Make_Guard (T : Node_Id; C : Node_Id; V : Node_Id; Cst : Value_Id); -- Create a guard for transition T, which test if V <> C.Cst procedure Make_Equal_Guard (T : Node_Id; C : Node_Id; V : Node_Id; Cst : Value_Id); -- Create a guard for transition T, which test if V = C.Cst function Make_Transition_Declaration (Transition_Name : Name_Id; P : Node_Location) return Node_Id; -- Create a transition declaration function Make_Place_Declaration (Place_Name : Name_Id; P : Node_Location) return Node_Id; -- Create a place declaration function Make_Transition_Declaration (Transition_Name : Name_Id) return Node_Id; -- Create a transition declaration function Make_Place_Declaration (Place_Name : Name_Id) return Node_Id; -- Create a place declaration function Make_Connection_Statement (Source_Node, Destination_Node : Node_Id; Place_To_Transition : Boolean) return Node_Id; -- Create a connection between the source and destination -- ports/parameters, passed as pn nodes. function Make_Place_Fusion (Node_1, Node_2, New_Name : Node_Id) return Node_Id; -- Create a new place fusion declaration between node_1 and node_2, -- namming it "new_name" (a scoped name) function Make_Symbolic_Value (N : Value_Id) return Node_Id; -- Create a new special value function Make_Include_Call (Gaia_Instance, Gaia_Subprogram_Call : Node_Id) return Node_Id; -- create a new include call function Make_Include_Call (Prefix : String; Gaia_Call : Node_Id) return Node_Id; -- create a new include call with constant namespace "UD" end Gaia.Pn.Nutils;