|
| 1 | +-- Same tests as for main.adb but using pragmas instead of |
| 2 | +-- Static/Dynamic_Predicate aspects. |
| 3 | +procedure Main95 is |
| 4 | + function Id (I : Integer) return Integer is (I); |
| 5 | + |
| 6 | + type Arr is array (Integer range <>) of Integer; |
| 7 | + subtype Stat_Arr is Arr (1 .. 10); |
| 8 | + subtype Dyn_Arr is Arr (1 .. Id (10)); |
| 9 | + type Multidim_Dyn_Arr is array (1 .. 10, 1 .. Id (10)) of Integer; |
| 10 | + |
| 11 | + subtype Stat_Int is Integer range 1 .. 10; |
| 12 | + subtype Dyn_Int is Integer range Id (1) .. Id (10); |
| 13 | + |
| 14 | + subtype Stat_Pred_Int is Integer; |
| 15 | + pragma Predicate (Entity => Stat_Pred_Int, Check => Stat_Pred_Int in 1 .. 10); |
| 16 | + subtype Dyn_Pred_Int is Integer; |
| 17 | + pragma Predicate (Entity => Dyn_Pred_Int, Check => Dyn_Pred_Int < Id(50)); |
| 18 | + |
| 19 | + S : String := "Hello"; |
| 20 | + C_S : constant String := "world"; |
| 21 | + |
| 22 | + procedure Process_Int (I : Integer) is |
| 23 | + begin |
| 24 | + null; |
| 25 | + end Process_Int; |
| 26 | + |
| 27 | + procedure Process_Stat_Int (I : Stat_Int) is |
| 28 | + begin |
| 29 | + null; |
| 30 | + end Process_Stat_Int; |
| 31 | + |
| 32 | + procedure Process_Dyn_Int (I : Dyn_Int) is |
| 33 | + begin |
| 34 | + null; |
| 35 | + end Process_Dyn_Int; |
| 36 | + |
| 37 | + procedure Process_Stat_Pred_Int (I : Stat_Pred_Int) is |
| 38 | + begin |
| 39 | + null; |
| 40 | + end Process_Stat_Pred_Int; |
| 41 | + |
| 42 | + procedure Process_Dyn_Pred_Int (I : Dyn_Pred_Int) is |
| 43 | + begin |
| 44 | + null; |
| 45 | + end Process_Dyn_Pred_Int; |
| 46 | + |
| 47 | + procedure Process_Multiple (I : Dyn_Pred_Int; J : Stat_Pred_Int) is |
| 48 | + begin |
| 49 | + null; |
| 50 | + end Process_Multiple; |
| 51 | + |
| 52 | + Stat_Assign : Stat_Int; |
| 53 | + Dyn_Assign : Dyn_Int; |
| 54 | + |
| 55 | + Stat_Index : Stat_Arr; |
| 56 | + Dyn_Index : Dyn_Arr; |
| 57 | + Mult_Index : Multidim_Dyn_Arr; |
| 58 | + |
| 59 | + Qual_Expr_1 : Stat_Int := Stat_Int'(C_S'Length); -- NOFLAG |
| 60 | + Qual_Expr_2 : Dyn_Int := Dyn_Int'(S'Length); -- NOFLAG |
| 61 | + Qual_Expr_3 : Dyn_Int := Dyn_Int'(C_S'Length); -- FLAG |
| 62 | + Qual_Expr_4 : Dyn_Int := Dyn_Int'(C_S'Size); -- NOFLAG |
| 63 | +begin |
| 64 | + Process_Int (S'Length); -- NOFLAG |
| 65 | + Process_Int (C_S'Length); -- NOFLAG |
| 66 | + Process_Stat_Int (S'Length); -- NOFLAG |
| 67 | + Process_Stat_Int (C_S'Length); -- NOFLAG |
| 68 | + Process_Dyn_Int (S'Length); -- NOFLAG |
| 69 | + Process_Dyn_Int (C_S'Length); -- FLAG |
| 70 | + Process_Dyn_Int (C_S'Size); -- NOFLAG |
| 71 | + Process_Stat_Pred_Int (S'Length); -- NOFLAG |
| 72 | + Process_Stat_Pred_Int (C_S'Length); -- NOFLAG |
| 73 | + Process_Dyn_Pred_Int (S'Length); -- NOFLAG |
| 74 | + Process_Dyn_Pred_Int (C_S'Length); -- FLAG |
| 75 | + Process_Dyn_Pred_Int (C_S'Size); -- NOFLAG |
| 76 | + |
| 77 | + Process_Multiple (S'Length, S'Size); -- NOFLAG |
| 78 | + Process_Multiple (C_S'Length, C_S'Size); -- FLAG |
| 79 | + |
| 80 | + Stat_Assign := S'Length; -- NOFLAG |
| 81 | + Stat_Assign := C_S'Length; -- NOFLAG |
| 82 | + Dyn_Assign := S'Length; -- NOFLAG |
| 83 | + Dyn_Assign := C_S'Length; -- FLAG |
| 84 | + Dyn_Assign := C_S'Size; -- NOFLAG |
| 85 | + |
| 86 | + Stat_Index (S'Length) := 10; -- NOFLAG |
| 87 | + Stat_Index (C_S'Length) := 10; -- NOFLAG |
| 88 | + Dyn_Index (S'Length) := 10; -- NOFLAG |
| 89 | + Dyn_Index (C_S'Length) := 10; -- FLAG |
| 90 | + Dyn_Index (C_S'Size) := 10; -- NOFLAG |
| 91 | + Dyn_Index (1) := 10; -- NOFLAG |
| 92 | + Mult_Index (1, S'Length) := 10; -- NOFLAG |
| 93 | + Mult_Index (1, C_S'Length) := 10; -- FLAG |
| 94 | + Mult_Index (1, C_S'Size) := 10; -- NOFLAG |
| 95 | + Mult_Index (C_S'Length, 1) := 10; -- FLAG |
| 96 | + Mult_Index (1, 1) := 10; -- NOFLAG |
| 97 | +end Main95; |
0 commit comments