OpenAADL / ocarina
1
------------------------------------------------------------------------------
2
--                                                                          --
3
--                           OCARINA COMPONENTS                             --
4
--                                                                          --
5
--            O C A R I N A . B A C K E N D S . C _ V A L U E S             --
6
--                                                                          --
7
--                                 S p e c                                  --
8
--                                                                          --
9
--               Copyright (C) 2008-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.C_Tree.Nodes; use Ocarina.Backends.C_Tree.Nodes;
34

35 1
package Ocarina.Backends.C_Values is
36

37
   type Value_Type (K : Node_Kind := K_Int) is record
38
      case K is
39
         when K_Int =>
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_Char =>
48
            CVal : Unsigned_Short;
49

50
         when K_Pointed_Char =>
51
            PCVal : Name_Id;
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_Floating_Point_Value (Value : Long_Double) return Value_Id;
62

63
   function New_Int_Value
64
     (Value : Unsigned_Long_Long;
65
      Sign  : Short_Short;
66
      Base  : Unsigned_Short_Short) return Value_Id;
67

68
   function New_Char_Value (Value : Unsigned_Short) return Value_Id;
69

70
   function New_Pointed_Char_Value (Value : Name_Id) return Value_Id;
71

72
   function New_Value (Value : Value_Type) return Value_Id;
73

74
   function Value (V : Value_Id) return Value_Type;
75
   procedure Set_Value (V : Value_Id; X : Value_Type);
76

77
   function Image (Value : Value_Id) return String;
78

79
   function To_C_Value (V : Value_Id) return Value_Id;
80
   --  Converts an AADL value to a C one
81

82
   function "not" (R : Value_Type) return Value_Type;
83
   function "-" (R : Value_Type) return Value_Type;
84
   function "-" (L, R : Value_Type) return Value_Type;
85
   function "+" (L, R : Value_Type) return Value_Type;
86
   function "mod" (L, R : Value_Type) return Value_Type;
87
   function "/" (L, R : Value_Type) return Value_Type;
88
   function "*" (L, R : Value_Type) return Value_Type;
89
   function "and" (L, R : Value_Type) return Value_Type;
90
   function "or" (L, R : Value_Type) return Value_Type;
91
   function "xor" (L, R : Value_Type) return Value_Type;
92
   function Shift_Left (L, R : Value_Type) return Value_Type;
93
   function Shift_Right (L, R : Value_Type) return Value_Type;
94

95
   function "<" (L, R : Value_Type) return Boolean;
96
   --  Assume L and R have the same type.
97

98
   procedure Reset;
99
   --  Reset the value table
100

101
private
102

103 1
   Bad_Value : constant Value_Type := Value_Type'((K => K_Node_Id));
104
   No_Value  : constant Value_Id   := 0;
105

106 1
end Ocarina.Backends.C_Values;

Read our documentation on viewing source code .

Loading