OpenAADL / ocarina
1
------------------------------------------------------------------------------
2
--                                                                          --
3
--                           OCARINA COMPONENTS                             --
4
--                                                                          --
5
--          O C A R I N A . B A C K E N D S . A D A _ V A L U E S           --
6
--                                                                          --
7
--                                 S p e c                                  --
8
--                                                                          --
9
--               Copyright (C) 2006-2009 Telecom ParisTech,                 --
10
--                 2010-2019 ESA & ISAE, 2019-2020 OpenAADL                 --
11
--                                                                          --
12
-- Ocarina  is free software; you can redistribute it and/or modify under   --
13
-- terms of the  GNU General Public License as published  by the Free Soft- --
14
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
15
-- sion. Ocarina is distributed in the hope that it will be useful, but     --
16
-- WITHOUT ANY WARRANTY; without even the implied warranty of               --
17
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     --
18
--                                                                          --
19
-- As a special exception under Section 7 of GPL version 3, you are granted --
20
-- additional permissions described in the GCC Runtime Library Exception,   --
21
-- version 3.1, as published by the Free Software Foundation.               --
22
--                                                                          --
23
-- You should have received a copy of the GNU General Public License and    --
24
-- a copy of the GCC Runtime Library Exception along with this program;     --
25
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
26
-- <http://www.gnu.org/licenses/>.                                          --
27
--                                                                          --
28
--                    Ocarina is maintained by OpenAADL team                --
29
--                              (info@openaadl.org)                         --
30
--                                                                          --
31
------------------------------------------------------------------------------
32

33
with Ocarina.Backends.Ada_Tree.Nodes; use Ocarina.Backends.Ada_Tree.Nodes;
34

35 1
package Ocarina.Backends.Ada_Values is
36

37
   type Value_Type (K : Node_Kind := K_Boolean) is record
38
      case K is
39
         when K_Integer | K_Boolean =>
40
            IVal : Unsigned_Long_Long;
41
            Sign : Short_Short;
42
            Base : Unsigned_Short_Short;
43

44
         when K_Float =>
45
            FVal : Long_Double;
46

47
         when K_String | K_Wide_String =>
48
            SVal : Name_Id;
49

50
         when K_Character | K_Wide_Character =>
51
            CVal : Unsigned_Short;
52

53
         when others =>
54
            null;
55
      end case;
56
   end record;
57

58
   Bad_Value : constant Value_Type;
59
   No_Value : constant Value_Id;
60

61
   function New_Boolean_Value (Value : Boolean) return Value_Id;
62

63
   function New_Floating_Point_Value (Value : Long_Double) return Value_Id;
64

65
   function New_Integer_Value
66
     (Value : Unsigned_Long_Long;
67
      Sign  : Short_Short;
68
      Base  : Unsigned_Short_Short) return Value_Id;
69

70
   function New_String_Value
71
     (Value : Name_Id;
72
      Wide  : Boolean := False) return Value_Id;
73

74
   function New_Character_Value
75
     (Value : Unsigned_Short;
76
      Wide  : Boolean := False) return Value_Id;
77

78
   function New_Value (Value : Value_Type) return Value_Id;
79

80
   function Value (V : Value_Id) return Value_Type;
81
   procedure Set_Value (V : Value_Id; X : Value_Type);
82

83
   function Image (Value : Value_Id) return String;
84

85
   function To_Ada_Value (V : Value_Id) return Value_Id;
86
   --  Converts an AADL value to and Ada one
87

88
   function "not" (R : Value_Type) return Value_Type;
89
   function "-" (R : Value_Type) return Value_Type;
90
   function "-" (L, R : Value_Type) return Value_Type;
91
   function "+" (L, R : Value_Type) return Value_Type;
92
   function "mod" (L, R : Value_Type) return Value_Type;
93
   function "/" (L, R : Value_Type) return Value_Type;
94
   function "*" (L, R : Value_Type) return Value_Type;
95
   function "and" (L, R : Value_Type) return Value_Type;
96
   function "or" (L, R : Value_Type) return Value_Type;
97
   function "xor" (L, R : Value_Type) return Value_Type;
98
   function Shift_Left (L, R : Value_Type) return Value_Type;
99
   function Shift_Right (L, R : Value_Type) return Value_Type;
100

101
   function "<" (L, R : Value_Type) return Boolean;
102
   --  Assume L and R have the same type.
103

104
   procedure Reset;
105
   --  Reset the value table
106

107
private
108

109 1
   Bad_Value : constant Value_Type := Value_Type'((K => K_Node_Id));
110
   No_Value  : constant Value_Id   := 0;
111

112 1
end Ocarina.Backends.Ada_Values;

Read our documentation on viewing source code .

Loading