diff --git a/src/eff.ml b/src/eff.ml index 65d80475ce63744f78a47d5fda83a930f1fdebe7..e2498fd862ad2ee900ae59cc24df34290aa8a4a4 100644 --- a/src/eff.ml +++ b/src/eff.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 15/09/2008 (at 15:21) by Erwan Jahier> *) +(** Time-stamp: <modified the 23/10/2008 (at 15:16) by Erwan Jahier> *) (** @@ -213,7 +213,7 @@ and const = (* type predef *) Bool_const_eff of bool | Int_const_eff of int - | Real_const_eff of float + | Real_const_eff of string (* type atomique non predef : on précise le type *) | Extern_const_eff of (Ident.long * type_ * const option) | Enum_const_eff of (Ident.long * type_) @@ -455,9 +455,9 @@ let rec (subst_type : type_ -> type_ -> type_) = let (type_of_const: const -> type_) = function - | Bool_const_eff v -> Bool_type_eff - | Int_const_eff v -> Int_type_eff - | Real_const_eff v -> Real_type_eff + | Bool_const_eff _ -> Bool_type_eff + | Int_const_eff _ -> Int_type_eff + | Real_const_eff _ -> Real_type_eff | Extern_const_eff (s, teff, vopt) -> teff | Enum_const_eff (s, teff) -> teff | Struct_const_eff (fl, teff) -> teff diff --git a/src/lexer.mll b/src/lexer.mll index 625efbb4933f11fec7f2b03bb1c4e6e3853b4681..c560f029275b58acc07d289cbe96111b81758ed2 100644 --- a/src/lexer.mll +++ b/src/lexer.mll @@ -262,11 +262,12 @@ rule lexer = parse (* constantes entières et réelles *) | chiffres { TK_ICONST (Lxm.make lexbuf ) } - | chiffres (exposant) { TK_RCONST (Lxm.make lexbuf ) } + | ( '-' )? chiffres (exposant) { TK_RCONST (Lxm.make lexbuf ) } - | chiffres '.' (chiffres)? (exposant)? { TK_RCONST (Lxm.make lexbuf ) } + | ( '-' )? chiffres '.' (chiffres)? (exposant)? + { TK_RCONST (Lxm.make lexbuf ) } - | '.' chiffres (exposant)? { TK_RCONST (Lxm.make lexbuf ) } + | ( '-' )? '.' chiffres (exposant)? { TK_RCONST (Lxm.make lexbuf ) } (* mot-clé ou identificateur *) | ['_' 'A'-'Z' 'a'-'z'] ['A'-'Z' 'a'-'z' '\'' '_' '0'-'9'] * diff --git a/src/licDump.ml b/src/licDump.ml index 0fd69c21acfaf20815e450a34918e8d289bec8de..9aa28d0b74588c760b0013a5bd73b2d594b82134 100644 --- a/src/licDump.ml +++ b/src/licDump.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 23/10/2008 (at 15:12) by Erwan Jahier> *) +(** Time-stamp: <modified the 23/10/2008 (at 15:16) by Erwan Jahier> *) open Printf open Lxm @@ -72,7 +72,7 @@ let rec string_of_const_eff = ( | Bool_const_eff true -> "true" | Bool_const_eff false -> "false" | Int_const_eff i -> sprintf "%d" i - | Real_const_eff r -> sprintf "%f" r + | Real_const_eff r -> r | Extern_const_eff (s,t,vopt) -> (long s) ^ (string_of_const_eff_opt vopt) | Enum_const_eff (s,t) -> (long s) | Struct_const_eff (fl, t) -> ( diff --git a/src/predefEvalConst.ml b/src/predefEvalConst.ml index b0a7ce8b1dd3b11800345fbccb04de559f98b92e..928e969391fa28d9e5d554968eb1084e1124c57d 100644 --- a/src/predefEvalConst.ml +++ b/src/predefEvalConst.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 28/08/2008 (at 17:30) by Erwan Jahier> *) +(** Time-stamp: <modified the 23/10/2008 (at 15:48) by Erwan Jahier> *) open Predef open Eff @@ -10,6 +10,9 @@ type const_evaluator = Eff.const evaluator exception EvalConst_error of string +let eval_real_error () = + raise (EvalConst_error "reals cannot be evaluated, sorry.") + (* exported *) let (type_error_const : Eff.const list -> string -> 'a) = fun v expect -> @@ -33,8 +36,8 @@ let (ooo_evaluator:(int -> int -> int) -> (float -> float -> float) -> const_evaluator) = fun opi opr -> fun ll -> match List.flatten ll with | [Int_const_eff v0; Int_const_eff v1] -> [Int_const_eff (opi v0 v1)] - | [Real_const_eff v0; Real_const_eff v1] -> [Real_const_eff (opr v0 v1)] - (* XXX should we evaluate reals ??? *) + | [Real_const_eff v0; Real_const_eff v1] -> eval_real_error () + (* [Real_const_eff (opr v0 v1)] *) | _ -> assert false (* should not occur because eval_type is called before *) let (iii_evaluator:(int -> int -> int) -> const_evaluator) = @@ -49,7 +52,8 @@ let (aab_evaluator:('a -> 'a -> bool) -> const_evaluator) = let (fff_evaluator:(float -> float -> float) -> const_evaluator) = fun op -> fun ll -> match List.flatten ll with - | [Real_const_eff v0; Real_const_eff v1] -> [Real_const_eff (op v0 v1)] + | [Real_const_eff v0; Real_const_eff v1] -> eval_real_error () +(* [Real_const_eff (op v0 v1)] *) | _ -> assert false (* should not occur because eval_type is called before *) let (bb_evaluator:(bool -> bool) -> const_evaluator) = @@ -64,24 +68,17 @@ let (ii_evaluator:(int -> int) -> const_evaluator) = let (ff_evaluator:(float -> float) -> const_evaluator) = fun op -> fun ll -> match List.flatten ll with - | [Real_const_eff v0] -> [Real_const_eff (op v0)] + | [Real_const_eff v0] -> eval_real_error () (* [Real_const_eff (op v0)] *) | _ -> assert false (* should not occur because eval_type is called before *) let (oo_evaluator:(int -> int) -> (float -> float) -> const_evaluator) = fun opi opr -> fun ll -> match List.flatten ll with | [Int_const_eff v0] -> [Int_const_eff (opi v0)] - | [Real_const_eff v0] -> [Real_const_eff (opr v0)] - (* XXX should we evaluate reals ??? *) + | [Real_const_eff v0] -> eval_real_error () (* [Real_const_eff (opr v0)] *) | _ -> assert false (* should not occur because eval_type is called before *) let (sf_evaluator: Ident.t -> const_evaluator) = - fun id ceff_ll -> - try let v = float_of_string (Ident.to_string id) in - [Real_const_eff v] - with Failure "float_of_string" -> - raise (EvalConst_error( - Printf.sprintf "\n*** fail to convert the string \"%s\" into a float" - (Ident.to_string id))) + fun id ceff_ll -> [Real_const_eff (Ident.to_string id)] let (si_evaluator: Ident.t -> const_evaluator) = fun id ceff_ll -> @@ -96,12 +93,12 @@ let (sb_evaluator: bool -> const_evaluator) = fun v ceff_ll -> [Bool_const_eff v] -let (fi_evaluator:(float -> int) -> const_evaluator) = +let (fi_evaluator:(string -> int) -> const_evaluator) = fun op -> fun ll -> match List.flatten ll with - | [Real_const_eff v0] -> [Int_const_eff (op v0)] + | [Real_const_eff v0] -> [Int_const_eff (op v0)] | _ -> assert false (* should not occur because [eval_type] is called before *) -let (if_evaluator: (int -> float) -> const_evaluator) = +let (if_evaluator: (int -> string) -> const_evaluator) = fun op -> fun ll -> match List.flatten ll with | [Int_const_eff v0] -> [Real_const_eff (op v0)] | _ -> assert false (* should not occur because [eval_type] is called before *) @@ -134,8 +131,8 @@ let (f: op -> Lxm.t -> Eff.static_arg list -> const_evaluator) = | ICONST_n id -> si_evaluator id ll | RCONST_n id -> sf_evaluator id ll | NOT_n -> bb_evaluator (not) ll - | REAL2INT_n -> fi_evaluator int_of_float ll - | INT2REAL_n -> if_evaluator float_of_int ll + | REAL2INT_n -> fi_evaluator int_of_string ll + | INT2REAL_n -> if_evaluator string_of_int ll | AND_n -> bbb_evaluator (&&) ll | OR_n -> bbb_evaluator (||) ll | XOR_n -> bbb_evaluator (<>) ll diff --git a/src/test/should_fail/semantics/bug.lus b/src/test/should_fail/semantics/bug.lus index 53264d1ddc4f5c741ed36e1bbb2fc31015ea59d4..b5bbccd7a664a38e8d6875ef1c588746060f7557 100644 --- a/src/test/should_fail/semantics/bug.lus +++ b/src/test/should_fail/semantics/bug.lus @@ -87,7 +87,7 @@ let -- realO = 10.0 -> pre(realO) * realI; -- (intO, realO) = (10 -> pre(intO) * intI, 10.0 -> pre(realO) * realI); -- (intO, realO) = (10,10.0) -> (pre(intO) * intI, pre(realO) * realI); - (intO, realO) = (ze_const_int+x+y,10.0-10.0-10.0) -> (intI, pre(realO) * realI); + (intO, realO) = (ze_const_int+x+y,10.0 - 10.0 - 10.0) -> (intI, pre(realO) * realI); x = 0 -> if active then y else pre(x)+1; y = 1 -> if active then pre(y)+1 else x; diff --git a/src/test/should_fail/semantics/const3.lus b/src/test/should_fail/semantics/const3.lus new file mode 100644 index 0000000000000000000000000000000000000000..5aeffbe53aeffb7efed1d7d88f9bbcf3f7ec66b9 --- /dev/null +++ b/src/test/should_fail/semantics/const3.lus @@ -0,0 +1,2 @@ +const pi = 3.1416; +const right = pi/2.; diff --git a/src/test/should_fail/type/const2.lus b/src/test/should_fail/type/const2.lus index ba01eef27645737481cf9f71155b8b642516d40c..feb44c1faf228e1ccfcbd14857e6df20ff0de3b2 100644 --- a/src/test/should_fail/type/const2.lus +++ b/src/test/should_fail/type/const2.lus @@ -12,7 +12,7 @@ const c9=not false; c10=3; - e2 = 3+2.5; + e1 = if(2<>6.5) then true+1 else 2->4; diff --git a/src/test/should_work/NONREG/simple.lus b/src/test/should_work/NONREG/simple.lus index 65774fbfbae5a234054d556dd2734997a08d4854..9115f8d6455440c0148a15bfe6438fe3304d4274 100644 --- a/src/test/should_work/NONREG/simple.lus +++ b/src/test/should_work/NONREG/simple.lus @@ -8,7 +8,6 @@ type W = T^(size+2); const c = true; const size = 16; const pi = 3.1416; -const right = pi/2.; const u = #(true, false, true); extern function f1 (x: int) returns (y: int); diff --git a/src/test/should_work/Pascal/heater_control.lus b/src/test/should_work/Pascal/heater_control.lus index 6acf7fcf93d399198279d0fd4ef04a22c764d93c..02937bde1ed22c22e68586f9822d34dab7d6d566 100644 --- a/src/test/should_work/Pascal/heater_control.lus +++ b/src/test/should_work/Pascal/heater_control.lus @@ -14,7 +14,7 @@ -- o Otherwise, it keeps its previous state. -const FAILURE = - 999.0; -- a fake temperature given when all sensors are broken +const FAILURE = -999.0; -- a fake temperature given when all sensors are broken const TMIN = 6.0; const TMAX = 9.0; diff --git a/src/test/should_work/Pascal/onlyroll.lus b/src/test/should_work/Pascal/onlyroll.lus index 582c294f2e1bbdf3f5156e4b5ed53f83a000476c..d0a2a1618597d650d6afcfbf1840464cccb02684 100644 --- a/src/test/should_work/Pascal/onlyroll.lus +++ b/src/test/should_work/Pascal/onlyroll.lus @@ -25,20 +25,20 @@ const NRmaxR = 25.3 ; NRminR = -25.3 ; -- NominalRange for roll - NRmaxP = 5.1 ; - NRminP = - 5.1 ; -- NominalRange for pitch + NRmaxP = 5.1 ; + NRminP = -5.1 ; -- NominalRange for pitch - NRmaxY = 5.0 ; - NRminY = - 5.0 ; -- NominalRange for yaw + NRmaxY = 5.0 ; + NRminY = -5.0 ; -- NominalRange for yaw - HORmaxR = 285.0 ; - HORminR = - 285.0 ; -- Hard Over Range for roll + HORmaxR = 285.0 ; + HORminR = -285.0 ; -- Hard Over Range for roll - HORmaxP = 57.0 ; - HORminP = - 57.0 ; -- Hard Over Range for pitch + HORmaxP = 57.0 ; + HORminP = -57.0 ; -- Hard Over Range for pitch - HORmaxY = 57.0 ; - HORminY = - 57.0 ; -- Hard Over Range for yaw + HORmaxY = 57.0 ; + HORminY = -57.0 ; -- Hard Over Range for yaw TIME5 = 4 ; -- specified in point 5, page 4 (value ?) diff --git a/src/test/should_work/demo/lustre_test1_ok.lus b/src/test/should_work/demo/lustre_test1_ok.lus index 6271f58ca90a0080021a105c8c0e241619dd3fc9..0c2d029ed4afe98ec381491aefc3e6b68779326a 100644 --- a/src/test/should_work/demo/lustre_test1_ok.lus +++ b/src/test/should_work/demo/lustre_test1_ok.lus @@ -62,7 +62,7 @@ tel node TransFnc_1(E:real) returns(S:real); var Sm_1 :real; let - S = 1.0*E -0.5*Sm_1 ; + S = 1.0*E - 0.5*Sm_1 ; Sm_1 = 0.0->pre(S) ; tel diff --git a/src/test/should_work/fab_test/onlyroll.lus b/src/test/should_work/fab_test/onlyroll.lus index 4998a3302b2fe7e5cbad64c4ce5134870cd51525..8df4aeb3c906a5f192b41c862620f8b049d60bd5 100644 --- a/src/test/should_work/fab_test/onlyroll.lus +++ b/src/test/should_work/fab_test/onlyroll.lus @@ -25,20 +25,20 @@ const NRmaxR = 25.3 ; NRminR = -25.3 ; -- NominalRange for roll - NRmaxP = 5.1 ; - NRminP = - 5.1 ; -- NominalRange for pitch + NRmaxP = 5.1 ; + NRminP = -5.1 ; -- NominalRange for pitch - NRmaxY = 5.0 ; - NRminY = - 5.0 ; -- NominalRange for yaw + NRmaxY = 5.0 ; + NRminY = -5.0 ; -- NominalRange for yaw - HORmaxR = 285.0 ; - HORminR = - 285.0 ; -- Hard Over Range for roll + HORmaxR = 285.0 ; + HORminR = -285.0 ; -- Hard Over Range for roll - HORmaxP = 57.0 ; - HORminP = - 57.0 ; -- Hard Over Range for pitch + HORmaxP = 57.0 ; + HORminP = -57.0 ; -- Hard Over Range for pitch - HORmaxY = 57.0 ; - HORminY = - 57.0 ; -- Hard Over Range for yaw + HORmaxY = 57.0 ; + HORminY = -57.0 ; -- Hard Over Range for yaw TIME5 = 4 ; -- specified in point 5, page 4 (value ?) diff --git a/src/test/should_work/fab_test/onlyroll2.lus b/src/test/should_work/fab_test/onlyroll2.lus index cac7294a34e362e46cb0722035376dfb73cc65ad..a51ebfe1df2d74c32c201e95f636fefb6b211173 100644 --- a/src/test/should_work/fab_test/onlyroll2.lus +++ b/src/test/should_work/fab_test/onlyroll2.lus @@ -25,20 +25,20 @@ const NRmaxR = 25.3 ; NRminR = -25.3 ; -- NominalRange for roll - NRmaxP = 5.1 ; - NRminP = - 5.1 ; -- NominalRange for pitch + NRmaxP = 5.1 ; + NRminP = -5.1 ; -- NominalRange for pitch - NRmaxY = 5.0 ; - NRminY = - 5.0 ; -- NominalRange for yaw + NRmaxY = 5.0 ; + NRminY = -5.0 ; -- NominalRange for yaw - HORmaxR = 285.0 ; - HORminR = - 285.0 ; -- Hard Over Range for roll + HORmaxR = 285.0 ; + HORminR = -285.0 ; -- Hard Over Range for roll - HORmaxP = 57.0 ; - HORminP = - 57.0 ; -- Hard Over Range for pitch + HORmaxP = 57.0 ; + HORminP = -57.0 ; -- Hard Over Range for pitch - HORmaxY = 57.0 ; - HORminY = - 57.0 ; -- Hard Over Range for yaw + HORmaxY = 57.0 ; + HORminY = -57.0 ; -- Hard Over Range for yaw TIME5 = 4 ; -- specified in point 5, page 4 (value ?) diff --git a/src/test/test.res.exp b/src/test/test.res.exp index 79a4f7bae22bc26458ff31562a7ce5db1015b7b8..302f1ba7a5208511953587ff16a54863249b6e06 100644 --- a/src/test/test.res.exp +++ b/src/test/test.res.exp @@ -2501,9 +2501,9 @@ tel ====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/deconne.lus Opening file should_work/NONREG/deconne.lus type _deconne::pendule; -const deconne::G = 10.000000; -const deconne::L = 2.000000; -const deconne::T = 0.100000; +const deconne::G = 10.0; +const deconne::L = 2.0; +const deconne::T = 0.1; extern function deconne::make_pend( x0:real; @@ -2943,7 +2943,7 @@ type _hanane::t2; type _hanane::t3; type _hanane::tabStruct = _hanane::structT^2; const hanane::b = true; -const hanane::c = 3.140000; +const hanane::c = 3.14; node hanane::hanane( a1:bool; @@ -7344,9 +7344,8 @@ type _simple::U = struct {a : int; b : _simple::H}; type _simple::V = _simple::U^4; const simple::size = 16; type _simple::W = int^18; -const simple::pi = 3.141600; -const simple::right = 1.570800; const simple::u = false; +const simple::pi = 3.1416; const simple::c = true; node simple::simple(e:bool; a:_simple::U) returns (b:int); var @@ -7999,10 +7998,10 @@ tel ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --compile-all-items should_work/Pascal/heater_control.lus Opening file should_work/Pascal/heater_control.lus -const heater_control::FAILURE = -999.000000; -const heater_control::TMIN = 6.000000; -const heater_control::TMAX = 9.000000; -const heater_control::DELTA = 0.500000; +const heater_control::FAILURE = -999.0; +const heater_control::TMIN = 6.0; +const heater_control::TMAX = 9.0; +const heater_control::DELTA = 0.5; node heater_control::not_a_sauna2( T:real; @@ -8331,34 +8330,34 @@ const inter::n = -4; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --compile-all-items should_work/Pascal/onlyroll.lus Opening file should_work/Pascal/onlyroll.lus -const onlyroll::NRminP = -5.100000; -const onlyroll::NRminR = -25.300000; -const onlyroll::NRmaxP = 5.100000; -const onlyroll::DELTA_PITCH = 3.000000; -const onlyroll::NRmaxR = 25.300000; -const onlyroll::FAIL_SAFE_PITCH_VALUE = 4.000000; -const onlyroll::DELTA_YAW = 2.730000; -const onlyroll::NRminY = -5.000000; -const onlyroll::HORminP = -57.000000; -const onlyroll::XFAIL_SAFE_ROLL_VALUE = 1.100000; -const onlyroll::NRmaxY = 5.000000; -const onlyroll::HORminR = -285.000000; -const onlyroll::HORmaxP = 57.000000; -const onlyroll::CROSS_CH_TOL_PITCH = 10.100000; -const onlyroll::HORmaxR = 285.000000; -const onlyroll::FAIL_SAFE_YAW_VALUE = 4.000000; -const onlyroll::HORminY = -57.000000; -const onlyroll::DELTA_ROLL = 14.900000; -const onlyroll::FAIL_SAFE_ROLL_VALUE = 1.000000; +const onlyroll::NRminP = -5.1; +const onlyroll::NRminR = -25.3; +const onlyroll::NRmaxP = 5.1; +const onlyroll::DELTA_PITCH = 3.0; +const onlyroll::NRmaxR = 25.3; +const onlyroll::FAIL_SAFE_PITCH_VALUE = 4.0; +const onlyroll::DELTA_YAW = 2.73; +const onlyroll::NRminY = -5.0; +const onlyroll::HORminP = -57.0; +const onlyroll::XFAIL_SAFE_ROLL_VALUE = 1.1; +const onlyroll::NRmaxY = 5.0; +const onlyroll::HORminR = -285.0; +const onlyroll::HORmaxP = 57.0; +const onlyroll::CROSS_CH_TOL_PITCH = 10.1; +const onlyroll::HORmaxR = 285.0; +const onlyroll::FAIL_SAFE_YAW_VALUE = 4.0; +const onlyroll::HORminY = -57.0; +const onlyroll::DELTA_ROLL = 14.9; +const onlyroll::FAIL_SAFE_ROLL_VALUE = 1.0; const onlyroll::OneSecond = 10; -const onlyroll::HORmaxY = 57.000000; +const onlyroll::HORmaxY = 57.0; const onlyroll::TIME_ROLL = 3; -const onlyroll::CROSS_CH_TOL_ROLL = 51.000000; -const onlyroll::BID_LAST = 2.200000; +const onlyroll::CROSS_CH_TOL_ROLL = 51.0; +const onlyroll::BID_LAST = 2.2; const onlyroll::TIME5 = 4; const onlyroll::SAFE_COUNTER_TIME = 3; -const onlyroll::BID_VAL = 3.300000; -const onlyroll::CROSS_CH_TOL_YAW = 10.000000; +const onlyroll::BID_VAL = 3.3; +const onlyroll::CROSS_CH_TOL_YAW = 10.0; const onlyroll::TIME_CROSS_ROLL = 3; node onlyroll::noneof( @@ -9586,7 +9585,7 @@ Opening file should_work/Pascal/pfs.lus ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --compile-all-items should_work/Pascal/struct.lus Opening file should_work/Pascal/struct.lus -type _struct::complex = struct {re : real = 0.000000; im : real = 0.000000}; +type _struct::complex = struct {re : real = 0.; im : real = 0.}; node struct::plus( a:_struct::complex; @@ -10147,16 +10146,16 @@ type _Gyroscope2::CFF_Eltstruct = struct {indx : int; indx_toChange : int; valu type _Gyroscope2::Faulty_ChannelT = struct {valuea : real; valueb : real}; type _Gyroscope2::Faulty_Array = A__Gyroscope2::Faulty_ChannelT_4^3; type _Gyroscope2::CFF_struct = struct {indx : int; indx_toChange : int; tabToFill : A__Gyroscope2::Valid_ChannelT_3}; -const Gyroscope2::DELTA_PITCH = 2.000000; -const Gyroscope2::DELTA_YAW = 2.000000; -const Gyroscope2::DELTA_TO_GOD_YAW = 2.000000; -const Gyroscope2::DELTA_ROLL = 2.000000; -const Gyroscope2::CROSS_CHANNEL_TOLERANCE = 1.000000; -const Gyroscope2::GOD_PITCH = 16.000000; -const Gyroscope2::GOD_ROLL = 15.000000; -const Gyroscope2::GOD_YAW = 14.000000; -const Gyroscope2::DELTA_TO_GOD_ROLL = 2.000000; -const Gyroscope2::DELTA_TO_GOD_PITCH = 2.000000; +const Gyroscope2::DELTA_PITCH = 2.0; +const Gyroscope2::DELTA_YAW = 2.0; +const Gyroscope2::DELTA_TO_GOD_YAW = 2.0; +const Gyroscope2::DELTA_ROLL = 2.0; +const Gyroscope2::CROSS_CHANNEL_TOLERANCE = 1.0; +const Gyroscope2::GOD_PITCH = 16.0; +const Gyroscope2::GOD_ROLL = 15.0; +const Gyroscope2::GOD_YAW = 14.0; +const Gyroscope2::DELTA_TO_GOD_ROLL = 2.0; +const Gyroscope2::DELTA_TO_GOD_PITCH = 2.0; node Gyroscope2::abs(in:real) returns (out:real); var _v1:bool; @@ -10892,7 +10891,7 @@ type _decl::t5 = A__decl::t1_8^5; type _decl::coord = struct {x : real; y : real}; type _decl::coord_tab = _decl::coord^1; type _decl::couleur = enum {decl::bleu, decl::blanc, decl::rouge}; -const decl::e = 8.500000; +const decl::e = 8.5; const decl::a:int; const decl::b:int; const decl::c:int; @@ -10937,7 +10936,7 @@ type _declaration::t5 = A__declaration::t1_8^5; type _declaration::coord = struct {x : real; y : real}; type _declaration::coord_tab = _declaration::coord^1; type _declaration::couleur = enum {declaration::bleu, declaration::blanc, declaration::rouge}; -const declaration::e = 8.500000; +const declaration::e = 8.5; const declaration::a:int; const declaration::b:int; const declaration::c:int; @@ -11004,7 +11003,7 @@ type _def::t3; type _def::tabStruct = _def::structT^2; const def::id_int = 5; const def::b = true; -const def::c = 3.140000; +const def::c = 3.14; node def::def( a1:bool; @@ -11792,6 +11791,11 @@ tel -- end of node sample_time_change::MainNode +---------------------------------------------------------------------- +====> ../lus2lic -vl 2 --compile-all-items should_work/fab_test/.#onlyroll2.lus +Opening file should_work/fab_test/.#onlyroll2.lus +should_work/fab_test/.#onlyroll2.lus: No such file or directory + ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --compile-all-items should_work/fab_test/bob.lus Opening file should_work/fab_test/bob.lus @@ -12826,34 +12830,34 @@ tel ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --compile-all-items should_work/fab_test/onlyroll.lus Opening file should_work/fab_test/onlyroll.lus -const onlyroll::NRminP = -5.100000; -const onlyroll::NRminR = -25.300000; -const onlyroll::NRmaxP = 5.100000; -const onlyroll::DELTA_PITCH = 3.000000; -const onlyroll::NRmaxR = 25.300000; -const onlyroll::FAIL_SAFE_PITCH_VALUE = 4.000000; -const onlyroll::DELTA_YAW = 2.730000; -const onlyroll::NRminY = -5.000000; -const onlyroll::HORminP = -57.000000; -const onlyroll::XFAIL_SAFE_ROLL_VALUE = 1.100000; -const onlyroll::NRmaxY = 5.000000; -const onlyroll::HORminR = -285.000000; -const onlyroll::HORmaxP = 57.000000; -const onlyroll::CROSS_CH_TOL_PITCH = 10.100000; -const onlyroll::HORmaxR = 285.000000; -const onlyroll::FAIL_SAFE_YAW_VALUE = 4.000000; -const onlyroll::HORminY = -57.000000; -const onlyroll::DELTA_ROLL = 14.900000; -const onlyroll::FAIL_SAFE_ROLL_VALUE = 1.000000; +const onlyroll::NRminP = -5.1; +const onlyroll::NRminR = -25.3; +const onlyroll::NRmaxP = 5.1; +const onlyroll::DELTA_PITCH = 3.0; +const onlyroll::NRmaxR = 25.3; +const onlyroll::FAIL_SAFE_PITCH_VALUE = 4.0; +const onlyroll::DELTA_YAW = 2.73; +const onlyroll::NRminY = -5.0; +const onlyroll::HORminP = -57.0; +const onlyroll::XFAIL_SAFE_ROLL_VALUE = 1.1; +const onlyroll::NRmaxY = 5.0; +const onlyroll::HORminR = -285.0; +const onlyroll::HORmaxP = 57.0; +const onlyroll::CROSS_CH_TOL_PITCH = 10.1; +const onlyroll::HORmaxR = 285.0; +const onlyroll::FAIL_SAFE_YAW_VALUE = 4.0; +const onlyroll::HORminY = -57.0; +const onlyroll::DELTA_ROLL = 14.9; +const onlyroll::FAIL_SAFE_ROLL_VALUE = 1.0; const onlyroll::OneSecond = 10; -const onlyroll::HORmaxY = 57.000000; +const onlyroll::HORmaxY = 57.0; const onlyroll::TIME_ROLL = 3; -const onlyroll::CROSS_CH_TOL_ROLL = 51.000000; -const onlyroll::BID_LAST = 2.200000; +const onlyroll::CROSS_CH_TOL_ROLL = 51.0; +const onlyroll::BID_LAST = 2.2; const onlyroll::TIME5 = 4; const onlyroll::SAFE_COUNTER_TIME = 3; -const onlyroll::BID_VAL = 3.300000; -const onlyroll::CROSS_CH_TOL_YAW = 10.000000; +const onlyroll::BID_VAL = 3.3; +const onlyroll::CROSS_CH_TOL_YAW = 10.0; const onlyroll::TIME_CROSS_ROLL = 3; node onlyroll::noneof( @@ -13941,34 +13945,34 @@ tel ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --compile-all-items should_work/fab_test/onlyroll2.lus Opening file should_work/fab_test/onlyroll2.lus -const onlyroll2::NRminP = -5.100000; -const onlyroll2::NRminR = -25.300000; -const onlyroll2::NRmaxP = 5.100000; -const onlyroll2::DELTA_PITCH = 3.000000; -const onlyroll2::NRmaxR = 25.300000; -const onlyroll2::FAIL_SAFE_PITCH_VALUE = 4.000000; -const onlyroll2::DELTA_YAW = 2.730000; -const onlyroll2::NRminY = -5.000000; -const onlyroll2::HORminP = -57.000000; -const onlyroll2::XFAIL_SAFE_ROLL_VALUE = 1.100000; -const onlyroll2::NRmaxY = 5.000000; -const onlyroll2::HORminR = -285.000000; -const onlyroll2::HORmaxP = 57.000000; -const onlyroll2::CROSS_CH_TOL_PITCH = 10.100000; -const onlyroll2::HORmaxR = 285.000000; -const onlyroll2::FAIL_SAFE_YAW_VALUE = 4.000000; -const onlyroll2::HORminY = -57.000000; -const onlyroll2::DELTA_ROLL = 14.900000; -const onlyroll2::FAIL_SAFE_ROLL_VALUE = 1.000000; +const onlyroll2::NRminP = -5.1; +const onlyroll2::NRminR = -25.3; +const onlyroll2::NRmaxP = 5.1; +const onlyroll2::DELTA_PITCH = 3.0; +const onlyroll2::NRmaxR = 25.3; +const onlyroll2::FAIL_SAFE_PITCH_VALUE = 4.0; +const onlyroll2::DELTA_YAW = 2.73; +const onlyroll2::NRminY = -5.0; +const onlyroll2::HORminP = -57.0; +const onlyroll2::XFAIL_SAFE_ROLL_VALUE = 1.1; +const onlyroll2::NRmaxY = 5.0; +const onlyroll2::HORminR = -285.0; +const onlyroll2::HORmaxP = 57.0; +const onlyroll2::CROSS_CH_TOL_PITCH = 10.1; +const onlyroll2::HORmaxR = 285.0; +const onlyroll2::FAIL_SAFE_YAW_VALUE = 4.0; +const onlyroll2::HORminY = -57.0; +const onlyroll2::DELTA_ROLL = 14.9; +const onlyroll2::FAIL_SAFE_ROLL_VALUE = 1.0; const onlyroll2::OneSecond = 10; -const onlyroll2::HORmaxY = 57.000000; +const onlyroll2::HORmaxY = 57.0; const onlyroll2::TIME_ROLL = 3; -const onlyroll2::CROSS_CH_TOL_ROLL = 51.000000; -const onlyroll2::BID_LAST = 2.200000; +const onlyroll2::CROSS_CH_TOL_ROLL = 51.0; +const onlyroll2::BID_LAST = 2.2; const onlyroll2::TIME5 = 4; const onlyroll2::SAFE_COUNTER_TIME = 3; -const onlyroll2::BID_VAL = 3.300000; -const onlyroll2::CROSS_CH_TOL_YAW = 10.000000; +const onlyroll2::BID_VAL = 3.3; +const onlyroll2::CROSS_CH_TOL_YAW = 10.0; const onlyroll2::TIME_CROSS_ROLL = 3; node onlyroll2::noneof( @@ -15323,16 +15327,16 @@ Opening file should_work/lionel/Gyroscope.lus type _Gyroscope::Faulty_ChannelT = struct {valuea : real; valueb : real}; type _Gyroscope::Faulty_Array = A__Gyroscope::Faulty_ChannelT_4^3; type _Gyroscope::Valid_ChannelT = struct {local_failure : bool; local_value : real}; -const Gyroscope::DELTA_PITCH = 2.000000; -const Gyroscope::DELTA_YAW = 2.000000; -const Gyroscope::DELTA_TO_GOD_YAW = 2.000000; -const Gyroscope::DELTA_ROLL = 2.000000; -const Gyroscope::GOD_PITCH = 16.000000; -const Gyroscope::GOD_ROLL = 15.000000; -const Gyroscope::GOD_YAW = 14.000000; -const Gyroscope::DELTA_TO_GOD_ROLL = 2.000000; +const Gyroscope::DELTA_PITCH = 2.0; +const Gyroscope::DELTA_YAW = 2.0; +const Gyroscope::DELTA_TO_GOD_YAW = 2.0; +const Gyroscope::DELTA_ROLL = 2.0; +const Gyroscope::GOD_PITCH = 16.0; +const Gyroscope::GOD_ROLL = 15.0; +const Gyroscope::GOD_YAW = 14.0; +const Gyroscope::DELTA_TO_GOD_ROLL = 2.0; const Gyroscope::TIME = 3; -const Gyroscope::DELTA_TO_GOD_PITCH = 2.000000; +const Gyroscope::DELTA_TO_GOD_PITCH = 2.0; node Gyroscope::abs(in:real) returns (out:real); var _v1:bool; @@ -17757,7 +17761,7 @@ tel ====> ../lus2lic -vl 2 --compile-all-items should_work/packEnvTest/complex.lus Opening file should_work/packEnvTest/complex.lus type _complex::t = struct {re : real; im : real}; -const complex::i = _complex::t{re = 0.000000; im = 1.000000}; +const complex::i = _complex::t{re = 0.; im = 1.}; function complex::re(c:_complex::t) returns (re:real); let re = c.re; @@ -18367,7 +18371,7 @@ let _v1 = pre in; tel -- end of node Pbool::n -const main::pi = 3.141590; +const main::pi = 3.14159; node main::main( i:int; @@ -18547,9 +18551,9 @@ type A_int_3 = int^3; ====> ../lus2lic -vl 2 --compile-all-items should_work/to_sort_out/asservi.lus Opening file should_work/to_sort_out/asservi.lus type _asservi::pendule; -const asservi::G = 10.000000; -const asservi::L = 2.000000; -const asservi::T = 0.100000; +const asservi::G = 10.0; +const asservi::L = 2.0; +const asservi::T = 0.1; node asservi::D(x:real) returns (d:real); var _v1:real; @@ -19048,6 +19052,15 @@ Opening file should_fail/semantics/const2.lus *** syntax error +---------------------------------------------------------------------- +====> ../lus2lic -vl 2 --compile-all-items should_fail/semantics/const3.lus +Opening file should_fail/semantics/const3.lus +*** Error in file "should_fail/semantics/const3.lus", line 2, col 17 to 17, token '/': +*** +*** can't eval constant: reals cannot be evaluated, sorry. + +const const3::pi = 3.1416; + ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --compile-all-items should_fail/semantics/cpt_dc.lus Opening file should_fail/semantics/cpt_dc.lus