----------------------------------------------- --------------------------------- -- -- -- OCARINA COMPONENTS -- -- -- -- O C A R I N A . A A D L _ V A L U E S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2004-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) -- -- -- ------------------------------------------------------------------------------ -- This package contains the functions related to value management -- inside the Ocarina tree. with Ocarina.Nodes; use Ocarina.Nodes; with Types; use Types; package Ocarina.AADL_Values is type literal_type is (lt_integer, lt_real, lt_string, lt_boolean, lt_enumeration); type value_type (T : literal_type := lt_integer) is record case T is when lt_integer => IVal : unsigned_long_long; -- Absolute value ISign : Boolean; -- True => Negative IBase : unsigned_short_short; -- For printing purpose only IExp : Integer; -- For printing purpose only when lt_real => RVal : Long_Long_Float; -- Absolute value RSign : Boolean; -- True => Negative RBase : unsigned_short_short; -- For printing purpose only RExp : Integer; -- For printing purpose only when lt_string => SVal : name_id; when lt_boolean => BVal : Boolean; when lt_enumeration => EVal : name_id; end case; end record; No_Value : constant value_id; V_Zero : value_id; V_One : value_id; function Get_Value_Type (Value : value_id) return value_type; function New_Boolean_Value (Value : Boolean) return value_id; function New_Real_Value (Value : Long_Long_Float; Negative : Boolean := False; Base : unsigned_short_short := 10; Exp : Integer := 0) return value_id; function New_Integer_Value (Value : unsigned_long_long; Negative : Boolean := False; Base : unsigned_short_short := 10; Exp : Integer := 0) return value_id; function New_String_Value (Value : name_id) return value_id; function New_Enum_Value (Value : name_id) return value_id; function New_Value (Value : value_type) return value_id; function Value (V : value_id) return value_type; procedure Set_Value (V : value_id; X : value_type); function Image (Value : value_type; Quoted : Boolean := True) return String; function Image (Value : value_id; Quoted : Boolean := True) return String; function Power (Base : Integer; Exp : Integer) return Long_Long_Float; -- Return (Base ** Exp) function Image (V : unsigned_short_short) return String; pragma inline (Image); function Image (V : Integer) return String; pragma inline (Image); function Image (V : unsigned_long_long) return String; pragma inline (Image); function Image (V : Long_Long_Float) return String; pragma inline (Image); -- Call Remove_Leading_Spaces (XXXXXX'Image (V)) function Image (V : Long_Long_Float; Base : unsigned_short_short; Exp : Integer) return String; function Image (V : unsigned_long_long; Base : unsigned_short_short; Exp : Integer) return String; function Image (Kind : node_kind) return String; -- Return corresponding string of node kind function "*" (L : value_type; R : value_type) return value_type; -- Return L * R (accept Integer * Real) function "=" (L : value_type; R : value_type) return Boolean; function "<" (L : value_type; R : value_type) return Boolean; -- Accept comparison between integer and real procedure Reset; -- Reset the value table private No_Value : constant value_id := 0; end Ocarina.AADL_Values;