Commit 4b6cc330 authored by hugues.jerome's avatar hugues.jerome

* Correct the processing of some numerical expressions



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@1092 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 1e0ac4a7
...@@ -1948,7 +1948,7 @@ package body Ocarina.Analyzer.AADL.Semantics is ...@@ -1948,7 +1948,7 @@ package body Ocarina.Analyzer.AADL.Semantics is
Get_Type_Of_Property_Value Get_Type_Of_Property_Value
(Expanded_Single_Value (Expanded_Single_Value
(Property_Association_Value (Property_Association_Value
(Property_Association)))) (Property_Association))))
and then Test_Property_Value_Validity and then Test_Property_Value_Validity
(Property_Name_Type (Property_Name), (Property_Name_Type (Property_Name),
Expanded_Single_Value Expanded_Single_Value
...@@ -2001,7 +2001,7 @@ package body Ocarina.Analyzer.AADL.Semantics is ...@@ -2001,7 +2001,7 @@ package body Ocarina.Analyzer.AADL.Semantics is
end if; end if;
-- Use the routines of the AADL_Values package to compare the -- Use the routines of the AADL_Values package to compare the
-- values and wrapp them to intercept any comparison error. -- values and wrap them to intercept any comparison error.
begin begin
if Value (Value (Literal_1)) < Value (Value (Literal_2)) then if Value (Value (Literal_1)) < Value (Value (Literal_2)) then
...@@ -2014,6 +2014,7 @@ package body Ocarina.Analyzer.AADL.Semantics is ...@@ -2014,6 +2014,7 @@ package body Ocarina.Analyzer.AADL.Semantics is
exception exception
when Constraint_Error => when Constraint_Error =>
Result := -2; Result := -2;
raise;
end; end;
return Result; return Result;
...@@ -2150,6 +2151,7 @@ package body Ocarina.Analyzer.AADL.Semantics is ...@@ -2150,6 +2151,7 @@ package body Ocarina.Analyzer.AADL.Semantics is
N := New_Node (K_Literal, Loc (L)); N := New_Node (K_Literal, Loc (L));
Set_Value (N, New_Value (Result)); Set_Value (N, New_Value (Result));
return N; return N;
end Convert_To_Base; end Convert_To_Base;
...@@ -2340,7 +2342,6 @@ package body Ocarina.Analyzer.AADL.Semantics is ...@@ -2340,7 +2342,6 @@ package body Ocarina.Analyzer.AADL.Semantics is
if Success then if Success then
case Kind (Type_Designator) is case Kind (Type_Designator) is
when K_Classifier_Type => when K_Classifier_Type =>
List_Node := List_Node :=
First_Node (List_Items (Type_Designator)); First_Node (List_Items (Type_Designator));
...@@ -2400,9 +2401,10 @@ package body Ocarina.Analyzer.AADL.Semantics is ...@@ -2400,9 +2401,10 @@ package body Ocarina.Analyzer.AADL.Semantics is
if Get_Entity_Category (Temp_Node) = if Get_Entity_Category (Temp_Node) =
EC_Subcomponent EC_Subcomponent
then then
-- If the subcomponent specification -- If the subcomponent
-- is incmplete (see AADL 1.0 -- specification is incomplete
-- standard paragraph 4.5 section -- (see AADL 1.0 standard
-- paragraph 4.5 section
-- `semantics'), then there is -- `semantics'), then there is
-- nothing else to analyze. -- nothing else to analyze.
...@@ -2507,18 +2509,14 @@ package body Ocarina.Analyzer.AADL.Semantics is ...@@ -2507,18 +2509,14 @@ package body Ocarina.Analyzer.AADL.Semantics is
Present (Lower_Bound (Type_Range (Type_Designator))) Present (Lower_Bound (Type_Range (Type_Designator)))
and then and then
(Compare_Numbers (Compare_Numbers
(Lower_Bound (Lower_Bound (Type_Range (Type_Designator)),
(Type_Range Actual_Literal) >= 0)
(Type_Designator)),
Actual_Literal) >= 0)
and then and then
Present (Upper_Bound (Type_Range (Type_Designator))) Present (Upper_Bound (Type_Range (Type_Designator)))
and then and then
(Compare_Numbers (Compare_Numbers
(Actual_Literal, (Actual_Literal,
Upper_Bound Upper_Bound (Type_Range (Type_Designator))) >= 0);
(Type_Range
(Type_Designator))) >= 0);
end if; end if;
else else
Success := False; Success := False;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2004-2008, GET-Telecom Paris. -- -- Copyright (C) 2004-2010, GET-Telecom Paris. --
-- -- -- --
-- Ocarina is free software; you can redistribute it and/or modify -- -- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the -- -- it under terms of the GNU General Public License as published by the --
...@@ -262,28 +262,16 @@ package body Ocarina.AADL_Values is ...@@ -262,28 +262,16 @@ package body Ocarina.AADL_Values is
return Remove_Leading_Spaces (Unsigned_Short_Short'Image (V)); return Remove_Leading_Spaces (Unsigned_Short_Short'Image (V));
end Image; end Image;
-----------
-- Image --
-----------
function Image (V : Integer) return String is function Image (V : Integer) return String is
begin begin
return Remove_Leading_Spaces (Integer'Image (V)); return Remove_Leading_Spaces (Integer'Image (V));
end Image; end Image;
-----------
-- Image --
-----------
function Image (V : Unsigned_Long_Long) return String is function Image (V : Unsigned_Long_Long) return String is
begin begin
return Remove_Leading_Spaces (Unsigned_Long_Long'Image (V)); return Remove_Leading_Spaces (Unsigned_Long_Long'Image (V));
end Image; end Image;
-----------
-- Image --
-----------
function Image function Image
(V : Unsigned_Long_Long; (V : Unsigned_Long_Long;
Base : Unsigned_Short_Short) Base : Unsigned_Short_Short)
...@@ -321,10 +309,6 @@ package body Ocarina.AADL_Values is ...@@ -321,10 +309,6 @@ package body Ocarina.AADL_Values is
return Str (Str_Pos + 1 .. Str'Last); return Str (Str_Pos + 1 .. Str'Last);
end Image; end Image;
-----------
-- Image --
-----------
function Image function Image
(V : Unsigned_Long_Long; (V : Unsigned_Long_Long;
Base : Unsigned_Short_Short; Base : Unsigned_Short_Short;
...@@ -359,10 +343,6 @@ package body Ocarina.AADL_Values is ...@@ -359,10 +343,6 @@ package body Ocarina.AADL_Values is
end if; end if;
end Image; end Image;
-----------
-- Image --
-----------
function Image (V : Long_Long_Float) return String is function Image (V : Long_Long_Float) return String is
Str : String (1 .. 2 * Long_Long_Float'Digits + 2); Str : String (1 .. 2 * Long_Long_Float'Digits + 2);
-- Max digits = [+/-] Fore . Aft -- Max digits = [+/-] Fore . Aft
...@@ -372,10 +352,6 @@ package body Ocarina.AADL_Values is ...@@ -372,10 +352,6 @@ package body Ocarina.AADL_Values is
return Remove_Ending_Zeros (Remove_Leading_Spaces (Str)); return Remove_Ending_Zeros (Remove_Leading_Spaces (Str));
end Image; end Image;
-----------
-- Image --
-----------
function Image function Image
(V : Long_Long_Float; (V : Long_Long_Float;
Base : Unsigned_Short_Short) Base : Unsigned_Short_Short)
...@@ -430,10 +406,6 @@ package body Ocarina.AADL_Values is ...@@ -430,10 +406,6 @@ package body Ocarina.AADL_Values is
end if; end if;
end Image; end Image;
-----------
-- Image --
-----------
function Image function Image
(V : Long_Long_Float; (V : Long_Long_Float;
Base : Unsigned_Short_Short; Base : Unsigned_Short_Short;
...@@ -468,10 +440,6 @@ package body Ocarina.AADL_Values is ...@@ -468,10 +440,6 @@ package body Ocarina.AADL_Values is
end if; end if;
end Image; end Image;
-----------
-- Image --
-----------
function Image (Kind : Node_Kind) return String is function Image (Kind : Node_Kind) return String is
use Charset; use Charset;
...@@ -504,7 +472,7 @@ package body Ocarina.AADL_Values is ...@@ -504,7 +472,7 @@ package body Ocarina.AADL_Values is
PExp : constant Integer := abs (Exp); PExp : constant Integer := abs (Exp);
begin begin
for I in 1 .. PExp loop for J in 1 .. PExp loop
Result := Result * LBase; Result := Result * LBase;
end loop; end loop;
...@@ -568,6 +536,7 @@ package body Ocarina.AADL_Values is ...@@ -568,6 +536,7 @@ package body Ocarina.AADL_Values is
Result.IBase := 10; Result.IBase := 10;
Result.ISign := Safe_XOR (L.ISign, R.ISign); Result.ISign := Safe_XOR (L.ISign, R.ISign);
Result.IVal := L.IVal * R.IVal; Result.IVal := L.IVal * R.IVal;
Result.IExp := 0;
return Result; return Result;
end; end;
......
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