diff --git a/src/TODO b/src/TODO index e67d0f290b259d0af84696245021916e510b61d7..f7a74e2f0f92898f3f2bc5141abda51d8b841166 100644 --- a/src/TODO +++ b/src/TODO @@ -186,6 +186,8 @@ les operateurs polymorphes au sens fort sont : fby, ->, current, pre, ite En effet, on ne peut pas ecrire (1,2) > (3,4) (enfin pour l'instant, mais est-ce souhaitable ?) +* Dans Eff.const, le variant Int_const_eff devrait etre parametre par +un string, pas par un entier * une idée rigolote me vient : faire du byte-profiling sur les tests de non-regression, et faire un grep de "(* 0 *)" pour voir s'il y a diff --git a/src/eff.ml b/src/eff.ml index 5f302450e2ce0fe0c746507f7b5b9f322587cbad..b42e535369ddb74260a6cfc1d8a4212b784d2933 100644 --- a/src/eff.ml +++ b/src/eff.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 20/11/2008 (at 15:25) by Erwan Jahier> *) +(** Time-stamp: <modified the 25/11/2008 (at 14:07) by Erwan Jahier> *) (** @@ -189,7 +189,7 @@ and by_pos_op = | CONCAT | HAT of int * val_exp - | ARRAY + | ARRAY of val_exp list | STRUCT_ACCESS of Ident.t (* those are different from [by_pos_op] *) @@ -212,7 +212,7 @@ and by_pos_op = and const = (* type predef *) Bool_const_eff of bool - | Int_const_eff of int + | Int_const_eff of int (* XXX should be a string ! *) | Real_const_eff of string (* type atomique non predef : on précise le type *) | Extern_const_eff of (Ident.long * type_ * const option) @@ -220,7 +220,7 @@ and const = (* type_ structure : liste (champ,valeur) + type_ structure *) | Struct_const_eff of ((Ident.t * const) list * type_) (* type_ tableau : liste des valeurs + type_ des elts + taille *) - | Array_const_eff of (const array * type_) + | Array_const_eff of (const list * type_) (*--------------------------------------------------------------------- Type: val ----------------------------------------------------------------------- @@ -459,7 +459,42 @@ let (type_of_const: const -> type_) = | Extern_const_eff (s, teff, vopt) -> teff | Enum_const_eff (s, teff) -> teff | Struct_const_eff (fl, teff) -> teff - | Array_const_eff (ct, teff) -> Array_type_eff (teff, Array.length ct) + | Array_const_eff (ct, teff) -> Array_type_eff (teff, List.length ct) + +let rec (const_to_val_eff: Lxm.t -> const -> val_exp) = + fun lxm const -> + let mk_by_pos_op by_pos_op_eff = + CallByPosEff(flagit by_pos_op_eff lxm, OperEff []) + in + let id_of_int i = Ident.of_string (string_of_int i) in + match const with + | Bool_const_eff b -> + mk_by_pos_op (Predef((if b then Predef.TRUE_n else Predef.FALSE_n), [])) + | Int_const_eff i -> + mk_by_pos_op (Predef((Predef.ICONST_n (id_of_int i)),[])) + | Real_const_eff r -> + mk_by_pos_op (Predef((Predef.RCONST_n (Ident.of_string r)),[])) + | Enum_const_eff (s, _) + | Extern_const_eff (s, _, None) -> mk_by_pos_op (IDENT (Ident.idref_of_long s)) + | Extern_const_eff (s, _, Some c) -> const_to_val_eff lxm c + | Array_const_eff (ct, _) -> + mk_by_pos_op (ARRAY (List.map (const_to_val_eff lxm) ct)) + + | Struct_const_eff (fl, stype) -> + let sname = match stype with + | Struct_type_eff(sname, _) -> sname + | _ -> assert false + in + let pack = Ident.pack_of_long sname in + let name_op_flg = flagit (STRUCT(pack, Ident.idref_of_long sname)) lxm in + (CallByNameEff( + name_op_flg, + List.map + (fun (id,const) -> flagit id lxm ,const_to_val_eff lxm const) + fl + )) + + let (type_of_left: left -> type_) = diff --git a/src/evalClock.ml b/src/evalClock.ml index fdbbb18da5eb17d1aeea21b11d1d118473492d90..199768df532a6434e2e8c9c146a538c7c68159b8 100644 --- a/src/evalClock.ml +++ b/src/evalClock.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 20/11/2008 (at 12:06) by Erwan Jahier> *) +(** Time-stamp: <modified the 25/11/2008 (at 14:40) by Erwan Jahier> *) open Predef @@ -253,15 +253,15 @@ and (f_list : Eff.id_solver -> subst -> Eff.val_exp list -> Eff.id_clock list li and (eval_by_pos_clock : Eff.id_solver -> Eff.by_pos_op -> Lxm.t -> Eff.val_exp list -> subst -> Eff.id_clock list * subst) = fun id_solver posop lxm args s -> - match posop with - | Eff.CURRENT -> ( (* we return the clock of the argument *) + match posop,args with + | Eff.CURRENT,args -> ( (* we return the clock of the argument *) let clocks_of_args, s = f_list id_solver s args in match List.flatten clocks_of_args with | [id, BaseEff] -> [id, BaseEff],s | [id, On(_,clk)] -> [id, clk],s | _ -> assert false ) - | Eff.WHEN clk_exp -> ( + | Eff.WHEN clk_exp,args -> ( let c_clk, when_exp_clk = match clk_exp with | Base -> BaseEff, BaseEff @@ -325,20 +325,20 @@ and (eval_by_pos_clock : Eff.id_solver -> Eff.by_pos_op -> Lxm.t -> Eff.val_exp ) ) - | Eff.MERGE _ -> assert false (* TODO *) + | Eff.MERGE _,args -> assert false (* TODO *) (* f_aux id_solver (List.hd args) *) - | Eff.HAT(i,ve) -> f_aux id_solver s ve + | Eff.HAT(i,ve),args -> f_aux id_solver s ve (* nb: the args have been put inside the HAT_eff constructor *) - | Eff.CONST (idref,_) -> [Ident.of_idref idref, get_constant_clock ()],s - | Eff.IDENT idref -> ( + | Eff.CONST (idref,_),args -> [Ident.of_idref idref, get_constant_clock ()],s + | Eff.IDENT idref,args -> ( try ([var_info_eff_to_clock_eff (id_solver.id2var idref lxm)], s) with _ -> (* => it is a constant *) [Ident.of_idref idref, get_constant_clock ()], s ) - | Eff.CALL node_exp_eff -> + | Eff.CALL node_exp_eff,args -> let (cil_arg, cil_res) = get_clock_profile node_exp_eff.it in let rel_base = ClockVar (UnifyClock.get_var_type ()) in (* the value of the base clock of a node is actually relative @@ -366,16 +366,15 @@ and (eval_by_pos_clock : Eff.id_solver -> Eff.by_pos_op -> Lxm.t -> Eff.val_exp List.map (apply_subst s) cil_res, s (* One argument. *) - | Eff.PRE - | Eff.STRUCT_ACCESS _ - | Eff.ARRAY_ACCES (_, _) - | Eff.ARRAY_SLICE (_,_) -> + | Eff.PRE,args + | Eff.STRUCT_ACCESS _,args + | Eff.ARRAY_ACCES (_, _),args + | Eff.ARRAY_SLICE (_,_),args -> assert(List.length args = 1); f_aux id_solver s (List.hd args) - | Eff.Predef (op,sargs) -> + | Eff.Predef (op,sargs),args -> let clk_args, s = f_list id_solver s args in - let flat_clk_args = List.flatten clk_args in (* => mono-clock! *) let clk_list, s = if args = [] then [],s else @@ -385,11 +384,11 @@ and (eval_by_pos_clock : Eff.id_solver -> Eff.by_pos_op -> Lxm.t -> Eff.val_exp PredefEvalClock.f op lxm sargs clk_list, s (* may have tuples as arguments *) - | Eff.TUPLE - | Eff.ARROW - | Eff.FBY - | Eff.CONCAT - | Eff.ARRAY -> ( + | Eff.TUPLE,args + | Eff.ARROW,args + | Eff.FBY ,args + | Eff.CONCAT,args + | Eff.ARRAY(args),_ -> ( (* Check that all args are of the same (unifiable) clocks. XXX : we suppose that all those operators are @@ -406,7 +405,7 @@ and (eval_by_pos_clock : Eff.id_solver -> Eff.by_pos_op -> Lxm.t -> Eff.val_exp in clk_list, s ) - | Eff.WITH(ve) -> f_aux id_solver s ve + | Eff.WITH(ve),args -> f_aux id_solver s ve diff --git a/src/evalConst.ml b/src/evalConst.ml index 3b7906899a5391abaa77eb2a1a4b130f985c1513..d45b9979b8afd446e571edf2f491e369e3a588ee 100644 --- a/src/evalConst.ml +++ b/src/evalConst.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 15/09/2008 (at 17:14) by Erwan Jahier> *) +(** Time-stamp: <modified the 25/11/2008 (at 14:38) by Erwan Jahier> *) open Printf @@ -39,18 +39,33 @@ venir de eva et donc N.B. Puisque correct, last_ix est inutile, mais bon ... -----------------------------------------------------*) +let rec fill init size = if size = 0 then [] else init::(fill init (size-1)) +let _ = assert (fill 0 5 = [0;0;0;0;0]) + let (make_slice_const : - Eff.const array -> Eff.type_ -> Eff.slice_info -> Eff.const list) = - fun ctab ctype slice -> - let get_res (ix : int) = Array.get ctab (slice.se_first + ix*slice.se_step) in - [Array_const_eff (Array.init slice.se_width get_res, ctype)] + Eff.const list -> Eff.type_ -> Eff.slice_info -> Eff.const list) = + fun clist ctype slice -> + let sliced_clist,_,_ = + List.fold_left + (fun (acc, i, j) elt -> + if i = slice.se_first + j*slice.se_step then + (elt::acc, i+1, j+1) + else + (acc, i+1, j) + ) + ([], 0, 0) + clist + in + let sliced_clist = List.rev sliced_clist in + [Array_const_eff(sliced_clist, ctype)] (** Utilitaire : fabriquer si possible une constante tableau *) -let (make_array_const : Eff.const list array -> Eff.const) = +let (make_array_const : Eff.const list list -> Eff.const) = fun ops -> let expected_type = ref None in - let treat_arg (op : Eff.const list) = + let treat_arg : Eff.const list -> Eff.const = + fun op -> match op with | [x] -> ( (* non tuple *) @@ -69,7 +84,7 @@ let (make_array_const : Eff.const list array -> Eff.const) = | _ -> (* tuple *) raise (EvalConst_error("array of tuple not allowed")) in - let res = Array.map treat_arg ops in + let res = List.map treat_arg ops in match (!expected_type) with | None -> raise (EvalConst_error("empty array")) | Some t -> Array_const_eff(res, t) @@ -219,8 +234,8 @@ let rec f let sz = eval_array_size env szexp in match rec_eval_const cexp with | [cst] -> - let atab = Array.make sz cst in - [ Array_const_eff (atab, Eff.type_of_const cst) ] + let l = fill cst sz in + [ Array_const_eff (l, Eff.type_of_const cst) ] | x -> raise (EvalConst_error("array of tuple not allowed")) with @@ -236,7 +251,7 @@ let rec f | [[Array_const_eff (v0, t0)]; [Array_const_eff (v1, t1)]] -> ( if(t0 = t1) then - [Array_const_eff (Array.append v0 v1, t0)] + [Array_const_eff (List.append v0 v1, t0)] else raise(EvalConst_error( sprintf @@ -254,16 +269,16 @@ let rec f ) | ARRAY_n -> ( let ops = (List.map rec_eval_const args) in - [make_array_const (Array.of_list ops)] + [make_array_const (ops)] ) | ARRAY_ACCES_n ix -> ( let effargs = List.flatten (List.map rec_eval_const args) in match effargs with | [Array_const_eff (elts, typelts)] -> ( try - let sz = Array.length elts in + let sz = List.length elts in let effix = eval_array_index env ix sz lxm in - [Array.get elts effix ] + [List.nth elts effix] with EvalArray_error msg -> raise(EvalConst_error msg) ) | _ -> type_error_const effargs "some array" @@ -275,7 +290,7 @@ let rec f | x -> type_error_const x "some array" in (* on en déduit la taille du tableau *) - let sz = Array.length elts in + let sz = List.length elts in (* évalue la slice *) try let sliceff = eval_array_slice env sl sz lxm in diff --git a/src/evalType.ml b/src/evalType.ml index 0e225901cbc5d832091f5e1e56d2c767b4605319..ff67f94add90cd566228e1d3ec0b903850ff8e06 100644 --- a/src/evalType.ml +++ b/src/evalType.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 20/11/2008 (at 13:45) by Erwan Jahier> *) +(** Time-stamp: <modified the 25/11/2008 (at 09:38) by Erwan Jahier> *) open Predef @@ -152,7 +152,7 @@ and (eval_by_pos_type : let teff_list = f id_solver ceff in List.map (fun teff -> Array_type_eff(teff, size)) teff_list - | Eff.ARRAY -> + | Eff.ARRAY(args) -> (* check that args are of the same type *) let type_args_eff = (List.map (f id_solver) args) in let teff_elt = diff --git a/src/getEff.ml b/src/getEff.ml index 9b89217addcd026edc5f777a04904b13fe7606d5..4d2cfacc0197fb347dabf7993189102e5bef2ff8 100644 --- a/src/getEff.ml +++ b/src/getEff.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 31/10/2008 (at 17:05) by Erwan Jahier> *) +(** Time-stamp: <modified the 25/11/2008 (at 14:42) by Erwan Jahier> *) open Lxm @@ -103,8 +103,8 @@ let rec (node : Eff.id_solver -> SyntaxTreeCore.node_exp srcflagged -> and sa_l = List.length static_args in if (sp_l <> sa_l) then let msg = "Bad number of (static) arguments: " ^ - (string_of_int sp_l) ^ " expected, and " ^ - (string_of_int sa_l) ^ " provided." + (string_of_int sp_l) ^ " expected, and " ^ + (string_of_int sa_l) ^ " provided." in raise (Compile_error(lxm, msg)) else @@ -139,7 +139,7 @@ and (check_static_arg : Eff.id_solver -> | Array_type_eff(teff_ext,i),Array_type_exp(texp,j) -> i=(EvalConst.eval_array_size node_id_solver j) - & (eff_type_and_type_exp_are_equal teff texp.it) + & (eff_type_and_type_exp_are_equal teff texp.it) | Any,_ -> assert false (* for TTB, polymorphism is not supported *) | Overload, _ -> assert false (* ditto *) @@ -165,15 +165,15 @@ and (check_static_arg : Eff.id_solver -> in let check_node_arg neff vii vio = let str = "Bad (static) node argument: " in - if (List.length neff.inlist_eff) <> (List.length vii) then - raise (Compile_error(sa.src, str ^ "arity error (inputs).")) - else if (List.length neff.outlist_eff) <> (List.length vio) then - raise (Compile_error(sa.src, str ^ "arity error (outputs).")) - else if not (type_check_var_info_list neff.inlist_eff vii) then - raise (Compile_error(sa.src, str ^ "wrong input type profile.")) - else if not (type_check_var_info_list neff.outlist_eff vio) then - raise (Compile_error(sa.src, str ^ "wrong output type profile.")) - else () + if (List.length neff.inlist_eff) <> (List.length vii) then + raise (Compile_error(sa.src, str ^ "arity error (inputs).")) + else if (List.length neff.outlist_eff) <> (List.length vio) then + raise (Compile_error(sa.src, str ^ "arity error (outputs).")) + else if not (type_check_var_info_list neff.inlist_eff vii) then + raise (Compile_error(sa.src, str ^ "wrong input type profile.")) + else if not (type_check_var_info_list neff.outlist_eff vio) then + raise (Compile_error(sa.src, str ^ "wrong output type profile.")) + else () in let sa_eff = @@ -309,11 +309,140 @@ and (translate_val_exp : Eff.id_solver -> SyntaxTreeCore.val_exp -> Eff.val_exp) List.map (translate_field id_solver) field_list)) | CallByPos(by_pos_op, Oper vel) -> - let vel_eff = List.map (translate_val_exp id_solver) vel in - let by_pos_op_eff = translate_by_pos_op id_solver by_pos_op vel in - CallByPosEff(flagit by_pos_op_eff by_pos_op.src, OperEff vel_eff) - - + let vel_eff = OperEff (List.map (translate_val_exp id_solver) vel) in + let lxm = by_pos_op.src in + let by_pos_op = by_pos_op.it in + let mk_by_pos_op by_pos_op_eff = + CallByPosEff(flagit by_pos_op_eff lxm, vel_eff) + in + match by_pos_op with + (* put that in another module ? yes, see above.*) + | Predef_n(Map, _) + | Predef_n(Fill, _) + | Predef_n(Red, _) + | Predef_n(FillRed, _) + | Predef_n(BoolRed, _) -> + mk_by_pos_op (translate_iteror id_solver by_pos_op lxm) + + (* other predef operators *) + | Predef_n(op, args) -> assert (args=[]); mk_by_pos_op(Predef (op,[])) + + | CALL_n node_exp_f -> + mk_by_pos_op(Eff.CALL (flagit (node id_solver node_exp_f) + node_exp_f.src)) + + | IDENT_n idref -> ( + try Eff.const_to_val_eff lxm (id_solver.id2const idref lxm) + with _ -> (* It migth not be a static constant... *) + match Ident.pack_of_idref idref with + | Some pn -> mk_by_pos_op(Eff.IDENT idref) + (* Constant with a pack name are treated as + IDENT_eff. Indeed, I do not see any means to + know if an idref denotes a constant or not, since + the SymbolTab tables are indexed by + Ident.t... Anyway, CONST_eff was introduced + precisely to handle idref constants with no pack + name, so handling idref with a pack name as + before should be ok (albeit being quite + inelegant). *) + | None -> + try + let id = Ident.of_idref idref in + let pn = + SymbolTab.find_pack_of_const id_solver.symbols id lxm + in + mk_by_pos_op(Eff.CONST (idref, pn)) + with _ -> + mk_by_pos_op(Eff.IDENT idref) + ) + | CURRENT_n -> mk_by_pos_op Eff.CURRENT + | PRE_n -> mk_by_pos_op Eff.PRE + + | ARROW_n -> mk_by_pos_op Eff.ARROW + | FBY_n -> mk_by_pos_op Eff.FBY + | CONCAT_n -> mk_by_pos_op Eff.CONCAT + | TUPLE_n -> mk_by_pos_op Eff.TUPLE + | ARRAY_n -> + let vel_eff = List.map (translate_val_exp id_solver) vel in + CallByPosEff(flagit (Eff.ARRAY vel_eff) lxm, OperEff []) + + | WITH_n(c,e1,e2) -> + let c_eff = EvalConst.f id_solver c in + if c_eff = [ Bool_const_eff true ] then + mk_by_pos_op (Eff.WITH (translate_val_exp id_solver e1)) + else + mk_by_pos_op (Eff.WITH (translate_val_exp id_solver e2)) + | STRUCT_ACCESS_n id -> mk_by_pos_op (Eff.STRUCT_ACCESS id) + + | WHEN_n Base -> mk_by_pos_op (Eff.WHEN Base) + | WHEN_n (NamedClock { it = (cc,cv) ; src = lxm }) -> + let cc = + try + match Ident.pack_of_idref cc with + | Some _ -> cc + | None -> + let id = Ident.of_idref cc in + let pn = + SymbolTab.find_pack_of_const id_solver.symbols id lxm + in + Ident.make_idref pn id + with _ -> cc (* raise en error? *) + in + mk_by_pos_op (Eff.WHEN (NamedClock { it = (cc,cv) ; src = lxm })) + + | ARRAY_ACCES_n ve_index -> + let teff = + assert (List.length vel = 1); + EvalType.f id_solver (translate_val_exp id_solver (List.hd vel)) + in + let size, teff_elt = + match teff with + | [Array_type_eff(teff_elt, size)] -> size, teff_elt + | _ -> + raise (Compile_error( + lxm, "\n*** Type error: '" ^ + (LicDump.string_of_type_eff_list teff) ^ + "' was expected to be an array")) + in + mk_by_pos_op ( + Eff.ARRAY_ACCES( + EvalConst.eval_array_index id_solver ve_index size lxm, + teff_elt + )) + + | ARRAY_SLICE_n si -> + let teff = + assert (List.length vel = 1); + EvalType.f id_solver (translate_val_exp id_solver (List.hd vel)) + in + let size, teff_elt = + match teff with + | [Array_type_eff(teff_elt, size)] -> size, teff_elt + | _ -> + raise (Compile_error( + lxm, "\n*** Type error: '" ^ + (LicDump.string_of_type_eff_list teff) ^ + "' was expected to be an array")) + in + mk_by_pos_op + (Eff.ARRAY_SLICE( + EvalConst.eval_array_slice id_solver si size lxm, teff_elt)) + + | HAT_n -> ( + match vel with + | [exp; ve_size] -> + let size_const_eff = EvalConst.f id_solver ve_size + and exp_eff = translate_val_exp id_solver exp in + (match size_const_eff with + | [Int_const_eff size] -> + mk_by_pos_op (Eff.HAT(size, exp_eff)) + | _ -> assert false) + | _ -> assert false + ) + + | MERGE_n(id, idl) -> mk_by_pos_op (Eff.MERGE(id, idl)) + + and translate_by_name_op id_solver op = match op.it with | STRUCT_anonymous_n -> STRUCT_anonymous @@ -386,120 +515,6 @@ and (translate_iteror: Eff.id_solver -> SyntaxTreeCore.by_pos_op -> Lxm.t -> | _ -> assert false -and (translate_by_pos_op : Eff.id_solver -> SyntaxTreeCore.by_pos_op srcflagged -> - SyntaxTreeCore.val_exp list -> Eff.by_pos_op) = - fun id_solver {it=by_pos_op;src=lxm} args -> - match by_pos_op with - (* put that in another module ? yes, see above.*) - | Predef_n(Map, _) - | Predef_n(Fill, _) - | Predef_n(Red, _) - | Predef_n(FillRed, _) - | Predef_n(BoolRed, _) -> translate_iteror id_solver by_pos_op lxm - - (* other predef operators *) - | Predef_n(op, args) -> assert (args=[]); Predef (op,[]) - - | CALL_n node_exp_f -> - Eff.CALL (flagit (node id_solver node_exp_f) node_exp_f.src) - - | IDENT_n idref -> ( - try - match Ident.pack_of_idref idref with - | Some pn -> Eff.IDENT idref - (* Constant with a pack name are treated as - IDENT_eff. Indeed, I do not see any means to - know if an idref denotes a constant or not, since - the SymbolTab tables are indexed by - Ident.t... Anyway, CONST_eff was introduced - precisely to handle idref constants with no pack - name, so handling idref with a pack name as - before should be ok (albeit being quite - inelegant). *) - | None -> - let id = Ident.of_idref idref in - let pn = SymbolTab.find_pack_of_const id_solver.symbols id lxm in - Eff.CONST (idref, pn) - with _ -> Eff.IDENT idref - ) - | CURRENT_n -> Eff.CURRENT - | PRE_n -> Eff.PRE - - | ARROW_n -> Eff.ARROW - | FBY_n -> Eff.FBY - | CONCAT_n -> Eff.CONCAT - | TUPLE_n -> Eff.TUPLE - | ARRAY_n -> Eff.ARRAY - | WITH_n(c,e1,e2) -> - let c_eff = EvalConst.f id_solver c in - if c_eff = [ Bool_const_eff true ] then - Eff.WITH (translate_val_exp id_solver e1) - else - Eff.WITH (translate_val_exp id_solver e2) - | STRUCT_ACCESS_n id -> Eff.STRUCT_ACCESS id - - | WHEN_n Base -> Eff.WHEN Base - | WHEN_n (NamedClock { it = (cc,cv) ; src = lxm }) -> - let cc = - try - match Ident.pack_of_idref cc with - | Some _ -> cc - | None -> - let id = Ident.of_idref cc in - let pn = SymbolTab.find_pack_of_const id_solver.symbols id lxm in - Ident.make_idref pn id - with _ -> cc (* raise en error? *) - in - Eff.WHEN (NamedClock { it = (cc,cv) ; src = lxm }) - - | ARRAY_ACCES_n ve_index -> - let teff = - assert (List.length args = 1); - EvalType.f id_solver (translate_val_exp id_solver (List.hd args)) - in - let size, teff_elt = - match teff with - | [Array_type_eff(teff_elt, size)] -> size, teff_elt - | _ -> - raise (Compile_error( - lxm, "\n*** Type error: '" ^ - (LicDump.string_of_type_eff_list teff) ^ - "' was expected to be an array")) - in - Eff.ARRAY_ACCES( - EvalConst.eval_array_index id_solver ve_index size lxm, - teff_elt - ) - - | ARRAY_SLICE_n si -> - let teff = - assert (List.length args = 1); - EvalType.f id_solver (translate_val_exp id_solver (List.hd args)) - in - let size, teff_elt = - match teff with - | [Array_type_eff(teff_elt, size)] -> size, teff_elt - | _ -> - raise (Compile_error( - lxm, "\n*** Type error: '" ^ - (LicDump.string_of_type_eff_list teff) ^ - "' was expected to be an array")) - in - Eff.ARRAY_SLICE(EvalConst.eval_array_slice id_solver si size lxm, - teff_elt) - - | HAT_n -> ( - match args with - | [exp; ve_size] -> - let size_const_eff = EvalConst.f id_solver ve_size - and exp_eff = translate_val_exp id_solver exp in - (match size_const_eff with - | [Int_const_eff size] -> Eff.HAT(size, exp_eff) - | _ -> assert false) - | _ -> assert false - ) - - | MERGE_n(id, idl) -> Eff.MERGE(id, idl) and (translate_slice_info : Eff.id_solver -> SyntaxTreeCore.slice_info -> int -> diff --git a/src/ident.ml b/src/ident.ml index a5b2ebdc4b8d5a795b433ebaf2f36f5cf4c8f62a..b43b9535854ba7c207cc5e1c92087037ed39b0ad 100644 --- a/src/ident.ml +++ b/src/ident.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 15/09/2008 (at 17:25) by Erwan Jahier> *) +(** Time-stamp: <modified the 24/11/2008 (at 17:09) by Erwan Jahier> *) (* J'ai appele ca symbol (mais ca remplace le ident) : c'est juste une couche qui garantit l'unicite en memoire @@ -131,6 +131,10 @@ let (long_of_idref : idref -> long) = Some p -> (p, name_of_idref idr) | None -> (!dft_pack_name, name_of_idref idr) +let (idref_of_long : long -> idref) = + fun (pn,id) -> + { id_pack = Some pn ; id_id = id } + let (make_idref : pack_name -> t -> idref) = fun pn id -> { id_pack = Some pn ; id_id = id } diff --git a/src/ident.mli b/src/ident.mli index 974466ca0f76d985d6c1c7f2a738b85ae3a60c63..7d8eeb6a9ac5f615488d2e5369d3e49981d751f6 100644 --- a/src/ident.mli +++ b/src/ident.mli @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 15/09/2008 (at 17:55) by Erwan Jahier> *) +(** Time-stamp: <modified the 24/11/2008 (at 17:10) by Erwan Jahier> *) type t @@ -54,6 +54,7 @@ val pack_of_idref : idref -> pack_name option SyntaxTree.idref *) val long_of_idref : idref -> long +val idref_of_long : long -> idref type clk = idref * t (* The Clock constructor, and the clock variable. diff --git a/src/licDump.ml b/src/licDump.ml index fdd6eb9f7c1166eba5320746a8b6400805e0f778..70867feb278bb3cbe95faca985603cdb17777dd0 100644 --- a/src/licDump.ml +++ b/src/licDump.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 20/11/2008 (at 15:25) by Erwan Jahier> *) +(** Time-stamp: <modified the 25/11/2008 (at 14:08) by Erwan Jahier> *) open Printf open Lxm @@ -84,7 +84,7 @@ let rec string_of_const_eff = ( (string_of_type_eff t)^"{"^(String.concat "; " flst)^"}" ) | Array_const_eff (ctab, t) -> ( - let vl = Array.to_list(Array.map string_of_const_eff ctab) in + let vl = List.map string_of_const_eff ctab in "["^(String.concat ", " vl)^"]" ) ) @@ -385,7 +385,7 @@ and (string_of_by_pos_op_eff: Eff.by_pos_op srcflagged -> Eff.val_exp list -> st | CONCAT, [ve1; ve2] -> (string_of_val_exp_eff ve1) ^ " | " ^ (string_of_val_exp_eff ve2) | HAT (i, ve), _ -> (string_of_val_exp_eff ve) ^ "^" ^ (string_of_int i) - | ARRAY, _ -> tuple_square vel + | ARRAY vel, _ -> tuple_square vel | STRUCT_ACCESS(id), [ve1] -> (string_of_val_exp_eff ve1) ^ "." ^ (Ident.to_string id) diff --git a/src/split.ml b/src/split.ml index 2d6930114da9669a12edeb83e1a7ec92ab65cfe5..18b050058e8ba5f079a50b526e2ed14080b038ab 100644 --- a/src/split.ml +++ b/src/split.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 21/11/2008 (at 14:43) by Erwan Jahier> *) +(** Time-stamp: <modified the 25/11/2008 (at 14:47) by Erwan Jahier> *) open Lxm @@ -199,6 +199,11 @@ and (split_val_exp : bool -> Eff.local_env -> Eff.val_exp -> Eff.val_exp * split let rhs = CallByPosEff(by_pos_op_eff, OperEff vel) in rhs, (eql, vl) + | Eff.ARRAY vel -> + let vel, (eql, vl) = split_val_exp_list false node_env vel in + let by_pos_op_eff = Lxm.flagit (Eff.ARRAY(vel)) lxm in + let rhs = CallByPosEff(by_pos_op_eff, OperEff []) in + rhs, (eql, vl) | _ -> let vel, (eql, vl) = split_val_exp_list false node_env vel in let rhs = CallByPosEff(by_pos_op_eff, OperEff vel) in diff --git a/src/test/test.res.exp b/src/test/test.res.exp index e82ea64a435626531b8116c75f94e91be015b371..da5cb2393e86e4917a0d990d5e4d19f843c526fb 100644 --- a/src/test/test.res.exp +++ b/src/test/test.res.exp @@ -102,8 +102,10 @@ tel function Int8::incr(x:A_bool_8) returns (incr:A_bool_8); var co:bool; + _v1:A_bool_8; let - (co, incr) = fillred<<Int8::fulladd, 8>>(true, x, Int8::zero); + (co, incr) = fillred<<Int8::fulladd, 8>>(true, x, _v1); + _v1 = [false, false, false, false, false, false, false, false]; tel -- end of node Int8::incr function Int8::add(x:A_bool_8; y:A_bool_8) returns (sum:A_bool_8); @@ -1839,14 +1841,14 @@ let _v7 = _v5 or _v6; _v8 = pre tps_vigilence; _v9 = _v8 = 0; - tps_vigilence = alarme::decompte(_v12, alarme::delai_vigilence, _v15); + tps_vigilence = alarme::decompte(_v12, 3, _v15); _v10 = alarme::edge(en_marche); _v11 = alarme::edge(demande_entree); _v12 = _v10 or _v11; _v13 = pre tps_vigilence; _v14 = _v13 > 0; _v15 = en_marche and _v14; - tps_alarme = alarme::decompte(_v16, alarme::delai_alarme, _v20); + tps_alarme = alarme::decompte(_v16, 6, _v20); _v16 = alarme::edge(alarme); _v17 = pre alarme; _v18 = pre tps_alarme; @@ -1859,7 +1861,7 @@ let _v24 = _v21 and _v23; _v25 = pre tps_reprise; _v26 = _v25 = 0; - tps_reprise = alarme::decompte(_v27, alarme::delai_reprise, _v31); + tps_reprise = alarme::decompte(_v27, 4, _v31); _v27 = alarme::edge(reprise); _v28 = pre reprise; _v29 = tps_reprise > 0; @@ -2532,10 +2534,10 @@ let y0 = 0.; x = x0 + _v2; _v1 = deconne::sin(teta); - _v2 = deconne::L * _v1; + _v2 = 2.0 * _v1; y = y0 + _v4; _v3 = deconne::cos(teta); - _v4 = deconne::L * _v3; + _v4 = 2.0 * _v3; p = deconne::make_pend(x0, y0, x, y); tel -- end of node deconne::deconne @@ -7206,8 +7208,8 @@ var _v2:int; _v3:int; let - z = cst::i + cst::j; - t = cst::j - cst::k; + z = 1 + 1; + t = 1 - 1; y = _v2 + _v3; _v1 = 2 * z; _v2 = x + _v1; @@ -7240,7 +7242,7 @@ type A_int_3 = int^3; Opening file should_work/NONREG/param_node2.lus node param_node2::mk_tab_int_0_3(a:int) returns (res:A_int_3); let - res = init^3; + res = 0^3; tel -- end of node param_node2::mk_tab_int_0_3 node param_node2::tab_int3(a:int) returns (res:A_int_3); @@ -7250,7 +7252,7 @@ tel -- end of node param_node2::tab_int3 node param_node2::mk_tab_bool_true_4(a:bool) returns (res:A_bool_4); let - res = init^4; + res = true^4; tel -- end of node param_node2::mk_tab_bool_true_4 node param_node2::tab_bool4(a:bool) returns (res:A_bool_4); @@ -7262,6 +7264,58 @@ tel type A_bool_4 = bool^4; type A_int_3 = int^3; +---------------------------------------------------------------------- +====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/param_node3.lus +Opening file should_work/NONREG/param_node3.lus +node param_node3::mk_tab_int_0_3(a:int) returns (res:A_int_3); +let + res = 0^3; +tel +-- end of node param_node3::mk_tab_int_0_3 +node param_node3::titi_int(a:int) returns (res:A_int_3); +let + res = param_node3::mk_tab_int_0_3(a); +tel +-- end of node param_node3::titi_int +node param_node3::xxx(a:int) returns (res:A_int_3); +let + res = param_node3::titi_int(a); +tel +-- end of node param_node3::xxx +-- automatically defined aliases: +type A_int_3 = int^3; + +---------------------------------------------------------------------- +====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/param_struct.lus +Opening file should_work/NONREG/param_struct.lus +type _param_struct::toto = struct {a : int; b : int}; +const param_struct::c = _param_struct::toto{a = 1; b = 1}; + +node param_struct::mk_tab__param_struct::toto__param_struct::toto{a = 1; + b = 1}_3( + a:_param_struct::toto) +returns ( + res:A__param_struct::toto_3); +var + _v1:_param_struct::toto; +let + res = _v1^3; + _v1 = _param_struct::toto{a=1;b=1}; +tel +-- end of node param_struct::mk_tab__param_struct::toto__param_struct::toto{a = 1; b = 1}_3 + +node param_struct::tab_toto( + a:_param_struct::toto) +returns ( + res:A__param_struct::toto_3); +let + res = param_struct::mk_tab__param_struct::toto__param_struct::toto{a = 1; + b = 1}_3(a); +tel +-- end of node param_struct::tab_toto +-- automatically defined aliases: +type A__param_struct::toto_3 = _param_struct::toto^3; + ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/patrick.lus Opening file should_work/NONREG/patrick.lus @@ -7530,7 +7584,7 @@ node test::toto(x:bool) returns (y:bool); var _v1:bool; let - y = _v1 and test::c; + y = _v1 and true; _v1 = test::tutu(x); tel -- end of node test::toto @@ -8058,7 +8112,7 @@ var let ok = true -> _v3; _v1 = pre T; - _v2 = heater_control::TMAX - 6.0; + _v2 = 9.0 - 6.0; _v3 = _v1 < _v2; tel -- end of node heater_control::not_a_sauna2 @@ -8227,16 +8281,16 @@ var _v24:bool; _v25:bool; let - V12 = _v2 < heater_control::DELTA; + V12 = _v2 < 0.5; _v1 = T1 - T2; _v2 = heater_control::abs(_v1); - V13 = _v4 < heater_control::DELTA; + V13 = _v4 < 0.5; _v3 = T1 - T3; _v4 = heater_control::abs(_v3); - V23 = _v6 < heater_control::DELTA; + V23 = _v6 < 0.5; _v5 = T2 - T3; _v6 = heater_control::abs(_v5); - Tguess = if _v7 then heater_control::FAILURE else _v18; + Tguess = if _v7 then -999.0 else _v18; _v7 = heater_control::noneoftree(V12, V13, V23); _v8 = heater_control::oneoftree(V12, V13, V23); _v9 = heater_control::Median(T1, T2, T3); @@ -8250,9 +8304,9 @@ let _v17 = if _v10 then _v11 else _v16; _v18 = if _v8 then _v9 else _v17; Heat_on = true -> _v25; - _v19 = Tguess = heater_control::FAILURE; - _v20 = Tguess < heater_control::TMIN; - _v21 = Tguess > heater_control::TMAX; + _v19 = Tguess = -999.0; + _v20 = Tguess < 6.0; + _v21 = Tguess > 9.0; _v22 = pre Heat_on; _v23 = if _v21 then false else _v22; _v24 = if _v20 then true else _v23; @@ -8275,7 +8329,7 @@ var let ok = true -> _v3; _v1 = pre T; - _v2 = heater_control::TMAX + 1.0; + _v2 = 9.0 + 1.0; _v3 = _v1 < _v2; tel -- end of node heater_control::not_a_sauna @@ -8889,7 +8943,7 @@ let _v3 = pre cpt_roll; _v4 = _v3 - 1; _v5 = if _v2 then _v4 else 0; - _v6 = if three_roll then onlyroll::SAFE_COUNTER_TIME else _v5; + _v6 = if three_roll then 3 else _v5; zero_roll = onlyroll::noneof(f1, f2, f3, f4); one_roll = onlyroll::oneoffour(f1, f2, f3, f4); two_roll = onlyroll::twooffour(f1, f2, f3, f4); @@ -8904,7 +8958,7 @@ let _v13 = cpt_roll = 0; _v14 = two_roll and _v13; _v15 = onlyroll::Average(x1, x2, x3, x4, f1, f2, f3, f4); - _v16 = if _v14 then _v15 else onlyroll::FAIL_SAFE_ROLL_VALUE; + _v16 = if _v14 then _v15 else 1.0; _v17 = if _v11 then _v12 else _v16; tel -- end of node onlyroll::Calculate @@ -8951,8 +9005,8 @@ let inline_monitor_failed = _v4 or disc; _v1 = xa - xb; _v2 = onlyroll::abs(_v1); - _v3 = _v2 > onlyroll::DELTA_ROLL; - _v4 = onlyroll::maintain(onlyroll::TIME_ROLL, _v3); + _v3 = _v2 > 14.9; + _v4 = onlyroll::maintain(3, _v3); local_value = xa; tel -- end of node onlyroll::Monitor @@ -8962,8 +9016,8 @@ var _v2:bool; let i = _v1 and _v2; - _v1 = r < onlyroll::NRmaxR; - _v2 = r > onlyroll::NRminR; + _v1 = r < 25.3; + _v2 = r > -25.3; tel -- end of node onlyroll::InNominalRange @@ -9000,16 +9054,16 @@ var _v17:bool; _v18:bool; let - one = _v2 > onlyroll::CROSS_CH_TOL_ROLL; + one = _v2 > 51.0; _v1 = xi - pxother1; _v2 = onlyroll::abs(_v1); - two = _v4 > onlyroll::CROSS_CH_TOL_ROLL; + two = _v4 > 51.0; _v3 = xi - pxother2; _v4 = onlyroll::abs(_v3); - three = _v6 > onlyroll::CROSS_CH_TOL_ROLL; + three = _v6 > 51.0; _v5 = xi - pxother3; _v6 = onlyroll::abs(_v5); - r = onlyroll::maintain(onlyroll::TIME_CROSS_ROLL, _v18); + r = onlyroll::maintain(3, _v18); _v7 = if pfother3 then false else three; _v8 = two and three; _v9 = if pfother3 then two else _v8; @@ -9475,8 +9529,8 @@ var _v2:bool; let i = _v1 or _v2; - _v1 = r > onlyroll::HORmaxR; - _v2 = r < onlyroll::HORminR; + _v1 = r > 285.0; + _v2 = r < -285.0; tel -- end of node onlyroll::InHardoverRange @@ -9673,9 +9727,16 @@ Opening file should_work/Pascal/t.lus const t::A = [[1, 1], [1, 1], [1, 1]]; const t::B = [2, 2]; node t::toto(x:bool) returns (a:A_A_int_2_3; b:A_int_2); +var + _v1:A_int_2; + _v2:A_int_2; + _v3:A_int_2; let - a = t::A; - b = t::B; + a = [_v1, _v2, _v3]; + _v1 = [1, 1]; + _v2 = [1, 1]; + _v3 = [1, 1]; + b = [2, 2]; tel -- end of node t::toto -- automatically defined aliases: @@ -10609,7 +10670,7 @@ var _v4:real; let acc_out = acc_in; - diff = _v4 > Gyroscope2::CROSS_CHANNEL_TOLERANCE; + diff = _v4 > 1.0; _v1 = acc_in.local_value; _v2 = channel.local_value; _v3 = _v1 - _v2; @@ -10939,16 +11000,13 @@ var _v5:A_real_3; let secure_values = map<<Gyroscope2::EvaluateAxis, 3>>(axis, _v1, _v2, _v3); - _v1 = [Gyroscope2::DELTA_ROLL, Gyroscope2::DELTA_PITCH, - Gyroscope2::DELTA_YAW]; - _v2 = [Gyroscope2::GOD_ROLL, Gyroscope2::GOD_PITCH, Gyroscope2::GOD_YAW]; - _v3 = [Gyroscope2::DELTA_TO_GOD_ROLL, Gyroscope2::DELTA_TO_GOD_PITCH, - Gyroscope2::DELTA_TO_GOD_YAW]; + _v1 = [2.0, 2.0, 2.0]; + _v2 = [15.0, 16.0, 14.0]; + _v3 = [2.0, 2.0, 2.0]; valid = red<<Gyroscope2::ValueIsSecureII, 3>>(true, secure_values, _v4, _v5); - _v4 = [Gyroscope2::DELTA_TO_GOD_ROLL, Gyroscope2::DELTA_TO_GOD_PITCH, - Gyroscope2::DELTA_TO_GOD_YAW]; - _v5 = [Gyroscope2::GOD_ROLL, Gyroscope2::GOD_PITCH, Gyroscope2::GOD_YAW]; + _v4 = [2.0, 2.0, 2.0]; + _v5 = [15.0, 16.0, 14.0]; tel -- end of node Gyroscope2::Gyroscope2 @@ -11024,7 +11082,7 @@ let b = alias::aliasPredefNot(a); c = alias::aliasGivenNode(0, _v3); _v1 = 0^3; - _v2 = alias::SIZE^3; + _v2 = 3^3; _v3 = map<<Lustre::iplus, 3>>(_v1, _v2); tel -- end of node alias::alias @@ -13593,7 +13651,7 @@ let _v3 = pre cpt_roll; _v4 = _v3 - 1; _v5 = if _v2 then _v4 else 0; - _v6 = if three_roll then onlyroll::SAFE_COUNTER_TIME else _v5; + _v6 = if three_roll then 3 else _v5; zero_roll = onlyroll::noneof(f1, f2, f3, f4); one_roll = onlyroll::oneoffour(f1, f2, f3, f4); two_roll = onlyroll::twooffour(f1, f2, f3, f4); @@ -13608,7 +13666,7 @@ let _v13 = cpt_roll = 0; _v14 = two_roll and _v13; _v15 = onlyroll::Average(x1, x2, x3, x4, f1, f2, f3, f4); - _v16 = if _v14 then _v15 else onlyroll::FAIL_SAFE_ROLL_VALUE; + _v16 = if _v14 then _v15 else 1.0; _v17 = if _v11 then _v12 else _v16; tel -- end of node onlyroll::Calculate @@ -13655,8 +13713,8 @@ let inline_monitor_failed = _v4 or disc; _v1 = xa - xb; _v2 = onlyroll::abs(_v1); - _v3 = _v2 > onlyroll::DELTA_ROLL; - _v4 = onlyroll::maintain(onlyroll::TIME_ROLL, _v3); + _v3 = _v2 > 14.9; + _v4 = onlyroll::maintain(3, _v3); local_value = xa; tel -- end of node onlyroll::Monitor @@ -13666,8 +13724,8 @@ var _v2:bool; let i = _v1 and _v2; - _v1 = r < onlyroll::NRmaxR; - _v2 = r > onlyroll::NRminR; + _v1 = r < 25.3; + _v2 = r > -25.3; tel -- end of node onlyroll::InNominalRange @@ -13704,16 +13762,16 @@ var _v17:bool; _v18:bool; let - one = _v2 > onlyroll::CROSS_CH_TOL_ROLL; + one = _v2 > 51.0; _v1 = xi - pxother1; _v2 = onlyroll::abs(_v1); - two = _v4 > onlyroll::CROSS_CH_TOL_ROLL; + two = _v4 > 51.0; _v3 = xi - pxother2; _v4 = onlyroll::abs(_v3); - three = _v6 > onlyroll::CROSS_CH_TOL_ROLL; + three = _v6 > 51.0; _v5 = xi - pxother3; _v6 = onlyroll::abs(_v5); - r = onlyroll::maintain(onlyroll::TIME_CROSS_ROLL, _v18); + r = onlyroll::maintain(3, _v18); _v7 = if pfother3 then false else three; _v8 = two and three; _v9 = if pfother3 then two else _v8; @@ -14185,8 +14243,8 @@ var _v2:bool; let i = _v1 or _v2; - _v1 = r > onlyroll::HORmaxR; - _v2 = r < onlyroll::HORminR; + _v1 = r > 285.0; + _v2 = r < -285.0; tel -- end of node onlyroll::InHardoverRange @@ -14708,7 +14766,7 @@ let _v3 = pre cpt_roll; _v4 = _v3 - 1; _v5 = if _v2 then _v4 else 0; - _v6 = if three_roll then onlyroll2::SAFE_COUNTER_TIME else _v5; + _v6 = if three_roll then 3 else _v5; zero_roll = onlyroll2::noneof(f1, f2, f3, f4); one_roll = onlyroll2::oneoffour(f1, f2, f3, f4); two_roll = onlyroll2::twooffour(f1, f2, f3, f4); @@ -14723,7 +14781,7 @@ let _v13 = cpt_roll = 0; _v14 = two_roll and _v13; _v15 = onlyroll2::Average(x1, x2, x3, x4, f1, f2, f3, f4); - _v16 = if _v14 then _v15 else onlyroll2::FAIL_SAFE_ROLL_VALUE; + _v16 = if _v14 then _v15 else 1.0; _v17 = if _v11 then _v12 else _v16; tel -- end of node onlyroll2::Calculate @@ -14770,8 +14828,8 @@ let inline_monitor_failed = _v4 or disc; _v1 = xa - xb; _v2 = onlyroll2::abs(_v1); - _v3 = _v2 > onlyroll2::DELTA_ROLL; - _v4 = onlyroll2::maintain(onlyroll2::TIME_ROLL, _v3); + _v3 = _v2 > 14.9; + _v4 = onlyroll2::maintain(3, _v3); local_value = xa; tel -- end of node onlyroll2::Monitor @@ -14781,8 +14839,8 @@ var _v2:bool; let i = _v1 and _v2; - _v1 = r < onlyroll2::NRmaxR; - _v2 = r > onlyroll2::NRminR; + _v1 = r < 25.3; + _v2 = r > -25.3; tel -- end of node onlyroll2::InNominalRange @@ -14819,16 +14877,16 @@ var _v17:bool; _v18:bool; let - one = _v2 > onlyroll2::CROSS_CH_TOL_ROLL; + one = _v2 > 51.0; _v1 = xi - pxother1; _v2 = onlyroll2::abs(_v1); - two = _v4 > onlyroll2::CROSS_CH_TOL_ROLL; + two = _v4 > 51.0; _v3 = xi - pxother2; _v4 = onlyroll2::abs(_v3); - three = _v6 > onlyroll2::CROSS_CH_TOL_ROLL; + three = _v6 > 51.0; _v5 = xi - pxother3; _v6 = onlyroll2::abs(_v5); - r = onlyroll2::maintain(onlyroll2::TIME_CROSS_ROLL, _v18); + r = onlyroll2::maintain(3, _v18); _v7 = if pfother3 then false else three; _v8 = two and three; _v9 = if pfother3 then two else _v8; @@ -15300,8 +15358,8 @@ var _v2:bool; let i = _v1 or _v2; - _v1 = r > onlyroll2::HORmaxR; - _v2 = r < onlyroll2::HORminR; + _v1 = r > 285.0; + _v2 = r < -285.0; tel -- end of node onlyroll2::InHardoverRange @@ -15744,7 +15802,7 @@ var _v9:real; _v10:real; let - maintain = Gyroscope::Maintain(Gyroscope::TIME, _v5); + maintain = Gyroscope::Maintain(3, _v5); _v1 = inChannel.valuea; _v2 = inChannel.valueb; _v3 = _v1 - _v2; @@ -15860,16 +15918,13 @@ var _v5:A_real_3; let secure_values = map<<Gyroscope::EvaluateAxis, 3>>(axis, _v1, _v2, _v3); - _v1 = [Gyroscope::DELTA_ROLL, Gyroscope::DELTA_PITCH, - Gyroscope::DELTA_YAW]; - _v2 = [Gyroscope::GOD_ROLL, Gyroscope::GOD_PITCH, Gyroscope::GOD_YAW]; - _v3 = [Gyroscope::DELTA_TO_GOD_ROLL, Gyroscope::DELTA_TO_GOD_PITCH, - Gyroscope::DELTA_TO_GOD_YAW]; + _v1 = [2.0, 2.0, 2.0]; + _v2 = [15.0, 16.0, 14.0]; + _v3 = [2.0, 2.0, 2.0]; valid = red<<Gyroscope::ValueIsSecureII, 3>>(true, secure_values, _v4, _v5); - _v4 = [Gyroscope::DELTA_TO_GOD_ROLL, Gyroscope::DELTA_TO_GOD_PITCH, - Gyroscope::DELTA_TO_GOD_YAW]; - _v5 = [Gyroscope::GOD_ROLL, Gyroscope::GOD_PITCH, Gyroscope::GOD_YAW]; + _v4 = [2.0, 2.0, 2.0]; + _v5 = [15.0, 16.0, 14.0]; tel -- end of node Gyroscope::Gyroscope @@ -16152,7 +16207,7 @@ let _v7 = _v5 >= _v6; _v8 = acc_in.actual_rank; _v9 = acc_in.rank; - _v10 = _v9 + produitBool::size; + _v10 = _v9 + 10; _v11 = _v8 < _v10; _v12 = _v7 and _v11; _v13 = acc_in.actual_rank; @@ -16313,7 +16368,7 @@ let _v7 = _v5 >= _v6; _v8 = i_acc_in.actual_rank; _v9 = i_acc_in.rank; - _v10 = _v9 + shiftFill_ludic::c_size; + _v10 = _v9 + 10; _v11 = _v8 < _v10; _v12 = _v7 and _v11; _v13 = i_acc_in.actual_rank; @@ -16422,7 +16477,7 @@ let _v7 = _v5 >= _v6; _v8 = i_acc_in.actual_rank; _v9 = i_acc_in.rank; - _v10 = _v9 + shift_ludic::c_size; + _v10 = _v9 + 10; _v11 = _v8 < _v10; _v12 = _v7 and _v11; _v13 = i_acc_in.actual_rank; @@ -17236,7 +17291,7 @@ returns ( var Vide:A_int_20; let - Vide = normal::COM_ERR^20; + Vide = 0^20; TabComChg = red<<normal::fusion_tab_com, 4>>(Vide, AllTabComChg, AllTabComVal); tel @@ -17824,7 +17879,7 @@ returns ( var Vide:A_int_20; let - Vide = testSilus::COM_ERR^20; + Vide = 0^20; TabComChg = red<<testSilus::fusion_tab_com, 4>>(Vide, AllTabComChg, AllTabComVal); tel @@ -19254,7 +19309,7 @@ let obool = Pbool::n(true, _v1); _v1 = i < 50; oreal = Preal::n(0., _v4); - _v2 = main::pi * ray; + _v2 = 3.14159 * ray; _v3 = _v2 * ray; _v4 = 0. -> _v3; tel @@ -19427,7 +19482,7 @@ let d = 0.0 -> _v3; _v1 = pre x; _v2 = x - _v1; - _v3 = _v2 / asservi::T; + _v3 = _v2 / 0.1; tel -- end of node asservi::D extern function asservi::sin(x:real) returns (y:real); @@ -19439,7 +19494,7 @@ var _v3:real; let x = 0.0 -> _v3; - _v1 = asservi::T * dx; + _v1 = 0.1 * dx; _v2 = _v1 + x; _v3 = pre _v2; tel @@ -19453,7 +19508,7 @@ var let dx = asservi::I(d2x); x = dx -> _v3; - _v1 = asservi::T * dx; + _v1 = 0.1 * dx; _v2 = pre x; _v3 = _v1 + _v2; tel @@ -19470,12 +19525,12 @@ var let teta = asservi::I2(_v7); _v1 = asservi::sin(teta); - _v2 = d2y0 + asservi::G; + _v2 = d2y0 + 10.0; _v3 = _v1 * _v2; _v4 = asservi::cos(teta); _v5 = _v4 * d2x0; _v6 = _v3 - _v5; - _v7 = _v6 / asservi::L; + _v7 = _v6 / 2.0; tel -- end of node asservi::PEND @@ -19507,10 +19562,10 @@ let teta = asservi::PEND(d2x0, d2y0); x = x0 + _v4; _v3 = asservi::sin(teta); - _v4 = asservi::L * _v3; + _v4 = 2.0 * _v3; y = y0 + _v6; _v5 = asservi::cos(teta); - _v6 = asservi::L * _v5; + _v6 = 2.0 * _v5; p = asservi::make_pend(x0, y0, x, y); tel -- end of node asservi::jeu @@ -19546,28 +19601,28 @@ var let d2y0 = 0.0; d2x0 = delta -> _v14; - _v1 = 8.0 * asservi::G; + _v1 = 8.0 * 10.0; _v2 = asservi::sin(teta); _v3 = _v1 * _v2; _v4 = asservi::cos(teta); _v5 = _v3 / _v4; - _v6 = 1.0 * asservi::G; - _v7 = _v6 * asservi::L; + _v6 = 1.0 * 10.0; + _v7 = _v6 * 2.0; _v8 = asservi::sqrt(_v7); _v9 = asservi::D(teta); _v10 = _v8 * _v9; _v11 = _v5 + _v10; _v12 = 0.5 * x0; - _v13 = _v12 / asservi::L; + _v13 = _v12 / 2.0; _v14 = _v11 + _v13; teta = asservi::PEND(_v15, d2y0); _v15 = delta -> d2x0; x = x0 + _v17; _v16 = asservi::sin(teta); - _v17 = asservi::L * _v16; + _v17 = 2.0 * _v16; y = y0 + _v19; _v18 = asservi::cos(teta); - _v19 = asservi::L * _v18; + _v19 = 2.0 * _v18; x0 = asservi::I2(d2x0); y0 = asservi::I2(d2y0); p = asservi::make_pend(x0, y0, x, y); @@ -19880,7 +19935,7 @@ let _v3 = bug::once_from_to(action, begin, en); intO = _v5 -> intI; realO = _v7 -> _v9; - _v4 = bug::ze_const_int + x; + _v4 = 5 + x; _v5 = _v4 + y; _v6 = 10.0 - 10.0; _v7 = _v6 - 10.0;